From 3c8f7c89459b60ff1fb34e58c9debc190c1a97d7 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Tue, 14 Apr 2026 13:32:53 +0000 Subject: [PATCH 1/7] Changes before error encountered Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/9f82a7b9-1e72-4933-9f6a-3dfebc52f516 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- apps/server/objectstack.config.ts | 46 ++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/apps/server/objectstack.config.ts b/apps/server/objectstack.config.ts index 0e483b00c..e91cd5a7c 100644 --- a/apps/server/objectstack.config.ts +++ b/apps/server/objectstack.config.ts @@ -4,6 +4,7 @@ import { defineStack } from '@objectstack/spec'; import { AppPlugin, DriverPlugin } from '@objectstack/runtime'; import { ObjectQLPlugin } from '@objectstack/objectql'; import { InMemoryDriver } from '@objectstack/driver-memory'; +import { TursoDriver } from '@objectstack/driver-turso'; import { AuthPlugin } from '@objectstack/plugin-auth'; import CrmApp from '../../examples/app-crm/objectstack.config'; import TodoApp from '../../examples/app-todo/objectstack.config'; @@ -31,13 +32,34 @@ export default defineStack({ description: 'Production server aggregating CRM, Todo and BI plugins', type: 'app', }, - + + // Datasource Mapping Configuration + // Routes different namespaces to different datasources for optimal performance + datasourceMapping: [ + // Example apps use in-memory driver for fast, ephemeral data + { namespace: 'crm', datasource: 'memory' }, + { namespace: 'todo', datasource: 'memory' }, + { namespace: 'bi', datasource: 'memory' }, + // System objects use Turso for persistent, production-grade storage + { namespace: 'sys', datasource: 'turso' }, + // Default fallback to memory driver + { default: true, datasource: 'memory' }, + ], + // Explicitly Load Plugins and Apps // The Runtime CLI will iterate this list and call kernel.use() plugins: [ new ObjectQLPlugin(), - // Register Default Driver (Memory) - new DriverPlugin(new InMemoryDriver()), + // Register Memory Driver for example apps (volatile, fast) + new DriverPlugin(new InMemoryDriver(), { name: 'memory' }), + // Register Turso Driver for system objects (persistent, production) + new DriverPlugin( + new TursoDriver({ + url: process.env.TURSO_DATABASE_URL ?? 'file:./data/server.db', + authToken: process.env.TURSO_AUTH_TOKEN, + }), + { name: 'turso' } + ), // Authentication — required for production (Vercel) deployments authPlugin, // Wrap Manifests/Stacks in AppPlugin adapter @@ -100,10 +122,26 @@ export const PreviewHostExample = defineStack({ type: 'app', }, + // Same datasource mapping as standard server + datasourceMapping: [ + { namespace: 'crm', datasource: 'memory' }, + { namespace: 'todo', datasource: 'memory' }, + { namespace: 'bi', datasource: 'memory' }, + { namespace: 'sys', datasource: 'turso' }, + { default: true, datasource: 'memory' }, + ], + // Same plugins as the standard host plugins: [ new ObjectQLPlugin(), - new DriverPlugin(new InMemoryDriver()), + new DriverPlugin(new InMemoryDriver(), { name: 'memory' }), + new DriverPlugin( + new TursoDriver({ + url: process.env.TURSO_DATABASE_URL ?? 'file:./data/server.db', + authToken: process.env.TURSO_AUTH_TOKEN, + }), + { name: 'turso' } + ), authPlugin, new AppPlugin(CrmApp), new AppPlugin(TodoApp), From 5cd6c830bb6aeac191db987970a346e87d05840c Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Tue, 14 Apr 2026 13:42:26 +0000 Subject: [PATCH 2/7] feat(server): Configure Vercel deployment with dual-driver setup (Turso + InMemory) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add InMemoryDriver alongside TursoDriver for example apps - Configure datasource mapping: example apps (crm/todo/bi) → memory, system → turso - Mark @libsql/client as external in bundle-api.mjs for native binaries - Add .npmrc with node-linker=hoisted for Vercel compatibility - Update build-vercel.sh to copy @libsql/client and better-sqlite3 native modules - Update vercel.json to include native modules in function deployment package - Make Turso credentials optional (fallback to file-based SQLite for local dev) Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/a39e186a-367a-4f31-b27e-0dcf46dfcb96 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com> --- apps/server/.npmrc | 3 +++ apps/server/scripts/build-vercel.sh | 41 +++++++++++++++++++++++++++-- apps/server/scripts/bundle-api.mjs | 5 +++- apps/server/server/index.ts | 28 +++++++++++++++++--- apps/server/vercel.json | 6 ++++- 5 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 apps/server/.npmrc diff --git a/apps/server/.npmrc b/apps/server/.npmrc new file mode 100644 index 000000000..ff33604d5 --- /dev/null +++ b/apps/server/.npmrc @@ -0,0 +1,3 @@ +# pnpm configuration for Vercel deployment +# Use hoisted node_modules instead of symlinks to avoid Vercel packaging issues +node-linker=hoisted diff --git a/apps/server/scripts/build-vercel.sh b/apps/server/scripts/build-vercel.sh index 20b624f59..743b921e4 100755 --- a/apps/server/scripts/build-vercel.sh +++ b/apps/server/scripts/build-vercel.sh @@ -12,7 +12,8 @@ set -euo pipefail # Steps: # 1. Build the project with turbo (includes studio) # 2. Bundle the API serverless function (→ api/_handler.js) -# 3. Copy studio dist files to public/ for UI serving +# 3. Copy native/external modules into local node_modules for Vercel packaging +# 4. Copy studio dist files to public/ for UI serving echo "[build-vercel] Starting server build..." @@ -25,7 +26,43 @@ cd apps/server # 2. Bundle API serverless function node scripts/bundle-api.mjs -# 3. Copy studio dist files to public/ for UI serving +# 3. Copy native/external modules into local node_modules for Vercel packaging. +# +# This monorepo uses pnpm's default strict node_modules structure. External +# dependencies marked in bundle-api.mjs (@libsql/client, better-sqlite3) only +# exist in the monorepo root's node_modules/.pnpm/ virtual store. +# +# The vercel.json includeFiles pattern references node_modules/ relative to +# apps/server/, so we must copy the actual module files here for Vercel to +# include them in the serverless function's deployment package. +echo "[build-vercel] Copying external native modules to local node_modules..." +for mod in "@libsql/client" better-sqlite3; do + src="../../node_modules/$mod" + if [ -e "$src" ]; then + dest="node_modules/$mod" + mkdir -p "$(dirname "$dest")" + cp -rL "$src" "$dest" + echo "[build-vercel] ✓ Copied $mod" + else + echo "[build-vercel] ⚠ $mod not found at $src (skipped)" + fi +done + +# Copy native binary subdirectories for @libsql/client +if [ -d "../../node_modules/@libsql" ]; then + mkdir -p "node_modules/@libsql" + for pkg in ../../node_modules/@libsql/*/; do + pkgname="$(basename "$pkg")" + if [ "$pkgname" != "client" ]; then # client already copied above + cp -rL "$pkg" "node_modules/@libsql/$pkgname" + echo "[build-vercel] ✓ Copied @libsql/$pkgname" + fi + done +else + echo "[build-vercel] ⚠ @libsql not found (skipped)" +fi + +# 4. Copy studio dist files to public/ for UI serving echo "[build-vercel] Copying studio dist to public/..." rm -rf public mkdir -p public diff --git a/apps/server/scripts/bundle-api.mjs b/apps/server/scripts/bundle-api.mjs index 57700c855..2feeb3d2d 100644 --- a/apps/server/scripts/bundle-api.mjs +++ b/apps/server/scripts/bundle-api.mjs @@ -14,8 +14,10 @@ import { build } from 'esbuild'; -// Packages that cannot be bundled (native bindings / optional drivers) +// Packages that cannot be bundled (native bindings / platform-specific modules) const EXTERNAL = [ + // @libsql/client has platform-specific native binaries that must be external + '@libsql/client', // Optional knex database drivers — never used at runtime, but knex requires() them 'pg', 'pg-native', @@ -23,6 +25,7 @@ const EXTERNAL = [ 'mysql', 'mysql2', 'sqlite3', + 'better-sqlite3', 'oracledb', 'tedious', // macOS-only native file watcher diff --git a/apps/server/server/index.ts b/apps/server/server/index.ts index 9d080cfa9..863a366d2 100644 --- a/apps/server/server/index.ts +++ b/apps/server/server/index.ts @@ -13,6 +13,7 @@ import { ObjectKernel, DriverPlugin, AppPlugin } from '@objectstack/runtime'; import { ObjectQLPlugin } from '@objectstack/objectql'; import { TursoDriver } from '@objectstack/driver-turso'; +import { InMemoryDriver } from '@objectstack/driver-memory'; import { createHonoApp } from '@objectstack/hono'; import { AuthPlugin } from '@objectstack/plugin-auth'; import { SecurityPlugin } from '@objectstack/plugin-security'; @@ -62,21 +63,40 @@ async function ensureKernel(): Promise { // Register ObjectQL engine await kernel.use(new ObjectQLPlugin()); - // Database driver - Turso (remote mode for Vercel) + // Register Memory Driver for example apps (volatile, fast) + await kernel.use(new DriverPlugin(new InMemoryDriver(), { name: 'memory' })); + + // Register Turso Driver for system objects (persistent, production) const tursoUrl = process.env.TURSO_DATABASE_URL; const tursoToken = process.env.TURSO_AUTH_TOKEN; if (!tursoUrl || !tursoToken) { - throw new Error('Missing required environment variables: TURSO_DATABASE_URL and TURSO_AUTH_TOKEN'); + console.warn('[Vercel] Turso credentials not found, falling back to file-based SQLite'); } const tursoDriver = new TursoDriver({ - url: tursoUrl, + url: tursoUrl ?? 'file:./data/server.db', authToken: tursoToken, // Remote mode - no local sync needed for Vercel }); - await kernel.use(new DriverPlugin(tursoDriver)); + await kernel.use(new DriverPlugin(tursoDriver, { name: 'turso' })); + + // Configure datasource mapping + // This must be done before loading apps, so ObjectQL can route objects correctly + const ql = kernel.getService('ObjectQL'); + if (ql && typeof ql.setDatasourceMapping === 'function') { + ql.setDatasourceMapping([ + // Example apps use in-memory driver for fast, ephemeral data + { namespace: 'crm', datasource: 'memory' }, + { namespace: 'todo', datasource: 'memory' }, + { namespace: 'bi', datasource: 'memory' }, + // System objects use Turso for persistent, production-grade storage + { namespace: 'sys', datasource: 'turso' }, + // Default fallback to memory driver + { default: true, datasource: 'memory' }, + ]); + } // Load app manifests (BEFORE plugins that need object schemas) await kernel.use(new AppPlugin(CrmApp)); diff --git a/apps/server/vercel.json b/apps/server/vercel.json index fdaa07ceb..3b13a2802 100644 --- a/apps/server/vercel.json +++ b/apps/server/vercel.json @@ -12,7 +12,11 @@ "functions": { "api/**/*.js": { "memory": 1024, - "maxDuration": 60 + "maxDuration": 60, + "includeFiles": [ + "node_modules/@libsql/**", + "node_modules/better-sqlite3/**" + ] } }, "headers": [ From c3b6c83630fd96e4256be29791ccc1ba0f08a7fb Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Tue, 14 Apr 2026 13:47:21 +0000 Subject: [PATCH 3/7] fix(server): Fix vercel.json schema - includeFiles should be string not array Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/1245e678-d4d6-4f94-8c34-64c7bced2044 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com> --- apps/server/vercel.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/server/vercel.json b/apps/server/vercel.json index 3b13a2802..e1f7a64d4 100644 --- a/apps/server/vercel.json +++ b/apps/server/vercel.json @@ -13,10 +13,7 @@ "api/**/*.js": { "memory": 1024, "maxDuration": 60, - "includeFiles": [ - "node_modules/@libsql/**", - "node_modules/better-sqlite3/**" - ] + "includeFiles": "node_modules/{@libsql,better-sqlite3}/**" } }, "headers": [ From fb2be3b61a9780e62b46054e1c0e2bdcf8caa7ec Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:07:22 +0000 Subject: [PATCH 4/7] refactor(server): Remove better-sqlite3 from Vercel deployment (not needed for Turso remote mode) Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/af3d6298-72a1-4aa6-91fa-5536560dcbd9 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com> --- apps/server/scripts/build-vercel.sh | 28 ++++++++++++++-------------- apps/server/scripts/bundle-api.mjs | 2 +- apps/server/vercel.json | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/server/scripts/build-vercel.sh b/apps/server/scripts/build-vercel.sh index 743b921e4..1aa8e9dc5 100755 --- a/apps/server/scripts/build-vercel.sh +++ b/apps/server/scripts/build-vercel.sh @@ -29,24 +29,24 @@ node scripts/bundle-api.mjs # 3. Copy native/external modules into local node_modules for Vercel packaging. # # This monorepo uses pnpm's default strict node_modules structure. External -# dependencies marked in bundle-api.mjs (@libsql/client, better-sqlite3) only -# exist in the monorepo root's node_modules/.pnpm/ virtual store. +# dependencies marked in bundle-api.mjs (@libsql/client) only exist in the +# monorepo root's node_modules/.pnpm/ virtual store. # # The vercel.json includeFiles pattern references node_modules/ relative to # apps/server/, so we must copy the actual module files here for Vercel to # include them in the serverless function's deployment package. -echo "[build-vercel] Copying external native modules to local node_modules..." -for mod in "@libsql/client" better-sqlite3; do - src="../../node_modules/$mod" - if [ -e "$src" ]; then - dest="node_modules/$mod" - mkdir -p "$(dirname "$dest")" - cp -rL "$src" "$dest" - echo "[build-vercel] ✓ Copied $mod" - else - echo "[build-vercel] ⚠ $mod not found at $src (skipped)" - fi -done +# +# Note: better-sqlite3 is NOT needed for Turso remote mode on Vercel. +echo "[build-vercel] Copying @libsql/client to local node_modules..." +src="../../node_modules/@libsql/client" +if [ -e "$src" ]; then + dest="node_modules/@libsql/client" + mkdir -p "$(dirname "$dest")" + cp -rL "$src" "$dest" + echo "[build-vercel] ✓ Copied @libsql/client" +else + echo "[build-vercel] ⚠ @libsql/client not found at $src (skipped)" +fi # Copy native binary subdirectories for @libsql/client if [ -d "../../node_modules/@libsql" ]; then diff --git a/apps/server/scripts/bundle-api.mjs b/apps/server/scripts/bundle-api.mjs index 2feeb3d2d..71e4bbbc3 100644 --- a/apps/server/scripts/bundle-api.mjs +++ b/apps/server/scripts/bundle-api.mjs @@ -25,7 +25,7 @@ const EXTERNAL = [ 'mysql', 'mysql2', 'sqlite3', - 'better-sqlite3', + // better-sqlite3 NOT needed for Turso remote mode on Vercel 'oracledb', 'tedious', // macOS-only native file watcher diff --git a/apps/server/vercel.json b/apps/server/vercel.json index e1f7a64d4..742e0c817 100644 --- a/apps/server/vercel.json +++ b/apps/server/vercel.json @@ -13,7 +13,7 @@ "api/**/*.js": { "memory": 1024, "maxDuration": 60, - "includeFiles": "node_modules/{@libsql,better-sqlite3}/**" + "includeFiles": "node_modules/@libsql/**" } }, "headers": [ From eb6a9df68071df679ff1b44ffda548f17b6267a0 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:22:59 +0000 Subject: [PATCH 5/7] fix(server): Use async service resolution for ObjectQL on Vercel Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/513c44ed-000f-41d7-8aed-49b74803191d Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com> --- apps/server/server/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/server/server/index.ts b/apps/server/server/index.ts index 863a366d2..fc43c0309 100644 --- a/apps/server/server/index.ts +++ b/apps/server/server/index.ts @@ -84,7 +84,7 @@ async function ensureKernel(): Promise { // Configure datasource mapping // This must be done before loading apps, so ObjectQL can route objects correctly - const ql = kernel.getService('ObjectQL'); + const ql = await kernel.getServiceAsync('ObjectQL'); if (ql && typeof ql.setDatasourceMapping === 'function') { ql.setDatasourceMapping([ // Example apps use in-memory driver for fast, ephemeral data From ad6426686698b5bf3c4a9dbd0778e3c3371dd59e Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Wed, 15 Apr 2026 01:51:59 +0000 Subject: [PATCH 6/7] fix(server): Pass driver names as strings, not objects, to DriverPlugin Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/38859349-2ac2-4ed9-a6ab-dc857bf07fba Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- .../__vite-browser-external-BJgzPGy7.js | 1 + apps/server/public/assets/chunk-DECur_0Z.js | 1 + apps/server/public/assets/data-CGvg7kH3.js | 39 ++ apps/server/public/assets/index-BqvyhY64.js | 306 +++++++++++++++ apps/server/public/assets/index-ffw1U6iI.css | 2 + apps/server/public/index.html | 19 + apps/server/public/mockServiceWorker.js | 349 ++++++++++++++++++ apps/server/public/vite.svg | 5 + apps/server/server/index.ts | 4 +- 9 files changed, 724 insertions(+), 2 deletions(-) create mode 100644 apps/server/public/assets/__vite-browser-external-BJgzPGy7.js create mode 100644 apps/server/public/assets/chunk-DECur_0Z.js create mode 100644 apps/server/public/assets/data-CGvg7kH3.js create mode 100644 apps/server/public/assets/index-BqvyhY64.js create mode 100644 apps/server/public/assets/index-ffw1U6iI.css create mode 100644 apps/server/public/index.html create mode 100644 apps/server/public/mockServiceWorker.js create mode 100644 apps/server/public/vite.svg diff --git a/apps/server/public/assets/__vite-browser-external-BJgzPGy7.js b/apps/server/public/assets/__vite-browser-external-BJgzPGy7.js new file mode 100644 index 000000000..7b1c56949 --- /dev/null +++ b/apps/server/public/assets/__vite-browser-external-BJgzPGy7.js @@ -0,0 +1 @@ +import{t as e}from"./chunk-DECur_0Z.js";var t=e(((e,t)=>{t.exports={}}));export default t(); \ No newline at end of file diff --git a/apps/server/public/assets/chunk-DECur_0Z.js b/apps/server/public/assets/chunk-DECur_0Z.js new file mode 100644 index 000000000..c7f309007 --- /dev/null +++ b/apps/server/public/assets/chunk-DECur_0Z.js @@ -0,0 +1 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));export{s as n,l as r,o as t}; \ No newline at end of file diff --git a/apps/server/public/assets/data-CGvg7kH3.js b/apps/server/public/assets/data-CGvg7kH3.js new file mode 100644 index 000000000..a3b06359a --- /dev/null +++ b/apps/server/public/assets/data-CGvg7kH3.js @@ -0,0 +1,39 @@ +import{n as e}from"./chunk-DECur_0Z.js";Object.freeze({status:`aborted`});function t(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var n=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},r=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},i={};function a(e){return e&&Object.assign(i,e),i}function o(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function s(e,t){return typeof t==`bigint`?t.toString():t}function c(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function l(e){return e==null}function u(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ee(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var te=Symbol(`evaluating`);function d(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==te)return r===void 0&&(r=te,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function f(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function ne(e){return JSON.stringify(e)}function re(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ie=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ae(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var oe=c(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function m(e){if(ae(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ae(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function se(e){return m(e)?{...e}:Array.isArray(e)?[...e]:e}var ce=new Set([`string`,`number`,`symbol`]);function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function g(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function le(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ue={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function de(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return g(e,p(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return f(this,`shape`,e),e},checks:[]}))}function fe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return g(e,p(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return f(this,`shape`,r),r},checks:[]}))}function pe(e,t){if(!m(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return g(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function me(e,t){if(!m(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return g(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function he(e,t){return g(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return f(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function ge(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return g(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return f(this,`shape`,i),i},checks:[]}))}function _e(e,t,n){return g(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return f(this,`shape`,i),i}}))}function v(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ve(e){return typeof e==`string`?e:e?.message}function b(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=ve(e.inst?._zod.def?.error?.(e))??ve(t?.error?.(e))??ve(n.customError?.(e))??ve(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ye(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function be(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var xe=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,s,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Se=t(`$ZodError`,xe),Ce=t(`$ZodError`,xe,{Parent:Error});function we(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Te(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r(t,r,i,o)=>{let s=i?Object.assign(i,{async:!1}):{async:!1},c=t._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new n;if(c.issues.length){let t=new(o?.Err??e)(c.issues.map(e=>b(e,s,a())));throw ie(t,o?.callee),t}return c.value},De=Ee(Ce),Oe=e=>async(t,n,r,i)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(i?.Err??e)(s.issues.map(e=>b(e,o,a())));throw ie(t,i?.callee),t}return s.value},ke=Oe(Ce),Ae=e=>(t,r,i)=>{let o=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new n;return s.issues.length?{success:!1,error:new(e??Se)(s.issues.map(e=>b(e,o,a())))}:{success:!0,data:s.value}},je=Ae(Ce),Me=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>b(e,i,a())))}:{success:!0,data:o.value}},Ne=Me(Ce),Pe=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ee(e)(t,n,i)},Fe=e=>(t,n,r)=>Ee(e)(t,n,r),Ie=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Oe(e)(t,n,i)},Le=e=>async(t,n,r)=>Oe(e)(t,n,r),Re=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ae(e)(t,n,i)},ze=e=>(t,n,r)=>Ae(e)(t,n,r),Be=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Me(e)(t,n,i)},Ve=e=>async(t,n,r)=>Me(e)(t,n,r),He=/^[cC][^\s-]{8,}$/,Ue=/^[0-9a-z]+$/,We=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ge=/^[0-9a-vA-V]{20}$/,Ke=/^[A-Za-z0-9]{27}$/,qe=/^[a-zA-Z0-9_-]{21}$/,Je=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ye=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Xe=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ze=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qe=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function $e(){return new RegExp(Qe,`u`)}var et=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,it=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,at=/^[A-Za-z0-9_-]*$/,ot=/^\+[1-9]\d{6,14}$/,st=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,ct=RegExp(`^${st}$`);function lt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ut(e){return RegExp(`^${lt(e)}$`)}function dt(e){let t=lt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${st}T(?:${r})$`)}var ft=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},pt=/^-?\d+$/,mt=/^-?\d+(?:\.\d+)?$/,ht=/^(?:true|false)$/i,gt=/^null$/i,_t=/^[^A-Z]*$/,vt=/^[^a-z]*$/,x=t(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),yt={number:`number`,bigint:`bigint`,object:`date`},bt=t(`$ZodCheckLessThan`,(e,t)=>{x.init(e,t);let n=yt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{x.init(e,t);let n=yt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),St=t(`$ZodCheckMultipleOf`,(e,t)=>{x.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):ee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ct=t(`$ZodCheckNumberFormat`,(e,t)=>{x.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ue[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=pt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),wt=t(`$ZodCheckMaxLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!l(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=ye(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Tt=t(`$ZodCheckMinLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!l(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ye(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Et=t(`$ZodCheckLengthEquals`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!l(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ye(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Dt=t(`$ZodCheckStringFormat`,(e,t)=>{var n,r;x.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ot=t(`$ZodCheckRegex`,(e,t)=>{Dt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),kt=t(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=_t,Dt.init(e,t)}),At=t(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=vt,Dt.init(e,t)}),jt=t(`$ZodCheckIncludes`,(e,t)=>{x.init(e,t);let n=h(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Mt=t(`$ZodCheckStartsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`^${h(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Nt=t(`$ZodCheckEndsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`.*${h(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Pt=t(`$ZodCheckOverwrite`,(e,t)=>{x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ft=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` +`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(` +`))}},It={major:4,minor:3,patch:6},S=t(`$ZodType`,(e,t)=>{var r;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=It;let i=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let i=v(e),a;for(let o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&r?.async===!1)throw new n;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||=v(e,t))});else{if(e.issues.length===t)continue;i||=v(e,t)}}return a?a.then(()=>e):e},r=(r,a,o)=>{if(v(r))return r.aborted=!0,r;let s=t(a,i,o);if(s instanceof Promise){if(o.async===!1)throw new n;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new n;return s.then(e=>t(e,i,o))}return t(s,i,o)}}d(e,`~standard`,()=>({validate:t=>{try{let n=je(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ne(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Lt=t(`$ZodString`,(e,t)=>{S.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ft(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),C=t(`$ZodStringFormat`,(e,t)=>{Dt.init(e,t),Lt.init(e,t)}),Rt=t(`$ZodGUID`,(e,t)=>{t.pattern??=Ye,C.init(e,t)}),zt=t(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Xe(e)}else t.pattern??=Xe();C.init(e,t)}),Bt=t(`$ZodEmail`,(e,t)=>{t.pattern??=Ze,C.init(e,t)}),Vt=t(`$ZodURL`,(e,t)=>{C.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ht=t(`$ZodEmoji`,(e,t)=>{t.pattern??=$e(),C.init(e,t)}),Ut=t(`$ZodNanoID`,(e,t)=>{t.pattern??=qe,C.init(e,t)}),Wt=t(`$ZodCUID`,(e,t)=>{t.pattern??=He,C.init(e,t)}),Gt=t(`$ZodCUID2`,(e,t)=>{t.pattern??=Ue,C.init(e,t)}),Kt=t(`$ZodULID`,(e,t)=>{t.pattern??=We,C.init(e,t)}),qt=t(`$ZodXID`,(e,t)=>{t.pattern??=Ge,C.init(e,t)}),Jt=t(`$ZodKSUID`,(e,t)=>{t.pattern??=Ke,C.init(e,t)}),Yt=t(`$ZodISODateTime`,(e,t)=>{t.pattern??=dt(t),C.init(e,t)}),Xt=t(`$ZodISODate`,(e,t)=>{t.pattern??=ct,C.init(e,t)}),Zt=t(`$ZodISOTime`,(e,t)=>{t.pattern??=ut(t),C.init(e,t)}),Qt=t(`$ZodISODuration`,(e,t)=>{t.pattern??=Je,C.init(e,t)}),$t=t(`$ZodIPv4`,(e,t)=>{t.pattern??=et,C.init(e,t),e._zod.bag.format=`ipv4`}),en=t(`$ZodIPv6`,(e,t)=>{t.pattern??=tt,C.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),tn=t(`$ZodCIDRv4`,(e,t)=>{t.pattern??=nt,C.init(e,t)}),nn=t(`$ZodCIDRv6`,(e,t)=>{t.pattern??=rt,C.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function rn(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var an=t(`$ZodBase64`,(e,t)=>{t.pattern??=it,C.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{rn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function on(e){if(!at.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return rn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var sn=t(`$ZodBase64URL`,(e,t)=>{t.pattern??=at,C.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{on(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),cn=t(`$ZodE164`,(e,t)=>{t.pattern??=ot,C.init(e,t)});function ln(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var un=t(`$ZodJWT`,(e,t)=>{C.init(e,t),e._zod.check=n=>{ln(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),dn=t(`$ZodNumber`,(e,t)=>{S.init(e,t),e._zod.pattern=e._zod.bag.pattern??mt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),fn=t(`$ZodNumberFormat`,(e,t)=>{Ct.init(e,t),dn.init(e,t)}),pn=t(`$ZodBoolean`,(e,t)=>{S.init(e,t),e._zod.pattern=ht,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),mn=t(`$ZodNull`,(e,t)=>{S.init(e,t),e._zod.pattern=gt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),hn=t(`$ZodAny`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),gn=t(`$ZodUnknown`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),_n=t(`$ZodNever`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),vn=t(`$ZodVoid`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),yn=t(`$ZodDate`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function bn(e,t,n){e.issues.length&&t.issues.push(...y(n,e.issues)),t.value[n]=e.value}var xn=t(`$ZodArray`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;ebn(t,n,e))):bn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Sn(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...y(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Cn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=le(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function wn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Sn(e,n,i,t,u))):Sn(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Tn=t(`$ZodObject`,(e,t)=>{if(S.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=c(()=>Cn(t));d(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ae,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Sn(n,t,e,s,r))):Sn(i,t,e,s,r)}return i?wn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),En=t(`$ZodObjectJIT`,(e,t)=>{Tn.init(e,t);let n=e._zod.parse,r=c(()=>Cn(t)),a=e=>{let t=new Ft([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ne(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ne(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(` + if (${n}.issues.length) { + if (${o} in input) { + payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${o}, ...iss.path] : [${o}] + }))); + } + } + + if (${n}.value === undefined) { + if (${o} in input) { + newResult[${o}] = undefined; + } + } else { + newResult[${o}] = ${n}.value; + } + + `):t.write(` + if (${n}.issues.length) { + payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${o}, ...iss.path] : [${o}] + }))); + } + + if (${n}.value === undefined) { + if (${o} in input) { + newResult[${o}] = undefined; + } + } else { + newResult[${o}] = ${n}.value; + } + + `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},o,s=ae,l=!i.jitless,u=l&&oe.value,ee=t.catchall,te;e._zod.parse=(i,c)=>{te??=r.value;let d=i.value;return s(d)?l&&u&&c?.async===!1&&c.jitless!==!0?(o||=a(t.shape),i=o(i,c),ee?wn([],d,i,c,te,e):i):n(i,c):(i.issues.push({expected:`object`,code:`invalid_type`,input:d,inst:e}),i)}});function Dn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!v(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>b(e,r,a())))}),t)}var On=t(`$ZodUnion`,(e,t)=>{S.init(e,t),d(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),d(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),d(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),d(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>u(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>Dn(t,i,e,a)):Dn(s,i,e,a)}}),kn=t(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,On.init(e,t);let n=e._zod.parse;d(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=c(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!ae(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),An=t(`$ZodIntersection`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Mn(e,t,n)):Mn(e,i,a)}});function jn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(m(e)&&m(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=jn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;re.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),v(e))return e;let o=jn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Nn=t(`$ZodTuple`,(e,t)=>{S.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=[...n].reverse().findIndex(e=>e._zod.optin!==`optional`),c=s===-1?0:n.length-s;if(!t.rest){let t=a.length>n.length,i=a.length=a.length&&l>=c)continue;let t=e._zod.run({value:a[l],issues:[]},i);t instanceof Promise?o.push(t.then(e=>Pn(e,r,l))):Pn(t,r,l)}if(t.rest){let e=a.slice(n.length);for(let n of e){l++;let e=t.rest._zod.run({value:n,issues:[]},i);e instanceof Promise?o.push(e.then(e=>Pn(e,r,l))):Pn(e,r,l)}}return o.length?Promise.all(o).then(()=>r):r}});function Pn(e,t,n){e.issues.length&&t.issues.push(...y(n,e.issues)),t.value[n]=e.value}var Fn=t(`$ZodRecord`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!m(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let o=[],s=t.keyType._zod.values;if(s){n.value={};let a=new Set;for(let e of s)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){a.add(typeof e==`number`?e.toString():e);let s=t.valueType._zod.run({value:i[e],issues:[]},r);s instanceof Promise?o.push(s.then(t=>{t.issues.length&&n.issues.push(...y(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(...y(e,s.issues)),n.value[e]=s.value)}let c;for(let e in i)a.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let s of Reflect.ownKeys(i)){if(s===`__proto__`)continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof s==`string`&&mt.test(s)&&c.issues.length){let e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[s]=i[s]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>b(e,r,a())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&n.issues.push(...y(s,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...y(s,l.issues)),n.value[c.value]=l.value)}}return o.length?Promise.all(o).then(()=>n):n}}),In=t(`$ZodEnum`,(e,t)=>{S.init(e,t);let n=o(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ce.has(typeof e)).map(e=>typeof e==`string`?h(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ln=t(`$ZodLiteral`,(e,t)=>{if(S.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?h(e):e?h(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Rn=t(`$ZodTransform`,(e,t)=>{S.init(e,t),e._zod.parse=(i,a)=>{if(a.direction===`backward`)throw new r(e.constructor.name);let o=t.transform(i.value,i);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(i.value=e,i));if(o instanceof Promise)throw new n;return i.value=o,i}});function zn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Bn=t(`$ZodOptional`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${u(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>zn(t,e.value)):zn(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Vn=t(`$ZodExactOptional`,(e,t)=>{Bn.init(e,t),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Hn=t(`$ZodNullable`,(e,t)=>{S.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${u(e.source)}|null)$`):void 0}),d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Un=t(`$ZodDefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Wn(e,t)):Wn(r,t)}});function Wn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Gn=t(`$ZodPrefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Kn=t(`$ZodNonOptional`,(e,t)=>{S.init(e,t),d(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>qn(t,e)):qn(i,e)}});function qn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Jn=t(`$ZodCatch`,(e,t)=>{S.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>b(e,n,a()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>b(e,n,a()))},input:e.value}),e.issues=[]),e)}}),Yn=t(`$ZodPipe`,(e,t)=>{S.init(e,t),d(e._zod,`values`,()=>t.in._zod.values),d(e._zod,`optin`,()=>t.in._zod.optin),d(e._zod,`optout`,()=>t.out._zod.optout),d(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Xn(e,t.in,n)):Xn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Xn(e,t.out,n)):Xn(r,t.out,n)}});function Xn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Zn=t(`$ZodReadonly`,(e,t)=>{S.init(e,t),d(e._zod,`propValues`,()=>t.innerType._zod.propValues),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`optin`,()=>t.innerType?._zod?.optin),d(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Qn):Qn(r)}});function Qn(e){return e.value=Object.freeze(e.value),e}var $n=t(`$ZodFunction`,(e,t)=>(S.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?De(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?De(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await ke(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await ke(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new Nn({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),er=t(`$ZodPromise`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),tr=t(`$ZodLazy`,(e,t)=>{S.init(e,t),d(e._zod,`innerType`,()=>t.getter()),d(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),d(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),d(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),d(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),nr=t(`$ZodCustom`,(e,t)=>{x.init(e,t),S.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>rr(t,n,r,e));rr(i,n,r,e)}});function rr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(be(e))}}var ir,ar=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function or(){return new ar}(ir=globalThis).__zod_globalRegistry??(ir.__zod_globalRegistry=or());var sr=globalThis.__zod_globalRegistry;function cr(e,t){return new e({type:`string`,..._(t)})}function lr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,..._(t)})}function ur(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,..._(t)})}function dr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,..._(t)})}function fr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,..._(t)})}function pr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,..._(t)})}function mr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,..._(t)})}function hr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,..._(t)})}function gr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,..._(t)})}function _r(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,..._(t)})}function vr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,..._(t)})}function yr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,..._(t)})}function br(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,..._(t)})}function xr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,..._(t)})}function Sr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,..._(t)})}function Cr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,..._(t)})}function wr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,..._(t)})}function Tr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,..._(t)})}function Er(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,..._(t)})}function Dr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,..._(t)})}function Or(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,..._(t)})}function kr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,..._(t)})}function Ar(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,..._(t)})}function jr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,..._(t)})}function Mr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,..._(t)})}function Nr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,..._(t)})}function Pr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,..._(t)})}function Fr(e,t){return new e({type:`number`,checks:[],..._(t)})}function Ir(e,t){return new e({type:`number`,coerce:!0,checks:[],..._(t)})}function Lr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,..._(t)})}function Rr(e,t){return new e({type:`boolean`,..._(t)})}function zr(e,t){return new e({type:`boolean`,coerce:!0,..._(t)})}function Br(e,t){return new e({type:`null`,..._(t)})}function Vr(e){return new e({type:`any`})}function Hr(e){return new e({type:`unknown`})}function Ur(e,t){return new e({type:`never`,..._(t)})}function Wr(e,t){return new e({type:`void`,..._(t)})}function Gr(e,t){return new e({type:`date`,..._(t)})}function Kr(e,t){return new bt({check:`less_than`,..._(t),value:e,inclusive:!1})}function qr(e,t){return new bt({check:`less_than`,..._(t),value:e,inclusive:!0})}function Jr(e,t){return new xt({check:`greater_than`,..._(t),value:e,inclusive:!1})}function Yr(e,t){return new xt({check:`greater_than`,..._(t),value:e,inclusive:!0})}function Xr(e,t){return new St({check:`multiple_of`,..._(t),value:e})}function Zr(e,t){return new wt({check:`max_length`,..._(t),maximum:e})}function Qr(e,t){return new Tt({check:`min_length`,..._(t),minimum:e})}function $r(e,t){return new Et({check:`length_equals`,..._(t),length:e})}function ei(e,t){return new Ot({check:`string_format`,format:`regex`,..._(t),pattern:e})}function ti(e){return new kt({check:`string_format`,format:`lowercase`,..._(e)})}function ni(e){return new At({check:`string_format`,format:`uppercase`,..._(e)})}function ri(e,t){return new jt({check:`string_format`,format:`includes`,..._(t),includes:e})}function ii(e,t){return new Mt({check:`string_format`,format:`starts_with`,..._(t),prefix:e})}function ai(e,t){return new Nt({check:`string_format`,format:`ends_with`,..._(t),suffix:e})}function w(e){return new Pt({check:`overwrite`,tx:e})}function oi(e){return w(t=>t.normalize(e))}function si(){return w(e=>e.trim())}function ci(){return w(e=>e.toLowerCase())}function li(){return w(e=>e.toUpperCase())}function ui(){return w(e=>re(e))}function di(e,t,n){return new e({type:`array`,element:t,..._(n)})}function fi(e,t,n){let r=_(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function pi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,..._(n)})}function mi(e){let t=hi(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(be(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(be(r))}},e(n.value,n)));return t}function hi(e,t){let n=new x({check:`custom`,..._(t)});return n._zod.check=e,n}function gi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??sr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function T(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,T(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&E(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function _i(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function vi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:bi(t,`input`,e.processors),output:bi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function E(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return E(r.element,n);if(r.type===`set`)return E(r.valueType,n);if(r.type===`lazy`)return E(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return E(r.innerType,n);if(r.type===`intersection`)return E(r.left,n)||E(r.right,n);if(r.type===`record`||r.type===`map`)return E(r.keyType,n)||E(r.valueType,n);if(r.type===`pipe`)return E(r.in,n)||E(r.out,n);if(r.type===`object`){for(let e in r.shape)if(E(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(E(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(E(e,n))return!0;return!!(r.rest&&E(r.rest,n))}return!1}var yi=(e,t={})=>n=>{let r=gi({...n,processors:t});return T(e,r),_i(r,e),vi(r,e)},bi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=gi({...i??{},target:a,io:t,processors:n});return T(e,o),_i(o,e),vi(o,e)},xi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Si=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=xi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ci=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},wi=(e,t,n,r)=>{n.type=`boolean`},Ti=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},Ei=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},Di=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Oi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},ki=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Ai=(e,t,n,r)=>{n.not={}},ji=(e,t,n,r)=>{},Mi=(e,t,n,r)=>{},Ni=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Pi=(e,t,n,r)=>{let i=e._zod.def,a=o(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Fi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Ii=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},Li=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Ri=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},zi=(e,t,n,r)=>{n.type=`boolean`},Bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Vi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Hi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ui=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Wi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Gi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=T(a.element,t,{...r,path:[...r.path,`items`]})},Ki=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=T(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=T(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},qi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>T(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ji=(e,t,n,r)=>{let i=e._zod.def,a=T(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=T(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Yi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>T(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?T(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:ee}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof ee==`number`&&(i.maxItems=ee)},Xi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=T(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=T(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=T(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Zi=(e,t,n,r)=>{let i=e._zod.def,a=T(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Qi=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},$i=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ea=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ta=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},na=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;T(a,t,r);let o=t.seen.get(e);o.ref=a},ra=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ia=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},aa=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},oa=(e,t,n,r)=>{let i=e._zod.innerType;T(i,t,r);let a=t.seen.get(e);a.ref=i},sa={string:Si,number:Ci,boolean:wi,bigint:Ti,symbol:Ei,null:Di,undefined:Oi,void:ki,never:Ai,any:ji,unknown:Mi,date:Ni,enum:Pi,literal:Fi,nan:Ii,template_literal:Li,file:Ri,success:zi,custom:Bi,function:Vi,transform:Hi,map:Ui,set:Wi,array:Gi,object:Ki,union:qi,intersection:Ji,tuple:Yi,record:Xi,nullable:Zi,nonoptional:Qi,default:$i,prefault:ea,catch:ta,pipe:na,readonly:ra,promise:ia,optional:aa,lazy:oa};function ca(e,t){if(`_idmap`in e){let n=e,r=gi({...t,processors:sa}),i={};for(let e of n._idmap.entries()){let[t,n]=e;T(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;_i(r,n),a[t]=vi(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=gi({...t,processors:sa});return T(e,n),_i(n,e),vi(n,e)}var la=t(`ZodISODateTime`,(e,t)=>{Yt.init(e,t),A.init(e,t)});function ua(e){return jr(la,e)}var da=t(`ZodISODate`,(e,t)=>{Xt.init(e,t),A.init(e,t)});function fa(e){return Mr(da,e)}var pa=t(`ZodISOTime`,(e,t)=>{Zt.init(e,t),A.init(e,t)});function ma(e){return Nr(pa,e)}var ha=t(`ZodISODuration`,(e,t)=>{Qt.init(e,t),A.init(e,t)});function ga(e){return Pr(ha,e)}var _a=(e,t)=>{Se.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Te(e,t)},flatten:{value:t=>we(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,s,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,s,2)}},isEmpty:{get(){return e.issues.length===0}}})},va=t(`ZodError`,_a),D=t(`ZodError`,_a,{Parent:Error}),ya=Ee(D),ba=Oe(D),xa=Ae(D),Sa=Me(D),Ca=Pe(D),wa=Fe(D),Ta=Ie(D),Ea=Le(D),Da=Re(D),Oa=ze(D),ka=Be(D),Aa=Ve(D),O=t(`ZodType`,(e,t)=>(S.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:bi(e,`input`),output:bi(e,`output`)}}),e.toJSONSchema=yi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(p(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>g(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>ya(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>xa(e,t,n),e.parseAsync=async(t,n)=>ba(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Sa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ca(e,t,n),e.decode=(t,n)=>wa(e,t,n),e.encodeAsync=async(t,n)=>Ta(e,t,n),e.decodeAsync=async(t,n)=>Ea(e,t,n),e.safeEncode=(t,n)=>Da(e,t,n),e.safeDecode=(t,n)=>Oa(e,t,n),e.safeEncodeAsync=async(t,n)=>ka(e,t,n),e.safeDecodeAsync=async(t,n)=>Aa(e,t,n),e.refine=(t,n)=>e.check(Jo(t,n)),e.superRefine=t=>e.check(Yo(t)),e.overwrite=t=>e.check(w(t)),e.optional=()=>Eo(e),e.exactOptional=()=>Oo(e),e.nullable=()=>Ao(e),e.nullish=()=>Eo(Ao(e)),e.nonoptional=t=>Io(e,t),e.array=()=>L(e),e.or=t=>z([e,t]),e.and=t=>vo(e,t),e.transform=t=>Bo(e,wo(t)),e.default=t=>Mo(e,t),e.prefault=t=>Po(e,t),e.catch=t=>Ro(e,t),e.pipe=t=>Bo(e,t),e.readonly=()=>Ho(e),e.describe=t=>{let n=e.clone();return sr.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return sr.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return sr.get(e);let n=e.clone();return sr.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ja=t(`_ZodString`,(e,t)=>{Lt.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ei(...t)),e.includes=(...t)=>e.check(ri(...t)),e.startsWith=(...t)=>e.check(ii(...t)),e.endsWith=(...t)=>e.check(ai(...t)),e.min=(...t)=>e.check(Qr(...t)),e.max=(...t)=>e.check(Zr(...t)),e.length=(...t)=>e.check($r(...t)),e.nonempty=(...t)=>e.check(Qr(1,...t)),e.lowercase=t=>e.check(ti(t)),e.uppercase=t=>e.check(ni(t)),e.trim=()=>e.check(si()),e.normalize=(...t)=>e.check(oi(...t)),e.toLowerCase=()=>e.check(ci()),e.toUpperCase=()=>e.check(li()),e.slugify=()=>e.check(ui())}),Ma=t(`ZodString`,(e,t)=>{Lt.init(e,t),ja.init(e,t),e.email=t=>e.check(lr(Na,t)),e.url=t=>e.check(hr(Ia,t)),e.jwt=t=>e.check(Ar(Za,t)),e.emoji=t=>e.check(gr(La,t)),e.guid=t=>e.check(ur(Pa,t)),e.uuid=t=>e.check(dr(Fa,t)),e.uuidv4=t=>e.check(fr(Fa,t)),e.uuidv6=t=>e.check(pr(Fa,t)),e.uuidv7=t=>e.check(mr(Fa,t)),e.nanoid=t=>e.check(_r(Ra,t)),e.guid=t=>e.check(ur(Pa,t)),e.cuid=t=>e.check(vr(za,t)),e.cuid2=t=>e.check(yr(Ba,t)),e.ulid=t=>e.check(br(Va,t)),e.base64=t=>e.check(Dr(Ja,t)),e.base64url=t=>e.check(Or(Ya,t)),e.xid=t=>e.check(xr(Ha,t)),e.ksuid=t=>e.check(Sr(Ua,t)),e.ipv4=t=>e.check(Cr(Wa,t)),e.ipv6=t=>e.check(wr(Ga,t)),e.cidrv4=t=>e.check(Tr(Ka,t)),e.cidrv6=t=>e.check(Er(qa,t)),e.e164=t=>e.check(kr(Xa,t)),e.datetime=t=>e.check(ua(t)),e.date=t=>e.check(fa(t)),e.time=t=>e.check(ma(t)),e.duration=t=>e.check(ga(t))});function k(e){return cr(Ma,e)}var A=t(`ZodStringFormat`,(e,t)=>{C.init(e,t),ja.init(e,t)}),Na=t(`ZodEmail`,(e,t)=>{Bt.init(e,t),A.init(e,t)}),Pa=t(`ZodGUID`,(e,t)=>{Rt.init(e,t),A.init(e,t)}),Fa=t(`ZodUUID`,(e,t)=>{zt.init(e,t),A.init(e,t)}),Ia=t(`ZodURL`,(e,t)=>{Vt.init(e,t),A.init(e,t)}),La=t(`ZodEmoji`,(e,t)=>{Ht.init(e,t),A.init(e,t)}),Ra=t(`ZodNanoID`,(e,t)=>{Ut.init(e,t),A.init(e,t)}),za=t(`ZodCUID`,(e,t)=>{Wt.init(e,t),A.init(e,t)}),Ba=t(`ZodCUID2`,(e,t)=>{Gt.init(e,t),A.init(e,t)}),Va=t(`ZodULID`,(e,t)=>{Kt.init(e,t),A.init(e,t)}),Ha=t(`ZodXID`,(e,t)=>{qt.init(e,t),A.init(e,t)}),Ua=t(`ZodKSUID`,(e,t)=>{Jt.init(e,t),A.init(e,t)}),Wa=t(`ZodIPv4`,(e,t)=>{$t.init(e,t),A.init(e,t)}),Ga=t(`ZodIPv6`,(e,t)=>{en.init(e,t),A.init(e,t)}),Ka=t(`ZodCIDRv4`,(e,t)=>{tn.init(e,t),A.init(e,t)}),qa=t(`ZodCIDRv6`,(e,t)=>{nn.init(e,t),A.init(e,t)}),Ja=t(`ZodBase64`,(e,t)=>{an.init(e,t),A.init(e,t)}),Ya=t(`ZodBase64URL`,(e,t)=>{sn.init(e,t),A.init(e,t)}),Xa=t(`ZodE164`,(e,t)=>{cn.init(e,t),A.init(e,t)}),Za=t(`ZodJWT`,(e,t)=>{un.init(e,t),A.init(e,t)}),Qa=t(`ZodNumber`,(e,t)=>{dn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.gt=(t,n)=>e.check(Jr(t,n)),e.gte=(t,n)=>e.check(Yr(t,n)),e.min=(t,n)=>e.check(Yr(t,n)),e.lt=(t,n)=>e.check(Kr(t,n)),e.lte=(t,n)=>e.check(qr(t,n)),e.max=(t,n)=>e.check(qr(t,n)),e.int=t=>e.check(eo(t)),e.safe=t=>e.check(eo(t)),e.positive=t=>e.check(Jr(0,t)),e.nonnegative=t=>e.check(Yr(0,t)),e.negative=t=>e.check(Kr(0,t)),e.nonpositive=t=>e.check(qr(0,t)),e.multipleOf=(t,n)=>e.check(Xr(t,n)),e.step=(t,n)=>e.check(Xr(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function j(e){return Fr(Qa,e)}var $a=t(`ZodNumberFormat`,(e,t)=>{fn.init(e,t),Qa.init(e,t)});function eo(e){return Lr($a,e)}var to=t(`ZodBoolean`,(e,t)=>{pn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function M(e){return Rr(to,e)}var no=t(`ZodNull`,(e,t)=>{mn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r)});function ro(e){return Br(no,e)}var io=t(`ZodAny`,(e,t)=>{hn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function N(){return Vr(io)}var ao=t(`ZodUnknown`,(e,t)=>{gn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function P(){return Hr(ao)}var oo=t(`ZodNever`,(e,t)=>{_n.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r)});function so(e){return Ur(oo,e)}var co=t(`ZodVoid`,(e,t)=>{vn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r)});function F(e){return Wr(co,e)}var lo=t(`ZodDate`,(e,t)=>{yn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.min=(t,n)=>e.check(Yr(t,n)),e.max=(t,n)=>e.check(qr(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function I(e){return Gr(lo,e)}var uo=t(`ZodArray`,(e,t)=>{xn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Qr(t,n)),e.nonempty=t=>e.check(Qr(1,t)),e.max=(t,n)=>e.check(Zr(t,n)),e.length=(t,n)=>e.check($r(t,n)),e.unwrap=()=>e.element});function L(e,t){return di(uo,e,t)}var fo=t(`ZodObject`,(e,t)=>{En.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),d(e,`shape`,()=>t.shape),e.keyof=()=>H(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:P()}),e.loose=()=>e.clone({...e._zod.def,catchall:P()}),e.strict=()=>e.clone({...e._zod.def,catchall:so()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>pe(e,t),e.safeExtend=t=>me(e,t),e.merge=t=>he(e,t),e.pick=t=>de(e,t),e.omit=t=>fe(e,t),e.partial=(...t)=>ge(To,e,t[0]),e.required=(...t)=>_e(Fo,e,t[0])});function R(e,t){return new fo({type:`object`,shape:e??{},..._(t)})}function po(e,t){return new fo({type:`object`,shape:e,catchall:so(),..._(t)})}var mo=t(`ZodUnion`,(e,t)=>{On.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.options=t.options});function z(e,t){return new mo({type:`union`,options:e,..._(t)})}var ho=t(`ZodDiscriminatedUnion`,(e,t)=>{mo.init(e,t),kn.init(e,t)});function go(e,t,n){return new ho({type:`union`,options:t,discriminator:e,..._(n)})}var _o=t(`ZodIntersection`,(e,t)=>{An.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r)});function vo(e,t){return new _o({type:`intersection`,left:e,right:t})}var yo=t(`ZodTuple`,(e,t)=>{Nn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function B(e,t,n){let r=t instanceof S;return new yo({type:`tuple`,items:e,rest:r?t:null,..._(r?n:t)})}var bo=t(`ZodRecord`,(e,t)=>{Fn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function V(e,t,n){return new bo({type:`record`,keyType:e,valueType:t,..._(n)})}var xo=t(`ZodEnum`,(e,t)=>{In.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new xo({...t,checks:[],..._(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new xo({...t,checks:[],..._(r),entries:i})}});function H(e,t){return new xo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,..._(t)})}var So=t(`ZodLiteral`,(e,t)=>{Ln.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function U(e,t){return new So({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}var Co=t(`ZodTransform`,(e,t)=>{Rn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e._zod.parse=(n,i)=>{if(i.direction===`backward`)throw new r(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(be(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(be(t))}};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n)):(n.value=a,n)}});function wo(e){return new Co({type:`transform`,transform:e})}var To=t(`ZodOptional`,(e,t)=>{Bn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Eo(e){return new To({type:`optional`,innerType:e})}var Do=t(`ZodExactOptional`,(e,t)=>{Vn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e){return new Do({type:`optional`,innerType:e})}var ko=t(`ZodNullable`,(e,t)=>{Hn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ao(e){return new ko({type:`nullable`,innerType:e})}var jo=t(`ZodDefault`,(e,t)=>{Un.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mo(e,t){return new jo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}var No=t(`ZodPrefault`,(e,t)=>{Gn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Po(e,t){return new No({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}var Fo=t(`ZodNonOptional`,(e,t)=>{Kn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Io(e,t){return new Fo({type:`nonoptional`,innerType:e,..._(t)})}var Lo=t(`ZodCatch`,(e,t)=>{Jn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ro(e,t){return new Lo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var zo=t(`ZodPipe`,(e,t)=>{Yn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>na(e,t,n,r),e.in=t.in,e.out=t.out});function Bo(e,t){return new zo({type:`pipe`,in:e,out:t})}var Vo=t(`ZodReadonly`,(e,t)=>{Zn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ra(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ho(e){return new Vo({type:`readonly`,innerType:e})}var Uo=t(`ZodLazy`,(e,t)=>{tr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oa(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function W(e){return new Uo({type:`lazy`,getter:e})}var Wo=t(`ZodPromise`,(e,t)=>{er.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function G(e){return new Wo({type:`promise`,innerType:e})}var Go=t(`ZodFunction`,(e,t)=>{$n.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r)});function K(e){return new Go({type:`function`,input:Array.isArray(e?.input)?B(e?.input):e?.input??L(P()),output:e?.output??P()})}var Ko=t(`ZodCustom`,(e,t)=>{nr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r)});function qo(e,t){return fi(Ko,e??(()=>!0),t)}function Jo(e,t={}){return pi(Ko,e,t)}function Yo(e){return mi(e)}function Xo(e,t={}){let n=new Ko({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,..._(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Zo(e,t){return Bo(wo(e),t)}var Qo=e({AggregationFunction:()=>ls,AggregationMetricType:()=>xl,AggregationNodeSchema:()=>us,AggregationStageSchema:()=>nl,ApiMethod:()=>ac,AsyncValidationSchema:()=>Hs,BaseEngineOptionsSchema:()=>Q,CDCConfigSchema:()=>pc,ComputedFieldCacheSchema:()=>Ns,ConditionalValidationSchema:()=>Gs,ConsistencyLevelSchema:()=>Yc,CrossFieldValidationSchema:()=>Bs,CubeJoinSchema:()=>El,CurrencyConfigSchema:()=>ks,CustomValidatorSchema:()=>Us,DataEngineAggregateRequestSchema:()=>Ic,DataEngineBatchRequestSchema:()=>zc,DataEngineCountRequestSchema:()=>Fc,DataEngineDeleteRequestSchema:()=>Pc,DataEngineExecuteRequestSchema:()=>Lc,DataEngineFilterSchema:()=>Z,DataEngineFindOneRequestSchema:()=>jc,DataEngineFindRequestSchema:()=>Ac,DataEngineInsertOptionsSchema:()=>Cc,DataEngineInsertRequestSchema:()=>Mc,DataEngineSortSchema:()=>xc,DataEngineUpdateRequestSchema:()=>Nc,DataEngineVectorFindRequestSchema:()=>Rc,DataQualityRulesSchema:()=>Ms,DataTypeMappingSchema:()=>Kc,DatasetLoadResultSchema:()=>ul,DatasetMode:()=>rl,DatasetSchema:()=>il,DatasourceCapabilities:()=>bl,DimensionSchema:()=>Tl,DimensionType:()=>Sl,DocumentSchemaValidationSchema:()=>$c,DocumentTemplateSchema:()=>pl,DocumentVersionSchema:()=>fl,DriverCapabilitiesSchema:()=>Hc,DriverConfigSchema:()=>Wc,DriverOptionsSchema:()=>$,DriverType:()=>yl,ESignatureConfigSchema:()=>ml,EngineAggregateOptionsSchema:()=>Ec,EngineCountOptionsSchema:()=>Dc,EngineDeleteOptionsSchema:()=>Tc,EngineQueryOptionsSchema:()=>Sc,EngineUpdateOptionsSchema:()=>wc,ExternalDataSourceSchema:()=>_l,ExternalFieldMappingSchema:()=>vl,FILTER_OPERATORS:()=>os,FeedActorSchema:()=>jl,FeedItemType:()=>Dl,FeedVisibility:()=>Ml,Field:()=>Fs,FieldChangeEntrySchema:()=>kl,FieldMappingSchema:()=>yc,FieldNodeSchema:()=>_s,FieldOperatorsSchema:()=>$o,FieldReferenceSchema:()=>q,FieldSchema:()=>Ps,FieldType:()=>Ds,FileAttachmentConfigSchema:()=>js,FilterConditionSchema:()=>J,FormatValidationSchema:()=>zs,FullTextSearchSchema:()=>vs,HookEvent:()=>_c,IndexSchema:()=>sc,JSONValidationSchema:()=>Vs,JoinNodeSchema:()=>ps,JoinStrategy:()=>fs,JoinType:()=>ds,LOGICAL_OPERATORS:()=>ss,MentionSchema:()=>Ol,MetricSchema:()=>wl,NoSQLDataTypeMappingSchema:()=>el,NoSQLDatabaseTypeSchema:()=>Jc,NoSQLIndexTypeSchema:()=>Xc,NoSQLQueryOptionsSchema:()=>tl,NormalizedFilterSchema:()=>es,NotificationChannel:()=>Pl,ObjectCapabilities:()=>oc,ObjectDependencyGraphSchema:()=>sl,ObjectDependencyNodeSchema:()=>ol,ObjectSchema:()=>gc,PartitioningConfigSchema:()=>fc,PoolConfigSchema:()=>Uc,QuerySchema:()=>Y,ReactionSchema:()=>Al,ReferenceResolutionErrorSchema:()=>cl,ReferenceResolutionSchema:()=>al,ReplicationConfigSchema:()=>Qc,SQLDialectSchema:()=>Gc,SSLConfigSchema:()=>qc,ScriptValidationSchema:()=>Is,SearchConfigSchema:()=>cc,SeedLoaderConfigSchema:()=>ll,SeedLoaderRequestSchema:()=>dl,SelectOptionSchema:()=>Os,ShardingConfigSchema:()=>Zc,SoftDeleteConfigSchema:()=>uc,SortNodeSchema:()=>cs,StateMachineValidationSchema:()=>Rs,SubscriptionEventType:()=>Nl,TenancyConfigSchema:()=>lc,TenantDatabaseLifecycleSchema:()=>Ll,TenantResolverStrategySchema:()=>Fl,TimeUpdateInterval:()=>Cl,TransformType:()=>vc,TursoGroupSchema:()=>Il,UniquenessValidationSchema:()=>Ls,VALID_AST_OPERATORS:()=>ts,ValidationRuleSchema:()=>Ws,VectorConfigSchema:()=>As,VersioningConfigSchema:()=>dc,WindowFunction:()=>ms,WindowFunctionNodeSchema:()=>gs,WindowSpecSchema:()=>hs,isFilterAST:()=>ns,parseFilterAST:()=>as}),q=R({$field:k().describe(`Field Reference/Column Name`)});R({$eq:N().optional(),$ne:N().optional()}),R({$gt:z([j(),I(),q]).optional(),$gte:z([j(),I(),q]).optional(),$lt:z([j(),I(),q]).optional(),$lte:z([j(),I(),q]).optional()}),R({$in:L(N()).optional(),$nin:L(N()).optional()}),R({$between:B([z([j(),I(),q]),z([j(),I(),q])]).optional()}),R({$contains:k().optional(),$notContains:k().optional(),$startsWith:k().optional(),$endsWith:k().optional()}),R({$null:M().optional(),$exists:M().optional()});var $o=R({$eq:N().optional(),$ne:N().optional(),$gt:z([j(),I(),q]).optional(),$gte:z([j(),I(),q]).optional(),$lt:z([j(),I(),q]).optional(),$lte:z([j(),I(),q]).optional(),$in:L(N()).optional(),$nin:L(N()).optional(),$between:B([z([j(),I(),q]),z([j(),I(),q])]).optional(),$contains:k().optional(),$notContains:k().optional(),$startsWith:k().optional(),$endsWith:k().optional(),$null:M().optional(),$exists:M().optional()}),J=W(()=>V(k(),P()).and(R({$and:L(J).optional(),$or:L(J).optional(),$not:J.optional()})));R({where:J.optional()});var es=W(()=>R({$and:L(z([V(k(),$o),es])).optional(),$or:L(z([V(k(),$o),es])).optional(),$not:z([V(k(),$o),es]).optional()})),ts=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function ns(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=>ns(e));if(e.length>=2&&typeof e[1]==`string`)return ts.has(e[1].toLowerCase())}return e.every(e=>ns(e))?e.length>0:!1}var rs={"=":`$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 is(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=rs[i];return a?{[t]:{[a]:r}}:{[t]:{[`$${i}`]:r}}}function as(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=>as(e)).filter(Boolean);return r.length===0?void 0:r.length===1?r[0]:{[n]:r}}if(e.length>=2&&typeof t==`string`)return is(e);if(e.every(e=>Array.isArray(e))){let t=e.map(e=>as(e)).filter(Boolean);return t.length===0?void 0:t.length===1?t[0]:{$and:t}}}var os=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],ss=[`$and`,`$or`,`$not`];[...os,...ss];var cs=R({field:k(),order:H([`asc`,`desc`]).default(`asc`)}),ls=H([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),us=R({function:ls.describe(`Aggregation function`),field:k().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:k().describe(`Result column alias`),distinct:M().optional().describe(`Apply DISTINCT before aggregation`),filter:J.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)}),ds=H([`inner`,`left`,`right`,`full`]),fs=H([`auto`,`database`,`hash`,`loop`]),ps=W(()=>R({type:ds.describe(`Join type`),strategy:fs.optional().describe(`Execution strategy hint`),object:k().describe(`Object/table to join`),alias:k().optional().describe(`Table alias`),on:J.describe(`Join condition`),subquery:W(()=>Y).optional().describe(`Subquery instead of object`)})),ms=H([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),hs=R({partitionBy:L(k()).optional().describe(`PARTITION BY fields`),orderBy:L(cs).optional().describe(`ORDER BY specification`),frame:R({type:H([`rows`,`range`]).optional(),start:k().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:k().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)}),gs=R({function:ms.describe(`Window function name`),field:k().optional().describe(`Field to operate on (for aggregate window functions)`),alias:k().describe(`Result column alias`),over:hs.describe(`Window specification (OVER clause)`)}),_s=W(()=>z([k(),R({field:k(),fields:L(_s).optional(),alias:k().optional()})])),vs=R({query:k().describe(`Search query text`),fields:L(k()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:M().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:H([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:V(k(),j()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:j().optional().describe(`Minimum relevance score threshold`),language:k().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:M().optional().default(!1).describe(`Enable search result highlighting`)}),Y=R({object:k().describe(`Object name (e.g. account)`),fields:L(_s).optional().describe(`Fields to retrieve`),where:J.optional().describe(`Filtering criteria (WHERE)`),search:vs.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:L(cs).optional().describe(`Sorting instructions (ORDER BY)`),limit:j().optional().describe(`Max records to return (LIMIT)`),offset:j().optional().describe(`Records to skip (OFFSET)`),top:j().optional().describe(`Alias for limit (OData compatibility)`),cursor:V(k(),P()).optional().describe(`Cursor for keyset pagination`),joins:L(ps).optional().describe(`Explicit Table Joins`),aggregations:L(us).optional().describe(`Aggregation functions`),groupBy:L(k()).optional().describe(`GROUP BY fields`),having:J.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:L(gs).optional().describe(`Window functions with OVER clause`),distinct:M().optional().describe(`SELECT DISTINCT flag`)}).extend({expand:W(()=>V(k(),Y)).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.`)}),ys=k().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)`),bs=k().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)`);k().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 xs=H([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),Ss=H([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),Cs=R({enabled:M().default(!1).describe(`Enable automatic key rotation`),frequencyDays:j().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:j().default(3).describe(`Number of old key versions to retain`),autoRotate:M().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),ws=R({enabled:M().default(!1).describe(`Enable field-level encryption`),algorithm:xs.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:R({provider:Ss.describe(`Key management service provider`),keyId:k().optional().describe(`Key identifier in the provider`),rotationPolicy:Cs.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:H([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:M().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:M().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);R({fieldName:k().describe(`Name of the field to encrypt`),encryptionConfig:ws.describe(`Encryption settings for this field`),indexable:M().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var Ts=H([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),Es=R({field:k().describe(`Field name to apply masking to`),strategy:Ts.describe(`Masking strategy to use`),pattern:k().optional().describe(`Regex pattern for partial masking`),preserveFormat:M().default(!0).describe(`Keep the original data format after masking`),preserveLength:M().default(!0).describe(`Keep the original data length after masking`),roles:L(k()).optional().describe(`Roles that see masked data`),exemptRoles:L(k()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);R({enabled:M().default(!1).describe(`Enable data masking`),rules:L(Es).describe(`List of field-level masking rules`),auditUnmasking:M().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var Ds=H(`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(`.`)),Os=R({label:k().describe(`Display label (human-readable, any case allowed)`),value:ys.describe(`Stored value (lowercase machine identifier)`),color:k().optional().describe(`Color code for badges/charts`),default:M().optional().describe(`Is default option`)});R({latitude:j().min(-90).max(90).describe(`Latitude coordinate`),longitude:j().min(-180).max(180).describe(`Longitude coordinate`),altitude:j().optional().describe(`Altitude in meters`),accuracy:j().optional().describe(`Accuracy in meters`)});var ks=R({precision:j().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:H([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:k().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});R({value:j().describe(`Monetary amount`),currency:k().length(3).describe(`Currency code (ISO 4217)`)}),R({street:k().optional().describe(`Street address`),city:k().optional().describe(`City name`),state:k().optional().describe(`State/Province`),postalCode:k().optional().describe(`Postal/ZIP code`),country:k().optional().describe(`Country name or code`),countryCode:k().optional().describe(`ISO country code (e.g., US, GB)`),formatted:k().optional().describe(`Formatted address string`)});var As=R({dimensions:j().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:H([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:M().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:M().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:H([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),js=R({minSize:j().min(0).optional().describe(`Minimum file size in bytes`),maxSize:j().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:L(k()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:L(k()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:L(k()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:L(k()).optional().describe(`Blocked MIME types`),virusScan:M().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:H([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:M().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:M().default(!0).describe(`Quarantine files if threat detected`),storageProvider:k().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:k().optional().describe(`Target bucket name`),storagePrefix:k().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:R({minWidth:j().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:j().min(1).optional().describe(`Maximum image width in pixels`),minHeight:j().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:j().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:k().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:M().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:L(R({name:k().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:j().min(1).describe(`Thumbnail width in pixels`),height:j().min(1).describe(`Thumbnail height in pixels`),crop:M().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:M().default(!1).describe(`Preserve EXIF metadata`),autoRotate:M().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:M().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:M().default(!0).describe(`Allow replacing existing files`),allowDelete:M().default(!0).describe(`Allow deleting uploaded files`),requireUpload:M().default(!1).describe(`Require at least one file when field is required`),extractMetadata:M().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:M().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:M().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:j().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:M().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:j().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`}),Ms=R({uniqueness:M().default(!1).describe(`Enforce unique values across all records`),completeness:j().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:R({source:k().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:j().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),Ns=R({enabled:M().describe(`Enable caching for computed field results`),ttl:j().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:L(k()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),Ps=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:k().optional().describe(`Human readable label`),type:Ds.describe(`Field Data Type`),description:k().optional().describe(`Tooltip/Help text`),format:k().optional().describe(`Format string (e.g. email, phone)`),columnName:k().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:M().default(!1).describe(`Is required`),searchable:M().default(!1).describe(`Is searchable`),multiple:M().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:M().default(!1).describe(`Is unique constraint`),defaultValue:P().optional().describe(`Default value`),maxLength:j().optional().describe(`Max character length`),minLength:j().optional().describe(`Min character length`),precision:j().optional().describe(`Total digits`),scale:j().optional().describe(`Decimal places`),min:j().optional().describe(`Minimum value`),max:j().optional().describe(`Maximum value`),options:L(Os).optional().describe(`Static options for select/multiselect`),reference:k().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:L(k()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:M().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:H([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:k().optional().describe(`Formula expression`),summaryOperations:R({object:k().describe(`Source child object name for roll-up`),field:k().describe(`Field on child object to aggregate`),function:H([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:k().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:k().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:M().optional().describe(`Show line numbers in code editor`),maxRating:j().optional().describe(`Maximum rating value (default: 5)`),allowHalf:M().optional().describe(`Allow half-star ratings`),displayMap:M().optional().describe(`Display map widget for location field`),allowGeocoding:M().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:H([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:H([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:M().optional().describe(`Allow transparency/alpha channel`),presetColors:L(k()).optional().describe(`Preset color options`),step:j().optional().describe(`Step increment for slider (default: 1)`),showValue:M().optional().describe(`Display current value on slider`),marks:V(k(),k()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:H([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:H([`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:M().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:M().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:ks.optional().describe(`Configuration for currency field type`),vectorConfig:As.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:js.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:ws.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:Es.optional().describe(`Data masking rules for PII protection`),auditTrail:M().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:L(k()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:Ns.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:Ms.optional().describe(`Data quality validation and monitoring rules`),group:k().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:k().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:M().default(!1).describe(`Hidden from default UI`),readonly:M().default(!1).describe(`Read-only in UI`),sortable:M().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:k().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:M().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:M().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:k().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:M().default(!1).describe(`Create standard database index`),externalId:M().default(!1).describe(`Is external ID for upsert operations`)}),Fs={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})},X=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:k().optional().describe(`Human-readable label for the rule listing`),description:k().optional().describe(`Administrative notes explaining the business reason`),active:M().default(!0),events:L(H([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:j().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:L(k()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:H([`error`,`warning`,`info`]).default(`error`),message:k().describe(`Error message to display to the user`)}),Is=X.extend({type:U(`script`),condition:k().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),Ls=X.extend({type:U(`unique`),fields:L(k()).describe(`Fields that must be combined unique`),scope:k().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:M().default(!0)}),Rs=X.extend({type:U(`state_machine`),field:k().describe(`State field (e.g. status)`),transitions:V(k(),L(k())).describe(`Map of { OldState: [AllowedNewStates] }`)}),zs=X.extend({type:U(`format`),field:k(),regex:k().optional(),format:H([`email`,`url`,`phone`,`json`]).optional()}),Bs=X.extend({type:U(`cross_field`),condition:k().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:L(k()).describe(`Fields involved in the validation`)}),Vs=X.extend({type:U(`json_schema`),field:k().describe(`JSON field to validate`),schema:V(k(),P()).describe(`JSON Schema object definition`)}),Hs=X.extend({type:U(`async`),field:k().describe(`Field to validate`),validatorUrl:k().optional().describe(`External API endpoint for validation`),method:H([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:V(k(),k()).optional().describe(`Custom headers for the request`),validatorFunction:k().optional().describe(`Reference to custom validator function`),timeout:j().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:j().optional().describe(`Debounce delay in milliseconds`),params:V(k(),P()).optional().describe(`Additional parameters to pass to validator`)}),Us=X.extend({type:U(`custom`),handler:k().describe(`Name of the custom validation function registered in the system`),params:V(k(),P()).optional().describe(`Parameters passed to the custom handler`)}),Ws=W(()=>go(`type`,[Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Gs])),Gs=X.extend({type:U(`conditional`),when:k().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:Ws.describe(`Validation rule to apply when condition is true`),otherwise:Ws.optional().describe(`Validation rule to apply when condition is false`)}),Ks=z([k().describe(`Action Name`),R({type:k(),params:V(k(),P()).optional()})]),qs=z([k().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),R({type:k(),params:V(k(),P()).optional()})]),Js=R({target:k().optional().describe(`Target State ID`),cond:qs.optional().describe(`Condition (Guard) required to take this path`),actions:L(Ks).optional().describe(`Actions to execute during transition`),description:k().optional().describe(`Human readable description of this rule`)});R({type:k().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:V(k(),P()).optional().describe(`Expected event payload structure`)});var Ys=W(()=>R({type:H([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:L(Ks).optional().describe(`Actions to run when entering this state`),exit:L(Ks).optional().describe(`Actions to run when leaving this state`),on:V(k(),z([k(),Js,L(Js)])).optional().describe(`Map of Event Type -> Transition Definition`),always:L(Js).optional(),initial:k().optional().describe(`Initial child state (if compound)`),states:V(k(),Ys).optional(),meta:R({label:k().optional(),description:k().optional(),color:k().optional(),aiInstructions:k().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),Xs=R({id:bs.describe(`Unique Machine ID`),description:k().optional(),contextSchema:V(k(),P()).optional().describe(`Zod Schema for the machine context/memory`),initial:k().describe(`Initial State ID`),states:V(k(),Ys).describe(`State Nodes`),on:V(k(),z([k(),Js,L(Js)])).optional()});R({key:k().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:k().optional().describe(`Fallback value when translation key is not found`),params:V(k(),z([k(),j(),M()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var Zs=k().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),Qs=R({ariaLabel:Zs.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:k().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:k().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);R({key:k().describe(`Translation key`),zero:k().optional().describe(`Zero form (e.g., "No items")`),one:k().optional().describe(`Singular form (e.g., "{count} item")`),two:k().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:k().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:k().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:k().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var $s=R({style:H([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:k().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:k().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:j().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:j().optional().describe(`Maximum number of fraction digits`),useGrouping:M().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),ec=R({dateStyle:H([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:H([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:k().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:M().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);R({code:k().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:L(k()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:H([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:$s.optional().describe(`Default number formatting rules`),dateFormat:ec.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var tc=R({name:k(),label:Zs,type:Ds,required:M().default(!1),options:L(R({label:Zs,value:k()})).optional()}),nc=H([`script`,`url`,`modal`,`flow`,`api`]),rc=new Set(nc.options.filter(e=>e!==`script`)),ic=R({name:bs.describe(`Machine name (lowercase snake_case)`),label:Zs.describe(`Display label`),objectName:k().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:k().optional().describe(`Icon name`),locations:L(H([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:H([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:nc.default(`script`).describe(`Action functionality type`),target:k().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:k().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:L(tc).optional().describe(`Input parameters required from user`),variant:H([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:Zs.optional().describe(`Confirmation message before execution`),successMessage:Zs.optional().describe(`Success message to show after execution`),refreshAfter:M().default(!1).describe(`Refresh view after execution`),visible:k().optional().describe(`Formula returning boolean`),disabled:z([M(),k()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:k().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:M().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:j().optional().describe(`Maximum execution time in milliseconds for the action`),aria:Qs.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(rc.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),ac=H([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),oc=R({trackHistory:M().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:M().default(!0).describe(`Index records for global search`),apiEnabled:M().default(!0).describe(`Expose object via automatic APIs`),apiMethods:L(ac).optional().describe(`Whitelist of allowed API operations`),files:M().default(!1).describe(`Enable file attachments and document management`),feeds:M().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:M().default(!1).describe(`Enable standard tasks and events tracking`),trash:M().default(!0).describe(`Enable soft-delete with restore capability`),mru:M().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:M().default(!0).describe(`Allow record deep cloning`)}),sc=R({name:k().optional().describe(`Index name (auto-generated if not provided)`),fields:L(k()).describe(`Fields included in the index`),type:H([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:M().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:k().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),cc=R({fields:L(k()).describe(`Fields to index for full-text search weighting`),displayFields:L(k()).optional().describe(`Fields to display in search result cards`),filters:L(k()).optional().describe(`Default filters for search results`)}),lc=R({enabled:M().describe(`Enable multi-tenancy for this object`),strategy:H([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:k().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:M().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),uc=R({enabled:M().describe(`Enable soft delete (trash/recycle bin)`),field:k().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:M().default(!1).describe(`Cascade soft delete to related records`)}),dc=R({enabled:M().describe(`Enable record versioning`),strategy:H([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:j().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:k().default(`version`).describe(`Field name for version number/timestamp`)}),fc=R({enabled:M().describe(`Enable table partitioning`),strategy:H([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:k().describe(`Field name to partition by`),interval:k().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"`}),pc=R({enabled:M().describe(`Enable Change Data Capture`),events:L(H([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:k().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),mc=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:k().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:k().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:k().optional().describe(`Developer documentation / description`),icon:k().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:k().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:L(k()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:M().optional().default(!0).describe(`Is the object active and usable`),isSystem:M().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:M().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:k().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:k().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:V(k().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),Ps).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:L(sc).optional().describe(`Database performance indexes`),tenancy:lc.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:uc.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:dc.optional().describe(`Record versioning and history tracking configuration`),partitioning:fc.optional().describe(`Table partitioning configuration for performance`),cdc:pc.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:L(Ws).optional().describe(`Object-level validation rules`),stateMachines:V(k(),Xs).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:k().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:R({type:H([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:k().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:j().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:k().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:L(k()).optional().describe(`Primary fields for hover/cards/lookups`),search:cc.optional().describe(`Search engine configuration`),enable:oc.optional().describe(`Enabled system features modules`),recordTypes:L(k()).optional().describe(`Record type names for this object`),sharingModel:H([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:k().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:L(ic).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function hc(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var gc=Object.assign(mc,{create:e=>{let t={...e,label:e.label??hc(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return mc.parse(t)}});H([`own`,`extend`]),R({extend:k().describe(`Target object name (FQN) to extend`),fields:V(k(),Ps).optional().describe(`Fields to add/override`),label:k().optional().describe(`Override label for the extended object`),pluralLabel:k().optional().describe(`Override plural label for the extended object`),description:k().optional().describe(`Override description for the extended object`),validations:L(Ws).optional().describe(`Additional validation rules to merge into the target object`),indexes:L(sc).optional().describe(`Additional indexes to merge into the target object`),priority:j().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)});var _c=H([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]);R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:k().optional().describe(`Description of what this hook does`),object:z([k(),L(k())]).describe(`Target object(s)`),events:L(_c).describe(`Lifecycle events`),handler:z([k(),K()]).optional().describe(`Handler function name (string) or inline function reference`),priority:j().default(100).describe(`Execution priority`),async:M().default(!1).describe(`Run specifically as fire-and-forget`),condition:k().optional().describe(`Formula expression; hook runs only when TRUE (e.g., "status = 'closed' AND amount > 1000")`),description:k().optional().describe(`Human-readable description of what this hook does`),retryPolicy:R({maxRetries:j().default(3).describe(`Maximum retry attempts on failure`),backoffMs:j().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:j().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:H([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)}),R({id:k().optional().describe(`Unique execution ID for tracing`),object:k(),event:_c,input:V(k(),P()).describe(`Mutable input parameters`),result:P().optional().describe(`Operation result (After hooks only)`),previous:V(k(),P()).optional().describe(`Record state before operation`),session:R({userId:k().optional(),tenantId:k().optional(),roles:L(k()).optional(),accessToken:k().optional()}).optional().describe(`Current session context`),transaction:P().optional().describe(`Database transaction handle`),ql:P().describe(`ObjectQL Engine Reference`),api:P().optional().describe(`Cross-object data access (ScopedContext)`),user:R({id:k().optional(),name:k().optional(),email:k().optional()}).optional().describe(`Current user info shortcut`)});var vc=H([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),yc=R({source:z([k(),L(k())]).describe(`Source column header(s)`),target:z([k(),L(k())]).describe(`Target object field(s)`),transform:vc.default(`none`),params:R({value:P().optional(),object:k().optional(),fromField:k().optional(),toField:k().optional(),autoCreate:M().optional(),valueMap:V(k(),P()).optional(),separator:k().optional()}).optional()});R({name:bs.describe(`Mapping unique name (lowercase snake_case)`),label:k().optional(),sourceFormat:H([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:k().describe(`Target Object Name`),fieldMapping:L(yc),mode:H([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:L(k()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:Y.optional().describe(`Query to run for export only`),errorPolicy:H([`skip`,`abort`,`retry`]).default(`skip`),batchSize:j().default(1e3)});var bc=R({userId:k().optional(),tenantId:k().optional(),roles:L(k()).default([]),permissions:L(k()).default([]),isSystem:M().default(!1),accessToken:k().optional(),transaction:P().optional(),traceId:k().optional()}),Z=z([V(k(),P()),J]).describe(`Data Engine query filter conditions`),xc=z([V(k(),H([`asc`,`desc`])),V(k(),z([U(1),U(-1)])),L(cs)]).describe(`Sort order definition`),Q=R({context:bc.optional()}),Sc=Q.extend({where:z([V(k(),P()),J]).optional(),fields:L(_s).optional(),orderBy:L(cs).optional(),limit:j().optional(),offset:j().optional(),top:j().optional(),cursor:V(k(),P()).optional(),search:vs.optional(),expand:W(()=>V(k(),Y)).optional(),distinct:M().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`);Q.extend({filter:Z.optional(),select:L(k()).optional(),sort:xc.optional(),limit:j().int().min(1).optional(),skip:j().int().min(0).optional(),top:j().int().min(1).optional(),populate:L(k()).optional()}).describe(`Query options for IDataEngine.find() operations`);var Cc=Q.extend({returning:M().default(!0).optional()}).describe(`Options for DataEngine.insert operations`),wc=Q.extend({where:z([V(k(),P()),J]).optional(),upsert:M().default(!1).optional(),multi:M().default(!1).optional(),returning:M().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`);Q.extend({filter:Z.optional(),upsert:M().default(!1).optional(),multi:M().default(!1).optional(),returning:M().default(!1).optional()}).describe(`Options for DataEngine.update operations`);var Tc=Q.extend({where:z([V(k(),P()),J]).optional(),multi:M().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`);Q.extend({filter:Z.optional(),multi:M().default(!1).optional()}).describe(`Options for DataEngine.delete operations`);var Ec=Q.extend({where:z([V(k(),P()),J]).optional(),groupBy:L(k()).optional(),aggregations:L(us).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`);Q.extend({filter:Z.optional(),groupBy:L(k()).optional(),aggregations:L(R({field:k(),method:H([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:k().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`);var Dc=Q.extend({where:z([V(k(),P()),J]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`);Q.extend({filter:Z.optional()}).describe(`Options for DataEngine.count operations`),R({find:K().input(B([k(),Sc.optional()])).output(G(L(P()))),findOne:K().input(B([k(),Sc.optional()])).output(G(P())),insert:K().input(B([k(),z([V(k(),P()),L(V(k(),P()))]),Cc.optional()])).output(G(P())),update:K().input(B([k(),V(k(),P()),wc.optional()])).output(G(P())),delete:K().input(B([k(),Tc.optional()])).output(G(P())),count:K().input(B([k(),Dc.optional()])).output(G(j())),aggregate:K().input(B([k(),Ec])).output(G(L(P())))}).describe(`Standard Data Engine Contract`);var Oc={filter:Z.optional()},kc=Sc.extend({...Oc,select:L(k()).optional(),sort:xc.optional(),skip:j().int().min(0).optional(),populate:L(k()).optional()}),Ac=R({method:U(`find`),object:k(),query:kc.optional()}),jc=R({method:U(`findOne`),object:k(),query:kc.optional()}),Mc=R({method:U(`insert`),object:k(),data:z([V(k(),P()),L(V(k(),P()))]),options:Cc.optional()}),Nc=R({method:U(`update`),object:k(),data:V(k(),P()),id:z([k(),j()]).optional().describe(`ID for single update, or use where in options`),options:wc.extend(Oc).optional()}),Pc=R({method:U(`delete`),object:k(),id:z([k(),j()]).optional().describe(`ID for single delete, or use where in options`),options:Tc.extend(Oc).optional()}),Fc=R({method:U(`count`),object:k(),query:Dc.extend(Oc).optional()}),Ic=R({method:U(`aggregate`),object:k(),query:Ec.extend(Oc)}),Lc=R({method:U(`execute`),command:P(),options:V(k(),P()).optional()}),Rc=R({method:U(`vectorFind`),object:k(),vector:L(j()),where:z([V(k(),P()),J]).optional(),fields:L(k()).optional(),limit:j().int().default(5).optional(),threshold:j().optional()}),zc=R({method:U(`batch`),requests:L(go(`method`,[Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc])),transaction:M().default(!0).optional()});go(`method`,[Ac,jc,Mc,Nc,Pc,Fc,Ic,zc,Lc,Rc]).describe(`Virtual ObjectQL Request Protocol`),H([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var Bc=H([`asc`,`desc`]).describe(`Sort order direction`);R({field:k().describe(`Field name to sort by`),order:Bc.describe(`Sort direction`)}).describe(`Sort field and direction pair`),H([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`);var Vc=H([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`);H([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var $=R({transaction:P().optional().describe(`Transaction handle`),timeout:j().optional().describe(`Timeout in ms`),skipCache:M().optional().describe(`Bypass cache`),traceContext:V(k(),k()).optional().describe(`OpenTelemetry context or request ID`),tenantId:k().optional().describe(`Tenant Isolation identifier`)}),Hc=R({create:M().default(!0).describe(`Supports CREATE operations`),read:M().default(!0).describe(`Supports READ operations`),update:M().default(!0).describe(`Supports UPDATE operations`),delete:M().default(!0).describe(`Supports DELETE operations`),bulkCreate:M().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:M().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:M().default(!1).describe(`Supports bulk DELETE operations`),transactions:M().default(!1).describe(`Supports ACID transactions`),savepoints:M().default(!1).describe(`Supports transaction savepoints`),isolationLevels:L(Vc).optional().describe(`Supported isolation levels`),queryFilters:M().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:M().default(!1).describe(`Supports GROUP BY and aggregation functions`),querySorting:M().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:M().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:M().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:M().default(!1).describe(`Supports subqueries`),queryCTE:M().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:M().default(!1).describe(`Supports SQL joins`),fullTextSearch:M().default(!1).describe(`Supports full-text search`),jsonQuery:M().default(!1).describe(`Supports JSON field querying`),geospatialQuery:M().default(!1).describe(`Supports geospatial queries`),streaming:M().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:M().default(!1).describe(`Supports JSON field types`),arrayFields:M().default(!1).describe(`Supports array field types`),vectorSearch:M().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:M().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:M().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:M().default(!1).describe(`Supports database migrations`),indexes:M().default(!1).describe(`Supports index creation and management`),connectionPooling:M().default(!1).describe(`Supports connection pooling`),preparedStatements:M().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:M().default(!1).describe(`Supports query result caching`)});R({name:k().describe(`Driver unique name`),version:k().describe(`Driver version`),supports:Hc,connect:K().input(B([])).output(G(F())).describe(`Establish connection`),disconnect:K().input(B([])).output(G(F())).describe(`Close connection`),checkHealth:K().input(B([])).output(G(M())).describe(`Health check`),getPoolStats:K().input(B([])).output(R({total:j(),idle:j(),active:j(),waiting:j()}).optional()).optional().describe(`Get connection pool statistics`),execute:K().input(B([P(),L(P()).optional(),$.optional()])).output(G(P())).describe(`Execute raw command`),find:K().input(B([k(),Y,$.optional()])).output(G(L(V(k(),P())))).describe(`Find records`),findStream:K().input(B([k(),Y,$.optional()])).output(P()).describe(`Stream records (AsyncIterable)`),findOne:K().input(B([k(),Y,$.optional()])).output(G(V(k(),P()).nullable())).describe(`Find one record`),create:K().input(B([k(),V(k(),P()),$.optional()])).output(G(V(k(),P()))).describe(`Create record`),update:K().input(B([k(),k().or(j()),V(k(),P()),$.optional()])).output(G(V(k(),P()))).describe(`Update record`),upsert:K().input(B([k(),V(k(),P()),L(k()).optional(),$.optional()])).output(G(V(k(),P()))).describe(`Upsert record`),delete:K().input(B([k(),k().or(j()),$.optional()])).output(G(M())).describe(`Delete record`),count:K().input(B([k(),Y.optional(),$.optional()])).output(G(j())).describe(`Count records`),bulkCreate:K().input(B([k(),L(V(k(),P())),$.optional()])).output(G(L(V(k(),P())))),bulkUpdate:K().input(B([k(),L(R({id:k().or(j()),data:V(k(),P())})),$.optional()])).output(G(L(V(k(),P())))),bulkDelete:K().input(B([k(),L(k().or(j())),$.optional()])).output(G(F())),updateMany:K().input(B([k(),Y,V(k(),P()),$.optional()])).output(G(j())).optional(),deleteMany:K().input(B([k(),Y,$.optional()])).output(G(j())).optional(),beginTransaction:K().input(B([R({isolationLevel:Vc.optional()}).optional()])).output(G(P())).describe(`Start transaction`),commit:K().input(B([P()])).output(G(F())).describe(`Commit transaction`),rollback:K().input(B([P()])).output(G(F())).describe(`Rollback transaction`),syncSchema:K().input(B([k(),P(),$.optional()])).output(G(F())).describe(`Sync object schema to DB`),syncSchemasBatch:K().input(B([L(R({object:k(),schema:P()})),$.optional()])).output(G(F())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:K().input(B([k(),$.optional()])).output(G(F())),explain:K().input(B([k(),Y,$.optional()])).output(G(P())).optional()});var Uc=R({min:j().min(0).default(2).describe(`Minimum number of connections in pool`),max:j().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:j().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:j().min(0).default(5e3).describe(`Time in ms to wait for available connection`)}),Wc=R({name:k().describe(`Driver instance name`),type:H([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:Hc.describe(`Driver capability flags`),connectionString:k().optional().describe(`Database connection string (driver-specific format)`),poolConfig:Uc.optional().describe(`Connection pool configuration`)}),Gc=H([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`]),Kc=R({text:k().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:k().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:k().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:k().describe(`SQL type for date fields (e.g., DATE)`),datetime:k().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:k().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:k().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:k().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)}),qc=R({rejectUnauthorized:M().default(!0).describe(`Reject connections with invalid certificates`),ca:k().optional().describe(`CA certificate file path or content`),cert:k().optional().describe(`Client certificate file path or content`),key:k().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`});Wc.extend({type:U(`sql`).describe(`Driver type must be "sql"`),dialect:Gc.describe(`SQL database dialect`),dataTypeMapping:Kc.describe(`SQL data type mapping configuration`),ssl:M().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:qc.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`});var Jc=H([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]);H([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]);var Yc=H([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`]),Xc=H([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`]),Zc=R({enabled:M().default(!1).describe(`Enable sharding`),shardKey:k().optional().describe(`Field to use as shard key`),shardingStrategy:H([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:j().int().positive().optional().describe(`Number of shards`)}),Qc=R({enabled:M().default(!1).describe(`Enable replication`),replicaSetName:k().optional().describe(`Replica set name`),replicas:j().int().positive().optional().describe(`Number of replicas`),readPreference:H([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:H([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)}),$c=R({enabled:M().default(!1).describe(`Enable schema validation`),validationLevel:H([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:H([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:V(k(),P()).optional().describe(`JSON Schema for validation`)}),el=R({text:k().describe(`NoSQL type for text fields`),number:k().describe(`NoSQL type for number fields`),boolean:k().describe(`NoSQL type for boolean fields`),date:k().describe(`NoSQL type for date fields`),datetime:k().describe(`NoSQL type for datetime fields`),json:k().optional().describe(`NoSQL type for JSON/object fields`),uuid:k().optional().describe(`NoSQL type for UUID fields`),binary:k().optional().describe(`NoSQL type for binary fields`),array:k().optional().describe(`NoSQL type for array fields`),objectId:k().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:k().optional().describe(`NoSQL type for geospatial point fields`)});Wc.extend({type:U(`nosql`).describe(`Driver type must be "nosql"`),databaseType:Jc.describe(`Specific NoSQL database type`),dataTypeMapping:el.describe(`NoSQL data type mapping configuration`),consistency:Yc.optional().describe(`Consistency level for operations`),replication:Qc.optional().describe(`Replication configuration`),sharding:Zc.optional().describe(`Sharding configuration`),schemaValidation:$c.optional().describe(`Document schema validation`),region:k().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:k().optional().describe(`AWS access key ID`),secretAccessKey:k().optional().describe(`AWS secret access key`),ttlField:k().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:j().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:k().optional().describe(`Prefix for collection/table names`)});var tl=R({consistency:Yc.optional().describe(`Consistency level override`),readFromSecondary:M().optional().describe(`Allow reading from secondary replicas`),projection:V(k(),z([U(0),U(1)])).optional().describe(`Field projection`),timeout:j().int().positive().optional().describe(`Query timeout (ms)`),useCursor:M().optional().describe(`Use cursor instead of loading all results`),batchSize:j().int().positive().optional().describe(`Cursor batch size`),profile:M().optional().describe(`Enable query profiling`),hint:k().optional().describe(`Index hint for query optimization`)}),nl=R({operator:k().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:V(k(),P()).describe(`Stage-specific options`)});R({collection:k().describe(`Collection/table name`),stages:L(nl).describe(`Aggregation pipeline stages`),options:tl.optional().describe(`Query options`)}),R({name:k().describe(`Index name`),type:Xc.describe(`Index type`),fields:L(R({field:k().describe(`Field name`),order:H([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:M().default(!1).describe(`Enforce uniqueness`),sparse:M().default(!1).describe(`Sparse index`),expireAfterSeconds:j().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:V(k(),P()).optional().describe(`Partial index filter`),background:M().default(!1).describe(`Create index in background`)}),R({readConcern:H([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:H([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:H([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:j().int().positive().optional().describe(`Transaction commit timeout (ms)`)});var rl=H([`insert`,`update`,`upsert`,`replace`,`ignore`]),il=R({object:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:k().default(`name`).describe(`Field match for uniqueness check`),mode:rl.default(`upsert`).describe(`Conflict resolution strategy`),env:L(H([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:L(V(k(),P())).describe(`Data records`)}),al=R({field:k().describe(`Source field name containing the reference value`),targetObject:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:k().default(`name`).describe(`Field on target object used for matching`),fieldType:H([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`),ol=R({object:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:L(k()).describe(`Objects this object depends on`),references:L(al).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`),sl=R({nodes:L(ol).describe(`All objects in the dependency graph`),insertOrder:L(k()).describe(`Topologically sorted insert order`),circularDependencies:L(L(k())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`),cl=R({sourceObject:k().describe(`Object with the broken reference`),field:k().describe(`Field name with unresolved reference`),targetObject:k().describe(`Target object searched for the reference`),targetField:k().describe(`ExternalId field used for matching`),attemptedValue:P().describe(`Value that failed to resolve`),recordIndex:j().int().min(0).describe(`Index of the record in the dataset`),message:k().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`),ll=R({dryRun:M().default(!1).describe(`Validate references without writing data`),haltOnError:M().default(!1).describe(`Stop on first reference resolution error`),multiPass:M().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:rl.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:j().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:M().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:H([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`)}).describe(`Seed data loader configuration`),ul=R({object:k().describe(`Object that was loaded`),mode:rl.describe(`Import mode used`),inserted:j().int().min(0).describe(`Records inserted`),updated:j().int().min(0).describe(`Records updated`),skipped:j().int().min(0).describe(`Records skipped`),errored:j().int().min(0).describe(`Records with errors`),total:j().int().min(0).describe(`Total records in dataset`),referencesResolved:j().int().min(0).describe(`References resolved via externalId`),referencesDeferred:j().int().min(0).describe(`References deferred to second pass`),errors:L(cl).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`);R({success:M().describe(`Overall success status`),dryRun:M().describe(`Whether this was a dry-run`),dependencyGraph:sl.describe(`Object dependency graph`),results:L(ul).describe(`Per-object load results`),errors:L(cl).describe(`All reference resolution errors`),summary:R({objectsProcessed:j().int().min(0).describe(`Total objects processed`),totalRecords:j().int().min(0).describe(`Total records across all objects`),totalInserted:j().int().min(0).describe(`Total records inserted`),totalUpdated:j().int().min(0).describe(`Total records updated`),totalSkipped:j().int().min(0).describe(`Total records skipped`),totalErrored:j().int().min(0).describe(`Total records with errors`),totalReferencesResolved:j().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:j().int().min(0).describe(`Total references deferred`),circularDependencyCount:j().int().min(0).describe(`Circular dependency chains detected`),durationMs:j().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`);var dl=R({datasets:L(il).min(1).describe(`Datasets to load`),config:Zo(e=>e??{},ll).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`),fl=R({versionNumber:j().describe(`Version number`),createdAt:j().describe(`Creation timestamp`),createdBy:k().describe(`Creator user ID`),size:j().describe(`File size in bytes`),checksum:k().describe(`File checksum`),downloadUrl:k().url().describe(`Download URL`),isLatest:M().optional().default(!1).describe(`Is latest version`)}),pl=R({id:k().describe(`Template ID`),name:k().describe(`Template name`),description:k().optional().describe(`Template description`),fileUrl:k().url().describe(`Template file URL`),fileType:k().describe(`File MIME type`),placeholders:L(R({key:k().describe(`Placeholder key`),label:k().describe(`Placeholder label`),type:H([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:M().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)}),ml=R({provider:H([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:M().optional().default(!1).describe(`E-signature enabled`),signers:L(R({email:k().email().describe(`Signer email`),name:k().describe(`Signer name`),role:k().describe(`Signer role`),order:j().describe(`Signing order`)})).describe(`Document signers`),expirationDays:j().optional().default(30).describe(`Expiration days`),reminderDays:j().optional().default(7).describe(`Reminder interval days`)});R({id:k().describe(`Document ID`),name:k().describe(`Document name`),description:k().optional().describe(`Document description`),fileType:k().describe(`File MIME type`),fileSize:j().describe(`File size in bytes`),category:k().optional().describe(`Document category`),tags:L(k()).optional().describe(`Document tags`),versioning:R({enabled:M().describe(`Versioning enabled`),versions:L(fl).describe(`Version history`),majorVersion:j().describe(`Major version`),minorVersion:j().describe(`Minor version`)}).optional().describe(`Version control`),template:pl.optional().describe(`Document template`),eSignature:ml.optional().describe(`E-signature config`),access:R({isPublic:M().optional().default(!1).describe(`Public access`),sharedWith:L(k()).optional().describe(`Shared with`),expiresAt:j().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:V(k(),P()).optional().describe(`Custom metadata`)});var hl=go(`type`,[R({type:U(`constant`),value:P().describe(`Constant value to use`)}).describe(`Set a constant value`),R({type:U(`cast`),targetType:H([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),R({type:U(`lookup`),table:k().describe(`Lookup table name`),keyField:k().describe(`Field to match on`),valueField:k().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),R({type:U(`javascript`),expression:k().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),R({type:U(`map`),mappings:V(k(),P()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]),gl=R({source:k().describe(`Source field name`),target:k().describe(`Target field name`),transform:hl.optional().describe(`Transformation to apply`),defaultValue:P().optional().describe(`Default if source is null/undefined`)}),_l=R({id:k().describe(`Data source ID`),name:k().describe(`Data source name`),type:H([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:k().url().describe(`API endpoint URL`),authentication:R({type:H([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:V(k(),P()).describe(`Auth configuration`)}).describe(`Authentication`)}),vl=gl.extend({type:k().optional().describe(`Field type`),readonly:M().optional().default(!0).describe(`Read-only field`)});R({fieldName:k().describe(`Field name`),dataSource:_l.describe(`External data source`),query:R({endpoint:k().describe(`Query endpoint path`),method:H([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:V(k(),P()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:L(vl).describe(`Field mappings`),caching:R({enabled:M().optional().default(!0).describe(`Cache enabled`),ttl:j().optional().default(300).describe(`Cache TTL (seconds)`),strategy:H([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:R({enabled:M().optional().default(!0).describe(`Fallback enabled`),defaultValue:P().optional().describe(`Default fallback value`),showError:M().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:R({requestsPerSecond:j().describe(`Requests per second limit`),burstSize:j().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:R({maxRetries:j().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:j().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:j().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:j().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:L(j()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:R({request:R({headers:V(k(),k()).optional().describe(`Additional request headers`),queryParams:V(k(),k()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:R({dataPath:k().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:k().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:R({type:H([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:j().default(100).describe(`Items per page`),maxPages:j().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)});var yl=k().describe(`Underlying driver identifier`);R({id:k().describe(`Unique driver identifier (e.g. "postgres")`),label:k().describe(`Display label (e.g. "PostgreSQL")`),description:k().optional(),icon:k().optional(),configSchema:V(k(),P()).describe(`JSON Schema for connection configuration`),capabilities:W(()=>bl).optional()});var bl=R({transactions:M().default(!1),queryFilters:M().default(!1),queryAggregations:M().default(!1),querySorting:M().default(!1),queryPagination:M().default(!1),queryWindowFunctions:M().default(!1),querySubqueries:M().default(!1),joins:M().default(!1),fullTextSearch:M().default(!1),readOnly:M().default(!1),dynamicSchema:M().default(!1)});R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:k().optional().describe(`Display label`),driver:yl.describe(`Underlying driver type`),config:V(k(),P()).describe(`Driver specific configuration`),pool:R({min:j().default(0).describe(`Minimum connections`),max:j().default(10).describe(`Maximum connections`),idleTimeoutMillis:j().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:j().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:L(V(k(),P())).optional().describe(`Read-only replica configurations`),capabilities:bl.optional().describe(`Capability overrides`),healthCheck:R({enabled:M().default(!0).describe(`Enable health check endpoint`),intervalMs:j().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:j().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:R({enabled:M().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:M().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:k().optional().describe(`CA certificate (PEM format or path to file)`),cert:k().optional().describe(`Client certificate (PEM format or path to file)`),key:k().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:R({maxRetries:j().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:j().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:j().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:j().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:k().optional().describe(`Internal description`),active:M().default(!0).describe(`Is datasource enabled`)});var xl=H([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),Sl=H([`string`,`number`,`boolean`,`time`,`geo`]),Cl=H([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),wl=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:k().describe(`Human readable label`),description:k().optional(),type:xl,sql:k().describe(`SQL expression or field reference`),filters:L(R({sql:k()})).optional(),format:k().optional()}),Tl=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:k().describe(`Human readable label`),description:k().optional(),type:Sl,sql:k().describe(`SQL expression or column reference`),granularities:L(Cl).optional()}),El=R({name:k().describe(`Target cube name`),relationship:H([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:k().describe(`Join condition (ON clause)`)});R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:k().optional(),description:k().optional(),sql:k().describe(`Base SQL statement or Table Name`),measures:V(k(),wl).describe(`Quantitative metrics`),dimensions:V(k(),Tl).describe(`Qualitative attributes`),joins:V(k(),El).optional(),refreshKey:R({every:k().optional(),sql:k().optional()}).optional(),public:M().default(!1)}),R({cube:k().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:L(k()).describe(`List of metrics to calculate`),dimensions:L(k()).optional().describe(`List of dimensions to group by`),filters:L(R({member:k().describe(`Dimension or Measure`),operator:H([`equals`,`notEquals`,`contains`,`notContains`,`gt`,`gte`,`lt`,`lte`,`set`,`notSet`,`inDateRange`]),values:L(k()).optional()})).optional(),timeDimensions:L(R({dimension:k(),granularity:Cl.optional(),dateRange:z([k(),L(k())]).optional()})).optional(),order:V(k(),H([`asc`,`desc`])).optional(),limit:j().optional(),offset:j().optional(),timezone:k().optional().default(`UTC`)});var Dl=H([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Ol=R({type:H([`user`,`team`,`record`]).describe(`Mention target type`),id:k().describe(`Target ID`),name:k().describe(`Display name for rendering`),offset:j().int().min(0).describe(`Character offset in body text`),length:j().int().min(1).describe(`Length of mention token in body text`)}),kl=R({field:k().describe(`Field machine name`),fieldLabel:k().optional().describe(`Field display label`),oldValue:P().optional().describe(`Previous value`),newValue:P().optional().describe(`New value`),oldDisplayValue:k().optional().describe(`Human-readable old value`),newDisplayValue:k().optional().describe(`Human-readable new value`)}),Al=R({emoji:k().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:L(k()).describe(`Users who reacted`),count:j().int().min(1).describe(`Total reaction count`)}),jl=R({type:H([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:k().describe(`Actor ID`),name:k().optional().describe(`Actor display name`),avatarUrl:k().url().optional().describe(`Actor avatar URL`),source:k().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),Ml=H([`public`,`internal`,`private`]);R({id:k().describe(`Feed item ID`),type:Dl.describe(`Activity type`),object:k().describe(`Object name (e.g., "account")`),recordId:k().describe(`Record ID this feed item belongs to`),actor:jl.describe(`Who performed this action`),body:k().optional().describe(`Rich text body (Markdown supported)`),mentions:L(Ol).optional().describe(`Mentioned users/teams/records`),changes:L(kl).optional().describe(`Field-level changes`),reactions:L(Al).optional().describe(`Emoji reactions on this item`),parentId:k().optional().describe(`Parent feed item ID for threaded replies`),replyCount:j().int().min(0).default(0).describe(`Number of replies`),pinned:M().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:k().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:k().optional().describe(`User ID who pinned the item`),starred:M().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:k().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Ml.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:k().datetime().describe(`Creation timestamp`),updatedAt:k().datetime().optional().describe(`Last update timestamp`),editedAt:k().datetime().optional().describe(`When comment was last edited`),isEdited:M().default(!1).describe(`Whether comment has been edited`)}),H([`all`,`comments_only`,`changes_only`,`tasks_only`]);var Nl=H([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),Pl=H([`in_app`,`email`,`push`,`slack`]);R({object:k().describe(`Object name`),recordId:k().describe(`Record ID`),userId:k().describe(`Subscribing user ID`),events:L(Nl).default([`all`]).describe(`Event types to receive notifications for`),channels:L(Pl).default([`in_app`]).describe(`Notification delivery channels`),active:M().default(!0).describe(`Whether the subscription is active`),createdAt:k().datetime().describe(`Subscription creation timestamp`)});var Fl=H([`header`,`subdomain`,`path`,`token`,`lookup`]).describe(`Strategy for resolving tenant identity from request context`),Il=R({name:k().min(1).describe(`Turso database group name`),primaryLocation:k().min(2).describe(`Primary Turso region code (e.g., iad, lhr, nrt)`),replicaLocations:L(k().min(2)).default([]).describe(`Additional replica region codes`),schemaDatabase:k().optional().describe(`Schema database name for multi-db schemas`)}).describe(`Turso database group configuration`),Ll=R({onTenantCreate:R({autoCreate:M().default(!0).describe(`Auto-create database on tenant registration`),group:k().optional().describe(`Turso group for the new database`),applyGroupSchema:M().default(!0).describe(`Apply shared schema from group`),seedData:M().default(!1).describe(`Populate seed data on creation`)}).describe(`Tenant creation hook`),onTenantDelete:R({immediate:M().default(!1).describe(`Destroy database immediately`),gracePeriodHours:j().int().min(0).default(72).describe(`Grace period before permanent deletion`),createBackup:M().default(!0).describe(`Create backup before deletion`)}).describe(`Tenant deletion hook`),onTenantSuspend:R({revokeTokens:M().default(!0).describe(`Revoke auth tokens on suspension`),readOnly:M().default(!0).describe(`Set database to read-only on suspension`)}).describe(`Tenant suspension hook`)}).describe(`Tenant database lifecycle hooks`);R({organizationSlug:k().min(1).describe(`Turso organization slug`),urlTemplate:k().min(1).describe(`URL template with {tenant_id} placeholder`),groupAuthToken:k().min(1).describe(`Group-level auth token for platform operations`),tenantResolverStrategy:Fl.default(`token`),group:Il.optional().describe(`Database group configuration`),lifecycle:Ll.optional().describe(`Lifecycle hooks`),maxCachedConnections:j().int().min(1).default(100).describe(`Max cached tenant connections (LRU)`),connectionCacheTTL:j().int().min(0).default(300).describe(`Connection cache TTL in seconds`)}).describe(`Turso multi-tenant router configuration`);export{k as A,so as C,G as D,Zo as E,va as F,ca as I,zr as L,z as M,P as N,V as O,Sa as P,Ir as R,U as S,R as T,qo as _,ns as a,vo as b,Qa as c,Xo as d,ro as f,M as g,L as h,Qo as i,B as j,po as k,H as l,N as m,gc as n,as as o,F as p,ll as r,to as s,Fs as t,K as u,I as v,j as w,W as x,go as y}; \ No newline at end of file diff --git a/apps/server/public/assets/index-BqvyhY64.js b/apps/server/public/assets/index-BqvyhY64.js new file mode 100644 index 000000000..1fb137db5 --- /dev/null +++ b/apps/server/public/assets/index-BqvyhY64.js @@ -0,0 +1,306 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./__vite-browser-external-BJgzPGy7.js","./chunk-DECur_0Z.js","./data-CGvg7kH3.js"])))=>i.map(i=>d[i]); +import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{A as r,D as i,E as a,F as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,_ as g,a as _,b as v,c as y,d as b,f as x,g as S,h as C,j as w,k as T,l as E,m as D,n as O,o as ee,p as te,r as k,s as A,t as j,u as M,v as N,w as P,x as F,y as I}from"./data-CGvg7kH3.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 ne=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 D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(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?ee(``+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&&(O(o)&&(o=D(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{t.exports=ne()})),ie=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(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,O());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()-Tt&&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?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,te=ee.port2;ee.port1.onmessage=D,O=function(){te.postMessage(null)}}else O=function(){_(D,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||125o?(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,O()))),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}}}})),ae=n(((e,t)=>{t.exports=ie()})),oe=n((e=>{var t=re();function n(e){var t=`https://react.dev/errors/`+e;if(1{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=oe()})),ce=n((e=>{var t=ae(),n=re(),r=se();function i(e){var t=`https://react.dev/errors/`+e;if(1F||(e.current=P[F],P[F]=null,F--)}function ie(e,t){F++,P[F]=e.current,e.current=t}var oe=I(null),ce=I(null),le=I(null),L=I(null);function ue(e,t){switch(ie(le,t),ie(ce,e),ie(oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ld(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ld(t),e=Rd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ne(oe),ie(oe,e)}function de(){ne(oe),ne(ce),ne(le)}function fe(e){e.memoizedState!==null&&ie(L,e);var t=oe.current,n=Rd(t,e.type);t!==n&&(ie(ce,e),ie(oe,n))}function pe(e){ce.current===e&&(ne(oe),ne(ce)),L.current===e&&(ne(L),Gf._currentValue=N)}var me,he;function ge(e){if(me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);me=t&&t[1]||``,he=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{_e=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ge(n):``}function ye(e,t){switch(e.tag){case 26:case 27:case 5:return ge(e.type);case 16:return ge(`Lazy`);case 13:return e.child!==t&&t!==null?ge(`Suspense Fallback`):ge(`Suspense`);case 19:return ge(`SuspenseList`);case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return ge(`Activity`);default:return``}}function be(e){try{var t=``,n=null;do t+=ye(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var xe=Object.prototype.hasOwnProperty,Se=t.unstable_scheduleCallback,Ce=t.unstable_cancelCallback,we=t.unstable_shouldYield,Te=t.unstable_requestPaint,Ee=t.unstable_now,De=t.unstable_getCurrentPriorityLevel,Oe=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function Le(e){if(typeof Ne==`function`&&Pe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Re=Math.clz32?Math.clz32:Ve,ze=Math.log,Be=Math.LN2;function Ve(e){return e>>>=0,e===0?32:31-(ze(e)/Be|0)|0}var He=256,Ue=262144,We=4194304;function Ge(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ke(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ge(n))):i=Ge(o):i=Ge(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ge(n))):i=Ge(o)):i=Ge(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function eee(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Je(){var e=We;return We<<=1,!(We&62914560)&&(We=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),ln=!1;if(cn)try{var un={};Object.defineProperty(un,`passive`,{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,fn=null,pn=null;function mn(){if(pn)return pn;var e,t=fn,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e=Vn),Wn=` `,Gn=!1;function Kn(e,t){switch(e){case`keyup`:return oee.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Jn=!1;function Yn(e,t){switch(e){case`compositionend`:return qn(t);case`keypress`:return t.which===32?(Gn=!0,Wn):null;case`textInput`:return e=t.data,e===Wn&&Gn?null:e;default:return null}}function Xn(e,t){if(Jn)return e===`compositionend`||!Bn&&Kn(e,t)?(e=mn(),pn=fn=dn=null,Jn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=mr(n)}}function gr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _r(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=It(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=It(e.document)}return t}function vr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var yr=cn&&`documentMode`in document&&11>=document.documentMode,br=null,xr=null,Sr=null,Cr=!1;function wr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Cr||br==null||br!==It(r)||(r=br,`selectionStart`in r&&vr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Sr&&pr(Sr,r)||(Sr=r,r=xd(xr,`onSelect`),0>=o,i-=o,hi=1<<32-Re(t)+i|n<m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),wi&&_i(i,m),l;if(d===null){for(;mh?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),wi&&_i(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return wi&&_i(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),wi&&_i(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&ha(l)===r.type){n(e,r.sibling),c=a(r,o.props),Sa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=ni(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ti(o.type,o.key,o.props,null,e.mode,c),Sa(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ai(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=ha(o),x(e,r,o,c)}if(A(o))return v(e,r,o,c);if(ee(o)){if(l=ee(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,xa(o),c);if(o.$$typeof===b)return x(e,r,Gi(e,o),c);Ca(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ri(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ba=0;var i=x(e,t,n,r);return ya=null,i}catch(t){if(t===la||t===da)throw t;var a=Zr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ta=wa(!0),Ea=wa(!1),Da=!1;function Oa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ka(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Aa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ja(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ol&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Jr(e),qr(e,null,n),t}return Wr(e,r,t,n),Jr(e)}function Ma(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}function Na(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Pa=!1;function Fa(){if(Pa){var e=na;if(e!==null)throw e}}function Ia(e,t,n,r){Pa=!1;var i=e.updateQueue;Da=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(jl&p)===p:(r&p)===p){p!==0&&p===ta&&(Pa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Da=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),zl|=o,e.lanes=o,e.memoizedState=d}}function La(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ra(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=j.T,s={};j.T=s,Cs(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ss(e,t,pee(c,r),su(e)):Ss(e,t,r,su(e))}catch(n){Ss(e,t,{then:function(){},status:`rejected`,reason:n},su())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function mee(){}function ms(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=hs(e).queue;ps(e,a,t,N,n===null?mee:function(){return gs(e),n(r)})}function hs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:N,baseState:N,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:N},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function gs(e){var t=hs(e);t.next===null&&(t=e.alternate.memoizedState),Ss(e,t.next.queue,{},su())}function _s(){return Wi(Gf)}function vs(){return xo().memoizedState}function ys(){return xo().memoizedState}function hee(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=su();e=Aa(n);var r=ja(t,e,n);r!==null&&(lu(r,t,n),Ma(r,t,n)),t={cache:Zi()},e.payload=t;return}t=t.return}}function bs(e,t,n){var r=su();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ws(e)?Ts(t,n):(n=Gr(e,t,n,r),n!==null&&(lu(n,e,r),Es(n,t,r)))}function xs(e,t,n){Ss(e,t,n,su())}function Ss(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ws(e))Ts(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,fr(s,o))return Wr(e,t,i,0),kl===null&&Ur(),!1}catch{}if(n=Gr(e,t,i,r),n!==null)return lu(n,e,r),Es(n,t,r),!0}return!1}function Cs(e,t,n,r){if(r={lane:2,revertLane:ad(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ws(e)){if(t)throw Error(i(479))}else t=Gr(e,n,r,2),t!==null&&lu(t,e,2)}function ws(e){var t=e.alternate;return e===eo||t!==null&&t===eo}function Ts(e,t){io=ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Es(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}var Ds={readContext:Wi,use:wo,useCallback:uo,useContext:uo,useEffect:uo,useImperativeHandle:uo,useLayoutEffect:uo,useInsertionEffect:uo,useMemo:uo,useReducer:uo,useRef:uo,useState:uo,useDebugValue:uo,useDeferredValue:uo,useTransition:uo,useSyncExternalStore:uo,useId:uo,useHostTransitionStatus:uo,useFormState:uo,useActionState:uo,useOptimistic:uo,useMemoCache:uo,useCacheRefresh:uo};Ds.useEffectEvent=uo;var Os={readContext:Wi,use:wo,useCallback:function(e,t){return bo().memoizedState=[e,t===void 0?null:t],e},useContext:Wi,useEffect:es,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Qo(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qo(4194308,4,e,t)},useInsertionEffect:function(e,t){Qo(4,2,e,t)},useMemo:function(e,t){var n=bo();t=t===void 0?null:t;var r=e();if(ao){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=bo();if(n!==void 0){var i=n(t);if(ao){Le(!0);try{n(t)}finally{Le(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=bs.bind(null,eo,e),[r.memoizedState,e]},useRef:function(e){var t=bo();return e={current:e},t.memoizedState=e},useState:function(e){e=Io(e);var t=e.queue,n=xs.bind(null,eo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:cs,useDeferredValue:function(e,t){return ds(bo(),e,t)},useTransition:function(){var e=Io(!1);return e=ps.bind(null,eo,e.queue,!0,!1),bo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=eo,a=bo();if(wi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),kl===null)throw Error(i(349));jl&127||jo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,es(No.bind(null,r,o,e),[e]),r.flags|=2048,Xo(9,{destroy:void 0},Mo.bind(null,r,o,n,t),null),n},useId:function(){var e=bo(),t=kl.identifierPrefix;if(wi){var n=gi,r=hi;n=(r&~(1<<32-Re(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=oo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ot]=t,o[st]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Ad(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&xc(t)}}return Ec(t),Sc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&xc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=le.current,ji(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Si,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Dd(e.nodeValue,n)),e||Oi(t,!0)}else e=Id(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Ec(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ji(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ot]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ec(t),e=!1}else n=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Xa(t),t):(Xa(t),null);if(t.flags&128)throw Error(i(558))}return Ec(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ji(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ot]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ec(t),a=!1}else a=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Xa(t),t):(Xa(t),null)}return Xa(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),wc(t,t.updateQueue),Ec(t),null);case 4:return de(),e===null&&_d(t.stateNode.containerInfo),Ec(t),null;case 10:return zi(t.type),Ec(t),null;case 19:if(ne(Za),r=t.memoizedState,r===null)return Ec(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Tc(r,!1);else{if(Rl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Qa(e),o!==null){for(t.flags|=128,Tc(r,!1),e=o.updateQueue,t.updateQueue=e,wc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ei(n,e),n=n.sibling;return ie(Za,Za.current&1|2),wi&&_i(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ee()>Yl&&(t.flags|=128,a=!0,Tc(r,!1),t.lanes=4194304)}else{if(!a)if(e=Qa(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,wc(t,e),Tc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!wi)return Ec(t),null}else 2*Ee()-r.renderingStartTime>Yl&&n!==536870912&&(t.flags|=128,a=!0,Tc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Ec(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ee(),e.sibling=null,n=Za.current,ie(Za,a?n&1|2:n&1),wi&&_i(t,r.treeForkCount),e);case 22:case 23:return Xa(t),Ua(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ec(t),t.subtreeFlags&6&&(t.flags|=8192)):Ec(t),n=t.updateQueue,n!==null&&wc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ne(aa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),zi(Xi),Ec(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Oc(e,t){switch(bi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zi(Xi),de(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pe(t),null;case 31:if(t.memoizedState!==null){if(Xa(t),t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Xa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ne(Za),null;case 4:return de(),null;case 10:return zi(t.type),null;case 22:case 23:return Xa(t),Ua(),e!==null&&ne(aa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zi(Xi),null;case 25:return null;default:return null}}function kc(e,t){switch(bi(t),t.tag){case 3:zi(Xi),de();break;case 26:case 27:case 5:pe(t);break;case 4:de();break;case 31:t.memoizedState!==null&&Xa(t);break;case 13:Xa(t);break;case 19:ne(Za);break;case 10:zi(t.type);break;case 22:case 23:Xa(t),Ua(),e!==null&&ne(aa);break;case 24:zi(Xi)}}function Ac(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){zu(t,t.return,e)}}function jc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){zu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){zu(t,t.return,e)}}function Mc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ra(t,n)}catch(t){zu(e,e.return,t)}}}function Nc(e,t,n){n.props=Fs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){zu(e,t,n)}}function Pc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){zu(e,t,n)}}function Fc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){zu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){zu(e,t,n)}else n.current=null}function Ic(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){zu(e,e.return,t)}}function Lc(e,t,n){try{var r=e.stateNode;jd(r,e.type,n,t),r[st]=t}catch(t){zu(e,e.return,t)}}function Rc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qd(e.type)||e.tag===4}function zc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Rc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&qd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Bc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&qd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Bc(e,t,n),e=e.sibling;e!==null;)Bc(e,t,n),e=e.sibling}function Vc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&qd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Vc(e,t,n),e=e.sibling;e!==null;)Vc(e,t,n),e=e.sibling}function Hc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ad(t,r,n),t[ot]=e,t[st]=n}catch(t){zu(e,e.return,t)}}var Uc=!1,Wc=!1,Gc=!1,Kc=typeof WeakSet==`function`?WeakSet:Set,qc=null;function _ee(e,t){if(e=e.containerInfo,Pd=ep,e=_r(e),vr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Fd={focusedElem:e,selectionRange:n},ep=!1,qc=t;qc!==null;)if(t=qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,qc=e;else for(;qc!==null;){switch(t=qc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Ad(o,r,n),o[ot]=e,yt(o),r=o;break a;case`link`:var s=Pf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=hr(s,h),v=hr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,j.T=null,n=ru,ru=null;var o=$l,s=tu;if(Ql=0,eu=$l=null,tu=0,Ol&6)throw Error(i(331));var c=Ol;if(Ol|=4,Cl(o.current),hl(o,o.current,s,n),Ol=c,Qu(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,o)}catch{}return!0}finally{M.p=a,j.T=r,Fu(e,t)}}function Ru(e,t,n){t=si(n,t),t=Vs(e.stateNode,t,2),e=ja(e,t,2),e!==null&&(Xe(e,2),Zu(e))}function zu(e,t,n){if(e.tag===3)Ru(e,e,n);else for(;t!==null;){if(t.tag===3){Ru(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Zl===null||!Zl.has(r))){e=si(n,e),n=Hs(2),r=ja(t,n,2),r!==null&&(Us(n,r,t,e),Xe(r,2),Zu(r));break}}t=t.return}}function Bu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Dl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Il=!0,i.add(n),e=Vu.bind(null,e,t,n),t.then(e,e))}function Vu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,kl===e&&(jl&n)===n&&(Rl===4||Rl===3&&(jl&62914560)===jl&&300>Ee()-ql?!(Ol&2)&&gu(e,0):Vl|=n,Ul===jl&&(Ul=0)),Zu(e)}function Hu(e,t){t===0&&(t=Je()),e=Kr(e,t),e!==null&&(Xe(e,t),Zu(e))}function Uu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Hu(e,n)}function vee(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Hu(e,n)}function Wu(e,t){return Se(e,t)}var Gu=null,Ku=null,qu=!1,Ju=!1,Yu=!1,Xu=0;function Zu(e){e!==Ku&&e.next===null&&(Ku===null?Gu=Ku=e:Ku=Ku.next=e),Ju=!0,qu||(qu=!0,id())}function Qu(e,t){if(!Yu&&Ju){Yu=!0;do for(var n=!1,r=Gu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Re(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,rd(r,a))}else a=jl,a=Ke(r,r===kl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||qe(r,a)||(n=!0,rd(r,a));r=r.next}while(n);Yu=!1}}function $u(){ed()}function ed(){Ju=qu=!1;var e=0;Xu!==0&&Vd()&&(e=Xu);for(var t=Ee(),n=null,r=Gu;r!==null;){var i=r.next,a=td(r,t);a===0?(r.next=null,n===null?Gu=i:n.next=i,i===null&&(Ku=n)):(n=r,(e!==0||a&3)&&(Ju=!0)),r=i}Ql!==0&&Ql!==5||Qu(e,!1),Xu!==0&&(Xu=0)}function td(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Md(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function mf(e,t,n){var r=pf;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),lf.has(i)||(lf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ad(t,`link`,e),yt(t),r.head.appendChild(t)))}}function hf(e){df.D(e),mf(`dns-prefetch`,e,null)}function gf(e,t){df.C(e,t),mf(`preconnect`,e,t)}function _f(e,t,n){df.L(e,t,n);var r=pf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=Cf(e);break;case`script`:a=Df(e)}cf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),cf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(wf(a))||t===`script`&&r.querySelector(Of(a))||(t=r.createElement(`link`),Ad(t,`link`,e),yt(t),r.head.appendChild(t)))}}function vf(e,t){df.m(e,t);var n=pf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Rt(r)+`"][href="`+Rt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Df(e)}if(!cf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),cf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Of(a)))return}r=n.createElement(`link`),Ad(r,`link`,e),yt(r),n.head.appendChild(r)}}}function yf(e,t,n){df.S(e,t,n);var r=pf;if(r&&e){var i=vt(r).hoistableStyles,a=Cf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(wf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=cf.get(a))&&jf(e,n);var c=o=r.createElement(`link`);yt(c),Ad(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Af(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function bf(e,t){df.X(e,t);var n=pf;if(n&&e){var r=vt(n).hoistableScripts,i=Df(e),a=r.get(i);a||(a=n.querySelector(Of(i)),a||(e=f({src:e,async:!0},t),(t=cf.get(i))&&Mf(e,t),a=n.createElement(`script`),yt(a),Ad(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function xf(e,t){df.M(e,t);var n=pf;if(n&&e){var r=vt(n).hoistableScripts,i=Df(e),a=r.get(i);a||(a=n.querySelector(Of(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=cf.get(i))&&Mf(e,t),a=n.createElement(`script`),yt(a),Ad(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Sf(e,t,n,r){var a=(a=le.current)?uf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Cf(n.href),n=vt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Cf(n.href);var o=vt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(wf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),cf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},cf.set(e,n),o||Ef(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Df(n),n=vt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Cf(e){return`href="`+Rt(e)+`"`}function wf(e){return`link[rel="stylesheet"][`+e+`]`}function Tf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Ef(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ad(t,`link`,n),yt(t),e.head.appendChild(t))}function Df(e){return`[src="`+Rt(e)+`"]`}function Of(e){return`script[async]`+e}function kf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Ad(r,`style`,a),Af(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Cf(n.href);var o=e.querySelector(wf(a));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=Tf(n),(a=cf.get(a))&&jf(r,a),o=(e.ownerDocument||e).createElement(`link`),yt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ad(o,`link`,r),t.state.loading|=4,Af(o,n.precedence,e),t.instance=o;case`script`:return o=Df(n.src),(a=e.querySelector(Of(o)))?(t.instance=a,yt(a),a):(r=n,(a=cf.get(o))&&(r=f({},n),Mf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(a),Ad(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Af(r,n.precedence,e));return t.instance}function Af(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function If(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Lf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Rf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Cf(r.href),a=t.querySelector(wf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Vf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Tf(r),(i=cf.get(i))&&jf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ad(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Vf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var zf=0;function Bf(e,t){return e.stylesheets&&e.count===0&&Uf(e,e.stylesheets),0zf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Vf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Uf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Hf=null;function Uf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Hf=new Map,t.forEach(Wf,e),Hf=null,Vf.call(e))}function Wf(e,t){if(!(t.state.loading&4)){var n=Hf.get(e);if(n)var r=n.get(null);else{n=new Map,Hf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{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=ce()})),L=t(re(),1),ue=t(le(),1),de={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},fe;(function(e){})(fe||={});function pe(e){return p(y,e)}function me(e){return c(A,e)}var he=E([`lru`,`lfu`,`fifo`,`ttl`,`adaptive`]).describe(`Cache eviction strategy`),ge=h({name:r().describe(`Unique cache tier name`),type:E([`memory`,`redis`,`memcached`,`cdn`]).describe(`Cache backend type`),maxSize:P().optional().describe(`Max size in MB`),ttl:P().default(300).describe(`Default TTL in seconds`),strategy:he.default(`lru`).describe(`Eviction strategy`),warmup:S().default(!1).describe(`Pre-populate cache on startup`)}).describe(`Configuration for a single cache tier in the hierarchy`),_e=h({trigger:E([`create`,`update`,`delete`,`manual`]).describe(`Event that triggers invalidation`),scope:E([`key`,`pattern`,`tag`,`all`]).describe(`Invalidation scope`),pattern:r().optional().describe(`Key pattern for pattern-based invalidation`),tags:C(r()).optional().describe(`Cache tags to invalidate`)}).describe(`Rule defining when and how cached entries are invalidated`),ve=h({enabled:S().default(!1).describe(`Enable application-level caching`),tiers:C(ge).describe(`Ordered cache tier hierarchy`),invalidation:C(_e).describe(`Cache invalidation rules`),prefetch:S().default(!1).describe(`Enable cache prefetching`),compression:S().default(!1).describe(`Enable data compression in cache`),encryption:S().default(!1).describe(`Enable encryption for cached data`)}).describe(`Top-level application cache configuration`),ye=E([`write_through`,`write_behind`,`write_around`,`refresh_ahead`]).describe(`Distributed cache write consistency strategy`),be=h({jitterTtl:h({enabled:S().default(!1).describe(`Add random jitter to TTL values`),maxJitterSeconds:P().default(60).describe(`Maximum jitter added to TTL in seconds`)}).optional().describe(`TTL jitter to prevent simultaneous expiration`),circuitBreaker:h({enabled:S().default(!1).describe(`Enable circuit breaker for backend protection`),failureThreshold:P().default(5).describe(`Failures before circuit opens`),resetTimeout:P().default(30).describe(`Seconds before half-open state`)}).optional().describe(`Circuit breaker for backend protection`),lockout:h({enabled:S().default(!1).describe(`Enable cache locking for key regeneration`),lockTimeoutMs:P().default(5e3).describe(`Maximum lock wait time in milliseconds`)}).optional().describe(`Lock-based stampede prevention`)}).describe(`Cache avalanche/stampede prevention configuration`),xe=h({enabled:S().default(!1).describe(`Enable cache warmup`),strategy:E([`eager`,`lazy`,`scheduled`]).default(`lazy`).describe(`Warmup strategy: eager (at startup), lazy (on first access), scheduled (cron)`),schedule:r().optional().describe(`Cron expression for scheduled warmup`),patterns:C(r()).optional().describe(`Key patterns to warm up (e.g., "user:*", "config:*")`),concurrency:P().default(10).describe(`Maximum concurrent warmup operations`)}).describe(`Cache warmup strategy`);ve.extend({consistency:ye.optional().describe(`Distributed cache consistency strategy`),avalanchePrevention:be.optional().describe(`Cache avalanche and stampede prevention`),warmup:xe.optional().describe(`Cache warmup strategy`)}).describe(`Distributed cache configuration with consistency and avalanche prevention`);var Se=E([`full`,`incremental`,`differential`]).describe(`Backup strategy type`),Ce=h({days:P().min(1).describe(`Retention period in days`),minCopies:P().min(1).default(3).describe(`Minimum backup copies to retain`),maxCopies:P().optional().describe(`Maximum backup copies to store`)}).describe(`Backup retention policy`),we=h({strategy:Se.default(`incremental`).describe(`Backup strategy`),schedule:r().optional().describe(`Cron expression for backup schedule (e.g., "0 2 * * *")`),retention:Ce.describe(`Backup retention policy`),destination:h({type:E([`s3`,`gcs`,`azure_blob`,`local`]).describe(`Storage backend type`),bucket:r().optional().describe(`Cloud storage bucket/container name`),path:r().optional().describe(`Storage path prefix`),region:r().optional().describe(`Cloud storage region`)}).describe(`Backup storage destination`),encryption:h({enabled:S().default(!0).describe(`Enable backup encryption`),algorithm:E([`AES-256-GCM`,`AES-256-CBC`,`ChaCha20-Poly1305`]).default(`AES-256-GCM`).describe(`Encryption algorithm`),keyId:r().optional().describe(`KMS key ID for encryption`)}).optional().describe(`Backup encryption settings`),compression:h({enabled:S().default(!0).describe(`Enable backup compression`),algorithm:E([`gzip`,`zstd`,`lz4`,`snappy`]).default(`zstd`).describe(`Compression algorithm`)}).optional().describe(`Backup compression settings`),verifyAfterBackup:S().default(!0).describe(`Verify backup integrity after creation`)}).describe(`Backup configuration`),Te=h({mode:E([`active_passive`,`active_active`,`pilot_light`,`warm_standby`]).describe(`Failover mode`).default(`active_passive`).describe(`Failover mode`),autoFailover:S().default(!0).describe(`Enable automatic failover`),healthCheckInterval:P().default(30).describe(`Health check interval in seconds`),failureThreshold:P().default(3).describe(`Consecutive failures before failover`),regions:C(h({name:r().describe(`Region identifier (e.g., "us-east-1", "eu-west-1")`),role:E([`primary`,`secondary`,`witness`]).describe(`Region role`),endpoint:r().optional().describe(`Region endpoint URL`),priority:P().optional().describe(`Failover priority (lower = higher priority)`)})).min(2).describe(`Multi-region configuration (minimum 2 regions)`),dns:h({ttl:P().default(60).describe(`DNS TTL in seconds for failover`),provider:E([`route53`,`cloudflare`,`azure_dns`,`custom`]).optional().describe(`DNS provider for automatic failover`)}).optional().describe(`DNS failover settings`)}).describe(`Failover configuration`),Ee=h({value:P().min(0).describe(`RPO value`),unit:E([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RPO time unit`)}).describe(`Recovery Point Objective (maximum acceptable data loss)`),De=h({value:P().min(0).describe(`RTO value`),unit:E([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RTO time unit`)}).describe(`Recovery Time Objective (maximum acceptable downtime)`);h({enabled:S().default(!1).describe(`Enable disaster recovery plan`),rpo:Ee.describe(`Recovery Point Objective`),rto:De.describe(`Recovery Time Objective`),backup:we.describe(`Backup configuration`),failover:Te.optional().describe(`Multi-region failover configuration`),replication:h({mode:E([`synchronous`,`asynchronous`,`semi_synchronous`]).default(`asynchronous`).describe(`Data replication mode`),maxLagSeconds:P().optional().describe(`Maximum acceptable replication lag in seconds`),includeObjects:C(r()).optional().describe(`Objects to replicate (empty = all)`),excludeObjects:C(r()).optional().describe(`Objects to exclude from replication`)}).optional().describe(`Data replication settings`),testing:h({enabled:S().default(!1).describe(`Enable automated DR testing`),schedule:r().optional().describe(`Cron expression for DR test schedule`),notificationChannel:r().optional().describe(`Notification channel for DR test results`)}).optional().describe(`Automated disaster recovery testing`),runbookUrl:r().optional().describe(`URL to disaster recovery runbook/playbook`),contacts:C(h({name:r().describe(`Contact name`),role:r().describe(`Contact role (e.g., "DBA", "SRE Lead")`),email:r().optional().describe(`Contact email`),phone:r().optional().describe(`Contact phone`)})).optional().describe(`Emergency contact list for DR incidents`)}).describe(`Complete disaster recovery plan configuration`);var Oe=E([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Supported message queue backend provider`),ke=h({name:r().describe(`Topic name identifier`),partitions:P().default(1).describe(`Number of partitions for parallel consumption`),replicationFactor:P().default(1).describe(`Number of replicas for fault tolerance`),retentionMs:P().optional().describe(`Message retention period in milliseconds`),compressionType:E([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression algorithm`)}).describe(`Configuration for a message queue topic`),Ae=h({groupId:r().describe(`Consumer group identifier`),autoOffsetReset:E([`earliest`,`latest`]).default(`latest`).describe(`Where to start reading when no offset exists`),enableAutoCommit:S().default(!0).describe(`Automatically commit consumed offsets`),maxPollRecords:P().default(500).describe(`Maximum records returned per poll`)}).describe(`Consumer group configuration for topic consumption`),je=h({enabled:S().default(!1).describe(`Enable dead letter queue for failed messages`),maxRetries:P().default(3).describe(`Maximum delivery attempts before sending to DLQ`),queueName:r().describe(`Name of the dead letter queue`)}).describe(`Dead letter queue configuration for unprocessable messages`);h({provider:Oe.describe(`Message queue backend provider`),topics:C(ke).describe(`List of topic configurations`),consumers:C(Ae).optional().describe(`Consumer group configurations`),deadLetterQueue:je.optional().describe(`Dead letter queue for failed messages`),ssl:S().default(!1).describe(`Enable SSL/TLS for broker connections`),sasl:h({mechanism:E([`plain`,`scram-sha-256`,`scram-sha-512`]).describe(`SASL authentication mechanism`),username:r().describe(`SASL username`),password:r().describe(`SASL password`)}).optional().describe(`SASL authentication configuration`)}).describe(`Top-level message queue configuration`);var Me=r().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)`),Ne=r().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)`);r().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 Pe=E([`global`,`tenant`,`user`,`session`,`temp`,`cache`,`data`,`logs`,`config`,`public`]).describe(`Storage scope classification`);h({path:r().describe(`File path`),name:r().describe(`File name`),size:P().int().describe(`File size in bytes`),mimeType:r().describe(`MIME type`),lastModified:r().datetime().describe(`Last modified timestamp`),created:r().datetime().describe(`Creation timestamp`),etag:r().optional().describe(`Entity tag`)});var Fe=E([`s3`,`azure_blob`,`gcs`,`minio`,`r2`,`spaces`,`wasabi`,`backblaze`,`local`]).describe(`Storage provider type`),Ie=E([`private`,`public_read`,`public_read_write`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full_control`]).describe(`Storage access control level`),Le=E([`standard`,`intelligent`,`infrequent_access`,`glacier`,`deep_archive`]).describe(`Storage class/tier for cost optimization`),Re=E([`transition`,`delete`,`abort`]).describe(`Lifecycle policy action type`);h({contentType:r().describe(`MIME type (e.g., image/jpeg, application/pdf)`),contentLength:P().min(0).describe(`File size in bytes`),contentEncoding:r().optional().describe(`Content encoding (e.g., gzip)`),contentDisposition:r().optional().describe(`Content disposition header`),contentLanguage:r().optional().describe(`Content language`),cacheControl:r().optional().describe(`Cache control directives`),etag:r().optional().describe(`Entity tag for versioning/caching`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),versionId:r().optional().describe(`Object version identifier`),storageClass:Le.optional().describe(`Storage class/tier`),encryption:h({algorithm:r().describe(`Encryption algorithm (e.g., AES256, aws:kms)`),keyId:r().optional().describe(`KMS key ID if using managed encryption`)}).optional().describe(`Server-side encryption configuration`),custom:d(r(),r()).optional().describe(`Custom user-defined metadata`)}),h({operation:E([`get`,`put`,`delete`,`head`]).describe(`Allowed operation`),expiresIn:P().min(1).max(604800).describe(`Expiration time in seconds (max 7 days)`),contentType:r().optional().describe(`Required content type for PUT operations`),maxSize:P().min(0).optional().describe(`Maximum file size in bytes for PUT operations`),responseContentType:r().optional().describe(`Override content-type for GET operations`),responseContentDisposition:r().optional().describe(`Override content-disposition for GET operations`)});var ze=h({enabled:S().default(!0).describe(`Enable multipart uploads`),partSize:P().min(5*1024*1024).max(5*1024*1024*1024).default(10*1024*1024).describe(`Part size in bytes (min 5MB, max 5GB)`),maxParts:P().min(1).max(1e4).default(1e4).describe(`Maximum number of parts (max 10,000)`),threshold:P().min(0).default(100*1024*1024).describe(`File size threshold to trigger multipart upload (bytes)`),maxConcurrent:P().min(1).max(100).default(4).describe(`Maximum concurrent part uploads`),abortIncompleteAfterDays:P().min(1).optional().describe(`Auto-abort incomplete uploads after N days`)}),Be=h({acl:Ie.default(`private`).describe(`Default access control level`),allowedOrigins:C(r()).optional().describe(`CORS allowed origins`),allowedMethods:C(E([`GET`,`PUT`,`POST`,`DELETE`,`HEAD`])).optional().describe(`CORS allowed HTTP methods`),allowedHeaders:C(r()).optional().describe(`CORS allowed headers`),exposeHeaders:C(r()).optional().describe(`CORS exposed headers`),maxAge:P().min(0).optional().describe(`CORS preflight cache duration in seconds`),corsEnabled:S().default(!1).describe(`Enable CORS configuration`),publicAccess:h({allowPublicRead:S().default(!1).describe(`Allow public read access`),allowPublicWrite:S().default(!1).describe(`Allow public write access`),allowPublicList:S().default(!1).describe(`Allow public bucket listing`)}).optional().describe(`Public access control`),allowedIps:C(r()).optional().describe(`Allowed IP addresses/CIDR blocks`),blockedIps:C(r()).optional().describe(`Blocked IP addresses/CIDR blocks`)}),Ve=h({id:Me.describe(`Rule identifier`),enabled:S().default(!0).describe(`Enable this rule`),action:Re.describe(`Action to perform`),prefix:r().optional().describe(`Object key prefix filter (e.g., "uploads/")`),tags:d(r(),r()).optional().describe(`Object tag filters`),daysAfterCreation:P().min(0).optional().describe(`Days after object creation`),daysAfterModification:P().min(0).optional().describe(`Days after last modification`),targetStorageClass:Le.optional().describe(`Target storage class for transition action`)}).refine(e=>!(e.action===`transition`&&!e.targetStorageClass),{message:`targetStorageClass is required when action is "transition"`}),He=h({enabled:S().default(!1).describe(`Enable lifecycle policies`),rules:C(Ve).default([]).describe(`Lifecycle rules`)}),Ue=h({name:Me.describe(`Bucket identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),bucketName:r().describe(`Actual bucket/container name in storage provider`),region:r().optional().describe(`Storage region (e.g., us-east-1, westus)`),provider:Fe.describe(`Storage provider`),endpoint:r().optional().describe(`Custom endpoint URL (for S3-compatible providers)`),pathStyle:S().default(!1).describe(`Use path-style URLs (for S3-compatible providers)`),versioning:S().default(!1).describe(`Enable object versioning`),encryption:h({enabled:S().default(!1).describe(`Enable server-side encryption`),algorithm:E([`AES256`,`aws:kms`,`azure:kms`,`gcp:kms`]).default(`AES256`).describe(`Encryption algorithm`),kmsKeyId:r().optional().describe(`KMS key ID for managed encryption`)}).optional().describe(`Server-side encryption configuration`),accessControl:Be.optional().describe(`Access control configuration`),lifecyclePolicy:He.optional().describe(`Lifecycle policy configuration`),multipartConfig:ze.optional().describe(`Multipart upload configuration`),tags:d(r(),r()).optional().describe(`Bucket tags for organization`),description:r().optional().describe(`Bucket description`),enabled:S().default(!0).describe(`Enable this bucket`)}),We=h({accessKeyId:r().optional().describe(`AWS access key ID or MinIO access key`),secretAccessKey:r().optional().describe(`AWS secret access key or MinIO secret key`),sessionToken:r().optional().describe(`AWS session token for temporary credentials`),accountName:r().optional().describe(`Azure storage account name`),accountKey:r().optional().describe(`Azure storage account key`),sasToken:r().optional().describe(`Azure SAS token`),projectId:r().optional().describe(`GCP project ID`),credentials:r().optional().describe(`GCP service account credentials JSON`),endpoint:r().optional().describe(`Custom endpoint URL`),region:r().optional().describe(`Default region`),useSSL:S().default(!0).describe(`Use SSL/TLS for connections`),timeout:P().min(0).optional().describe(`Connection timeout in milliseconds`)}),Ge=h({name:Me.describe(`Storage configuration identifier`),label:r().describe(`Display label`),provider:Fe.describe(`Primary storage provider`),scope:Pe.optional().default(`global`).describe(`Storage scope`),connection:We.describe(`Connection credentials`),buckets:C(Ue).default([]).describe(`Configured buckets`),defaultBucket:r().optional().describe(`Default bucket name for operations`),location:r().optional().describe(`Root path (local) or base location`),quota:P().int().positive().optional().describe(`Max size in bytes`),options:d(r(),u()).optional().describe(`Provider-specific configuration options`),enabled:S().default(!0).describe(`Enable this storage configuration`),description:r().optional().describe(`Configuration description`)});Ge.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}),Ge.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}),Ge.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}),Ge.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});var Ke=E([`elasticsearch`,`algolia`,`meilisearch`,`typesense`,`opensearch`]).describe(`Supported full-text search engine provider`),qe=h({type:E([`standard`,`simple`,`whitespace`,`keyword`,`pattern`,`language`]).describe(`Text analyzer type`),language:r().optional().describe(`Language for language-specific analysis`),stopwords:C(r()).optional().describe(`Custom stopwords to filter during analysis`),customFilters:C(r()).optional().describe(`Additional token filter names to apply`)}).describe(`Text analyzer configuration for index tokenization and normalization`),eee=h({indexName:r().describe(`Name of the search index`),objectName:r().describe(`Source ObjectQL object`),fields:C(h({name:r().describe(`Field name to index`),type:E([`text`,`keyword`,`number`,`date`,`boolean`,`geo`]).describe(`Index field data type`),analyzer:r().optional().describe(`Named analyzer to use for this field`),searchable:S().default(!0).describe(`Include field in full-text search`),filterable:S().default(!1).describe(`Allow filtering on this field`),sortable:S().default(!1).describe(`Allow sorting by this field`),boost:P().default(1).describe(`Relevance boost factor for this field`)})).describe(`Fields to include in the search index`),replicas:P().default(1).describe(`Number of index replicas for availability`),shards:P().default(1).describe(`Number of index shards for distribution`)}).describe(`Search index definition mapping an ObjectQL object to a search engine index`),Je=h({field:r().describe(`Field name to generate facets from`),maxValues:P().default(10).describe(`Maximum number of facet values to return`),sort:E([`count`,`alpha`]).default(`count`).describe(`Facet value sort order`)}).describe(`Faceted search configuration for a single field`);h({provider:Ke.describe(`Search engine backend provider`),indexes:C(eee).describe(`Search index definitions`),analyzers:d(r(),qe).optional().describe(`Named text analyzer configurations`),facets:C(Je).optional().describe(`Faceted search configurations`),typoTolerance:S().default(!0).describe(`Enable typo-tolerant search`),synonyms:d(r(),C(r())).optional().describe(`Synonym mappings for search expansion`),ranking:C(E([`typo`,`geo`,`words`,`filters`,`proximity`,`attribute`,`exact`,`custom`])).optional().describe(`Custom ranking rule order`)}).describe(`Top-level full-text search engine configuration`);var Ye=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),Xe=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]);h({url:r().describe(`API endpoint URL`),method:Xe.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)});var Ze=h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(Ye).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),Qe=h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),$e=h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)}),et=h({port:P().int().min(1).max(65535).default(3e3).describe(`Port number to listen on`),host:r().default(`0.0.0.0`).describe(`Host address to bind to`),cors:Ze.optional().describe(`CORS configuration`),requestTimeout:P().int().default(3e4).describe(`Request timeout in milliseconds`),bodyLimit:r().default(`10mb`).describe(`Maximum request body size`),compression:S().default(!0).describe(`Enable response compression`),security:h({helmet:S().default(!0).describe(`Enable security headers via helmet`),rateLimit:Qe.optional().describe(`Global rate limiting configuration`)}).optional().describe(`Security configuration`),static:C($e).optional().describe(`Static file serving configuration`),trustProxy:S().default(!1).describe(`Trust X-Forwarded-* headers`)});h({method:Ye.describe(`HTTP method`),path:r().describe(`URL path pattern`),handler:r().describe(`Handler identifier or name`),metadata:h({summary:r().optional().describe(`Route summary for documentation`),description:r().optional().describe(`Route description`),tags:C(r()).optional().describe(`Tags for grouping`),operationId:r().optional().describe(`Unique operation identifier`)}).optional(),security:h({authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:r().optional().describe(`Rate limit policy override`)}).optional()});var tt=E([`authentication`,`authorization`,`logging`,`validation`,`transformation`,`error`,`custom`]),nt=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Middleware name (snake_case)`),type:tt.describe(`Middleware type`),enabled:S().default(!0).describe(`Whether middleware is enabled`),order:P().int().default(100).describe(`Execution order priority`),config:d(r(),u()).optional().describe(`Middleware configuration object`),paths:h({include:C(r()).optional().describe(`Include path patterns (glob)`),exclude:C(r()).optional().describe(`Exclude path patterns (glob)`)}).optional().describe(`Path filtering`)});h({type:E([`starting`,`started`,`stopping`,`stopped`,`request`,`response`,`error`]).describe(`Event type`),timestamp:r().datetime().describe(`Event timestamp (ISO 8601)`),data:d(r(),u()).optional().describe(`Event-specific data`)}),h({httpVersions:C(E([`1.0`,`1.1`,`2.0`,`3.0`])).default([`1.1`]).describe(`Supported HTTP versions`),websocket:S().default(!1).describe(`WebSocket support`),sse:S().default(!1).describe(`Server-Sent Events support`),serverPush:S().default(!1).describe(`HTTP/2 Server Push support`),streaming:S().default(!0).describe(`Response streaming support`),middleware:S().default(!0).describe(`Middleware chain support`),routeParams:S().default(!0).describe(`URL parameter support (/users/:id)`),compression:S().default(!0).describe(`Built-in compression support`)}),h({state:E([`stopped`,`starting`,`running`,`stopping`,`error`]).describe(`Current server state`),uptime:P().int().optional().describe(`Server uptime in milliseconds`),server:h({port:P().int().describe(`Listening port`),host:r().describe(`Bound host`),url:r().optional().describe(`Full server URL`)}).optional(),connections:h({active:P().int().describe(`Active connections`),total:P().int().describe(`Total connections handled`)}).optional(),requests:h({total:P().int().describe(`Total requests processed`),success:P().int().describe(`Successful requests`),errors:P().int().describe(`Failed requests`)}).optional()}),Object.assign(et,{create:e=>e}),Object.assign(nt,{create:e=>e});var rt=E(`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(`,`)),it=E([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),at=h({type:E([`user`,`system`,`service`,`api_client`,`integration`]).describe(`Actor type`),id:r().describe(`Actor identifier`),name:r().optional().describe(`Actor display name`),email:r().email().optional().describe(`Actor email address`),ipAddress:r().optional().describe(`Actor IP address`),userAgent:r().optional().describe(`User agent string`)}),ot=h({type:r().describe(`Target type`),id:r().describe(`Target identifier`),name:r().optional().describe(`Target display name`),metadata:d(r(),u()).optional().describe(`Target metadata`)}),st=h({field:r().describe(`Changed field name`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`)});h({id:r().describe(`Audit event ID`),eventType:rt.describe(`Event type`),severity:it.default(`info`).describe(`Event severity`),timestamp:r().datetime().describe(`Event timestamp`),actor:at.describe(`Event actor`),target:ot.optional().describe(`Event target`),description:r().describe(`Event description`),changes:C(st).optional().describe(`List of changes`),result:E([`success`,`failure`,`partial`]).default(`success`).describe(`Action result`),errorMessage:r().optional().describe(`Error message`),tenantId:r().optional().describe(`Tenant identifier`),requestId:r().optional().describe(`Request ID for tracing`),metadata:d(r(),u()).optional().describe(`Additional metadata`),location:h({country:r().optional(),region:r().optional(),city:r().optional()}).optional().describe(`Geographic location`)});var ct=h({retentionDays:P().int().min(1).default(180).describe(`Retention period in days`),archiveAfterRetention:S().default(!0).describe(`Archive logs after retention period`),archiveStorage:h({type:E([`s3`,`gcs`,`azure_blob`,`filesystem`]).describe(`Archive storage type`),endpoint:r().optional().describe(`Storage endpoint URL`),bucket:r().optional().describe(`Storage bucket/container name`),path:r().optional().describe(`Storage path prefix`),credentials:d(r(),u()).optional().describe(`Storage credentials`)}).optional().describe(`Archive storage configuration`),customRetention:d(r(),P().int().positive()).optional().describe(`Custom retention by event type`),minimumRetentionDays:P().int().positive().optional().describe(`Minimum retention for compliance`)}),lt=h({id:r().describe(`Rule identifier`),name:r().describe(`Rule name`),description:r().optional().describe(`Rule description`),enabled:S().default(!0).describe(`Rule enabled status`),eventTypes:C(rt).describe(`Event types to monitor`),condition:h({threshold:P().int().positive().describe(`Event threshold`),windowSeconds:P().int().positive().describe(`Time window in seconds`),groupBy:C(r()).optional().describe(`Grouping criteria`),filters:d(r(),u()).optional().describe(`Additional filters`)}).describe(`Detection condition`),actions:C(E([`alert`,`lock_account`,`block_ip`,`require_mfa`,`log_critical`,`webhook`])).describe(`Actions to take`),alertSeverity:it.default(`warning`).describe(`Alert severity`),notifications:h({email:C(r().email()).optional().describe(`Email recipients`),slack:r().url().optional().describe(`Slack webhook URL`),webhook:r().url().optional().describe(`Custom webhook URL`)}).optional().describe(`Notification configuration`)}),ut=h({type:E([`database`,`elasticsearch`,`mongodb`,`clickhouse`,`s3`,`gcs`,`azure_blob`,`custom`]).describe(`Storage backend type`),connectionString:r().optional().describe(`Connection string`),config:d(r(),u()).optional().describe(`Storage-specific configuration`),bufferEnabled:S().default(!0).describe(`Enable buffering`),bufferSize:P().int().positive().default(100).describe(`Buffer size`),flushIntervalSeconds:P().int().positive().default(5).describe(`Flush interval in seconds`),compression:S().default(!0).describe(`Enable compression`)});h({eventTypes:C(rt).optional().describe(`Event types to include`),severities:C(it).optional().describe(`Severity levels to include`),actorId:r().optional().describe(`Actor identifier`),tenantId:r().optional().describe(`Tenant identifier`),timeRange:h({from:r().datetime().describe(`Start time`),to:r().datetime().describe(`End time`)}).optional().describe(`Time range filter`),result:E([`success`,`failure`,`partial`]).optional().describe(`Result status`),searchQuery:r().optional().describe(`Search query`),customFilters:d(r(),u()).optional().describe(`Custom filters`)}),h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().default(!0).describe(`Enable audit logging`),eventTypes:C(rt).optional().describe(`Event types to audit`),excludeEventTypes:C(rt).optional().describe(`Event types to exclude`),minimumSeverity:it.default(`info`).describe(`Minimum severity level`),storage:ut.describe(`Storage configuration`),retentionPolicy:ct.optional().describe(`Retention policy`),suspiciousActivityRules:C(lt).default([]).describe(`Suspicious activity rules`),includeSensitiveData:S().default(!1).describe(`Include sensitive data`),redactFields:C(r()).default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`]).describe(`Fields to redact`),logReads:S().default(!1).describe(`Log read operations`),readSamplingRate:P().min(0).max(1).default(.1).describe(`Read sampling rate`),logSystemEvents:S().default(!0).describe(`Log system events`),customHandlers:C(h({eventType:rt.describe(`Event type to handle`),handlerId:r().describe(`Unique identifier for the handler`)})).optional().describe(`Custom event handler references`),compliance:h({standards:C(E([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),immutableLogs:S().default(!0).describe(`Enforce immutable logs`),requireSigning:S().default(!1).describe(`Require log signing`),signingKey:r().optional().describe(`Signing key`)}).optional().describe(`Compliance configuration`)});var dt=E([`debug`,`info`,`warn`,`error`,`fatal`,`silent`]).describe(`Log severity level`),ft=E([`json`,`text`,`pretty`]).describe(`Log output format`),pt=h({name:r().optional().describe(`Logger name identifier`),level:dt.optional().default(`info`),format:ft.optional().default(`json`),redact:C(r()).optional().default([`password`,`token`,`secret`,`key`]).describe(`Keys to redact from log context`),sourceLocation:S().optional().default(!1).describe(`Include file and line number`),file:r().optional().describe(`Path to log file`),rotation:h({maxSize:r().optional().default(`10m`),maxFiles:P().optional().default(5)}).optional()});h({timestamp:r().datetime().describe(`ISO 8601 timestamp`),level:dt,message:r().describe(`Log message`),context:d(r(),u()).optional().describe(`Structured context data`),error:d(r(),u()).optional().describe(`Error object if present`),traceId:r().optional().describe(`Distributed trace ID`),spanId:r().optional().describe(`Span ID`),service:r().optional().describe(`Service name`),component:r().optional().describe(`Component name (e.g. plugin id)`)});var mt=E([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]).describe(`Extended log severity level`),ht=E([`console`,`file`,`syslog`,`elasticsearch`,`cloudwatch`,`stackdriver`,`azure_monitor`,`datadog`,`splunk`,`loki`,`http`,`kafka`,`redis`,`custom`]).describe(`Log destination type`),gt=h({stream:E([`stdout`,`stderr`]).optional().default(`stdout`),colors:S().optional().default(!0),prettyPrint:S().optional().default(!1)}).describe(`Console destination configuration`),_t=h({path:r().describe(`Log file path`),rotation:h({maxSize:r().optional().default(`10m`),maxFiles:P().int().positive().optional().default(5),compress:S().optional().default(!0),interval:E([`hourly`,`daily`,`weekly`,`monthly`]).optional()}).optional(),encoding:r().optional().default(`utf8`),append:S().optional().default(!0)}).describe(`File destination configuration`),vt=h({url:r().url().describe(`HTTP endpoint URL`),method:E([`POST`,`PUT`]).optional().default(`POST`),headers:d(r(),r()).optional(),auth:h({type:E([`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional(),apiKeyHeader:r().optional().default(`X-API-Key`)}).optional(),batch:h({maxSize:P().int().positive().optional().default(100),flushInterval:P().int().positive().optional().default(5e3)}).optional(),retry:h({maxAttempts:P().int().positive().optional().default(3),initialDelay:P().int().positive().optional().default(1e3),backoffMultiplier:P().positive().optional().default(2)}).optional(),timeout:P().int().positive().optional().default(3e4)}).describe(`HTTP destination configuration`),yt=h({endpoint:r().url().optional(),region:r().optional(),credentials:h({accessKeyId:r().optional(),secretAccessKey:r().optional(),apiKey:r().optional(),projectId:r().optional()}).optional(),logGroup:r().optional(),logStream:r().optional(),index:r().optional(),config:d(r(),u()).optional()}).describe(`External service destination configuration`),bt=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Destination name (snake_case)`),type:ht.describe(`Destination type`),level:mt.optional().default(`info`),enabled:S().optional().default(!0),console:gt.optional(),file:_t.optional(),http:vt.optional(),externalService:yt.optional(),format:E([`json`,`text`,`pretty`]).optional().default(`json`),filterId:r().optional().describe(`Filter function identifier`)}).describe(`Log destination configuration`),xt=h({staticFields:d(r(),u()).optional().describe(`Static fields added to every log`),dynamicEnrichers:C(r()).optional().describe(`Dynamic enricher function IDs`),addHostname:S().optional().default(!0),addProcessId:S().optional().default(!0),addEnvironment:S().optional().default(!0),addTimestampFormats:h({unix:S().optional().default(!1),iso:S().optional().default(!0)}).optional(),addCaller:S().optional().default(!1),addCorrelationIds:S().optional().default(!0)}).describe(`Log enrichment configuration`);h({timestamp:r().datetime().describe(`ISO 8601 timestamp`),level:mt.describe(`Log severity level`),message:r().describe(`Log message`),context:d(r(),u()).optional().describe(`Structured context`),error:h({name:r().optional(),message:r().optional(),stack:r().optional(),code:r().optional(),details:d(r(),u()).optional()}).optional().describe(`Error details`),trace:h({traceId:r().describe(`Trace ID`),spanId:r().describe(`Span ID`),parentSpanId:r().optional().describe(`Parent span ID`),traceFlags:P().int().optional().describe(`Trace flags`)}).optional().describe(`Distributed tracing context`),source:h({service:r().optional().describe(`Service name`),component:r().optional().describe(`Component name`),file:r().optional().describe(`Source file`),line:P().int().optional().describe(`Line number`),function:r().optional().describe(`Function name`)}).optional().describe(`Source information`),host:h({hostname:r().optional(),pid:P().int().optional(),ip:r().optional()}).optional().describe(`Host information`),environment:r().optional().describe(`Environment (e.g., production, staging)`),user:h({id:r().optional(),username:r().optional(),email:r().optional()}).optional().describe(`User context`),request:h({id:r().optional(),method:r().optional(),path:r().optional(),userAgent:r().optional(),ip:r().optional()}).optional().describe(`Request context`),labels:d(r(),r()).optional().describe(`Custom labels`),metadata:d(r(),u()).optional().describe(`Additional metadata`)}).describe(`Structured log entry`),h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),level:mt.optional().default(`info`),default:pt.optional().describe(`Default logger configuration`),loggers:d(r(),pt).optional().describe(`Named logger configurations`),destinations:C(bt).describe(`Log destinations`),enrichment:xt.optional(),redact:C(r()).optional().default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`,`authorization`]).describe(`Fields to redact`),sampling:h({enabled:S().optional().default(!1),rate:P().min(0).max(1).optional().default(1),rateByLevel:d(r(),P().min(0).max(1)).optional()}).optional(),buffer:h({enabled:S().optional().default(!0),size:P().int().positive().optional().default(1e3),flushInterval:P().int().positive().optional().default(1e3),flushOnShutdown:S().optional().default(!0)}).optional(),performance:h({async:S().optional().default(!0),workers:P().int().positive().optional().default(1)}).optional()}).describe(`Logging configuration`);var St=E([`counter`,`gauge`,`histogram`,`summary`]).describe(`Metric type`),Ct=E([`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`),wt=E([`sum`,`avg`,`min`,`max`,`count`,`p50`,`p75`,`p90`,`p95`,`p99`,`p999`,`rate`,`stddev`]).describe(`Metric aggregation type`),Tt=h({type:E([`linear`,`exponential`,`explicit`]).describe(`Bucket type`),linear:h({start:P().describe(`Start value`),width:P().positive().describe(`Bucket width`),count:P().int().positive().describe(`Number of buckets`)}).optional(),exponential:h({start:P().positive().describe(`Start value`),factor:P().positive().describe(`Growth factor`),count:P().int().positive().describe(`Number of buckets`)}).optional(),explicit:h({boundaries:C(P()).describe(`Bucket boundaries`)}).optional()}).describe(`Histogram bucket configuration`),Et=d(r(),r()).describe(`Metric labels`),Dt=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Metric name (snake_case)`),label:r().optional().describe(`Display label`),type:St.describe(`Metric type`),unit:Ct.optional().describe(`Metric unit`),description:r().optional().describe(`Metric description`),labelNames:C(r()).optional().default([]).describe(`Label names`),histogram:Tt.optional(),summary:h({quantiles:C(P().min(0).max(1)).optional().default([.5,.9,.99]),maxAge:P().int().positive().optional().default(600),ageBuckets:P().int().positive().optional().default(5)}).optional(),enabled:S().optional().default(!0)}).describe(`Metric definition`);h({name:r().describe(`Metric name`),type:St.describe(`Metric type`),timestamp:r().datetime().describe(`Observation timestamp`),value:P().optional().describe(`Metric value`),labels:Et.optional().describe(`Metric labels`),histogram:h({count:P().int().nonnegative().describe(`Total count`),sum:P().describe(`Sum of all values`),buckets:C(h({upperBound:P().describe(`Upper bound of bucket`),count:P().int().nonnegative().describe(`Count in bucket`)})).describe(`Histogram buckets`)}).optional(),summary:h({count:P().int().nonnegative().describe(`Total count`),sum:P().describe(`Sum of all values`),quantiles:C(h({quantile:P().min(0).max(1).describe(`Quantile (0-1)`),value:P().describe(`Quantile value`)})).describe(`Summary quantiles`)}).optional()}).describe(`Metric data point`);var Ot=h({timestamp:r().datetime().describe(`Timestamp`),value:P().describe(`Value`),labels:d(r(),r()).optional().describe(`Labels`)}).describe(`Time series data point`);h({name:r().describe(`Series name`),labels:d(r(),r()).optional().describe(`Series labels`),dataPoints:C(Ot).describe(`Data points`),startTime:r().datetime().optional().describe(`Start time`),endTime:r().datetime().optional().describe(`End time`)}).describe(`Time series`);var kt=h({type:wt.describe(`Aggregation type`),window:h({size:P().int().positive().describe(`Window size in seconds`),sliding:S().optional().default(!1),slideInterval:P().int().positive().optional()}).optional(),groupBy:C(r()).optional().describe(`Group by label names`),filters:d(r(),u()).optional().describe(`Filter criteria`)}).describe(`Metric aggregation configuration`),At=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLI name (snake_case)`),label:r().describe(`Display label`),description:r().optional().describe(`SLI description`),metric:r().describe(`Base metric name`),type:E([`availability`,`latency`,`throughput`,`error_rate`,`saturation`,`custom`]).describe(`SLI type`),successCriteria:h({threshold:P().describe(`Threshold value`),operator:E([`lt`,`lte`,`gt`,`gte`,`eq`]).describe(`Comparison operator`),percentile:P().min(0).max(1).optional().describe(`Percentile (0-1)`)}).describe(`Success criteria`),window:h({size:P().int().positive().describe(`Window size in seconds`),rolling:S().optional().default(!0)}).describe(`Measurement window`),enabled:S().optional().default(!0)}).describe(`Service Level Indicator`),jt=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLO name (snake_case)`),label:r().describe(`Display label`),description:r().optional().describe(`SLO description`),sli:r().describe(`SLI name`),target:P().min(0).max(100).describe(`Target percentage`),period:h({type:E([`rolling`,`calendar`]).describe(`Period type`),duration:P().int().positive().optional().describe(`Duration in seconds`),calendar:E([`daily`,`weekly`,`monthly`,`quarterly`,`yearly`]).optional()}).describe(`Time period`),errorBudget:h({enabled:S().optional().default(!0),alertThreshold:P().min(0).max(100).optional().default(80),burnRateWindows:C(h({window:P().int().positive().describe(`Window size`),threshold:P().positive().describe(`Burn rate threshold`)})).optional()}).optional(),alerts:C(h({name:r().describe(`Alert name`),severity:E([`info`,`warning`,`critical`]).describe(`Alert severity`),condition:h({type:E([`slo_breach`,`error_budget`,`burn_rate`]).describe(`Condition type`),threshold:P().optional().describe(`Threshold value`)}).describe(`Alert condition`)})).optional().default([]),enabled:S().optional().default(!0)}).describe(`Service Level Objective`),Mt=h({type:E([`prometheus`,`openmetrics`,`graphite`,`statsd`,`influxdb`,`datadog`,`cloudwatch`,`stackdriver`,`azure_monitor`,`http`,`custom`]).describe(`Export type`),endpoint:r().optional().describe(`Export endpoint`),interval:P().int().positive().optional().default(60),batch:h({enabled:S().optional().default(!0),size:P().int().positive().optional().default(1e3)}).optional(),auth:h({type:E([`none`,`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional()}).optional(),config:d(r(),u()).optional().describe(`Additional configuration`)}).describe(`Metric export configuration`);h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),metrics:C(Dt).optional().default([]),defaultLabels:Et.optional().default({}),aggregations:C(kt).optional().default([]),slis:C(At).optional().default([]),slos:C(jt).optional().default([]),exports:C(Mt).optional().default([]),collectionInterval:P().int().positive().optional().default(15),retention:h({period:P().int().positive().optional().default(604800),downsampling:C(h({afterSeconds:P().int().positive().describe(`Downsample after seconds`),resolution:P().int().positive().describe(`Downsampled resolution`)})).optional()}).optional(),cardinalityLimits:h({maxLabelCombinations:P().int().positive().optional().default(1e4),onLimitExceeded:E([`drop`,`sample`,`alert`]).optional().default(`alert`)}).optional()}).describe(`Metrics configuration`);var Nt=h({entries:d(r(),r()).describe(`Trace state entries`)}).describe(`Trace state`),Pt=P().int().min(0).max(255).describe(`Trace flags bitmap`),Ft=h({traceId:r().regex(/^[0-9a-f]{32}$/).describe(`Trace ID (32 hex chars)`),spanId:r().regex(/^[0-9a-f]{16}$/).describe(`Span ID (16 hex chars)`),traceFlags:Pt.optional().default(1),traceState:Nt.optional(),parentSpanId:r().regex(/^[0-9a-f]{16}$/).optional().describe(`Parent span ID (16 hex chars)`),sampled:S().optional().default(!0),remote:S().optional().default(!1)}).describe(`Trace context (W3C Trace Context)`),It=E([`internal`,`server`,`client`,`producer`,`consumer`]).describe(`Span kind`),Lt=E([`unset`,`ok`,`error`]).describe(`Span status`),Rt=l([r(),P(),S(),C(r()),C(P()),C(S())]).describe(`Span attribute value`),zt=d(r(),Rt).describe(`Span attributes`),Bt=h({name:r().describe(`Event name`),timestamp:r().datetime().describe(`Event timestamp`),attributes:zt.optional().describe(`Event attributes`)}).describe(`Span event`),Vt=h({context:Ft.describe(`Linked trace context`),attributes:zt.optional().describe(`Link attributes`)}).describe(`Span link`);h({context:Ft.describe(`Trace context`),name:r().describe(`Span name`),kind:It.optional().default(`internal`),startTime:r().datetime().describe(`Span start time`),endTime:r().datetime().optional().describe(`Span end time`),duration:P().nonnegative().optional().describe(`Duration in milliseconds`),status:h({code:Lt.describe(`Status code`),message:r().optional().describe(`Status message`)}).optional(),attributes:zt.optional().default({}),events:C(Bt).optional().default([]),links:C(Vt).optional().default([]),resource:zt.optional().describe(`Resource attributes`),instrumentationLibrary:h({name:r().describe(`Library name`),version:r().optional().describe(`Library version`)}).optional()}).describe(`OpenTelemetry span`);var Ht=E([`drop`,`record_only`,`record_and_sample`]).describe(`Sampling decision`),Ut=E([`always_on`,`always_off`,`trace_id_ratio`,`rate_limiting`,`parent_based`,`probability`,`composite`,`custom`]).describe(`Sampling strategy type`),Wt=h({type:Ut.describe(`Sampling strategy`),ratio:P().min(0).max(1).optional().describe(`Sample ratio (0-1)`),rateLimit:P().positive().optional().describe(`Traces per second`),parentBased:h({whenParentSampled:Ut.optional().default(`always_on`),whenParentNotSampled:Ut.optional().default(`always_off`),root:Ut.optional().default(`trace_id_ratio`),rootRatio:P().min(0).max(1).optional().default(.1)}).optional(),composite:C(h({strategy:Ut.describe(`Strategy type`),ratio:P().min(0).max(1).optional(),condition:d(r(),u()).optional().describe(`Condition for this strategy`)})).optional(),rules:C(h({name:r().describe(`Rule name`),match:h({service:r().optional(),spanName:r().optional(),attributes:d(r(),u()).optional()}).optional(),decision:Ht.describe(`Sampling decision`),rate:P().min(0).max(1).optional()})).optional().default([]),customSamplerId:r().optional().describe(`Custom sampler identifier`)}).describe(`Trace sampling configuration`),Gt=h({formats:C(E([`w3c`,`b3`,`b3_multi`,`jaeger`,`xray`,`ottrace`,`custom`]).describe(`Trace propagation format`)).optional().default([`w3c`]),extract:S().optional().default(!0),inject:S().optional().default(!0),headers:h({traceId:r().optional(),spanId:r().optional(),traceFlags:r().optional(),traceState:r().optional()}).optional(),baggage:h({enabled:S().optional().default(!0),maxSize:P().int().positive().optional().default(8192),allowedKeys:C(r()).optional()}).optional()}).describe(`Trace context propagation`),Kt=E([`otlp_http`,`otlp_grpc`,`jaeger`,`zipkin`,`console`,`datadog`,`honeycomb`,`lightstep`,`newrelic`,`custom`]).describe(`OpenTelemetry exporter type`),qt=h({sdkVersion:r().optional().describe(`OTel SDK version`),exporter:h({type:Kt.describe(`Exporter type`),endpoint:r().url().optional().describe(`Exporter endpoint`),protocol:r().optional().describe(`Protocol version`),headers:d(r(),r()).optional().describe(`HTTP headers`),timeout:P().int().positive().optional().default(1e4),compression:E([`none`,`gzip`]).optional().default(`none`),batch:h({maxBatchSize:P().int().positive().optional().default(512),maxQueueSize:P().int().positive().optional().default(2048),exportTimeout:P().int().positive().optional().default(3e4),scheduledDelay:P().int().positive().optional().default(5e3)}).optional()}).describe(`Exporter configuration`),resource:h({serviceName:r().describe(`Service name`),serviceVersion:r().optional().describe(`Service version`),serviceInstanceId:r().optional().describe(`Service instance ID`),serviceNamespace:r().optional().describe(`Service namespace`),deploymentEnvironment:r().optional().describe(`Deployment environment`),attributes:zt.optional().describe(`Additional resource attributes`)}).describe(`Resource attributes`),instrumentation:h({autoInstrumentation:S().optional().default(!0),libraries:C(r()).optional().describe(`Enabled libraries`),disabledLibraries:C(r()).optional().describe(`Disabled libraries`)}).optional(),semanticConventionsVersion:r().optional().describe(`Semantic conventions version`)}).describe(`OpenTelemetry compatibility configuration`);h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),sampling:Wt.optional().default({type:`always_on`,rules:[]}),propagation:Gt.optional().default({formats:[`w3c`],extract:!0,inject:!0}),openTelemetry:qt.optional(),spanLimits:h({maxAttributes:P().int().positive().optional().default(128),maxEvents:P().int().positive().optional().default(128),maxLinks:P().int().positive().optional().default(128),maxAttributeValueLength:P().int().positive().optional().default(4096)}).optional(),traceIdGenerator:E([`random`,`uuid`,`custom`]).optional().default(`random`),customTraceIdGeneratorId:r().optional().describe(`Custom generator identifier`),performance:h({asyncExport:S().optional().default(!0),exportInterval:P().int().positive().optional().default(5e3)}).optional()}).describe(`Tracing configuration`);var Jt=E([`pii`,`phi`,`pci`,`financial`,`confidential`,`internal`,`public`]).describe(`Data classification level`),Yt=E([`gdpr`,`hipaa`,`sox`,`pci_dss`,`ccpa`,`iso27001`]).describe(`Compliance framework identifier`),tee=h({framework:Yt.describe(`Compliance framework identifier`),requiredEvents:C(r()).describe(`Audit event types required by this framework (e.g., "data.delete", "auth.login")`),retentionDays:P().min(1).describe(`Minimum audit log retention period required by this framework (in days)`),alertOnMissing:S().default(!0).describe(`Raise alert if a required audit event is not being captured`)}).describe(`Compliance framework audit event requirements`),Xt=h({framework:Yt.describe(`Compliance framework identifier`),dataClassifications:C(Jt).describe(`Data classifications that must be encrypted under this framework`),minimumAlgorithm:E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).default(`aes-256-gcm`).describe(`Minimum encryption algorithm strength required`),keyRotationMaxDays:P().min(1).default(90).describe(`Maximum key rotation interval required (in days)`)}).describe(`Compliance framework encryption requirements`),Zt=h({dataClassification:Jt.describe(`Data classification this rule applies to`),defaultMasked:S().default(!0).describe(`Whether data is masked by default`),unmaskRoles:C(r()).optional().describe(`Roles allowed to view unmasked data`),auditUnmask:S().default(!0).describe(`Log an audit event when data is unmasked`),requireApproval:S().default(!1).describe(`Require explicit approval before unmasking`),approvalRoles:C(r()).optional().describe(`Roles that can approve unmasking requests`)}).describe(`Masking visibility and audit rule per data classification`),Qt=h({enabled:S().default(!0).describe(`Enable cross-subsystem security event correlation`),correlationId:S().default(!0).describe(`Inject a shared correlation ID into audit, encryption, and masking events`),linkAuthToAudit:S().default(!0).describe(`Link authentication events to subsequent data operation audit trails`),linkEncryptionToAudit:S().default(!0).describe(`Log encryption/decryption operations in the audit trail`),linkMaskingToAudit:S().default(!0).describe(`Log masking/unmasking operations in the audit trail`)}).describe(`Cross-subsystem security event correlation configuration`),$t=h({classification:Jt.describe(`Data classification level`),requireEncryption:S().default(!1).describe(`Encryption required for this classification`),requireMasking:S().default(!1).describe(`Masking required for this classification`),requireAudit:S().default(!1).describe(`Audit trail required for access to this classification`),retentionDays:P().optional().describe(`Data retention limit in days (for compliance)`)}).describe(`Security policy for a specific data classification level`);h({enabled:S().default(!0).describe(`Enable unified security context governance`),complianceAuditRequirements:C(tee).optional().describe(`Compliance-driven audit event requirements`),complianceEncryptionRequirements:C(Xt).optional().describe(`Compliance-driven encryption requirements by data classification`),maskingVisibility:C(Zt).optional().describe(`Masking visibility rules per data classification`),dataClassifications:C($t).optional().describe(`Data classification policies for unified security enforcement`),eventCorrelation:Qt.optional().describe(`Cross-subsystem security event correlation settings`),enforceOnWrite:S().default(!0).describe(`Enforce encryption and masking requirements on data write operations`),enforceOnRead:S().default(!0).describe(`Enforce masking and audit requirements on data read operations`),failOpen:S().default(!1).describe(`When false (default), deny access if security context cannot be evaluated`)}).describe(`Unified security context governance configuration`);var en=E([`standard`,`normal`,`emergency`,`major`]),tn=E([`critical`,`high`,`medium`,`low`]),nn=E([`draft`,`submitted`,`in-review`,`approved`,`scheduled`,`in-progress`,`completed`,`failed`,`rolled-back`,`cancelled`]),rn=h({level:E([`low`,`medium`,`high`,`critical`]).describe(`Impact level`),affectedSystems:C(r()).describe(`Affected systems`),affectedUsers:P().optional().describe(`Affected user count`),downtime:h({required:S().describe(`Downtime required`),durationMinutes:P().optional().describe(`Downtime duration`)}).optional().describe(`Downtime information`)}),an=h({description:r().describe(`Rollback description`),steps:C(h({order:P().describe(`Step order`),description:r().describe(`Step description`),estimatedMinutes:P().describe(`Estimated duration`)})).describe(`Rollback steps`),testProcedure:r().optional().describe(`Test procedure`)});h({id:r().describe(`Change request ID`),title:r().describe(`Change title`),description:r().describe(`Change description`),type:en.describe(`Change type`),priority:tn.describe(`Change priority`),status:nn.describe(`Change status`),requestedBy:r().describe(`Requester user ID`),requestedAt:P().describe(`Request timestamp`),impact:rn.describe(`Impact assessment`),implementation:h({description:r().describe(`Implementation description`),steps:C(h({order:P().describe(`Step order`),description:r().describe(`Step description`),estimatedMinutes:P().describe(`Estimated duration`)})).describe(`Implementation steps`),testing:r().optional().describe(`Testing procedure`)}).describe(`Implementation plan`),rollbackPlan:an.describe(`Rollback plan`),schedule:h({plannedStart:P().describe(`Planned start time`),plannedEnd:P().describe(`Planned end time`),actualStart:P().optional().describe(`Actual start time`),actualEnd:P().optional().describe(`Actual end time`)}).optional().describe(`Schedule`),securityImpact:h({assessed:S().describe(`Whether security impact has been assessed`),riskLevel:E([`none`,`low`,`medium`,`high`,`critical`]).optional().describe(`Security risk level`),affectedDataClassifications:C(Jt).optional().describe(`Affected data classifications`),requiresSecurityApproval:S().default(!1).describe(`Whether security team approval is required`),reviewedBy:r().optional().describe(`Security reviewer user ID`),reviewedAt:P().optional().describe(`Security review timestamp`),reviewNotes:r().optional().describe(`Security review notes or conditions`)}).optional().describe(`Security impact assessment per ISO 27001:2022 A.8.32`),approval:h({required:S().describe(`Approval required`),approvers:C(h({userId:r().describe(`Approver user ID`),approvedAt:P().optional().describe(`Approval timestamp`),comments:r().optional().describe(`Approver comments`)})).describe(`Approvers`)}).optional().describe(`Approval workflow`),attachments:C(h({name:r().describe(`Attachment name`),url:r().url().describe(`Attachment URL`)})).optional().describe(`Attachments`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs for extensibility`)});var on=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),sn=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),cn=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),ln=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:on.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:sn.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:cn.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:ln.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var un=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),dn=h({field:r().describe(`Field name to apply masking to`),strategy:un.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(dn).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var fn=E(`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(`.`)),pn=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:Me.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var mn=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var hn=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),gn=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),_n=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),vn=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),yn=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:fn.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(pn).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:mn.optional().describe(`Configuration for currency field type`),vectorConfig:hn.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:gn.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:ln.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:dn.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:vn.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:_n.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),bn=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label for the rule listing`),description:r().optional().describe(`Administrative notes explaining the business reason`),active:S().default(!0),events:C(E([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:P().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:C(r()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:E([`error`,`warning`,`info`]).default(`error`),message:r().describe(`Error message to display to the user`)}),xn=bn.extend({type:m(`script`),condition:r().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),nee=bn.extend({type:m(`unique`),fields:C(r()).describe(`Fields that must be combined unique`),scope:r().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:S().default(!0)}),Sn=bn.extend({type:m(`state_machine`),field:r().describe(`State field (e.g. status)`),transitions:d(r(),C(r())).describe(`Map of { OldState: [AllowedNewStates] }`)}),Cn=bn.extend({type:m(`format`),field:r(),regex:r().optional(),format:E([`email`,`url`,`phone`,`json`]).optional()}),wn=bn.extend({type:m(`cross_field`),condition:r().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:C(r()).describe(`Fields involved in the validation`)}),Tn=bn.extend({type:m(`json_schema`),field:r().describe(`JSON field to validate`),schema:d(r(),u()).describe(`JSON Schema object definition`)}),En=bn.extend({type:m(`async`),field:r().describe(`Field to validate`),validatorUrl:r().optional().describe(`External API endpoint for validation`),method:E([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:d(r(),r()).optional().describe(`Custom headers for the request`),validatorFunction:r().optional().describe(`Reference to custom validator function`),timeout:P().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:P().optional().describe(`Debounce delay in milliseconds`),params:d(r(),u()).optional().describe(`Additional parameters to pass to validator`)}),Dn=bn.extend({type:m(`custom`),handler:r().describe(`Name of the custom validation function registered in the system`),params:d(r(),u()).optional().describe(`Parameters passed to the custom handler`)}),On=F(()=>I(`type`,[xn,nee,Sn,Cn,wn,Tn,En,Dn,kn])),kn=bn.extend({type:m(`conditional`),when:r().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:On.describe(`Validation rule to apply when condition is true`),otherwise:On.optional().describe(`Validation rule to apply when condition is false`)}),An=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),jn=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),Mn=h({target:r().optional().describe(`Target State ID`),cond:jn.optional().describe(`Condition (Guard) required to take this path`),actions:C(An).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)});h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)});var Nn=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(An).optional().describe(`Actions to run when entering this state`),exit:C(An).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),Mn,C(Mn)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(Mn).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),Nn).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),Pn=h({id:Ne.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),Nn).describe(`State Nodes`),on:d(r(),l([r(),Mn,C(Mn)])).optional()});h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var Fn=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),In=h({ariaLabel:Fn.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var Ln=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),Rn=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:Ln.optional().describe(`Default number formatting rules`),dateFormat:Rn.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var ree=h({name:r(),label:Fn,type:fn,required:S().default(!1),options:C(h({label:Fn,value:r()})).optional()}),zn=E([`script`,`url`,`modal`,`flow`,`api`]),iee=new Set(zn.options.filter(e=>e!==`script`)),aee=h({name:Ne.describe(`Machine name (lowercase snake_case)`),label:Fn.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:zn.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(ree).optional().describe(`Input parameters required from user`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:Fn.optional().describe(`Confirmation message before execution`),successMessage:Fn.optional().describe(`Success message to show after execution`),refreshAfter:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:In.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(iee.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),oee=E([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),Bn=h({trackHistory:S().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:S().default(!0).describe(`Index records for global search`),apiEnabled:S().default(!0).describe(`Expose object via automatic APIs`),apiMethods:C(oee).optional().describe(`Whitelist of allowed API operations`),files:S().default(!1).describe(`Enable file attachments and document management`),feeds:S().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:S().default(!1).describe(`Enable standard tasks and events tracking`),trash:S().default(!0).describe(`Enable soft-delete with restore capability`),mru:S().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:S().default(!0).describe(`Allow record deep cloning`)}),Vn=h({name:r().optional().describe(`Index name (auto-generated if not provided)`),fields:C(r()).describe(`Fields included in the index`),type:E([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:S().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:r().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),Hn=h({fields:C(r()).describe(`Fields to index for full-text search weighting`),displayFields:C(r()).optional().describe(`Fields to display in search result cards`),filters:C(r()).optional().describe(`Default filters for search results`)}),Un=h({enabled:S().describe(`Enable multi-tenancy for this object`),strategy:E([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:r().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:S().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),Wn=h({enabled:S().describe(`Enable soft delete (trash/recycle bin)`),field:r().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:S().default(!1).describe(`Cascade soft delete to related records`)}),Gn=h({enabled:S().describe(`Enable record versioning`),strategy:E([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:P().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:r().default(`version`).describe(`Field name for version number/timestamp`)}),Kn=h({enabled:S().describe(`Enable table partitioning`),strategy:E([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:r().describe(`Field name to partition by`),interval:r().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"`}),qn=h({enabled:S().describe(`Enable Change Data Capture`),events:C(E([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:r().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),Jn=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:r().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:r().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:r().optional().describe(`Developer documentation / description`),icon:r().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:r().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:C(r()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:S().optional().default(!0).describe(`Is the object active and usable`),isSystem:S().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:S().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:r().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:r().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:d(r().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),yn).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:C(Vn).optional().describe(`Database performance indexes`),tenancy:Un.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:Wn.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:Gn.optional().describe(`Record versioning and history tracking configuration`),partitioning:Kn.optional().describe(`Table partitioning configuration for performance`),cdc:qn.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:C(On).optional().describe(`Object-level validation rules`),stateMachines:d(r(),Pn).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:r().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:h({type:E([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:r().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:P().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:r().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:C(r()).optional().describe(`Primary fields for hover/cards/lookups`),search:Hn.optional().describe(`Search engine configuration`),enable:Bn.optional().describe(`Enabled system features modules`),recordTypes:C(r()).optional().describe(`Record type names for this object`),sharingModel:E([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:r().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:C(aee).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function Yn(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var Xn=Object.assign(Jn,{create:e=>{let t={...e,label:e.label??Yn(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return Jn.parse(t)}});E([`own`,`extend`]),h({extend:r().describe(`Target object name (FQN) to extend`),fields:d(r(),yn).optional().describe(`Fields to add/override`),label:r().optional().describe(`Override label for the extended object`),pluralLabel:r().optional().describe(`Override plural label for the extended object`),description:r().optional().describe(`Override description for the extended object`),validations:C(On).optional().describe(`Additional validation rules to merge into the target object`),indexes:C(Vn).optional().describe(`Additional indexes to merge into the target object`),priority:P().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)});var Zn=I(`type`,[h({type:m(`add_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to add`),field:yn.describe(`Full field definition to add`)}).describe(`Add a new field to an existing object`),h({type:m(`modify_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to modify`),changes:d(r(),u()).describe(`Partial field definition updates`)}).describe(`Modify properties of an existing field`),h({type:m(`remove_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to remove`)}).describe(`Remove a field from an existing object`),h({type:m(`create_object`),object:Xn.describe(`Full object definition to create`)}).describe(`Create a new object`),h({type:m(`rename_object`),oldName:r().describe(`Current object name`),newName:r().describe(`New object name`)}).describe(`Rename an existing object`),h({type:m(`delete_object`),objectName:r().describe(`Name of the object to delete`)}).describe(`Delete an existing object`),h({type:m(`execute_sql`),sql:r().describe(`Raw SQL statement to execute`),description:r().optional().describe(`Human-readable description of the SQL`)}).describe(`Execute a raw SQL statement`)]),Qn=h({migrationId:r().describe(`ID of the migration this depends on`),package:r().optional().describe(`Package that owns the dependency migration`)}).describe(`Dependency reference to another migration that must run first`);h({id:r().uuid().describe(`Unique identifier for this change set`),name:r().describe(`Human readable name for the migration`),description:r().optional().describe(`Detailed description of what this migration does`),author:r().optional().describe(`Author who created this migration`),createdAt:r().datetime().optional().describe(`ISO 8601 timestamp when the migration was created`),dependencies:C(Qn).optional().describe(`Migrations that must run before this one`),operations:C(Zn).describe(`Ordered list of atomic migration operations`),rollback:C(Zn).optional().describe(`Operations to reverse this migration`)}).describe(`A versioned set of atomic schema migration operations`);var $n=h({id:r().describe(`Provider ID (github, google)`),clientId:r().describe(`OAuth Client ID`),clientSecret:r().describe(`OAuth Client Secret`),scope:C(r()).optional().describe(`Requested permissions`)}),er=h({organization:S().default(!1).describe(`Enable Organization/Teams support`),twoFactor:S().default(!1).describe(`Enable 2FA`),passkeys:S().default(!1).describe(`Enable Passkey support`),magicLink:S().default(!1).describe(`Enable Magic Link login`)}),tr=h({enabled:S().default(!1).describe(`Enable mutual TLS authentication`),clientCertRequired:S().default(!1).describe(`Require client certificates for all connections`),trustedCAs:C(r()).describe(`PEM-encoded CA certificates or file paths`),crlUrl:r().optional().describe(`Certificate Revocation List (CRL) URL`),ocspUrl:r().optional().describe(`Online Certificate Status Protocol (OCSP) URL`),certificateValidation:E([`strict`,`relaxed`,`none`]).describe(`Certificate validation strictness level`),allowedCNs:C(r()).optional().describe(`Allowed Common Names (CN) on client certificates`),allowedOUs:C(r()).optional().describe(`Allowed Organizational Units (OU) on client certificates`),pinning:h({enabled:S().describe(`Enable certificate pinning`),pins:C(r()).describe(`Pinned certificate hashes`)}).optional().describe(`Certificate pinning configuration`)}),nr=d(r(),h({clientId:r().describe(`OAuth Client ID`),clientSecret:r().describe(`OAuth Client Secret`),enabled:S().optional().default(!0).describe(`Enable this provider`),scope:C(r()).optional().describe(`Additional OAuth scopes`)}).catchall(u())).optional().describe(`Social/OAuth provider map forwarded to better-auth socialProviders. Keys are provider ids (google, github, apple, …).`),rr=h({enabled:S().default(!0).describe(`Enable email/password auth`),disableSignUp:S().optional().describe(`Disable new user registration via email/password`),requireEmailVerification:S().optional().describe(`Require email verification before creating a session`),minPasswordLength:P().optional().describe(`Minimum password length (default 8)`),maxPasswordLength:P().optional().describe(`Maximum password length (default 128)`),resetPasswordTokenExpiresIn:P().optional().describe(`Reset-password token TTL in seconds (default 3600)`),autoSignIn:S().optional().describe(`Auto sign-in after sign-up (default true)`),revokeSessionsOnPasswordReset:S().optional().describe(`Revoke all other sessions on password reset`)}).optional().describe(`Email and password authentication options forwarded to better-auth`),ir=h({sendOnSignUp:S().optional().describe(`Automatically send verification email after sign-up`),sendOnSignIn:S().optional().describe(`Send verification email on sign-in when not yet verified`),autoSignInAfterVerification:S().optional().describe(`Auto sign-in the user after email verification`),expiresIn:P().optional().describe(`Verification token TTL in seconds (default 3600)`)}).optional().describe(`Email verification options forwarded to better-auth`),ar=h({crossSubDomainCookies:h({enabled:S().describe(`Enable cross-subdomain cookies`),additionalCookies:C(r()).optional().describe(`Extra cookies shared across subdomains`),domain:r().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:S().optional().describe(`Force Secure flag on cookies`),disableCSRFCheck:S().optional().describe(`⚠ Disable CSRF check — security risk, use with caution`),cookiePrefix:r().optional().describe(`Prefix for auth cookie names`)}).optional().describe(`Advanced / low-level Better-Auth options`);h({secret:r().optional().describe(`Encryption secret`),baseUrl:r().optional().describe(`Base URL for auth routes`),databaseUrl:r().optional().describe(`Database connection string`),providers:C($n).optional(),plugins:er.optional(),session:h({expiresIn:P().default(3600*24*7).describe(`Session duration in seconds`),updateAge:P().default(3600*24).describe(`Session update frequency`)}).optional(),trustedOrigins:C(r()).optional().describe(`Trusted origins for CSRF protection. Supports wildcards (e.g. "https://*.example.com"). The baseUrl origin is always trusted implicitly.`),socialProviders:nr,emailAndPassword:rr,emailVerification:ir,advanced:ar,mutualTls:tr.optional().describe(`Mutual TLS (mTLS) configuration`)}).catchall(u());var or=h({enabled:S().describe(`Enable GDPR compliance controls`),dataSubjectRights:h({rightToAccess:S().default(!0).describe(`Allow data subjects to access their data`),rightToRectification:S().default(!0).describe(`Allow data subjects to correct their data`),rightToErasure:S().default(!0).describe(`Allow data subjects to request deletion`),rightToRestriction:S().default(!0).describe(`Allow data subjects to restrict processing`),rightToPortability:S().default(!0).describe(`Allow data subjects to export their data`),rightToObjection:S().default(!0).describe(`Allow data subjects to object to processing`)}).describe(`Data subject rights configuration per GDPR Articles 15-21`),legalBasis:E([`consent`,`contract`,`legal-obligation`,`vital-interests`,`public-task`,`legitimate-interests`]).describe(`Legal basis for data processing under GDPR Article 6`),consentTracking:S().default(!0).describe(`Track and record user consent`),dataRetentionDays:P().optional().describe(`Maximum data retention period in days`),dataProcessingAgreement:r().optional().describe(`URL or reference to the data processing agreement`)}).describe(`GDPR (General Data Protection Regulation) compliance configuration`),sr=h({enabled:S().describe(`Enable HIPAA compliance controls`),phi:h({encryption:S().default(!0).describe(`Encrypt Protected Health Information at rest`),accessControl:S().default(!0).describe(`Enforce role-based access to PHI`),auditTrail:S().default(!0).describe(`Log all PHI access events`),backupAndRecovery:S().default(!0).describe(`Enable PHI backup and disaster recovery`)}).describe(`Protected Health Information safeguards`),businessAssociateAgreement:S().default(!1).describe(`BAA is in place with third-party processors`)}).describe(`HIPAA (Health Insurance Portability and Accountability Act) compliance configuration`),cr=h({enabled:S().describe(`Enable PCI-DSS compliance controls`),level:E([`1`,`2`,`3`,`4`]).describe(`PCI-DSS compliance level (1 = highest)`),cardDataFields:C(r()).describe(`Field names containing cardholder data`),tokenization:S().default(!0).describe(`Replace card data with secure tokens`),encryptionInTransit:S().default(!0).describe(`Encrypt cardholder data during transmission`),encryptionAtRest:S().default(!0).describe(`Encrypt stored cardholder data`)}).describe(`PCI-DSS (Payment Card Industry Data Security Standard) compliance configuration`),lr=h({enabled:S().default(!0).describe(`Enable audit logging`),retentionDays:P().default(365).describe(`Number of days to retain audit logs`),immutable:S().default(!0).describe(`Prevent modification or deletion of audit logs`),signLogs:S().default(!1).describe(`Cryptographically sign log entries for tamper detection`),events:C(E([`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`),ur=E([`critical`,`major`,`minor`,`observation`]),see=E([`open`,`in_remediation`,`remediated`,`verified`,`accepted_risk`,`closed`]),cee=h({id:r().describe(`Unique finding identifier`),title:r().describe(`Finding title`),description:r().describe(`Finding description`),severity:ur.describe(`Finding severity`),status:see.describe(`Finding status`),controlReference:r().optional().describe(`ISO 27001 control reference`),framework:Yt.optional().describe(`Related compliance framework`),identifiedAt:P().describe(`Identification timestamp`),identifiedBy:r().describe(`Identifier (auditor name or system)`),remediationPlan:r().optional().describe(`Remediation plan`),remediationDeadline:P().optional().describe(`Remediation deadline timestamp`),verifiedAt:P().optional().describe(`Verification timestamp`),verifiedBy:r().optional().describe(`Verifier name or role`),notes:r().optional().describe(`Additional notes`)}).describe(`Audit finding with remediation tracking per ISO 27001:2022 A.5.35`),lee=h({id:r().describe(`Unique audit schedule identifier`),title:r().describe(`Audit title`),scope:C(r()).describe(`Audit scope areas`),framework:Yt.describe(`Target compliance framework`),scheduledAt:P().describe(`Scheduled audit timestamp`),completedAt:P().optional().describe(`Completion timestamp`),assessor:r().describe(`Assessor or audit team`),isExternal:S().default(!1).describe(`Whether this is an external audit`),recurrenceMonths:P().default(0).describe(`Recurrence interval in months (0 = one-time)`),findings:C(cee).optional().describe(`Audit findings`)}).describe(`Audit schedule for independent security reviews per ISO 27001:2022 A.5.35`);h({gdpr:or.optional().describe(`GDPR compliance settings`),hipaa:sr.optional().describe(`HIPAA compliance settings`),pciDss:cr.optional().describe(`PCI-DSS compliance settings`),auditLog:lr.describe(`Audit log configuration`),auditSchedules:C(lee).optional().describe(`Scheduled compliance audits (A.5.35)`)}).describe(`Unified compliance configuration spanning GDPR, HIPAA, PCI-DSS, and audit governance`);var dr=E([`critical`,`high`,`medium`,`low`]),uee=E([`data_breach`,`malware`,`unauthorized_access`,`denial_of_service`,`social_engineering`,`insider_threat`,`physical_security`,`configuration_error`,`vulnerability_exploit`,`policy_violation`,`other`]),fr=E([`reported`,`triaged`,`investigating`,`containing`,`eradicating`,`recovering`,`resolved`,`closed`]),pr=h({phase:E([`identification`,`containment`,`eradication`,`recovery`,`lessons_learned`]).describe(`Response phase name`),description:r().describe(`Phase description and objectives`),assignedTo:r().describe(`Responsible team or role`),targetHours:P().min(0).describe(`Target completion time in hours`),completedAt:P().optional().describe(`Actual completion timestamp`),notes:r().optional().describe(`Phase notes and findings`)}).describe(`Incident response phase with timing and assignment`),mr=h({rules:C(h({severity:dr.describe(`Minimum severity to trigger notification`),channels:C(E([`email`,`sms`,`slack`,`pagerduty`,`webhook`])).describe(`Notification channels`),recipients:C(r()).describe(`Roles or teams to notify`),withinMinutes:P().min(1).describe(`Notification deadline in minutes from detection`),notifyRegulators:S().default(!1).describe(`Whether to notify regulatory authorities`),regulatorDeadlineHours:P().optional().describe(`Regulatory notification deadline in hours`)}).describe(`Incident notification rule per severity level`)).describe(`Notification rules by severity level`),escalationTimeoutMinutes:P().default(30).describe(`Auto-escalation timeout in minutes`),escalationChain:C(r()).default([]).describe(`Ordered escalation chain of roles`)}).describe(`Incident notification matrix with escalation policies`);h({id:r().describe(`Unique incident identifier`),title:r().describe(`Incident title`),description:r().describe(`Detailed incident description`),severity:dr.describe(`Incident severity level`),category:uee.describe(`Incident category`),status:fr.describe(`Current incident status`),reportedBy:r().describe(`Reporter user ID or system name`),reportedAt:P().describe(`Report timestamp`),detectedAt:P().optional().describe(`Detection timestamp`),resolvedAt:P().optional().describe(`Resolution timestamp`),affectedSystems:C(r()).describe(`Affected systems`),affectedDataClassifications:C(Jt).optional().describe(`Affected data classifications`),responsePhases:C(pr).optional().describe(`Incident response phases`),rootCause:r().optional().describe(`Root cause analysis`),correctiveActions:C(r()).optional().describe(`Corrective actions taken or planned`),lessonsLearned:r().optional().describe(`Lessons learned from the incident`),relatedChangeRequestIds:C(r()).optional().describe(`Related change request IDs`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Security incident record per ISO 27001:2022 A.5.24–A.5.28`),h({enabled:S().default(!0).describe(`Enable incident response management`),notificationMatrix:mr.describe(`Notification and escalation matrix`),defaultResponseTeam:r().describe(`Default incident response team or role`),triageDeadlineHours:P().default(1).describe(`Maximum hours to begin triage after detection`),requirePostIncidentReview:S().default(!0).describe(`Require post-incident review for all incidents`),regulatoryNotificationThreshold:dr.default(`high`).describe(`Minimum severity requiring regulatory notification`),retentionDays:P().default(2555).describe(`Incident record retention period in days (default ~7 years)`)}).describe(`Organization-level incident response policy per ISO 27001:2022`);var hr=E([`critical`,`high`,`medium`,`low`]),gr=E([`pending`,`in_progress`,`completed`,`expired`,`failed`]),_r=h({id:r().describe(`Requirement identifier`),description:r().describe(`Requirement description`),controlReference:r().optional().describe(`ISO 27001 control reference`),mandatory:S().default(!0).describe(`Whether this requirement is mandatory`),compliant:S().optional().describe(`Whether the supplier meets this requirement`),evidence:r().optional().describe(`Compliance evidence or assessment notes`)}).describe(`Individual supplier security requirement`);h({supplierId:r().describe(`Unique supplier identifier`),supplierName:r().describe(`Supplier display name`),riskLevel:hr.describe(`Supplier risk classification`),status:gr.describe(`Assessment status`),assessedBy:r().describe(`Assessor user ID or team`),assessedAt:P().describe(`Assessment timestamp`),validUntil:P().describe(`Assessment validity expiry timestamp`),requirements:C(_r).describe(`Security requirements and their compliance status`),overallCompliant:S().describe(`Whether supplier meets all mandatory requirements`),dataClassificationsShared:C(Jt).optional().describe(`Data classifications shared with supplier`),servicesProvided:C(r()).optional().describe(`Services provided by this supplier`),certifications:C(r()).optional().describe(`Supplier certifications (e.g., ISO 27001, SOC 2)`),remediationItems:C(h({requirementId:r().describe(`Non-compliant requirement ID`),action:r().describe(`Required remediation action`),deadline:P().describe(`Remediation deadline timestamp`),status:E([`pending`,`in_progress`,`completed`]).default(`pending`).describe(`Remediation status`)})).optional().describe(`Remediation items for non-compliant requirements`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Supplier security assessment record per ISO 27001:2022 A.5.19–A.5.21`),h({enabled:S().default(!0).describe(`Enable supplier security management`),reassessmentIntervalDays:P().default(365).describe(`Supplier reassessment interval in days`),requirePreOnboardingAssessment:S().default(!0).describe(`Require security assessment before supplier onboarding`),formalAssessmentThreshold:hr.default(`medium`).describe(`Minimum risk level requiring formal assessment`),monitorChanges:S().default(!0).describe(`Monitor supplier security posture changes`),requiredCertifications:C(r()).default([]).describe(`Required certifications for critical-risk suppliers`)}).describe(`Organization-level supplier security management policy per ISO 27001:2022`);var vr=E([`security_awareness`,`data_protection`,`incident_response`,`access_control`,`phishing_awareness`,`compliance`,`secure_development`,`physical_security`,`business_continuity`,`other`]),yr=E([`not_started`,`in_progress`,`completed`,`failed`,`expired`]),br=h({id:r().describe(`Unique course identifier`),title:r().describe(`Course title`),description:r().describe(`Course description and learning objectives`),category:vr.describe(`Training category`),durationMinutes:P().min(1).describe(`Estimated course duration in minutes`),mandatory:S().default(!1).describe(`Whether training is mandatory`),targetRoles:C(r()).describe(`Target roles or groups`),validityDays:P().optional().describe(`Certification validity period in days`),passingScore:P().min(0).max(100).optional().describe(`Minimum passing score percentage`),version:r().optional().describe(`Course content version`)}).describe(`Security training course definition`);h({courseId:r().describe(`Training course identifier`),userId:r().describe(`User identifier`),status:yr.describe(`Training completion status`),assignedAt:P().describe(`Assignment timestamp`),completedAt:P().optional().describe(`Completion timestamp`),score:P().min(0).max(100).optional().describe(`Assessment score percentage`),expiresAt:P().optional().describe(`Certification expiry timestamp`),notes:r().optional().describe(`Training notes or comments`)}).describe(`Individual training completion record`),h({enabled:S().default(!0).describe(`Enable training management`),courses:C(br).describe(`Training courses`),recertificationIntervalDays:P().default(365).describe(`Default recertification interval in days`),trackCompletion:S().default(!0).describe(`Track training completion for compliance`),gracePeriodDays:P().default(30).describe(`Grace period in days after certification expiry`),sendReminders:S().default(!0).describe(`Send reminders for upcoming training deadlines`),reminderDaysBefore:P().default(14).describe(`Days before deadline to send first reminder`)}).describe(`Organizational training plan per ISO 27001:2022 A.6.3`);var xr=I(`type`,[h({type:m(`cron`),expression:r().describe(`Cron expression (e.g., "0 0 * * *" for daily at midnight)`),timezone:r().optional().default(`UTC`).describe(`Timezone for cron execution (e.g., "America/New_York")`)}),h({type:m(`interval`),intervalMs:P().int().positive().describe(`Interval in milliseconds`)}),h({type:m(`once`),at:r().datetime().describe(`ISO 8601 datetime when to execute`)})]),Sr=h({maxRetries:P().int().min(0).default(3).describe(`Maximum number of retry attempts`),backoffMs:P().int().positive().default(1e3).describe(`Initial backoff delay in milliseconds`),backoffMultiplier:P().positive().default(2).describe(`Multiplier for exponential backoff`)});h({id:r().describe(`Unique job identifier`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Job name (snake_case)`),schedule:xr.describe(`Job schedule configuration`),handler:r().describe(`Handler path (e.g. "path/to/file:functionName") or script ID`),retryPolicy:Sr.optional().describe(`Retry policy configuration`),timeout:P().int().positive().optional().describe(`Timeout in milliseconds`),enabled:S().default(!0).describe(`Whether the job is enabled`)});var Cr=E([`running`,`success`,`failed`,`timeout`]);h({jobId:r().describe(`Job identifier`),startedAt:r().datetime().describe(`ISO 8601 datetime when execution started`),completedAt:r().datetime().optional().describe(`ISO 8601 datetime when execution completed`),status:Cr.describe(`Execution status`),error:r().optional().describe(`Error message if failed`),duration:P().int().optional().describe(`Execution duration in milliseconds`)});var wr=E([`critical`,`high`,`normal`,`low`,`background`]),Tr=E([`pending`,`queued`,`processing`,`completed`,`failed`,`cancelled`,`timeout`,`dead`]),Er=h({maxRetries:P().int().min(0).default(3).describe(`Maximum retry attempts`),backoffStrategy:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy between retries`),initialDelayMs:P().int().positive().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().int().positive().default(6e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:P().positive().default(2).describe(`Multiplier for exponential backoff`)}),Dr=h({id:r().describe(`Unique task identifier`),type:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),payload:u().describe(`Task payload data`),queue:r().default(`default`).describe(`Queue name`),priority:wr.default(`normal`).describe(`Task priority level`),retryPolicy:Er.optional().describe(`Retry policy configuration`),timeoutMs:P().int().positive().optional().describe(`Task timeout in milliseconds`),scheduledAt:r().datetime().optional().describe(`ISO 8601 datetime to execute task`),attempts:P().int().min(0).default(0).describe(`Number of execution attempts`),status:Tr.default(`pending`).describe(`Current task status`),metadata:h({createdAt:r().datetime().optional().describe(`When task was created`),updatedAt:r().datetime().optional().describe(`Last update time`),createdBy:r().optional().describe(`User who created task`),tags:C(r()).optional().describe(`Task tags for filtering`)}).optional().describe(`Task metadata`)});h({taskId:r().describe(`Task identifier`),status:Tr.describe(`Execution status`),result:u().optional().describe(`Execution result data`),error:h({message:r().describe(`Error message`),stack:r().optional().describe(`Error stack trace`),code:r().optional().describe(`Error code`)}).optional().describe(`Error details if failed`),durationMs:P().int().optional().describe(`Execution duration in milliseconds`),startedAt:r().datetime().describe(`When execution started`),completedAt:r().datetime().optional().describe(`When execution completed`),attempt:P().int().min(1).describe(`Attempt number (1-indexed)`),willRetry:S().describe(`Whether task will be retried`)});var Or=h({name:r().describe(`Queue name (snake_case)`),concurrency:P().int().min(1).default(5).describe(`Max concurrent task executions`),rateLimit:h({max:P().int().positive().describe(`Maximum tasks per duration`),duration:P().int().positive().describe(`Duration in milliseconds`)}).optional().describe(`Rate limit configuration`),defaultRetryPolicy:Er.optional().describe(`Default retry policy for tasks`),deadLetterQueue:r().optional().describe(`Dead letter queue name`),priority:P().int().min(0).default(0).describe(`Queue priority (lower = higher priority)`),autoScale:h({enabled:S().default(!1).describe(`Enable auto-scaling`),minWorkers:P().int().min(1).default(1).describe(`Minimum workers`),maxWorkers:P().int().min(1).default(10).describe(`Maximum workers`),scaleUpThreshold:P().int().positive().default(100).describe(`Queue size to scale up`),scaleDownThreshold:P().int().min(0).default(10).describe(`Queue size to scale down`)}).optional().describe(`Auto-scaling configuration`)}),kr=h({id:r().describe(`Unique batch job identifier`),type:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),items:C(u()).describe(`Array of items to process`),batchSize:P().int().min(1).default(100).describe(`Number of items per batch`),queue:r().default(`batch`).describe(`Queue for batch tasks`),priority:wr.default(`normal`).describe(`Batch task priority`),parallel:S().default(!0).describe(`Process batches in parallel`),stopOnError:S().default(!1).describe(`Stop batch if any item fails`),onProgress:M().input(w([h({processed:P(),total:P(),failed:P()})])).output(te()).optional().describe(`Progress callback function (called after each batch)`)});h({batchId:r().describe(`Batch job identifier`),total:P().int().min(0).describe(`Total number of items`),processed:P().int().min(0).default(0).describe(`Items processed`),succeeded:P().int().min(0).default(0).describe(`Items succeeded`),failed:P().int().min(0).default(0).describe(`Items failed`),percentage:P().min(0).max(100).describe(`Progress percentage`),status:E([`pending`,`running`,`completed`,`failed`,`cancelled`]).describe(`Batch status`),startedAt:r().datetime().optional().describe(`When batch started`),completedAt:r().datetime().optional().describe(`When batch completed`)});var Ar=h({name:r().describe(`Worker name`),queues:C(r()).min(1).describe(`Queue names to process`),queueConfigs:C(Or).optional().describe(`Queue configurations`),pollIntervalMs:P().int().positive().default(1e3).describe(`Queue polling interval in milliseconds`),visibilityTimeoutMs:P().int().positive().default(3e4).describe(`How long a task is invisible after being claimed`),defaultTimeoutMs:P().int().positive().default(3e5).describe(`Default task timeout in milliseconds`),shutdownTimeoutMs:P().int().positive().default(3e4).describe(`Graceful shutdown timeout in milliseconds`),handlers:d(r(),M()).optional().describe(`Task type handlers`)});h({workerName:r().describe(`Worker name`),totalProcessed:P().int().min(0).describe(`Total tasks processed`),succeeded:P().int().min(0).describe(`Successful tasks`),failed:P().int().min(0).describe(`Failed tasks`),active:P().int().min(0).describe(`Currently active tasks`),avgExecutionMs:P().min(0).optional().describe(`Average execution time in milliseconds`),uptimeMs:P().int().min(0).describe(`Worker uptime in milliseconds`),queues:d(r(),h({pending:P().int().min(0).describe(`Pending tasks`),active:P().int().min(0).describe(`Active tasks`),completed:P().int().min(0).describe(`Completed tasks`),failed:P().int().min(0).describe(`Failed tasks`)})).optional().describe(`Per-queue statistics`)}),Object.assign(Dr,{create:e=>e}),Object.assign(Or,{create:e=>e}),Object.assign(Ar,{create:e=>e}),Object.assign(kr,{create:e=>e});var jr=h({id:r().describe(`Template identifier`),subject:r().describe(`Email subject`),body:r().describe(`Email body content`),bodyType:E([`text`,`html`,`markdown`]).optional().default(`html`).describe(`Body content type`),variables:C(r()).optional().describe(`Template variables`),attachments:C(h({name:r().describe(`Attachment filename`),url:r().url().describe(`Attachment URL`)})).optional().describe(`Email attachments`)}),Mr=h({id:r().describe(`Template identifier`),message:r().describe(`SMS message content`),maxLength:P().optional().default(160).describe(`Maximum message length`),variables:C(r()).optional().describe(`Template variables`)}),Nr=h({title:r().describe(`Notification title`),body:r().describe(`Notification body`),icon:r().url().optional().describe(`Notification icon URL`),badge:P().optional().describe(`Badge count`),data:d(r(),u()).optional().describe(`Custom data`),actions:C(h({action:r().describe(`Action identifier`),title:r().describe(`Action button title`)})).optional().describe(`Notification actions`)}),Pr=h({title:r().describe(`Notification title`),message:r().describe(`Notification message`),type:E([`info`,`success`,`warning`,`error`]).describe(`Notification type`),actionUrl:r().optional().describe(`Action URL`),dismissible:S().optional().default(!0).describe(`User dismissible`),expiresAt:P().optional().describe(`Expiration timestamp`)}),dee=E([`email`,`sms`,`push`,`in-app`,`slack`,`teams`,`webhook`]);h({id:r().describe(`Notification ID`),name:r().describe(`Notification name`),channel:dee.describe(`Notification channel`),template:l([jr,Mr,Nr,Pr]).describe(`Notification template`),recipients:h({to:C(r()).describe(`Primary recipients`),cc:C(r()).optional().describe(`CC recipients`),bcc:C(r()).optional().describe(`BCC recipients`)}).describe(`Recipients`),schedule:h({type:E([`immediate`,`delayed`,`scheduled`]).describe(`Schedule type`),delay:P().optional().describe(`Delay in milliseconds`),scheduledAt:P().optional().describe(`Scheduled timestamp`)}).optional().describe(`Scheduling`),retryPolicy:h({enabled:S().optional().default(!0).describe(`Enable retries`),maxRetries:P().optional().default(3).describe(`Max retry attempts`),backoffStrategy:E([`exponential`,`linear`,`fixed`]).describe(`Backoff strategy`)}).optional().describe(`Retry policy`),tracking:h({trackOpens:S().optional().default(!1).describe(`Track opens`),trackClicks:S().optional().default(!1).describe(`Track clicks`),trackDelivery:S().optional().default(!0).describe(`Track delivery`)}).optional().describe(`Tracking configuration`)});var Fr=r().describe(`BCP-47 Language Tag (e.g. en-US, zh-CN)`),Ir=h({label:r().optional().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),placeholder:r().optional().describe(`Translated placeholder text for form inputs`),options:d(r(),r()).optional().describe(`Option value to translated label map`)}).describe(`Translation data for a single field`),Lr=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),fields:d(r(),Ir).optional().describe(`Field-level translations`)}).describe(`Translation data for a single object`);d(Fr,h({objects:d(r(),Lr).optional().describe(`Object translations keyed by object name`),apps:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID`),validationMessages:d(r(),r()).optional().describe(`Translatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})`)}).describe(`Translation data for objects, apps, and UI messages`)).describe(`Map of locale codes to translation data`);var Rr=E([`bundled`,`per_locale`,`per_namespace`]).describe(`Translation file organization strategy`),zr=E([`icu`,`simple`]).describe(`Message interpolation format: ICU MessageFormat or simple {variable} replacement`);h({defaultLocale:Fr.describe(`Default locale (e.g., "en")`),supportedLocales:C(Fr).describe(`Supported BCP-47 locale codes`),fallbackLocale:Fr.optional().describe(`Fallback locale code`),fileOrganization:Rr.default(`per_locale`).describe(`File organization strategy`),messageFormat:zr.default(`simple`).describe(`Message interpolation format (ICU MessageFormat or simple)`),lazyLoad:S().default(!1).describe(`Load translations on demand`),cache:S().default(!0).describe(`Cache loaded translations`)}).describe(`Internationalization configuration`);var Br=d(r(),r()).describe(`Option value to translated label map`),Vr=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),description:r().optional().describe(`Translated object description`),helpText:r().optional().describe(`Translated help text for the object`),fields:d(r(),Ir).optional().describe(`Field translations keyed by field name`),_options:d(r(),Br).optional().describe(`Object-scoped picklist option translations keyed by field name`),_views:d(r(),h({label:r().optional().describe(`Translated view label`),description:r().optional().describe(`Translated view description`)})).optional().describe(`View translations keyed by view name`),_sections:d(r(),h({label:r().optional().describe(`Translated section label`)})).optional().describe(`Section translations keyed by section name`),_actions:d(r(),h({label:r().optional().describe(`Translated action label`),confirmMessage:r().optional().describe(`Translated confirmation message`)})).optional().describe(`Action translations keyed by action name`),_notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Notification translations keyed by notification name`),_errors:d(r(),r()).optional().describe(`Error message translations keyed by error code`)}).describe(`Object-first aggregated translation node`);h({_meta:h({locale:r().optional().describe(`BCP-47 locale code for this bundle`),direction:E([`ltr`,`rtl`]).optional().describe(`Text direction: left-to-right or right-to-left`)}).optional().describe(`Bundle-level metadata (locale, bidi direction)`),namespace:r().optional().describe(`Namespace for plugin isolation to avoid translation key collisions`),o:d(r(),Vr).optional().describe(`Object-first translations keyed by object name`),_globalOptions:d(r(),Br).optional().describe(`Global picklist option translations keyed by option set name`),app:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),nav:d(r(),r()).optional().describe(`Navigation item translations keyed by nav item name`),dashboard:d(r(),h({label:r().optional().describe(`Translated dashboard label`),description:r().optional().describe(`Translated dashboard description`)})).optional().describe(`Dashboard translations keyed by dashboard name`),reports:d(r(),h({label:r().optional().describe(`Translated report label`),description:r().optional().describe(`Translated report description`)})).optional().describe(`Report translations keyed by report name`),pages:d(r(),h({title:r().optional().describe(`Translated page title`),description:r().optional().describe(`Translated page description`)})).optional().describe(`Page translations keyed by page name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID (supports ICU MessageFormat)`),validationMessages:d(r(),r()).optional().describe(`Validation error message translations keyed by rule name (supports ICU MessageFormat)`),notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Global notification translations keyed by notification name`),errors:d(r(),r()).optional().describe(`Global error message translations keyed by error code`)}).describe(`Object-first application translation bundle for a single locale`);var Hr=E([`missing`,`redundant`,`stale`]).describe(`Translation diff status: missing from bundle, redundant (no matching metadata), or stale (metadata changed)`),Ur=h({key:r().describe(`Dot-path translation key`),status:Hr.describe(`Diff status of this translation key`),objectName:r().optional().describe(`Associated object name (snake_case)`),locale:r().describe(`BCP-47 locale code`),sourceHash:r().optional().describe(`Hash of source metadata for precise stale detection`),aiSuggested:r().optional().describe(`AI-suggested translation for this key`),aiConfidence:P().min(0).max(1).optional().describe(`AI suggestion confidence score (0–1)`)}).describe(`A single translation diff item`),Wr=h({group:r().describe(`Translation group category`),totalKeys:P().int().nonnegative().describe(`Total keys in this group`),translatedKeys:P().int().nonnegative().describe(`Translated keys in this group`),coveragePercent:P().min(0).max(100).describe(`Coverage percentage for this group`)}).describe(`Coverage breakdown for a single translation group`);h({locale:r().describe(`BCP-47 locale code`),objectName:r().optional().describe(`Object name scope (omit for full bundle)`),totalKeys:P().int().nonnegative().describe(`Total translatable keys from metadata`),translatedKeys:P().int().nonnegative().describe(`Number of translated keys`),missingKeys:P().int().nonnegative().describe(`Number of missing translations`),redundantKeys:P().int().nonnegative().describe(`Number of redundant translations`),staleKeys:P().int().nonnegative().describe(`Number of stale translations`),coveragePercent:P().min(0).max(100).describe(`Translation coverage percentage`),items:C(Ur).describe(`Detailed diff items`),breakdown:C(Wr).optional().describe(`Per-group coverage breakdown`)}).describe(`Aggregated translation coverage result`),E([`insert`,`delete`,`retain`]);var Gr=I(`type`,[h({type:m(`insert`),text:r().describe(`Text to insert`),attributes:d(r(),u()).optional().describe(`Text formatting attributes (e.g., bold, italic)`)}),h({type:m(`delete`),count:P().int().positive().describe(`Number of characters to delete`)}),h({type:m(`retain`),count:P().int().positive().describe(`Number of characters to retain`),attributes:d(r(),u()).optional().describe(`Attribute changes to apply`)})]),Kr=h({operationId:r().uuid().describe(`Unique operation identifier`),documentId:r().describe(`Document identifier`),userId:r().describe(`User who created the operation`),sessionId:r().uuid().describe(`Session identifier`),components:C(Gr).describe(`Operation components`),baseVersion:P().int().nonnegative().describe(`Document version this operation is based on`),timestamp:r().datetime().describe(`ISO 8601 datetime when operation was created`),metadata:d(r(),u()).optional().describe(`Additional operation metadata`)});h({operation:Kr.describe(`Transformed operation`),transformed:S().describe(`Whether transformation was applied`),conflicts:C(r()).optional().describe(`Conflict descriptions if any`)}),E([`lww-register`,`g-counter`,`pn-counter`,`g-set`,`or-set`,`lww-map`,`text`,`tree`,`json`]);var qr=h({clock:d(r(),P().int().nonnegative()).describe(`Map of replica ID to logical timestamp`)}),Jr=h({type:m(`lww-register`),value:u().describe(`Current register value`),timestamp:r().datetime().describe(`ISO 8601 datetime of last write`),replicaId:r().describe(`ID of replica that performed last write`),vectorClock:qr.optional().describe(`Optional vector clock for causality tracking`)});h({replicaId:r().describe(`Replica identifier`),delta:P().int().describe(`Change amount (positive for increment, negative for decrement)`),timestamp:r().datetime().describe(`ISO 8601 datetime of operation`)});var Yr=h({type:m(`g-counter`),counts:d(r(),P().int().nonnegative()).describe(`Map of replica ID to count`)}),Xr=h({type:m(`pn-counter`),positive:d(r(),P().int().nonnegative()).describe(`Positive increments per replica`),negative:d(r(),P().int().nonnegative()).describe(`Negative increments per replica`)}),Zr=h({value:u().describe(`Element value`),timestamp:r().datetime().describe(`Addition timestamp`),replicaId:r().describe(`Replica that added the element`),uid:r().uuid().describe(`Unique identifier for this addition`),removed:S().optional().default(!1).describe(`Whether element has been removed`)}),Qr=h({type:m(`or-set`),elements:C(Zr).describe(`Set elements with metadata`)}),$r=h({operationId:r().uuid().describe(`Unique operation identifier`),replicaId:r().describe(`Replica identifier`),position:P().int().nonnegative().describe(`Position in document`),insert:r().optional().describe(`Text to insert`),delete:P().int().positive().optional().describe(`Number of characters to delete`),timestamp:r().datetime().describe(`ISO 8601 datetime of operation`),lamportTimestamp:P().int().nonnegative().describe(`Lamport timestamp for ordering`)});h({state:I(`type`,[Jr,Yr,Xr,Qr,h({type:m(`text`),documentId:r().describe(`Document identifier`),content:r().describe(`Current text content`),operations:C($r).describe(`History of operations`),lamportClock:P().int().nonnegative().describe(`Current Lamport clock value`),vectorClock:qr.describe(`Vector clock for causality`)})]).describe(`Merged CRDT state`),conflicts:C(h({type:r().describe(`Conflict type`),description:r().describe(`Conflict description`),resolved:S().describe(`Whether conflict was automatically resolved`)})).optional().describe(`Conflicts encountered during merge`)});var ei=h({color:l([E([`blue`,`green`,`red`,`yellow`,`purple`,`orange`,`pink`,`teal`,`indigo`,`cyan`]),r()]).describe(`Cursor color (preset or custom hex)`),opacity:P().min(0).max(1).optional().default(1).describe(`Cursor opacity (0-1)`),label:r().optional().describe(`Label to display with cursor (usually username)`),showLabel:S().optional().default(!0).describe(`Whether to show label`),pulseOnUpdate:S().optional().default(!0).describe(`Whether to pulse when cursor moves`)}),ti=h({anchor:h({line:P().int().nonnegative().describe(`Anchor line number`),column:P().int().nonnegative().describe(`Anchor column number`)}).describe(`Selection anchor (start point)`),focus:h({line:P().int().nonnegative().describe(`Focus line number`),column:P().int().nonnegative().describe(`Focus column number`)}).describe(`Selection focus (end point)`),direction:E([`forward`,`backward`]).optional().describe(`Selection direction`)}),ni=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier`),userName:r().describe(`Display name of user`),position:h({line:P().int().nonnegative().describe(`Cursor line number (0-indexed)`),column:P().int().nonnegative().describe(`Cursor column number (0-indexed)`)}).describe(`Current cursor position`),selection:ti.optional().describe(`Current text selection`),style:ei.describe(`Visual style for this cursor`),isTyping:S().optional().default(!1).describe(`Whether user is currently typing`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last cursor update`),metadata:d(r(),u()).optional().describe(`Additional cursor metadata`)});h({position:h({line:P().int().nonnegative(),column:P().int().nonnegative()}).optional().describe(`Updated cursor position`),selection:ti.optional().describe(`Updated selection`),isTyping:S().optional().describe(`Updated typing state`),metadata:d(r(),u()).optional().describe(`Updated metadata`)});var ri=E([`active`,`idle`,`viewing`,`disconnected`]),ii=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),userName:r().describe(`Display name`),userAvatar:r().optional().describe(`User avatar URL`),status:ri.describe(`Current activity status`),currentDocument:r().optional().describe(`Document ID user is currently editing`),currentView:r().optional().describe(`Current view/page user is on`),lastActivity:r().datetime().describe(`ISO 8601 datetime of last activity`),joinedAt:r().datetime().describe(`ISO 8601 datetime when user joined session`),permissions:C(r()).optional().describe(`User permissions in this session`),metadata:d(r(),u()).optional().describe(`Additional user state metadata`)});h({sessionId:r().uuid().describe(`Session identifier`),documentId:r().optional().describe(`Document ID this session is for`),users:C(ii).describe(`Active users in session`),startedAt:r().datetime().describe(`ISO 8601 datetime when session started`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last update`),metadata:d(r(),u()).optional().describe(`Session metadata`)}),h({status:ri.optional().describe(`Updated status`),currentDocument:r().optional().describe(`Updated current document`),currentView:r().optional().describe(`Updated current view`),metadata:d(r(),u()).optional().describe(`Updated metadata`)}),h({eventId:r().uuid().describe(`Event identifier`),sessionId:r().uuid().describe(`Session identifier`),eventType:E([`user.joined`,`user.left`,`user.updated`,`session.created`,`session.ended`]).describe(`Type of awareness event`),userId:r().optional().describe(`User involved in event`),timestamp:r().datetime().describe(`ISO 8601 datetime of event`),payload:u().describe(`Event payload`)});var ai=h({mode:E([`ot`,`crdt`,`lock`,`hybrid`]).describe(`Collaboration mode to use`),enableCursorSharing:S().optional().default(!0).describe(`Enable cursor sharing`),enablePresence:S().optional().default(!0).describe(`Enable presence tracking`),enableAwareness:S().optional().default(!0).describe(`Enable awareness state`),maxUsers:P().int().positive().optional().describe(`Maximum concurrent users`),idleTimeout:P().int().positive().optional().default(3e5).describe(`Idle timeout in milliseconds`),conflictResolution:E([`ot`,`crdt`,`manual`]).optional().default(`ot`).describe(`Conflict resolution strategy`),persistence:S().optional().default(!0).describe(`Enable operation persistence`),snapshot:h({enabled:S().describe(`Enable periodic snapshots`),interval:P().int().positive().describe(`Snapshot interval in milliseconds`)}).optional().describe(`Snapshot configuration`)});h({sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier`),config:ai.describe(`Session configuration`),users:C(ii).describe(`Active users`),cursors:C(ni).describe(`Active cursors`),version:P().int().nonnegative().describe(`Current document version`),operations:C(l([Kr,$r])).optional().describe(`Recent operations`),createdAt:r().datetime().describe(`ISO 8601 datetime when session was created`),lastActivity:r().datetime().describe(`ISO 8601 datetime of last activity`),status:E([`active`,`idle`,`ended`]).describe(`Session status`)});var oi=E([`system`,`platform`,`user`]),si=E([`draft`,`active`,`archived`,`deprecated`]);h({id:r(),name:r(),type:r(),namespace:r().default(`default`),packageId:r().optional().describe(`Package ID that owns/delivered this metadata`),managedBy:E([`package`,`platform`,`user`]).optional().describe(`Who manages this metadata record lifecycle`),scope:oi.default(`platform`),metadata:d(r(),u()),extends:r().optional().describe(`Name of the parent metadata to extend/override`),strategy:E([`merge`,`replace`]).default(`merge`),owner:r().optional(),state:si.default(`active`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant isolation`),version:P().default(1).describe(`Record version for optimistic concurrency control`),checksum:r().optional().describe(`Content checksum for change detection`),source:E([`filesystem`,`database`,`api`,`migration`]).optional().describe(`Origin of this metadata record`),tags:C(r()).optional().describe(`Classification tags for filtering and grouping`),publishedDefinition:u().optional().describe(`Snapshot of the last published definition`),publishedAt:r().datetime().optional().describe(`When this metadata was last published`),publishedBy:r().optional().describe(`Who published this version`),createdBy:r().optional(),createdAt:r().datetime().optional().describe(`Creation timestamp`),updatedBy:r().optional(),updatedAt:r().datetime().optional().describe(`Last update timestamp`)}),h({success:S().describe(`Whether the publish succeeded`),packageId:r().describe(`The package ID that was published`),version:P().int().describe(`New version number after publish`),publishedAt:r().datetime().describe(`Publish timestamp`),itemsPublished:P().int().describe(`Total metadata items published`),validationErrors:C(h({type:r().describe(`Metadata type that failed validation`),name:r().describe(`Item name that failed validation`),message:r().describe(`Validation error message`)})).optional().describe(`Validation errors if publish failed`)});var ci=E([`json`,`yaml`,`yml`,`ts`,`js`,`typescript`,`javascript`]),li=h({path:r().optional(),size:P().optional(),mtime:r().datetime().optional(),hash:r().optional(),etag:r().optional(),modifiedAt:r().datetime().optional(),format:ci.optional()});h({name:r(),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Loader protocol identifier`),description:r().optional(),supportedFormats:C(r()).optional(),supportsWatch:S().optional(),supportsWrite:S().optional(),supportsCache:S().optional(),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)})}),h({scope:oi.optional(),namespace:r().optional(),raw:S().optional().describe(`Return raw file content instead of parsed JSON`),cache:S().optional(),useCache:S().optional(),validate:S().optional(),ifNoneMatch:r().optional(),recursive:S().optional(),limit:P().optional(),patterns:C(r()).optional(),loader:r().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),h({data:u(),stats:li.optional(),format:ci.optional(),source:r().optional(),fromCache:S().optional(),etag:r().optional(),notModified:S().optional(),loadTime:P().optional()}),h({format:ci.optional(),create:S().default(!0),overwrite:S().default(!0),path:r().optional(),prettify:S().optional(),indent:P().optional(),sortKeys:S().optional(),backup:S().optional(),atomic:S().optional(),loader:r().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),h({success:S(),path:r().optional(),stats:li.optional(),etag:r().optional(),size:P().optional(),saveTime:P().optional(),backupPath:r().optional()}),h({type:E([`add`,`change`,`unlink`,`added`,`changed`,`deleted`]),path:r(),name:r().optional(),stats:li.optional(),metadataType:r().optional(),data:u().optional(),timestamp:r().datetime().optional()}),h({type:r(),count:P(),namespaces:C(r())}),h({types:C(r()).optional(),namespaces:C(r()).optional(),output:r().describe(`Output directory or file`),format:ci.default(`json`)}),h({source:r().describe(`Input directory or file`),strategy:E([`merge`,`replace`,`skip`]).default(`merge`),validate:S().default(!0)});var ui=E([`filesystem`,`memory`,`none`]);E([`filesystem`,`database`,`api`,`migration`]),h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:ui.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory for filesystem-based metadata`),formats:C(ci).optional().describe(`Enabled metadata formats`),watch:S().optional().describe(`Enable file watching for filesystem loaders`),cache:S().optional().describe(`Enable metadata caching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`)}).optional().describe(`File watcher options`)});var di=h({id:r(),metadataId:r().describe(`Foreign key to sys_metadata.id`),name:r(),type:r(),version:P().describe(`Version number at this snapshot`),operationType:E([`create`,`update`,`publish`,`revert`,`delete`]).describe(`Type of operation that created this history entry`),metadata:l([r(),d(r(),u())]).nullable().optional().describe(`Snapshot of metadata definition at this version (raw JSON string or parsed object)`),checksum:r().describe(`SHA-256 checksum of metadata content`),previousChecksum:r().optional().describe(`Checksum of the previous version`),changeNote:r().optional().describe(`Description of changes made in this version`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant isolation`),recordedBy:r().optional().describe(`User who made this change`),recordedAt:r().datetime().describe(`Timestamp when this version was recorded`)});h({limit:P().int().positive().optional().describe(`Maximum number of history records to return`),offset:P().int().nonnegative().optional().describe(`Number of records to skip`),since:r().datetime().optional().describe(`Only return history after this timestamp`),until:r().datetime().optional().describe(`Only return history before this timestamp`),operationType:E([`create`,`update`,`publish`,`revert`,`delete`]).optional().describe(`Filter by operation type`),includeMetadata:S().optional().default(!0).describe(`Include full metadata payload`)}),h({records:C(di),total:P().int().nonnegative(),hasMore:S()}),h({type:r(),name:r(),version1:P(),version2:P(),checksum1:r(),checksum2:r(),identical:S(),patch:C(u()).optional().describe(`JSON patch operations`),summary:r().optional().describe(`Human-readable summary of changes`)}),h({maxVersions:P().int().positive().optional().describe(`Maximum number of versions to retain`),maxAgeDays:P().int().positive().optional().describe(`Maximum age of history records in days`),autoCleanup:S().default(!1).describe(`Enable automatic cleanup of old history`),cleanupIntervalHours:P().int().positive().default(24).describe(`How often to run cleanup (in hours)`)});var fi=E([`metadata`,`data`,`auth`,`file-storage`,`search`,`cache`,`queue`,`automation`,`graphql`,`analytics`,`realtime`,`job`,`notification`,`ai`,`i18n`,`ui`,`workflow`]);E([`required`,`core`,`optional`]);var pi={data:`required`,metadata:`core`,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`};h({name:fi,enabled:S(),status:E([`running`,`stopped`,`degraded`,`initializing`]),version:r().optional(),provider:r().optional().describe(`Implementation provider (e.g. "s3" for storage)`),features:C(r()).optional().describe(`List of supported sub-features`)}),d(fi,u().describe(`Service Instance implementing the protocol interface`)),h({id:r(),name:fi,options:d(r(),u()).optional()});var mi=E([`shared_schema`,`isolated_schema`,`isolated_db`]),hi=E([`turso`,`postgres`,`memory`]).describe(`Database provider for tenant data`),gi=h({url:r().min(1).describe(`Database connection URL`),authToken:r().optional().describe(`Database auth token (encrypted at rest)`),group:r().optional().describe(`Turso database group name`)}).describe(`Tenant database connection configuration`),_i=h({maxUsers:P().int().positive().optional().describe(`Maximum number of users`),maxStorage:P().int().positive().optional().describe(`Maximum storage in bytes`),apiRateLimit:P().int().positive().optional().describe(`API requests per minute`),maxObjects:P().int().positive().optional().describe(`Maximum number of custom objects`),maxRecordsPerObject:P().int().positive().optional().describe(`Maximum records per object`),maxDeploymentsPerDay:P().int().positive().optional().describe(`Maximum deployments per day`),maxStorageBytes:P().int().positive().optional().describe(`Maximum storage in bytes`)});h({currentObjectCount:P().int().min(0).default(0).describe(`Current number of custom objects`),currentRecordCount:P().int().min(0).default(0).describe(`Total records across all objects`),currentStorageBytes:P().int().min(0).default(0).describe(`Current storage usage in bytes`),deploymentsToday:P().int().min(0).default(0).describe(`Deployments executed today`),currentUsers:P().int().min(0).default(0).describe(`Current number of active users`),apiRequestsThisMinute:P().int().min(0).default(0).describe(`API requests in the current minute`),lastUpdatedAt:r().datetime().optional().describe(`Last usage update time`)}).describe(`Current tenant resource usage`),h({allowed:S().describe(`Whether the operation is within quota`),exceededQuota:r().optional().describe(`Name of the exceeded quota`),currentUsage:P().optional().describe(`Current usage value`),limit:P().optional().describe(`Quota limit`),message:r().optional().describe(`Human-readable quota message`)}).describe(`Quota enforcement check result`),h({id:r().describe(`Unique tenant identifier`),name:r().describe(`Tenant display name`),isolationLevel:mi,databaseProvider:hi.optional().describe(`Database provider`),connectionConfig:gi.optional().describe(`Database connection config`),provisioningStatus:E([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).optional().describe(`Current provisioning lifecycle status`),plan:E([`free`,`pro`,`enterprise`]).optional().describe(`Subscription plan`),customizations:d(r(),u()).optional().describe(`Custom configuration values`),quotas:_i.optional()}),I(`strategy`,[h({strategy:m(`shared_schema`).describe(`Row-level isolation strategy`),database:h({enableRLS:S().default(!0).describe(`Enable PostgreSQL Row-Level Security`),contextMethod:E([`session_variable`,`search_path`,`application_name`]).default(`session_variable`).describe(`How to set tenant context`),contextVariable:r().default(`app.current_tenant`).describe(`Session variable name`),applicationValidation:S().default(!0).describe(`Application-level tenant validation`)}).optional().describe(`Database configuration`),performance:h({usePartialIndexes:S().default(!0).describe(`Use partial indexes per tenant`),usePartitioning:S().default(!1).describe(`Use table partitioning by tenant_id`),poolSizePerTenant:P().int().positive().optional().describe(`Connection pool size per tenant`)}).optional().describe(`Performance settings`)}),h({strategy:m(`isolated_schema`).describe(`Schema-level isolation strategy`),schema:h({namingPattern:r().default(`tenant_{tenant_id}`).describe(`Schema naming pattern`),includePublicSchema:S().default(!0).describe(`Include public schema`),sharedSchema:r().default(`public`).describe(`Schema for shared resources`),autoCreateSchema:S().default(!0).describe(`Auto-create schema`)}).optional().describe(`Schema configuration`),migrations:h({strategy:E([`parallel`,`sequential`,`on_demand`]).default(`parallel`).describe(`Migration strategy`),maxConcurrent:P().int().positive().default(10).describe(`Max concurrent migrations`),rollbackOnError:S().default(!0).describe(`Rollback on error`)}).optional().describe(`Migration configuration`),performance:h({poolPerSchema:S().default(!1).describe(`Separate pool per schema`),schemaCacheTTL:P().int().positive().default(3600).describe(`Schema cache TTL`)}).optional().describe(`Performance settings`)}),h({strategy:m(`isolated_db`).describe(`Database-level isolation strategy`),database:h({namingPattern:r().default(`tenant_{tenant_id}`).describe(`Database naming pattern`),serverStrategy:E([`shared`,`sharded`,`dedicated`]).default(`shared`).describe(`Server assignment strategy`),separateCredentials:S().default(!0).describe(`Separate credentials per tenant`),autoCreateDatabase:S().default(!0).describe(`Auto-create database`)}).optional().describe(`Database configuration`),connectionPool:h({poolSize:P().int().positive().default(10).describe(`Connection pool size`),maxActivePools:P().int().positive().default(100).describe(`Max active pools`),idleTimeout:P().int().positive().default(300).describe(`Idle pool timeout`),usePooler:S().default(!0).describe(`Use connection pooler`)}).optional().describe(`Connection pool configuration`),backup:h({strategy:E([`individual`,`consolidated`,`on_demand`]).default(`individual`).describe(`Backup strategy`),frequencyHours:P().int().positive().default(24).describe(`Backup frequency`),retentionDays:P().int().positive().default(30).describe(`Backup retention days`)}).optional().describe(`Backup configuration`),encryption:h({perTenantKeys:S().default(!1).describe(`Per-tenant encryption keys`),algorithm:r().default(`AES-256-GCM`).describe(`Encryption algorithm`),keyManagement:E([`aws_kms`,`azure_key_vault`,`gcp_kms`,`hashicorp_vault`,`custom`]).optional().describe(`Key management service`)}).optional().describe(`Encryption configuration`)})]),h({encryption:h({atRest:S().default(!0).describe(`Require encryption at rest`),inTransit:S().default(!0).describe(`Require encryption in transit`),fieldLevel:S().default(!1).describe(`Require field-level encryption`)}).optional().describe(`Encryption requirements`),accessControl:h({requireMFA:S().default(!1).describe(`Require MFA`),requireSSO:S().default(!1).describe(`Require SSO`),ipWhitelist:C(r()).optional().describe(`Allowed IP addresses`),sessionTimeout:P().int().positive().default(3600).describe(`Session timeout`)}).optional().describe(`Access control requirements`),compliance:h({standards:C(E([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),requireAuditLog:S().default(!0).describe(`Require audit logging`),auditRetentionDays:P().int().positive().default(365).describe(`Audit retention days`),dataResidency:h({region:r().optional().describe(`Required region (e.g., US, EU, APAC)`),excludeRegions:C(r()).optional().describe(`Prohibited regions`)}).optional().describe(`Data residency requirements`)}).optional().describe(`Compliance requirements`)});var vi=E([`boolean`,`counter`,`gauge`]).describe(`License metric type`);h({code:r().regex(/^[a-z_][a-z0-9_.]*$/).describe(`Feature code (e.g. core.api_access)`),label:r(),description:r().optional(),type:vi.default(`boolean`),unit:E([`count`,`bytes`,`seconds`,`percent`]).optional(),requires:C(r()).optional()}),h({code:r().describe(`Plan code (e.g. pro_v1)`),label:r(),active:S().default(!0),features:C(r()).describe(`List of enabled boolean features`),limits:d(r(),P()).describe(`Map of metric codes to limit values (e.g. { storage_gb: 10 })`),currency:r().default(`USD`).optional(),priceMonthly:P().optional(),priceYearly:P().optional()}),h({spaceId:r().describe(`Target Space ID`),planCode:r(),issuedAt:r().datetime(),expiresAt:r().datetime().optional(),status:E([`active`,`expired`,`suspended`,`trial`]),customFeatures:C(r()).optional(),customLimits:d(r(),P()).optional(),plugins:C(r()).optional().describe(`List of enabled plugin package IDs`),signature:r().optional().describe(`Cryptographic signature of the license`)});var yi=E([`manual`,`auto`,`proxy`]).describe(`Registry synchronization strategy`),bi=h({url:r().url().describe(`Upstream registry endpoint`),syncPolicy:yi.default(`auto`),syncInterval:P().int().min(60).optional().describe(`Auto-sync interval in seconds`),auth:h({type:E([`none`,`basic`,`bearer`,`api-key`,`oauth2`]).default(`none`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional()}).optional(),tls:h({enabled:S().default(!0),verifyCertificate:S().default(!0),certificate:r().optional(),privateKey:r().optional()}).optional(),timeout:P().int().min(1e3).default(3e4).describe(`Request timeout in milliseconds`),retry:h({maxAttempts:P().int().min(0).default(3),backoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`)}).optional()});h({type:E([`public`,`private`,`hybrid`]).describe(`Registry deployment type`),upstream:C(bi).optional().describe(`Upstream registries to sync from or proxy to`),scope:C(r()).optional().describe(`npm-style scopes managed by this registry (e.g., @my-corp, @enterprise)`),defaultScope:r().optional().describe(`Default scope prefix for new plugins`),storage:h({backend:E([`local`,`s3`,`gcs`,`azure-blob`,`oss`]).default(`local`),path:r().optional(),credentials:d(r(),u()).optional()}).optional(),visibility:E([`public`,`private`,`internal`]).default(`private`).describe(`Who can access this registry`),accessControl:h({requireAuthForRead:S().default(!1),requireAuthForWrite:S().default(!0),allowedPrincipals:C(r()).optional()}).optional(),cache:h({enabled:S().default(!0),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().optional().describe(`Maximum cache size in bytes`)}).optional(),mirrors:C(h({url:r().url(),priority:P().int().min(1).default(1)})).optional().describe(`Mirror registries for redundancy`)});var xi=E([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).describe(`Tenant provisioning lifecycle status`),Si=E([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),Ci=E([`us-east`,`us-west`,`eu-west`,`eu-central`,`ap-southeast`,`ap-northeast`]).describe(`Available deployment region`),wi=h({name:r().min(1).describe(`Step name (e.g., create_database, sync_schema)`),status:E([`pending`,`running`,`completed`,`failed`,`skipped`]).describe(`Step status`),startedAt:r().datetime().optional().describe(`Step start time`),completedAt:r().datetime().optional().describe(`Step completion time`),durationMs:P().int().min(0).optional().describe(`Step duration in ms`),error:r().optional().describe(`Error message on failure`)}).describe(`Individual provisioning step status`);h({orgId:r().min(1).describe(`Organization ID`),plan:Si.default(`free`),region:Ci.default(`us-east`),displayName:r().optional().describe(`Tenant display name`),adminEmail:r().email().optional().describe(`Initial admin user email`),metadata:d(r(),u()).optional().describe(`Additional metadata`)}).describe(`Tenant provisioning request`),h({tenantId:r().min(1).describe(`Provisioned tenant ID`),connectionUrl:r().min(1).describe(`Database connection URL`),status:xi,region:Ci,plan:Si,steps:C(wi).default([]).describe(`Pipeline step statuses`),totalDurationMs:P().int().min(0).optional().describe(`Total provisioning duration`),provisionedAt:r().datetime().optional().describe(`Provisioning completion time`),error:r().optional().describe(`Error message on failure`)}).describe(`Tenant provisioning result`),E([`validating`,`diffing`,`migrating`,`registering`,`ready`,`failed`,`rolling_back`]).describe(`Deployment lifecycle status`),h({changes:C(h({entityType:E([`object`,`field`,`index`,`view`,`flow`,`permission`]).describe(`Entity type`),entityName:r().min(1).describe(`Entity name`),parentEntity:r().optional().describe(`Parent entity name`),changeType:E([`added`,`modified`,`removed`]).describe(`Change type`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`)}).describe(`Individual schema change`)).default([]).describe(`List of schema changes`),summary:h({added:P().int().min(0).default(0).describe(`Number of added entities`),modified:P().int().min(0).default(0).describe(`Number of modified entities`),removed:P().int().min(0).default(0).describe(`Number of removed entities`)}).describe(`Change summary counts`),hasBreakingChanges:S().default(!1).describe(`Whether diff contains breaking changes`)}).describe(`Schema diff between current and desired state`),h({statements:C(h({sql:r().min(1).describe(`SQL DDL statement`),reversible:S().default(!0).describe(`Whether the statement can be reversed`),rollbackSql:r().optional().describe(`Reverse SQL for rollback`),order:P().int().min(0).describe(`Execution order`)}).describe(`Single DDL migration statement`)).default([]).describe(`Ordered DDL statements`),dialect:r().min(1).describe(`Target SQL dialect`),reversible:S().default(!0).describe(`Whether the plan can be fully rolled back`),estimatedDurationMs:P().int().min(0).optional().describe(`Estimated execution time`)}).describe(`Ordered migration plan`);var Ti=h({severity:E([`error`,`warning`,`info`]).describe(`Issue severity`),path:r().describe(`Entity path (e.g., objects.project_task.fields.name)`),message:r().describe(`Issue description`),code:r().optional().describe(`Validation error code`)}).describe(`Validation issue`);h({valid:S().describe(`Whether the bundle is valid`),issues:C(Ti).default([]).describe(`Validation issues`),errorCount:P().int().min(0).default(0).describe(`Number of errors`),warningCount:P().int().min(0).default(0).describe(`Number of warnings`)}).describe(`Bundle validation result`),h({manifest:h({version:r().min(1).describe(`Deployment version`),checksum:r().optional().describe(`SHA256 checksum`),objects:C(r()).default([]).describe(`Object names included`),views:C(r()).default([]).describe(`View names included`),flows:C(r()).default([]).describe(`Flow names included`),permissions:C(r()).default([]).describe(`Permission names included`),createdAt:r().datetime().optional().describe(`Bundle creation time`)}).describe(`Deployment manifest`),objects:C(d(r(),u())).default([]).describe(`Object definitions`),views:C(d(r(),u())).default([]).describe(`View definitions`),flows:C(d(r(),u())).default([]).describe(`Flow definitions`),permissions:C(d(r(),u())).default([]).describe(`Permission definitions`),seedData:C(d(r(),u())).default([]).describe(`Seed data records`)}).describe(`Deploy bundle containing all metadata for deployment`),h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`App identifier (snake_case)`),label:r().min(1).describe(`App display label`),version:r().min(1).describe(`App version (semver)`),description:r().optional().describe(`App description`),minKernelVersion:r().optional().describe(`Minimum required kernel version`),objects:C(r()).default([]).describe(`Object names provided`),views:C(r()).default([]).describe(`View names provided`),flows:C(r()).default([]).describe(`Flow names provided`),hasSeedData:S().default(!1).describe(`Whether app includes seed data`),seedData:C(d(r(),u())).default([]).describe(`Seed data records`),dependencies:C(r()).default([]).describe(`Required app dependencies`)}).describe(`App manifest for marketplace installation`),h({compatible:S().describe(`Whether the app is compatible`),issues:C(h({severity:E([`error`,`warning`]).describe(`Issue severity`),message:r().describe(`Issue description`),category:E([`kernel_version`,`object_conflict`,`dependency_missing`,`quota_exceeded`]).describe(`Issue category`)})).default([]).describe(`Compatibility issues`)}).describe(`App compatibility check result`),h({tenantId:r().min(1).describe(`Target tenant ID`),appId:r().min(1).describe(`App identifier`),configOverrides:d(r(),u()).optional().describe(`Configuration overrides`),skipSeedData:S().default(!1).describe(`Skip seed data population`)}).describe(`App install request`),h({success:S().describe(`Whether installation succeeded`),appId:r().describe(`Installed app identifier`),version:r().describe(`Installed app version`),installedObjects:C(r()).default([]).describe(`Objects created/updated`),createdTables:C(r()).default([]).describe(`Database tables created`),seededRecords:P().int().min(0).default(0).describe(`Seed records inserted`),durationMs:P().int().min(0).optional().describe(`Installation duration`),error:r().optional().describe(`Error message on failure`)}).describe(`App install result`);var Ei=h({$field:r().describe(`Field Reference/Column Name`)});h({$eq:D().optional(),$ne:D().optional()}),h({$gt:l([P(),N(),Ei]).optional(),$gte:l([P(),N(),Ei]).optional(),$lt:l([P(),N(),Ei]).optional(),$lte:l([P(),N(),Ei]).optional()}),h({$in:C(D()).optional(),$nin:C(D()).optional()}),h({$between:w([l([P(),N(),Ei]),l([P(),N(),Ei])]).optional()}),h({$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional()}),h({$null:S().optional(),$exists:S().optional()});var Di=h({$eq:D().optional(),$ne:D().optional(),$gt:l([P(),N(),Ei]).optional(),$gte:l([P(),N(),Ei]).optional(),$lt:l([P(),N(),Ei]).optional(),$lte:l([P(),N(),Ei]).optional(),$in:C(D()).optional(),$nin:C(D()).optional(),$between:w([l([P(),N(),Ei]),l([P(),N(),Ei])]).optional(),$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional(),$null:S().optional(),$exists:S().optional()}),Oi=F(()=>d(r(),u()).and(h({$and:C(Oi).optional(),$or:C(Oi).optional(),$not:Oi.optional()})));h({where:Oi.optional()});var ki=F(()=>h({$and:C(l([d(r(),Di),ki])).optional(),$or:C(l([d(r(),Di),ki])).optional(),$not:l([d(r(),Di),ki]).optional()})),Ai=h({field:r(),order:E([`asc`,`desc`]).default(`asc`)}),ji=h({function:E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]).describe(`Aggregation function`),field:r().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:r().describe(`Result column alias`),distinct:S().optional().describe(`Apply DISTINCT before aggregation`),filter:Oi.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)}),Mi=E([`inner`,`left`,`right`,`full`]),Ni=E([`auto`,`database`,`hash`,`loop`]),Pi=F(()=>h({type:Mi.describe(`Join type`),strategy:Ni.optional().describe(`Execution strategy hint`),object:r().describe(`Object/table to join`),alias:r().optional().describe(`Table alias`),on:Oi.describe(`Join condition`),subquery:F(()=>Bi).optional().describe(`Subquery instead of object`)})),Fi=E([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),Ii=h({partitionBy:C(r()).optional().describe(`PARTITION BY fields`),orderBy:C(Ai).optional().describe(`ORDER BY specification`),frame:h({type:E([`rows`,`range`]).optional(),start:r().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:r().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)}),Li=h({function:Fi.describe(`Window function name`),field:r().optional().describe(`Field to operate on (for aggregate window functions)`),alias:r().describe(`Result column alias`),over:Ii.describe(`Window specification (OVER clause)`)}),Ri=F(()=>l([r(),h({field:r(),fields:C(Ri).optional(),alias:r().optional()})])),zi=h({query:r().describe(`Search query text`),fields:C(r()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:S().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:E([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:d(r(),P()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:P().optional().describe(`Minimum relevance score threshold`),language:r().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:S().optional().default(!1).describe(`Enable search result highlighting`)}),Bi=h({object:r().describe(`Object name (e.g. account)`),fields:C(Ri).optional().describe(`Fields to retrieve`),where:Oi.optional().describe(`Filtering criteria (WHERE)`),search:zi.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:C(Ai).optional().describe(`Sorting instructions (ORDER BY)`),limit:P().optional().describe(`Max records to return (LIMIT)`),offset:P().optional().describe(`Records to skip (OFFSET)`),top:P().optional().describe(`Alias for limit (OData compatibility)`),cursor:d(r(),u()).optional().describe(`Cursor for keyset pagination`),joins:C(Pi).optional().describe(`Explicit Table Joins`),aggregations:C(ji).optional().describe(`Aggregation functions`),groupBy:C(r()).optional().describe(`GROUP BY fields`),having:Oi.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:C(Li).optional().describe(`Window functions with OVER clause`),distinct:S().optional().describe(`SELECT DISTINCT flag`)}).extend({expand:F(()=>d(r(),Bi)).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.`)}),Vi=h({code:r().describe(`Error code (e.g. validation_error)`),message:r().describe(`Readable error message`),category:r().optional().describe(`Error category (e.g. validation, authorization)`),details:u().optional().describe(`Additional error context (e.g. field validation errors)`),requestId:r().optional().describe(`Request ID for tracking`)}),R=h({success:S().describe(`Operation success status`),error:Vi.optional().describe(`Error details if success is false`),meta:h({timestamp:r(),duration:P().optional(),requestId:r().optional(),traceId:r().optional()}).optional().describe(`Response metadata`)}),Hi=d(r(),u()).describe(`Key-value map of record data`);h({data:Hi.describe(`Record data to insert`)}),h({data:Hi.describe(`Partial record data to update`)}),h({records:C(Hi).describe(`Array of records to process`),allOrNone:S().default(!0).describe(`If true, rollback entire transaction on any failure`)}),v(Bi,h({format:E([`csv`,`json`,`xlsx`]).default(`csv`)})),R.extend({data:Hi.describe(`The requested or modified record`)}),R.extend({data:C(Hi).describe(`Array of matching records`),pagination:h({total:P().optional().describe(`Total matching records count`),limit:P().optional().describe(`Page size`),offset:P().optional().describe(`Page offset`),cursor:r().optional().describe(`Cursor for next page`),nextCursor:r().optional().describe(`Next cursor for pagination`),hasMore:S().describe(`Are there more pages?`)}).describe(`Pagination info`)}),h({id:r().describe(`Record ID`)});var Ui=h({id:r().optional().describe(`Record ID if processed`),success:S(),errors:C(Vi).optional(),index:P().optional().describe(`Index in original request`),data:u().optional().describe(`Result data (e.g. created record)`)});R.extend({data:C(Ui).describe(`Results for each item in the batch`)}),R.extend({id:r().describe(`ID of the deleted record`)}),h({ids:C(r())});var Wi=h({maxBatchSize:P().int().default(100).describe(`Maximum number of keys per batch load`),batchScheduleFn:E([`microtask`,`timeout`,`manual`]).default(`microtask`).describe(`Scheduling strategy for collecting batch keys`),cacheEnabled:S().default(!0).describe(`Enable per-request result caching`),cacheKeyFn:r().optional().describe(`Name or identifier of the cache key function`),cacheTtl:P().min(0).optional().describe(`Cache time-to-live in seconds (0 = no expiration)`),coalesceRequests:S().default(!0).describe(`Deduplicate identical requests within a batch window`),maxConcurrency:P().int().optional().describe(`Maximum parallel batch requests`)}),Gi=h({strategy:E([`dataloader`,`windowed`,`prefetch`]).describe(`Batch loading strategy type`),windowMs:P().optional().describe(`Collection window duration in milliseconds (for windowed strategy)`),prefetchDepth:P().int().optional().describe(`Depth of relation prefetching (for prefetch strategy)`),associationLoading:E([`lazy`,`eager`,`batch`]).default(`batch`).describe(`How to load related associations`)});h({preventNPlusOne:S().describe(`Enable N+1 query detection and prevention`),dataLoader:Wi.optional().describe(`DataLoader batch loading configuration`),batchStrategy:Gi.optional().describe(`Batch loading strategy configuration`),maxQueryDepth:P().int().describe(`Maximum depth for nested relation queries`),queryComplexityLimit:P().optional().describe(`Maximum allowed query complexity score`),enableQueryPlan:S().default(!1).describe(`Log query execution plans for debugging`)});var Ki=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),qi=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),Ji=h({url:r().describe(`API endpoint URL`),method:qi.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)}),Yi=h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(Ki).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),Xi=h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),Zi=h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)}),Qi=h({source:r().describe(`Source field/path`),target:r().describe(`Target field/path`),transform:r().optional().describe(`Transformation function name`)}),$i=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique endpoint ID`),path:r().regex(/^\//).describe(`URL Path (e.g. /api/v1/customers)`),method:Ki.describe(`HTTP Method`),summary:r().optional(),description:r().optional(),type:E([`flow`,`script`,`object_operation`,`proxy`]).describe(`Implementation type`),target:r().describe(`Target Flow ID, Script Name, or Proxy URL`),objectParams:h({object:r().optional(),operation:E([`find`,`get`,`create`,`update`,`delete`]).optional()}).optional().describe(`For object_operation type`),inputMapping:C(Qi).optional().describe(`Map Request Body to Internal Params`),outputMapping:C(Qi).optional().describe(`Map Internal Result to Response Body`),authRequired:S().default(!0).describe(`Require authentication`),rateLimit:Xi.optional().describe(`Rate limiting policy`),cacheTtl:P().optional().describe(`Response cache TTL in seconds`)});Object.assign($i,{create:e=>e});var ea=E([`available`,`registered`,`unavailable`,`degraded`,`stub`]).describe(`available = fully operational, registered = route declared but handler unverified, unavailable = not installed, degraded = partial, stub = placeholder that returns 501`),ta=h({enabled:S(),status:ea,handlerReady:S().optional().describe(`Whether the HTTP handler is confirmed to be mounted. Omitted = readiness unknown/unverified; true = handler mounted; false = handler missing or stub (likely 501).`),route:r().optional().describe(`e.g. /api/v1/analytics`),provider:r().optional().describe(`e.g. "objectql", "plugin-redis", "driver-memory"`),version:r().optional().describe(`Semantic version of the service implementation (e.g. "3.0.6")`),message:r().optional().describe(`e.g. "Install plugin-workflow to enable"`),rateLimit:h({requestsPerMinute:P().int().optional().describe(`Maximum requests per minute`),requestsPerHour:P().int().optional().describe(`Maximum requests per hour`),burstLimit:P().int().optional().describe(`Maximum burst request count`),retryAfterMs:P().int().optional().describe(`Suggested retry-after delay in milliseconds when rate-limited`)}).optional().describe(`Rate limit and quota info for this service`)}),na=h({data:r().describe(`e.g. /api/v1/data`),metadata:r().describe(`e.g. /api/v1/meta`),discovery:r().optional().describe(`e.g. /api/v1/discovery`),ui:r().optional().describe(`e.g. /api/v1/ui`),auth:r().optional().describe(`e.g. /api/v1/auth`),automation:r().optional().describe(`e.g. /api/v1/automation`),storage:r().optional().describe(`e.g. /api/v1/storage`),analytics:r().optional().describe(`e.g. /api/v1/analytics`),graphql:r().optional().describe(`e.g. /graphql`),packages:r().optional().describe(`e.g. /api/v1/packages`),workflow:r().optional().describe(`e.g. /api/v1/workflow`),realtime:r().optional().describe(`e.g. /api/v1/realtime`),notifications:r().optional().describe(`e.g. /api/v1/notifications`),ai:r().optional().describe(`e.g. /api/v1/ai`),i18n:r().optional().describe(`e.g. /api/v1/i18n`),feed:r().optional().describe(`e.g. /api/v1/feed`)}),fee=h({name:r(),version:r(),environment:E([`production`,`sandbox`,`development`]),routes:na,locale:h({default:r(),supported:C(r()),timezone:r()}),services:d(r(),ta).describe(`Per-service availability map keyed by CoreServiceName`),capabilities:d(r(),h({enabled:S().describe(`Whether this capability is available`),features:d(r(),S()).optional().describe(`Sub-feature flags within this capability`),description:r().optional().describe(`Human-readable capability description`)})).optional().describe(`Hierarchical capability descriptors for frontend intelligent adaptation`),schemaDiscovery:h({openapi:r().optional().describe(`URL to OpenAPI (Swagger) specification (e.g., "/api/v1/openapi.json")`),graphql:r().optional().describe(`URL to GraphQL schema endpoint (e.g., "/graphql")`),jsonSchema:r().optional().describe(`URL to JSON Schema definitions`)}).optional().describe(`Schema discovery endpoints for API toolchain integration`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs for extensibility`)});h({feed:S().describe(`Whether the backend supports Feed / Chatter API`),comments:S().describe(`Whether the backend supports comments (a subset of Feed)`),automation:S().describe(`Whether the backend supports Automation CRUD (flows, triggers)`),cron:S().describe(`Whether the backend supports cron scheduling`),search:S().describe(`Whether the backend supports full-text search`),export:S().describe(`Whether the backend supports async export`),chunkedUpload:S().describe(`Whether the backend supports chunked (multipart) uploads`)}).describe(`Well-known capability flags for frontend intelligent adaptation`);var ra=h({route:r().describe(`Route path pattern`),method:Ki.describe(`HTTP method (GET, POST, etc.)`),service:r().describe(`Target service name`),declared:S().describe(`Whether the route is declared in discovery/metadata`),handlerRegistered:S().describe(`Whether the HTTP handler is registered`),healthStatus:E([`pass`,`fail`,`missing`,`skip`]).describe(`pass = handler responds, fail = 501/503, missing = no handler (404), skip = not checked`),message:r().optional().describe(`Diagnostic message`)});h({timestamp:r().describe(`ISO 8601 timestamp of report generation`),adapter:r().describe(`Adapter or runtime that produced this report`),totalDeclared:P().int().describe(`Total routes declared in discovery`),totalRegistered:P().int().describe(`Routes with confirmed handler`),totalMissing:P().int().describe(`Routes missing a handler`),routes:C(ra).describe(`Per-route health entries`)});var pee=E(`metadata.object.created,metadata.object.updated,metadata.object.deleted,metadata.field.created,metadata.field.updated,metadata.field.deleted,metadata.view.created,metadata.view.updated,metadata.view.deleted,metadata.app.created,metadata.app.updated,metadata.app.deleted,metadata.agent.created,metadata.agent.updated,metadata.agent.deleted,metadata.tool.created,metadata.tool.updated,metadata.tool.deleted,metadata.flow.created,metadata.flow.updated,metadata.flow.deleted,metadata.action.created,metadata.action.updated,metadata.action.deleted,metadata.workflow.created,metadata.workflow.updated,metadata.workflow.deleted,metadata.dashboard.created,metadata.dashboard.updated,metadata.dashboard.deleted,metadata.report.created,metadata.report.updated,metadata.report.deleted,metadata.role.created,metadata.role.updated,metadata.role.deleted,metadata.permission.created,metadata.permission.updated,metadata.permission.deleted`.split(`,`)),ia=E([`data.record.created`,`data.record.updated`,`data.record.deleted`,`data.field.changed`]);h({id:r().uuid().describe(`Unique event identifier`),type:pee.describe(`Event type`),metadataType:r().describe(`Metadata type (object, view, agent, etc.)`),name:r().describe(`Metadata item name`),packageId:r().optional().describe(`Package ID`),definition:u().optional().describe(`Full definition (create/update only)`),userId:r().optional().describe(`User who triggered the event`),timestamp:r().datetime().describe(`Event timestamp`)}),h({id:r().uuid().describe(`Unique event identifier`),type:ia.describe(`Event type`),object:r().describe(`Object name`),recordId:r().describe(`Record ID`),changes:d(r(),u()).optional().describe(`Changed fields`),before:d(r(),u()).optional().describe(`Before state`),after:d(r(),u()).optional().describe(`After state`),userId:r().optional().describe(`User who triggered the event`),timestamp:r().datetime().describe(`Event timestamp`)});var aa=E([`online`,`away`,`busy`,`offline`]),oa=E([`created`,`updated`,`deleted`]),sa=h({userId:r().describe(`User identifier`),status:aa.describe(`Current presence status`),lastSeen:r().datetime().describe(`ISO 8601 datetime of last activity`),metadata:d(r(),u()).optional().describe(`Custom presence data (e.g., current page, custom status)`)}),ca=E([`websocket`,`sse`,`polling`]),la=h({type:E([`record.created`,`record.updated`,`record.deleted`,`field.changed`]).describe(`Type of event to subscribe to`),object:r().optional().describe(`Object name to subscribe to`),filters:u().optional().describe(`Filter conditions`)}),ua=h({id:r().uuid().describe(`Unique subscription identifier`),events:C(la).describe(`Array of events to subscribe to`),transport:ca.describe(`Transport protocol to use`),channel:r().optional().describe(`Optional channel name for grouping subscriptions`)}),da=sa;h({id:r().uuid().describe(`Unique event identifier`),type:r().describe(`Event type (e.g., record.created, record.updated)`),object:r().optional().describe(`Object name the event relates to`),action:oa.optional().describe(`Action performed`),payload:d(r(),u()).describe(`Event payload data`),timestamp:r().datetime().describe(`ISO 8601 datetime when event occurred`),userId:r().optional().describe(`User who triggered the event`),sessionId:r().optional().describe(`Session identifier`)}),h({enabled:S().default(!0).describe(`Enable realtime synchronization`),transport:ca.default(`websocket`).describe(`Transport protocol`),subscriptions:C(ua).optional().describe(`Default subscriptions`)}).passthrough();var fa=r().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)`),pa=r().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)`),ma=r().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)`),ha=E([`subscribe`,`unsubscribe`,`event`,`ping`,`pong`,`ack`,`error`,`presence`,`cursor`,`edit`]),ga=E([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`,`contains`,`startsWith`,`endsWith`,`exists`,`regex`]),_a=h({conditions:C(h({field:r().describe(`Field path to filter on (supports dot notation, e.g., "user.email")`),operator:ga.describe(`Comparison operator`),value:u().optional().describe(`Value to compare against (not needed for "exists" operator)`)})).optional().describe(`Array of filter conditions`),and:F(()=>C(_a)).optional().describe(`AND logical combination of filters`),or:F(()=>C(_a)).optional().describe(`OR logical combination of filters`),not:F(()=>_a).optional().describe(`NOT logical negation of filter`)}),va=r().min(1).regex(/^[a-z*][a-z0-9_.*]*$/,{message:`Event pattern must be lowercase and may contain letters, numbers, underscores, dots, or wildcards (e.g., "record.*", "*.created", "user.login")`}).describe(`Event pattern (supports wildcards like "record.*" or "*.created")`),ya=h({subscriptionId:r().uuid().describe(`Unique subscription identifier`),events:C(va).describe(`Event patterns to subscribe to (supports wildcards, e.g., "record.*", "user.created")`),objects:C(r()).optional().describe(`Object names to filter events by (e.g., ["account", "contact"])`),filters:_a.optional().describe(`Advanced filter conditions for event payloads`),channels:C(r()).optional().describe(`Channel names for scoped subscriptions`)}),ba=h({subscriptionId:r().uuid().describe(`Subscription ID to unsubscribe from`)}),xa=aa,Sa=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Unique session identifier`),status:xa.describe(`Current presence status`),lastSeen:r().datetime().describe(`ISO 8601 datetime of last activity`),currentLocation:r().optional().describe(`Current page/route user is viewing`),device:E([`desktop`,`mobile`,`tablet`,`other`]).optional().describe(`Device type`),customStatus:r().optional().describe(`Custom user status message`),metadata:d(r(),u()).optional().describe(`Additional custom presence data`)});h({status:xa.optional().describe(`Updated presence status`),currentLocation:r().optional().describe(`Updated current location`),customStatus:r().optional().describe(`Updated custom status message`),metadata:d(r(),u()).optional().describe(`Updated metadata`)});var Ca=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier being edited`),position:h({line:P().int().nonnegative().describe(`Line number (0-indexed)`),column:P().int().nonnegative().describe(`Column number (0-indexed)`)}).optional().describe(`Cursor position in document`),selection:h({start:h({line:P().int().nonnegative(),column:P().int().nonnegative()}),end:h({line:P().int().nonnegative(),column:P().int().nonnegative()})}).optional().describe(`Selection range (if text is selected)`),color:r().optional().describe(`Cursor color for visual representation`),userName:r().optional().describe(`Display name of user`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last cursor update`)}),wa=E([`insert`,`delete`,`replace`]),Ta=h({operationId:r().uuid().describe(`Unique operation identifier`),documentId:r().describe(`Document identifier`),userId:r().describe(`User who performed the edit`),sessionId:r().uuid().describe(`Session identifier`),type:wa.describe(`Type of edit operation`),position:h({line:P().int().nonnegative().describe(`Line number (0-indexed)`),column:P().int().nonnegative().describe(`Column number (0-indexed)`)}).describe(`Starting position of the operation`),endPosition:h({line:P().int().nonnegative(),column:P().int().nonnegative()}).optional().describe(`Ending position (for delete/replace operations)`),content:r().optional().describe(`Content to insert/replace`),version:P().int().nonnegative().describe(`Document version before this operation`),timestamp:r().datetime().describe(`ISO 8601 datetime when operation was created`),baseOperationId:r().uuid().optional().describe(`Previous operation ID this builds upon (for OT)`)});h({documentId:r().describe(`Document identifier`),version:P().int().nonnegative().describe(`Current document version`),content:r().describe(`Current document content`),lastModified:r().datetime().describe(`ISO 8601 datetime of last modification`),activeSessions:C(r().uuid()).describe(`Active editing session IDs`),checksum:r().optional().describe(`Content checksum for integrity verification`)});var Ea=h({messageId:r().uuid().describe(`Unique message identifier`),type:ha.describe(`Message type`),timestamp:r().datetime().describe(`ISO 8601 datetime when message was sent`)});I(`type`,[Ea.extend({type:m(`subscribe`),subscription:ya.describe(`Subscription configuration`)}),Ea.extend({type:m(`unsubscribe`),request:ba.describe(`Unsubscribe request`)}),Ea.extend({type:m(`event`),subscriptionId:r().uuid().describe(`Subscription ID this event belongs to`),eventName:ma.describe(`Event name`),object:r().optional().describe(`Object name the event relates to`),payload:u().describe(`Event payload data`),userId:r().optional().describe(`User who triggered the event`)}),Ea.extend({type:m(`presence`),presence:Sa.describe(`Presence state`)}),Ea.extend({type:m(`cursor`),cursor:Ca.describe(`Cursor position`)}),Ea.extend({type:m(`edit`),operation:Ta.describe(`Edit operation`)}),Ea.extend({type:m(`ack`),ackMessageId:r().uuid().describe(`ID of the message being acknowledged`),success:S().describe(`Whether the operation was successful`),error:r().optional().describe(`Error message if operation failed`)}),Ea.extend({type:m(`error`),code:r().describe(`Error code`),message:r().describe(`Error message`),details:u().optional().describe(`Additional error details`)}),Ea.extend({type:m(`ping`)}),Ea.extend({type:m(`pong`),pingMessageId:r().uuid().optional().describe(`ID of ping message being responded to`)})]),h({url:r().url().describe(`WebSocket server URL`),protocols:C(r()).optional().describe(`WebSocket sub-protocols`),reconnect:S().optional().default(!0).describe(`Enable automatic reconnection`),reconnectInterval:P().int().positive().optional().default(1e3).describe(`Reconnection interval in milliseconds`),maxReconnectAttempts:P().int().positive().optional().default(5).describe(`Maximum reconnection attempts`),pingInterval:P().int().positive().optional().default(3e4).describe(`Ping interval in milliseconds`),timeout:P().int().positive().optional().default(5e3).describe(`Message timeout in milliseconds`),headers:d(r(),r()).optional().describe(`Custom headers for WebSocket handshake`)}),h({type:E([`subscribe`,`unsubscribe`,`data-change`,`presence-update`,`cursor-update`,`error`]).describe(`Event type`),channel:r().describe(`Channel identifier (e.g., "record.account.123", "user.456")`),payload:u().describe(`Event payload data`),timestamp:P().describe(`Unix timestamp in milliseconds`)}),h({userId:r().describe(`User identifier`),userName:r().describe(`User display name`),status:E([`online`,`away`,`offline`]).describe(`User presence status`),lastSeen:P().describe(`Unix timestamp of last activity in milliseconds`),metadata:d(r(),u()).optional().describe(`Additional presence metadata (e.g., current page, custom status)`)}),h({userId:r().describe(`User identifier`),recordId:r().describe(`Record identifier being edited`),fieldName:r().describe(`Field name being edited`),position:P().describe(`Cursor position (character offset from start)`),selection:h({start:P().describe(`Selection start position`),end:P().describe(`Selection end position`)}).optional().describe(`Text selection range (if text is selected)`)}),h({enabled:S().default(!1).describe(`Enable WebSocket server`),path:r().default(`/ws`).describe(`WebSocket endpoint path`),heartbeatInterval:P().default(3e4).describe(`Heartbeat interval in milliseconds`),reconnectAttempts:P().default(5).describe(`Maximum reconnection attempts for clients`),presence:S().default(!1).describe(`Enable presence tracking`),cursorSharing:S().default(!1).describe(`Enable collaborative cursor sharing`)});var Da=E([`system`,`api`,`auth`,`static`,`webhook`,`plugin`]);h({method:Ki,path:r().describe(`URL Path pattern`),category:Da.default(`api`),handler:r().describe(`Unique handler identifier`),summary:r().optional().describe(`OpenAPI summary`),description:r().optional().describe(`OpenAPI description`),public:S().default(!1).describe(`Is publicly accessible`),permissions:C(r()).optional().describe(`Required permissions`),timeout:P().int().optional().describe(`Execution timeout in ms`),rateLimit:r().optional().describe(`Rate limit policy name`)}),h({basePath:r().default(`/api`).describe(`Global API prefix`),mounts:h({data:r().default(`/data`).describe(`Data Protocol (CRUD)`),metadata:r().default(`/meta`).describe(`Metadata Protocol (Schemas)`),auth:r().default(`/auth`).describe(`Auth Protocol`),automation:r().default(`/automation`).describe(`Automation Protocol`),storage:r().default(`/storage`).describe(`Storage Protocol`),analytics:r().default(`/analytics`).describe(`Analytics Protocol`),graphql:r().default(`/graphql`).describe(`GraphQL Endpoint`),ui:r().default(`/ui`).describe(`UI Metadata Protocol (Views, Layouts)`),workflow:r().default(`/workflow`).describe(`Workflow Engine Protocol`),realtime:r().default(`/realtime`).describe(`Realtime/WebSocket Protocol`),notifications:r().default(`/notifications`).describe(`Notification Protocol`),ai:r().default(`/ai`).describe(`AI Engine Protocol (NLQ, Chat, Suggest)`),i18n:r().default(`/i18n`).describe(`Internationalization Protocol`),packages:r().default(`/packages`).describe(`Package Management Protocol`)}).default({data:`/data`,metadata:`/meta`,auth:`/auth`,automation:`/automation`,storage:`/storage`,analytics:`/analytics`,graphql:`/graphql`,ui:`/ui`,workflow:`/workflow`,realtime:`/realtime`,notifications:`/notifications`,ai:`/ai`,i18n:`/i18n`,packages:`/packages`}),cors:Yi.optional(),staticMounts:C(Zi).optional()}),h({$select:l([r(),C(r())]).optional().describe(`Fields to select`),$filter:r().optional().describe(`Filter expression (OData filter syntax)`),$orderby:l([r(),C(r())]).optional().describe(`Sort order`),$top:P().int().min(0).optional().describe(`Max results to return`),$skip:P().int().min(0).optional().describe(`Results to skip`),$expand:l([r(),C(r())]).optional().describe(`Navigation properties to expand (lookup/master_detail fields)`),$count:S().optional().describe(`Include total count`),$search:r().optional().describe(`Search expression`),$format:E([`json`,`xml`,`atom`]).optional().describe(`Response format`),$apply:r().optional().describe(`Aggregation expression`)}),E([`eq`,`ne`,`lt`,`le`,`gt`,`ge`,`and`,`or`,`not`,`(`,`)`,`in`,`has`]),E(`contains.startswith.endswith.length.indexof.substring.tolower.toupper.trim.concat.year.month.day.hour.minute.second.date.time.now.maxdatetime.mindatetime.round.floor.ceiling.cast.isof.any.all`.split(`.`)),h({"@odata.context":r().url().optional().describe(`Metadata context URL`),"@odata.count":P().int().optional().describe(`Total results count`),"@odata.nextLink":r().url().optional().describe(`Next page URL`),value:C(d(r(),u())).describe(`Results array`)}),h({error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),target:r().optional().describe(`Error target`),details:C(h({code:r(),message:r(),target:r().optional()})).optional().describe(`Error details`),innererror:d(r(),u()).optional().describe(`Inner error details`)})});var Oa=h({namespace:r().describe(`Service namespace`),entityTypes:C(h({name:r().describe(`Entity type name`),key:C(r()).describe(`Key fields`),properties:C(h({name:r(),type:r().describe(`OData type (Edm.String, Edm.Int32, etc.)`),nullable:S().default(!0)})),navigationProperties:C(h({name:r(),type:r(),partner:r().optional()})).optional()})).describe(`Entity types`),entitySets:C(h({name:r().describe(`Entity set name`),entityType:r().describe(`Entity type`)})).describe(`Entity sets`)});h({enabled:S().default(!0).describe(`Enable OData API`),path:r().default(`/odata`).describe(`OData endpoint path`),metadata:Oa.optional().describe(`OData metadata configuration`)}).passthrough(),E([`ID`,`String`,`Int`,`Float`,`Boolean`,`DateTime`,`Date`,`Time`,`JSON`,`JSONObject`,`Upload`,`URL`,`Email`,`PhoneNumber`,`Currency`,`Decimal`,`BigInt`,`Long`,`UUID`,`Base64`,`Void`]);var ka=h({name:r().describe(`GraphQL type name (PascalCase recommended)`),object:r().describe(`Source ObjectQL object name`),description:r().optional().describe(`Type description`),fields:h({include:C(r()).optional().describe(`Fields to include`),exclude:C(r()).optional().describe(`Fields to exclude (e.g., sensitive fields)`),mappings:d(r(),h({graphqlName:r().optional().describe(`Custom GraphQL field name`),graphqlType:r().optional().describe(`Override GraphQL type`),description:r().optional().describe(`Field description`),deprecationReason:r().optional().describe(`Why field is deprecated`),nullable:S().optional().describe(`Override nullable`)})).optional().describe(`Field-level customizations`)}).optional().describe(`Field configuration`),interfaces:C(r()).optional().describe(`GraphQL interface names`),isInterface:S().optional().default(!1).describe(`Define as GraphQL interface`),directives:C(h({name:r().describe(`Directive name`),args:d(r(),u()).optional().describe(`Directive arguments`)})).optional().describe(`GraphQL directives`)}),Aa=h({name:r().describe(`Query field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),type:E([`get`,`list`,`search`]).describe(`Query type`),description:r().optional().describe(`Query description`),args:d(r(),h({type:r().describe(`GraphQL type (e.g., "ID!", "String", "Int")`),description:r().optional().describe(`Argument description`),defaultValue:u().optional().describe(`Default value`)})).optional().describe(`Query arguments`),filtering:h({enabled:S().default(!0).describe(`Allow filtering`),fields:C(r()).optional().describe(`Filterable fields`),operators:C(E([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`notIn`,`contains`,`startsWith`,`endsWith`,`isNull`,`isNotNull`])).optional().describe(`Allowed filter operators`)}).optional().describe(`Filtering capabilities`),sorting:h({enabled:S().default(!0).describe(`Allow sorting`),fields:C(r()).optional().describe(`Sortable fields`),defaultSort:h({field:r(),direction:E([`ASC`,`DESC`])}).optional().describe(`Default sort order`)}).optional().describe(`Sorting capabilities`),pagination:h({enabled:S().default(!0).describe(`Enable pagination`),type:E([`offset`,`cursor`,`relay`]).default(`offset`).describe(`Pagination style`),defaultLimit:P().int().min(1).default(20).describe(`Default page size`),maxLimit:P().int().min(1).default(100).describe(`Maximum page size`),cursors:h({field:r().default(`id`).describe(`Field to use for cursor pagination`)}).optional()}).optional().describe(`Pagination configuration`),fields:h({required:C(r()).optional().describe(`Required fields (always returned)`),selectable:C(r()).optional().describe(`Selectable fields`)}).optional().describe(`Field selection configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),cache:h({enabled:S().default(!1).describe(`Enable caching`),ttl:P().int().min(0).optional().describe(`Cache TTL in seconds`),key:r().optional().describe(`Cache key template`)}).optional().describe(`Query caching`)}),ja=h({name:r().describe(`Mutation field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),type:E([`create`,`update`,`delete`,`upsert`,`custom`]).describe(`Mutation type`),description:r().optional().describe(`Mutation description`),input:h({typeName:r().optional().describe(`Custom input type name`),fields:h({include:C(r()).optional().describe(`Fields to include`),exclude:C(r()).optional().describe(`Fields to exclude`),required:C(r()).optional().describe(`Required input fields`)}).optional().describe(`Input field configuration`),validation:h({enabled:S().default(!0).describe(`Enable input validation`),rules:C(r()).optional().describe(`Custom validation rules`)}).optional().describe(`Input validation`)}).optional().describe(`Input configuration`),output:h({type:E([`object`,`payload`,`boolean`,`custom`]).default(`object`).describe(`Output type`),includeEnvelope:S().optional().default(!1).describe(`Wrap in success/error payload`),customType:r().optional().describe(`Custom output type name`)}).optional().describe(`Output configuration`),transaction:h({enabled:S().default(!0).describe(`Use database transaction`),isolationLevel:E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`]).optional().describe(`Transaction isolation level`)}).optional().describe(`Transaction configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),hooks:h({before:C(r()).optional().describe(`Pre-mutation hooks`),after:C(r()).optional().describe(`Post-mutation hooks`)}).optional().describe(`Lifecycle hooks`)}),Ma=h({name:r().describe(`Subscription field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),events:C(E([`created`,`updated`,`deleted`,`custom`])).describe(`Events to subscribe to`),description:r().optional().describe(`Subscription description`),filter:h({enabled:S().default(!0).describe(`Allow filtering subscriptions`),fields:C(r()).optional().describe(`Filterable fields`)}).optional().describe(`Subscription filtering`),payload:h({includeEntity:S().default(!0).describe(`Include entity in payload`),includePreviousValues:S().optional().default(!1).describe(`Include previous field values`),includeMeta:S().optional().default(!0).describe(`Include metadata (timestamp, user, etc.)`)}).optional().describe(`Payload configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:h({enabled:S().default(!0).describe(`Enable rate limiting`),maxSubscriptionsPerUser:P().int().min(1).default(10).describe(`Max concurrent subscriptions per user`),throttleMs:P().int().min(0).optional().describe(`Throttle interval in milliseconds`)}).optional().describe(`Subscription rate limiting`)}),Na=h({path:r().describe(`Resolver path (Type.field)`),type:E([`datasource`,`computed`,`script`,`proxy`]).describe(`Resolver implementation type`),implementation:h({datasource:r().optional().describe(`Datasource ID`),query:r().optional().describe(`Query/SQL to execute`),expression:r().optional().describe(`Computation expression`),dependencies:C(r()).optional().describe(`Dependent fields`),script:r().optional().describe(`Script ID or inline code`),url:r().optional().describe(`Proxy URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`]).optional().describe(`HTTP method`)}).optional().describe(`Implementation configuration`),cache:h({enabled:S().default(!1).describe(`Enable resolver caching`),ttl:P().int().min(0).optional().describe(`Cache TTL in seconds`),keyArgs:C(r()).optional().describe(`Arguments to include in cache key`)}).optional().describe(`Resolver caching`)}),Pa=h({name:r().describe(`DataLoader name`),source:r().describe(`Source object or datasource`),batchFunction:h({type:E([`findByIds`,`query`,`script`,`custom`]).describe(`Batch function type`),keyField:r().optional().describe(`Field to batch on (e.g., "id")`),query:r().optional().describe(`Query template`),script:r().optional().describe(`Script ID`),maxBatchSize:P().int().min(1).optional().default(100).describe(`Maximum batch size`)}).describe(`Batch function configuration`),cache:h({enabled:S().default(!0).describe(`Enable per-request caching`),keyFn:r().optional().describe(`Custom cache key function`)}).optional().describe(`DataLoader caching`),options:h({batch:S().default(!0).describe(`Enable batching`),cache:S().default(!0).describe(`Enable caching`),maxCacheSize:P().int().min(0).optional().describe(`Max cache entries`)}).optional().describe(`DataLoader options`)}),Fa=E([`QUERY`,`MUTATION`,`SUBSCRIPTION`,`FIELD`,`FRAGMENT_DEFINITION`,`FRAGMENT_SPREAD`,`INLINE_FRAGMENT`,`VARIABLE_DEFINITION`,`SCHEMA`,`SCALAR`,`OBJECT`,`FIELD_DEFINITION`,`ARGUMENT_DEFINITION`,`INTERFACE`,`UNION`,`ENUM`,`ENUM_VALUE`,`INPUT_OBJECT`,`INPUT_FIELD_DEFINITION`]),Ia=h({name:r().regex(/^[a-z][a-zA-Z0-9]*$/).describe(`Directive name (camelCase)`),description:r().optional().describe(`Directive description`),locations:C(Fa).describe(`Directive locations`),args:d(r(),h({type:r().describe(`Argument type`),description:r().optional().describe(`Argument description`),defaultValue:u().optional().describe(`Default value`)})).optional().describe(`Directive arguments`),repeatable:S().optional().default(!1).describe(`Can be applied multiple times`),implementation:h({type:E([`auth`,`validation`,`transform`,`cache`,`deprecation`,`custom`]).describe(`Directive type`),handler:r().optional().describe(`Handler function name or script`)}).optional().describe(`Directive implementation`)}),La=h({enabled:S().default(!0).describe(`Enable query depth limiting`),maxDepth:P().int().min(1).default(10).describe(`Maximum query depth`),ignoreFields:C(r()).optional().describe(`Fields excluded from depth calculation`),onDepthExceeded:E([`reject`,`log`,`warn`]).default(`reject`).describe(`Action when depth exceeded`),errorMessage:r().optional().describe(`Custom error message for depth violations`)}),Ra=h({enabled:S().default(!0).describe(`Enable query complexity limiting`),maxComplexity:P().int().min(1).default(1e3).describe(`Maximum query complexity`),defaultFieldComplexity:P().int().min(0).default(1).describe(`Default complexity per field`),fieldComplexity:d(r(),l([P().int().min(0),h({base:P().int().min(0).describe(`Base complexity`),multiplier:r().optional().describe(`Argument multiplier (e.g., "limit")`),calculator:r().optional().describe(`Custom calculator function`)})])).optional().describe(`Per-field complexity configuration`),listMultiplier:P().min(0).default(10).describe(`Multiplier for list fields`),onComplexityExceeded:E([`reject`,`log`,`warn`]).default(`reject`).describe(`Action when complexity exceeded`),errorMessage:r().optional().describe(`Custom error message for complexity violations`)}),za=h({enabled:S().default(!0).describe(`Enable rate limiting`),strategy:E([`token_bucket`,`fixed_window`,`sliding_window`,`cost_based`]).default(`token_bucket`).describe(`Rate limiting strategy`),global:h({maxRequests:P().int().min(1).default(1e3).describe(`Maximum requests per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`)}).optional().describe(`Global rate limits`),perUser:h({maxRequests:P().int().min(1).default(100).describe(`Maximum requests per user per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`)}).optional().describe(`Per-user rate limits`),costBased:h({enabled:S().default(!1).describe(`Enable cost-based rate limiting`),maxCost:P().int().min(1).default(1e4).describe(`Maximum cost per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`),useComplexityAsCost:S().default(!0).describe(`Use query complexity as cost`)}).optional().describe(`Cost-based rate limiting`),operations:d(r(),h({maxRequests:P().int().min(1).describe(`Max requests for this operation`),windowMs:P().int().min(1e3).describe(`Time window`)})).optional().describe(`Per-operation rate limits`),onLimitExceeded:E([`reject`,`queue`,`log`]).default(`reject`).describe(`Action when rate limit exceeded`),errorMessage:r().optional().describe(`Custom error message for rate limit violations`),includeHeaders:S().default(!0).describe(`Include rate limit headers in response`)}),Ba=h({enabled:S().default(!1).describe(`Enable persisted queries`),mode:E([`optional`,`required`]).default(`optional`).describe(`Persisted query mode (optional: allow both, required: only persisted)`),store:h({type:E([`memory`,`redis`,`database`,`file`]).default(`memory`).describe(`Query store type`),connection:r().optional().describe(`Store connection string or path`),ttl:P().int().min(0).optional().describe(`TTL in seconds for stored queries`)}).optional().describe(`Query store configuration`),apq:h({enabled:S().default(!0).describe(`Enable Automatic Persisted Queries`),hashAlgorithm:E([`sha256`,`sha1`,`md5`]).default(`sha256`).describe(`Hash algorithm for query IDs`),cache:h({ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(1).optional().describe(`Maximum number of cached queries`)}).optional().describe(`APQ cache configuration`)}).optional().describe(`Automatic Persisted Queries configuration`),allowlist:h({enabled:S().default(!1).describe(`Enable query allow list (reject queries not in list)`),queries:C(h({id:r().describe(`Query ID or hash`),operation:r().optional().describe(`Operation name`),query:r().optional().describe(`Query string`)})).optional().describe(`Allowed queries`),source:r().optional().describe(`External allow list source (file path or URL)`)}).optional().describe(`Query allow list configuration`),security:h({maxQuerySize:P().int().min(1).optional().describe(`Maximum query string size in bytes`),rejectIntrospection:S().default(!1).describe(`Reject introspection queries`)}).optional().describe(`Security configuration`)}),Va=h({fields:r().describe(`Selection set of fields composing the entity key`),resolvable:S().optional().default(!0).describe(`Whether entities can be resolved from this subgraph`)}),Ha=h({field:r().describe(`Field name marked as external`),ownerSubgraph:r().optional().describe(`Subgraph that owns this field`)}),Ua=h({field:r().describe(`Field with the requirement`),fields:r().describe(`Selection set of required fields (e.g., "price weight")`)}),Wa=h({field:r().describe(`Field that provides additional entity fields`),fields:r().describe(`Selection set of provided fields (e.g., "name price")`)}),Ga=h({typeName:r().describe(`GraphQL type name for this entity`),keys:C(Va).min(1).describe(`Entity key definitions`),externalFields:C(Ha).optional().describe(`Fields owned by other subgraphs`),requires:C(Ua).optional().describe(`Required external fields for computed fields`),provides:C(Wa).optional().describe(`Fields provided during resolution`),owner:S().optional().default(!1).describe(`Whether this subgraph is the owner of this entity`)}),Ka=h({name:r().describe(`Unique subgraph identifier`),url:r().describe(`Subgraph endpoint URL`),schemaSource:E([`introspection`,`file`,`registry`]).default(`introspection`).describe(`How to obtain the subgraph schema`),schemaPath:r().optional().describe(`Path to schema file (SDL format)`),entities:C(Ga).optional().describe(`Entity definitions for this subgraph`),healthCheck:h({enabled:S().default(!0).describe(`Enable health checking`),path:r().default(`/health`).describe(`Health check endpoint path`),intervalMs:P().int().min(1e3).default(3e4).describe(`Health check interval in milliseconds`)}).optional().describe(`Subgraph health check configuration`),forwardHeaders:C(r()).optional().describe(`HTTP headers to forward to this subgraph`)}),qa=h({enabled:S().default(!1).describe(`Enable GraphQL Federation gateway mode`),version:E([`v1`,`v2`]).default(`v2`).describe(`Federation specification version`),subgraphs:C(Ka).describe(`Subgraph configurations`),serviceDiscovery:h({type:E([`static`,`dns`,`consul`,`kubernetes`]).default(`static`).describe(`Service discovery method`),pollIntervalMs:P().int().min(1e3).optional().describe(`Discovery poll interval in milliseconds`),namespace:r().optional().describe(`Kubernetes namespace for subgraph discovery`)}).optional().describe(`Service discovery configuration`),queryPlanning:h({strategy:E([`parallel`,`sequential`,`adaptive`]).default(`parallel`).describe(`Query execution strategy across subgraphs`),maxDepth:P().int().min(1).optional().describe(`Max query depth in federated execution`),dryRun:S().optional().default(!1).describe(`Log query plans without executing`)}).optional().describe(`Query planning configuration`),composition:h({conflictResolution:E([`error`,`first_wins`,`last_wins`]).default(`error`).describe(`Strategy for resolving schema conflicts`),validate:S().default(!0).describe(`Validate composed supergraph schema`)}).optional().describe(`Schema composition configuration`),errorHandling:h({includeSubgraphName:S().default(!1).describe(`Include subgraph name in error responses`),partialErrors:E([`propagate`,`nullify`,`reject`]).default(`propagate`).describe(`Behavior when a subgraph returns partial errors`)}).optional().describe(`Error handling configuration`)}),Ja=h({enabled:S().default(!0).describe(`Enable GraphQL API`),path:r().default(`/graphql`).describe(`GraphQL endpoint path`),playground:h({enabled:S().default(!0).describe(`Enable GraphQL Playground`),path:r().default(`/playground`).describe(`Playground path`)}).optional().describe(`GraphQL Playground configuration`),schema:h({autoGenerateTypes:S().default(!0).describe(`Auto-generate types from Objects`),types:C(ka).optional().describe(`Type configurations`),queries:C(Aa).optional().describe(`Query configurations`),mutations:C(ja).optional().describe(`Mutation configurations`),subscriptions:C(Ma).optional().describe(`Subscription configurations`),resolvers:C(Na).optional().describe(`Custom resolver configurations`),directives:C(Ia).optional().describe(`Custom directive configurations`)}).optional().describe(`Schema generation configuration`),dataLoaders:C(Pa).optional().describe(`DataLoader configurations`),security:h({depthLimit:La.optional().describe(`Query depth limiting`),complexity:Ra.optional().describe(`Query complexity calculation`),rateLimit:za.optional().describe(`Rate limiting`),persistedQueries:Ba.optional().describe(`Persisted queries`)}).optional().describe(`Security configuration`),federation:qa.optional().describe(`GraphQL Federation gateway configuration`)});Object.assign(Ja,{create:e=>e});var Ya=E([`create`,`update`,`upsert`,`delete`]),Xa=h({id:r().optional().describe(`Record ID (required for update/delete)`),data:Hi.optional().describe(`Record data (required for create/update/upsert)`),externalId:r().optional().describe(`External ID for upsert matching`)}),Za=h({atomic:S().optional().default(!0).describe(`If true, rollback entire batch on any failure (transaction mode)`),returnRecords:S().optional().default(!1).describe(`If true, return full record data in response`),continueOnError:S().optional().default(!1).describe(`If true (and atomic=false), continue processing remaining records after errors`),validateOnly:S().optional().default(!1).describe(`If true, validate records without persisting changes (dry-run mode)`)}),Qa=h({operation:Ya.describe(`Type of batch operation`),records:C(Xa).min(1).max(200).describe(`Array of records to process (max 200 per batch)`),options:Za.optional().describe(`Batch operation options`)});h({records:C(Xa).min(1).max(200).describe(`Array of records to update (max 200 per batch)`),options:Za.optional().describe(`Update options`)});var $a=h({id:r().optional().describe(`Record ID if operation succeeded`),success:S().describe(`Whether this record was processed successfully`),errors:C(Vi).optional().describe(`Array of errors if operation failed`),data:Hi.optional().describe(`Full record data (if returnRecords=true)`),index:P().optional().describe(`Index of the record in the request array`)});R.extend({operation:Ya.optional().describe(`Operation type that was performed`),total:P().describe(`Total number of records in the batch`),succeeded:P().describe(`Number of records that succeeded`),failed:P().describe(`Number of records that failed`),results:C($a).describe(`Detailed results for each record`)}),h({ids:C(r()).min(1).max(200).describe(`Array of record IDs to delete (max 200)`),options:Za.optional().describe(`Delete options`)}),h({enabled:S().default(!0).describe(`Enable batch operations`),maxRecordsPerBatch:P().int().min(1).max(1e3).default(200).describe(`Maximum records per batch`),defaultOptions:Za.optional().describe(`Default batch options`)}).passthrough();var eo=h({directives:C(E([`public`,`private`,`no-cache`,`no-store`,`must-revalidate`,`max-age`])).describe(`Cache control directives`),maxAge:P().optional().describe(`Maximum cache age in seconds`),staleWhileRevalidate:P().optional().describe(`Allow serving stale content while revalidating (seconds)`),staleIfError:P().optional().describe(`Allow serving stale content on error (seconds)`)}),to=h({value:r().describe(`ETag value (hash or version identifier)`),weak:S().optional().default(!1).describe(`Whether this is a weak ETag`)}),no=h({ifNoneMatch:r().optional().describe(`ETag value for conditional request (If-None-Match header)`),ifModifiedSince:r().datetime().optional().describe(`Timestamp for conditional request (If-Modified-Since header)`),cacheControl:eo.optional().describe(`Client cache control preferences`)});h({data:u().optional().describe(`Metadata payload (omitted for 304 Not Modified)`),etag:to.optional().describe(`ETag for this resource version`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),cacheControl:eo.optional().describe(`Cache control directives`),notModified:S().optional().default(!1).describe(`True if resource has not been modified (304 response)`),version:r().optional().describe(`Metadata version identifier`)}),h({target:E([`all`,`object`,`field`,`permission`,`layout`,`custom`]).describe(`What to invalidate`),identifiers:C(r()).optional().describe(`Specific resources to invalidate (e.g., object names)`),cascade:S().optional().default(!1).describe(`If true, invalidate dependent resources`),pattern:r().optional().describe(`Pattern for custom invalidation (supports wildcards)`)}),h({success:S().describe(`Whether invalidation succeeded`),invalidated:P().describe(`Number of cache entries invalidated`),targets:C(r()).optional().describe(`List of invalidated resources`)});var ro=E([`validation`,`authentication`,`authorization`,`not_found`,`conflict`,`rate_limit`,`server`,`external`,`maintenance`]),io=E(`validation_error.invalid_field.missing_required_field.invalid_format.value_too_long.value_too_short.value_out_of_range.invalid_reference.duplicate_value.invalid_query.invalid_filter.invalid_sort.max_records_exceeded.unauthenticated.invalid_credentials.expired_token.invalid_token.session_expired.mfa_required.email_not_verified.permission_denied.insufficient_privileges.field_not_accessible.record_not_accessible.license_required.ip_restricted.time_restricted.resource_not_found.object_not_found.record_not_found.field_not_found.endpoint_not_found.resource_conflict.concurrent_modification.delete_restricted.duplicate_record.lock_conflict.rate_limit_exceeded.quota_exceeded.concurrent_limit_exceeded.internal_error.database_error.timeout.service_unavailable.not_implemented.external_service_error.integration_error.webhook_delivery_failed.batch_partial_failure.batch_complete_failure.transaction_failed`.split(`.`)),ao=E([`no_retry`,`retry_immediate`,`retry_backoff`,`retry_after`]),oo=h({field:r().describe(`Field path (supports dot notation)`),code:io.describe(`Error code for this field`),message:r().describe(`Human-readable error message`),value:u().optional().describe(`The invalid value that was provided`),constraint:u().optional().describe(`The constraint that was violated (e.g., max length)`)}),so=h({code:io.describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),category:ro.optional().describe(`Error category`),httpStatus:P().optional().describe(`HTTP status code`),retryable:S().default(!1).describe(`Whether the request can be retried`),retryStrategy:ao.optional().describe(`Recommended retry strategy`),retryAfter:P().optional().describe(`Seconds to wait before retrying`),details:u().optional().describe(`Additional error context`),fieldErrors:C(oo).optional().describe(`Field-specific validation errors`),timestamp:r().datetime().optional().describe(`When the error occurred`),requestId:r().optional().describe(`Request ID for tracking`),traceId:r().optional().describe(`Distributed trace ID`),documentation:r().url().optional().describe(`URL to error documentation`),helpText:r().optional().describe(`Suggested actions to resolve the error`)});h({success:m(!1).describe(`Always false for error responses`),error:so.describe(`Error details`),meta:h({timestamp:r().datetime().optional(),requestId:r().optional(),traceId:r().optional()}).optional().describe(`Response metadata`)}),h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var co=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),lo=h({ariaLabel:co.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var uo=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),fo=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:uo.optional().describe(`Default number formatting rules`),dateFormat:fo.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var po=h({enabled:S().default(!1).describe(`Enable public sharing`),publicLink:r().optional().describe(`Generated public share URL`),password:r().optional().describe(`Password required to access shared link`),allowedDomains:C(r()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:r().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:S().optional().default(!1).describe(`Allow access without authentication`)}),mo=h({enabled:S().default(!1).describe(`Enable iframe embedding`),allowedOrigins:C(r()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:r().optional().default(`100%`).describe(`Embed width (CSS value)`),height:r().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:S().optional().default(!0).describe(`Show interface header in embed`),showNavigation:S().optional().default(!1).describe(`Show navigation in embed`),responsive:S().optional().default(!0).describe(`Enable responsive resizing`)}),ho=E([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),go=h({xs:P().min(1).max(12).optional(),sm:P().min(1).max(12).optional(),md:P().min(1).max(12).optional(),lg:P().min(1).max(12).optional(),xl:P().min(1).max(12).optional(),"2xl":P().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),_o=h({xs:P().optional(),sm:P().optional(),md:P().optional(),lg:P().optional(),xl:P().optional(),"2xl":P().optional()}).describe(`Display order per breakpoint`),vo=h({breakpoint:ho.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:C(ho).optional().describe(`Hide on these breakpoints`),columns:go.optional().describe(`Grid columns per breakpoint`),order:_o.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),yo=h({lazyLoad:S().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:h({enabled:S().default(!1).describe(`Enable virtual scrolling`),itemHeight:P().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:P().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:E([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:S().optional().describe(`Prefetch data before component is visible`),pageSize:P().optional().describe(`Number of items per page for pagination`),debounceMs:P().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),bo=I(`provider`,[h({provider:m(`object`),object:r().describe(`Target object name`)}),h({provider:m(`api`),read:Ji.optional().describe(`Configuration for fetching data`),write:Ji.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),h({provider:m(`value`),items:C(u()).describe(`Static data array`)})]),xo=h({field:r().describe(`Field name to filter on`),operator:r().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),So=E([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),Co=h({field:r().describe(`Field name (snake_case)`),label:co.optional().describe(`Display label override`),width:P().positive().optional().describe(`Column width in pixels`),align:E([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:S().optional().describe(`Hide column by default`),sortable:S().optional().describe(`Allow sorting by this column`),resizable:S().optional().describe(`Allow resizing this column`),wrap:S().optional().describe(`Allow text wrapping`),type:r().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:E([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:So.optional().describe(`Footer aggregation function for this column`),link:S().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:r().optional().describe(`Registered Action ID to execute when clicked`)}),wo=h({type:E([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),To=h({pageSize:P().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:C(P().int().positive()).optional().describe(`Available page size options`)}),Eo=E([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),Do=h({fields:C(h({field:r().describe(`Field name to group by`),order:E([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:S().default(!1).describe(`Collapse groups by default`)})).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),Oo=h({coverField:r().optional().describe(`Attachment/image field to display as card cover`),coverFit:E([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:E([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:r().optional().describe(`Field to display as card title`),visibleFields:C(r()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),ko=h({startDateField:r().describe(`Field for timeline item start date`),endDateField:r().optional().describe(`Field for timeline item end date`),titleField:r().describe(`Field to display as timeline item title`),groupByField:r().optional().describe(`Field to group timeline rows`),colorField:r().optional().describe(`Field to determine item color`),scale:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),Ao=h({type:E([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:r().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),jo=h({field:r().describe(`Field to derive color from (typically a select/status field)`),colors:d(r(),r()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),Mo=E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),No=h({sort:S().default(!0).describe(`Allow users to sort records`),search:S().default(!0).describe(`Allow users to search records`),filter:S().default(!0).describe(`Allow users to filter records`),rowHeight:S().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:S().default(!1).describe(`Add records through a form instead of inline`),buttons:C(r()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),Po=h({showDescription:S().default(!0).describe(`Show the view description text`),allowedVisualizations:C(Mo).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),Fo=h({name:pa.describe(`Tab identifier (snake_case)`),label:co.optional().describe(`Display label`),icon:r().optional().describe(`Tab icon name`),view:r().optional().describe(`Referenced list view name from listViews`),filter:C(xo).optional().describe(`Tab-specific filter criteria`),order:P().int().min(0).optional().describe(`Tab display order`),pinned:S().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:S().default(!1).describe(`Set as the default active tab`),visible:S().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),Io=h({enabled:S().default(!0).describe(`Show the add record entry point`),position:E([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:E([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:r().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),Lo=h({groupByField:r().describe(`Field to group columns by (usually status/select)`),summarizeField:r().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:C(r()).describe(`Fields to show on cards`)}),Ro=h({startDateField:r(),endDateField:r().optional(),titleField:r(),colorField:r().optional()}),zo=h({startDateField:r(),endDateField:r(),titleField:r(),progressField:r().optional(),dependenciesField:r().optional()}),Bo=h({mode:E([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]).default(`page`),view:r().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:S().default(!1).describe(`Disable standard navigation entirely`),openNewTab:S().default(!1).describe(`Force open in new tab (applies to page mode)`),width:l([r(),P()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),Vo=h({name:pa.optional().describe(`Internal view name (lowercase snake_case)`),label:co.optional(),type:E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:bo.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:l([C(r()),C(Co)]).describe(`Fields to display as columns`),filter:C(xo).optional().describe(`Filter criteria (JSON Rules)`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional(),searchableFields:C(r()).optional().describe(`Fields enabled for search`),filterableFields:C(r()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:C(h({field:r().describe(`Field name to filter by`),label:r().optional().describe(`Display label for the chip`),operator:E([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:S().optional().describe(`Enable column resizing`),striped:S().optional().describe(`Striped row styling`),bordered:S().optional().describe(`Show borders`),selection:wo.optional().describe(`Row selection configuration`),navigation:Bo.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:To.optional().describe(`Pagination configuration`),kanban:Lo.optional(),calendar:Ro.optional(),gantt:zo.optional(),gallery:Oo.optional(),timeline:ko.optional(),description:co.optional().describe(`View description for documentation/tooltips`),sharing:Ao.optional().describe(`View sharing and access configuration`),rowHeight:Eo.optional().describe(`Row height / density setting`),grouping:Do.optional().describe(`Group records by one or more fields`),rowColor:jo.optional().describe(`Color rows based on field value`),hiddenFields:C(r()).optional().describe(`Fields to hide in this specific view`),fieldOrder:C(r()).optional().describe(`Explicit field display order for this view`),rowActions:C(r()).optional().describe(`Actions available for individual row items`),bulkActions:C(r()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:S().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:C(h({condition:r().describe(`Condition expression to evaluate`),style:d(r(),r()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:S().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:C(E([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:No.optional().describe(`User action toggles for the view toolbar`),appearance:Po.optional().describe(`Appearance and visualization configuration`),tabs:C(Fo).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:Io.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at the bottom of the list`),allowPrinting:S().optional().describe(`Allow users to print the view`),emptyState:h({title:co.optional(),message:co.optional(),icon:r().optional()}).optional().describe(`Empty state configuration when no records found`),aria:lo.optional().describe(`ARIA accessibility attributes for the list view`),responsive:vo.optional().describe(`Responsive layout configuration`),performance:yo.optional().describe(`Performance optimization settings`)}),Ho=h({field:r().describe(`Field name (snake_case)`),label:co.optional().describe(`Display label override`),placeholder:co.optional().describe(`Placeholder text`),helpText:co.optional().describe(`Help/hint text`),readonly:S().optional().describe(`Read-only override`),required:S().optional().describe(`Required override`),hidden:S().optional().describe(`Hidden override`),colSpan:P().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:r().optional().describe(`Custom widget/component name`),dependsOn:r().optional().describe(`Parent field name for cascading`),visibleOn:r().optional().describe(`Visibility condition expression`)}),Uo=h({label:co.optional(),collapsible:S().default(!1),collapsed:S().default(!1),columns:E([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:C(l([r(),Ho]))}),Wo=h({type:E([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:bo.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:C(Uo).optional(),groups:C(Uo).optional(),defaultSort:C(h({field:r().describe(`Field name to sort by`),order:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:po.optional().describe(`Public sharing configuration for this form`),aria:lo.optional().describe(`ARIA accessibility attributes for the form view`)}),Go=h({list:Vo.optional(),form:Wo.optional(),listViews:d(r(),Vo).optional().describe(`Additional named list views`),formViews:d(r(),Wo).optional().describe(`Additional named form views`)}),Ko=E([`select`,`insert`,`update`,`delete`,`all`]),qo=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy unique identifier (snake_case)`),label:r().optional().describe(`Human-readable policy label`),description:r().optional().describe(`Policy description and business justification`),object:r().describe(`Target object name`),operation:Ko.describe(`Database operation this policy applies to`),using:r().optional().describe(`Filter condition for SELECT/UPDATE/DELETE (PostgreSQL SQL WHERE clause syntax with parameterized context variables). Optional for INSERT-only policies.`),check:r().optional().describe(`Validation condition for INSERT/UPDATE (defaults to USING clause if not specified - enforced at application level)`),roles:C(r()).optional().describe(`Roles this policy applies to (omit for all roles)`),enabled:S().default(!0).describe(`Whether this policy is active`),priority:P().int().default(0).describe(`Policy evaluation priority (higher = evaluated first)`),tags:C(r()).optional().describe(`Policy categorization tags`)}).superRefine((e,t)=>{!e.using&&!e.check&&t.addIssue({code:de.custom,message:`At least one of "using" or "check" must be specified. For SELECT/UPDATE/DELETE operations, provide "using". For INSERT operations, provide "check".`})});h({timestamp:r().describe(`ISO 8601 timestamp of the evaluation`),userId:r().describe(`User ID whose access was evaluated`),operation:E([`select`,`insert`,`update`,`delete`]).describe(`Database operation being performed`),object:r().describe(`Target object name`),policyName:r().describe(`Name of the RLS policy evaluated`),granted:S().describe(`Whether access was granted`),evaluationDurationMs:P().describe(`Policy evaluation duration in milliseconds`),matchedCondition:r().optional().describe(`Which USING/CHECK clause matched`),rowCount:P().optional().describe(`Number of rows affected`),metadata:d(r(),u()).optional().describe(`Additional audit event metadata`)});var Jo=h({enabled:S().describe(`Enable RLS audit logging`),logLevel:E([`all`,`denied_only`,`granted_only`,`none`]).describe(`Which evaluations to log`),destination:E([`system_log`,`audit_trail`,`external`]).describe(`Audit log destination`),sampleRate:P().min(0).max(1).describe(`Sampling rate (0-1) for high-traffic environments`),retentionDays:P().int().default(90).describe(`Audit log retention period in days`),includeRowData:S().default(!1).describe(`Include row data in audit logs (security-sensitive)`),alertOnDenied:S().default(!0).describe(`Send alerts when access is denied`)});h({enabled:S().default(!0).describe(`Enable RLS enforcement globally`),defaultPolicy:E([`deny`,`allow`]).default(`deny`).describe(`Default action when no policies match`),allowSuperuserBypass:S().default(!0).describe(`Allow superusers to bypass RLS`),bypassRoles:C(r()).optional().describe(`Roles that bypass RLS (see all data)`),logEvaluations:S().default(!1).describe(`Log RLS policy evaluations for debugging`),cacheResults:S().default(!0).describe(`Cache RLS evaluation results`),cacheTtlSeconds:P().int().positive().default(300).describe(`Cache TTL in seconds`),prefetchUserContext:S().default(!0).describe(`Pre-fetch user context for performance`),audit:Jo.optional().describe(`RLS audit logging configuration`)}),h({id:r().describe(`User ID`),email:r().email().optional().describe(`User email`),tenantId:r().optional().describe(`Tenant/Organization ID`),role:l([r(),C(r())]).optional().describe(`User role(s)`),department:r().optional().describe(`User department`),attributes:d(r(),u()).optional().describe(`Additional custom user attributes`)}),h({policyName:r().describe(`Policy name`),granted:S().describe(`Whether access was granted`),durationMs:P().optional().describe(`Evaluation duration in milliseconds`),error:r().optional().describe(`Error message if evaluation failed`),usingResult:S().optional().describe(`USING clause evaluation result`),checkResult:S().optional().describe(`CHECK clause evaluation result`)});var Yo=h({allowCreate:S().default(!1).describe(`Create permission`),allowRead:S().default(!1).describe(`Read permission`),allowEdit:S().default(!1).describe(`Edit permission`),allowDelete:S().default(!1).describe(`Delete permission`),allowTransfer:S().default(!1).describe(`Change record ownership`),allowRestore:S().default(!1).describe(`Restore from trash (Undelete)`),allowPurge:S().default(!1).describe(`Permanently delete (Hard Delete/GDPR)`),viewAllRecords:S().default(!1).describe(`View All Data (Bypass Sharing)`),modifyAllRecords:S().default(!1).describe(`Modify All Data (Bypass Sharing)`)}),Xo=h({readable:S().default(!0).describe(`Field read access`),editable:S().default(!1).describe(`Field edit access`)});h({name:pa.describe(`Permission set unique name (lowercase snake_case)`),label:r().optional().describe(`Display label`),isProfile:S().default(!1).describe(`Whether this is a user profile`),objects:d(r(),Yo).describe(`Entity permissions`),fields:d(r(),Xo).optional().describe(`Field level security`),systemPermissions:C(r()).optional().describe(`System level capabilities`),tabPermissions:d(r(),E([`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:C(qo).optional().describe(`Row-level security policies (see rls.zod.ts for full spec)`),contextVariables:d(r(),u()).optional().describe(`Context variables for RLS evaluation`)});var Zo=E([`on_create`,`on_update`,`on_create_or_update`,`on_delete`,`schedule`]),Qo=h({name:r().describe(`Action name`),type:m(`field_update`),field:r().describe(`Field to update`),value:u().describe(`Value or Formula to set`)}),$o=h({name:r().describe(`Action name`),type:m(`email_alert`),template:r().describe(`Email template ID/DevName`),recipients:C(r()).describe(`List of recipient emails or user IDs`)}),es=h({name:r().describe(`Action name`),type:m(`connector_action`),connectorId:r().describe(`Target Connector ID (e.g. slack, twilio)`),actionId:r().describe(`Target Action ID (e.g. send_message)`),input:d(r(),u()).describe(`Input parameters matching the action schema`)}),ts=I(`type`,[Qo,$o,h({name:r().describe(`Action name`),type:m(`http_call`),url:r().describe(`Target URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`]).default(`POST`).describe(`HTTP Method`),headers:d(r(),r()).optional().describe(`HTTP Headers`),body:r().optional().describe(`Request body (JSON or text)`)}),es,h({name:r().describe(`Action name`),type:m(`task_creation`),taskObject:r().describe(`Task object name (e.g., "task", "project_task")`),subject:r().describe(`Task subject/title`),description:r().optional().describe(`Task description`),assignedTo:r().optional().describe(`User ID or field reference for assignee`),dueDate:r().optional().describe(`Due date (ISO string or formula)`),priority:r().optional().describe(`Task priority`),relatedTo:r().optional().describe(`Related record ID or field reference`),additionalFields:d(r(),u()).optional().describe(`Additional custom fields`)}),h({name:r().describe(`Action name`),type:m(`push_notification`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),recipients:C(r()).describe(`User IDs or device tokens`),data:d(r(),u()).optional().describe(`Additional data payload`),badge:P().optional().describe(`Badge count (iOS)`),sound:r().optional().describe(`Notification sound`),clickAction:r().optional().describe(`Action/URL when notification is clicked`)}),h({name:r().describe(`Action name`),type:m(`custom_script`),language:E([`javascript`,`typescript`,`python`]).default(`javascript`).describe(`Script language`),code:r().describe(`Script code to execute`),timeout:P().default(3e4).describe(`Execution timeout in milliseconds`),context:d(r(),u()).optional().describe(`Additional context variables`)})]),ns=h({id:r().optional().describe(`Unique identifier`),timeLength:P().int().describe(`Duration amount (e.g. 1, 30)`),timeUnit:E([`minutes`,`hours`,`days`]).describe(`Unit of time`),offsetDirection:E([`before`,`after`]).describe(`Before or After the reference date`),offsetFrom:E([`trigger_date`,`date_field`]).describe(`Basis for calculation`),dateField:r().optional().describe(`Date field to calculate from (required if offsetFrom is date_field)`),actions:C(ts).describe(`Actions to execute at the scheduled time`)}),rs=h({name:pa.describe(`Unique workflow name (lowercase snake_case)`),objectName:r().describe(`Target Object`),triggerType:Zo.describe(`When to evaluate`),criteria:r().optional().describe(`Formula condition. If TRUE, actions execute.`),actions:C(ts).optional().describe(`Immediate actions`),timeTriggers:C(ns).optional().describe(`Scheduled actions relative to trigger or date field`),active:S().default(!0).describe(`Whether this workflow is active`),executionOrder:P().int().min(0).default(100).describe(`Deterministic execution order when multiple workflows match (lower runs first)`),reevaluateOnChange:S().default(!1).describe(`Re-evaluate rule if field updates change the record validity`)}),is=r().describe(`BCP-47 Language Tag (e.g. en-US, zh-CN)`),as=h({label:r().optional().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),placeholder:r().optional().describe(`Translated placeholder text for form inputs`),options:d(r(),r()).optional().describe(`Option value to translated label map`)}).describe(`Translation data for a single field`),os=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),fields:d(r(),as).optional().describe(`Field-level translations`)}).describe(`Translation data for a single object`),ss=h({objects:d(r(),os).optional().describe(`Object translations keyed by object name`),apps:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID`),validationMessages:d(r(),r()).optional().describe(`Translatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})`)}).describe(`Translation data for objects, apps, and UI messages`);d(is,ss).describe(`Map of locale codes to translation data`);var cs=E([`bundled`,`per_locale`,`per_namespace`]).describe(`Translation file organization strategy`),ls=E([`icu`,`simple`]).describe(`Message interpolation format: ICU MessageFormat or simple {variable} replacement`);h({defaultLocale:is.describe(`Default locale (e.g., "en")`),supportedLocales:C(is).describe(`Supported BCP-47 locale codes`),fallbackLocale:is.optional().describe(`Fallback locale code`),fileOrganization:cs.default(`per_locale`).describe(`File organization strategy`),messageFormat:ls.default(`simple`).describe(`Message interpolation format (ICU MessageFormat or simple)`),lazyLoad:S().default(!1).describe(`Load translations on demand`),cache:S().default(!0).describe(`Cache loaded translations`)}).describe(`Internationalization configuration`);var us=d(r(),r()).describe(`Option value to translated label map`),ds=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),description:r().optional().describe(`Translated object description`),helpText:r().optional().describe(`Translated help text for the object`),fields:d(r(),as).optional().describe(`Field translations keyed by field name`),_options:d(r(),us).optional().describe(`Object-scoped picklist option translations keyed by field name`),_views:d(r(),h({label:r().optional().describe(`Translated view label`),description:r().optional().describe(`Translated view description`)})).optional().describe(`View translations keyed by view name`),_sections:d(r(),h({label:r().optional().describe(`Translated section label`)})).optional().describe(`Section translations keyed by section name`),_actions:d(r(),h({label:r().optional().describe(`Translated action label`),confirmMessage:r().optional().describe(`Translated confirmation message`)})).optional().describe(`Action translations keyed by action name`),_notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Notification translations keyed by notification name`),_errors:d(r(),r()).optional().describe(`Error message translations keyed by error code`)}).describe(`Object-first aggregated translation node`);h({_meta:h({locale:r().optional().describe(`BCP-47 locale code for this bundle`),direction:E([`ltr`,`rtl`]).optional().describe(`Text direction: left-to-right or right-to-left`)}).optional().describe(`Bundle-level metadata (locale, bidi direction)`),namespace:r().optional().describe(`Namespace for plugin isolation to avoid translation key collisions`),o:d(r(),ds).optional().describe(`Object-first translations keyed by object name`),_globalOptions:d(r(),us).optional().describe(`Global picklist option translations keyed by option set name`),app:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),nav:d(r(),r()).optional().describe(`Navigation item translations keyed by nav item name`),dashboard:d(r(),h({label:r().optional().describe(`Translated dashboard label`),description:r().optional().describe(`Translated dashboard description`)})).optional().describe(`Dashboard translations keyed by dashboard name`),reports:d(r(),h({label:r().optional().describe(`Translated report label`),description:r().optional().describe(`Translated report description`)})).optional().describe(`Report translations keyed by report name`),pages:d(r(),h({title:r().optional().describe(`Translated page title`),description:r().optional().describe(`Translated page description`)})).optional().describe(`Page translations keyed by page name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID (supports ICU MessageFormat)`),validationMessages:d(r(),r()).optional().describe(`Validation error message translations keyed by rule name (supports ICU MessageFormat)`),notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Global notification translations keyed by notification name`),errors:d(r(),r()).optional().describe(`Global error message translations keyed by error code`)}).describe(`Object-first application translation bundle for a single locale`);var fs=E([`missing`,`redundant`,`stale`]).describe(`Translation diff status: missing from bundle, redundant (no matching metadata), or stale (metadata changed)`),ps=h({key:r().describe(`Dot-path translation key`),status:fs.describe(`Diff status of this translation key`),objectName:r().optional().describe(`Associated object name (snake_case)`),locale:r().describe(`BCP-47 locale code`),sourceHash:r().optional().describe(`Hash of source metadata for precise stale detection`),aiSuggested:r().optional().describe(`AI-suggested translation for this key`),aiConfidence:P().min(0).max(1).optional().describe(`AI suggestion confidence score (0–1)`)}).describe(`A single translation diff item`),mee=h({group:r().describe(`Translation group category`),totalKeys:P().int().nonnegative().describe(`Total keys in this group`),translatedKeys:P().int().nonnegative().describe(`Translated keys in this group`),coveragePercent:P().min(0).max(100).describe(`Coverage percentage for this group`)}).describe(`Coverage breakdown for a single translation group`);h({locale:r().describe(`BCP-47 locale code`),objectName:r().optional().describe(`Object name scope (omit for full bundle)`),totalKeys:P().int().nonnegative().describe(`Total translatable keys from metadata`),translatedKeys:P().int().nonnegative().describe(`Number of translated keys`),missingKeys:P().int().nonnegative().describe(`Number of missing translations`),redundantKeys:P().int().nonnegative().describe(`Number of redundant translations`),staleKeys:P().int().nonnegative().describe(`Number of stale translations`),coveragePercent:P().min(0).max(100).describe(`Translation coverage percentage`),items:C(ps).describe(`Detailed diff items`),breakdown:C(mee).optional().describe(`Per-group coverage breakdown`)}).describe(`Aggregated translation coverage result`);var ms=E([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),hs=h({major:P().int().min(0),minor:P().int().min(0),patch:P().int().min(0)}).describe(`Semantic version of the protocol`),gs=h({id:r().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:r(),version:hs,specification:r().optional().describe(`URL or path to protocol specification`),description:r().optional()}),_s=h({name:r().describe(`Feature identifier within the protocol`),enabled:S().default(!0),description:r().optional(),sinceVersion:r().optional().describe(`Version when this feature was added`),deprecatedSince:r().optional().describe(`Version when deprecated`)}),vs=h({protocol:gs,conformance:ms.default(`full`),implementedFeatures:C(r()).optional().describe(`List of implemented feature names`),features:C(_s).optional(),metadata:d(r(),u()).optional(),certified:S().default(!1).describe(`Has passed official conformance tests`),certificationDate:r().datetime().optional()}),ys=h({id:r().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:r(),description:r().optional(),version:hs,methods:C(h({name:r().describe(`Method name`),description:r().optional(),parameters:C(h({name:r(),type:r().describe(`Type notation (e.g., string, number, User)`),required:S().default(!0),description:r().optional()})).optional(),returnType:r().optional().describe(`Return value type`),async:S().default(!1).describe(`Whether method returns a Promise`)})),events:C(h({name:r().describe(`Event name`),description:r().optional(),payload:r().optional().describe(`Event payload type`)})).optional(),stability:E([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),hee=h({pluginId:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:r().describe(`Semantic version constraint`),optional:S().default(!1),reason:r().optional(),requiredCapabilities:C(r()).optional().describe(`Protocol IDs the dependency must support`)}),bs=h({id:r().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:r(),description:r().optional(),type:E([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:h({input:r().optional().describe(`Input type/schema`),output:r().optional().describe(`Output type/schema`),signature:r().optional().describe(`Function signature if applicable`)}).optional(),cardinality:E([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),xs=h({implements:C(vs).optional().describe(`List of protocols this plugin conforms to`),provides:C(ys).optional().describe(`Services/APIs this plugin offers to others`),requires:C(hee).optional().describe(`Required plugins and their capabilities`),extensionPoints:C(bs).optional().describe(`Points where other plugins can extend this plugin`),extensions:C(h({targetPluginId:r().describe(`Plugin ID being extended`),extensionPointId:r().describe(`Extension point identifier`),implementation:r().describe(`Path to implementation module`),priority:P().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),Ss=E([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),Cs=h({enabled:S().default(!1),priority:P().int().min(0).default(100),resources:C(E([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:h({routes:C(r()).optional(),roles:C(r()).optional(),deviceType:C(E([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:E([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),ws=h({enabled:S().default(!0),strategy:E([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:E([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:P().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:h({enabled:S().default(!0),minChunks:P().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),Ts=h({enabled:S().default(!0),mode:E([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:S().default(!1).describe(`Prefetch module in idle time`),preload:S().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:r().optional().describe(`Custom chunk name for webpack`),timeout:P().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:h({enabled:S().default(!0),maxAttempts:P().int().min(1).max(10).default(3),backoffMs:P().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),Es=h({mode:E([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:P().int().min(100).default(3e4),priority:P().int().min(0).default(100),critical:S().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:h({enabled:S().default(!1),maxAttempts:P().int().min(1).max(5).default(3),backoffMs:P().int().min(0).default(1e3)}).optional(),healthCheckInterval:P().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),Ds=h({strategy:E([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:h({resolve:S().default(!0),onMissing:E([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:E([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:h({load:S().default(!0),onFailure:E([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:E([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:E([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),Os=h({enabled:S().default(!1),environment:E([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:E([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:C(r()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:C(r()).optional().describe(`Glob patterns for files to ignore`),debounceMs:P().int().min(0).default(300),preserveState:S().default(!1),stateSerialization:h({enabled:S().default(!1),handler:r().optional()}).optional(),hooks:h({beforeReload:r().optional().describe(`Function to call before reload`),afterReload:r().optional().describe(`Function to call after reload`),onError:r().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:h({healthValidation:S().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:S().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:P().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:S().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:P().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:P().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:P().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),ks=h({enabled:S().default(!0),storage:E([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:E([`version`,`hash`,`timestamp`]).default(`version`),ttl:P().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:P().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:C(E([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:h({enabled:S().default(!1),algorithm:E([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),As=h({enabled:S().default(!1),scope:E([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:E([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:C(r()).optional().describe(`List of allowed capability IDs`),resourceQuotas:h({maxMemoryMB:P().int().min(1).optional(),maxCpuTimeMs:P().int().min(100).optional(),maxFileDescriptors:P().int().min(1).optional(),maxNetworkKBps:P().int().min(1).optional()}).optional(),permissions:h({allowedAPIs:C(r()).optional(),allowedPaths:C(r()).optional(),allowedEndpoints:C(r()).optional(),allowedEnvVars:C(r()).optional()}).optional(),ipc:h({enabled:S().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:E([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:P().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:P().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:C(r()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),js=h({enabled:S().default(!1),metrics:C(E([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:P().min(0).max(1).default(1),reportingInterval:P().int().min(1).default(60),budgets:h({maxLoadTimeMs:P().int().min(0).optional(),maxInitTimeMs:P().int().min(0).optional(),maxMemoryMB:P().int().min(0).optional()}).optional(),onBudgetViolation:E([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),Ms=h({strategy:Ss.default(`lazy`),preload:Cs.optional(),codeSplitting:ws.optional(),dynamicImport:Ts.optional(),initialization:Es.optional(),dependencyResolution:Ds.optional(),hotReload:Os.optional(),caching:ks.optional(),sandboxing:As.optional(),monitoring:js.optional()}).describe(`Complete plugin loading configuration`);h({type:E([`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:r(),timestamp:P().int().min(0),durationMs:P().int().min(0).optional(),metadata:d(r(),u()).optional(),error:h({message:r(),code:r().optional(),stack:r().optional()}).optional()}).describe(`Plugin loading lifecycle event`),h({pluginId:r(),state:E([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:P().min(0).max(100).default(0),startedAt:P().int().min(0).optional(),completedAt:P().int().min(0).optional(),lastError:r().optional(),retryCount:P().int().min(0).default(0)}).describe(`Plugin loading state`),h({ql:h({object:M().describe(`Get object handle for method chaining`),query:M().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:h({getCurrentUser:M().describe(`Get the current authenticated user`),getConfig:M().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:h({debug:M().describe(`Log debug message`),info:M().describe(`Log info message`),warn:M().describe(`Log warning message`),error:M().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:h({get:M().describe(`Get a value from storage`),set:M().describe(`Set a value in storage`),delete:M().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:h({t:M().describe(`Translate a key`),getLocale:M().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:d(r(),u()),events:d(r(),u()),app:h({router:h({get:M().describe(`Register GET route handler`),post:M().describe(`Register POST route handler`),use:M().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:h({register:M().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),h({previousVersion:r().describe(`Version before upgrade`),newVersion:r().describe(`Version after upgrade`),isMajorUpgrade:S().describe(`Whether this is a major version bump`),previousMetadata:d(r(),u()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`);var Ns=h({onInstall:M().optional().describe(`Called when plugin is installed`),onEnable:M().optional().describe(`Called when plugin is enabled`),onDisable:M().optional().describe(`Called when plugin is disabled`),onUninstall:M().optional().describe(`Called when plugin is uninstalled`),onUpgrade:M().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),Ps=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`];Ns.extend({id:r().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:E([`standard`,...Ps]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:r().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:r().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:S().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:r().optional(),author:r().optional(),homepage:r().url().optional()});var Fs=E([`insert`,`update`,`upsert`,`replace`,`ignore`]),Is=h({object:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:r().default(`name`).describe(`Field match for uniqueness check`),mode:Fs.default(`upsert`).describe(`Conflict resolution strategy`),env:C(E([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:C(d(r(),u())).describe(`Data records`)}),Ls=h({id:r().describe(`Unique package identifier (reverse domain style)`),namespace:r().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")`),defaultDatasource:r().optional().default(`default`).describe(`Default datasource for all objects in this package`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:E([`plugin`,...Ps,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:r().describe(`Human-readable package name`),description:r().optional().describe(`Package description`),permissions:C(r()).optional().describe(`Array of required permission strings`),objects:C(r()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:C(r()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:d(r(),r()).optional().describe(`Package dependencies`),configuration:h({title:r().optional(),properties:d(r(),h({type:E([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:u().optional().describe(`Default value`),description:r().optional().describe(`Tooltip description`),required:S().optional().describe(`Is this setting required?`),secret:S().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:C(r()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:h({kinds:C(h({id:r().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:C(r()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:r().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:C(r()).optional().describe(`Events this plugin listens to`),menus:d(r(),C(h({id:r(),label:r(),command:r().optional()}))).optional().describe(`UI Menu contributions`),themes:C(h({id:r(),label:r(),path:r()})).optional().describe(`Theme contributions`),translations:C(h({locale:r(),path:r()})).optional().describe(`Translation resources`),actions:C(h({name:r().describe(`Unique action name`),label:r().optional(),description:r().optional(),input:u().optional().describe(`Input validation schema`),output:u().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:C(h({id:r().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:r().describe(`Human readable name`),description:r().optional()})).optional().describe(`Driver contributions`),fieldTypes:C(h({name:r().describe(`Unique field type name (e.g. "vector")`),label:r().describe(`Display label`),description:r().optional()})).optional().describe(`Field Type contributions`),functions:C(h({name:r().describe(`Function name (e.g. "distance")`),description:r().optional(),args:C(r()).optional().describe(`Argument types`),returnType:r().optional()})).optional().describe(`Query Function contributions`),routes:C(h({prefix:r().regex(/^\//).describe(`API path prefix`),service:r().describe(`Service name this plugin provides`),methods:C(r()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:C(h({name:r().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:r().optional().describe(`Command description for help text`),module:r().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:C(Is).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:xs.optional().describe(`Plugin capability declarations for interoperability`),extensions:d(r(),u()).optional().describe(`Extension points and contributions`),loading:Ms.optional().describe(`Plugin loading and runtime behavior configuration`),engine:h({objectstack:r().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)}),Rs=E([`satisfied`,`needs_install`,`needs_upgrade`,`conflict`]).describe(`Resolution status for a dependency`),zs=h({packageId:r().describe(`Dependency package identifier`),requiredRange:r().describe(`SemVer range required (e.g. "^2.0.0")`),resolvedVersion:r().optional().describe(`Actual version resolved from registry`),installedVersion:r().optional().describe(`Currently installed version`),status:Rs.describe(`Resolution status`),conflictReason:r().optional().describe(`Explanation of the conflict`)}).describe(`Resolution result for a single dependency`),Bs=h({type:E([`install`,`upgrade`,`confirm_conflict`]).describe(`Type of action required`),packageId:r().describe(`Target package identifier`),description:r().describe(`Human-readable action description`)}).describe(`Action required before installation can proceed`),Vs=h({dependencies:C(zs).describe(`Resolution result for each dependency`),canProceed:S().describe(`Whether installation can proceed`),requiredActions:C(Bs).describe(`Actions required before proceeding`),installOrder:C(r()).describe(`Topologically sorted package IDs for installation`),circularDependencies:C(C(r())).optional().describe(`Circular dependency chains detected (e.g. [["A", "B", "A"]])`)}).describe(`Complete dependency resolution result`),Hs=E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),Us=h({manifest:Ls.describe(`Full package manifest`),status:Hs.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:S().default(!0).describe(`Whether the package is currently enabled`),installedAt:r().datetime().optional().describe(`Installation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),installedVersion:r().optional().describe(`Currently installed version for quick access`),previousVersion:r().optional().describe(`Version before the last upgrade`),statusChangedAt:r().datetime().optional().describe(`Status change timestamp`),errorMessage:r().optional().describe(`Error message when status is error`),settings:d(r(),u()).optional().describe(`User-provided configuration settings`),upgradeHistory:C(h({fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Version after upgrade`),upgradedAt:r().datetime().describe(`Upgrade timestamp`),status:E([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:C(r()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:C(r()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`);h({namespace:r().describe(`Namespace prefix`),packageId:r().describe(`Owning package ID`),registeredAt:r().datetime().describe(`Registration timestamp`),status:E([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package display name`),suggestion:r().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),h({status:Hs.optional().describe(`Filter by package status`),type:Ls.shape.type.optional().describe(`Filter by package type`),enabled:S().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),h({packages:C(Us).describe(`List of installed packages`),total:P().describe(`Total package count`)}).describe(`List packages response`),h({id:r().describe(`Package identifier`)}).describe(`Get package request`),h({package:Us.describe(`Package details`)}).describe(`Get package response`),h({manifest:Ls.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),h({package:Us.describe(`Installed package details`),message:r().optional().describe(`Installation status message`),dependencyResolution:Vs.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),h({id:r().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),h({id:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),h({id:r().describe(`Package ID to enable`)}).describe(`Enable package request`),h({package:Us.describe(`Enabled package details`),message:r().optional().describe(`Enable status message`)}).describe(`Enable package response`),h({id:r().describe(`Package ID to disable`)}).describe(`Disable package request`),h({package:Us.describe(`Disabled package details`),message:r().optional().describe(`Disable status message`)}).describe(`Disable package response`),h({trigger:r(),payload:d(r(),u())}),h({success:S(),jobId:r().optional(),result:u().optional()}),h({}),fee.partial().required({version:!0}).extend({apiName:r().optional().describe(`API name (deprecated — use name)`)}),h({}),h({types:C(r()).describe(`Available metadata type names (e.g., "object", "plugin", "view")`)}),h({type:r().describe(`Metadata type name (e.g., "object", "plugin")`),packageId:r().optional().describe(`Optional package ID to filter items by`)}),h({type:r().describe(`Metadata type name`),items:C(u()).describe(`Array of metadata items`)}),h({type:r().describe(`Metadata type name`),name:r().describe(`Item name (snake_case identifier)`),packageId:r().optional().describe(`Optional package ID to filter items by`)}),h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),item:u().describe(`Metadata item definition`)}),h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),item:u().describe(`Metadata item definition`)}),h({success:S(),message:r().optional()}),h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),cacheRequest:no.optional().describe(`Cache validation parameters`)}),h({object:r().describe(`Object name (snake_case)`),type:E([`list`,`form`]).describe(`View type`)}),h({object:r().describe(`The unique machine name of the object to query (e.g. "account").`),query:Bi.optional().describe(`Structured query definition (filter, sort, select, pagination).`)}),h({object:r().describe(`The object name for the returned records.`),records:C(d(r(),u())).describe(`The list of matching records.`),total:P().optional().describe(`Total number of records matching the filter (if requested).`),nextCursor:r().optional().describe(`Cursor for the next page of results (cursor-based pagination).`),hasMore:S().optional().describe(`True if there are more records available (pagination).`)}),h({filter:r().optional().describe(`JSON-encoded filter expression (canonical, singular).`),filters:r().optional().describe(`JSON-encoded filter expression (deprecated plural alias).`),select:r().optional().describe(`Comma-separated list of fields to retrieve.`),sort:r().optional().describe(`Sort expression (e.g. "name asc,created_at desc" or "-created_at").`),orderBy:r().optional().describe(`Alias for sort (OData compatibility).`),top:pe().optional().describe(`Max records to return (limit).`),skip:pe().optional().describe(`Records to skip (offset).`),expand:r().optional().describe(`Comma-separated list of lookup/master_detail field names to expand. Resolved to populate array and passed to the engine for batch $in expansion.`),search:r().optional().describe(`Full-text search query.`),distinct:me().optional().describe(`SELECT DISTINCT flag.`),count:me().optional().describe(`Include total count in response.`)}),h({object:r().describe(`The object name.`),id:r().describe(`The unique record identifier (primary key).`),select:C(r()).optional().describe(`Fields to include in the response (allowlisted query param).`),expand:C(r()).optional().describe(`Lookup/master_detail field names to expand. The engine resolves these via batch $in queries, replacing foreign key IDs with full objects.`)}),h({object:r().describe(`The object name.`),id:r().describe(`The record ID.`),record:d(r(),u()).describe(`The complete record data.`)}),h({object:r().describe(`The object name.`),data:d(r(),u()).describe(`The dictionary of field values to insert.`)}),h({object:r().describe(`The object name.`),id:r().describe(`The ID of the newly created record.`),record:d(r(),u()).describe(`The created record, including server-generated fields (created_at, owner).`)}),h({object:r().describe(`The object name.`),id:r().describe(`The ID of the record to update.`),data:d(r(),u()).describe(`The fields to update (partial update).`)}),h({object:r().describe(`Object name`),id:r().describe(`Updated record ID`),record:d(r(),u()).describe(`Updated record`)}),h({object:r().describe(`Object name`),id:r().describe(`Record ID to delete`)}),h({object:r().describe(`Object name`),id:r().describe(`Deleted record ID`),success:S().describe(`Whether deletion succeeded`)}),h({object:r().describe(`Object name`),request:Qa.describe(`Batch operation request`)}),h({object:r().describe(`Object name`),records:C(d(r(),u())).describe(`Array of records to create`)}),h({object:r().describe(`Object name`),records:C(d(r(),u())).describe(`Created records`),count:P().describe(`Number of records created`)}),h({object:r().describe(`Object name`),records:C(h({id:r().describe(`Record ID`),data:d(r(),u()).describe(`Fields to update`)})).describe(`Array of updates`),options:Za.optional().describe(`Update options`)}),h({object:r().describe(`Object name`),ids:C(r()).describe(`Array of record IDs to delete`),options:Za.optional().describe(`Delete options`)}),h({object:r().describe(`Object name (snake_case)`),type:E([`list`,`form`]).optional().describe(`Filter by view type`)}),h({object:r().describe(`Object name`),views:C(Go).describe(`Array of view definitions`)}),h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier`)}),h({object:r().describe(`Object name`),view:Go.describe(`View definition`)}),h({object:r().describe(`Object name (snake_case)`),data:Go.describe(`View definition to create`)}),h({object:r().describe(`Object name`),viewId:r().describe(`Created view identifier`),view:Go.describe(`Created view definition`)}),h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier`),data:Go.partial().describe(`Partial view data to update`)}),h({object:r().describe(`Object name`),viewId:r().describe(`Updated view identifier`),view:Go.describe(`Updated view definition`)}),h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier to delete`)}),h({object:r().describe(`Object name`),viewId:r().describe(`Deleted view identifier`),success:S().describe(`Whether deletion succeeded`)}),h({object:r().describe(`Object name to check permissions for`),action:E([`create`,`read`,`edit`,`delete`,`transfer`,`restore`,`purge`]).describe(`Action to check`),recordId:r().optional().describe(`Specific record ID (for record-level checks)`),field:r().optional().describe(`Specific field name (for field-level checks)`)}),h({allowed:S().describe(`Whether the action is permitted`),reason:r().optional().describe(`Reason if denied`)}),h({object:r().describe(`Object name to get permissions for`)}),h({object:r().describe(`Object name`),permissions:Yo.describe(`Object-level permissions`),fieldPermissions:d(r(),Xo).optional().describe(`Field-level permissions keyed by field name`)}),h({}),h({objects:d(r(),Yo).describe(`Effective object permissions keyed by object name`),systemPermissions:C(r()).describe(`Effective system-level permissions`)}),h({object:r().describe(`Object name to get workflow config for`)}),h({object:r().describe(`Object name`),workflows:C(rs).describe(`Active workflow rules for this object`)});var Ws=h({currentState:r().describe(`Current workflow state name`),availableTransitions:C(h({name:r().describe(`Transition name`),targetState:r().describe(`Target state after transition`),label:r().optional().describe(`Display label`),requiresApproval:S().default(!1).describe(`Whether transition requires approval`)})).describe(`Available transitions from current state`),history:C(h({fromState:r().describe(`Previous state`),toState:r().describe(`New state`),action:r().describe(`Action that triggered the transition`),userId:r().describe(`User who performed the action`),timestamp:r().datetime().describe(`When the transition occurred`),comment:r().optional().describe(`Optional comment`)})).optional().describe(`State transition history`)});h({object:r().describe(`Object name`),recordId:r().describe(`Record ID to get workflow state for`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),state:Ws.describe(`Current workflow state and available transitions`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),transition:r().describe(`Transition name to execute`),comment:r().optional().describe(`Optional comment for the transition`),data:d(r(),u()).optional().describe(`Additional data for the transition`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the transition succeeded`),state:Ws.describe(`New workflow state after transition`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),comment:r().optional().describe(`Approval comment`),data:d(r(),u()).optional().describe(`Additional data`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the approval succeeded`),state:Ws.describe(`New workflow state after approval`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),reason:r().describe(`Rejection reason`),comment:r().optional().describe(`Additional comment`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the rejection succeeded`),state:Ws.describe(`New workflow state after rejection`)}),h({transport:ca.optional().describe(`Preferred transport protocol`),channels:C(r()).optional().describe(`Channels to subscribe to on connect`),token:r().optional().describe(`Authentication token`)}),h({connectionId:r().describe(`Unique connection identifier`),transport:ca.describe(`Negotiated transport protocol`),url:r().optional().describe(`WebSocket/SSE endpoint URL`)}),h({connectionId:r().optional().describe(`Connection ID to disconnect`)}),h({success:S().describe(`Whether disconnection succeeded`)}),h({channel:r().describe(`Channel name to subscribe to`),events:C(r()).optional().describe(`Specific event types to listen for`),filter:d(r(),u()).optional().describe(`Event filter criteria`)}),h({subscriptionId:r().describe(`Unique subscription identifier`),channel:r().describe(`Subscribed channel name`)}),h({subscriptionId:r().describe(`Subscription ID to cancel`)}),h({success:S().describe(`Whether unsubscription succeeded`)}),h({channel:r().describe(`Channel to set presence in`),state:da.describe(`Presence state to set`)}),h({success:S().describe(`Whether presence was set`)}),h({channel:r().describe(`Channel to get presence for`)}),h({channel:r().describe(`Channel name`),members:C(da).describe(`Active members and their presence state`)}),h({token:r().describe(`Device push notification token`),platform:E([`ios`,`android`,`web`]).describe(`Device platform`),deviceId:r().optional().describe(`Unique device identifier`),name:r().optional().describe(`Device friendly name`)}),h({deviceId:r().describe(`Registered device ID`),success:S().describe(`Whether registration succeeded`)}),h({deviceId:r().describe(`Device ID to unregister`)}),h({success:S().describe(`Whether unregistration succeeded`)});var Gs=h({email:S().default(!0).describe(`Receive email notifications`),push:S().default(!0).describe(`Receive push notifications`),inApp:S().default(!0).describe(`Receive in-app notifications`),digest:E([`none`,`daily`,`weekly`]).default(`none`).describe(`Email digest frequency`),channels:d(r(),h({enabled:S().default(!0).describe(`Whether this channel is enabled`),email:S().optional().describe(`Override email setting`),push:S().optional().describe(`Override push setting`)})).optional().describe(`Per-channel notification preferences`)});h({}),h({preferences:Gs.describe(`Current notification preferences`)}),h({preferences:Gs.partial().describe(`Preferences to update`)}),h({preferences:Gs.describe(`Updated notification preferences`)});var Ks=h({id:r().describe(`Notification ID`),type:r().describe(`Notification type`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),read:S().default(!1).describe(`Whether notification has been read`),data:d(r(),u()).optional().describe(`Additional notification data`),actionUrl:r().optional().describe(`URL to navigate to when clicked`),createdAt:r().datetime().describe(`When notification was created`)});h({read:S().optional().describe(`Filter by read status`),type:r().optional().describe(`Filter by notification type`),limit:P().default(20).describe(`Maximum number of notifications to return`),cursor:r().optional().describe(`Pagination cursor`)}),h({notifications:C(Ks).describe(`List of notifications`),unreadCount:P().describe(`Total number of unread notifications`),cursor:r().optional().describe(`Next page cursor`)}),h({ids:C(r()).describe(`Notification IDs to mark as read`)}),h({success:S().describe(`Whether the operation succeeded`),readCount:P().describe(`Number of notifications marked as read`)}),h({}),h({success:S().describe(`Whether the operation succeeded`),readCount:P().describe(`Number of notifications marked as read`)}),h({query:r().describe(`Natural language query string`),object:r().optional().describe(`Target object context`),conversationId:r().optional().describe(`Conversation ID for multi-turn queries`)}),h({query:u().describe(`Generated structured query (AST)`),explanation:r().optional().describe(`Human-readable explanation of the query`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),suggestions:C(r()).optional().describe(`Suggested follow-up queries`)}),h({object:r().describe(`Object name for context`),field:r().optional().describe(`Field to suggest values for`),recordId:r().optional().describe(`Record ID for context`),partial:r().optional().describe(`Partial input for completion`)}),h({suggestions:C(h({value:u().describe(`Suggested value`),label:r().describe(`Display label`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),reason:r().optional().describe(`Reason for this suggestion`)})).describe(`Suggested values`)}),h({object:r().describe(`Object name to analyze`),recordId:r().optional().describe(`Specific record to analyze`),type:E([`summary`,`trends`,`anomalies`,`recommendations`]).optional().describe(`Type of insight`)}),h({insights:C(h({type:r().describe(`Insight type`),title:r().describe(`Insight title`),description:r().describe(`Detailed description`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),data:d(r(),u()).optional().describe(`Supporting data`)})).describe(`Generated insights`)}),h({}),h({locales:C(h({code:r().describe(`BCP-47 locale code (e.g., en-US, zh-CN)`),label:r().describe(`Display name of the locale`),isDefault:S().default(!1).describe(`Whether this is the default locale`)})).describe(`Available locales`)}),h({locale:r().describe(`BCP-47 locale code`),namespace:r().optional().describe(`Translation namespace (e.g., objects, apps, messages)`),keys:C(r()).optional().describe(`Specific translation keys to fetch`)}),h({locale:r().describe(`Locale code`),translations:ss.describe(`Translation data`)}),h({object:r().describe(`Object name`),locale:r().describe(`BCP-47 locale code`)}),h({object:r().describe(`Object name`),locale:r().describe(`Locale code`),labels:d(r(),h({label:r().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),options:d(r(),r()).optional().describe(`Translated option labels`)})).describe(`Field labels keyed by field name`)}),h({getDiscovery:M().describe(`Get API discovery information`),getMetaTypes:M().describe(`Get available metadata types`),getMetaItems:M().describe(`Get all items of a metadata type`),getMetaItem:M().describe(`Get a specific metadata item`),saveMetaItem:M().describe(`Save metadata item`),getMetaItemCached:M().describe(`Get a metadata item with cache validation`),getUiView:M().describe(`Get UI view definition`),analyticsQuery:M().describe(`Execute analytics query`),getAnalyticsMeta:M().describe(`Get analytics metadata (cubes)`),triggerAutomation:M().describe(`Trigger an automation flow or script`),listPackages:M().describe(`List installed packages with optional filters`),getPackage:M().describe(`Get a specific installed package by ID`),installPackage:M().describe(`Install a new package from manifest`),uninstallPackage:M().describe(`Uninstall a package by ID`),enablePackage:M().describe(`Enable a disabled package`),disablePackage:M().describe(`Disable an installed package`),findData:M().describe(`Find data records`),getData:M().describe(`Get single data record`),createData:M().describe(`Create a data record`),updateData:M().describe(`Update a data record`),deleteData:M().describe(`Delete a data record`),batchData:M().describe(`Perform batch operations`),createManyData:M().describe(`Create multiple records`),updateManyData:M().describe(`Update multiple records`),deleteManyData:M().describe(`Delete multiple records`),listViews:M().describe(`List views for an object`),getView:M().describe(`Get a specific view`),createView:M().describe(`Create a new view`),updateView:M().describe(`Update an existing view`),deleteView:M().describe(`Delete a view`),checkPermission:M().describe(`Check if an action is permitted`),getObjectPermissions:M().describe(`Get permissions for an object`),getEffectivePermissions:M().describe(`Get effective permissions for current user`),getWorkflowConfig:M().describe(`Get workflow configuration for an object`),getWorkflowState:M().describe(`Get workflow state for a record`),workflowTransition:M().describe(`Execute a workflow state transition`),workflowApprove:M().describe(`Approve a workflow step`),workflowReject:M().describe(`Reject a workflow step`),realtimeConnect:M().describe(`Establish realtime connection`),realtimeDisconnect:M().describe(`Close realtime connection`),realtimeSubscribe:M().describe(`Subscribe to a realtime channel`),realtimeUnsubscribe:M().describe(`Unsubscribe from a realtime channel`),setPresence:M().describe(`Set user presence state`),getPresence:M().describe(`Get channel presence information`),registerDevice:M().describe(`Register a device for push notifications`),unregisterDevice:M().describe(`Unregister a device`),getNotificationPreferences:M().describe(`Get notification preferences`),updateNotificationPreferences:M().describe(`Update notification preferences`),listNotifications:M().describe(`List notifications`),markNotificationsRead:M().describe(`Mark specific notifications as read`),markAllNotificationsRead:M().describe(`Mark all notifications as read`),aiNlq:M().describe(`Natural language query`),aiChat:M().describe(`AI chat interaction`),aiSuggest:M().describe(`Get AI-powered suggestions`),aiInsights:M().describe(`Get AI-generated insights`),getLocales:M().describe(`Get available locales`),getTranslations:M().describe(`Get translations for a locale`),getFieldLabels:M().describe(`Get translated field labels for an object`),listFeed:M().describe(`List feed items for a record`),createFeedItem:M().describe(`Create a new feed item`),updateFeedItem:M().describe(`Update an existing feed item`),deleteFeedItem:M().describe(`Delete a feed item`),addReaction:M().describe(`Add an emoji reaction to a feed item`),removeReaction:M().describe(`Remove an emoji reaction from a feed item`),pinFeedItem:M().describe(`Pin a feed item`),unpinFeedItem:M().describe(`Unpin a feed item`),starFeedItem:M().describe(`Star a feed item`),unstarFeedItem:M().describe(`Unstar a feed item`),searchFeed:M().describe(`Search feed items`),getChangelog:M().describe(`Get field-level changelog for a record`),feedSubscribe:M().describe(`Subscribe to record notifications`),feedUnsubscribe:M().describe(`Unsubscribe from record notifications`)});var qs=h({version:r().regex(/^[a-zA-Z0-9_\-\.]+$/).default(`v1`).describe(`API version (e.g., v1, v2, 2024-01)`),basePath:r().default(`/api`).describe(`Base URL path for API`),apiPath:r().optional().describe(`Full API path (defaults to {basePath}/{version})`),enableCrud:S().default(!0).describe(`Enable automatic CRUD endpoint generation`),enableMetadata:S().default(!0).describe(`Enable metadata API endpoints`),enableUi:S().default(!0).describe(`Enable UI API endpoints (Views, Menus, Layouts)`),enableBatch:S().default(!0).describe(`Enable batch operation endpoints`),enableDiscovery:S().default(!0).describe(`Enable API discovery endpoint`),documentation:h({enabled:S().default(!0).describe(`Enable API documentation`),title:r().default(`ObjectStack API`).describe(`API documentation title`),description:r().optional().describe(`API description`),version:r().optional().describe(`Documentation version`),termsOfService:r().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().optional(),email:r().optional()}).optional(),license:h({name:r(),url:r().optional()}).optional()}).optional().describe(`OpenAPI/Swagger documentation config`),responseFormat:h({envelope:S().default(!0).describe(`Wrap responses in standard envelope`),includeMetadata:S().default(!0).describe(`Include response metadata (timestamp, requestId)`),includePagination:S().default(!0).describe(`Include pagination info in list responses`)}).optional().describe(`Response format options`)}),Js=E([`create`,`read`,`update`,`delete`,`list`]),Ys=h({method:Ki.describe(`HTTP method`),path:r().describe(`URL path pattern`),summary:r().optional().describe(`Operation summary`),description:r().optional().describe(`Operation description`)}),Xs=h({operations:h({create:S().default(!0).describe(`Enable create operation`),read:S().default(!0).describe(`Enable read operation`),update:S().default(!0).describe(`Enable update operation`),delete:S().default(!0).describe(`Enable delete operation`),list:S().default(!0).describe(`Enable list operation`)}).optional().describe(`Enable/disable operations`),patterns:d(Js,Ys.optional()).optional().describe(`Custom URL patterns for operations`),dataPrefix:r().default(`/data`).describe(`URL prefix for data endpoints`),objectParamStyle:E([`path`,`query`]).default(`path`).describe(`How object name is passed (path param or query param)`)}),Zs=h({prefix:r().default(`/meta`).describe(`URL prefix for metadata endpoints`),enableCache:S().default(!0).describe(`Enable HTTP cache headers (ETag, Last-Modified)`),cacheTtl:P().int().default(3600).describe(`Cache TTL in seconds`),endpoints:h({types:S().default(!0).describe(`GET /meta - List all metadata types`),items:S().default(!0).describe(`GET /meta/:type - List items of type`),item:S().default(!0).describe(`GET /meta/:type/:name - Get specific item`),schema:S().default(!0).describe(`GET /meta/:type/:name/schema - Get JSON schema`)}).optional().describe(`Enable/disable specific endpoints`)}),Qs=h({maxBatchSize:P().int().min(1).max(1e3).default(200).describe(`Maximum records per batch operation`),enableBatchEndpoint:S().default(!0).describe(`Enable POST /data/:object/batch endpoint`),operations:h({createMany:S().default(!0).describe(`Enable POST /data/:object/createMany`),updateMany:S().default(!0).describe(`Enable POST /data/:object/updateMany`),deleteMany:S().default(!0).describe(`Enable POST /data/:object/deleteMany`),upsertMany:S().default(!0).describe(`Enable POST /data/:object/upsertMany`)}).optional().describe(`Enable/disable specific batch operations`),defaultAtomic:S().default(!0).describe(`Default atomic/transaction mode for batch operations`)}),$s=h({includeObjects:C(r()).optional().describe(`Specific objects to generate routes for (empty = all)`),excludeObjects:C(r()).optional().describe(`Objects to exclude from route generation`),nameTransform:E([`none`,`plural`,`kebab-case`,`camelCase`]).default(`none`).describe(`Transform object names in URLs`),overrides:d(r(),h({enabled:S().optional().describe(`Enable/disable routes for this object`),basePath:r().optional().describe(`Custom base path`),operations:d(Js,S()).optional().describe(`Enable/disable specific operations`)})).optional().describe(`Per-object route customization`)}),ec=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Webhook event identifier (snake_case)`),description:r().describe(`Human-readable event description`),method:Ki.default(`POST`).describe(`HTTP method for webhook delivery`),payloadSchema:r().describe(`JSON Schema $ref for the webhook payload`),headers:d(r(),r()).optional().describe(`Custom headers to include in webhook delivery`),security:C(E([`hmac_sha256`,`basic`,`bearer`,`api_key`])).describe(`Supported authentication methods for webhook verification`)});h({enabled:S().default(!1).describe(`Enable webhook support`),events:C(ec).describe(`Registered webhook events`),deliveryConfig:h({maxRetries:P().int().default(3).describe(`Maximum delivery retry attempts`),retryIntervalMs:P().int().default(5e3).describe(`Milliseconds between retry attempts`),timeoutMs:P().int().default(3e4).describe(`Delivery request timeout in milliseconds`),signatureHeader:r().default(`X-Signature-256`).describe(`Header name for webhook signature`)}).describe(`Webhook delivery configuration`),registrationEndpoint:r().default(`/webhooks`).describe(`URL path for webhook registration`)});var tc=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Callback identifier (snake_case)`),expression:r().describe(`Runtime expression (e.g., {$request.body#/callbackUrl})`),method:Ki.describe(`HTTP method for callback request`),url:r().describe(`Callback URL template with runtime expressions`)}),gee=h({webhooks:d(r(),ec).optional().describe(`OpenAPI 3.1 webhooks (top-level webhook definitions)`),callbacks:d(r(),C(tc)).optional().describe(`OpenAPI 3.1 callbacks (async response definitions)`),jsonSchemaDialect:r().default(`https://json-schema.org/draft/2020-12/schema`).describe(`JSON Schema dialect for schema definitions`),pathItemReferences:S().default(!1).describe(`Allow $ref in path items (OpenAPI 3.1 feature)`)}),nc=h({api:qs.optional().describe(`REST API configuration`),crud:Xs.optional().describe(`CRUD endpoints configuration`),metadata:Zs.optional().describe(`Metadata endpoints configuration`),batch:Qs.optional().describe(`Batch endpoints configuration`),routes:$s.optional().describe(`Route generation configuration`),openApi31:gee.optional().describe(`OpenAPI 3.1 extensions configuration`)}),rc=h({id:r().describe(`Unique endpoint identifier`),method:Ki.describe(`HTTP method`),path:r().describe(`Full URL path`),object:r().describe(`Object name (snake_case)`),operation:l([Js,r()]).describe(`Operation type`),handler:r().describe(`Handler function identifier`),metadata:h({summary:r().optional(),description:r().optional(),tags:C(r()).optional(),deprecated:S().optional()}).optional()});h({endpoints:C(rc).describe(`All generated endpoints`),total:P().int().describe(`Total number of endpoints`),byObject:d(r(),C(rc)).optional().describe(`Endpoints grouped by object`),byOperation:d(r(),C(rc)).optional().describe(`Endpoints grouped by operation`)}),Object.assign(qs,{create:e=>e}),Object.assign(nc,{create:e=>e});var ic=E([`rest`,`graphql`,`odata`,`websocket`,`file`,`auth`,`metadata`,`plugin`,`webhook`,`rpc`]),ac=l([P().int().min(100).max(599),E([`2xx`,`3xx`,`4xx`,`5xx`])]),oc=h({objectId:pa.describe(`Object name to reference`),includeFields:C(r()).optional().describe(`Include only these fields in the schema`),excludeFields:C(r()).optional().describe(`Exclude these fields from the schema`),includeRelated:C(r()).optional().describe(`Include related objects via lookup fields`)});l([u().describe(`Static JSON Schema definition`),h({$ref:oc.describe(`Dynamic reference to ObjectQL object`)}).describe(`Dynamic ObjectQL reference`)]);var sc=h({name:r().describe(`Parameter name`),in:E([`path`,`query`,`header`,`body`,`cookie`]).describe(`Parameter location`),description:r().optional().describe(`Parameter description`),required:S().default(!1).describe(`Whether parameter is required`),schema:l([h({type:E([`string`,`number`,`integer`,`boolean`,`array`,`object`]).describe(`Parameter type`),format:r().optional().describe(`Format (e.g., date-time, email, uuid)`),enum:C(u()).optional().describe(`Allowed values`),default:u().optional().describe(`Default value`),items:u().optional().describe(`Array item schema`),properties:d(r(),u()).optional().describe(`Object properties`)}).describe(`Static JSON Schema`),h({$ref:oc}).describe(`Dynamic ObjectQL reference`)]).describe(`Parameter schema definition`),example:u().optional().describe(`Example value`)}),cc=h({statusCode:ac.describe(`HTTP status code`),description:r().describe(`Response description`),contentType:r().default(`application/json`).describe(`Response content type`),schema:l([u().describe(`Static JSON Schema`),h({$ref:oc}).describe(`Dynamic ObjectQL reference`)]).optional().describe(`Response body schema`),headers:d(r(),h({description:r().optional(),schema:u()})).optional().describe(`Response headers`),example:u().optional().describe(`Example response`)}),lc=h({id:r().describe(`Unique endpoint identifier`),method:Ki.optional().describe(`HTTP method`),path:r().describe(`URL path pattern`),summary:r().optional().describe(`Short endpoint summary`),description:r().optional().describe(`Detailed endpoint description`),operationId:r().optional().describe(`Unique operation identifier`),tags:C(r()).optional().default([]).describe(`Tags for categorization`),parameters:C(sc).optional().default([]).describe(`Endpoint parameters`),requestBody:h({description:r().optional(),required:S().default(!1),contentType:r().default(`application/json`),schema:u().optional(),example:u().optional()}).optional().describe(`Request body specification`),responses:C(cc).optional().default([]).describe(`Possible responses`),rateLimit:Xi.optional().describe(`Endpoint specific rate limiting`),security:C(d(r(),C(r()))).optional().describe(`Security requirements (e.g. [{"bearerAuth": []}])`),requiredPermissions:C(r()).optional().default([]).describe(`Required RBAC permissions (e.g., "customer.read", "manage_users")`),priority:P().int().min(0).max(1e3).optional().default(100).describe(`Route priority for conflict resolution (0-1000, higher = more important)`),protocolConfig:d(r(),u()).optional().describe(`Protocol-specific configuration for custom protocols (gRPC, tRPC, etc.)`),deprecated:S().default(!1).describe(`Whether endpoint is deprecated`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation link`)}),uc=h({owner:r().optional().describe(`Owner team or person`),status:E([`active`,`deprecated`,`experimental`,`beta`]).default(`active`).describe(`API lifecycle status`),tags:C(r()).optional().default([]).describe(`Classification tags`),pluginSource:r().optional().describe(`Source plugin name`),custom:d(r(),u()).optional().describe(`Custom metadata fields`)}),dc=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique API identifier (snake_case)`),name:r().describe(`API display name`),type:ic.describe(`API protocol type`),version:r().describe(`API version (e.g., v1, 2024-01)`),basePath:r().describe(`Base URL path for this API`),description:r().optional().describe(`API description`),endpoints:C(lc).describe(`Registered endpoints`),config:d(r(),u()).optional().describe(`Protocol-specific configuration`),metadata:uc.optional().describe(`Additional metadata`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`Contact information`),license:h({name:r(),url:r().url().optional()}).optional().describe(`License information`)}),fc=E([`error`,`priority`,`first-wins`,`last-wins`]),pc=h({version:r().describe(`Registry version`),conflictResolution:fc.optional().default(`error`).describe(`Strategy for handling route conflicts`),apis:C(dc).describe(`All registered APIs`),totalApis:P().int().describe(`Total number of registered APIs`),totalEndpoints:P().int().describe(`Total number of endpoints`),byType:d(ic,C(dc)).optional().describe(`APIs grouped by protocol type`),byStatus:d(r(),C(dc)).optional().describe(`APIs grouped by status`),updatedAt:r().datetime().optional().describe(`Last registry update time`)}),mc=h({type:ic.optional().describe(`Filter by API protocol type`),tags:C(r()).optional().describe(`Filter by tags (ANY match)`),status:E([`active`,`deprecated`,`experimental`,`beta`]).optional().describe(`Filter by lifecycle status`),pluginSource:r().optional().describe(`Filter by plugin name`),search:r().optional().describe(`Full-text search in name/description`),version:r().optional().describe(`Filter by specific version`)});h({apis:C(dc).describe(`Matching API entries`),total:P().int().describe(`Total matching APIs`),filters:mc.optional().describe(`Applied query filters`)}),Object.assign(lc,{create:e=>e}),Object.assign(dc,{create:e=>e}),Object.assign(pc,{create:e=>e});var hc=h({url:r().url().describe(`Server base URL`),description:r().optional().describe(`Server description`),variables:d(r(),h({default:r(),description:r().optional(),enum:C(r()).optional()})).optional().describe(`URL template variables`)}),gc=h({type:E([`apiKey`,`http`,`oauth2`,`openIdConnect`]).describe(`Security type`),scheme:r().optional().describe(`HTTP auth scheme (bearer, basic, etc.)`),bearerFormat:r().optional().describe(`Bearer token format (e.g., JWT)`),name:r().optional().describe(`API key parameter name`),in:E([`header`,`query`,`cookie`]).optional().describe(`API key location`),flows:h({implicit:u().optional(),password:u().optional(),clientCredentials:u().optional(),authorizationCode:u().optional()}).optional().describe(`OAuth2 flows`),openIdConnectUrl:r().url().optional().describe(`OpenID Connect discovery URL`),description:r().optional().describe(`Security scheme description`)}),_c=h({openapi:r().default(`3.0.0`).describe(`OpenAPI specification version`),info:h({title:r().describe(`API title`),version:r().describe(`API version`),description:r().optional().describe(`API description`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional(),license:h({name:r(),url:r().url().optional()}).optional()}).describe(`API metadata`),servers:C(hc).optional().default([]).describe(`API servers`),paths:d(r(),u()).describe(`API paths and operations`),components:h({schemas:d(r(),u()).optional(),responses:d(r(),u()).optional(),parameters:d(r(),u()).optional(),examples:d(r(),u()).optional(),requestBodies:d(r(),u()).optional(),headers:d(r(),u()).optional(),securitySchemes:d(r(),gc).optional(),links:d(r(),u()).optional(),callbacks:d(r(),u()).optional()}).optional().describe(`Reusable components`),security:C(d(r(),C(r()))).optional().describe(`Global security requirements`),tags:C(h({name:r(),description:r().optional(),externalDocs:h({description:r().optional(),url:r().url()}).optional()})).optional().describe(`Tag definitions`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation`)}),vc=h({type:E([`swagger-ui`,`redoc`,`rapidoc`,`stoplight`,`scalar`,`graphql-playground`,`graphiql`,`postman`,`custom`]).describe(`Testing UI implementation`),path:r().default(`/api-docs`).describe(`URL path for documentation UI`),theme:E([`light`,`dark`,`auto`]).default(`light`).describe(`UI color theme`),enableTryItOut:S().default(!0).describe(`Enable interactive API testing`),enableFilter:S().default(!0).describe(`Enable endpoint filtering`),enableCors:S().default(!0).describe(`Enable CORS for browser testing`),defaultModelsExpandDepth:P().int().min(-1).default(1).describe(`Default expand depth for schemas (-1 = fully expand)`),displayRequestDuration:S().default(!0).describe(`Show request duration`),syntaxHighlighting:S().default(!0).describe(`Enable syntax highlighting`),customCssUrl:r().url().optional().describe(`Custom CSS stylesheet URL`),customJsUrl:r().url().optional().describe(`Custom JavaScript URL`),layout:h({showExtensions:S().default(!1).describe(`Show vendor extensions`),showCommonExtensions:S().default(!1).describe(`Show common extensions`),deepLinking:S().default(!0).describe(`Enable deep linking`),displayOperationId:S().default(!1).describe(`Display operation IDs`),defaultModelRendering:E([`example`,`model`]).default(`example`).describe(`Default model rendering mode`),defaultModelsExpandDepth:P().int().default(1).describe(`Models expand depth`),defaultModelExpandDepth:P().int().default(1).describe(`Single model expand depth`),docExpansion:E([`list`,`full`,`none`]).default(`list`).describe(`Documentation expansion mode`)}).optional().describe(`Layout configuration`)}),yc=h({name:r().describe(`Test request name`),description:r().optional().describe(`Request description`),method:E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`HEAD`,`OPTIONS`]).describe(`HTTP method`),url:r().describe(`Request URL (can include variables)`),headers:d(r(),r()).optional().default({}).describe(`Request headers`),queryParams:d(r(),l([r(),P(),S()])).optional().default({}).describe(`Query parameters`),body:u().optional().describe(`Request body`),variables:d(r(),u()).optional().default({}).describe(`Template variables`),expectedResponse:h({statusCode:P().int(),body:u().optional()}).optional().describe(`Expected response for validation`)}),bc=h({name:r().describe(`Collection name`),description:r().optional().describe(`Collection description`),variables:d(r(),u()).optional().default({}).describe(`Shared variables`),requests:C(yc).describe(`Test requests in this collection`),folders:C(h({name:r(),description:r().optional(),requests:C(yc)})).optional().describe(`Request folders for organization`)}),xc=h({version:r().describe(`API version`),date:r().date().describe(`Release date`),changes:h({added:C(r()).optional().default([]).describe(`New features`),changed:C(r()).optional().default([]).describe(`Changes`),deprecated:C(r()).optional().default([]).describe(`Deprecations`),removed:C(r()).optional().default([]).describe(`Removed features`),fixed:C(r()).optional().default([]).describe(`Bug fixes`),security:C(r()).optional().default([]).describe(`Security fixes`)}).describe(`Version changes`),migrationGuide:r().optional().describe(`Migration guide URL or text`)}),Sc=h({language:r().describe(`Target language/framework (e.g., typescript, python, curl)`),name:r().describe(`Template name`),template:r().describe(`Code template with placeholders`),variables:C(r()).optional().describe(`Required template variables`)}),Cc=h({enabled:S().default(!0).describe(`Enable API documentation`),title:r().default(`API Documentation`).describe(`Documentation title`),version:r().describe(`API version`),description:r().optional().describe(`API description`),servers:C(hc).optional().default([]).describe(`API server URLs`),ui:vc.optional().describe(`Testing UI configuration`),generateOpenApi:S().default(!0).describe(`Generate OpenAPI 3.0 specification`),generateTestCollections:S().default(!0).describe(`Generate API test collections`),testCollections:C(bc).optional().default([]).describe(`Predefined test collections`),changelog:C(xc).optional().default([]).describe(`API version changelog`),codeTemplates:C(Sc).optional().default([]).describe(`Code generation templates`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`Contact information`),license:h({name:r(),url:r().url().optional()}).optional().describe(`API license`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation link`),securitySchemes:d(r(),gc).optional().describe(`Security scheme definitions`),tags:C(h({name:r(),description:r().optional(),externalDocs:h({description:r().optional(),url:r().url()}).optional()})).optional().describe(`Global tag definitions`)});h({openApiSpec:_c.optional().describe(`Generated OpenAPI specification`),testCollections:C(bc).optional().describe(`Generated test collections`),markdown:r().optional().describe(`Generated markdown documentation`),html:r().optional().describe(`Generated HTML documentation`),generatedAt:r().datetime().describe(`Generation timestamp`),sourceApis:C(r()).describe(`Source API IDs used for generation`)}),Object.assign(Cc,{create:e=>e}),Object.assign(bc,{create:e=>e}),Object.assign(_c,{create:e=>e});var wc=E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),Tc=E([`string`,`number`,`boolean`,`time`,`geo`]),Ec=E([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),Dc=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:r().describe(`Human readable label`),description:r().optional(),type:wc,sql:r().describe(`SQL expression or field reference`),filters:C(h({sql:r()})).optional(),format:r().optional()}),Oc=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:r().describe(`Human readable label`),description:r().optional(),type:Tc,sql:r().describe(`SQL expression or column reference`),granularities:C(Ec).optional()}),kc=h({name:r().describe(`Target cube name`),relationship:E([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:r().describe(`Join condition (ON clause)`)}),Ac=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:r().optional(),description:r().optional(),sql:r().describe(`Base SQL statement or Table Name`),measures:d(r(),Dc).describe(`Quantitative metrics`),dimensions:d(r(),Oc).describe(`Qualitative attributes`),joins:d(r(),kc).optional(),refreshKey:h({every:r().optional(),sql:r().optional()}).optional(),public:S().default(!1)}),jc=h({cube:r().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:C(r()).describe(`List of metrics to calculate`),dimensions:C(r()).optional().describe(`List of dimensions to group by`),filters:C(h({member:r().describe(`Dimension or Measure`),operator:E([`equals`,`notEquals`,`contains`,`notContains`,`gt`,`gte`,`lt`,`lte`,`set`,`notSet`,`inDateRange`]),values:C(r()).optional()})).optional(),timeDimensions:C(h({dimension:r(),granularity:Ec.optional(),dateRange:l([r(),C(r())]).optional()})).optional(),order:d(r(),E([`asc`,`desc`])).optional(),limit:P().optional(),offset:P().optional(),timezone:r().optional().default(`UTC`)});E([`/api/v1/analytics/query`,`/api/v1/analytics/meta`,`/api/v1/analytics/sql`]),h({query:jc.describe(`The analytic query definition`),cube:r().describe(`Target cube name`),format:E([`json`,`csv`,`xlsx`]).default(`json`).describe(`Response format`)}),R.extend({data:h({rows:C(d(r(),u())).describe(`Result rows`),fields:C(h({name:r(),type:r()})).describe(`Column metadata`),sql:r().optional().describe(`Executed SQL (if debug enabled)`)})}),h({cube:r().optional().describe(`Optional cube name to filter`)}),R.extend({data:h({cubes:C(Ac).describe(`Available cubes`)})}),R.extend({data:h({sql:r(),params:C(u())})});var Mc=E([`urlPath`,`header`,`queryParam`,`dateBased`]),Nc=E([`preview`,`current`,`supported`,`deprecated`,`retired`]),Pc=h({version:r().describe(`Version identifier (e.g., "v1", "v2beta1", "2025-01-01")`),status:Nc.describe(`Lifecycle status of this version`),releasedAt:r().describe(`Release date (ISO 8601, e.g., "2025-01-15")`),deprecatedAt:r().optional().describe(`Deprecation date (ISO 8601). Only set for deprecated/retired versions`),sunsetAt:r().optional().describe(`Sunset date (ISO 8601). After this date, the version returns 410 Gone`),migrationGuide:r().url().optional().describe(`URL to migration guide for upgrading from this version`),description:r().optional().describe(`Human-readable description or release notes summary`),breakingChanges:C(r()).optional().describe(`List of breaking changes (for preview/new versions)`)});h({strategy:Mc.default(`urlPath`).describe(`How the API version is specified by clients`),current:r().describe(`The current/recommended API version identifier`),default:r().describe(`Fallback version when client does not specify one`),versions:C(Pc).min(1).describe(`All available API versions with lifecycle metadata`),headerName:r().default(`ObjectStack-Version`).describe(`HTTP header name for version negotiation (header/dateBased strategies)`),queryParamName:r().default(`version`).describe(`Query parameter name for version specification (queryParam strategy)`),urlPrefix:r().default(`/api`).describe(`URL prefix before version segment (urlPath strategy)`),deprecation:h({warnHeader:S().default(!0).describe(`Include Deprecation header (RFC 8594) in responses`),sunsetHeader:S().default(!0).describe(`Include Sunset header (RFC 8594) with retirement date`),linkHeader:S().default(!0).describe(`Include Link header pointing to migration guide URL`),rejectRetired:S().default(!0).describe(`Return 410 Gone for retired API versions`),warningMessage:r().optional().describe(`Custom warning message for deprecated version responses`)}).optional().describe(`Deprecation lifecycle behavior`),includeInDiscovery:S().default(!0).describe(`Include version information in the API discovery endpoint`)}),h({current:r().describe(`Current recommended API version`),requested:r().optional().describe(`Version requested by the client`),resolved:r().describe(`Resolved API version for this request`),supported:C(r()).describe(`All supported version identifiers`),deprecated:C(r()).optional().describe(`Deprecated version identifiers`),versions:C(Pc).optional().describe(`Full version definitions with lifecycle metadata`)}),E([`local`,`google`,`github`,`microsoft`,`ldap`,`saml`]);var Fc=h({id:r().describe(`User ID`),email:r().email().describe(`Email address`),emailVerified:S().default(!1).describe(`Is email verified?`),name:r().describe(`Display name`),image:r().optional().describe(`Avatar URL`),username:r().optional().describe(`Username (optional)`),roles:C(r()).optional().default([]).describe(`Assigned role IDs`),tenantId:r().optional().describe(`Current tenant ID`),language:r().default(`en`).describe(`Preferred language`),timezone:r().optional().describe(`Preferred timezone`),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional()}),Ic=h({id:r(),expiresAt:r().datetime(),token:r().optional(),ipAddress:r().optional(),userAgent:r().optional(),userId:r()});h({type:E([`email`,`username`,`phone`,`magic-link`,`social`]).default(`email`).describe(`Login method`),email:r().email().optional().describe(`Required for email/magic-link`),username:r().optional().describe(`Required for username login`),password:r().optional().describe(`Required for password login`),provider:r().optional().describe(`Required for social (google, github)`),redirectTo:r().optional().describe(`Redirect URL after successful login`)}),h({email:r().email(),password:r(),name:r(),image:r().optional()}),h({refreshToken:r().describe(`Refresh token`)}),R.extend({data:h({session:Ic.describe(`Active Session Info`),user:Fc.describe(`Current User Details`),token:r().optional().describe(`Bearer token if not using cookies`)})}),R.extend({data:Fc});var Lc={signInEmail:`/sign-in/email`,signUpEmail:`/sign-up/email`,signOut:`/sign-out`,getSession:`/get-session`,forgetPassword:`/forget-password`,resetPassword:`/reset-password`,sendVerificationEmail:`/send-verification-email`,verifyEmail:`/verify-email`,twoFactorEnable:`/two-factor/enable`,twoFactorVerify:`/two-factor/verify`,passkeyRegister:`/passkey/register`,passkeyAuthenticate:`/passkey/authenticate`,magicLinkSend:`/magic-link/send`,magicLinkVerify:`/magic-link/verify`};h({signInEmail:h({method:m(`POST`),path:m(Lc.signInEmail),description:m(`Sign in with email and password`)}),signUpEmail:h({method:m(`POST`),path:m(Lc.signUpEmail),description:m(`Register new user with email and password`)}),signOut:h({method:m(`POST`),path:m(Lc.signOut),description:m(`Sign out current user`)}),getSession:h({method:m(`GET`),path:m(Lc.getSession),description:m(`Get current user session`)}),forgetPassword:h({method:m(`POST`),path:m(Lc.forgetPassword),description:m(`Request password reset email`)}),resetPassword:h({method:m(`POST`),path:m(Lc.resetPassword),description:m(`Reset password with token`)}),sendVerificationEmail:h({method:m(`POST`),path:m(Lc.sendVerificationEmail),description:m(`Send email verification link`)}),verifyEmail:h({method:m(`GET`),path:m(Lc.verifyEmail),description:m(`Verify email with token`)})}),Lc.signInEmail,Lc.signUpEmail,Lc.signOut,Lc.getSession,Lc.signInEmail,Lc.signUpEmail,Lc.signOut,Lc.getSession,Lc.getSession;var Rc=h({id:r().describe(`Provider ID (e.g., google, github, microsoft)`),name:r().describe(`Display name (e.g., Google, GitHub)`),enabled:S().describe(`Whether this provider is enabled`)}),zc=h({enabled:S().describe(`Whether email/password auth is enabled`),disableSignUp:S().optional().describe(`Whether new user registration is disabled`),requireEmailVerification:S().optional().describe(`Whether email verification is required`)}),Bc=h({twoFactor:S().default(!1).describe(`Two-factor authentication enabled`),passkeys:S().default(!1).describe(`Passkey/WebAuthn support enabled`),magicLink:S().default(!1).describe(`Magic link login enabled`),organization:S().default(!1).describe(`Multi-tenant organization support enabled`)});h({emailPassword:zc.describe(`Email/password authentication config`),socialProviders:C(Rc).describe(`Available social/OAuth providers`),features:Bc.describe(`Enabled authentication features`)});var Vc=E([`global`,`tenant`,`user`,`session`,`temp`,`cache`,`data`,`logs`,`config`,`public`]).describe(`Storage scope classification`),Hc=h({path:r().describe(`File path`),name:r().describe(`File name`),size:P().int().describe(`File size in bytes`),mimeType:r().describe(`MIME type`),lastModified:r().datetime().describe(`Last modified timestamp`),created:r().datetime().describe(`Creation timestamp`),etag:r().optional().describe(`Entity tag`)}),Uc=E([`s3`,`azure_blob`,`gcs`,`minio`,`r2`,`spaces`,`wasabi`,`backblaze`,`local`]).describe(`Storage provider type`),Wc=E([`private`,`public_read`,`public_read_write`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full_control`]).describe(`Storage access control level`),Gc=E([`standard`,`intelligent`,`infrequent_access`,`glacier`,`deep_archive`]).describe(`Storage class/tier for cost optimization`),Kc=E([`transition`,`delete`,`abort`]).describe(`Lifecycle policy action type`);h({contentType:r().describe(`MIME type (e.g., image/jpeg, application/pdf)`),contentLength:P().min(0).describe(`File size in bytes`),contentEncoding:r().optional().describe(`Content encoding (e.g., gzip)`),contentDisposition:r().optional().describe(`Content disposition header`),contentLanguage:r().optional().describe(`Content language`),cacheControl:r().optional().describe(`Cache control directives`),etag:r().optional().describe(`Entity tag for versioning/caching`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),versionId:r().optional().describe(`Object version identifier`),storageClass:Gc.optional().describe(`Storage class/tier`),encryption:h({algorithm:r().describe(`Encryption algorithm (e.g., AES256, aws:kms)`),keyId:r().optional().describe(`KMS key ID if using managed encryption`)}).optional().describe(`Server-side encryption configuration`),custom:d(r(),r()).optional().describe(`Custom user-defined metadata`)}),h({operation:E([`get`,`put`,`delete`,`head`]).describe(`Allowed operation`),expiresIn:P().min(1).max(604800).describe(`Expiration time in seconds (max 7 days)`),contentType:r().optional().describe(`Required content type for PUT operations`),maxSize:P().min(0).optional().describe(`Maximum file size in bytes for PUT operations`),responseContentType:r().optional().describe(`Override content-type for GET operations`),responseContentDisposition:r().optional().describe(`Override content-disposition for GET operations`)});var qc=h({enabled:S().default(!0).describe(`Enable multipart uploads`),partSize:P().min(5*1024*1024).max(5*1024*1024*1024).default(10*1024*1024).describe(`Part size in bytes (min 5MB, max 5GB)`),maxParts:P().min(1).max(1e4).default(1e4).describe(`Maximum number of parts (max 10,000)`),threshold:P().min(0).default(100*1024*1024).describe(`File size threshold to trigger multipart upload (bytes)`),maxConcurrent:P().min(1).max(100).default(4).describe(`Maximum concurrent part uploads`),abortIncompleteAfterDays:P().min(1).optional().describe(`Auto-abort incomplete uploads after N days`)}),_ee=h({acl:Wc.default(`private`).describe(`Default access control level`),allowedOrigins:C(r()).optional().describe(`CORS allowed origins`),allowedMethods:C(E([`GET`,`PUT`,`POST`,`DELETE`,`HEAD`])).optional().describe(`CORS allowed HTTP methods`),allowedHeaders:C(r()).optional().describe(`CORS allowed headers`),exposeHeaders:C(r()).optional().describe(`CORS exposed headers`),maxAge:P().min(0).optional().describe(`CORS preflight cache duration in seconds`),corsEnabled:S().default(!1).describe(`Enable CORS configuration`),publicAccess:h({allowPublicRead:S().default(!1).describe(`Allow public read access`),allowPublicWrite:S().default(!1).describe(`Allow public write access`),allowPublicList:S().default(!1).describe(`Allow public bucket listing`)}).optional().describe(`Public access control`),allowedIps:C(r()).optional().describe(`Allowed IP addresses/CIDR blocks`),blockedIps:C(r()).optional().describe(`Blocked IP addresses/CIDR blocks`)}),Jc=h({id:fa.describe(`Rule identifier`),enabled:S().default(!0).describe(`Enable this rule`),action:Kc.describe(`Action to perform`),prefix:r().optional().describe(`Object key prefix filter (e.g., "uploads/")`),tags:d(r(),r()).optional().describe(`Object tag filters`),daysAfterCreation:P().min(0).optional().describe(`Days after object creation`),daysAfterModification:P().min(0).optional().describe(`Days after last modification`),targetStorageClass:Gc.optional().describe(`Target storage class for transition action`)}).refine(e=>!(e.action===`transition`&&!e.targetStorageClass),{message:`targetStorageClass is required when action is "transition"`}),Yc=h({enabled:S().default(!1).describe(`Enable lifecycle policies`),rules:C(Jc).default([]).describe(`Lifecycle rules`)}),Xc=h({name:fa.describe(`Bucket identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),bucketName:r().describe(`Actual bucket/container name in storage provider`),region:r().optional().describe(`Storage region (e.g., us-east-1, westus)`),provider:Uc.describe(`Storage provider`),endpoint:r().optional().describe(`Custom endpoint URL (for S3-compatible providers)`),pathStyle:S().default(!1).describe(`Use path-style URLs (for S3-compatible providers)`),versioning:S().default(!1).describe(`Enable object versioning`),encryption:h({enabled:S().default(!1).describe(`Enable server-side encryption`),algorithm:E([`AES256`,`aws:kms`,`azure:kms`,`gcp:kms`]).default(`AES256`).describe(`Encryption algorithm`),kmsKeyId:r().optional().describe(`KMS key ID for managed encryption`)}).optional().describe(`Server-side encryption configuration`),accessControl:_ee.optional().describe(`Access control configuration`),lifecyclePolicy:Yc.optional().describe(`Lifecycle policy configuration`),multipartConfig:qc.optional().describe(`Multipart upload configuration`),tags:d(r(),r()).optional().describe(`Bucket tags for organization`),description:r().optional().describe(`Bucket description`),enabled:S().default(!0).describe(`Enable this bucket`)}),Zc=h({accessKeyId:r().optional().describe(`AWS access key ID or MinIO access key`),secretAccessKey:r().optional().describe(`AWS secret access key or MinIO secret key`),sessionToken:r().optional().describe(`AWS session token for temporary credentials`),accountName:r().optional().describe(`Azure storage account name`),accountKey:r().optional().describe(`Azure storage account key`),sasToken:r().optional().describe(`Azure SAS token`),projectId:r().optional().describe(`GCP project ID`),credentials:r().optional().describe(`GCP service account credentials JSON`),endpoint:r().optional().describe(`Custom endpoint URL`),region:r().optional().describe(`Default region`),useSSL:S().default(!0).describe(`Use SSL/TLS for connections`),timeout:P().min(0).optional().describe(`Connection timeout in milliseconds`)}),Qc=h({name:fa.describe(`Storage configuration identifier`),label:r().describe(`Display label`),provider:Uc.describe(`Primary storage provider`),scope:Vc.optional().default(`global`).describe(`Storage scope`),connection:Zc.describe(`Connection credentials`),buckets:C(Xc).default([]).describe(`Configured buckets`),defaultBucket:r().optional().describe(`Default bucket name for operations`),location:r().optional().describe(`Root path (local) or base location`),quota:P().int().positive().optional().describe(`Max size in bytes`),options:d(r(),u()).optional().describe(`Provider-specific configuration options`),enabled:S().default(!0).describe(`Enable this storage configuration`),description:r().optional().describe(`Configuration description`)});Qc.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}),Qc.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}),Qc.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}),Qc.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}),h({filename:r().describe(`Original filename`),mimeType:r().describe(`File MIME type`),size:P().describe(`File size in bytes`),scope:r().default(`user`).describe(`Target storage scope (e.g. user, private, public)`),bucket:r().optional().describe(`Specific bucket override (admin only)`)}),h({fileId:r().describe(`File ID returned from presigned request`),eTag:r().optional().describe(`S3 ETag verification`)}),R.extend({data:h({uploadUrl:r().describe(`PUT/POST URL for direct upload`),downloadUrl:r().optional().describe(`Public/Private preview URL`),fileId:r().describe(`Temporary File ID`),method:E([`PUT`,`POST`]).describe(`HTTP Method to use`),headers:d(r(),r()).optional().describe(`Required headers for upload`),expiresIn:P().describe(`URL expiry in seconds`)})}),R.extend({data:Hc.describe(`Uploaded file metadata`)}),h({mode:E([`whitelist`,`blacklist`]).describe(`whitelist = only allow listed types, blacklist = block listed types`),mimeTypes:C(r()).min(1).describe(`List of MIME types to allow or block (e.g., "image/jpeg", "application/pdf")`),extensions:C(r()).optional().describe(`List of file extensions to allow or block (e.g., ".jpg", ".pdf")`),maxFileSize:P().int().min(1).optional().describe(`Maximum file size in bytes`),minFileSize:P().int().min(0).optional().describe(`Minimum file size in bytes (e.g., reject empty files)`)}),h({filename:r().describe(`Original filename`),mimeType:r().describe(`File MIME type`),totalSize:P().int().min(1).describe(`Total file size in bytes`),chunkSize:P().int().min(5242880).default(5242880).describe(`Size of each chunk in bytes (minimum 5MB per S3 spec)`),scope:r().default(`user`).describe(`Target storage scope`),bucket:r().optional().describe(`Specific bucket override (admin only)`),metadata:d(r(),r()).optional().describe(`Custom metadata key-value pairs`)}),R.extend({data:h({uploadId:r().describe(`Multipart upload session ID`),resumeToken:r().describe(`Opaque token for resuming interrupted uploads`),fileId:r().describe(`Assigned file ID`),totalChunks:P().int().min(1).describe(`Expected number of chunks`),chunkSize:P().int().describe(`Chunk size in bytes`),expiresAt:r().datetime().describe(`Upload session expiration timestamp`)})}),h({uploadId:r().describe(`Multipart upload session ID`),chunkIndex:P().int().min(0).describe(`Zero-based chunk index`),resumeToken:r().describe(`Resume token from initiate response`)}),R.extend({data:h({chunkIndex:P().int().describe(`Chunk index that was uploaded`),eTag:r().describe(`Chunk ETag for multipart completion`),bytesReceived:P().int().describe(`Bytes received for this chunk`)})}),h({uploadId:r().describe(`Multipart upload session ID`),parts:C(h({chunkIndex:P().int().describe(`Chunk index`),eTag:r().describe(`ETag returned from chunk upload`)})).min(1).describe(`Ordered list of uploaded parts for assembly`)}),R.extend({data:h({fileId:r().describe(`Final file ID`),key:r().describe(`Storage key/path of the assembled file`),size:P().int().describe(`Total file size in bytes`),mimeType:r().describe(`File MIME type`),eTag:r().optional().describe(`Final ETag of the assembled file`),url:r().optional().describe(`Download URL for the assembled file`)})}),R.extend({data:h({uploadId:r().describe(`Multipart upload session ID`),fileId:r().describe(`Assigned file ID`),filename:r().describe(`Original filename`),totalSize:P().int().describe(`Total file size in bytes`),uploadedSize:P().int().describe(`Bytes uploaded so far`),totalChunks:P().int().describe(`Total expected chunks`),uploadedChunks:P().int().describe(`Number of chunks uploaded`),percentComplete:P().min(0).max(100).describe(`Upload progress percentage`),status:E([`in_progress`,`completing`,`completed`,`failed`,`expired`]).describe(`Current upload session status`),startedAt:r().datetime().describe(`Upload session start timestamp`),expiresAt:r().datetime().describe(`Session expiration timestamp`)})});var $c=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),el=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),tl=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),nl=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:$c.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:el.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:tl.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:nl.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var rl=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),il=h({field:r().describe(`Field name to apply masking to`),strategy:rl.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(il).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var al=E(`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(`.`)),ol=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:fa.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var sl=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var cl=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),ll=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),ul=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),dl=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),fl=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:al.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(ol).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:sl.optional().describe(`Configuration for currency field type`),vectorConfig:cl.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:ll.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:nl.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:il.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:dl.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:ul.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),pl=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label for the rule listing`),description:r().optional().describe(`Administrative notes explaining the business reason`),active:S().default(!0),events:C(E([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:P().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:C(r()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:E([`error`,`warning`,`info`]).default(`error`),message:r().describe(`Error message to display to the user`)}),ml=pl.extend({type:m(`script`),condition:r().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),hl=pl.extend({type:m(`unique`),fields:C(r()).describe(`Fields that must be combined unique`),scope:r().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:S().default(!0)}),gl=pl.extend({type:m(`state_machine`),field:r().describe(`State field (e.g. status)`),transitions:d(r(),C(r())).describe(`Map of { OldState: [AllowedNewStates] }`)}),_l=pl.extend({type:m(`format`),field:r(),regex:r().optional(),format:E([`email`,`url`,`phone`,`json`]).optional()}),vl=pl.extend({type:m(`cross_field`),condition:r().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:C(r()).describe(`Fields involved in the validation`)}),yl=pl.extend({type:m(`json_schema`),field:r().describe(`JSON field to validate`),schema:d(r(),u()).describe(`JSON Schema object definition`)}),bl=pl.extend({type:m(`async`),field:r().describe(`Field to validate`),validatorUrl:r().optional().describe(`External API endpoint for validation`),method:E([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:d(r(),r()).optional().describe(`Custom headers for the request`),validatorFunction:r().optional().describe(`Reference to custom validator function`),timeout:P().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:P().optional().describe(`Debounce delay in milliseconds`),params:d(r(),u()).optional().describe(`Additional parameters to pass to validator`)}),xl=pl.extend({type:m(`custom`),handler:r().describe(`Name of the custom validation function registered in the system`),params:d(r(),u()).optional().describe(`Parameters passed to the custom handler`)}),Sl=F(()=>I(`type`,[ml,hl,gl,_l,vl,yl,bl,xl,Cl])),Cl=pl.extend({type:m(`conditional`),when:r().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:Sl.describe(`Validation rule to apply when condition is true`),otherwise:Sl.optional().describe(`Validation rule to apply when condition is false`)}),wl=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),Tl=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),El=h({target:r().optional().describe(`Target State ID`),cond:Tl.optional().describe(`Condition (Guard) required to take this path`),actions:C(wl).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)});h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)});var Dl=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(wl).optional().describe(`Actions to run when entering this state`),exit:C(wl).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),El,C(El)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(El).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),Dl).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),Ol=h({id:pa.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),Dl).describe(`State Nodes`),on:d(r(),l([r(),El,C(El)])).optional()}),kl=h({name:r(),label:co,type:al,required:S().default(!1),options:C(h({label:co,value:r()})).optional()}),Al=E([`script`,`url`,`modal`,`flow`,`api`]),jl=new Set(Al.options.filter(e=>e!==`script`)),Ml=h({name:pa.describe(`Machine name (lowercase snake_case)`),label:co.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:Al.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(kl).optional().describe(`Input parameters required from user`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:co.optional().describe(`Confirmation message before execution`),successMessage:co.optional().describe(`Success message to show after execution`),refreshAfter:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:lo.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(jl.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),Nl=E([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),Pl=h({trackHistory:S().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:S().default(!0).describe(`Index records for global search`),apiEnabled:S().default(!0).describe(`Expose object via automatic APIs`),apiMethods:C(Nl).optional().describe(`Whitelist of allowed API operations`),files:S().default(!1).describe(`Enable file attachments and document management`),feeds:S().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:S().default(!1).describe(`Enable standard tasks and events tracking`),trash:S().default(!0).describe(`Enable soft-delete with restore capability`),mru:S().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:S().default(!0).describe(`Allow record deep cloning`)}),Fl=h({name:r().optional().describe(`Index name (auto-generated if not provided)`),fields:C(r()).describe(`Fields included in the index`),type:E([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:S().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:r().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),Il=h({fields:C(r()).describe(`Fields to index for full-text search weighting`),displayFields:C(r()).optional().describe(`Fields to display in search result cards`),filters:C(r()).optional().describe(`Default filters for search results`)}),Ll=h({enabled:S().describe(`Enable multi-tenancy for this object`),strategy:E([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:r().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:S().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),Rl=h({enabled:S().describe(`Enable soft delete (trash/recycle bin)`),field:r().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:S().default(!1).describe(`Cascade soft delete to related records`)}),zl=h({enabled:S().describe(`Enable record versioning`),strategy:E([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:P().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:r().default(`version`).describe(`Field name for version number/timestamp`)}),Bl=h({enabled:S().describe(`Enable table partitioning`),strategy:E([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:r().describe(`Field name to partition by`),interval:r().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"`}),Vl=h({enabled:S().describe(`Enable Change Data Capture`),events:C(E([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:r().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),Hl=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:r().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:r().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:r().optional().describe(`Developer documentation / description`),icon:r().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:r().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:C(r()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:S().optional().default(!0).describe(`Is the object active and usable`),isSystem:S().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:S().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:r().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:r().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:d(r().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),fl).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:C(Fl).optional().describe(`Database performance indexes`),tenancy:Ll.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:Rl.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:zl.optional().describe(`Record versioning and history tracking configuration`),partitioning:Bl.optional().describe(`Table partitioning configuration for performance`),cdc:Vl.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:C(Sl).optional().describe(`Object-level validation rules`),stateMachines:d(r(),Ol).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:r().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:h({type:E([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:r().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:P().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:r().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:C(r()).optional().describe(`Primary fields for hover/cards/lookups`),search:Il.optional().describe(`Search engine configuration`),enable:Pl.optional().describe(`Enabled system features modules`),recordTypes:C(r()).optional().describe(`Record type names for this object`),sharingModel:E([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:r().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:C(Ml).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function Ul(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var Wl=Object.assign(Hl,{create:e=>{let t={...e,label:e.label??Ul(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return Hl.parse(t)}});E([`own`,`extend`]),h({extend:r().describe(`Target object name (FQN) to extend`),fields:d(r(),fl).optional().describe(`Fields to add/override`),label:r().optional().describe(`Override label for the extended object`),pluralLabel:r().optional().describe(`Override plural label for the extended object`),description:r().optional().describe(`Override description for the extended object`),validations:C(Sl).optional().describe(`Additional validation rules to merge into the target object`),indexes:C(Fl).optional().describe(`Additional indexes to merge into the target object`),priority:P().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)});var Gl=h({id:pa.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:co.describe(`Display proper label`),icon:r().optional().describe(`Icon name`),order:P().optional().describe(`Sort order within the same level (lower = first)`),badge:l([r(),P()]).optional().describe(`Badge text or count displayed on the item`),visible:r().optional().describe(`Visibility formula condition`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this item`)}),Kl=Gl.extend({type:m(`object`),objectName:r().describe(`Target object name`),viewName:r().optional().describe(`Default list view to open. Defaults to "all"`)}),ql=Gl.extend({type:m(`dashboard`),dashboardName:r().describe(`Target dashboard name`)}),Jl=Gl.extend({type:m(`page`),pageName:r().describe(`Target custom page component name`),params:d(r(),u()).optional().describe(`Parameters passed to the page context`)}),Yl=Gl.extend({type:m(`url`),url:r().describe(`Target external URL`),target:E([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),Xl=Gl.extend({type:m(`report`),reportName:r().describe(`Target report name`)}),Zl=Gl.extend({type:m(`action`),actionDef:h({actionName:r().describe(`Action machine name to execute`),params:d(r(),u()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),Ql=Gl.extend({type:m(`group`),expanded:S().default(!1).describe(`Default expansion state in sidebar`)}),$l=F(()=>l([Kl.extend({children:C($l).optional().describe(`Child navigation items (e.g. specific views)`)}),ql,Jl,Yl,Xl,Zl,Ql.extend({children:C($l).describe(`Child navigation items`)})])),eu=h({primaryColor:r().optional().describe(`Primary theme color hex code`),logo:r().optional().describe(`Custom logo URL for this app`),favicon:r().optional().describe(`Custom favicon URL for this app`)}),tu=h({id:pa.describe(`Unique area identifier (lowercase snake_case)`),label:co.describe(`Area display label`),icon:r().optional().describe(`Area icon name`),order:P().optional().describe(`Sort order among areas (lower = first)`),description:co.optional().describe(`Area description`),visible:r().optional().describe(`Visibility formula condition for this area`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this area`),navigation:C($l).describe(`Navigation items within this area`)}),nu=h({name:pa.describe(`App unique machine name (lowercase snake_case)`),label:co.describe(`App display label`),version:r().optional().describe(`App version`),description:co.optional().describe(`App description`),icon:r().optional().describe(`App icon used in the App Launcher`),branding:eu.optional().describe(`App-specific branding`),active:S().optional().default(!0).describe(`Whether the app is enabled`),isDefault:S().optional().default(!1).describe(`Is default app`),navigation:C($l).optional().describe(`Full navigation tree for the app sidebar`),areas:C(tu).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:r().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this app`),objects:C(u()).optional().describe(`Objects belonging to this app`),apis:C(u()).optional().describe(`Custom APIs belonging to this app`),sharing:po.optional().describe(`Public sharing configuration`),embed:mo.optional().describe(`Iframe embedding configuration`),mobileNavigation:h({mode:E([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:C(r()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:lo.optional().describe(`ARIA accessibility attributes for the application`)}),ru=E([`json`,`yaml`,`typescript`,`javascript`]),iu=h({size:P().int().min(0).describe(`File size in bytes`),modifiedAt:r().datetime().describe(`Last modified date`),etag:r().describe(`Entity tag for cache validation`),format:ru.describe(`Serialization format`),path:r().optional().describe(`File system path`),metadata:d(r(),u()).optional().describe(`Provider-specific metadata`)});h({patterns:C(r()).optional().describe(`File glob patterns`),ifNoneMatch:r().optional().describe(`ETag for conditional request`),ifModifiedSince:r().datetime().optional().describe(`Only load if modified after this date`),validate:S().default(!0).describe(`Validate against schema`),useCache:S().default(!0).describe(`Enable caching`),filter:r().optional().describe(`Filter predicate as string`),limit:P().int().min(1).optional().describe(`Maximum items to load`),recursive:S().default(!0).describe(`Search subdirectories`)}),h({format:ru.default(`typescript`).describe(`Output format`),prettify:S().default(!0).describe(`Format with indentation`),indent:P().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:S().default(!1).describe(`Sort object keys`),includeDefaults:S().default(!1).describe(`Include default values`),backup:S().default(!1).describe(`Create backup file`),overwrite:S().default(!0).describe(`Overwrite existing file`),atomic:S().default(!0).describe(`Use atomic write operation`),path:r().optional().describe(`Custom output path`)}),h({output:r().describe(`Output file path`),format:ru.default(`json`).describe(`Export format`),filter:r().optional().describe(`Filter items to export`),includeStats:S().default(!1).describe(`Include metadata statistics`),compress:S().default(!1).describe(`Compress output (gzip)`),prettify:S().default(!0).describe(`Pretty print output`)}),h({conflictResolution:E([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Simulate import without saving`),continueOnError:S().default(!1).describe(`Continue if validation fails`),transform:r().optional().describe(`Transform items before import`)}),h({data:u().nullable().describe(`Loaded metadata`),fromCache:S().default(!1).describe(`Loaded from cache`),notModified:S().default(!1).describe(`Not modified since last request`),etag:r().optional().describe(`Entity tag`),stats:iu.optional().describe(`Metadata statistics`),loadTime:P().min(0).optional().describe(`Load duration in ms`)}),h({success:S().describe(`Save successful`),path:r().describe(`Output path`),etag:r().optional().describe(`Generated entity tag`),size:P().int().min(0).optional().describe(`File size`),saveTime:P().min(0).optional().describe(`Save duration in ms`),backupPath:r().optional().describe(`Backup file path`)}),h({type:E([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:r().describe(`Type of metadata`),name:r().describe(`Item identifier`),path:r().describe(`File path`),data:u().optional().describe(`Item data`),timestamp:r().datetime().describe(`Event timestamp`)}),h({type:r().describe(`Collection type`),count:P().int().min(0).describe(`Number of items`),formats:C(ru).describe(`Formats in collection`),totalSize:P().int().min(0).optional().describe(`Total size in bytes`),lastModified:r().datetime().optional().describe(`Last modification date`),location:r().optional().describe(`Collection location`)}),h({name:r().describe(`Loader identifier`),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)}).describe(`Loader capabilities`),supportedFormats:C(ru).describe(`Supported formats`),supportsWatch:S().default(!1).describe(`Supports file watching`),supportsWrite:S().default(!0).describe(`Supports write operations`),supportsCache:S().default(!0).describe(`Supports caching`)});var au=E([`filesystem`,`memory`,`none`]),ou=h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:au.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory path`),formats:C(ru).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:h({enabled:S().default(!0).describe(`Enable caching`),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:S().default(!1).describe(`Enable file watching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`),ignoreInitial:S().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:h({strict:S().default(!0).describe(`Strict validation`),throwOnError:S().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:d(r(),u()).optional().describe(`Loader-specific configuration`)});E([`package`,`admin`,`user`,`migration`,`api`]);var su=h({path:r().describe(`JSON path to the changed field`),originalValue:u().optional().describe(`Original value from the package`),currentValue:u().describe(`Current customized value`),changedBy:r().optional().describe(`User or admin who made this change`),changedAt:r().datetime().optional().describe(`Timestamp of the change`)}),cu=h({id:r().describe(`Overlay record ID (UUID)`),baseType:r().describe(`Metadata type being customized`),baseName:r().describe(`Metadata name being customized`),packageId:r().optional().describe(`Package ID that delivered the base metadata`),packageVersion:r().optional().describe(`Package version when overlay was created`),scope:E([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:r().optional().describe(`Tenant identifier`),owner:r().optional().describe(`Owner user ID for user-scope overlays`),patch:d(r(),u()).describe(`JSON Merge Patch payload (changed fields only)`),changes:C(su).optional().describe(`Field-level change tracking for conflict detection`),active:S().default(!0).describe(`Whether this overlay is active`),createdAt:r().datetime().optional(),createdBy:r().optional(),updatedAt:r().datetime().optional(),updatedBy:r().optional()}),lu=h({path:r().describe(`JSON path to the conflicting field`),baseValue:u().describe(`Value in the old package version`),incomingValue:u().describe(`Value in the new package version`),customValue:u().describe(`Customer customized value`),suggestedResolution:E([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:r().optional().describe(`Explanation for the suggested resolution`)}),uu=h({defaultStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:C(r()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:C(r()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:S().default(!0).describe(`Auto-resolve changes that do not conflict`)});h({success:S().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:d(r(),u()).optional().describe(`Merged metadata result`),updatedOverlay:d(r(),u()).optional().describe(`Updated overlay after merge`),conflicts:C(lu).optional().describe(`Unresolved merge conflicts`),autoResolved:C(h({path:r(),resolution:r(),description:r().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:h({totalFields:P().int().min(0).describe(`Total fields evaluated`),unchanged:P().int().min(0).describe(`Fields with no changes`),autoResolved:P().int().min(0).describe(`Fields auto-resolved`),conflicts:P().int().min(0).describe(`Fields with conflicts`)}).optional()});var du=h({metadataType:r().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:S().default(!0),lockedFields:C(r()).optional().describe(`Field paths that cannot be customized`),customizableFields:C(r()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:S().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:S().default(!1).describe(`Whether admins can delete package-delivered fields`)}),fu=E([`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`]),pu=h({type:fu.describe(`Metadata type identifier`),label:r().describe(`Display label for the metadata type`),description:r().optional().describe(`Description of the metadata type`),filePatterns:C(r()).describe(`Glob patterns to discover files of this type`),supportsOverlay:S().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:S().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:S().default(!1).describe(`Whether version history is tracked`),loadOrder:P().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:E([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)}),mu=h({types:C(fu).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),packageId:r().optional().describe(`Filter by owning package`),search:r().optional().describe(`Full-text search query`),scope:E([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:E([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:C(r()).optional().describe(`Filter by tags`),sortBy:E([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(500).default(50).describe(`Items per page`)}),hu=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),namespace:r().optional().describe(`Namespace`),label:r().optional().describe(`Display label`),scope:E([`system`,`platform`,`user`]).optional(),state:E([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:r().optional(),updatedAt:r().datetime().optional()})).describe(`Matched metadata items`),total:P().int().min(0).describe(`Total matching items`),page:P().int().min(1).describe(`Current page`),pageSize:P().int().min(1).describe(`Page size`)});h({event:E([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:fu.describe(`Metadata type`),name:r().describe(`Metadata item name`),namespace:r().optional().describe(`Namespace`),packageId:r().optional().describe(`Owning package ID`),timestamp:r().datetime().describe(`Event timestamp`),actor:r().optional().describe(`User or system that triggered the event`),payload:d(r(),u()).optional().describe(`Event-specific payload`)});var gu=h({valid:S().describe(`Whether the metadata is valid`),errors:C(h({path:r().describe(`JSON path to the invalid field`),message:r().describe(`Error description`),code:r().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:C(h({path:r().describe(`JSON path to the field`),message:r().describe(`Warning description`)})).optional().describe(`Validation warnings`)}),_u=h({storage:ou.describe(`Storage backend configuration`),customizationPolicies:C(du).optional().describe(`Default customization policies per type`),mergeStrategy:uu.optional().describe(`Merge strategy for package upgrades`),additionalTypes:C(pu.omit({type:!0}).extend({type:r().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:S().default(!0).describe(`Emit metadata change events`),validateOnWrite:S().default(!0).describe(`Validate metadata on write`),enableVersioning:S().default(!1).describe(`Track metadata version history`),cacheMaxItems:P().int().min(0).default(1e4).describe(`Max items in memory cache`)});h({id:m(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:m(`ObjectStack Metadata Service`).describe(`Plugin name`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:m(`standard`).describe(`Plugin type`),description:r().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:h({crud:S().default(!0).describe(`Supports metadata CRUD`),query:S().default(!0).describe(`Supports metadata query`),overlay:S().default(!0).describe(`Supports customization overlays`),watch:S().default(!1).describe(`Supports file watching`),importExport:S().default(!0).describe(`Supports import/export`),validation:S().default(!0).describe(`Supports schema validation`),versioning:S().default(!1).describe(`Supports version history`),events:S().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:_u.optional().describe(`Plugin configuration`)}),h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue if individual item fails`),validate:S().default(!0).describe(`Validate before register`)});var vu=h({total:P().int().min(0).describe(`Total items processed`),succeeded:P().int().min(0).describe(`Successfully processed`),failed:P().int().min(0).describe(`Failed items`),errors:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),error:r().describe(`Error message`)})).optional().describe(`Per-item errors`)}),yu=h({sourceType:r().describe(`Dependent metadata type`),sourceName:r().describe(`Dependent metadata name`),targetType:r().describe(`Referenced metadata type`),targetName:r().describe(`Referenced metadata name`),kind:E([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)});R.extend({data:Wl.describe(`Full Object Schema`)}),R.extend({data:nu.describe(`Full App Configuration`)}),R.extend({data:C(h({name:r(),label:r(),icon:r().optional(),description:r().optional()})).describe(`List of available concepts (Objects, Apps, Flows)`)}),h({type:fu.describe(`Metadata type`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Item name (snake_case)`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Optional namespace`)}),R.extend({data:h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),definition:d(r(),u()).describe(`Metadata definition payload`)}).describe(`Metadata item`)}),R.extend({data:C(d(r(),u())).describe(`Array of metadata definitions`)}),R.extend({data:C(r()).describe(`Array of metadata item names`)}),R.extend({data:h({exists:S().describe(`Whether the item exists`)})}),R.extend({data:h({type:r().describe(`Metadata type`),name:r().describe(`Deleted item name`)})}),mu.describe(`Metadata query with filtering, sorting, and pagination`),R.extend({data:hu.describe(`Paginated query result`)}),h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue on individual failure`),validate:S().default(!0).describe(`Validate before registering`)}),h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`)})).min(1).describe(`Items to unregister`)}),R.extend({data:vu.describe(`Bulk operation result`)}),R.extend({data:cu.optional().describe(`Overlay definition, undefined if none`)}),cu.describe(`Overlay to save`),R.extend({data:d(r(),u()).optional().describe(`Effective metadata with all overlays applied`)}),h({types:C(r()).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),format:E([`json`,`yaml`]).default(`json`).describe(`Export format`)}),R.extend({data:u().describe(`Exported metadata bundle`)}),h({data:u().describe(`Metadata bundle to import`),conflictResolution:E([`skip`,`overwrite`,`merge`]).default(`skip`).describe(`Conflict resolution strategy`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Dry run (no save)`)}),R.extend({data:h({total:P().int().min(0),imported:P().int().min(0),skipped:P().int().min(0),failed:P().int().min(0),errors:C(h({type:r(),name:r(),error:r()})).optional()}).describe(`Import result`)}),h({type:r().describe(`Metadata type to validate against`),data:u().describe(`Metadata payload to validate`)}),R.extend({data:gu.describe(`Validation result`)}),R.extend({data:C(r()).describe(`Registered metadata type identifiers`)}),R.extend({data:h({type:r().describe(`Metadata type identifier`),label:r().describe(`Display label`),description:r().optional().describe(`Description`),filePatterns:C(r()).describe(`File glob patterns`),supportsOverlay:S().describe(`Overlay support`),domain:r().describe(`Protocol domain`)}).optional().describe(`Type info`)}),R.extend({data:C(yu).describe(`Items this item depends on`)}),R.extend({data:C(yu).describe(`Items that depend on this item`)});var bu=E([`metadata`,`data`,`auth`,`file-storage`,`search`,`cache`,`queue`,`automation`,`graphql`,`analytics`,`realtime`,`job`,`notification`,`ai`,`i18n`,`ui`,`workflow`]),xu=E([`required`,`core`,`optional`]);h({name:bu,enabled:S(),status:E([`running`,`stopped`,`degraded`,`initializing`]),version:r().optional(),provider:r().optional().describe(`Implementation provider (e.g. "s3" for storage)`),features:C(r()).optional().describe(`List of supported sub-features`)}),d(bu,u().describe(`Service Instance implementing the protocol interface`)),h({id:r(),name:bu,options:d(r(),u()).optional()}),h({routes:C(h({prefix:r().regex(/^\//).describe(`URL path prefix for routing (e.g. /api/v1/data)`),service:bu.describe(`Target core service name`),authRequired:S().default(!0).describe(`Whether authentication is required`),criticality:xu.default(`optional`).describe(`Service criticality level for unavailability handling`),permissions:C(r()).optional().describe(`Required permissions for this route namespace`)})).describe(`Route-to-service mappings`),fallback:E([`404`,`proxy`,`custom`]).default(`404`).describe(`Behavior when no route matches`),proxyTarget:r().url().optional().describe(`Proxy target URL when fallback is "proxy"`)}),E([`404`,`405`,`501`,`503`]).describe(`404 = route not found, 405 = method not allowed, 501 = not implemented (stub), 503 = service unavailable`),h({success:m(!1),error:h({code:P().int().describe(`HTTP status code (404, 405, 501, 503, …)`),message:r().describe(`Human-readable error message`),type:E([`ROUTE_NOT_FOUND`,`METHOD_NOT_ALLOWED`,`NOT_IMPLEMENTED`,`SERVICE_UNAVAILABLE`]).optional().describe(`Machine-readable error type`),route:r().optional().describe(`Requested route path`),service:r().optional().describe(`Target service name, if resolvable`),hint:r().optional().describe(`Actionable hint for the developer (e.g., "Install plugin-workflow")`)})});var Su=h({port:P().int().min(1).max(65535).default(3e3).describe(`Port number to listen on`),host:r().default(`0.0.0.0`).describe(`Host address to bind to`),cors:Yi.optional().describe(`CORS configuration`),requestTimeout:P().int().default(3e4).describe(`Request timeout in milliseconds`),bodyLimit:r().default(`10mb`).describe(`Maximum request body size`),compression:S().default(!0).describe(`Enable response compression`),security:h({helmet:S().default(!0).describe(`Enable security headers via helmet`),rateLimit:Xi.optional().describe(`Global rate limiting configuration`)}).optional().describe(`Security configuration`),static:C(Zi).optional().describe(`Static file serving configuration`),trustProxy:S().default(!1).describe(`Trust X-Forwarded-* headers`)});h({method:Ki.describe(`HTTP method`),path:r().describe(`URL path pattern`),handler:r().describe(`Handler identifier or name`),metadata:h({summary:r().optional().describe(`Route summary for documentation`),description:r().optional().describe(`Route description`),tags:C(r()).optional().describe(`Tags for grouping`),operationId:r().optional().describe(`Unique operation identifier`)}).optional(),security:h({authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:r().optional().describe(`Rate limit policy override`)}).optional()});var Cu=E([`authentication`,`authorization`,`logging`,`validation`,`transformation`,`error`,`custom`]),wu=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Middleware name (snake_case)`),type:Cu.describe(`Middleware type`),enabled:S().default(!0).describe(`Whether middleware is enabled`),order:P().int().default(100).describe(`Execution order priority`),config:d(r(),u()).optional().describe(`Middleware configuration object`),paths:h({include:C(r()).optional().describe(`Include path patterns (glob)`),exclude:C(r()).optional().describe(`Exclude path patterns (glob)`)}).optional().describe(`Path filtering`)});h({type:E([`starting`,`started`,`stopping`,`stopped`,`request`,`response`,`error`]).describe(`Event type`),timestamp:r().datetime().describe(`Event timestamp (ISO 8601)`),data:d(r(),u()).optional().describe(`Event-specific data`)}),h({httpVersions:C(E([`1.0`,`1.1`,`2.0`,`3.0`])).default([`1.1`]).describe(`Supported HTTP versions`),websocket:S().default(!1).describe(`WebSocket support`),sse:S().default(!1).describe(`Server-Sent Events support`),serverPush:S().default(!1).describe(`HTTP/2 Server Push support`),streaming:S().default(!0).describe(`Response streaming support`),middleware:S().default(!0).describe(`Middleware chain support`),routeParams:S().default(!0).describe(`URL parameter support (/users/:id)`),compression:S().default(!0).describe(`Built-in compression support`)}),h({state:E([`stopped`,`starting`,`running`,`stopping`,`error`]).describe(`Current server state`),uptime:P().int().optional().describe(`Server uptime in milliseconds`),server:h({port:P().int().describe(`Listening port`),host:r().describe(`Bound host`),url:r().optional().describe(`Full server URL`)}).optional(),connections:h({active:P().int().describe(`Active connections`),total:P().int().describe(`Total connections handled`)}).optional(),requests:h({total:P().int().describe(`Total requests processed`),success:P().int().describe(`Successful requests`),errors:P().int().describe(`Failed requests`)}).optional()}),Object.assign(Su,{create:e=>e}),Object.assign(wu,{create:e=>e});var Tu=E([`discovery`,`metadata`,`data`,`batch`,`permission`,`analytics`,`automation`,`workflow`,`ui`,`realtime`,`notification`,`ai`,`i18n`]),Eu=E([`implemented`,`stub`,`planned`]),Du=h({method:Ki.describe(`HTTP method for this endpoint`),path:r().describe(`URL path pattern (e.g., /api/v1/data/:object/:id)`),handler:r().describe(`Protocol method name or handler identifier`),category:Tu.describe(`Route category`),public:S().default(!1).describe(`Is publicly accessible without authentication`),permissions:C(r()).optional().describe(`Required permissions (e.g., ["data.read", "object.account.read"])`),summary:r().optional().describe(`Short description for OpenAPI`),description:r().optional().describe(`Detailed description for OpenAPI`),tags:C(r()).optional().describe(`OpenAPI tags for grouping`),requestSchema:r().optional().describe(`Request schema name (for validation)`),responseSchema:r().optional().describe(`Response schema name (for documentation)`),timeout:P().int().optional().describe(`Request timeout in milliseconds`),rateLimit:r().optional().describe(`Rate limit policy name`),cacheable:S().default(!1).describe(`Whether response can be cached`),cacheTtl:P().int().optional().describe(`Cache TTL in seconds`),handlerStatus:Eu.optional().describe(`Handler implementation status: implemented (default if omitted), stub, or planned`)}),Ou=h({prefix:r().regex(/^\//).describe(`URL path prefix for this route group`),service:r().describe(`Core service name (metadata, data, auth, etc.)`),category:Tu.describe(`Primary category for this route group`),methods:C(r()).optional().describe(`Protocol method names implemented`),endpoints:C(Du).optional().describe(`Endpoint definitions`),middleware:C(wu).optional().describe(`Middleware stack for this route group`),authRequired:S().default(!0).describe(`Whether authentication is required by default`),documentation:h({title:r().optional().describe(`Route group title`),description:r().optional().describe(`Route group description`),tags:C(r()).optional().describe(`OpenAPI tags`)}).optional().describe(`Documentation metadata for this route group`)}),ku=E([`strict`,`permissive`,`strip`]),Au=h({enabled:S().default(!0).describe(`Enable automatic request validation`),mode:ku.default(`strict`).describe(`How to handle validation errors`),validateBody:S().default(!0).describe(`Validate request body against schema`),validateQuery:S().default(!0).describe(`Validate query string parameters`),validateParams:S().default(!0).describe(`Validate URL path parameters`),validateHeaders:S().default(!1).describe(`Validate request headers`),includeFieldErrors:S().default(!0).describe(`Include field-level error details in response`),errorPrefix:r().optional().describe(`Custom prefix for validation error messages`),schemaRegistry:r().optional().describe(`Schema registry name to use for validation`)}),ju=h({enabled:S().default(!0).describe(`Enable automatic response envelope wrapping`),includeMetadata:S().default(!0).describe(`Include meta object in responses`),includeTimestamp:S().default(!0).describe(`Include timestamp in response metadata`),includeRequestId:S().default(!0).describe(`Include requestId in response metadata`),includeDuration:S().default(!1).describe(`Include request duration in ms`),includeTraceId:S().default(!1).describe(`Include distributed traceId`),customMetadata:d(r(),u()).optional().describe(`Additional metadata fields to include`),skipIfWrapped:S().default(!0).describe(`Skip wrapping if response already has success field`)}),Mu=h({enabled:S().default(!0).describe(`Enable standardized error handling`),includeStackTrace:S().default(!1).describe(`Include stack traces in error responses`),logErrors:S().default(!0).describe(`Log errors to system logger`),exposeInternalErrors:S().default(!1).describe(`Expose internal error details in responses`),includeRequestId:S().default(!0).describe(`Include requestId in error responses`),includeTimestamp:S().default(!0).describe(`Include timestamp in error responses`),includeDocumentation:S().default(!0).describe(`Include documentation URLs for errors`),documentationBaseUrl:r().url().optional().describe(`Base URL for error documentation`),customErrorMessages:d(r(),r()).optional().describe(`Custom error messages by error code`),redactFields:C(r()).optional().describe(`Field names to redact from error details`)}),Nu=h({enabled:S().default(!0).describe(`Enable automatic OpenAPI documentation generation`),version:E([`3.0.0`,`3.0.1`,`3.0.2`,`3.0.3`,`3.1.0`]).default(`3.0.3`).describe(`OpenAPI specification version`),title:r().default(`ObjectStack API`).describe(`API title`),description:r().optional().describe(`API description`),apiVersion:r().default(`1.0.0`).describe(`API version`),outputPath:r().default(`/api/docs/openapi.json`).describe(`URL path to serve OpenAPI JSON`),uiPath:r().default(`/api/docs`).describe(`URL path to serve documentation UI`),uiFramework:E([`swagger-ui`,`redoc`,`rapidoc`,`elements`]).default(`swagger-ui`).describe(`Documentation UI framework`),includeInternal:S().default(!1).describe(`Include internal endpoints in documentation`),generateSchemas:S().default(!0).describe(`Auto-generate schemas from Zod definitions`),includeExamples:S().default(!0).describe(`Include request/response examples`),servers:C(h({url:r().describe(`Server URL`),description:r().optional().describe(`Server description`)})).optional().describe(`Server URLs for API`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`API contact information`),license:h({name:r().describe(`License name`),url:r().url().optional().describe(`License URL`)}).optional().describe(`API license information`),securitySchemes:d(r(),h({type:E([`apiKey`,`http`,`oauth2`,`openIdConnect`]),scheme:r().optional(),bearerFormat:r().optional()})).optional().describe(`Security scheme definitions`)}),Pu=h({enabled:S().default(!0).describe(`Enable REST API plugin`),basePath:r().default(`/api`).describe(`Base path for all API routes`),version:r().default(`v1`).describe(`API version identifier`),routes:C(Ou).describe(`Route registrations`),validation:Au.optional().describe(`Request validation configuration`),responseEnvelope:ju.optional().describe(`Response envelope configuration`),errorHandling:Mu.optional().describe(`Error handling configuration`),openApi:Nu.optional().describe(`OpenAPI documentation configuration`),globalMiddleware:C(wu).optional().describe(`Global middleware stack`),cors:h({enabled:S().default(!0),origins:C(r()).optional(),methods:C(Ki).optional(),credentials:S().default(!0)}).optional().describe(`CORS configuration`),performance:h({enableCompression:S().default(!0).describe(`Enable response compression`),enableETag:S().default(!0).describe(`Enable ETag generation`),enableCaching:S().default(!0).describe(`Enable HTTP caching`),defaultCacheTtl:P().int().default(300).describe(`Default cache TTL in seconds`)}).optional().describe(`Performance optimization settings`)});Object.assign(Pu,{create:e=>e}),Object.assign(Ou,{create:e=>e});var Fu=h({path:r().describe(`Full URL path (e.g. /api/v1/analytics/query)`),method:Ki.describe(`HTTP method (GET, POST, etc.)`),category:Tu.describe(`Route category`),handlerStatus:Eu.describe(`Handler status`),service:r().describe(`Target service name`),healthCheckPassed:S().optional().describe(`Whether the health check probe succeeded`)});h({timestamp:r().describe(`ISO 8601 timestamp`),adapter:r().describe(`Adapter name (e.g. "hono", "express", "nextjs")`),summary:h({total:P().int().describe(`Total declared endpoints`),implemented:P().int().describe(`Endpoints with real handlers`),stub:P().int().describe(`Endpoints with stub handlers (501)`),planned:P().int().describe(`Endpoints not yet implemented`)}),entries:C(Fu).describe(`Per-endpoint coverage entries`)}),E([`rest`,`graphql`,`odata`]);var Iu=h({operator:r().describe(`Unified DSL operator`),rest:r().optional().describe(`REST query parameter template`),graphql:r().optional().describe(`GraphQL where clause template`),odata:r().optional().describe(`OData $filter expression template`)}),Lu=h({filterStyle:E([`bracket`,`dot`,`flat`,`rsql`]).default(`bracket`).describe(`REST filter parameter encoding style`),pagination:h({limitParam:r().default(`limit`).describe(`Page size parameter name`),offsetParam:r().default(`offset`).describe(`Offset parameter name`),cursorParam:r().default(`cursor`).describe(`Cursor parameter name`),pageParam:r().default(`page`).describe(`Page number parameter name`)}).optional().describe(`Pagination parameter name mappings`),sorting:h({param:r().default(`sort`).describe(`Sort parameter name`),format:E([`comma`,`array`,`pipe`]).default(`comma`).describe(`Sort parameter encoding format`)}).optional().describe(`Sort parameter mapping`),fieldsParam:r().default(`fields`).describe(`Field selection parameter name`)}),Ru=h({filterArgName:r().default(`where`).describe(`GraphQL filter argument name`),filterStyle:E([`nested`,`flat`,`array`]).default(`nested`).describe(`GraphQL filter nesting style`),pagination:h({limitArg:r().default(`limit`).describe(`Page size argument name`),offsetArg:r().default(`offset`).describe(`Offset argument name`),firstArg:r().default(`first`).describe(`Relay "first" argument name`),afterArg:r().default(`after`).describe(`Relay "after" cursor argument name`)}).optional().describe(`Pagination argument name mappings`),sorting:h({argName:r().default(`orderBy`).describe(`Sort argument name`),format:E([`enum`,`array`]).default(`enum`).describe(`Sort argument format`)}).optional().describe(`Sort argument mapping`)}),zu=h({version:E([`v2`,`v4`]).default(`v4`).describe(`OData version`),usePrefix:S().default(!0).describe(`Use $ prefix for system query options ($filter vs filter)`),stringFunctions:C(E([`contains`,`startswith`,`endswith`,`tolower`,`toupper`,`trim`,`concat`,`substring`,`length`])).optional().describe(`Supported OData string functions`),expand:h({enabled:S().default(!0).describe(`Enable $expand support`),maxDepth:P().int().min(1).default(3).describe(`Maximum expand depth`)}).optional().describe(`$expand configuration`)});h({operatorMappings:C(Iu).optional().describe(`Custom operator mappings`),rest:Lu.optional().describe(`REST query adapter configuration`),graphql:Ru.optional().describe(`GraphQL query adapter configuration`),odata:zu.optional().describe(`OData query adapter configuration`)});var Bu=E([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Vu=h({type:E([`user`,`team`,`record`]).describe(`Mention target type`),id:r().describe(`Target ID`),name:r().describe(`Display name for rendering`),offset:P().int().min(0).describe(`Character offset in body text`),length:P().int().min(1).describe(`Length of mention token in body text`)}),Hu=h({field:r().describe(`Field machine name`),fieldLabel:r().optional().describe(`Field display label`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`),oldDisplayValue:r().optional().describe(`Human-readable old value`),newDisplayValue:r().optional().describe(`Human-readable new value`)}),Uu=h({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:C(r()).describe(`Users who reacted`),count:P().int().min(1).describe(`Total reaction count`)}),vee=h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`),avatarUrl:r().url().optional().describe(`Actor avatar URL`),source:r().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),Wu=E([`public`,`internal`,`private`]),Gu=h({id:r().describe(`Feed item ID`),type:Bu.describe(`Activity type`),object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID this feed item belongs to`),actor:vee.describe(`Who performed this action`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(Vu).optional().describe(`Mentioned users/teams/records`),changes:C(Hu).optional().describe(`Field-level changes`),reactions:C(Uu).optional().describe(`Emoji reactions on this item`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),replyCount:P().int().min(0).default(0).describe(`Number of replies`),pinned:S().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:r().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:r().optional().describe(`User ID who pinned the item`),starred:S().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:r().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Wu.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:r().datetime().describe(`Creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),editedAt:r().datetime().optional().describe(`When comment was last edited`),isEdited:S().default(!1).describe(`Whether comment has been edited`)});E([`all`,`comments_only`,`changes_only`,`tasks_only`]);var Ku=E([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),qu=E([`in_app`,`email`,`push`,`slack`]),Ju=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),userId:r().describe(`Subscribing user ID`),events:C(Ku).default([`all`]).describe(`Event types to receive notifications for`),channels:C(qu).default([`in_app`]).describe(`Notification delivery channels`),active:S().default(!0).describe(`Whether the subscription is active`),createdAt:r().datetime().describe(`Subscription creation timestamp`)}),Yu=h({object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID`)}),Xu=Yu.extend({feedId:r().describe(`Feed item ID`)}),Zu=E([`all`,`comments_only`,`changes_only`,`tasks_only`]);Yu.extend({type:Zu.default(`all`).describe(`Filter by feed item category`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of items to return`),cursor:r().optional().describe(`Cursor for pagination (opaque string from previous response)`)}),R.extend({data:h({items:C(Gu).describe(`Feed items in reverse chronological order`),total:P().int().optional().describe(`Total feed items matching filter`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more items are available`)})}),Yu.extend({type:Bu.describe(`Type of feed item to create`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(Vu).optional().describe(`Mentioned users, teams, or records`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),visibility:Wu.default(`public`).describe(`Visibility: public, internal, or private`)}),R.extend({data:Gu.describe(`The created feed item`)}),Xu.extend({body:r().optional().describe(`Updated rich text body`),mentions:C(Vu).optional().describe(`Updated mentions`),visibility:Wu.optional().describe(`Updated visibility`)}),R.extend({data:Gu.describe(`The updated feed item`)}),R.extend({data:h({feedId:r().describe(`ID of the deleted feed item`)})}),Xu.extend({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`)}),R.extend({data:h({reactions:C(Uu).describe(`Updated reaction list for the feed item`)})}),Xu.extend({emoji:r().describe(`Emoji character or shortcode to remove`)}),R.extend({data:h({reactions:C(Uu).describe(`Updated reaction list for the feed item`)})}),R.extend({data:h({feedId:r().describe(`ID of the pinned feed item`),pinned:S().describe(`Whether the item is now pinned`),pinnedAt:r().datetime().describe(`Timestamp when pinned`)})}),R.extend({data:h({feedId:r().describe(`ID of the unpinned feed item`),pinned:S().describe(`Whether the item is now pinned (should be false)`)})}),R.extend({data:h({feedId:r().describe(`ID of the starred feed item`),starred:S().describe(`Whether the item is now starred`),starredAt:r().datetime().describe(`Timestamp when starred`)})}),R.extend({data:h({feedId:r().describe(`ID of the unstarred feed item`),starred:S().describe(`Whether the item is now starred (should be false)`)})}),Yu.extend({query:r().min(1).describe(`Full-text search query against feed body content`),type:Zu.optional().describe(`Filter by feed item category`),actorId:r().optional().describe(`Filter by actor user ID`),dateFrom:r().datetime().optional().describe(`Filter feed items created after this timestamp`),dateTo:r().datetime().optional().describe(`Filter feed items created before this timestamp`),hasAttachments:S().optional().describe(`Filter for items with file attachments`),pinnedOnly:S().optional().describe(`Return only pinned items`),starredOnly:S().optional().describe(`Return only starred items`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of items to return`),cursor:r().optional().describe(`Cursor for pagination`)}),R.extend({data:h({items:C(Gu).describe(`Matching feed items sorted by relevance`),total:P().int().optional().describe(`Total matching items`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more items are available`)})}),Yu.extend({field:r().optional().describe(`Filter changelog to a specific field name`),actorId:r().optional().describe(`Filter changelog by actor user ID`),dateFrom:r().datetime().optional().describe(`Filter changes after this timestamp`),dateTo:r().datetime().optional().describe(`Filter changes before this timestamp`),limit:P().int().min(1).max(200).default(50).describe(`Maximum number of changelog entries to return`),cursor:r().optional().describe(`Cursor for pagination`)});var Qu=h({id:r().describe(`Changelog entry ID`),object:r().describe(`Object name`),recordId:r().describe(`Record ID`),actor:h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`)}).describe(`Who made the change`),changes:C(Hu).min(1).describe(`Field-level changes`),timestamp:r().datetime().describe(`When the change occurred`),source:r().optional().describe(`Change source (e.g., "API", "UI", "automation")`)});R.extend({data:h({entries:C(Qu).describe(`Changelog entries in reverse chronological order`),total:P().int().optional().describe(`Total changelog entries matching filter`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more entries are available`)})}),Yu.extend({events:C(Ku).default([`all`]).describe(`Event types to subscribe to`),channels:C(qu).default([`in_app`]).describe(`Notification delivery channels`)}),R.extend({data:Ju.describe(`The created or updated subscription`)}),R.extend({data:h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),unsubscribed:S().describe(`Whether the user was unsubscribed`)})}),E([`feed_item_not_found`,`feed_permission_denied`,`feed_item_not_editable`,`feed_invalid_parent`,`reaction_already_exists`,`reaction_not_found`,`subscription_already_exists`,`subscription_not_found`,`invalid_feed_type`,`feed_already_pinned`,`feed_not_pinned`,`feed_already_starred`,`feed_not_starred`,`feed_search_query_too_short`]);var $u=E([`csv`,`json`,`jsonl`,`xlsx`,`parquet`]),ed=E([`pending`,`processing`,`completed`,`failed`,`cancelled`,`expired`]);h({object:r().describe(`Object name to export`),format:$u.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Specific fields to include (omit for all fields)`),filter:d(r(),u()).optional().describe(`Filter criteria for records to export`),sort:C(h({field:r().describe(`Field name to sort by`),direction:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`)})).optional().describe(`Sort order for exported records`),limit:P().int().min(1).optional().describe(`Maximum number of records to export`),includeHeaders:S().default(!0).describe(`Include header row (CSV/XLSX)`),encoding:r().default(`utf-8`).describe(`Character encoding for the export file`),templateId:r().optional().describe(`Export template ID for predefined field mappings`)}),R.extend({data:h({jobId:r().describe(`Export job ID`),status:ed.describe(`Initial job status`),estimatedRecords:P().int().optional().describe(`Estimated total records`),createdAt:r().datetime().describe(`Job creation timestamp`)})}),R.extend({data:h({jobId:r().describe(`Export job ID`),status:ed.describe(`Current job status`),format:$u.describe(`Export format`),totalRecords:P().int().optional().describe(`Total records to export`),processedRecords:P().int().describe(`Records processed so far`),percentComplete:P().min(0).max(100).describe(`Export progress percentage`),fileSize:P().int().optional().describe(`Current file size in bytes`),downloadUrl:r().optional().describe(`Presigned download URL (available when status is "completed")`),downloadExpiresAt:r().datetime().optional().describe(`Download URL expiration timestamp`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`)}).optional().describe(`Error details if job failed`),startedAt:r().datetime().optional().describe(`Processing start timestamp`),completedAt:r().datetime().optional().describe(`Completion timestamp`)})});var td=E([`strict`,`lenient`,`dry_run`]),nd=E([`skip`,`update`,`create_new`,`fail`]);h({mode:td.default(`strict`).describe(`Validation mode for the import`),deduplication:h({strategy:nd.default(`skip`).describe(`How to handle duplicate records`),matchFields:C(r()).min(1).describe(`Fields used to identify duplicates (e.g., "email", "external_id")`)}).optional().describe(`Deduplication configuration`),maxErrors:P().int().min(1).default(100).describe(`Maximum validation errors before aborting`),trimWhitespace:S().default(!0).describe(`Trim leading/trailing whitespace from string fields`),dateFormat:r().optional().describe(`Expected date format in import data (e.g., "YYYY-MM-DD")`),nullValues:C(r()).optional().describe(`Strings to treat as null (e.g., ["", "N/A", "null"])`)}),R.extend({data:h({totalRecords:P().int().describe(`Total records in import file`),validRecords:P().int().describe(`Records that passed validation`),invalidRecords:P().int().describe(`Records that failed validation`),duplicateRecords:P().int().describe(`Duplicate records detected`),errors:C(h({row:P().int().describe(`Row number in the import file`),field:r().optional().describe(`Field that failed validation`),code:r().describe(`Validation error code`),message:r().describe(`Validation error message`)})).describe(`List of validation errors`),preview:C(d(r(),u())).optional().describe(`Preview of first N valid records (for dry_run mode)`)})});var rd=h({sourceField:r().describe(`Field name in the source data (import) or object (export)`),targetField:r().describe(`Field name in the target object (import) or file column (export)`),targetLabel:r().optional().describe(`Display label for the target column (export)`),transform:E([`none`,`uppercase`,`lowercase`,`trim`,`date_format`,`lookup`]).default(`none`).describe(`Transformation to apply during mapping`),defaultValue:u().optional().describe(`Default value if source field is null/empty`),required:S().default(!1).describe(`Whether this field is required (import validation)`)});h({id:r().optional().describe(`Template ID (generated on save)`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template machine name (snake_case)`),label:r().describe(`Human-readable template label`),description:r().optional().describe(`Template description`),object:r().describe(`Target object name`),direction:E([`import`,`export`,`bidirectional`]).describe(`Template direction`),format:$u.optional().describe(`Default file format for this template`),mappings:C(rd).min(1).describe(`Field mapping entries`),createdAt:r().datetime().optional().describe(`Template creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the template`)}),h({id:r().optional().describe(`Scheduled export ID`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Schedule name (snake_case)`),label:r().optional().describe(`Human-readable label`),object:r().describe(`Object name to export`),format:$u.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Fields to include`),filter:d(r(),u()).optional().describe(`Record filter criteria`),templateId:r().optional().describe(`Export template ID for field mappings`),schedule:h({cronExpression:r().describe(`Cron expression for schedule`),timezone:r().default(`UTC`).describe(`IANA timezone`)}).describe(`Schedule timing configuration`),delivery:h({method:E([`email`,`storage`,`webhook`]).describe(`How to deliver the export file`),recipients:C(r()).optional().describe(`Email recipients (for email delivery)`),storagePath:r().optional().describe(`Storage path (for storage delivery)`),webhookUrl:r().optional().describe(`Webhook URL (for webhook delivery)`)}).describe(`Export delivery configuration`),enabled:S().default(!0).describe(`Whether the scheduled export is active`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution`),createdAt:r().datetime().optional().describe(`Creation timestamp`),createdBy:r().optional().describe(`User who created the schedule`)}),h({jobId:r().describe(`Export job ID`)}),R.extend({data:h({jobId:r().describe(`Export job ID`),downloadUrl:r().describe(`Presigned download URL`),fileName:r().describe(`Suggested file name`),fileSize:P().int().describe(`File size in bytes`),format:$u.describe(`Export file format`),expiresAt:r().datetime().describe(`Download URL expiration timestamp`),checksum:r().optional().describe(`File checksum (SHA-256)`)})}),h({object:r().optional().describe(`Filter by object name`),status:ed.optional().describe(`Filter by job status`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of jobs to return`),cursor:r().optional().describe(`Pagination cursor from a previous response`)});var id=h({jobId:r().describe(`Export job ID`),object:r().describe(`Object name that was exported`),status:ed.describe(`Current job status`),format:$u.describe(`Export file format`),totalRecords:P().int().optional().describe(`Total records exported`),fileSize:P().int().optional().describe(`File size in bytes`),createdAt:r().datetime().describe(`Job creation timestamp`),completedAt:r().datetime().optional().describe(`Completion timestamp`),createdBy:r().optional().describe(`User who initiated the export`)});R.extend({data:h({jobs:C(id).describe(`List of export jobs`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more jobs are available`)})}),h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Schedule name (snake_case)`),label:r().optional().describe(`Human-readable label`),object:r().describe(`Object name to export`),format:$u.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Fields to include`),filter:d(r(),u()).optional().describe(`Record filter criteria`),templateId:r().optional().describe(`Export template ID for field mappings`),schedule:h({cronExpression:r().describe(`Cron expression for schedule`),timezone:r().default(`UTC`).describe(`IANA timezone`)}).describe(`Schedule timing configuration`),delivery:h({method:E([`email`,`storage`,`webhook`]).describe(`How to deliver the export file`),recipients:C(r()).optional().describe(`Email recipients (for email delivery)`),storagePath:r().optional().describe(`Storage path (for storage delivery)`),webhookUrl:r().optional().describe(`Webhook URL (for webhook delivery)`)}).describe(`Export delivery configuration`)}),R.extend({data:h({id:r().describe(`Scheduled export ID`),name:r().describe(`Schedule name`),enabled:S().describe(`Whether the schedule is active`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution`),createdAt:r().datetime().describe(`Creation timestamp`)})}),h({jobId:r()}),h({jobId:r()});var ad=E([`start`,`end`,`decision`,`assignment`,`loop`,`create_record`,`update_record`,`delete_record`,`get_record`,`http_request`,`script`,`screen`,`wait`,`subflow`,`connector_action`,`parallel_gateway`,`join_gateway`,`boundary_event`]),od=h({name:r().describe(`Variable name`),type:r().describe(`Data type (text, number, boolean, object, list)`),isInput:S().default(!1).describe(`Is input parameter`),isOutput:S().default(!1).describe(`Is output parameter`)}),sd=h({id:r().describe(`Node unique ID`),type:ad.describe(`Action type`),label:r().describe(`Node label`),config:d(r(),u()).optional().describe(`Node configuration`),connectorConfig:h({connectorId:r(),actionId:r(),input:d(r(),u()).describe(`Mapped inputs for the action`)}).optional(),position:h({x:P(),y:P()}).optional(),timeoutMs:P().int().min(0).optional().describe(`Maximum execution time for this node in milliseconds`),inputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Parameter type`),required:S().default(!1).describe(`Whether the parameter is required`),description:r().optional().describe(`Parameter description`)})).optional().describe(`Input parameter schema for this node`),outputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Output type`),description:r().optional().describe(`Output description`)})).optional().describe(`Output schema declaration for this node`),waitEventConfig:h({eventType:E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`What kind of event resumes the execution`),timerDuration:r().optional().describe(`ISO 8601 duration (e.g., "PT1H") or wait time for timer events`),signalName:r().optional().describe(`Named signal or webhook event to wait for`),timeoutMs:P().int().min(0).optional().describe(`Maximum wait time before timeout (ms)`),onTimeout:E([`fail`,`continue`]).default(`fail`).describe(`Behavior when the wait times out`)}).optional().describe(`Configuration for wait node event resumption`),boundaryConfig:h({attachedToNodeId:r().describe(`Host node ID this boundary event monitors`),eventType:E([`error`,`timer`,`signal`,`cancel`]).describe(`Boundary event trigger type`),interrupting:S().default(!0).describe(`If true, the host activity is cancelled when this event fires`),errorCode:r().optional().describe(`Specific error code to catch (empty = catch all errors)`),timerDuration:r().optional().describe(`ISO 8601 duration for timer boundary events`),signalName:r().optional().describe(`Named signal to catch`)}).optional().describe(`Configuration for boundary events attached to host nodes`)}),cd=h({id:r().describe(`Edge unique ID`),source:r().describe(`Source Node ID`),target:r().describe(`Target Node ID`),condition:r().optional().describe(`Expression returning boolean used for branching`),type:E([`default`,`fault`,`conditional`]).default(`default`).describe(`Connection type: default (normal flow), fault (error path), or conditional (expression-guarded)`),label:r().optional().describe(`Label on the connector`),isDefault:S().default(!1).describe(`Marks this edge as the default path when no other conditions match`)}),ld=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name`),label:r().describe(`Flow label`),description:r().optional(),version:P().int().default(1).describe(`Version number`),status:E([`draft`,`active`,`obsolete`,`invalid`]).default(`draft`).describe(`Deployment status`),template:S().default(!1).describe(`Is logic template (Subflow)`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).describe(`Flow type`),variables:C(od).optional().describe(`Flow variables`),nodes:C(sd).describe(`Flow nodes`),edges:C(cd).describe(`Flow connections`),active:S().default(!1).describe(`Is active (Deprecated: use status)`),runAs:E([`system`,`user`]).default(`user`).describe(`Execution context`),errorHandling:h({strategy:E([`fail`,`retry`,`continue`]).default(`fail`).describe(`How to handle node execution errors`),maxRetries:P().int().min(0).max(10).default(0).describe(`Number of retry attempts (only for retry strategy)`),retryDelayMs:P().int().min(0).default(1e3).describe(`Delay between retries in milliseconds`),backoffMultiplier:P().min(1).default(1).describe(`Multiplier for exponential backoff between retries`),maxRetryDelayMs:P().int().min(0).default(3e4).describe(`Maximum delay between retries in milliseconds`),jitter:S().default(!1).describe(`Add random jitter to retry delay to avoid thundering herd`),fallbackNodeId:r().optional().describe(`Node ID to jump to on unrecoverable error`)}).optional().describe(`Flow-level error handling configuration`)});h({flowName:r().describe(`Flow machine name`),version:P().int().min(1).describe(`Version number`),definition:ld.describe(`Complete flow definition snapshot`),createdAt:r().datetime().describe(`When this version was created`),createdBy:r().optional().describe(`User who created this version`),changeNote:r().optional().describe(`Description of what changed in this version`)});var ud=E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]),dd=h({nodeId:r().describe(`Node ID that was executed`),nodeType:r().describe(`Node action type (e.g., "decision", "http_request")`),nodeLabel:r().optional().describe(`Human-readable node label`),status:E([`success`,`failure`,`skipped`]).describe(`Step execution result`),startedAt:r().datetime().describe(`When the step started`),completedAt:r().datetime().optional().describe(`When the step completed`),durationMs:P().int().min(0).optional().describe(`Step execution duration in milliseconds`),input:d(r(),u()).optional().describe(`Input data passed to the node`),output:d(r(),u()).optional().describe(`Output data produced by the node`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`)}).optional().describe(`Error details if step failed`),retryAttempt:P().int().min(0).optional().describe(`Retry attempt number (0 = first try)`)}),fd=h({id:r().describe(`Execution instance ID`),flowName:r().describe(`Machine name of the executed flow`),flowVersion:P().int().optional().describe(`Version of the flow that was executed`),status:ud.describe(`Current execution status`),trigger:h({type:r().describe(`Trigger type (e.g., "record_change", "schedule", "api", "manual")`),recordId:r().optional().describe(`Triggering record ID`),object:r().optional().describe(`Triggering object name`),userId:r().optional().describe(`User who triggered the execution`),metadata:d(r(),u()).optional().describe(`Additional trigger context`)}).describe(`What triggered this execution`),steps:C(dd).describe(`Ordered list of executed steps`),variables:d(r(),u()).optional().describe(`Final state of flow variables`),startedAt:r().datetime().describe(`Execution start timestamp`),completedAt:r().datetime().optional().describe(`Execution completion timestamp`),durationMs:P().int().min(0).optional().describe(`Total execution duration in milliseconds`),runAs:E([`system`,`user`]).optional().describe(`Execution context identity`),tenantId:r().optional().describe(`Tenant ID for multi-tenant isolation`)}),pd=E([`warning`,`error`,`critical`]);h({id:r().describe(`Error record ID`),executionId:r().describe(`Parent execution ID`),nodeId:r().optional().describe(`Node where the error occurred`),severity:pd.describe(`Error severity level`),code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),stack:r().optional().describe(`Stack trace for debugging`),context:d(r(),u()).optional().describe(`Additional diagnostic context (input data, config snapshot)`),timestamp:r().datetime().describe(`When the error occurred`),retryable:S().default(!1).describe(`Whether this error can be retried`),resolvedAt:r().datetime().optional().describe(`When the error was resolved (e.g., after successful retry)`)}),h({id:r().describe(`Checkpoint ID`),executionId:r().describe(`Parent execution ID`),flowName:r().describe(`Flow machine name`),currentNodeId:r().describe(`Node ID where execution is paused`),variables:d(r(),u()).describe(`Flow variable state at checkpoint`),completedNodeIds:C(r()).describe(`List of node IDs already executed`),createdAt:r().datetime().describe(`Checkpoint creation timestamp`),expiresAt:r().datetime().optional().describe(`Checkpoint expiration (auto-cleanup)`),reason:E([`wait`,`screen_input`,`approval`,`error`,`manual_pause`,`parallel_join`,`boundary_event`]).describe(`Why the execution was checkpointed`)}),h({maxConcurrent:P().int().min(1).default(1).describe(`Maximum number of concurrent executions allowed`),onConflict:E([`queue`,`reject`,`cancel_existing`]).default(`queue`).describe(`queue = enqueue for later, reject = fail immediately, cancel_existing = stop running instance`),lockScope:E([`global`,`per_record`,`per_user`]).default(`global`).describe(`Scope of the concurrency lock`),queueTimeoutMs:P().int().min(0).optional().describe(`Maximum time to wait in queue before timing out (ms)`)}),h({id:r().describe(`Schedule instance ID`),flowName:r().describe(`Flow machine name`),cronExpression:r().describe(`Cron expression (e.g., "0 9 * * MON-FRI")`),timezone:r().default(`UTC`).describe(`IANA timezone for cron evaluation`),status:E([`active`,`paused`,`disabled`,`expired`]).default(`active`).describe(`Current schedule status`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution timestamp`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),lastExecutionId:r().optional().describe(`Execution ID of the last run`),lastRunStatus:ud.optional().describe(`Status of the last run`),totalRuns:P().int().min(0).default(0).describe(`Total number of executions`),consecutiveFailures:P().int().min(0).default(0).describe(`Consecutive failed executions`),startDate:r().datetime().optional().describe(`Schedule effective start date`),endDate:r().datetime().optional().describe(`Schedule expiration date`),maxRuns:P().int().min(1).optional().describe(`Maximum total executions before auto-disable`),createdAt:r().datetime().describe(`Schedule creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the schedule`)});var md=h({name:r().describe(`Flow machine name (snake_case)`)});md.extend({runId:r().describe(`Execution run ID`)}),h({status:E([`draft`,`active`,`obsolete`,`invalid`]).optional().describe(`Filter by flow status`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).optional().describe(`Filter by flow type`),limit:P().int().min(1).max(100).default(50).describe(`Maximum number of flows to return`),cursor:r().optional().describe(`Cursor for pagination`)});var hd=h({name:r().describe(`Flow machine name`),label:r().describe(`Flow display label`),type:r().describe(`Flow type`),status:r().describe(`Flow deployment status`),version:P().int().describe(`Flow version number`),enabled:S().describe(`Whether the flow is enabled for execution`),nodeCount:P().int().optional().describe(`Number of nodes in the flow`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`)});R.extend({data:h({flows:C(hd).describe(`Flow summaries`),total:P().int().optional().describe(`Total matching flows`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more flows are available`)})}),R.extend({data:ld.describe(`Full flow definition`)}),R.extend({data:ld.describe(`The created flow definition`)}),md.extend({definition:ld.partial().describe(`Partial flow definition to update`)}),R.extend({data:ld.describe(`The updated flow definition`)}),R.extend({data:h({name:r().describe(`Name of the deleted flow`),deleted:S().describe(`Whether the flow was deleted`)})}),md.extend({record:d(r(),u()).optional().describe(`Record that triggered the automation`),object:r().optional().describe(`Object name the record belongs to`),event:r().optional().describe(`Trigger event type`),userId:r().optional().describe(`User who triggered the automation`),params:d(r(),u()).optional().describe(`Additional contextual data`)}),R.extend({data:h({success:S().describe(`Whether the automation completed successfully`),output:u().optional().describe(`Output data from the automation`),error:r().optional().describe(`Error message if execution failed`),durationMs:P().optional().describe(`Execution duration in milliseconds`)})}),md.extend({enabled:S().describe(`Whether to enable (true) or disable (false) the flow`)}),R.extend({data:h({name:r().describe(`Flow name`),enabled:S().describe(`New enabled state`)})}),md.extend({status:E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]).optional().describe(`Filter by execution status`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of runs to return`),cursor:r().optional().describe(`Cursor for pagination`)}),R.extend({data:h({runs:C(fd).describe(`Execution run logs`),total:P().int().optional().describe(`Total matching runs`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more runs are available`)})}),R.extend({data:fd.describe(`Full execution log with step details`)}),E([`flow_not_found`,`flow_already_exists`,`flow_validation_failed`,`flow_disabled`,`execution_not_found`,`execution_failed`,`execution_timeout`,`node_executor_not_found`,`concurrent_execution_limit`]);var gd=E([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),_d=h({type:r().describe(`Metadata type`),name:r().describe(`Metadata name`),changeType:gd.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:S().default(!1).describe(`Whether this change may conflict with customizations`),summary:r().optional().describe(`Human-readable change summary`),previousName:r().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),vd=E([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),yd=h({packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Currently installed version`),toVersion:r().describe(`Target upgrade version`),impactLevel:vd.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:C(_d).describe(`All metadata changes`),affectedCustomizations:P().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:S().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:C(r()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:C(h({packageId:r(),fromVersion:r(),toVersion:r()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:P().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:r().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`);h({id:r().describe(`Snapshot identifier`),packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Target upgrade version`),tenantId:r().optional().describe(`Tenant identifier`),previousManifest:Ls.describe(`Complete manifest of the previous package version`),metadataSnapshot:C(h({type:r(),name:r(),metadata:d(r(),u())})).describe(`Snapshot of all package metadata`),customizationSnapshot:C(d(r(),u())).optional().describe(`Snapshot of customer customizations`),createdAt:r().datetime().describe(`Snapshot creation timestamp`),expiresAt:r().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:Ls.optional().describe(`New manifest (if installing from local)`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`);var bd=E([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`);h({success:S().describe(`Whether the upgrade succeeded`),phase:bd.describe(`Current upgrade phase`),plan:yd.optional().describe(`Upgrade plan`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r(),baseValue:u(),incomingValue:u(),customValue:u()})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if upgrade failed`),message:r().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),h({packageId:r().describe(`Package ID to rollback`),snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Version restored to`),message:r().optional().describe(`Rollback status message`)}).describe(`Rollback package response`);var xd=E([`objects`,`views`,`pages`,`flows`,`dashboards`,`permissions`,`agents`,`reports`,`actions`,`translations`,`themes`,`datasets`,`apis`,`triggers`,`workflows`]).describe(`Metadata category within the artifact`),Sd=h({path:r().describe(`Relative file path within the artifact`),size:P().int().nonnegative().describe(`File size in bytes`),category:xd.optional().describe(`Metadata category this file belongs to`)}).describe(`A single file entry within the artifact`),Cd=h({algorithm:E([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm used for checksums`),files:d(r(),r().regex(/^[a-f0-9]+$/)).describe(`File path to hash value mapping`)}).describe(`Checksum manifest for artifact integrity verification`),wd=h({algorithm:E([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).default(`RSA-SHA256`).describe(`Signing algorithm used`),publicKeyRef:r().describe(`Public key reference (URL or fingerprint) for signature verification`),signature:r().describe(`Base64-encoded digital signature`),signedAt:r().datetime().optional().describe(`ISO 8601 timestamp of when the artifact was signed`),signedBy:r().optional().describe(`Identity of the signer (publisher ID or email)`)}).describe(`Digital signature for artifact authenticity verification`),Td=h({formatVersion:r().regex(/^\d+\.\d+$/).default(`1.0`).describe(`Artifact format version (e.g. "1.0")`),packageId:r().describe(`Package identifier from manifest`),version:r().describe(`Package version from manifest`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Archive format of the artifact`),size:P().int().positive().optional().describe(`Total artifact file size in bytes`),builtAt:r().datetime().describe(`ISO 8601 timestamp of when the artifact was built`),builtWith:r().optional().describe(`Build tool identifier (e.g. "os-cli@3.2.0")`),files:C(Sd).optional().describe(`List of files contained in the artifact`),metadataCategories:C(xd).optional().describe(`Metadata categories included in this artifact`),checksums:Cd.optional().describe(`SHA256 checksums for artifact integrity verification`),signature:wd.optional().describe(`Digital signature for artifact authenticity verification`)}).describe(`Package artifact structure and metadata`),Ed=E([`unverified`,`pending`,`verified`,`trusted`,`partner`]).describe(`Publisher verification status`);h({id:r().describe(`Publisher ID`),name:r().describe(`Publisher display name`),type:E([`individual`,`organization`]).describe(`Publisher type`),verification:Ed.default(`unverified`).describe(`Publisher verification status`),email:r().email().optional().describe(`Contact email`),website:r().url().optional().describe(`Publisher website`),logoUrl:r().url().optional().describe(`Publisher logo URL`),description:r().optional().describe(`Publisher description`),registeredAt:r().datetime().optional().describe(`Publisher registration timestamp`)}).describe(`Developer or organization that publishes packages`);var Dd=h({url:r().url().describe(`Artifact download URL`),sha256:r().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum`),size:P().int().positive().describe(`Artifact size in bytes`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Artifact format`),uploadedAt:r().datetime().describe(`Upload timestamp`)}).describe(`Reference to a downloadable package artifact`);h({downloadUrl:r().url().describe(`Artifact download URL (may be pre-signed)`),sha256:r().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum for verification`),size:P().int().positive().describe(`Artifact size in bytes`),format:E([`tgz`,`zip`]).describe(`Artifact format`),expiresAt:r().datetime().optional().describe(`URL expiration timestamp for pre-signed URLs`)}).describe(`Artifact download response with integrity metadata`);var Od=E([`crm`,`erp`,`hr`,`finance`,`project`,`collaboration`,`analytics`,`integration`,`automation`,`ai`,`security`,`developer-tools`,`ui-theme`,`storage`,`other`]).describe(`Marketplace package category`),kd=E([`draft`,`submitted`,`in-review`,`approved`,`published`,`rejected`,`suspended`,`deprecated`,`unlisted`]).describe(`Marketplace listing status`),Ad=E([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).describe(`Package pricing model`),jd=h({id:r().describe(`Listing ID (matches package manifest ID)`),packageId:r().describe(`Package identifier`),publisherId:r().describe(`Publisher ID`),status:kd.default(`draft`).describe(`Publication state: draft, published, under-review, suspended, deprecated, or unlisted`),name:r().describe(`Display name`),tagline:r().max(120).optional().describe(`Short tagline (max 120 chars)`),description:r().optional().describe(`Full description (Markdown)`),category:Od.describe(`Package category`),tags:C(r()).optional().describe(`Search tags`),iconUrl:r().url().optional().describe(`Package icon URL`),screenshots:C(h({url:r().url(),caption:r().optional()})).optional().describe(`Screenshots`),documentationUrl:r().url().optional().describe(`Documentation URL`),supportUrl:r().url().optional().describe(`Support URL`),repositoryUrl:r().url().optional().describe(`Source repository URL`),pricing:Ad.default(`free`).describe(`Pricing model`),priceInCents:P().int().min(0).optional().describe(`Price in cents (e.g. 999 = $9.99)`),latestVersion:r().describe(`Latest published version`),minPlatformVersion:r().optional().describe(`Minimum ObjectStack platform version`),versions:C(h({version:r().describe(`Version string`),releaseDate:r().datetime().describe(`Release date`),releaseNotes:r().optional().describe(`Release notes`),minPlatformVersion:r().optional().describe(`Minimum platform version`),deprecated:S().default(!1).describe(`Whether this version is deprecated`),artifact:Dd.optional().describe(`Downloadable artifact for this version`)})).optional().describe(`Published versions`),stats:h({totalInstalls:P().int().min(0).default(0).describe(`Total installs`),activeInstalls:P().int().min(0).default(0).describe(`Active installs`),averageRating:P().min(0).max(5).optional().describe(`Average user rating (0-5)`),totalRatings:P().int().min(0).default(0).describe(`Total ratings count`),totalReviews:P().int().min(0).default(0).describe(`Total reviews count`)}).optional().describe(`Aggregate marketplace statistics`),publishedAt:r().datetime().optional().describe(`First published timestamp`),updatedAt:r().datetime().optional().describe(`Last updated timestamp`)}).describe(`Public-facing package listing on the marketplace`);h({id:r().describe(`Submission ID`),packageId:r().describe(`Package identifier`),version:r().describe(`Version being submitted`),publisherId:r().describe(`Publisher submitting`),status:E([`pending`,`scanning`,`in-review`,`changes-requested`,`approved`,`rejected`]).default(`pending`).describe(`Review status`),artifactUrl:r().describe(`Package artifact URL for review`),releaseNotes:r().optional().describe(`Release notes for this version`),isNewListing:S().default(!1).describe(`Whether this is a new listing submission`),scanResults:h({passed:S(),securityScore:P().min(0).max(100).optional(),compatibilityCheck:S().optional(),issues:C(h({severity:E([`critical`,`high`,`medium`,`low`,`info`]),message:r(),file:r().optional(),line:P().optional()})).optional()}).optional().describe(`Automated scan results`),reviewerNotes:r().optional().describe(`Notes from the platform reviewer`),submittedAt:r().datetime().optional().describe(`Submission timestamp`),reviewedAt:r().datetime().optional().describe(`Review completion timestamp`)}).describe(`Developer submission of a package version for review`),h({query:r().optional().describe(`Full-text search query`),category:Od.optional().describe(`Filter by category`),tags:C(r()).optional().describe(`Filter by tags`),pricing:Ad.optional().describe(`Filter by pricing model`),publisherVerification:Ed.optional().describe(`Filter by publisher verification level`),sortBy:E([`relevance`,`popularity`,`rating`,`newest`,`updated`,`name`]).default(`relevance`).describe(`Sort field`),sortDirection:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(100).default(20).describe(`Items per page`),platformVersion:r().optional().describe(`Filter by platform version compatibility`)}).describe(`Marketplace search request`),h({items:C(jd).describe(`Search result listings`),total:P().int().min(0).describe(`Total matching results`),page:P().int().min(1).describe(`Current page number`),pageSize:P().int().min(1).describe(`Items per page`),facets:h({categories:C(h({category:Od,count:P().int().min(0)})).optional(),pricing:C(h({model:Ad,count:P().int().min(0)})).optional()}).optional().describe(`Aggregation facets for refining search`)}).describe(`Marketplace search response`),h({listingId:r().describe(`Marketplace listing ID`),version:r().optional().describe(`Version to install`),licenseKey:r().optional().describe(`License key for paid packages`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),artifactRef:Dd.optional().describe(`Artifact reference for direct installation`),tenantId:r().optional().describe(`Tenant identifier`)}).describe(`Install from marketplace request`),h({success:S().describe(`Whether installation succeeded`),packageId:r().optional().describe(`Installed package identifier`),version:r().optional().describe(`Installed version`),message:r().optional().describe(`Installation status message`)}).describe(`Install from marketplace response`);var Md=h({packageId:r().describe(`Package identifier`)});h({status:E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).optional().describe(`Filter by package status`),enabled:S().optional().describe(`Filter by enabled state`),limit:P().int().min(1).max(100).default(50).describe(`Maximum number of packages to return`),cursor:r().optional().describe(`Cursor for pagination`)}).describe(`List installed packages request`),R.extend({data:h({packages:C(Us).describe(`Installed packages`),total:P().int().optional().describe(`Total matching packages`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more packages are available`)})}).describe(`List installed packages response`),R.extend({data:Us.describe(`Installed package details`)}).describe(`Get installed package response`),h({manifest:Ls.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`),artifactRef:Dd.optional().describe(`Artifact reference for marketplace installation`)}).describe(`Install package request`),R.extend({data:h({package:Us.describe(`Installed package details`),dependencyResolution:Vs.optional().describe(`Dependency resolution result`),namespaceConflicts:C(h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package name`),suggestion:r().optional().describe(`Suggested alternative`)})).optional().describe(`Namespace conflicts detected`),message:r().optional().describe(`Installation status message`)})}).describe(`Install package response`),h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:Ls.optional().describe(`New manifest for the target version`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`),R.extend({data:h({success:S().describe(`Whether the upgrade succeeded`),phase:r().describe(`Current upgrade phase`),plan:yd.optional().describe(`Upgrade plan that was executed`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r().describe(`Conflict path`),baseValue:u().describe(`Base value`),incomingValue:u().describe(`Incoming value`),customValue:u().describe(`Custom value`)})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if failed`),message:r().optional().describe(`Human-readable status message`)})}).describe(`Upgrade package response`),h({manifest:Ls.describe(`Package manifest to resolve dependencies for`),platformVersion:r().optional().describe(`Current platform version for compatibility filtering`)}).describe(`Resolve dependencies request`),R.extend({data:Vs.describe(`Dependency resolution result with topological sort`)}).describe(`Resolve dependencies response`),h({artifact:Td.describe(`Package artifact metadata`),sha256:r().regex(/^[a-f0-9]{64}$/).optional().describe(`SHA256 checksum of the uploaded file`),token:r().optional().describe(`Publisher authentication token`),releaseNotes:r().optional().describe(`Release notes for this version`)}).describe(`Upload artifact request`),R.extend({data:h({success:S().describe(`Whether the upload succeeded`),artifactRef:Dd.optional().describe(`Artifact reference in the registry`),submissionId:r().optional().describe(`Marketplace submission ID for review tracking`),message:r().optional().describe(`Upload status message`)})}).describe(`Upload artifact response`),Md.extend({snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),R.extend({data:h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Restored version`),message:r().optional().describe(`Rollback status message`)})}).describe(`Rollback package response`),R.extend({data:h({packageId:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)})}).describe(`Uninstall package response`),E([`package_not_found`,`package_already_installed`,`version_not_found`,`dependency_conflict`,`namespace_conflict`,`platform_incompatible`,`artifact_invalid`,`checksum_mismatch`,`signature_invalid`,`upgrade_failed`,`rollback_failed`,`snapshot_not_found`,`upload_failed`]);var Nd=e({EOL:()=>` +`,EventEmitter:()=>Pd,Readable:()=>Ld,Stats:()=>uf,Stream:()=>Id,StringDecoder:()=>Bd,Transform:()=>zd,Writable:()=>Rd,access:()=>Cf,accessSync:()=>wf,arch:()=>Jd,basename:()=>tf,constants:()=>bf,copyFile:()=>jf,copyFileSync:()=>Mf,createHash:()=>Bf,createReadStream:()=>Nf,createWriteStream:()=>Pf,default:()=>Fd,dirname:()=>bee,endianness:()=>qd,existsSync:()=>Qd,extname:()=>nf,fileURLToPath:()=>ff,homedir:()=>Kd,isAbsolute:()=>af,join:()=>$d,lstat:()=>xf,lstatSync:()=>Zd,mkdir:()=>Tf,mkdirSync:()=>Ef,normalize:()=>of,open:()=>lf,pathToFileURL:()=>pf,platform:()=>Ud,posix:()=>sf,promises:()=>Vd,randomUUID:()=>Vf,readFile:()=>If,readFileSync:()=>Yd,readdir:()=>mf,readdirSync:()=>hf,readlink:()=>gf,readlinkSync:()=>_f,realpath:()=>vf,realpathSync:()=>yf,relative:()=>rf,release:()=>Wd,rename:()=>Rf,renameSync:()=>zf,resolve:()=>ef,rmdir:()=>Df,rmdirSync:()=>Of,sep:()=>`/`,stat:()=>Sf,statSync:()=>yee,tmpdir:()=>Gd,type:()=>Hd,unlink:()=>kf,unlinkSync:()=>Af,unwatchFile:()=>xee,watch:()=>Ff,watchFile:()=>df,win32:()=>cf,writeFile:()=>Lf,writeFileSync:()=>Xd}),Pd=class{on(){return this}off(){return this}emit(){return!0}once(){return this}addListener(){return this}removeListener(){return this}removeAllListeners(){return this}},Fd={EventEmitter:Pd},Id=class extends Pd{pipe(){return this}},Ld=class extends Id{},Rd=class extends Id{},zd=class extends Id{},Bd=class{write(){return``}end(){return``}},Vd={readFile:async()=>``,writeFile:async()=>{},stat:async()=>({isDirectory:()=>!1,isFile:()=>!1}),mkdir:async()=>{},rm:async()=>{},access:async()=>{throw Error(`ENOENT: no such file or directory (polyfill)`)}},Hd=()=>`Browser`,Ud=()=>`browser`,Wd=()=>`1.0.0`,Gd=()=>`/tmp`,Kd=()=>`/`,qd=()=>`LE`,Jd=()=>`javascript`,Yd=()=>``,Xd=()=>{},yee=()=>({isDirectory:()=>!1,isFile:()=>!1,isSymbolicLink:()=>!1}),Zd=()=>({isDirectory:()=>!1,isFile:()=>!1,isSymbolicLink:()=>!1}),Qd=()=>!1,$d=(...e)=>e.join(`/`),ef=(...e)=>e.join(`/`),bee=e=>e,tf=e=>e,nf=e=>``,rf=()=>``,af=()=>!1,of=e=>e,sf={},cf={},lf=async()=>({close:async()=>{}}),uf=class{isDirectory(){return!1}isFile(){return!1}isSymbolicLink(){return!1}},df=()=>{},xee=()=>{},ff=()=>``,pf=()=>``,mf=()=>{},hf=()=>[],gf=()=>{},_f=()=>``,vf=async()=>``,yf=()=>``;yf.native=()=>``;var bf={},xf=async()=>({isDirectory:()=>!1,isFile:()=>!1,isSymbolicLink:()=>!1}),Sf=async()=>({isDirectory:()=>!1,isFile:()=>!1,isSymbolicLink:()=>!1}),Cf=async()=>{throw Error(`ENOENT: no such file or directory (polyfill)`)},wf=()=>{throw Error(`ENOENT: no such file or directory (polyfill)`)},Tf=()=>{},Ef=()=>{},Df=()=>{},Of=()=>{},kf=()=>{},Af=()=>{},jf=()=>{},Mf=()=>{},Nf=()=>new Ld,Pf=()=>new Rd,Ff=()=>new Pd,If=async()=>``,Lf=async()=>{},Rf=async()=>{},zf=()=>{},Bf=()=>({update:()=>({digest:()=>``})}),Vf=()=>`00000000-0000-0000-0000-000000000000`,Hf=`modulepreload`,Uf=function(e,t){return new URL(e,t).href},Wf={},Gf=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Uf(t,n),t in Wf)return;Wf[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Hf,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Kf=Object.defineProperty,qf=(e,t)=>{for(var n in t)Kf(e,n,{get:t[n],enumerable:!0})},Jf=typeof process<`u`&&process.versions!=null&&process.versions.node!=null;function Yf(e,t){if(typeof process<`u`)return{}[e]||t;try{if(typeof globalThis<`u`)return{}[e]||t}catch{}return t}function Xf(e=0){Jf&&process.exit(e)}function Zf(){return Jf?process.memoryUsage():{heapUsed:0,heapTotal:0}}var Qf=class e{constructor(e={}){this.isNode=Jf,this.config={name:e.name,level:e.level??`info`,format:e.format??(this.isNode?`json`:`pretty`),redact:e.redact??[`password`,`token`,`secret`,`key`],sourceLocation:e.sourceLocation??!1,file:e.file,rotation:e.rotation??{maxSize:`10m`,maxFiles:5}},this.isNode&&this.initPinoLogger()}async initPinoLogger(){if(this.isNode)try{let{createRequire:e}=await Gf(async()=>{let{createRequire:e}=await import(`./__vite-browser-external-BJgzPGy7.js`).then(e=>t(e.default,1));return{createRequire:e}},__vite__mapDeps([0,1]),import.meta.url);this.require=e(import.meta.url);let n=this.require(`pino`),r={level:this.config.level,redact:{paths:this.config.redact,censor:`***REDACTED***`}};this.config.name&&(r.name=this.config.name);let i=[];if(this.config.format===`pretty`){let e=!1;try{this.require.resolve(`pino-pretty`),e=!0}catch{}e?i.push({target:`pino-pretty`,options:{colorize:!0,translateTime:`SYS:standard`,ignore:`pid,hostname`},level:this.config.level}):(console.warn(`[Logger] pino-pretty not found. Install it for pretty logging: pnpm add -D pino-pretty`),i.push({target:`pino/file`,options:{destination:1},level:this.config.level}))}else this.config.format,i.push({target:`pino/file`,options:{destination:1},level:this.config.level});this.config.file&&i.push({target:`pino/file`,options:{destination:this.config.file,mkdir:!0},level:this.config.level}),i.length>0&&(r.transport=i.length===1?i[0]:{targets:i}),this.pinoInstance=n(r),this.pinoLogger=this.pinoInstance}catch(e){console.warn(`[Logger] Pino not available, falling back to console:`,e),this.pinoLogger=null}}redactSensitive(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?[...e]:{...e};for(let e in t){let n=e.toLowerCase();this.config.redact.some(e=>n.includes(e.toLowerCase()))?t[e]=`***REDACTED***`:typeof t[e]==`object`&&t[e]!==null&&(t[e]=this.redactSensitive(t[e]))}return t}formatBrowserLog(e,t,n){if(this.config.format===`json`)return JSON.stringify({timestamp:new Date().toISOString(),level:e,message:t,...n});if(this.config.format===`text`){let r=[new Date().toISOString(),e.toUpperCase(),t];return n&&Object.keys(n).length>0&&r.push(JSON.stringify(n)),r.join(` | `)}let r=`${{debug:`\x1B[36m`,info:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`,fatal:`\x1B[35m`,silent:``}[e]||``}[${e.toUpperCase()}] ${t}`;return n&&Object.keys(n).length>0&&(r+=` ${JSON.stringify(n,null,2)}`),r}logBrowser(e,t,n,r){let i=n?this.redactSensitive(n):void 0,a=r?{...i,error:{message:r.message,stack:r.stack}}:i,o=this.formatBrowserLog(e,t,a);console[e===`debug`?`debug`:e===`info`?`log`:e===`warn`?`warn`:e===`error`||e===`fatal`?`error`:`log`](o)}debug(e,t){this.isNode&&this.pinoLogger?this.pinoLogger.debug(t||{},e):this.logBrowser(`debug`,e,t)}info(e,t){this.isNode&&this.pinoLogger?this.pinoLogger.info(t||{},e):this.logBrowser(`info`,e,t)}warn(e,t){this.isNode&&this.pinoLogger?this.pinoLogger.warn(t||{},e):this.logBrowser(`warn`,e,t)}error(e,t,n){let r,i={};if(t instanceof Error?(r=t,i=n||{}):i=t||{},this.isNode&&this.pinoLogger){let t=r?{err:r,...i}:i;this.pinoLogger.error(t,e)}else this.logBrowser(`error`,e,i,r)}fatal(e,t,n){let r,i={};if(t instanceof Error?(r=t,i=n||{}):i=t||{},this.isNode&&this.pinoLogger){let t=r?{err:r,...i}:i;this.pinoLogger.fatal(t,e)}else this.logBrowser(`fatal`,e,i,r)}child(t){let n=new e(this.config);return this.isNode&&this.pinoInstance&&(n.pinoLogger=this.pinoInstance.child(t),n.pinoInstance=this.pinoInstance),n}withTrace(e,t){return this.child({traceId:e,spanId:t})}async destroy(){this.pinoLogger&&this.pinoLogger.flush&&await new Promise(e=>{this.pinoLogger.flush(()=>e())})}log(e,...t){this.info(e,t.length>0?{args:t}:void 0)}};function $f(e){return new Qf(e)}var ep=class{constructor(e){this.logger=e}validatePluginConfig(e,t){if(!e.configSchema)return this.logger.debug(`Plugin ${e.name} has no config schema - skipping validation`),t;try{let n=e.configSchema.parse(t);return this.logger.debug(`\u2705 Plugin config validated: ${e.name}`,{plugin:e.name,configKeys:Object.keys(t||{}).length}),n}catch(t){if(t instanceof o){let n=this.formatZodErrors(t),r=[`Plugin ${e.name} configuration validation failed:`,...n.map(e=>` - ${e.path}: ${e.message}`)].join(` +`);throw this.logger.error(r,void 0,{plugin:e.name,errors:n}),Error(r)}throw t}}validatePartialConfig(e,t){if(!e.configSchema)return t;try{let n=e.configSchema.partial().parse(t);return this.logger.debug(`\u2705 Partial config validated: ${e.name}`),n}catch(t){if(t instanceof o){let n=this.formatZodErrors(t),r=[`Plugin ${e.name} partial configuration validation failed:`,...n.map(e=>` - ${e.path}: ${e.message}`)].join(` +`);throw Error(r)}throw t}}getDefaultConfig(e){if(e.configSchema)try{let t=e.configSchema.parse({});return this.logger.debug(`Default config extracted: ${e.name}`),t}catch{this.logger.debug(`No default config available: ${e.name}`);return}}isConfigValid(e,t){return e.configSchema?e.configSchema.safeParse(t).success:!0}getConfigErrors(e,t){if(!e.configSchema)return[];let n=e.configSchema.safeParse(t);return n.success?[]:this.formatZodErrors(n.error)}formatZodErrors(e){return e.issues.map(e=>({path:e.path.join(`.`)||`root`,message:e.message}))}},tp=class{constructor(e){this.loadedPlugins=new Map,this.serviceFactories=new Map,this.serviceInstances=new Map,this.scopedServices=new Map,this.creating=new Set,this.logger=e,this.configValidator=new ep(e)}setContext(e){this.context=e}getServiceInstance(e){return this.serviceInstances.get(e)}async loadPlugin(e){let t=Date.now();try{this.logger.info(`Loading plugin: ${e.name}`);let n=this.toPluginMetadata(e);this.validatePluginStructure(n);let r=this.checkVersionCompatibility(n);if(!r.compatible)throw Error(`Version incompatible: ${r.message}`);n.configSchema&&this.validatePluginConfig(n),n.signature&&await this.verifyPluginSignature(n),this.loadedPlugins.set(n.name,n);let i=Date.now()-t;return this.logger.info(`Plugin loaded: ${e.name} (${i}ms)`),{success:!0,plugin:n,loadTime:i}}catch(n){return this.logger.error(`Failed to load plugin: ${e.name}`,n),{success:!1,error:n,loadTime:Date.now()-t}}}registerServiceFactory(e){if(this.serviceFactories.has(e.name))throw Error(`Service factory '${e.name}' already registered`);this.serviceFactories.set(e.name,e),this.logger.debug(`Service factory registered: ${e.name} (${e.lifecycle})`)}async getService(e,t){let n=this.serviceFactories.get(e);if(!n){let t=this.serviceInstances.get(e);if(!t)throw Error(`Service '${e}' not found`);return t}switch(n.lifecycle){case`singleton`:return await this.getSingletonService(n);case`transient`:return await this.createTransientService(n);case`scoped`:if(!t)throw Error(`Scope ID required for scoped service '${e}'`);return await this.getScopedService(n,t);default:throw Error(`Unknown service lifecycle: ${n.lifecycle}`)}}registerService(e,t){if(this.serviceInstances.has(e))throw Error(`Service '${e}' already registered`);this.serviceInstances.set(e,t)}replaceService(e,t){if(!this.hasService(e))throw Error(`Service '${e}' not found`);this.serviceInstances.set(e,t)}hasService(e){return this.serviceInstances.has(e)||this.serviceFactories.has(e)}detectCircularDependencies(){let e=[],t=new Set,n=new Set,r=(i,a=[])=>{if(n.has(i)){let t=[...a,i].join(` -> `);e.push(t);return}if(t.has(i))return;n.add(i);let o=this.serviceFactories.get(i);if(o?.dependencies)for(let e of o.dependencies)r(e,[...a,i]);n.delete(i),t.add(i)};for(let e of this.serviceFactories.keys())r(e);return e}async checkPluginHealth(e){let t=this.loadedPlugins.get(e);if(!t)return{healthy:!1,message:`Plugin not found`,lastCheck:new Date};if(!t.healthCheck)return{healthy:!0,message:`No health check defined`,lastCheck:new Date};try{return{...await t.healthCheck(),lastCheck:new Date}}catch(e){return{healthy:!1,message:`Health check failed: ${e.message}`,lastCheck:new Date}}}clearScope(e){this.scopedServices.delete(e),this.logger.debug(`Cleared scope: ${e}`)}getLoadedPlugins(){return new Map(this.loadedPlugins)}toPluginMetadata(e){let t=e;return t.version||=`0.0.0`,t}validatePluginStructure(e){if(!e.name)throw Error(`Plugin name is required`);if(!e.init)throw Error(`Plugin init function is required`);if(!this.isValidSemanticVersion(e.version))throw Error(`Invalid semantic version: ${e.version}`)}checkVersionCompatibility(e){let t=e.version;return this.isValidSemanticVersion(t)?{compatible:!0,pluginVersion:t}:{compatible:!1,pluginVersion:t,message:`Invalid semantic version format`}}isValidSemanticVersion(e){return/^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$/.test(e)}validatePluginConfig(e,t){if(e.configSchema){if(t===void 0){this.logger.debug(`Plugin ${e.name} has configuration schema (config validation postponed)`);return}this.configValidator.validatePluginConfig(e,t)}}async verifyPluginSignature(e){e.signature&&this.logger.debug(`Plugin ${e.name} has signature (use PluginSignatureVerifier for verification)`)}async getSingletonService(e){let t=this.serviceInstances.get(e.name);return t||(t=await this.createServiceInstance(e),this.serviceInstances.set(e.name,t),this.logger.debug(`Singleton service created: ${e.name}`)),t}async createTransientService(e){let t=await this.createServiceInstance(e);return this.logger.debug(`Transient service created: ${e.name}`),t}async getScopedService(e,t){this.scopedServices.has(t)||this.scopedServices.set(t,new Map);let n=this.scopedServices.get(t),r=n.get(e.name);return r||(r=await this.createServiceInstance(e),n.set(e.name,r),this.logger.debug(`Scoped service created: ${e.name} (scope: ${t})`)),r}async createServiceInstance(e){if(!this.context)throw Error(`[PluginLoader] Context not set - cannot create service '${e.name}'`);if(this.creating.has(e.name))throw Error(`Circular dependency detected: ${Array.from(this.creating).join(` -> `)} -> ${e.name}`);this.creating.add(e.name);try{return await e.factory(this.context)}finally{this.creating.delete(e.name)}}};function np(){let e=new Map,t=0,n=0;return{_fallback:!0,_serviceName:`cache`,async get(r){let i=e.get(r);if(!i||i.expires&&Date.now()>i.expires){e.delete(r),n++;return}return t++,i.value},async set(t,n,r){e.set(t,{value:n,expires:r?Date.now()+r*1e3:void 0})},async delete(t){return e.delete(t)},async has(t){return e.has(t)},async clear(){e.clear()},async stats(){return{hits:t,misses:n,keyCount:e.size}}}}function rp(){let e=new Map,t=0;return{_fallback:!0,_serviceName:`queue`,async publish(n,r){let i=`fallback-msg-${++t}`,a=e.get(n)??[];for(let e of a)e({id:i,data:r,attempts:1,timestamp:Date.now()});return i},async subscribe(t,n){e.set(t,[...e.get(t)??[],n])},async unsubscribe(t){e.delete(t)},async getQueueSize(){return 0},async purge(t){e.delete(t)}}}function ip(){let e=new Map;return{_fallback:!0,_serviceName:`job`,async schedule(t,n,r){e.set(t,{schedule:n,handler:r})},async cancel(t){e.delete(t)},async trigger(t,n){let r=e.get(t);r?.handler&&await r.handler({jobId:t,data:n})},async getExecutions(){return[]},async listJobs(){return[...e.keys()]}}}function ap(e,t){if(t.length===0)return;if(t.includes(e))return e;let n=e.toLowerCase(),r=t.find(e=>e.toLowerCase()===n);if(r)return r;let i=e.split(`-`)[0].toLowerCase(),a=t.find(e=>e.toLowerCase()===i);if(a)return a;let o=t.find(e=>e.split(`-`)[0].toLowerCase()===i);if(o)return o}function op(){let e=new Map,t=`en`;function n(e,t){let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=r[e]}return typeof r==`string`?r:void 0}function r(t){if(e.has(t))return e.get(t);let n=ap(t,[...e.keys()]);if(n)return e.get(n)}return{_fallback:!0,_serviceName:`i18n`,t(i,a,o){let s=r(a)??e.get(t),c=s?n(s,i):void 0;return c==null?i:o?c.replace(/\{\{(\w+)\}\}/g,(e,t)=>String(o[t]??`{{${t}}}`)):c},getTranslations(e){return r(e)??{}},loadTranslations(t,n){let r=e.get(t)??{};e.set(t,{...r,...n})},getLocales(){return[...e.keys()]},getDefaultLocale(){return t},setDefaultLocale(e){t=e}}}function sp(){let e=new Map;function t(t){let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}return{_fallback:!0,_serviceName:`metadata`,async register(e,n,r){t(e).set(n,r)},async get(e,n){return t(e).get(n)},async list(e){return Array.from(t(e).values())},async unregister(e,n){t(e).delete(n)},async exists(e,n){return t(e).has(n)},async listNames(e){return Array.from(t(e).keys())},async getObject(e){return t(`object`).get(e)},async listObjects(){return Array.from(t(`object`).values())}}}var cp={metadata:sp,cache:np,queue:rp,job:ip,i18n:op},lp=class{constructor(e={}){this.plugins=new Map,this.services=new Map,this.hooks=new Map,this.state=`idle`,this.startedPlugins=new Set,this.pluginStartTimes=new Map,this.shutdownHandlers=[],this.config={defaultStartupTimeout:3e4,gracefulShutdown:!0,shutdownTimeout:6e4,rollbackOnFailure:!0,...e},this.logger=$f(e.logger),this.pluginLoader=new tp(this.logger),this.context={registerService:(e,t)=>{this.registerService(e,t)},getService:e=>{let t=this.services.get(e);if(t)return t;let n=this.pluginLoader.getServiceInstance(e);if(n)return this.services.set(e,n),n;try{let t=this.pluginLoader.getService(e);if(t instanceof Promise)throw t.catch(()=>{}),Error(`Service '${e}' is async - use await`);return t}catch(t){throw t.message?.includes(`is async`)||t.message!==`Service '${e}' not found`?t:Error(`[Kernel] Service '${e}' not found`)}},replaceService:(e,t)=>{if(!(this.services.has(e)||this.pluginLoader.hasService(e)))throw Error(`[Kernel] Service '${e}' not found. Use registerService() to add new services.`);this.services.set(e,t),this.pluginLoader.replaceService(e,t),this.logger.info(`Service '${e}' replaced`,{service:e})},hook:(e,t)=>{this.hooks.has(e)||this.hooks.set(e,[]),this.hooks.get(e).push(t)},trigger:async(e,...t)=>{let n=this.hooks.get(e)||[];for(let e of n)await e(...t)},getServices:()=>new Map(this.services),logger:this.logger,getKernel:()=>this},this.pluginLoader.setContext(this.context),this.config.gracefulShutdown&&this.registerShutdownSignals()}async use(e){if(this.state!==`idle`)throw Error(`[Kernel] Cannot register plugins after bootstrap has started`);let t=await this.pluginLoader.loadPlugin(e);if(!t.success||!t.plugin)throw Error(`Failed to load plugin: ${e.name} - ${t.error?.message}`);let n=t.plugin;return this.plugins.set(n.name,n),this.logger.info(`Plugin registered: ${n.name}@${n.version}`,{plugin:n.name,version:n.version}),this}registerService(e,t){if(this.services.has(e))throw Error(`[Kernel] Service '${e}' already registered`);return this.services.set(e,t),this.pluginLoader.registerService(e,t),this.logger.info(`Service '${e}' registered`,{service:e}),this}registerServiceFactory(e,t,n=`singleton`,r){return this.pluginLoader.registerServiceFactory({name:e,factory:t,lifecycle:n,dependencies:r}),this}preInjectCoreFallbacks(){if(!this.config.skipSystemValidation){for(let[e,t]of Object.entries(pi))if(t===`core`&&!(this.services.has(e)||this.pluginLoader.hasService(e))){let t=cp[e];if(t){let n=t();this.registerService(e,n),this.logger.debug(`[Kernel] Pre-injected in-memory fallback for '${e}' before Phase 2`)}}}}validateSystemRequirements(){if(this.config.skipSystemValidation){this.logger.debug(`System requirement validation skipped`);return}this.logger.debug(`Validating system service requirements...`);let e=[],t=[];for(let[n,r]of Object.entries(pi))if(!(this.services.has(n)||this.pluginLoader.hasService(n)))if(r===`required`)this.logger.error(`CRITICAL: Required service missing: ${n}`),e.push(n);else if(r===`core`){let e=cp[n];if(e){let t=e();this.registerService(n,t),this.logger.warn(`Service '${n}' not provided \u2014 using in-memory fallback`)}else this.logger.warn(`CORE: Core service missing, functionality may be degraded: ${n}`),t.push(n)}else this.logger.info(`Info: Optional service not present: ${n}`);if(e.length>0){let t=`System failed to start. Missing critical services: ${e.join(`, `)}`;throw this.logger.error(t),Error(t)}t.length>0&&this.logger.warn(`System started with degraded capabilities. Missing core services: ${t.join(`, `)}`),this.logger.info(`System requirement check passed`)}async bootstrap(){if(this.state!==`idle`)throw Error(`[Kernel] Kernel already bootstrapped`);this.state=`initializing`,this.logger.info(`Bootstrap started`);try{let e=this.pluginLoader.detectCircularDependencies();e.length>0&&this.logger.warn(`Circular service dependencies detected:`,{cycles:e});let t=this.resolveDependencies();this.logger.info(`Phase 1: Init plugins`);for(let e of t)await this.initPluginWithTimeout(e);this.preInjectCoreFallbacks(),this.logger.info(`Phase 2: Start plugins`),this.state=`running`;for(let e of t){let t=await this.startPluginWithTimeout(e);if(!t.success&&(this.logger.error(`Plugin startup failed: ${e.name}`,t.error),this.config.rollbackOnFailure))throw this.logger.warn(`Rolling back started plugins...`),await this.rollbackStartedPlugins(),Error(`Plugin ${e.name} failed to start - rollback complete`)}this.validateSystemRequirements(),this.logger.debug(`Triggering kernel:ready hook`),await this.context.trigger(`kernel:ready`),this.logger.info(`✅ Bootstrap complete`)}catch(e){throw this.state=`stopped`,e}}async shutdown(){if(this.state===`stopped`||this.state===`stopping`){this.logger.warn(`Kernel already stopped or stopping`);return}if(this.state!==`running`)throw Error(`[Kernel] Kernel not running`);this.state=`stopping`,this.logger.info(`Graceful shutdown started`);try{let e=this.performShutdown(),t=new Promise((e,t)=>{setTimeout(()=>{t(Error(`Shutdown timeout exceeded`))},this.config.shutdownTimeout)});await Promise.race([e,t]),this.state=`stopped`,this.logger.info(`✅ Graceful shutdown complete`)}catch(e){throw this.logger.error(`Shutdown error - forcing stop`,e),this.state=`stopped`,e}finally{await this.logger.destroy()}}async checkPluginHealth(e){return await this.pluginLoader.checkPluginHealth(e)}async checkAllPluginsHealth(){let e=new Map;for(let t of this.plugins.keys()){let n=await this.checkPluginHealth(t);e.set(t,n)}return e}getPluginMetrics(){return new Map(this.pluginStartTimes)}getService(e){return this.context.getService(e)}async getServiceAsync(e,t){return await this.pluginLoader.getService(e,t)}isRunning(){return this.state===`running`}getState(){return this.state}async initPluginWithTimeout(e){let t=e.startupTimeout||this.config.defaultStartupTimeout;this.logger.debug(`Init: ${e.name}`,{plugin:e.name});let n=e.init(this.context),r=new Promise((n,r)=>{setTimeout(()=>{r(Error(`Plugin ${e.name} init timeout after ${t}ms`))},t)});await Promise.race([n,r])}async startPluginWithTimeout(e){if(!e.start)return{success:!0,pluginName:e.name};let t=e.startupTimeout||this.config.defaultStartupTimeout,n=Date.now();this.logger.debug(`Start: ${e.name}`,{plugin:e.name});try{let r=e.start(this.context),i=new Promise((n,r)=>{setTimeout(()=>{r(Error(`Plugin ${e.name} start timeout after ${t}ms`))},t)});await Promise.race([r,i]);let a=Date.now()-n;return this.startedPlugins.add(e.name),this.pluginStartTimes.set(e.name,a),this.logger.debug(`Plugin started: ${e.name} (${a}ms)`),{success:!0,pluginName:e.name,startTime:a}}catch(t){let r=Date.now()-n,i=t.message.includes(`timeout`);return{success:!1,pluginName:e.name,error:t,startTime:r,timedOut:i}}}async rollbackStartedPlugins(){let e=Array.from(this.startedPlugins).reverse();for(let t of e){let e=this.plugins.get(t);if(e?.destroy)try{this.logger.debug(`Rollback: ${t}`),await e.destroy()}catch(e){this.logger.error(`Rollback failed for ${t}`,e)}}this.startedPlugins.clear()}async performShutdown(){await this.context.trigger(`kernel:shutdown`);let e=Array.from(this.plugins.values()).reverse();for(let t of e)if(t.destroy){this.logger.debug(`Destroy: ${t.name}`,{plugin:t.name});try{await t.destroy()}catch(e){this.logger.error(`Error destroying plugin ${t.name}`,e)}}for(let e of this.shutdownHandlers)try{await e()}catch(e){this.logger.error(`Shutdown handler error`,e)}}resolveDependencies(){let e=[],t=new Set,n=new Set,r=i=>{if(t.has(i))return;if(n.has(i))throw Error(`[Kernel] Circular dependency detected: ${i}`);let a=this.plugins.get(i);if(!a)throw Error(`[Kernel] Plugin '${i}' not found`);n.add(i);let o=a.dependencies||[];for(let e of o){if(!this.plugins.has(e))throw Error(`[Kernel] Dependency '${e}' not found for plugin '${i}'`);r(e)}n.delete(i),t.add(i),e.push(a)};for(let e of this.plugins.keys())r(e);return e}registerShutdownSignals(){let e=[`SIGINT`,`SIGTERM`,`SIGQUIT`],t=!1,n=async e=>{if(t){this.logger.warn(`Shutdown already in progress, ignoring ${e}`);return}t=!0,this.logger.info(`Received ${e} - initiating graceful shutdown`);try{await this.shutdown(),Xf(0)}catch(e){this.logger.error(`Shutdown failed`,e),Xf(1)}};if(Jf)for(let t of e)process.on(t,()=>n(t))}onShutdown(e){this.shutdownHandlers.push(e)}};qf({},{HttpTestAdapter:()=>dp,TestRunner:()=>up});var up=class{constructor(e){this.adapter=e}async runSuite(e){let t=[];for(let n of e.scenarios)t.push(await this.runScenario(n));return t}async runScenario(e){let t=Date.now(),n={};if(e.setup)for(let r of e.setup)try{await this.runStep(r,n)}catch(n){return{scenarioId:e.id,passed:!1,steps:[],error:`Setup failed: ${n instanceof Error?n.message:String(n)}`,duration:Date.now()-t}}let r=[],i=!0,a;for(let t of e.steps){let e=Date.now();try{let i=await this.runStep(t,n);r.push({stepName:t.name,passed:!0,output:i,duration:Date.now()-e})}catch(n){i=!1,a=n,r.push({stepName:t.name,passed:!1,error:n,duration:Date.now()-e});break}}if(e.teardown)for(let t of e.teardown)try{await this.runStep(t,n)}catch(e){i&&(i=!1,a=`Teardown failed: ${e instanceof Error?e.message:String(e)}`)}return{scenarioId:e.id,passed:i,steps:r,error:a,duration:Date.now()-t}}async runStep(e,t){let n=this.resolveVariables(e.action,t),r=await this.adapter.execute(n,t);if(e.capture)for(let[n,i]of Object.entries(e.capture))t[n]=this.getValueByPath(r,i);if(e.assertions)for(let n of e.assertions)this.assert(r,n,t);return r}resolveVariables(e,t){let n=JSON.stringify(e).replace(/\{\{([^}]+)\}\}/g,(e,n)=>{let r=this.getValueByPath(t,n.trim());return r===void 0?e:typeof r==`string`?r:JSON.stringify(r)});try{return JSON.parse(n)}catch{return e}}getValueByPath(e,t){if(!t)return e;let n=t.split(`.`),r=e;for(let e of n){if(r==null)return;r=r[e]}return r}assert(e,t,n){let r=this.getValueByPath(e,t.field),i=t.expectedValue;switch(t.operator){case`equals`:if(r!==i)throw Error(`Assertion failed: ${t.field} expected ${i}, got ${r}`);break;case`not_equals`:if(r===i)throw Error(`Assertion failed: ${t.field} expected not ${i}, got ${r}`);break;case`contains`:if(Array.isArray(r)){if(!r.includes(i))throw Error(`Assertion failed: ${t.field} array does not contain ${i}`)}else if(typeof r==`string`&&!r.includes(String(i)))throw Error(`Assertion failed: ${t.field} string does not contain ${i}`);break;case`not_null`:if(r==null)throw Error(`Assertion failed: ${t.field} is null`);break;case`is_null`:if(r!=null)throw Error(`Assertion failed: ${t.field} is not null`);break;default:throw Error(`Unknown assertion operator: ${t.operator}`)}}},dp=class{constructor(e,t){this.baseUrl=e,this.authToken=t}async execute(e,t){let n={"Content-Type":`application/json`};switch(this.authToken&&(n.Authorization=`Bearer ${this.authToken}`),e.user&&(n[`X-Run-As`]=e.user),e.type){case`create_record`:return this.createRecord(e.target,e.payload||{},n);case`update_record`:return this.updateRecord(e.target,e.payload||{},n);case`delete_record`:return this.deleteRecord(e.target,e.payload||{},n);case`read_record`:return this.readRecord(e.target,e.payload||{},n);case`query_records`:return this.queryRecords(e.target,e.payload||{},n);case`api_call`:return this.rawApiCall(e.target,e.payload||{},n);case`wait`:let t=Number(e.payload?.duration||1e3);return new Promise(e=>setTimeout(()=>e({waited:t}),t));default:throw Error(`Unsupported action type in HttpAdapter: ${e.type}`)}}async createRecord(e,t,n){let r=await fetch(`${this.baseUrl}/api/data/${e}`,{method:`POST`,headers:n,body:JSON.stringify(t)});return this.handleResponse(r)}async updateRecord(e,t,n){let r=t.id;if(!r)throw Error(`Update record requires id in payload`);let i=await fetch(`${this.baseUrl}/api/data/${e}/${r}`,{method:`PUT`,headers:n,body:JSON.stringify(t)});return this.handleResponse(i)}async deleteRecord(e,t,n){let r=t.id;if(!r)throw Error(`Delete record requires id in payload`);let i=await fetch(`${this.baseUrl}/api/data/${e}/${r}`,{method:`DELETE`,headers:n});return this.handleResponse(i)}async readRecord(e,t,n){let r=t.id;if(!r)throw Error(`Read record requires id in payload`);let i=await fetch(`${this.baseUrl}/api/data/${e}/${r}`,{method:`GET`,headers:n});return this.handleResponse(i)}async queryRecords(e,t,n){let r=await fetch(`${this.baseUrl}/api/data/${e}/query`,{method:`POST`,headers:n,body:JSON.stringify(t)});return this.handleResponse(r)}async rawApiCall(e,t,n){let r=t.method||`GET`,i=t.body?JSON.stringify(t.body):void 0,a=e.startsWith(`http`)?e:`${this.baseUrl}${e}`,o=await fetch(a,{method:r,headers:n,body:i});return this.handleResponse(o)}async handleResponse(e){if(!e.ok){let t=await e.text();throw Error(`HTTP Error ${e.status}: ${t}`)}let t=e.headers.get(`content-type`);return t&&t.includes(`application/json`)?e.json():e.text()}},fp=class e{constructor(e){this.sandboxes=new Map,this.monitoringIntervals=new Map,this.memoryBaselines=new Map,this.cpuBaselines=new Map,this.logger=e.child({component:`SandboxRuntime`})}createSandbox(e,t){if(this.sandboxes.has(e))throw Error(`Sandbox already exists for plugin: ${e}`);let n={pluginId:e,config:t,startTime:new Date,resourceUsage:{memory:{current:0,peak:0,limit:t.memory?.maxHeap},cpu:{current:0,average:0,limit:t.cpu?.maxCpuPercent},connections:{current:0,limit:t.network?.maxConnections}}};this.sandboxes.set(e,n);let r=Zf();return this.memoryBaselines.set(e,r.heapUsed),this.cpuBaselines.set(e,process.cpuUsage()),this.startResourceMonitoring(e),this.logger.info(`Sandbox created`,{pluginId:e,level:t.level,memoryLimit:t.memory?.maxHeap,cpuLimit:t.cpu?.maxCpuPercent}),n}destroySandbox(e){this.sandboxes.get(e)&&(this.stopResourceMonitoring(e),this.memoryBaselines.delete(e),this.cpuBaselines.delete(e),this.sandboxes.delete(e),this.logger.info(`Sandbox destroyed`,{pluginId:e}))}checkResourceAccess(e,t,n){let r=this.sandboxes.get(e);if(!r)return{allowed:!1,reason:`Sandbox not found`};let{config:i}=r;switch(t){case`file`:return this.checkFileAccess(i,n);case`network`:return this.checkNetworkAccess(i,n);case`process`:return this.checkProcessAccess(i);case`env`:return this.checkEnvAccess(i,n);default:return{allowed:!1,reason:`Unknown resource type`}}}checkFileAccess(e,t){if(e.level===`none`)return{allowed:!0};if(!e.filesystem)return{allowed:!1,reason:`File system access not configured`};if(!t)return{allowed:e.filesystem.mode!==`none`};let n=e.filesystem.allowedPaths||[],r=Fd.normalize(Fd.resolve(t)),i=n.some(e=>{let t=Fd.normalize(Fd.resolve(e));return r.startsWith(t)});return n.length>0&&!i?{allowed:!1,reason:`Path not in allowed list: ${t}`}:(e.filesystem.deniedPaths||[]).some(e=>{let t=Fd.normalize(Fd.resolve(e));return r.startsWith(t)})?{allowed:!1,reason:`Path is explicitly denied: ${t}`}:{allowed:!0}}checkNetworkAccess(e,t){if(e.level===`none`)return{allowed:!0};if(!e.network)return{allowed:!1,reason:`Network access not configured`};if(e.network.mode===`none`)return{allowed:!1,reason:`Network access disabled`};if(!t)return{allowed:e.network.mode!==`none`};let n;try{n=new URL(t).hostname}catch{return{allowed:!1,reason:`Invalid URL: ${t}`}}let r=e.network.allowedHosts||[];return r.length>0&&!r.some(e=>n===e)?{allowed:!1,reason:`Host not in allowed list: ${t}`}:(e.network.deniedHosts||[]).some(e=>n===e)?{allowed:!1,reason:`Host is blocked: ${t}`}:{allowed:!0}}checkProcessAccess(e){return e.level===`none`?{allowed:!0}:e.process?e.process.allowSpawn?{allowed:!0}:{allowed:!1,reason:`Process spawning not allowed`}:{allowed:!1,reason:`Process access not configured`}}checkEnvAccess(e,t){return e.level===`none`||e.process?{allowed:!0}:{allowed:!1,reason:`Environment access not configured`}}checkResourceLimits(e){let t=this.sandboxes.get(e);if(!t)return{withinLimits:!0,violations:[]};let n=[],{resourceUsage:r,config:i}=t;return i.memory?.maxHeap&&r.memory.current>i.memory.maxHeap&&n.push(`Memory limit exceeded: ${r.memory.current} > ${i.memory.maxHeap}`),i.runtime?.resourceLimits?.maxCpu&&r.cpu.current>i.runtime.resourceLimits.maxCpu&&n.push(`CPU limit exceeded: ${r.cpu.current}% > ${i.runtime.resourceLimits.maxCpu}%`),i.network?.maxConnections&&r.connections.current>i.network.maxConnections&&n.push(`Connection limit exceeded: ${r.connections.current} > ${i.network.maxConnections}`),{withinLimits:n.length===0,violations:n}}getResourceUsage(e){return this.sandboxes.get(e)?.resourceUsage}startResourceMonitoring(t){let n=setInterval(()=>{this.updateResourceUsage(t)},e.MONITORING_INTERVAL_MS);this.monitoringIntervals.set(t,n)}stopResourceMonitoring(e){let t=this.monitoringIntervals.get(e);t&&(clearInterval(t),this.monitoringIntervals.delete(e))}updateResourceUsage(t){let n=this.sandboxes.get(t);if(!n)return;let r=Zf(),i=this.memoryBaselines.get(t)??0,a=Math.max(0,r.heapUsed-i);n.resourceUsage.memory.current=a,n.resourceUsage.memory.peak=Math.max(n.resourceUsage.memory.peak,a);let o=this.cpuBaselines.get(t)??{user:0,system:0},s=process.cpuUsage(),c=s.user-o.user+(s.system-o.system),l=e.MONITORING_INTERVAL_MS*1e3;n.resourceUsage.cpu.current=c/l*100,this.cpuBaselines.set(t,s);let{withinLimits:u,violations:d}=this.checkResourceLimits(t);u||this.logger.warn(`Resource limit violations detected`,{pluginId:t,violations:d})}getAllSandboxes(){return new Map(this.sandboxes)}shutdown(){for(let e of this.monitoringIntervals.keys())this.stopResourceMonitoring(e);this.sandboxes.clear(),this.memoryBaselines.clear(),this.cpuBaselines.clear(),this.logger.info(`Sandbox runtime shutdown complete`)}};fp.MONITORING_INTERVAL_MS=5e3;var pp=class{constructor(e,t){this.subscriptions=new Map,this.eventBuffer=[],this._baseUrl=e,this._token=t}subscribeMetadata(e,t,n){let r=`metadata-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,packageId:n?.packageId,eventTypes:[`metadata.${e}.created`,`metadata.${e}.updated`,`metadata.${e}.deleted`]},handler:e=>{e.type.startsWith(`metadata.`)&&t(e)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}subscribeData(e,t,n){let r=`data-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,recordId:n?.recordId,eventTypes:[`data.record.created`,`data.record.updated`,`data.record.deleted`]},handler:r=>{r.type.startsWith(`data.`)&&r.object===e&&(!n?.recordId||r.payload?.recordId===n.recordId)&&t(r)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}emitEvent(e){for(let t of this.subscriptions.values()){let n=!t.filter.type||e.type.includes(t.filter.type)||e.object===t.filter.type,r=!t.filter.eventTypes?.length||t.filter.eventTypes.includes(e.type),i=!t.filter.packageId||e.payload?.packageId===t.filter.packageId;if(n&&r&&i)try{t.handler(e)}catch(e){console.error(`Error in realtime event handler:`,e)}}}startPolling(){this.pollInterval||=setInterval(()=>{for(;this.eventBuffer.length>0;){let e=this.eventBuffer.shift();e&&this.emitEvent(e)}},2e3)}stopPolling(){this.pollInterval&&=(clearInterval(this.pollInterval),void 0)}_bufferEvent(e){this.eventBuffer.push(e)}disconnect(){this.stopPolling(),this.subscriptions.clear(),this.eventBuffer=[]}},mp=class{constructor(e){this.meta={getTypes:async()=>{let e=this.getRoute(`metadata`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},getItems:async(e,t)=>{let n=this.getRoute(`metadata`),r=new URLSearchParams;t?.packageId&&r.set(`package`,t.packageId);let i=r.toString(),a=`${this.baseUrl}${n}/${e}${i?`?${i}`:``}`,o=await this.fetch(a);return this.unwrapResponse(o)},getItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.packageId&&i.set(`package`,n.packageId);let a=i.toString(),o=`${this.baseUrl}${r}/${e}/${t}${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},saveItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`PUT`,body:JSON.stringify(n)});return this.unwrapResponse(i)},deleteItem:async(e,t)=>{let n=this.getRoute(`metadata`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)},getCached:async(e,t)=>{let n=this.getRoute(`metadata`),r={};t?.ifNoneMatch&&(r[`If-None-Match`]=t.ifNoneMatch),t?.ifModifiedSince&&(r[`If-Modified-Since`]=t.ifModifiedSince);let i=await this.fetch(`${this.baseUrl}${n}/object/${e}`,{headers:r});if(i.status===304)return{notModified:!0,etag:t?.ifNoneMatch?{value:t.ifNoneMatch.replace(/^W\/|"/g,``),weak:t.ifNoneMatch.startsWith(`W/`)}:void 0};let a=await i.json(),o=i.headers.get(`ETag`),s=i.headers.get(`Last-Modified`);return{data:a,etag:o?{value:o.replace(/^W\/|"/g,``),weak:o.startsWith(`W/`)}:void 0,lastModified:s||void 0,notModified:!1}},getView:async(e,t=`list`)=>{let n=this.getRoute(`ui`),r=await this.fetch(`${this.baseUrl}${n}/view/${e}?type=${t}`);return this.unwrapResponse(r)}},this.analytics={query:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/query`,{method:`POST`,body:JSON.stringify(e)})).json()},meta:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/meta/${e}`)).json()},explain:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/explain`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.packages={list:async e=>{let t=this.getRoute(`packages`),n=new URLSearchParams;e?.status&&n.set(`status`,e.status),e?.type&&n.set(`type`,e.type),e?.enabled!==void 0&&n.set(`enabled`,String(e.enabled));let r=n.toString(),i=`${this.baseUrl}${t}${r?`?`+r:``}`,a=await this.fetch(i);return this.unwrapResponse(a)},get:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},install:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({manifest:e,settings:t?.settings,enableOnInstall:t?.enableOnInstall})});return this.unwrapResponse(r)},uninstall:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},enable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)}},this.auth={getConfig:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/config`);return this.unwrapResponse(t)},login:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-in/email`,{method:`POST`,body:JSON.stringify(e)})).json();return n.data?.token&&(this.token=n.data.token),n},logout:async()=>{let e=this.getRoute(`auth`);await this.fetch(`${this.baseUrl}${e}/sign-out`,{method:`POST`}),this.token=void 0},me:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/get-session`)).json()},register:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-up/email`,{method:`POST`,body:JSON.stringify(e)})).json();return n.data?.token&&(this.token=n.data.token),n},refreshToken:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/get-session`,{method:`GET`})).json();return n.data?.token&&(this.token=n.data.token),n}},this.storage={upload:async(e,t=`user`)=>{let n={filename:e.name,mimeType:e.type,size:e.size,scope:t},r=this.getRoute(`storage`),{data:i}=await(await this.fetch(`${this.baseUrl}${r}/upload/presigned`,{method:`POST`,body:JSON.stringify(n)})).json(),a=await this.fetchImpl(i.uploadUrl,{method:i.method,headers:i.headers,body:e});if(!a.ok)throw Error(`Storage Upload Failed: ${a.statusText}`);let o={fileId:i.fileId};return(await this.fetch(`${this.baseUrl}${r}/upload/complete`,{method:`POST`,body:JSON.stringify(o)})).json()},getDownloadUrl:async e=>{let t=this.getRoute(`storage`);return(await(await this.fetch(`${this.baseUrl}${t}/files/${e}/url`)).json()).url},getPresignedUrl:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/presigned`,{method:`POST`,body:JSON.stringify(e)})).json()},initChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked`,{method:`POST`,body:JSON.stringify(e)})).json()},uploadPart:async(e,t,n,r)=>{let i=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/chunk/${t}`,{method:`PUT`,headers:{"x-resume-token":n},body:r})).json()},completeChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked/${e.uploadId}/complete`,{method:`POST`,body:JSON.stringify(e)})).json()},resumeUpload:async(e,t,n,r)=>{let i=this.getRoute(`storage`),{totalChunks:a,uploadedChunks:o}=(await(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/progress`)).json()).data,s=[],c=t instanceof ArrayBuffer?t:await t.arrayBuffer();for(let t=o;t{let n=this.getRoute(`automation`);return(await this.fetch(`${this.baseUrl}${n}/trigger/${e}`,{method:`POST`,body:JSON.stringify(t)})).json()},list:async()=>{let e=this.getRoute(`automation`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},get:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`);return this.unwrapResponse(n)},create:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({name:e,...t})});return this.unwrapResponse(r)},update:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`PUT`,body:JSON.stringify({definition:t})});return this.unwrapResponse(r)},delete:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`,{method:`DELETE`});return this.unwrapResponse(n)},toggle:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/toggle`,{method:`POST`,body:JSON.stringify({enabled:t})});return this.unwrapResponse(r)},runs:{list:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${e}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/runs/${t}`);return this.unwrapResponse(r)}}},this.permissions={check:async e=>{let t=this.getRoute(`permissions`),n=new URLSearchParams({object:e.object,action:e.action});e.recordId!==void 0&&n.set(`recordId`,e.recordId),e.field!==void 0&&n.set(`field`,e.field);let r=await this.fetch(`${this.baseUrl}${t}/check?${n.toString()}`);return this.unwrapResponse(r)},getObjectPermissions:async e=>{let t=this.getRoute(`permissions`),n=await this.fetch(`${this.baseUrl}${t}/objects/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},getEffectivePermissions:async()=>{let e=this.getRoute(`permissions`),t=await this.fetch(`${this.baseUrl}${e}/effective`);return this.unwrapResponse(t)}},this.realtime={connect:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/connect`,{method:`POST`,body:JSON.stringify(e||{})});return this.unwrapResponse(n)},disconnect:async()=>{let e=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${e}/disconnect`,{method:`POST`})},subscribe:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/subscribe`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unsubscribe:async e=>{let t=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${t}/unsubscribe`,{method:`POST`,body:JSON.stringify({subscriptionId:e})})},setPresence:async(e,t)=>{let n=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${n}/presence`,{method:`PUT`,body:JSON.stringify({channel:e,state:t})})},getPresence:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/presence/${encodeURIComponent(e)}`);return this.unwrapResponse(n)}},this.workflow={getConfig:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/config`);return this.unwrapResponse(n)},getState:async(e,t)=>{let n=this.getRoute(`workflow`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/state`);return this.unwrapResponse(r)},transition:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/transition`,{method:`POST`,body:JSON.stringify({transition:e.transition,comment:e.comment,data:e.data})});return this.unwrapResponse(n)},approve:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/approve`,{method:`POST`,body:JSON.stringify({comment:e.comment,data:e.data})});return this.unwrapResponse(n)},reject:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/reject`,{method:`POST`,body:JSON.stringify({reason:e.reason,comment:e.comment})});return this.unwrapResponse(n)}},this.views={list:async(e,t)=>{let n=this.getRoute(`views`),r=new URLSearchParams;t&&r.set(`type`,t);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({object:e,data:t})});return this.unwrapResponse(r)},update:async(e,t,n)=>{let r=this.getRoute(`views`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`PUT`,body:JSON.stringify({object:e,viewId:t,data:n})});return this.unwrapResponse(i)},delete:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)}},this.notifications={registerDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unregisterDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},getPreferences:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/preferences`);return this.unwrapResponse(t)},updatePreferences:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/preferences`,{method:`PUT`,body:JSON.stringify({preferences:e})});return this.unwrapResponse(n)},list:async e=>{let t=this.getRoute(`notifications`),n=new URLSearchParams;e?.read!==void 0&&n.set(`read`,String(e.read)),e?.type&&n.set(`type`,e.type),e?.limit&&n.set(`limit`,String(e.limit)),e?.cursor&&n.set(`cursor`,e.cursor);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}${r?`?${r}`:``}`);return this.unwrapResponse(i)},markRead:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/read`,{method:`POST`,body:JSON.stringify({ids:e})});return this.unwrapResponse(n)},markAllRead:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/read/all`,{method:`POST`});return this.unwrapResponse(t)}},this.ai={nlq:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/nlq`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},suggest:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/suggest`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},insights:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/insights`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)}},this.i18n={getLocales:async()=>{let e=this.getRoute(`i18n`),t=await this.fetch(`${this.baseUrl}${e}/locales`);return this.unwrapResponse(t)},getTranslations:async(e,t)=>{let n=this.getRoute(`i18n`),r=new URLSearchParams;r.set(`locale`,e),t?.namespace&&r.set(`namespace`,t.namespace),t?.keys&&r.set(`keys`,t.keys.join(`,`));let i=await this.fetch(`${this.baseUrl}${n}/translations?${r.toString()}`);return this.unwrapResponse(i)},getFieldLabels:async(e,t)=>{let n=this.getRoute(`i18n`),r=await this.fetch(`${this.baseUrl}${n}/labels/${encodeURIComponent(e)}?locale=${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.feed={list:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.type&&i.set(`type`,n.type),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed${a?`?${a}`:``}`);return this.unwrapResponse(o)},create:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed`,{method:`POST`,body:JSON.stringify(n)});return this.unwrapResponse(i)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`PUT`,body:JSON.stringify(r)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`DELETE`});return this.unwrapResponse(i)},addReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions`,{method:`POST`,body:JSON.stringify({emoji:r})});return this.unwrapResponse(a)},removeReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions/${encodeURIComponent(r)}`,{method:`DELETE`});return this.unwrapResponse(a)},pin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`POST`});return this.unwrapResponse(i)},unpin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`DELETE`});return this.unwrapResponse(i)},star:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`POST`});return this.unwrapResponse(i)},unstar:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`DELETE`});return this.unwrapResponse(i)},search:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=new URLSearchParams;a.set(`query`,n),r?.type&&a.set(`type`,r.type),r?.actorId&&a.set(`actorId`,r.actorId),r?.dateFrom&&a.set(`dateFrom`,r.dateFrom),r?.dateTo&&a.set(`dateTo`,r.dateTo),r?.limit&&a.set(`limit`,String(r.limit)),r?.cursor&&a.set(`cursor`,r.cursor);let o=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/search?${a.toString()}`);return this.unwrapResponse(o)},getChangelog:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.field&&i.set(`field`,n.field),n?.actorId&&i.set(`actorId`,n.actorId),n?.dateFrom&&i.set(`dateFrom`,n.dateFrom),n?.dateTo&&i.set(`dateTo`,n.dateTo),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/changelog${a?`?${a}`:``}`);return this.unwrapResponse(o)},subscribe:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`POST`,body:JSON.stringify(n||{})});return this.unwrapResponse(i)},unsubscribe:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`DELETE`});return this.unwrapResponse(r)}},this.data={query:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/query`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},find:async(e,t={})=>{let n=this.getRoute(`data`),r=new URLSearchParams,i=t,a={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(i.where&&(a.filter=i.where),i.fields&&(a.select=i.fields),i.orderBy&&(a.sort=i.orderBy),i.limit!=null&&(a.top=i.limit),i.offset!=null&&(a.skip=i.offset),i.aggregations&&(a.aggregations=i.aggregations),i.groupBy&&(a.groupBy=i.groupBy)):Object.assign(a,t),a.top&&r.set(`top`,a.top.toString()),a.skip&&r.set(`skip`,a.skip.toString()),a.sort)if(Array.isArray(a.sort)&&typeof a.sort[0]==`object`)r.set(`sort`,JSON.stringify(a.sort));else{let e=Array.isArray(a.sort)?a.sort.join(`,`):a.sort;r.set(`sort`,e)}a.select&&r.set(`select`,a.select.join(`,`));let o=a.filter??a.filters;o&&(this.isFilterAST(o)||Array.isArray(o)?r.set(`filter`,JSON.stringify(o)):typeof o==`object`&&o&&Object.entries(o).forEach(([e,t])=>{t!=null&&r.append(e,String(t))})),a.aggregations&&r.set(`aggregations`,JSON.stringify(a.aggregations)),a.groupBy&&r.set(`groupBy`,a.groupBy.join(`,`));let s=await this.fetch(`${this.baseUrl}${n}/${e}?${r.toString()}`);return this.unwrapResponse(s)},get:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},createMany:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/createMany`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},update:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`PATCH`,body:JSON.stringify(n)});return this.unwrapResponse(i)},batch:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/batch`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},updateMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={records:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/updateMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)},delete:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`,{method:`DELETE`});return this.unwrapResponse(r)},deleteMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={ids:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/deleteMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)}},this.baseUrl=e.baseUrl.replace(/\/$/,``),this.token=e.token,this.fetchImpl=e.fetch||globalThis.fetch.bind(globalThis),this.logger=e.logger||$f({level:e.debug?`debug`:`info`,format:`pretty`}),this.realtimeAPI=new pp(this.baseUrl,this.token),this.logger.debug(`ObjectStack client created`,{baseUrl:this.baseUrl})}async connect(){this.logger.debug(`Connecting to ObjectStack server`,{baseUrl:this.baseUrl});try{let e;try{let t;try{t=`${new URL(this.baseUrl).origin}/.well-known/objectstack`}catch{t=`/.well-known/objectstack`}this.logger.debug(`Probing .well-known discovery`,{url:t});let n=await this.fetchImpl(t);if(n.ok){let t=await n.json();e=t.data||t,this.logger.debug(`Discovered via .well-known`)}}catch(e){this.logger.debug(`Standard discovery probe failed`,{error:e.message})}if(!e){let t=`${this.baseUrl}/api/v1/discovery`;this.logger.debug(`Falling back to standard discovery endpoint`,{url:t});let n=await this.fetchImpl(t);if(!n.ok)throw Error(`Failed to connect to ${t}: ${n.statusText}`);let r=await n.json();e=r.data||r}if(!e)throw Error(`Connection failed: No discovery data returned`);return this.discoveryInfo=e,this.logger.info(`Connected to ObjectStack server`,{version:e.version,apiName:e.apiName,services:e.services}),e}catch(e){throw this.logger.error(`Failed to connect to ObjectStack server`,e,{baseUrl:this.baseUrl}),e}}get capabilities(){let e=this.discoveryInfo?.capabilities;if(!e)return;let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r?!!r.enabled:!!r;return t}get events(){return this.realtimeAPI}isFilterAST(e){return _(e)}async unwrapResponse(e){let t=await e.json();return t&&typeof t.success==`boolean`&&`data`in t?t.data:t}async fetch(e,t={}){this.logger.debug(`HTTP request`,{method:t.method||`GET`,url:e,hasBody:!!t.body});let n={"Content-Type":`application/json`,...t.headers||{}};this.token&&(n.Authorization=`Bearer ${this.token}`);let r=await this.fetchImpl(e,{...t,headers:n});if(this.logger.debug(`HTTP response`,{method:t.method||`GET`,url:e,status:r.status,ok:r.ok}),!r.ok){let n;try{n=await r.json()}catch{n={message:r.statusText}}this.logger.error(`HTTP request failed`,void 0,{method:t.method||`GET`,url:e,status:r.status,error:n});let i=n?.message||n?.error?.message||r.statusText,a=n?.code||n?.error?.code,o=Error(`[ObjectStack] ${a?`${a}: `:``}${i}`);throw o.code=a,o.category=n?.category,o.httpStatus=r.status,o.retryable=n?.retryable,o.details=n?.details||n,o}return r}getRoute(e){let t=this.discoveryInfo?.routes;if(t){let n=t[e];if(n)return n}return{data:`/api/v1/data`,metadata:`/api/v1/meta`,discovery:`/api/v1/discovery`,ui:`/api/v1/ui`,auth:`/api/v1/auth`,analytics:`/api/v1/analytics`,storage:`/api/v1/storage`,automation:`/api/v1/automation`,packages:`/api/v1/packages`,permissions:`/api/v1/permissions`,realtime:`/api/v1/realtime`,workflow:`/api/v1/workflow`,views:`/api/v1/ui/views`,notifications:`/api/v1/notifications`,ai:`/api/v1/ai`,i18n:`/api/v1/i18n`,feed:`/api/v1/feed`,graphql:`/graphql`}[e]||`/api/v1/${e}`}},hp=(0,L.createContext)(null);function gp({client:e,children:t}){return L.createElement(hp.Provider,{value:e},t)}function _p(){let e=(0,L.useContext)(hp);if(!e)throw Error(`useClient must be used within an ObjectStackProvider. Make sure your component is wrapped with .`);return e}function vp(e,t,n){let r=_p();(0,L.useEffect)(()=>{if(!r)return;let i=r.events.subscribeMetadata(e,t,n);return()=>{i()}},[r,e,t,n?.packageId])}var yp=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),bp=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),xp=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Sp=e=>{let t=xp(e);return t.charAt(0).toUpperCase()+t.slice(1)},Cp={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},wp=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Tp=(0,L.createContext)({}),Ep=()=>(0,L.useContext)(Tp),See=(0,L.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ep()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,L.createElement)(`svg`,{ref:c,...Cp,width:t??l??Cp.width,height:t??l??Cp.height,stroke:e??f,strokeWidth:m,className:yp(`lucide`,p,i),...!a&&!wp(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,L.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),z=(e,t)=>{let n=(0,L.forwardRef)(({className:n,...r},i)=>(0,L.createElement)(See,{ref:i,iconNode:t,className:yp(`lucide-${bp(Sp(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Sp(e),n},Dp=z(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Op=z(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),Cee=z(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),kp=z(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ap=z(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),jp=z(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),wee=z(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),Tee=z(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Eee=z(`calculator`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]),Dee=z(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Mp=z(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Oee=z(`chart-pie`,[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]]),Np=z(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Pp=z(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Fp=z(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),kee=z(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Aee=z(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Ip=z(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Lp=z(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),jee=z(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Rp=z(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Mee=z(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),zp=z(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Bp=z(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Vp=z(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Hp=z(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Up=z(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Nee=z(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Pee=z(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Fee=z(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Iee=z(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Wp=z(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Gp=z(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Kp=z(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),qp=z(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Jp=z(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Lee=z(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Yp=z(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Ree=z(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Xp=z(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Zp=z(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),zee=z(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Qp=z(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),$p=z(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),em=z(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),tm=z(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),nm=z(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),rm=z(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Bee=z(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Vee=z(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),Hee=z(`pen-tool`,[[`path`,{d:`M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z`,key:`nt11vn`}],[`path`,{d:`m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18`,key:`15qc1e`}],[`path`,{d:`m2.3 2.3 7.286 7.286`,key:`1wuzzi`}],[`circle`,{cx:`11`,cy:`11`,r:`2`,key:`xmgehs`}]]),im=z(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),am=z(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Uee=z(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Wee=z(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),om=z(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Gee=z(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),sm=z(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),cm=z(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Kee=z(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),lm=z(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),um=z(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),dm=z(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),fm=z(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),qee=z(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),pm=z(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),mm=z(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),hm=z(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Jee=z(`toggle-left`,[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]),gm=z(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Yee=z(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),_m=z(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),vm=z(`webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),ym=z(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),bm=z(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),xm=z(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Sm=z(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Xee=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),B=n(((e,t)=>{t.exports=Xee()}))(),Zee=class extends L.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary] Uncaught error:`,e,t.componentStack)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,B.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-6`,children:(0,B.jsxs)(`div`,{className:`max-w-md w-full space-y-4 text-center`,children:[(0,B.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10`,children:(0,B.jsx)(Ip,{className:`h-6 w-6 text-destructive`})}),(0,B.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Something went wrong`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:this.state.error?.message||`An unexpected error occurred.`}),(0,B.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-auto rounded-lg bg-muted p-3 text-left text-xs font-mono text-muted-foreground`,children:this.state.error?.stack?.split(` +`).slice(0,6).join(` +`)}),(0,B.jsxs)(`button`,{onClick:this.handleReset,className:`inline-flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors`,children:[(0,B.jsx)(om,{className:`h-4 w-4`}),`Try Again`]})]})}):this.props.children}};function Cm(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function wm(...e){return t=>{let n=!1,r=e.map(e=>{let r=Cm(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:r,...i}=e;Dm(r)&&typeof Em==`function`&&(r=Em(r._payload));let a=L.Children.toArray(r),o=a.find(nte);if(o){let e=o.props.children,r=a.map(t=>t===o?L.Children.count(e)>1?L.Children.only(null):L.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:L.isValidElement(e)?L.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var km=Om(`Slot`);function ete(e){let t=L.forwardRef((e,t)=>{let{children:n,...r}=e;if(Dm(n)&&typeof Em==`function`&&(n=Em(n._payload)),L.isValidElement(n)){let e=ite(n),i=rte(r,n.props);return n.type!==L.Fragment&&(i.ref=t?wm(t,e):e),L.cloneElement(n,i)}return L.Children.count(n)>1?L.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tte=Symbol(`radix.slottable`);function nte(e){return L.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===tte}function rte(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function ite(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Am(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,Nm=jm,Pm=(e,t)=>n=>{if(t?.variants==null)return Nm(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Mm(t)||Mm(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Nm(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Fm=768;function ate(){let[e,t]=L.useState(void 0);return L.useEffect(()=>{let e=window.matchMedia(`(max-width: ${Fm-1}px)`),n=()=>{t(window.innerWidthe.removeEventListener(`change`,n)},[]),!!e}var ote=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),Im=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Lm=`-`,Rm=[],cte=`arbitrary..`,lte=e=>{let t=dte(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return ute(e);let n=e.split(Lm);return zm(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ote(i,t):t:i||Rm}return n[e]||Rm}}},zm=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=zm(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Lm):e.slice(t).join(Lm),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?cte+r:void 0})(),dte=e=>{let{theme:t,classGroups:n}=e;return fte(n,t)},fte=(e,t)=>{let n=Im();for(let r in e){let i=e[r];Bm(i,n,r,t)}return n},Bm=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){mte(e,t,n);return}if(typeof e==`function`){hte(e,t,n,r);return}gte(e,t,n,r)},mte=(e,t,n)=>{let r=e===``?t:Vm(t,e);r.classGroupId=n},hte=(e,t,n,r)=>{if(_te(e)){Bm(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ste(n,e))},gte=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(Lm),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,vte=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Hm=`!`,Um=`:`,yte=[],Wm=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),bte=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return Wm(t,l,c,u)};if(t){let e=t+Um,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Wm(yte,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},xte=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ste=e=>({cache:vte(e.cacheSize),parseClassName:bte(e),sortModifiers:xte(e),...lte(e)}),Cte=/\s+/,wte=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Cte),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Hm:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e0?` `+c:c)}return c},Tte=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=Ste(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=wte(e,n);return i(e,a),a};return a=o,(...e)=>a(Tte(...e))},Dte=[],Km=e=>{let t=t=>t[e]||Dte;return t.isThemeGetter=!0,t},qm=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Jm=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ote=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,kte=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ate=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jte=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mte=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Nte=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ym=e=>Ote.test(e),Xm=e=>!!e&&!Number.isNaN(Number(e)),Zm=e=>!!e&&Number.isInteger(Number(e)),Qm=e=>e.endsWith(`%`)&&Xm(e.slice(0,-1)),$m=e=>kte.test(e),eh=()=>!0,Pte=e=>Ate.test(e)&&!jte.test(e),th=()=>!1,Fte=e=>Mte.test(e),Ite=e=>Nte.test(e),Lte=e=>!nh(e)&&!sh(e),Rte=e=>dh(e,hh,th),nh=e=>qm.test(e),rh=e=>dh(e,gh,Pte),ih=e=>dh(e,Kte,Xm),zte=e=>dh(e,Jte,eh),Bte=e=>dh(e,qte,th),ah=e=>dh(e,ph,th),Vte=e=>dh(e,mh,Ite),oh=e=>dh(e,Yte,Fte),sh=e=>Jm.test(e),ch=e=>fh(e,gh),Hte=e=>fh(e,qte),lh=e=>fh(e,ph),Ute=e=>fh(e,hh),Wte=e=>fh(e,mh),uh=e=>fh(e,Yte,!0),Gte=e=>fh(e,Jte,!0),dh=(e,t,n)=>{let r=qm.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},fh=(e,t,n=!1)=>{let r=Jm.exec(e);return r?r[1]?t(r[1]):n:!1},ph=e=>e===`position`||e===`percentage`,mh=e=>e===`image`||e===`url`,hh=e=>e===`length`||e===`size`||e===`bg-size`,gh=e=>e===`length`,Kte=e=>e===`number`,qte=e=>e===`family-name`,Jte=e=>e===`number`||e===`weight`,Yte=e=>e===`shadow`,Xte=Ete(()=>{let e=Km(`color`),t=Km(`font`),n=Km(`text`),r=Km(`font-weight`),i=Km(`tracking`),a=Km(`leading`),o=Km(`breakpoint`),s=Km(`container`),c=Km(`spacing`),l=Km(`radius`),u=Km(`shadow`),d=Km(`inset-shadow`),f=Km(`text-shadow`),p=Km(`drop-shadow`),m=Km(`blur`),h=Km(`perspective`),g=Km(`aspect`),_=Km(`ease`),v=Km(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),sh,nh],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[sh,nh,c],T=()=>[Ym,`full`,`auto`,...w()],E=()=>[Zm,`none`,`subgrid`,sh,nh],D=()=>[`auto`,{span:[`full`,Zm,sh,nh]},Zm,sh,nh],O=()=>[Zm,`auto`,sh,nh],ee=()=>[`auto`,`min`,`max`,`fr`,sh,nh],te=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],k=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],j=()=>[Ym,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[Ym,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],N=()=>[Ym,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,sh,nh],F=()=>[...b(),lh,ah,{position:[sh,nh]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,Ute,Rte,{size:[sh,nh]}],re=()=>[Qm,ch,rh],ie=()=>[``,`none`,`full`,l,sh,nh],ae=()=>[``,Xm,ch,rh],oe=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ce=()=>[Xm,Qm,lh,ah],le=()=>[``,`none`,m,sh,nh],L=()=>[`none`,Xm,sh,nh],ue=()=>[`none`,Xm,sh,nh],de=()=>[Xm,sh,nh],fe=()=>[Ym,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[$m],breakpoint:[$m],color:[eh],container:[$m],"drop-shadow":[$m],ease:[`in`,`out`,`in-out`],font:[Lte],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[$m],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[$m],shadow:[$m],spacing:[`px`,Xm],text:[$m],"text-shadow":[$m],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Ym,nh,sh,g]}],container:[`container`],columns:[{columns:[Xm,nh,sh,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Zm,`auto`,sh,nh]}],basis:[{basis:[Ym,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Xm,Ym,`auto`,`initial`,`none`,nh]}],grow:[{grow:[``,Xm,sh,nh]}],shrink:[{shrink:[``,Xm,sh,nh]}],order:[{order:[Zm,`first`,`last`,`none`,sh,nh]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...te(),`normal`]}],"justify-items":[{"justify-items":[...k(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...k()]}],"align-content":[{content:[`normal`,...te()]}],"align-items":[{items:[...k(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...k(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...k(),`baseline`]}],"place-self":[{"place-self":[`auto`,...k()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...M()]}],"min-inline-size":[{"min-inline":[`auto`,...M()]}],"max-inline-size":[{"max-inline":[`none`,...M()]}],"block-size":[{block:[`auto`,...N()]}],"min-block-size":[{"min-block":[`auto`,...N()]}],"max-block-size":[{"max-block":[`none`,...N()]}],w:[{w:[s,`screen`,...j()]}],"min-w":[{"min-w":[s,`screen`,`none`,...j()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,ch,rh]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Gte,zte]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Qm,nh]}],"font-family":[{font:[Hte,Bte,t]}],"font-features":[{"font-features":[nh]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,sh,nh]}],"line-clamp":[{"line-clamp":[Xm,`none`,sh,ih]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,sh,nh]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,sh,nh]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...oe(),`wavy`]}],"text-decoration-thickness":[{decoration:[Xm,`from-font`,`auto`,sh,rh]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Xm,`auto`,sh,nh]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,sh,nh]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,sh,nh]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Zm,sh,nh],radial:[``,sh,nh],conic:[Zm,sh,nh]},Wte,Vte]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...oe(),`hidden`,`none`]}],"divide-style":[{divide:[...oe(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...oe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Xm,sh,nh]}],"outline-w":[{outline:[``,Xm,ch,rh]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,uh,oh]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,uh,oh]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:ae()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Xm,rh]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,uh,oh]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Xm,sh,nh]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Xm]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[sh,nh]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Xm]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,sh,nh]}],filter:[{filter:[``,`none`,sh,nh]}],blur:[{blur:le()}],brightness:[{brightness:[Xm,sh,nh]}],contrast:[{contrast:[Xm,sh,nh]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,uh,oh]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,Xm,sh,nh]}],"hue-rotate":[{"hue-rotate":[Xm,sh,nh]}],invert:[{invert:[``,Xm,sh,nh]}],saturate:[{saturate:[Xm,sh,nh]}],sepia:[{sepia:[``,Xm,sh,nh]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,sh,nh]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[Xm,sh,nh]}],"backdrop-contrast":[{"backdrop-contrast":[Xm,sh,nh]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Xm,sh,nh]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xm,sh,nh]}],"backdrop-invert":[{"backdrop-invert":[``,Xm,sh,nh]}],"backdrop-opacity":[{"backdrop-opacity":[Xm,sh,nh]}],"backdrop-saturate":[{"backdrop-saturate":[Xm,sh,nh]}],"backdrop-sepia":[{"backdrop-sepia":[``,Xm,sh,nh]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,sh,nh]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Xm,`initial`,sh,nh]}],ease:[{ease:[`linear`,`initial`,_,sh,nh]}],delay:[{delay:[Xm,sh,nh]}],animate:[{animate:[`none`,v,sh,nh]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,sh,nh]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:L()}],"rotate-x":[{"rotate-x":L()}],"rotate-y":[{"rotate-y":L()}],"rotate-z":[{"rotate-z":L()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":[`scale-3d`],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[sh,nh,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,sh,nh]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,sh,nh]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[Xm,ch,rh,ih]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function V(...e){return Xte(jm(e))}var Zte=Pm(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`,outline:`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),_h=L.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,B.jsx)(r?km:`button`,{className:V(Zte({variant:t,size:n,className:e})),ref:a,...i}));_h.displayName=`Button`;var vh=L.forwardRef(({className:e,type:t,...n},r)=>(0,B.jsx)(`input`,{type:t,className:V(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium 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:r,...n}));vh.displayName=`Input`;var yh=t(se(),1),Qte=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Om(`Primitive.${t}`),r=L.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),$te=`Separator`,ene=`horizontal`,tne=[`horizontal`,`vertical`],nne=L.forwardRef((e,t)=>{let{decorative:n,orientation:r=ene,...i}=e,a=rne(r)?r:ene,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,B.jsx)(Qte.div,{"data-orientation":a,...o,...i,ref:t})});nne.displayName=$te;function rne(e){return tne.includes(e)}var ine=nne,bh=L.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,B.jsx)(ine,{ref:i,decorative:n,orientation:t,className:V(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));bh.displayName=ine.displayName,typeof window<`u`&&window.document&&window.document.createElement;function H(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function ane(e,t){let n=L.createContext(t),r=e=>{let{children:t,...r}=e,i=L.useMemo(()=>r,Object.values(r));return(0,B.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=L.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function xh(e,t=[]){let n=[];function r(t,r){let i=L.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=L.useMemo(()=>o,Object.values(o));return(0,B.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=L.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>L.createContext(e));return function(n){let r=n?.[e]||t;return L.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,one(i,...t)]}function one(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return L.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Sh=globalThis?.document?L.useLayoutEffect:()=>{},sne=L.useId||(()=>void 0),cne=0;function Ch(e){let[t,n]=L.useState(sne());return Sh(()=>{e||n(e=>e??String(cne++))},[e]),e||(t?`radix-${t}`:``)}var lne=L.useInsertionEffect||Sh;function wh({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=une({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=L.useRef(e!==void 0);L.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,L.useCallback(t=>{if(s){let n=dne(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function une({defaultProp:e,onChange:t}){let[n,r]=L.useState(e),i=L.useRef(n),a=L.useRef(t);return lne(()=>{a.current=t},[t]),L.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function dne(e){return typeof e==`function`}function Th(e){let t=fne(e),n=L.forwardRef((e,n)=>{let{children:r,...i}=e,a=L.Children.toArray(r),o=a.find(hne);if(o){let e=o.props.children,r=a.map(t=>t===o?L.Children.count(e)>1?L.Children.only(null):L.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:L.isValidElement(e)?L.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function fne(e){let t=L.forwardRef((e,t)=>{let{children:n,...r}=e;if(L.isValidElement(n)){let e=_ne(n),i=gne(r,n.props);return n.type!==L.Fragment&&(i.ref=t?wm(t,e):e),L.cloneElement(n,i)}return L.Children.count(n)>1?L.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pne=Symbol(`radix.slottable`);function mne(e){let t=({children:e})=>(0,B.jsx)(B.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=pne,t}function hne(e){return L.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===pne}function gne(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function _ne(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Eh=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Th(`Primitive.${t}`),r=L.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Dh(e,t){e&&yh.flushSync(()=>e.dispatchEvent(t))}function Oh(e){let t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>(...e)=>t.current?.(...e),[])}function vne(e,t=globalThis?.document){let n=Oh(e);L.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var yne=`DismissableLayer`,kh=`dismissableLayer.update`,bne=`dismissableLayer.pointerDownOutside`,xne=`dismissableLayer.focusOutside`,Sne,Cne=L.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ah=L.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=L.useContext(Cne),[u,d]=L.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=L.useState({}),m=Tm(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Ene(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Dne(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return vne(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),L.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Sne=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),One(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Sne)}},[u,f,n,l]),L.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),One())},[u,l]),L.useEffect(()=>{let e=()=>p({});return document.addEventListener(kh,e),()=>document.removeEventListener(kh,e)},[]),(0,B.jsx)(Eh.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:H(e.onFocusCapture,S.onFocusCapture),onBlurCapture:H(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:H(e.onPointerDownCapture,x.onPointerDownCapture)})});Ah.displayName=yne;var wne=`DismissableLayerBranch`,Tne=L.forwardRef((e,t)=>{let n=L.useContext(Cne),r=L.useRef(null),i=Tm(t,r);return L.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,B.jsx)(Eh.div,{...e,ref:i})});Tne.displayName=wne;function Ene(e,t=globalThis?.document){let n=Oh(e),r=L.useRef(!1),i=L.useRef(()=>{});return L.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){kne(bne,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Dne(e,t=globalThis?.document){let n=Oh(e),r=L.useRef(!1);return L.useEffect(()=>{let e=e=>{e.target&&!r.current&&kne(xne,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function One(){let e=new CustomEvent(kh);document.dispatchEvent(e)}function kne(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Dh(i,a):i.dispatchEvent(a)}var Ane=Ah,jne=Tne,jh=`focusScope.autoFocusOnMount`,Mh=`focusScope.autoFocusOnUnmount`,Mne={bubbles:!1,cancelable:!0},Nne=`FocusScope`,Nh=L.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=L.useState(null),l=Oh(i),u=Oh(a),d=L.useRef(null),f=Tm(t,e=>c(e)),p=L.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;L.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Ph(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Ph(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Ph(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),L.useEffect(()=>{if(s){Bne.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(jh,Mne);s.addEventListener(jh,l),s.dispatchEvent(t),t.defaultPrevented||(Pne(Une(Ine(s)),{select:!0}),document.activeElement===e&&Ph(s))}return()=>{s.removeEventListener(jh,l),setTimeout(()=>{let t=new CustomEvent(Mh,Mne);s.addEventListener(Mh,u),s.dispatchEvent(t),t.defaultPrevented||Ph(e??document.body,{select:!0}),s.removeEventListener(Mh,u),Bne.remove(p)},0)}}},[s,l,u,p]);let m=L.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Fne(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Ph(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Ph(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,B.jsx)(Eh.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Nh.displayName=Nne;function Pne(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Ph(r,{select:t}),document.activeElement!==n)return}function Fne(e){let t=Ine(e);return[Lne(t,e),Lne(t.reverse(),e)]}function Ine(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Lne(e,t){for(let n of e)if(!Rne(n,{upTo:t}))return n}function Rne(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function zne(e){return e instanceof HTMLInputElement&&`select`in e}function Ph(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&zne(e)&&t&&e.select()}}var Bne=Vne();function Vne(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Hne(e,t),e.unshift(t)},remove(t){e=Hne(e,t),e[0]?.resume()}}}function Hne(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Une(e){return e.filter(e=>e.tagName!==`A`)}var Wne=`Portal`,Fh=L.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=L.useState(!1);Sh(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?yh.createPortal((0,B.jsx)(Eh.div,{...r,ref:t}),o):null});Fh.displayName=Wne;function Gne(e,t){return L.useReducer((e,n)=>t[e][n]??e,e)}var Ih=e=>{let{present:t,children:n}=e,r=Kne(t),i=typeof n==`function`?n({present:r.isPresent}):L.Children.only(n),a=Tm(r.ref,qne(i));return typeof n==`function`||r.isPresent?L.cloneElement(i,{ref:a}):null};Ih.displayName=`Presence`;function Kne(e){let[t,n]=L.useState(),r=L.useRef(null),i=L.useRef(e),a=L.useRef(`none`),[o,s]=Gne(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return L.useEffect(()=>{let e=Lh(r.current);a.current=o===`mounted`?e:`none`},[o]),Sh(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Lh(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Sh(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Lh(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Lh(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:L.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Lh(e){return e?.animationName||`none`}function qne(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rh=0;function zh(){L.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Jne()),document.body.insertAdjacentElement(`beforeend`,e[1]??Jne()),Rh++,()=>{Rh===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Rh--}},[])}function Jne(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Bh=function(){return Bh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return fre;var t=pre(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hre=Xh(),Qh=`data-scroll-locked`,gre=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` + .${Zne} { + overflow: hidden ${r}; + padding-right: ${s}px ${r}; + } + body[${Qh}] { + overflow: hidden ${r}; + overscroll-behavior: contain; + ${[t&&`position: relative ${r};`,n===`margin`&&` + padding-left: ${i}px; + padding-top: ${a}px; + padding-right: ${o}px; + margin-left:0; + margin-top:0; + margin-right: ${s}px ${r}; + `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} + } + + .${Vh} { + right: ${s}px ${r}; + } + + .${Hh} { + margin-right: ${s}px ${r}; + } + + .${Vh} .${Vh} { + right: 0 ${r}; + } + + .${Hh} .${Hh} { + margin-right: 0 ${r}; + } + + body[${Qh}] { + ${Qne}: ${s}px; + } +`},$h=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},_re=function(){L.useEffect(function(){return document.body.setAttribute(Qh,($h()+1).toString()),function(){var e=$h()-1;e<=0?document.body.removeAttribute(Qh):document.body.setAttribute(Qh,e.toString())}},[])},vre=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;_re();var a=L.useMemo(function(){return mre(i)},[i]);return L.createElement(hre,{styles:gre(a,!t,i,n?``:`!important`)})},eg=!1;if(typeof window<`u`)try{var tg=Object.defineProperty({},`passive`,{get:function(){return eg=!0,!0}});window.addEventListener(`test`,tg,tg),window.removeEventListener(`test`,tg,tg)}catch{eg=!1}var ng=eg?{passive:!1}:!1,yre=function(e){return e.tagName===`TEXTAREA`},rg=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!yre(e)&&n[t]===`visible`)},bre=function(e){return rg(e,`overflowY`)},xre=function(e){return rg(e,`overflowX`)},ig=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),ag(e,r)){var i=og(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Sre=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Cre=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},ag=function(e,t){return e===`v`?bre(t):xre(t)},og=function(e,t){return e===`v`?Sre(t):Cre(t)},wre=function(e,t){return e===`h`&&t===`rtl`?-1:1},Tre=function(e,t,n,r,i){var a=wre(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=og(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&ag(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},sg=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cg=function(e){return[e.deltaX,e.deltaY]},lg=function(e){return e&&`current`in e?e.current:e},Ere=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Dre=function(e){return` + .block-interactivity-${e} {pointer-events: none;} + .allow-interactivity-${e} {pointer-events: all;} +`},Ore=0,ug=[];function kre(e){var t=L.useRef([]),n=L.useRef([0,0]),r=L.useRef(),i=L.useState(Ore++)[0],a=L.useState(Xh)[0],o=L.useRef(e);L.useEffect(function(){o.current=e},[e]),L.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Xne([e.lockRef.current],(e.shards||[]).map(lg),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=L.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=sg(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ig(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ig(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Tre(h,t,e,h===`h`?s:c,!0)},[]),c=L.useCallback(function(e){var n=e;if(!(!ug.length||ug[ug.length-1]!==a)){var r=`deltaY`in n?cg(n):sg(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Ere(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(lg).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=L.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Are(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=L.useCallback(function(e){n.current=sg(e),r.current=void 0},[]),d=L.useCallback(function(t){l(t.type,cg(t),t.target,s(t,e.lockRef.current))},[]),f=L.useCallback(function(t){l(t.type,sg(t),t.target,s(t,e.lockRef.current))},[]);L.useEffect(function(){return ug.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ng),document.addEventListener(`touchmove`,c,ng),document.addEventListener(`touchstart`,u,ng),function(){ug=ug.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ng),document.removeEventListener(`touchmove`,c,ng),document.removeEventListener(`touchstart`,u,ng)}},[]);var p=e.removeScrollBar,m=e.inert;return L.createElement(L.Fragment,null,m?L.createElement(a,{styles:Dre(i)}):null,p?L.createElement(vre,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Are(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var jre=are(Kh,kre),dg=L.forwardRef(function(e,t){return L.createElement(Jh,Bh({},e,{ref:t,sideCar:jre}))});dg.classNames=Jh.classNames;var Mre=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},fg=new WeakMap,pg=new WeakMap,mg={},hg=0,gg=function(e){return e&&(e.host||gg(e.parentNode))},Nre=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=gg(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Pre=function(e,t,n,r){var i=Nre(t,Array.isArray(e)?e:[e]);mg[n]||(mg[n]=new WeakMap);var a=mg[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(fg.get(e)||0)+1,l=(a.get(e)||0)+1;fg.set(e,c),a.set(e,l),o.push(e),c===1&&i&&pg.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),hg++,function(){o.forEach(function(e){var t=fg.get(e)-1,i=a.get(e)-1;fg.set(e,t),a.set(e,i),t||(pg.has(e)||e.removeAttribute(r),pg.delete(e)),i||e.removeAttribute(n)}),hg--,hg||(fg=new WeakMap,fg=new WeakMap,pg=new WeakMap,mg={})}},_g=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Mre(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Pre(r,i,n,`aria-hidden`)):function(){return null}},vg=`Dialog`,[yg,Fre]=xh(vg),[Ire,bg]=yg(vg),xg=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=L.useRef(null),c=L.useRef(null),[l,u]=wh({prop:r,defaultProp:i??!1,onChange:a,caller:vg});return(0,B.jsx)(Ire,{scope:t,triggerRef:s,contentRef:c,contentId:Ch(),titleId:Ch(),descriptionId:Ch(),open:l,onOpenChange:u,onOpenToggle:L.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};xg.displayName=vg;var Sg=`DialogTrigger`,Lre=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(Sg,n),a=Tm(t,i.triggerRef);return(0,B.jsx)(Eh.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Lg(i.open),...r,ref:a,onClick:H(e.onClick,i.onOpenToggle)})});Lre.displayName=Sg;var Cg=`DialogPortal`,[Rre,wg]=yg(Cg,{forceMount:void 0}),Tg=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=bg(Cg,t);return(0,B.jsx)(Rre,{scope:t,forceMount:n,children:L.Children.map(r,e=>(0,B.jsx)(Ih,{present:n||a.open,children:(0,B.jsx)(Fh,{asChild:!0,container:i,children:e})}))})};Tg.displayName=Cg;var Eg=`DialogOverlay`,Dg=L.forwardRef((e,t)=>{let n=wg(Eg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=bg(Eg,e.__scopeDialog);return a.modal?(0,B.jsx)(Ih,{present:r||a.open,children:(0,B.jsx)(Bre,{...i,ref:t})}):null});Dg.displayName=Eg;var zre=Th(`DialogOverlay.RemoveScroll`),Bre=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(Eg,n);return(0,B.jsx)(dg,{as:zre,allowPinchZoom:!0,shards:[i.contentRef],children:(0,B.jsx)(Eh.div,{"data-state":Lg(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Og=`DialogContent`,kg=L.forwardRef((e,t)=>{let n=wg(Og,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=bg(Og,e.__scopeDialog);return(0,B.jsx)(Ih,{present:r||a.open,children:a.modal?(0,B.jsx)(Vre,{...i,ref:t}):(0,B.jsx)(Hre,{...i,ref:t})})});kg.displayName=Og;var Vre=L.forwardRef((e,t)=>{let n=bg(Og,e.__scopeDialog),r=L.useRef(null),i=Tm(t,n.contentRef,r);return L.useEffect(()=>{let e=r.current;if(e)return _g(e)},[]),(0,B.jsx)(Ag,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault())})}),Hre=L.forwardRef((e,t)=>{let n=bg(Og,e.__scopeDialog),r=L.useRef(!1),i=L.useRef(!1);return(0,B.jsx)(Ag,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Ag=L.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=bg(Og,n),c=L.useRef(null),l=Tm(t,c);return zh(),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Nh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(Ah,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Lg(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Wre,{titleId:s.titleId}),(0,B.jsx)(Kre,{contentRef:c,descriptionId:s.descriptionId})]})]})}),jg=`DialogTitle`,Mg=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(jg,n);return(0,B.jsx)(Eh.h2,{id:i.titleId,...r,ref:t})});Mg.displayName=jg;var Ng=`DialogDescription`,Pg=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(Ng,n);return(0,B.jsx)(Eh.p,{id:i.descriptionId,...r,ref:t})});Pg.displayName=Ng;var Fg=`DialogClose`,Ig=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(Fg,n);return(0,B.jsx)(Eh.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});Ig.displayName=Fg;function Lg(e){return e?`open`:`closed`}var Rg=`DialogTitleWarning`,[Ure,zg]=ane(Rg,{contentName:Og,titleName:jg,docsSlug:`dialog`}),Wre=({titleId:e})=>{let t=zg(Rg),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return L.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Gre=`DialogDescriptionWarning`,Kre=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zg(Gre).contentName}}.`;return L.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Bg=xg,Vg=Tg,Hg=Dg,Ug=kg,Wg=Mg,Gg=Pg,Kg=Ig,qre=Bg,Jre=Vg,qg=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Hg,{className:V(`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,ref:n}));qg.displayName=Hg.displayName;var Yre=Pm(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Jg=L.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,B.jsxs)(Jre,{children:[(0,B.jsx)(qg,{}),(0,B.jsxs)(Ug,{ref:i,className:V(Yre({side:e}),t),...r,children:[n,(0,B.jsxs)(Kg,{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-secondary`,children:[(0,B.jsx)(xm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Jg.displayName=Ug.displayName;var Xre=({className:e,...t})=>(0,B.jsx)(`div`,{className:V(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Xre.displayName=`SheetHeader`;var Zre=({className:e,...t})=>(0,B.jsx)(`div`,{className:V(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Zre.displayName=`SheetFooter`;var Qre=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Wg,{ref:n,className:V(`text-lg font-semibold text-foreground`,e),...t}));Qre.displayName=Wg.displayName;var $re=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Gg,{ref:n,className:V(`text-sm text-muted-foreground`,e),...t}));$re.displayName=Gg.displayName;function Yg({className:e,...t}){return(0,B.jsx)(`div`,{className:V(`bg-muted animate-pulse rounded-md`,e),...t})}var eie=[`top`,`right`,`bottom`,`left`],Xg=Math.min,Zg=Math.max,Qg=Math.round,$g=Math.floor,e_=e=>({x:e,y:e}),tie={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function t_(e,t,n){return Zg(e,Xg(t,n))}function n_(e,t){return typeof e==`function`?e(t):e}function r_(e){return e.split(`-`)[0]}function i_(e){return e.split(`-`)[1]}function a_(e){return e===`x`?`y`:`x`}function o_(e){return e===`y`?`height`:`width`}function s_(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function c_(e){return a_(s_(e))}function nie(e,t,n){n===void 0&&(n=!1);let r=i_(e),i=c_(e),a=o_(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=f_(o)),[o,f_(o)]}function rie(e){let t=f_(e);return[l_(e),t,l_(t)]}function l_(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var u_=[`left`,`right`],d_=[`right`,`left`],iie=[`top`,`bottom`],aie=[`bottom`,`top`];function oie(e,t,n){switch(e){case`top`:case`bottom`:return n?t?d_:u_:t?u_:d_;case`left`:case`right`:return t?iie:aie;default:return[]}}function sie(e,t,n,r){let i=i_(e),a=oie(r_(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(l_)))),a}function f_(e){let t=r_(e);return tie[t]+e.slice(t.length)}function cie(e){return{top:0,right:0,bottom:0,left:0,...e}}function p_(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:cie(e)}function m_(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function h_(e,t,n){let{reference:r,floating:i}=e,a=s_(t),o=c_(t),s=o_(o),c=r_(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(i_(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function lie(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=n_(t,e),p=p_(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=m_(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=m_(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var uie=50,die=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:lie},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=h_(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=n_(e,t)||{};if(l==null)return{};let d=p_(u),f={x:n,y:r},p=c_(i),m=o_(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Xg(d[_],T),D=Xg(d[v],T),O=E,ee=C-h[m]-D,te=C/2-h[m]/2+w,k=t_(O,te,ee),A=!c.arrow&&i_(i)!=null&&te!==k&&a.reference[m]/2-(tee<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==s_(t))||T.every(e=>s_(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=s_(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function g_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function __(e){return eie.some(t=>e[t]>=0)}var mie=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=n_(e,t);switch(i){case`referenceHidden`:{let e=g_(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:__(e)}}}case`escaped`:{let e=g_(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:__(e)}}}default:return{}}}}},v_=new Set([`left`,`top`]);async function hie(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=r_(n),s=i_(n),c=s_(n)===`y`,l=v_.has(o)?-1:1,u=a&&c?-1:1,d=n_(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var gie=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await hie(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},_ie=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=n_(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=s_(r_(i)),p=a_(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=t_(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=t_(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},vie=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=n_(e,t),u={x:n,y:r},d=s_(i),f=a_(d),p=u[f],m=u[d],h=n_(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=v_.has(r_(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},yie=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=n_(e,t),u=await o.detectOverflow(t,l),d=r_(i),f=i_(i),p=s_(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Xg(h-u[g],v),x=Xg(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Zg(u.left,0),t=Zg(u.right,0),n=Zg(u.top,0),r=Zg(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Zg(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Zg(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function y_(){return typeof window<`u`}function b_(e){return C_(e)?(e.nodeName||``).toLowerCase():`#document`}function x_(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function S_(e){return((C_(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function C_(e){return y_()?e instanceof Node||e instanceof x_(e).Node:!1}function w_(e){return y_()?e instanceof Element||e instanceof x_(e).Element:!1}function T_(e){return y_()?e instanceof HTMLElement||e instanceof x_(e).HTMLElement:!1}function E_(e){return!y_()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof x_(e).ShadowRoot}function D_(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=P_(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function bie(e){return/^(table|td|th)$/.test(b_(e))}function O_(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var xie=/transform|translate|scale|rotate|perspective|filter/,Sie=/paint|layout|strict|content/,k_=e=>!!e&&e!==`none`,A_;function j_(e){let t=w_(e)?P_(e):e;return k_(t.transform)||k_(t.translate)||k_(t.scale)||k_(t.rotate)||k_(t.perspective)||!M_()&&(k_(t.backdropFilter)||k_(t.filter))||xie.test(t.willChange||``)||Sie.test(t.contain||``)}function Cie(e){let t=I_(e);for(;T_(t)&&!N_(t);){if(j_(t))return t;if(O_(t))return null;t=I_(t)}return null}function M_(){return A_??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),A_}function N_(e){return/^(html|body|#document)$/.test(b_(e))}function P_(e){return x_(e).getComputedStyle(e)}function F_(e){return w_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function I_(e){if(b_(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||E_(e)&&e.host||S_(e);return E_(t)?t.host:t}function L_(e){let t=I_(e);return N_(t)?e.ownerDocument?e.ownerDocument.body:e.body:T_(t)&&D_(t)?t:L_(t)}function R_(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=L_(e),i=r===e.ownerDocument?.body,a=x_(r);if(i){let e=z_(a);return t.concat(a,a.visualViewport||[],D_(r)?r:[],e&&n?R_(e):[])}else return t.concat(r,R_(r,[],n))}function z_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function B_(e){let t=P_(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=T_(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Qg(n)!==a||Qg(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function V_(e){return w_(e)?e:e.contextElement}function H_(e){let t=V_(e);if(!T_(t))return e_(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=B_(t),o=(a?Qg(n.width):n.width)/r,s=(a?Qg(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var wie=e_(0);function U_(e){let t=x_(e);return!M_()||!t.visualViewport?wie:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Tie(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==x_(e)?!1:t}function W_(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=V_(e),o=e_(1);t&&(r?w_(r)&&(o=H_(r)):o=H_(e));let s=Tie(a,n,r)?U_(a):e_(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=x_(a),t=r&&w_(r)?x_(r):r,n=e,i=z_(n);for(;i&&r&&t!==n;){let e=H_(i),t=i.getBoundingClientRect(),r=P_(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=x_(i),i=z_(n)}}return m_({width:u,height:d,x:c,y:l})}function G_(e,t){let n=F_(e).scrollLeft;return t?t.left+n:W_(S_(e)).left+n}function K_(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-G_(e,n),y:n.top+t.scrollTop}}function Eie(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=S_(r),s=t?O_(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=e_(1),u=e_(0),d=T_(r);if((d||!d&&!a)&&((b_(r)!==`body`||D_(o))&&(c=F_(r)),d)){let e=W_(r);l=H_(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?K_(o,c):e_(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Die(e){return Array.from(e.getClientRects())}function Oie(e){let t=S_(e),n=F_(e),r=e.ownerDocument.body,i=Zg(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Zg(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+G_(e),s=-n.scrollTop;return P_(r).direction===`rtl`&&(o+=Zg(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var q_=25;function kie(e,t){let n=x_(e),r=S_(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=M_();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=G_(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=q_&&(a-=o)}else l<=q_&&(a+=l);return{width:a,height:o,x:s,y:c}}function Aie(e,t){let n=W_(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=T_(e)?H_(e):e_(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function J_(e,t,n){let r;if(t===`viewport`)r=kie(e,n);else if(t===`document`)r=Oie(S_(e));else if(w_(t))r=Aie(t,n);else{let n=U_(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return m_(r)}function Y_(e,t){let n=I_(e);return n===t||!w_(n)||N_(n)?!1:P_(n).position===`fixed`||Y_(n,t)}function jie(e,t){let n=t.get(e);if(n)return n;let r=R_(e,[],!1).filter(e=>w_(e)&&b_(e)!==`body`),i=null,a=P_(e).position===`fixed`,o=a?I_(e):e;for(;w_(o)&&!N_(o);){let t=P_(o),n=j_(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||D_(o)&&!n&&Y_(e,o))?r=r.filter(e=>e!==o):i=t,o=I_(o)}return t.set(e,r),r}function Mie(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?O_(t)?[]:jie(t,this._c):[].concat(n),r],o=J_(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!$_(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function zie(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=V_(e),u=i||a?[...l?R_(l):[],...t?R_(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Rie(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?W_(e):null;c&&g();function g(){let t=W_(e);h&&!$_(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Bie=gie,Vie=_ie,Hie=pie,Uie=yie,Wie=mie,ev=fie,Gie=vie,Kie=(e,t,n)=>{let r=new Map,i={platform:Lie,...n},a={...i.platform,_c:r};return die(e,t,{...i,platform:a})},tv=typeof document<`u`?L.useLayoutEffect:function(){};function nv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!nv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!nv(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function rv(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iv(e,t){let n=rv(e);return Math.round(t*n)/n}function av(e){let t=L.useRef(e);return tv(()=>{t.current=e}),t}function qie(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=L.useState(r);nv(f,r)||p(r);let[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=L.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=L.useRef(null),C=L.useRef(null),w=L.useRef(u),T=c!=null,E=av(c),D=av(i),O=av(l),ee=L.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Kie(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};te.current&&!nv(w.current,t)&&(w.current=t,yh.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);tv(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=L.useRef(!1);tv(()=>(te.current=!0,()=>{te.current=!1}),[]),tv(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let k=L.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),A=L.useMemo(()=>({reference:b,floating:x}),[b,x]),j=L.useMemo(()=>{let e={position:n,left:0,top:0};if(!A.floating)return e;let t=iv(A.floating,u.x),r=iv(A.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...rv(A.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,A.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:ee,refs:k,elements:A,floatingStyles:j}),[u,ee,k,A,j])}var Jie=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ev({element:r.current,padding:i}).fn(n):r?ev({element:r,padding:i}).fn(n):{}}}},Yie=(e,t)=>{let n=Bie(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xie=(e,t)=>{let n=Vie(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zie=(e,t)=>({fn:Gie(e).fn,options:[e,t]}),Qie=(e,t)=>{let n=Hie(e);return{name:n.name,fn:n.fn,options:[e,t]}},$ie=(e,t)=>{let n=Uie(e);return{name:n.name,fn:n.fn,options:[e,t]}},eae=(e,t)=>{let n=Wie(e);return{name:n.name,fn:n.fn,options:[e,t]}},tae=(e,t)=>{let n=Jie(e);return{name:n.name,fn:n.fn,options:[e,t]}},nae=`Arrow`,ov=L.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,B.jsx)(Eh.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,B.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});ov.displayName=nae;var rae=ov;function sv(e){let[t,n]=L.useState(void 0);return Sh(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var cv=`Popper`,[lv,uv]=xh(cv),[iae,dv]=lv(cv),fv=e=>{let{__scopePopper:t,children:n}=e,[r,i]=L.useState(null);return(0,B.jsx)(iae,{scope:t,anchor:r,onAnchorChange:i,children:n})};fv.displayName=cv;var pv=`PopperAnchor`,mv=L.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=dv(pv,n),o=L.useRef(null),s=Tm(t,o),c=L.useRef(null);return L.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,B.jsx)(Eh.div,{...i,ref:s})});mv.displayName=pv;var hv=`PopperContent`,[aae,oae]=lv(hv),gv=L.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=dv(hv,n),[_,v]=L.useState(null),y=Tm(t,e=>v(e)),[b,x]=L.useState(null),S=sv(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(cae),altBoundary:O},{refs:te,floatingStyles:k,placement:A,isPositioned:j,middlewareData:M}=qie({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>zie(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Yie({mainAxis:i+w,alignmentAxis:o}),c&&Xie({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Zie():void 0,...ee}),c&&Qie({...ee}),$ie({...ee,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&tae({element:b,padding:s}),lae({arrowWidth:C,arrowHeight:w}),f&&eae({strategy:`referenceHidden`,...ee})]}),[N,P]=yv(A),F=Oh(m);Sh(()=>{j&&F?.()},[j,F]);let I=M.arrow?.x,ne=M.arrow?.y,re=M.arrow?.centerOffset!==0,[ie,ae]=L.useState();return Sh(()=>{_&&ae(window.getComputedStyle(_).zIndex)},[_]),(0,B.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...k,transform:j?k.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ie,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,B.jsx)(aae,{scope:n,placedSide:N,onArrowChange:x,arrowX:I,arrowY:ne,shouldHideArrow:re,children:(0,B.jsx)(Eh.div,{"data-side":N,"data-align":P,...h,ref:y,style:{...h.style,animation:j?void 0:`none`}})})})});gv.displayName=hv;var _v=`PopperArrow`,sae={top:`bottom`,right:`left`,bottom:`top`,left:`right`},vv=L.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=oae(_v,n),a=sae[i.placedSide];return(0,B.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,B.jsx)(rae,{...r,ref:t,style:{...r.style,display:`block`}})})});vv.displayName=_v;function cae(e){return e!==null}var lae=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=yv(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function yv(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var bv=fv,xv=mv,Sv=gv,Cv=vv,wv=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),uae=`VisuallyHidden`,Tv=L.forwardRef((e,t)=>(0,B.jsx)(Eh.span,{...e,ref:t,style:{...wv,...e.style}}));Tv.displayName=uae;var dae=Tv,[Ev,fae]=xh(`Tooltip`,[uv]),Dv=uv(),Ov=`TooltipProvider`,pae=700,kv=`tooltip.open`,[mae,Av]=Ev(Ov),jv=e=>{let{__scopeTooltip:t,delayDuration:n=pae,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=L.useRef(!0),s=L.useRef(!1),c=L.useRef(0);return L.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(mae,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:L.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:L.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:L.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};jv.displayName=Ov;var Mv=`Tooltip`,[hae,Nv]=Ev(Mv),Pv=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Av(Mv,e.__scopeTooltip),l=Dv(t),[u,d]=L.useState(null),f=Ch(),p=L.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=L.useRef(!1),[_,v]=wh({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(kv))):c.onClose(),a?.(e)},caller:Mv}),y=L.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=L.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=L.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=L.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return L.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(bv,{...l,children:(0,B.jsx)(hae,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:L.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:L.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};Pv.displayName=Mv;var Fv=`TooltipTrigger`,Iv=L.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Nv(Fv,n),a=Av(Fv,n),o=Dv(n),s=Tm(t,L.useRef(null),i.onTriggerChange),c=L.useRef(!1),l=L.useRef(!1),u=L.useCallback(()=>c.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(xv,{asChild:!0,...o,children:(0,B.jsx)(Eh.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:H(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:H(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:H(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:H(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:H(e.onBlur,i.onClose),onClick:H(e.onClick,i.onClose)})})});Iv.displayName=Fv;var Lv=`TooltipPortal`,[gae,_ae]=Ev(Lv,{forceMount:void 0}),vae=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Nv(Lv,t);return(0,B.jsx)(gae,{scope:t,forceMount:n,children:(0,B.jsx)(Ih,{present:n||a.open,children:(0,B.jsx)(Fh,{asChild:!0,container:i,children:r})})})};vae.displayName=Lv;var Rv=`TooltipContent`,zv=L.forwardRef((e,t)=>{let n=_ae(Rv,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Nv(Rv,e.__scopeTooltip);return(0,B.jsx)(Ih,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(Bv,{side:i,...a,ref:t}):(0,B.jsx)(yae,{side:i,...a,ref:t})})}),yae=L.forwardRef((e,t)=>{let n=Nv(Rv,e.__scopeTooltip),r=Av(Rv,e.__scopeTooltip),i=L.useRef(null),a=Tm(t,i),[o,s]=L.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=L.useCallback(()=>{s(null),d(!1)},[d]),p=L.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Tae(r,wae(r,n.getBoundingClientRect())),a=Eae(t.getBoundingClientRect());s(Oae([...i,...a])),d(!0)},[d]);return L.useEffect(()=>()=>f(),[f]),L.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),L.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Dae(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(Bv,{...e,ref:a})}),[bae,xae]=Ev(Mv,{isInside:!1}),Sae=mne(`TooltipContent`),Bv=L.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Nv(Rv,n),l=Dv(n),{onClose:u}=c;return L.useEffect(()=>(document.addEventListener(kv,u),()=>document.removeEventListener(kv,u)),[u]),L.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(Ah,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Sv,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(Sae,{children:r}),(0,B.jsx)(bae,{scope:n,isInside:!0,children:(0,B.jsx)(dae,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});zv.displayName=Rv;var Vv=`TooltipArrow`,Cae=L.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Dv(n);return xae(Vv,n).isInside?null:(0,B.jsx)(Cv,{...i,...r,ref:t})});Cae.displayName=Vv;function wae(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Tae(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Eae(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Dae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Oae(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y)),kae(t)}function kae(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Aae=jv,jae=Pv,Mae=Iv,Hv=zv,Uv=Aae,Wv=jae,Gv=Mae,Kv=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,B.jsx)(Hv,{ref:r,sideOffset:t,className:V(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));Kv.displayName=Hv.displayName;var Nae=`sidebar_state`,Pae=3600*24*7,Fae=`16rem`,Iae=`18rem`,Lae=`3rem`,Rae=`b`,qv=L.createContext(null);function Jv(){let e=L.useContext(qv);if(!e)throw Error(`useSidebar must be used within a SidebarProvider`);return e}var Yv=L.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=ate(),[l,u]=L.useState(!1),[d,f]=L.useState(e),p=t??d,m=L.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${Nae}=${t}; path=/; max-age=${Pae}`},[n,p]),h=L.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);L.useEffect(()=>{let e=e=>{e.key===Rae&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=L.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,B.jsx)(qv.Provider,{value:_,children:(0,B.jsx)(Uv,{delayDuration:0,children:(0,B.jsx)(`div`,{style:{"--sidebar-width":Fae,"--sidebar-width-icon":Lae,...i},className:V(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-svh w-full overflow-hidden`,r),ref:s,...o,children:a})})})});Yv.displayName=`SidebarProvider`;var Xv=L.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},o)=>{let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=Jv();return n===`none`?(0,B.jsx)(`div`,{className:V(`bg-sidebar text-sidebar-foreground flex h-full w-[--sidebar-width] flex-col`,r),ref:o,...a,children:i}):s?(0,B.jsx)(qre,{open:l,onOpenChange:u,...a,children:(0,B.jsx)(Jg,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-[--sidebar-width] p-0 [&>button]:hidden`,style:{"--sidebar-width":Iae},side:e,children:(0,B.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})})}):(0,B.jsx)(`div`,{ref:o,className:V(`bg-sidebar text-sidebar-foreground hidden md:flex h-svh w-[--sidebar-width] shrink-0 flex-col border-r transition-[width] duration-200 ease-linear overflow-hidden`,c===`collapsed`&&n===`offcanvas`&&`w-0 border-0`,c===`collapsed`&&n===`icon`&&`w-[--sidebar-width-icon]`,r),"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,...a,children:i})});Xv.displayName=`Sidebar`;var Zv=L.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=Jv();return(0,B.jsxs)(_h,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:V(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,B.jsx)(Bee,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});Zv.displayName=`SidebarTrigger`;var zae=L.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=Jv();return(0,B.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:V(`hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});zae.displayName=`SidebarRail`;var Bae=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`main`,{ref:n,className:V(`relative flex min-h-svh flex-1 flex-col bg-background`,`peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));Bae.displayName=`SidebarInset`;var Qv=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(vh,{ref:n,"data-sidebar":`input`,className:V(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));Qv.displayName=`SidebarInput`;var $v=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:V(`flex flex-col gap-2 p-2`,e),...t}));$v.displayName=`SidebarHeader`;var Vae=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:V(`flex flex-col gap-2 p-2`,e),...t}));Vae.displayName=`SidebarFooter`;var ey=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(bh,{ref:n,"data-sidebar":`separator`,className:V(`mx-2 w-auto bg-sidebar-border`,e),...t}));ey.displayName=`SidebarSeparator`;var ty=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:V(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,e),...t}));ty.displayName=`SidebarContent`;var ny=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:V(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));ny.displayName=`SidebarGroup`;var ry=L.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,B.jsx)(t?km:`div`,{ref:r,"data-sidebar":`group-label`,className:V(`text-xs/6 font-medium text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 outline-none transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e),...n}));ry.displayName=`SidebarGroupLabel`;var Hae=L.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,B.jsx)(t?km:`button`,{ref:r,"data-sidebar":`group-action`,className:V(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));Hae.displayName=`SidebarGroupAction`;var iy=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:V(`w-full text-sm`,e),...t}));iy.displayName=`SidebarGroupContent`;var ay=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:V(`flex w-full min-w-0 flex-col gap-1`,e),...t}));ay.displayName=`SidebarMenu`;var oy=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:V(`group/menu-item relative`,e),...t}));oy.displayName=`SidebarMenuItem`;var sy=L.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?km:`button`,{isMobile:l,state:u}=Jv(),d=(0,B.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:V(Uae({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:d}),(0,B.jsx)(Kv,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});sy.displayName=`SidebarMenuButton`;var Uae=Pm(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),Wae=L.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,B.jsx)(t?km:`button`,{ref:i,"data-sidebar":`menu-action`,className:V(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));Wae.displayName=`SidebarMenuAction`;var Gae=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:V(`text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));Gae.displayName=`SidebarMenuBadge`;var cy=L.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=L.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,B.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:V(`rounded-md h-8 flex gap-2 px-2 items-center`,e),...n,children:[t&&(0,B.jsx)(Yg,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,B.jsx)(Yg,{className:`h-4 flex-1 max-w-[--skeleton-width]`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});cy.displayName=`SidebarMenuSkeleton`;var ly=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:V(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));ly.displayName=`SidebarMenuSub`;var uy=L.forwardRef(({...e},t)=>(0,B.jsx)(`li`,{ref:t,...e}));uy.displayName=`SidebarMenuSubItem`;var dy=L.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,B.jsx)(e?km:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:V(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,r),...i}));dy.displayName=`SidebarMenuSubButton`;var fy=`Collapsible`,[Kae,qae]=xh(fy),[Jae,py]=Kae(fy),my=L.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=wh({prop:r,defaultProp:i??!1,onChange:o,caller:fy});return(0,B.jsx)(Jae,{scope:n,disabled:a,contentId:Ch(),open:c,onOpenToggle:L.useCallback(()=>l(e=>!e),[l]),children:(0,B.jsx)(Eh.div,{"data-state":yy(c),"data-disabled":a?``:void 0,...s,ref:t})})});my.displayName=fy;var hy=`CollapsibleTrigger`,gy=L.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=py(hy,n);return(0,B.jsx)(Eh.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":yy(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:H(e.onClick,i.onOpenToggle)})});gy.displayName=hy;var _y=`CollapsibleContent`,vy=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=py(_y,e.__scopeCollapsible);return(0,B.jsx)(Ih,{present:n||i.open,children:({present:e})=>(0,B.jsx)(Yae,{...r,ref:t,present:e})})});vy.displayName=_y;var Yae=L.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=py(_y,n),[s,c]=L.useState(r),l=L.useRef(null),u=Tm(t,l),d=L.useRef(0),f=d.current,p=L.useRef(0),m=p.current,h=o.open||s,g=L.useRef(h),_=L.useRef(void 0);return L.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),Sh(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,B.jsx)(Eh.div,{"data-state":yy(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function yy(e){return e?`open`:`closed`}var by=my,xy=gy,Sy=vy;function Cy(e){let t=e+`CollectionProvider`,[n,r]=xh(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=L.useRef(null),a=L.useRef(new Map).current;return(0,B.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Th(s),l=L.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,B.jsx)(c,{ref:Tm(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Th(u),p=L.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=L.useRef(null),s=Tm(t,o),c=a(u,n);return L.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,B.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return L.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var Xae=L.createContext(void 0);function wy(e){let t=L.useContext(Xae);return e||t||`ltr`}var Ty=`rovingFocusGroup.onEntryFocus`,Zae={bubbles:!1,cancelable:!0},Ey=`RovingFocusGroup`,[Dy,Oy,Qae]=Cy(Ey),[$ae,ky]=xh(Ey,[Qae]),[eoe,toe]=$ae(Ey),Ay=L.forwardRef((e,t)=>(0,B.jsx)(Dy.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Dy.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(noe,{...e,ref:t})})}));Ay.displayName=Ey;var noe=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=L.useRef(null),p=Tm(t,f),m=wy(a),[h,g]=wh({prop:o,defaultProp:s??null,onChange:c,caller:Ey}),[_,v]=L.useState(!1),y=Oh(l),b=Oy(n),x=L.useRef(!1),[S,C]=L.useState(0);return L.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Ty,y),()=>e.removeEventListener(Ty,y)},[y]),(0,B.jsx)(eoe,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:L.useCallback(e=>g(e),[g]),onItemShiftTab:L.useCallback(()=>v(!0),[]),onFocusableItemAdd:L.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:L.useCallback(()=>C(e=>e-1),[]),children:(0,B.jsx)(Eh.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:H(e.onMouseDown,()=>{x.current=!0}),onFocus:H(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Ty,Zae);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Ny([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:H(e.onBlur,()=>v(!1))})})}),jy=`RovingFocusGroupItem`,My=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ch(),l=a||c,u=toe(jy,n),d=u.currentTabStopId===l,f=Oy(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return L.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(Dy.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(Eh.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:H(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:H(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:H(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=aoe(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ooe(n,r+1):n.slice(r+1)}setTimeout(()=>Ny(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});My.displayName=jy;var roe={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function ioe(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function aoe(e,t,n){let r=ioe(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return roe[r]}function Ny(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ooe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Py=Ay,Fy=My,Iy=[`Enter`,` `],soe=[`ArrowDown`,`PageUp`,`Home`],Ly=[`ArrowUp`,`PageDown`,`End`],coe=[...soe,...Ly],loe={ltr:[...Iy,`ArrowRight`],rtl:[...Iy,`ArrowLeft`]},uoe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Ry=`Menu`,[zy,doe,foe]=Cy(Ry),[By,Vy]=xh(Ry,[foe,uv,ky]),Hy=uv(),Uy=ky(),[Wy,Gy]=By(Ry),[poe,Ky]=By(Ry),qy=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Hy(t),[c,l]=L.useState(null),u=L.useRef(!1),d=Oh(a),f=wy(i);return L.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,B.jsx)(bv,{...s,children:(0,B.jsx)(Wy,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,B.jsx)(poe,{scope:t,onClose:L.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};qy.displayName=Ry;var moe=`MenuAnchor`,Jy=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Hy(n);return(0,B.jsx)(xv,{...i,...r,ref:t})});Jy.displayName=moe;var Yy=`MenuPortal`,[hoe,Xy]=By(Yy,{forceMount:void 0}),Zy=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Gy(Yy,t);return(0,B.jsx)(hoe,{scope:t,forceMount:n,children:(0,B.jsx)(Ih,{present:n||a.open,children:(0,B.jsx)(Fh,{asChild:!0,container:i,children:r})})})};Zy.displayName=Yy;var Qy=`MenuContent`,[goe,$y]=By(Qy),eb=L.forwardRef((e,t)=>{let n=Xy(Qy,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Gy(Qy,e.__scopeMenu),o=Ky(Qy,e.__scopeMenu);return(0,B.jsx)(zy.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(Ih,{present:r||a.open,children:(0,B.jsx)(zy.Slot,{scope:e.__scopeMenu,children:o.modal?(0,B.jsx)(_oe,{...i,ref:t}):(0,B.jsx)(voe,{...i,ref:t})})})})}),_oe=L.forwardRef((e,t)=>{let n=Gy(Qy,e.__scopeMenu),r=L.useRef(null),i=Tm(t,r);return L.useEffect(()=>{let e=r.current;if(e)return _g(e)},[]),(0,B.jsx)(tb,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),voe=L.forwardRef((e,t)=>{let n=Gy(Qy,e.__scopeMenu);return(0,B.jsx)(tb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),yoe=Th(`MenuContent.ScrollLock`),tb=L.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Gy(Qy,n),_=Ky(Qy,n),v=Hy(n),y=Uy(n),b=doe(n),[x,S]=L.useState(null),C=L.useRef(null),w=Tm(t,C,g.onContentChange),T=L.useRef(0),E=L.useRef(``),D=L.useRef(0),O=L.useRef(null),ee=L.useRef(`right`),te=L.useRef(0),k=m?dg:L.Fragment,A=m?{as:yoe,allowPinchZoom:!0}:void 0,j=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Moe(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};L.useEffect(()=>()=>window.clearTimeout(T.current),[]),zh();let M=L.useCallback(e=>ee.current===O.current?.side&&Poe(e,O.current?.area),[]);return(0,B.jsx)(goe,{scope:n,searchRef:E,onItemEnter:L.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:L.useCallback(e=>{M(e)||(C.current?.focus(),S(null))},[M]),onTriggerLeave:L.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:D,onPointerGraceIntentChange:L.useCallback(e=>{O.current=e},[]),children:(0,B.jsx)(k,{...A,children:(0,B.jsx)(Nh,{asChild:!0,trapped:i,onMountAutoFocus:H(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,B.jsx)(Ah,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,B.jsx)(Py,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:H(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,B.jsx)(Sv,{role:`menu`,"aria-orientation":`vertical`,"data-state":wb(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:H(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&j(e.key));let i=C.current;if(e.target!==i||!coe.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Ly.includes(e.key)&&a.reverse(),Aoe(a)}),onBlur:H(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:H(e.onPointerMove,Db(e=>{let t=e.target,n=te.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ee.current=e.clientX>te.current?`right`:`left`,te.current=e.clientX)}))})})})})})})});eb.displayName=Qy;var boe=`MenuGroup`,nb=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(Eh.div,{role:`group`,...r,ref:t})});nb.displayName=boe;var xoe=`MenuLabel`,rb=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(Eh.div,{...r,ref:t})});rb.displayName=xoe;var ib=`MenuItem`,ab=`menu.itemSelect`,ob=L.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=L.useRef(null),o=Ky(ib,e.__scopeMenu),s=$y(ib,e.__scopeMenu),c=Tm(t,a),l=L.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(ab,{bubbles:!0,cancelable:!0});e.addEventListener(ab,e=>r?.(e),{once:!0}),Dh(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,B.jsx)(sb,{...i,ref:c,disabled:n,onClick:H(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:H(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:H(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Iy.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});ob.displayName=ib;var sb=L.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=$y(ib,n),s=Uy(n),c=L.useRef(null),l=Tm(t,c),[u,d]=L.useState(!1),[f,p]=L.useState(``);return L.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,B.jsx)(zy.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,B.jsx)(Fy,{asChild:!0,...s,focusable:!r,children:(0,B.jsx)(Eh.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:H(e.onPointerMove,Db(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:H(e.onPointerLeave,Db(e=>o.onItemLeave(e))),onFocus:H(e.onFocus,()=>d(!0)),onBlur:H(e.onBlur,()=>d(!1))})})})}),Soe=`MenuCheckboxItem`,cb=L.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,B.jsx)(mb,{scope:e.__scopeMenu,checked:n,children:(0,B.jsx)(ob,{role:`menuitemcheckbox`,"aria-checked":Tb(n)?`mixed`:n,...i,ref:t,"data-state":Eb(n),onSelect:H(i.onSelect,()=>r?.(Tb(n)?!0:!n),{checkForDefaultPrevented:!1})})})});cb.displayName=Soe;var lb=`MenuRadioGroup`,[Coe,woe]=By(lb,{value:void 0,onValueChange:()=>{}}),ub=L.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Oh(r);return(0,B.jsx)(Coe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,B.jsx)(nb,{...i,ref:t})})});ub.displayName=lb;var db=`MenuRadioItem`,fb=L.forwardRef((e,t)=>{let{value:n,...r}=e,i=woe(db,e.__scopeMenu),a=n===i.value;return(0,B.jsx)(mb,{scope:e.__scopeMenu,checked:a,children:(0,B.jsx)(ob,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Eb(a),onSelect:H(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});fb.displayName=db;var pb=`MenuItemIndicator`,[mb,Toe]=By(pb,{checked:!1}),hb=L.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Toe(pb,n);return(0,B.jsx)(Ih,{present:r||Tb(a.checked)||a.checked===!0,children:(0,B.jsx)(Eh.span,{...i,ref:t,"data-state":Eb(a.checked)})})});hb.displayName=pb;var Eoe=`MenuSeparator`,gb=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(Eh.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});gb.displayName=Eoe;var Doe=`MenuArrow`,_b=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Hy(n);return(0,B.jsx)(Cv,{...i,...r,ref:t})});_b.displayName=Doe;var vb=`MenuSub`,[Ooe,yb]=By(vb),koe=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Gy(vb,t),o=Hy(t),[s,c]=L.useState(null),[l,u]=L.useState(null),d=Oh(i);return L.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,B.jsx)(bv,{...o,children:(0,B.jsx)(Wy,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,B.jsx)(Ooe,{scope:t,contentId:Ch(),triggerId:Ch(),trigger:s,onTriggerChange:c,children:n})})})};koe.displayName=vb;var bb=`MenuSubTrigger`,xb=L.forwardRef((e,t)=>{let n=Gy(bb,e.__scopeMenu),r=Ky(bb,e.__scopeMenu),i=yb(bb,e.__scopeMenu),a=$y(bb,e.__scopeMenu),o=L.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=L.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return L.useEffect(()=>u,[u]),L.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,B.jsx)(Jy,{asChild:!0,...l,children:(0,B.jsx)(sb,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":wb(n.open),...e,ref:wm(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:H(e.onPointerMove,Db(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:H(e.onPointerLeave,Db(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:H(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||loe[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});xb.displayName=bb;var Sb=`MenuSubContent`,Cb=L.forwardRef((e,t)=>{let n=Xy(Qy,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Gy(Qy,e.__scopeMenu),o=Ky(Qy,e.__scopeMenu),s=yb(Sb,e.__scopeMenu),c=L.useRef(null),l=Tm(t,c);return(0,B.jsx)(zy.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(Ih,{present:r||a.open,children:(0,B.jsx)(zy.Slot,{scope:e.__scopeMenu,children:(0,B.jsx)(tb,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:H(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:H(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:H(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=uoe[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Cb.displayName=Sb;function wb(e){return e?`open`:`closed`}function Tb(e){return e===`indeterminate`}function Eb(e){return Tb(e)?`indeterminate`:e?`checked`:`unchecked`}function Aoe(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function joe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Moe(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=joe(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Noe(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Poe(e,t){return t?Noe({x:e.clientX,y:e.clientY},t):!1}function Db(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Foe=qy,Ioe=Jy,Loe=Zy,Roe=eb,zoe=nb,Boe=rb,Voe=ob,Hoe=cb,Uoe=ub,Woe=fb,Goe=hb,Koe=gb,qoe=_b,Joe=xb,Yoe=Cb,Ob=`DropdownMenu`,[Xoe,Zoe]=xh(Ob,[Vy]),kb=Vy(),[Qoe,Ab]=Xoe(Ob),jb=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=kb(t),l=L.useRef(null),[u,d]=wh({prop:i,defaultProp:a??!1,onChange:o,caller:Ob});return(0,B.jsx)(Qoe,{scope:t,triggerId:Ch(),triggerRef:l,contentId:Ch(),open:u,onOpenChange:d,onOpenToggle:L.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,B.jsx)(Foe,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};jb.displayName=Ob;var Mb=`DropdownMenuTrigger`,Nb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Ab(Mb,n),o=kb(n);return(0,B.jsx)(Ioe,{asChild:!0,...o,children:(0,B.jsx)(Eh.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:wm(t,a.triggerRef),onPointerDown:H(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:H(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Nb.displayName=Mb;var $oe=`DropdownMenuPortal`,Pb=e=>{let{__scopeDropdownMenu:t,...n}=e,r=kb(t);return(0,B.jsx)(Loe,{...r,...n})};Pb.displayName=$oe;var Fb=`DropdownMenuContent`,Ib=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ab(Fb,n),a=kb(n),o=L.useRef(!1);return(0,B.jsx)(Roe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:H(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Ib.displayName=Fb;var ese=`DropdownMenuGroup`,tse=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(zoe,{...i,...r,ref:t})});tse.displayName=ese;var nse=`DropdownMenuLabel`,Lb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Boe,{...i,...r,ref:t})});Lb.displayName=nse;var rse=`DropdownMenuItem`,Rb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Voe,{...i,...r,ref:t})});Rb.displayName=rse;var ise=`DropdownMenuCheckboxItem`,zb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Hoe,{...i,...r,ref:t})});zb.displayName=ise;var ase=`DropdownMenuRadioGroup`,ose=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Uoe,{...i,...r,ref:t})});ose.displayName=ase;var sse=`DropdownMenuRadioItem`,Bb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Woe,{...i,...r,ref:t})});Bb.displayName=sse;var cse=`DropdownMenuItemIndicator`,Vb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Goe,{...i,...r,ref:t})});Vb.displayName=cse;var lse=`DropdownMenuSeparator`,Hb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Koe,{...i,...r,ref:t})});Hb.displayName=lse;var use=`DropdownMenuArrow`,dse=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(qoe,{...i,...r,ref:t})});dse.displayName=use;var fse=`DropdownMenuSubTrigger`,Ub=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Joe,{...i,...r,ref:t})});Ub.displayName=fse;var pse=`DropdownMenuSubContent`,Wb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Yoe,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Wb.displayName=pse;var mse=jb,hse=Nb,gse=Pb,Gb=Ib,Kb=Lb,qb=Rb,Jb=zb,Yb=Bb,Xb=Vb,Zb=Hb,Qb=Ub,$b=Wb,ex=mse,tx=hse,_se=L.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,B.jsxs)(Qb,{ref:i,className:V(`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,B.jsx)(Fp,{className:`ml-auto`})]}));_se.displayName=Qb.displayName;var vse=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)($b,{ref:n,className:V(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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`,e),...t}));vse.displayName=$b.displayName;var nx=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,B.jsx)(gse,{children:(0,B.jsx)(Gb,{ref:r,sideOffset:t,className:V(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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`,e),...n})}));nx.displayName=Gb.displayName;var rx=L.forwardRef(({className:e,inset:t,...n},r)=>(0,B.jsx)(qb,{ref:r,className:V(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));rx.displayName=qb.displayName;var yse=L.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,B.jsxs)(Jb,{ref:i,className:V(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(Xb,{children:(0,B.jsx)(Np,{className:`h-4 w-4`})})}),t]}));yse.displayName=Jb.displayName;var bse=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(Yb,{ref:r,className:V(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(Xb,{children:(0,B.jsx)(Mee,{className:`h-2 w-2 fill-current`})})}),t]}));bse.displayName=Yb.displayName;var ix=L.forwardRef(({className:e,inset:t,...n},r)=>(0,B.jsx)(Kb,{ref:r,className:V(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));ix.displayName=Kb.displayName;var ax=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Zb,{ref:n,className:V(`-mx-1 my-1 h-px bg-muted`,e),...t}));ax.displayName=Zb.displayName;var xse=({className:e,...t})=>(0,B.jsx)(`span`,{className:V(`ml-auto text-xs tracking-widest opacity-60`,e),...t});xse.displayName=`DropdownMenuShortcut`;var ox={object:{label:`Objects`,icon:nm},hook:{label:`Hooks`,icon:Dp},mapping:{label:`Mappings`,icon:em},analyticsCube:{label:`Analytics Cubes`,icon:Oee},data:{label:`Seed Data`,icon:Up},app:{label:`Apps`,icon:Op},action:{label:`Actions`,icon:Sm},view:{label:`Views`,icon:Wp},page:{label:`Pages`,icon:Gp},dashboard:{label:`Dashboards`,icon:Mp},report:{label:`Reports`,icon:Kp},theme:{label:`Themes`,icon:rm},flow:{label:`Flows`,icon:ym},workflow:{label:`Workflows`,icon:ym},approval:{label:`Approvals`,icon:fm},webhook:{label:`Webhooks`,icon:vm},role:{label:`Roles`,icon:_m},permission:{label:`Permissions`,icon:$p},profile:{label:`Profiles`,icon:um},sharingRule:{label:`Sharing Rules`,icon:um},policy:{label:`Policies`,icon:um},agent:{label:`Agents`,icon:jp},tool:{label:`Tools`,icon:bm},ragPipeline:{label:`RAG Pipelines`,icon:Ap},api:{label:`APIs`,icon:qp},connector:{label:`Connectors`,icon:Xp},plugin:{label:`Plugins`,icon:Yp},kind:{label:`Kinds`,icon:Up}};function Sse(e){return ox[e]?.label||e.charAt(0).toUpperCase()+e.slice(1)}function Cse(e){return ox[e]?.icon||Yp}var sx=[{key:`data`,label:`Data`,icon:Up,types:[`object`,`hook`,`mapping`,`analyticsCube`,`data`]},{key:`ui`,label:`UI`,icon:Op,types:[`app`,`action`,`view`,`page`,`dashboard`,`report`,`theme`]},{key:`automation`,label:`Automation`,icon:ym,types:[`flow`,`workflow`,`approval`,`webhook`]},{key:`security`,label:`Security`,icon:um,types:[`role`,`permission`,`profile`,`sharingRule`,`policy`]},{key:`ai`,label:`AI`,icon:jp,types:[`agent`,`tool`,`ragPipeline`]},{key:`api`,label:`API`,icon:qp,types:[`api`,`connector`]}],cx=new Set([`plugin`,`kind`]),lx=`sys`,wse=`${lx}__`,Tse=`${lx}_`;function ux(e){return typeof e==`string`?e:e&&typeof e==`object`&&`defaultValue`in e?String(e.defaultValue):e&&typeof e==`object`&&`key`in e?String(e.key):``}function dx(e){if(e.isSystem===!0||e.namespace===lx)return!0;let t=e.name||e.id||``;return t.startsWith(wse)||t.startsWith(Tse)}var fx={app:Op,plugin:Yp,driver:Up,server:qp,ui:dm,theme:dm,agent:jp,module:nm,objectql:Up,adapter:Sm};function Ese({selectedObject:e,onSelectObject:t,selectedMeta:n,onSelectMeta:r,packages:i,selectedPackage:a,onSelectPackage:o,onSelectView:s,selectedView:c,...l}){let u=_p(),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(``),[h,g]=(0,L.useState)([]),[_,v]=(0,L.useState)({}),[y,b]=(0,L.useState)(new Set([`object`])),[x,S]=(0,L.useState)(!0),C=e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},w=(0,L.useCallback)(async()=>{f(!0);try{let e=await u.meta.getTypes(),t=[];e&&Array.isArray(e.types)?t=e.types:Array.isArray(e)&&(t=e);let n=new Set(sx.flatMap(e=>e.types).filter(e=>!e.endsWith(`s`))),r=t.map(e=>e.endsWith(`s`)&&n.has(e.slice(0,-1))?e.slice(0,-1):e),i=sx.flatMap(e=>e.types),o=new Set(r),s=i.filter(e=>{if(o.has(e))return!1;let t=e.endsWith(`s`)?e.slice(0,-1):e+`s`;return!o.has(t)}),c=Array.from(new Set([...r,...s]));g(c);let l=a?.manifest?.id,d=await Promise.all(c.filter(e=>!cx.has(e)).map(async e=>{try{let t=await u.meta.getItems(e,l?{packageId:l}:void 0),n=[];return Array.isArray(t)?n=t:t&&Array.isArray(t.items)?n=t.items:t&&Array.isArray(t.value)&&(n=t.value),[e,n]}catch{return[e,[]]}}));v(Object.fromEntries(d))}catch(e){console.error(`Failed to load metadata types`,e)}finally{f(!1)}},[u,a]);(0,L.useEffect)(()=>{w()},[w]),vp(`object`,w),vp(`view`,w),vp(`app`,w),vp(`agent`,w),vp(`tool`,w),vp(`flow`,w),vp(`dashboard`,w),vp(`report`,w);let T=(e,t)=>!p||e.toLowerCase().includes(p.toLowerCase())||t.toLowerCase().includes(p.toLowerCase()),E=(0,L.useMemo)(()=>(_.object||[]).filter(dx),[_]),D=(0,L.useMemo)(()=>{if(x)return _;let e={..._};return e.object&&=e.object.filter(e=>!dx(e)),e},[_,x]),O=sx.map(e=>{let t=e.types.filter(e=>h.includes(e)&&!cx.has(e)&&(D[e]?.length??0)>0),n=t.reduce((e,t)=>e+(D[t]?.length??0),0);return{...e,visibleTypes:t,totalItems:n}}).filter(e=>e.totalItems>0),ee=a?fx[a.manifest?.type]||nm:dm;return(0,B.jsxs)(Xv,{...l,children:[(0,B.jsx)($v,{className:`border-b`,children:(0,B.jsxs)(ex,{children:[(0,B.jsx)(tx,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-sidebar-accent transition-colors`,children:[(0,B.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:(0,B.jsx)(ee,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{className:`flex flex-1 min-w-0 flex-col gap-0.5 leading-none overflow-hidden`,children:[(0,B.jsx)(`span`,{className:`truncate font-semibold text-sm`,children:a?a.manifest?.name||a.manifest?.id:`ObjectStack`}),(0,B.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:a?`v${a.manifest?.version} · ${a.manifest?.type}`:`Loading packages...`})]}),(0,B.jsx)(Aee,{className:`ml-auto h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,B.jsxs)(nx,{className:`w-[--radix-dropdown-menu-trigger-width] min-w-64`,align:`start`,sideOffset:4,children:[(0,B.jsx)(ix,{children:`Installed Packages`}),(0,B.jsx)(ax,{}),i.map(e=>{let t=fx[e.manifest?.type]||nm,n=a?.manifest?.id===e.manifest?.id;return(0,B.jsxs)(rx,{onClick:()=>o(e),className:`gap-2 py-2`,children:[(0,B.jsx)(`div`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded bg-primary/10 text-primary`,children:(0,B.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col leading-tight`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium`,children:e.manifest?.name||e.manifest?.id}),(0,B.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,e.manifest?.version,` · `,e.manifest?.type,!e.enabled&&` · disabled`]})]}),n&&(0,B.jsx)(Np,{className:`h-4 w-4 text-primary`})]},e.manifest?.id)}),i.length===0&&(0,B.jsx)(`div`,{className:`px-2 py-4 text-center text-xs text-muted-foreground`,children:`No packages installed`})]})]})}),(0,B.jsxs)(ty,{children:[(0,B.jsx)(ny,{children:(0,B.jsx)(iy,{children:(0,B.jsx)(ay,{children:(0,B.jsx)(oy,{children:(0,B.jsxs)(sy,{isActive:c===`overview`&&!e,onClick:()=>{t(``),s?.(`overview`)},children:[(0,B.jsx)(Ree,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:`Overview`})]})})})})}),(0,B.jsx)(`div`,{className:`px-4 pb-2`,children:(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(sm,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(Qv,{placeholder:`Search metadata...`,value:p,onChange:e=>m(e.target.value),className:`pl-8`})]})}),(0,B.jsx)(ey,{}),d?(0,B.jsxs)(ny,{children:[(0,B.jsx)(ry,{children:`Loading...`}),(0,B.jsx)(iy,{children:(0,B.jsx)(ay,{children:[1,2,3].map(e=>(0,B.jsx)(oy,{children:(0,B.jsx)(cy,{showIcon:!0})},e))})})]}):O.map(i=>(0,B.jsxs)(ny,{children:[(0,B.jsxs)(ry,{children:[(0,B.jsx)(i.icon,{className:`mr-1.5 h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:i.label}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-sidebar-foreground/50`,children:i.totalItems}),i.key===`data`&&E.length>0&&(0,B.jsx)(`button`,{type:`button`,title:x?`Hide system objects`:`Show system objects`,"aria-label":x?`Hide system objects`:`Show system objects`,onClick:e=>{e.stopPropagation(),S(!x)},className:`ml-1 shrink-0 rounded p-0.5 text-sidebar-foreground/50 hover:text-sidebar-foreground hover:bg-sidebar-accent transition-colors`,children:x?(0,B.jsx)(Wp,{className:`h-3 w-3`}):(0,B.jsx)(Iee,{className:`h-3 w-3`})})]}),(0,B.jsx)(iy,{children:(0,B.jsx)(ay,{children:i.visibleTypes.map(i=>{let a=D[i]||[],o=Cse(i),s=Sse(i),c=i===`object`,l=y.has(i)||!!p,u=a.filter(e=>T(ux(e.label)||e.name||``,e.name||``));return u.length===0&&p?null:(0,B.jsx)(by,{open:l,onOpenChange:()=>C(i),asChild:!0,children:(0,B.jsxs)(oy,{children:[(0,B.jsx)(xy,{asChild:!0,children:(0,B.jsxs)(sy,{tooltip:`${s} (${a.length})`,children:[(0,B.jsx)(o,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:s}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:a.length}),(0,B.jsx)(Fp,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ${l?`rotate-90`:``}`})]})}),(0,B.jsx)(Sy,{children:(0,B.jsx)(ly,{children:u.map(a=>{let o=a.name||a.id||`unknown`,s=ux(a.label)||a.name||`Untitled`,l=o.includes(`__`)?o.split(`__`):[null,o],u=l.length===2&&l[0]?l[0]:null;return(0,B.jsx)(uy,{children:(0,B.jsx)(dy,{isActive:c?e===o:n?.type===i&&n?.name===o,onClick:c?()=>t(o):()=>r?.(i,o),children:(0,B.jsxs)(`span`,{className:`truncate`,children:[u&&(0,B.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[u,`__`]}),s]})})},o)})})})]})},i)})})})]},i.key)),!d&&O.length===0&&(0,B.jsxs)(`div`,{className:`px-4 py-8 text-xs text-muted-foreground flex flex-col items-center gap-2`,children:[(0,B.jsx)(Up,{className:`h-5 w-5 opacity-40`}),(0,B.jsx)(`span`,{children:`No metadata registered`})]}),(0,B.jsx)(ey,{}),(0,B.jsxs)(ny,{children:[(0,B.jsxs)(ry,{children:[(0,B.jsx)(Kee,{className:`mr-1.5 h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`System`}),E.length>0&&(0,B.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-sidebar-foreground/50`,children:E.length})]}),(0,B.jsx)(iy,{children:(0,B.jsxs)(ay,{children:[E.length>0&&(0,B.jsx)(by,{open:y.has(`_system_objects`)||!!p,onOpenChange:e=>{let t=y.has(`_system_objects`);e&&!t&&C(`_system_objects`),!e&&t&&C(`_system_objects`)},asChild:!0,children:(0,B.jsxs)(oy,{children:[(0,B.jsx)(xy,{asChild:!0,children:(0,B.jsxs)(sy,{tooltip:`System Objects (${E.length})`,children:[(0,B.jsx)(Up,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`System Objects`}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:E.length}),(0,B.jsx)(Fp,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ${y.has(`_system_objects`)||p?`rotate-90`:``}`})]})}),(0,B.jsx)(Sy,{children:(0,B.jsx)(ly,{children:E.filter(e=>T(ux(e.label)||e.name||``,e.name||``)).map(n=>{let r=n.name||n.id||`unknown`,i=ux(n.label)||n.name||`Untitled`;return(0,B.jsx)(uy,{children:(0,B.jsx)(dy,{isActive:e===r,onClick:()=>t(r),children:(0,B.jsxs)(`span`,{className:`truncate`,children:[dx(n)&&(0,B.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[lx,`:`]}),i]})})},r)})})})]})}),(0,B.jsx)(oy,{children:(0,B.jsxs)(sy,{tooltip:`API Console`,isActive:c===`api-console`,onClick:()=>s?.(`api-console`),children:[(0,B.jsx)(qp,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:`API Console`})]})}),(0,B.jsx)(oy,{children:(0,B.jsxs)(sy,{tooltip:`Packages`,isActive:c===`packages`,onClick:()=>s?.(`packages`),children:[(0,B.jsx)(nm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:`Packages`})]})})]})})]})]})]})}var Dse=Pm(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`),px=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`nav`,{ref:n,"aria-label":`breadcrumb`,className:V(Dse(),e),...t}));px.displayName=`Breadcrumb`;var mx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`ol`,{ref:n,className:V(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`,e),...t}));mx.displayName=`BreadcrumbList`;var hx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`li`,{ref:n,className:V(`inline-flex items-center gap-1.5`,e),...t}));hx.displayName=`BreadcrumbItem`;var gx=L.forwardRef(({asChild:e,className:t,...n},r)=>(0,B.jsx)(e?km:`a`,{ref:r,className:V(`hover:text-foreground transition-colors`,t),...n}));gx.displayName=`BreadcrumbLink`;var _x=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:V(`text-foreground font-normal`,e),...t}));_x.displayName=`BreadcrumbPage`;var vx=({children:e,className:t,...n})=>(0,B.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:V(`[&>svg]:size-3.5`,t),...n,children:e??(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:(0,B.jsx)(`path`,{d:`m9 18 6-6-6-6`})})});vx.displayName=`BreadcrumbSeparator`;var Ose=({className:e,...t})=>(0,B.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:V(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,B.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`}),(0,B.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`})]}),(0,B.jsx)(`span`,{className:`sr-only`,children:`More`})]});Ose.displayName=`BreadcrumbElipssis`;function kse(){let[e,t]=(0,L.useState)(`light`);(0,L.useEffect)(()=>{let e=localStorage.getItem(`theme`);if(e)t(e),n(e);else{let e=window.matchMedia(`(prefers-color-scheme: dark)`).matches;t(`system`),n(e?`dark`:`light`)}},[]);function n(e){let t=document.documentElement;e===`dark`?t.classList.add(`dark`):t.classList.remove(`dark`)}function r(e){if(t(e),localStorage.setItem(`theme`,e),e===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`).matches;n(e?`dark`:`light`)}else n(e)}return(0,B.jsxs)(ex,{children:[(0,B.jsx)(tx,{asChild:!0,children:(0,B.jsxs)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:[(0,B.jsx)(pm,{className:`h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,B.jsx)(tm,{className:`absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Toggle theme`})]})}),(0,B.jsxs)(nx,{align:`end`,children:[(0,B.jsxs)(rx,{onClick:()=>r(`light`),children:[(0,B.jsx)(pm,{className:`mr-2 h-4 w-4`}),`Light`]}),(0,B.jsxs)(rx,{onClick:()=>r(`dark`),children:[(0,B.jsx)(tm,{className:`mr-2 h-4 w-4`}),`Dark`]}),(0,B.jsx)(rx,{onClick:()=>r(`system`),children:`System`})]})]})}var Ase=Pm(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function yx({className:e,variant:t,...n}){return(0,B.jsx)(`div`,{className:V(Ase({variant:t}),e),...n})}function jse(){if(typeof window<`u`){let e=new URLSearchParams(window.location.search).get(`mode`);if(e===`msw`||e===`server`)return e}return`server`}function Mse(){return``}var bx={mode:jse(),serverUrl:Mse(),mswBasePath:``};function Nse(){return bx.mode===`msw`}function Pse(){return bx.mode===`server`}function xx(){return Pse()?bx.serverUrl:bx.mswBasePath}function Fse(){console.log(`[Console Config]`,{mode:bx.mode,apiBaseUrl:xx(),serverUrl:bx.serverUrl})}var Ise={actions:`Actions`,dashboards:`Dashboards`,reports:`Reports`,flows:`Flows`,agents:`Agents`,apis:`APIs`,ragPipelines:`RAG Pipelines`,profiles:`Profiles`,sharingRules:`Sharing Rules`,data:`Seed Data`};function Lse({selectedObject:e,selectedMeta:t,selectedView:n,packageLabel:r}){let i={overview:`Overview`,packages:`Package Manager`,"api-console":`API Console`,object:e||`Object`,metadata:t?Ise[t.type]||t.type:`Metadata`};return(0,B.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between gap-2 border-b px-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Zv,{className:`-ml-1`}),(0,B.jsx)(bh,{orientation:`vertical`,className:`mr-2 h-4`}),(0,B.jsx)(px,{children:(0,B.jsxs)(mx,{children:[(0,B.jsx)(hx,{className:`hidden md:block`,children:(0,B.jsxs)(gx,{href:`#`,className:`flex items-center gap-1.5`,children:[(0,B.jsx)(hm,{className:`h-3.5 w-3.5`}),r||`ObjectStack`]})}),(0,B.jsx)(vx,{className:`hidden md:block`}),(0,B.jsx)(hx,{children:(0,B.jsx)(_x,{className:`font-medium`,children:i[n]||`Overview`})}),n===`object`&&e&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(vx,{}),(0,B.jsx)(hx,{children:(0,B.jsx)(_x,{children:(0,B.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:e})})})]}),n===`metadata`&&t&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(vx,{}),(0,B.jsx)(hx,{children:(0,B.jsx)(_x,{children:(0,B.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:t.name})})})]})]})})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n===`object`&&e&&(0,B.jsxs)(yx,{variant:`outline`,className:`font-mono text-[10px] gap-1 hidden sm:flex`,children:[`/api/v1/data/`,e]}),n===`metadata`&&t&&(0,B.jsxs)(yx,{variant:`outline`,className:`font-mono text-[10px] gap-1 hidden sm:flex`,children:[`/api/v1/meta/`,t.type,`/`,t.name]}),(0,B.jsxs)(yx,{variant:`secondary`,className:`text-[10px] gap-1 font-mono`,children:[(0,B.jsx)(Hp,{className:`h-2.5 w-2.5`}),bx.mode.toUpperCase()]}),(0,B.jsx)(kse,{})]})]})}var Sx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:V(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));Sx.displayName=`Card`;var Cx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:V(`flex flex-col space-y-1.5 p-6`,e),...t}));Cx.displayName=`CardHeader`;var wx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`h3`,{ref:n,className:V(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));wx.displayName=`CardTitle`;var Tx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`p`,{ref:n,className:V(`text-sm text-muted-foreground`,e),...t}));Tx.displayName=`CardDescription`;var Ex=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:V(`p-6 pt-0`,e),...t}));Ex.displayName=`CardContent`;var Dx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:V(`flex items-center p-6 pt-0`,e),...t}));Dx.displayName=`CardFooter`;function Rse({packages:e,selectedPackage:t,onNavigate:n}){let r=_p(),[i,a]=(0,L.useState)({packages:{total:0,enabled:0,disabled:0,byType:{}},metadata:{types:[],counts:{}},loading:!0}),o=(0,L.useCallback)(async()=>{a(e=>({...e,loading:!0}));try{let n=await r.meta.getTypes(),i=n?.types||(Array.isArray(n)?n:[]),o=t?.manifest?.id,s=await Promise.all(i.map(async e=>{try{let t=await r.meta.getItems(e,o?{packageId:o}:void 0);return[e,(t?.items||(Array.isArray(t)?t:[])).length]}catch{return[e,0]}})),c=Object.fromEntries(s),l=e.filter(e=>e.enabled).length,u={};e.forEach(e=>{let t=e.manifest?.type||`unknown`;u[t]=(u[t]||0)+1}),a({packages:{total:e.length,enabled:l,disabled:e.length-l,byType:u},metadata:{types:i,counts:c},loading:!1})}catch(e){console.error(`[DeveloperOverview] Failed to load stats:`,e),a(e=>({...e,loading:!1}))}},[r,e,t]);(0,L.useEffect)(()=>{o()},[o]);let s=i.metadata.counts.object||0,c=Object.values(i.metadata.counts).reduce((e,t)=>e+t,0);return(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col gap-6 p-6 overflow-auto`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h1`,{className:`text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,B.jsx)(hm,{className:`h-6 w-6`}),`Developer Console`]}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Inspect metadata, manage packages, and explore the ObjectStack runtime.`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(yx,{variant:`outline`,className:`font-mono text-xs gap-1`,children:[(0,B.jsx)(Hp,{className:`h-3 w-3`}),bx.mode.toUpperCase()]}),(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,onClick:o,disabled:i.loading,children:[(0,B.jsx)(om,{className:`h-3.5 w-3.5 mr-1.5 ${i.loading?`animate-spin`:``}`}),`Refresh`]})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,B.jsxs)(Sx,{className:`cursor-pointer hover:border-primary/50 transition-colors`,onClick:()=>n(`packages`),children:[(0,B.jsxs)(Cx,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,B.jsx)(wx,{className:`text-sm font-medium`,children:`Packages`}),(0,B.jsx)(nm,{className:`h-4 w-4 text-muted-foreground`})]}),(0,B.jsxs)(Ex,{children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:i.packages.total}),(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[i.packages.enabled,` enabled · `,i.packages.disabled,` disabled`]})]})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,B.jsx)(wx,{className:`text-sm font-medium`,children:`Objects`}),(0,B.jsx)(Up,{className:`h-4 w-4 text-muted-foreground`})]}),(0,B.jsxs)(Ex,{children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:s}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Data model definitions`})]})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,B.jsx)(wx,{className:`text-sm font-medium`,children:`Metadata Types`}),(0,B.jsx)(Yp,{className:`h-4 w-4 text-muted-foreground`})]}),(0,B.jsxs)(Ex,{children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:i.metadata.types.length}),(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[c,` total items registered`]})]})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,B.jsx)(wx,{className:`text-sm font-medium`,children:`API Endpoints`}),(0,B.jsx)(qp,{className:`h-4 w-4 text-muted-foreground`})]}),(0,B.jsxs)(Ex,{children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold font-mono text-sm pt-1`,children:`/api/v1`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`REST · data · meta · packages`})]})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(wx,{className:`text-base`,children:`Installed Packages`}),(0,B.jsxs)(_h,{variant:`ghost`,size:`sm`,className:`text-xs gap-1`,onClick:()=>n(`packages`),children:[`View all `,(0,B.jsx)(Fee,{className:`h-3 w-3`})]})]}),(0,B.jsx)(Tx,{children:`Runtime package registry`})]}),(0,B.jsx)(Ex,{className:`space-y-2`,children:e.length===0?(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`No packages installed`}):e.slice(0,6).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-2 px-3 rounded-md hover:bg-muted/50 transition-colors`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,B.jsx)(wee,{className:`h-4 w-4 shrink-0 ${e.enabled?`text-primary`:`text-muted-foreground`}`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.manifest?.name}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground font-mono truncate`,children:e.manifest?.id})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] font-mono`,children:e.manifest?.version}),(0,B.jsx)(yx,{variant:e.enabled?`default`:`secondary`,className:`text-[10px]`,children:e.manifest?.type})]})]},e.manifest?.id))})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsx)(wx,{className:`text-base`,children:`Metadata Registry`}),(0,B.jsx)(Tx,{children:t?`Metadata from ${t.manifest?.name||t.manifest?.id}`:`All registered metadata types and item counts`})]}),(0,B.jsx)(Ex,{children:(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[i.metadata.types.length===0?(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading...`}):i.metadata.types.filter(e=>(i.metadata.counts[e]||0)>0).sort((e,t)=>(i.metadata.counts[t]||0)-(i.metadata.counts[e]||0)).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-2 px-3 rounded-md hover:bg-muted/50 transition-colors cursor-default`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Bp,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-sm font-mono`,children:e})]}),(0,B.jsx)(yx,{variant:`secondary`,className:`text-xs font-mono`,children:i.metadata.counts[e]})]},e)),i.metadata.types.filter(e=>(i.metadata.counts[e]||0)===0).length>0&&(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-2 px-3`,children:[`+ `,i.metadata.types.filter(e=>(i.metadata.counts[e]||0)===0).length,` empty types`]})]})})]})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsx)(wx,{className:`text-base`,children:`Quick Reference`}),(0,B.jsx)(Tx,{children:`Common API endpoints for this runtime`})]}),(0,B.jsx)(Ex,{children:(0,B.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2 lg:grid-cols-3`,children:[{method:`GET`,path:`/api/v1/meta/types`,desc:`List metadata types`},{method:`GET`,path:`/api/v1/meta/objects`,desc:`List object definitions`},{method:`GET`,path:`/api/v1/data/{object}`,desc:`Query records`},{method:`POST`,path:`/api/v1/data/{object}`,desc:`Create record`},{method:`GET`,path:`/api/v1/packages`,desc:`List packages`},{method:`GET`,path:`/api/v1/discovery`,desc:`API discovery`}].map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-start gap-2 py-2 px-3 rounded-md bg-muted/30 border border-transparent hover:border-border transition-colors`,children:[(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] font-mono shrink-0 mt-0.5 ${e.method===`GET`?`text-emerald-600 border-emerald-300 dark:text-emerald-400`:e.method===`POST`?`text-blue-600 border-blue-300 dark:text-blue-400`:`text-amber-600 border-amber-300`}`,children:e.method}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs font-mono`,children:e.path}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:e.desc})]})]},t))})})]})]})}var zse=1,Bse=1e6,Ox=0;function Vse(){return Ox=(Ox+1)%(2**53-1),Ox.toString()}var kx=new Map,Ax=e=>{if(kx.has(e))return;let t=setTimeout(()=>{kx.delete(e),Nx({type:`REMOVE_TOAST`,toastId:e})},Bse);kx.set(e,t)},Hse=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,zse)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?Ax(n):e.toasts.forEach(e=>{Ax(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},jx=[],Mx={toasts:[]};function Nx(e){Mx=Hse(Mx,e),jx.forEach(e=>{e(Mx)})}function Px({...e}){let t=Vse(),n=e=>Nx({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>Nx({type:`DISMISS_TOAST`,toastId:t});return Nx({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function Use(){let[e,t]=L.useState(Mx);return L.useEffect(()=>(jx.push(t),()=>{let e=jx.indexOf(t);e>-1&&jx.splice(e,1)}),[e]),{...e,toast:Px,dismiss:e=>Nx({type:`DISMISS_TOAST`,toastId:e})}}function Wse(){let e=_p(),[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)(!0),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),p=(0,L.useCallback)(async()=>{i(!0),o(null);try{n((await e.packages.list())?.packages||[])}catch(e){console.error(`[PackageManager] Failed to load packages:`,e),o(e.message||`Failed to load packages`)}finally{i(!1)}},[e]);(0,L.useEffect)(()=>{p()},[p]);let m=[`objectstack.json`,`dist/objectstack.json`];function h(e){if(!e)return e;if(e.bundle)return h(e.bundle);if(!(e.id||e.name)&&e.manifest&&(e.manifest.id||e.manifest.name)){let{manifest:t,...n}=e;return{...t,...n}}return e}async function g(e){let t=await fetch(e,{headers:{Accept:`application/json`}});if(!t.ok)throw Error(`Failed to fetch ${e} (${t.status})`);return t.json()}async function _(e){let t=e.trim();if(!t)throw Error(`Please enter a package or URL.`);if(/^https?:\/\//i.test(t))return h(await g(t));let n=`https://unpkg.com/${t.replace(/\/$/,``)}`,r=null;for(let e of m)try{return h(await g(`${n}/${e}`))}catch(e){r=e instanceof Error?e:Error(`Failed to fetch manifest`)}throw r||Error(`Failed to resolve manifest from unpkg.`)}async function v(){f(null),u(!0);try{let t=await _(s);if(!t||!t.id)throw Error(`Manifest missing required id field.`);let n=await e.packages.install(t,{enableOnInstall:!0});Px({title:`Package installed`,description:n?.package?.manifest?.name||n?.package?.manifest?.id||t.id}),c(``),await p()}catch(e){f(e?.message||`Failed to install package`),console.error(`[PackageManager] Install failed:`,e)}finally{u(!1)}}async function y(t){try{t.enabled?await e.packages.disable(t.manifest?.id):await e.packages.enable(t.manifest?.id),await p()}catch(e){console.error(`[PackageManager] Toggle failed:`,e)}}async function b(t){if(confirm(`Uninstall "${t.manifest?.name}"? This cannot be undone.`))try{await e.packages.uninstall(t.manifest?.id),await p()}catch(e){console.error(`[PackageManager] Uninstall failed:`,e)}}let x={app:`bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200`,plugin:`bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200`,driver:`bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200`,server:`bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200`,module:`bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200`};return(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col gap-6 p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`h1`,{className:`text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,B.jsx)(nm,{className:`h-6 w-6`}),`Package Manager`]}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage installed packages. A package may contain apps, objects, actions, and other metadata.`})]}),(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,onClick:p,disabled:r,children:[(0,B.jsx)(om,{className:`h-4 w-4 mr-1.5 ${r?`animate-spin`:``}`}),`Refresh`]})]}),a&&(0,B.jsx)(Sx,{className:`border-destructive`,children:(0,B.jsx)(Ex,{className:`py-4 text-destructive text-sm`,children:a})}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{children:[(0,B.jsx)(wx,{className:`text-base`,children:`Install from unpkg`}),(0,B.jsx)(Tx,{className:`text-xs`,children:`Enter a package spec (for example: @objectstack/app-crm@1.0.0) or a direct URL to objectstack.json.`})]}),(0,B.jsxs)(Ex,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,B.jsx)(vh,{value:s,onChange:e=>c(e.target.value),placeholder:`@objectstack/app-crm@1.0.0`}),(0,B.jsx)(_h,{onClick:v,disabled:l||!s.trim(),className:`sm:w-28`,children:l?`Installing...`:`Install`})]}),d&&(0,B.jsx)(`div`,{className:`text-xs text-destructive`,children:d})]})]}),r?(0,B.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[1,2].map(e=>(0,B.jsx)(Sx,{className:`animate-pulse`,children:(0,B.jsxs)(Cx,{children:[(0,B.jsx)(`div`,{className:`h-5 w-40 bg-muted rounded`}),(0,B.jsx)(`div`,{className:`h-3 w-60 bg-muted rounded mt-2`})]})},e))}):t.length===0?(0,B.jsx)(Sx,{className:`border-dashed`,children:(0,B.jsxs)(Ex,{className:`py-12 text-center`,children:[(0,B.jsx)(Yp,{className:`h-10 w-10 mx-auto mb-3 text-muted-foreground/40`}),(0,B.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No packages installed`})]})}):(0,B.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:t.map(e=>(0,B.jsxs)(Sx,{className:e.enabled?``:`opacity-60`,children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[e.manifest?.type===`app`?(0,B.jsx)(Op,{className:`h-5 w-5 shrink-0 text-blue-500`}):(0,B.jsx)(nm,{className:`h-5 w-5 shrink-0 text-purple-500`}),(0,B.jsx)(wx,{className:`text-base truncate`,children:e.manifest?.name||e.manifest?.id||`Unknown`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,B.jsxs)(yx,{variant:`outline`,className:`text-xs font-mono`,children:[`v`,e.manifest?.version||`?`]}),(0,B.jsx)(yx,{className:`text-xs ${x[e.manifest?.type||`module`]||x.module}`,children:e.manifest?.type||`unknown`})]})]}),(0,B.jsx)(Tx,{className:`text-xs mt-1`,children:e.manifest?.description||e.manifest?.id||`No description`})]}),(0,B.jsx)(Ex,{className:`pt-0`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(yx,{variant:e.enabled?`default`:`secondary`,className:`text-xs`,children:e.enabled?`Enabled`:`Disabled`}),e.installedAt&&(0,B.jsxs)(`span`,{children:[`Installed `,new Date(e.installedAt).toLocaleDateString()]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>y(e),title:e.enabled?`Disable`:`Enable`,children:e.enabled?(0,B.jsx)(Uee,{className:`h-3.5 w-3.5`}):(0,B.jsx)(Wee,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-7 w-7 text-destructive hover:text-destructive`,onClick:()=>b(e),title:`Uninstall`,children:(0,B.jsx)(gm,{className:`h-3.5 w-3.5`})})]})]})})]},e.manifest?.id||String(Math.random())))})]})}var Gse=[`plugin`,`plugins`,`kind`,`package`],Kse=[{method:`GET`,path:`/api/v1/discovery`,desc:`API Discovery`,group:`System`},{method:`GET`,path:`/api/v1/meta/types`,desc:`List metadata types`,group:`Metadata`},{method:`GET`,path:`/api/v1/packages`,desc:`List packages`,group:`System`},{method:`GET`,path:`/api/v1/health`,desc:`Health check`,group:`System`}];function qse(e){return[{method:`POST`,path:`${e}/sign-in/email`,desc:`Sign in (email)`,group:`Auth`,bodyTemplate:{email:`user@example.com`,password:``}},{method:`POST`,path:`${e}/sign-up/email`,desc:`Sign up (email)`,group:`Auth`,bodyTemplate:{email:``,password:``,name:``}},{method:`POST`,path:`${e}/sign-out`,desc:`Sign out`,group:`Auth`},{method:`GET`,path:`${e}/get-session`,desc:`Get session`,group:`Auth`}]}var Fx={ai:{group:`AI`,defaultRoute:`/api/v1/ai`,endpoints:[{method:`POST`,path:`/chat`,desc:`Chat completion`,bodyTemplate:{messages:[{role:`user`,content:``}]}},{method:`POST`,path:`/chat/stream`,desc:`Streaming chat (SSE)`,bodyTemplate:{messages:[{role:`user`,content:``}]}},{method:`POST`,path:`/complete`,desc:`Text completion`,bodyTemplate:{prompt:``}},{method:`GET`,path:`/models`,desc:`List available models`},{method:`POST`,path:`/nlq`,desc:`Natural language query`,bodyTemplate:{query:``}},{method:`POST`,path:`/suggest`,desc:`AI-powered suggestions`,bodyTemplate:{object:``,field:``,context:{}}},{method:`POST`,path:`/insights`,desc:`AI-generated insights`,bodyTemplate:{object:``,recordIds:[]}},{method:`POST`,path:`/conversations`,desc:`Create conversation`,bodyTemplate:{}},{method:`GET`,path:`/conversations`,desc:`List conversations`},{method:`POST`,path:`/conversations/:id/messages`,desc:`Add message to conversation`,bodyTemplate:{role:`user`,content:``}},{method:`DELETE`,path:`/conversations/:id`,desc:`Delete conversation`}]},workflow:{group:`Workflow`,defaultRoute:`/api/v1/workflow`,endpoints:[{method:`GET`,path:`/:object/config`,desc:`Get workflow configuration`},{method:`GET`,path:`/:object/:recordId/state`,desc:`Get workflow state`},{method:`POST`,path:`/:object/:recordId/transition`,desc:`Execute workflow transition`,bodyTemplate:{targetState:``}},{method:`POST`,path:`/:object/:recordId/approve`,desc:`Approve workflow step`,bodyTemplate:{comment:``}},{method:`POST`,path:`/:object/:recordId/reject`,desc:`Reject workflow step`,bodyTemplate:{comment:``}}]},realtime:{group:`Realtime`,defaultRoute:`/api/v1/realtime`,endpoints:[{method:`POST`,path:`/connect`,desc:`Establish realtime connection`,bodyTemplate:{transport:`websocket`}},{method:`POST`,path:`/disconnect`,desc:`Close realtime connection`,bodyTemplate:{connectionId:``}},{method:`POST`,path:`/subscribe`,desc:`Subscribe to channel`,bodyTemplate:{channel:``}},{method:`POST`,path:`/unsubscribe`,desc:`Unsubscribe from channel`,bodyTemplate:{channel:``}},{method:`PUT`,path:`/presence/:channel`,desc:`Set presence state`,bodyTemplate:{status:`online`}},{method:`GET`,path:`/presence/:channel`,desc:`Get channel presence`}]},notification:{group:`Notifications`,defaultRoute:`/api/v1/notifications`,endpoints:[{method:`GET`,path:``,desc:`List notifications`},{method:`POST`,path:`/devices`,desc:`Register device for push`,bodyTemplate:{token:``,platform:`web`}},{method:`DELETE`,path:`/devices/:deviceId`,desc:`Unregister device`},{method:`GET`,path:`/preferences`,desc:`Get notification preferences`},{method:`PATCH`,path:`/preferences`,desc:`Update notification preferences`,bodyTemplate:{email:!0,push:!0}},{method:`POST`,path:`/read`,desc:`Mark notifications as read`,bodyTemplate:{ids:[]}},{method:`POST`,path:`/read/all`,desc:`Mark all as read`}]},analytics:{group:`Analytics`,defaultRoute:`/api/v1/analytics`,endpoints:[{method:`POST`,path:`/query`,desc:`Execute analytics query`,bodyTemplate:{measures:[],dimensions:[]}},{method:`GET`,path:`/meta`,desc:`Get analytics metadata`}]},automation:{group:`Automation`,defaultRoute:`/api/v1/automation`,endpoints:[{method:`POST`,path:`/trigger`,desc:`Trigger automation`,bodyTemplate:{name:``,params:{}}}]},i18n:{group:`i18n`,defaultRoute:`/api/v1/i18n`,endpoints:[{method:`GET`,path:`/locales`,desc:`Get available locales`},{method:`GET`,path:`/translations/:locale`,desc:`Get translations for locale`},{method:`GET`,path:`/labels/:object/:locale`,desc:`Get translated field labels`}]},ui:{group:`UI`,defaultRoute:`/api/v1/ui`,endpoints:[{method:`GET`,path:`/views`,desc:`List views`},{method:`GET`,path:`/views/:id`,desc:`Get view by ID`},{method:`POST`,path:`/views`,desc:`Create view`,bodyTemplate:{name:``,object:``,type:`list`}},{method:`PATCH`,path:`/views/:id`,desc:`Update view`,bodyTemplate:{name:``}},{method:`DELETE`,path:`/views/:id`,desc:`Delete view`}]},feed:{group:`Feed`,defaultRoute:`/api/v1/feed`,endpoints:[{method:`GET`,path:`/:object/:recordId`,desc:`Get feed items`},{method:`POST`,path:`/:object/:recordId`,desc:`Post feed item`,bodyTemplate:{body:``}}]},storage:{group:`Storage`,defaultRoute:`/api/v1/storage`,endpoints:[{method:`POST`,path:`/upload`,desc:`Upload file (multipart/form-data)`},{method:`GET`,path:`/:fileId`,desc:`Download file`},{method:`DELETE`,path:`/:fileId`,desc:`Delete file`}]}};function Jse(e,t){let n=Fx[e];return n?n.endpoints.map(e=>({method:e.method,path:`${t}${e.path}`,desc:e.desc,group:n.group,...e.bodyTemplate?{bodyTemplate:e.bodyTemplate}:{}})):[]}function Yse(){let e=_p(),[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)([]),[a,o]=(0,L.useState)(!0),[s,c]=(0,L.useState)(null),l=(0,L.useCallback)(async()=>{o(!0),c(null);try{let t=`/api/v1/auth`,r={},a={};try{let e=await fetch(`/api/v1/discovery`);if(e.ok){let n=await e.json(),i=n?.data??n;a=i?.routes??{},r=i?.services??{},a.auth&&(t=a.auth)}}catch{}let o=[];for(let[e,t]of Object.entries(Fx)){let n=r[e],i=n?.enabled??!1,s=n?.handlerReady??(n?.status===`available`||n?.status===`degraded`),c=n?.route??a[e]??t.defaultRoute;i&&s&&o.push(...Jse(e,c))}let s=[];try{let t=await e.meta.getTypes();t&&Array.isArray(t.types)?s=t.types:Array.isArray(t)&&(s=t)}catch{}let c=[];try{let t=s.includes(`object`)?`object`:null;if(t){let n=await e.meta.getItems(t),r=[];Array.isArray(n)?r=n:n&&Array.isArray(n.items)?r=n.items:n&&Array.isArray(n.value)&&(r=n.value),c=r.map(e=>e.name||e.id).filter(Boolean)}}catch{}let l=c.flatMap(e=>[{method:`GET`,path:`/api/v1/data/${e}`,desc:`List ${e}`,group:`Data: ${e}`},{method:`POST`,path:`/api/v1/data/${e}`,desc:`Create ${e}`,group:`Data: ${e}`,bodyTemplate:{name:`example`}},{method:`GET`,path:`/api/v1/data/${e}/:id`,desc:`Get ${e} by ID`,group:`Data: ${e}`},{method:`PATCH`,path:`/api/v1/data/${e}/:id`,desc:`Update ${e}`,group:`Data: ${e}`,bodyTemplate:{name:`updated`}},{method:`DELETE`,path:`/api/v1/data/${e}/:id`,desc:`Delete ${e}`,group:`Data: ${e}`}]),u=s.filter(e=>!Gse.includes(e)).map(e=>({method:`GET`,path:`/api/v1/meta/${e}`,desc:`List ${e} metadata`,group:`Metadata`})),d=c.map(e=>({method:`GET`,path:`/api/v1/meta/object/${e}`,desc:`${e} schema`,group:`Metadata`})),f=[...Kse,...qse(t),...o,...u,...d,...l],p=new Map;for(let e of f){let t=p.get(e.group)||[];t.push(e),p.set(e.group,t)}let m=[`System`,`Auth`,`AI`,`Workflow`,`Realtime`,`Notifications`,`Analytics`,`Automation`,`i18n`,`UI`,`Feed`,`Storage`,`Metadata`];n(Array.from(p.entries()).sort(([e],[t])=>{let n=m.indexOf(e),r=m.indexOf(t);return n!==-1&&r!==-1?n-r:n===-1?r===-1?e.localeCompare(t):1:-1}).map(([e,t])=>({key:e,label:e,endpoints:t}))),i(f)}catch(e){c(e.message||`Failed to discover APIs`)}finally{o(!1)}},[e]);return(0,L.useEffect)(()=>{l()},[l]),{groups:t,allEndpoints:r,loading:a,error:s,refresh:l}}var Ix={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`,PUT:`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`},Xse={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`},Zse=[{key:`$top`,placeholder:`10`,hint:`limit`},{key:`$skip`,placeholder:`0`,hint:`offset`},{key:`$sort`,placeholder:`name`,hint:`sort field`},{key:`$select`,placeholder:`name,email`,hint:`fields`},{key:`$count`,placeholder:`true`,hint:`total count`},{key:`$filter`,placeholder:`status eq 'active'`,hint:`OData filter`}],Lx=1;function Qse(){let e=_p(),{groups:t,loading:n,refresh:r}=Yse(),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(new Set),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)(``),[g,_]=(0,L.useState)([]),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)([]),[w,T]=(0,L.useState)(null),[E,D]=(0,L.useState)(!1),O=(0,L.useMemo)(()=>{if(!i)return t;let e=i.toLowerCase();return t.map(t=>({...t,endpoints:t.endpoints.filter(t=>t.desc.toLowerCase().includes(e)||t.path.toLowerCase().includes(e)||t.method.toLowerCase().includes(e))})).filter(e=>e.endpoints.length>0)},[t,i]),ee=(0,L.useCallback)(e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),te=(0,L.useCallback)(e=>{l(e),d(e.method),p(e.path),h(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),_([]),x(null)},[]),k=u||c?.method||`GET`,A=f||c?.path||``,j=(0,L.useMemo)(()=>{let e=g.filter(e=>e.enabled&&e.key.trim());return e.length===0?A:`${A}?${e.map(e=>`${encodeURIComponent(e.key)}=${encodeURIComponent(e.value)}`).join(`&`)}`},[A,g]),M=(0,L.useCallback)((e=``,t=``)=>{_(n=>[...n,{id:Lx++,key:e,value:t,enabled:!0}])},[]),N=(0,L.useCallback)(e=>{_(t=>t.filter(t=>t.id!==e))},[]),P=(0,L.useCallback)((e,t,n)=>{_(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),F=(0,L.useCallback)(e=>{_(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t))},[]),I=(0,L.useCallback)(async()=>{if(v||!j)return;let t=`${e?.baseUrl??``}${j}`;y(!0);let n=performance.now();try{let e={method:k,headers:{"Content-Type":`application/json`}};[`POST`,`PATCH`,`PUT`].includes(k)&&m.trim()&&(e.body=m);let r=await fetch(t,e),i=Math.round(performance.now()-n),a;if((r.headers.get(`content-type`)??``).includes(`json`)){let e=await r.json();a=JSON.stringify(e,null,2)}else a=await r.text();x({status:r.status,body:a,duration:i}),C(e=>[{id:Date.now(),method:k,url:j,body:m||void 0,status:r.status,duration:i,response:a,timestamp:new Date},...e].slice(0,50))}catch(e){let t=Math.round(performance.now()-n);x({status:0,body:`Network Error: ${e.message}`,duration:t})}finally{y(!1)}},[e,j,k,m,v]),ne=(0,L.useCallback)(e=>{d(e.method);let[t,n]=e.url.split(`?`);if(p(t),h(e.body||``),n){let e=new URLSearchParams(n),t=[];e.forEach((e,n)=>{t.push({id:Lx++,key:n,value:e,enabled:!0})}),_(t)}else _([]);x(null),l(null)},[]),re=(0,L.useCallback)(()=>{b?.body&&(navigator.clipboard.writeText(b.body),D(!0),setTimeout(()=>D(!1),1500))},[b]),ie=e=>Xse[String(e)[0]]??`text-muted-foreground`;return(0,B.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`w-72 shrink-0 border-r flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`p-3 border-b space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-foreground flex-1`,children:`API Endpoints`}),(0,B.jsx)(`button`,{onClick:r,disabled:n,className:`p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,title:`Refresh endpoints`,children:(0,B.jsx)(om,{className:`h-3.5 w-3.5 ${n?`animate-spin`:``}`})})]}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(sm,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`Search endpoints...`,className:`w-full rounded-md border bg-background pl-8 pr-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-ring`})]})]}),(0,B.jsx)(`div`,{className:`flex-1 overflow-auto p-2 space-y-1`,children:n?(0,B.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin mr-2`}),`Discovering APIs...`]}):O.length===0?(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,B.jsx)(qp,{className:`h-6 w-6 opacity-30 mb-2`}),(0,B.jsx)(`span`,{children:i?`No matching endpoints`:`No endpoints found`})]}):O.map(e=>{let t=o.has(e.key)||!!i;return(0,B.jsxs)(by,{open:t,onOpenChange:()=>ee(e.key),children:[(0,B.jsx)(xy,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`w-full flex items-center gap-1.5 px-2 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground transition-colors`,children:[(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0 transition-transform duration-200 ${t?`rotate-90`:``}`}),(0,B.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.label}),(0,B.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums opacity-60`,children:e.endpoints.length})]})}),(0,B.jsx)(Sy,{children:(0,B.jsx)(`div`,{className:`ml-3 space-y-0.5 mt-0.5`,children:e.endpoints.map((e,t)=>(0,B.jsxs)(`button`,{onClick:()=>te(e),className:`w-full text-left flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${c===e?`bg-accent text-accent-foreground`:`hover:bg-muted/50 text-muted-foreground hover:text-foreground`}`,children:[(0,B.jsx)(yx,{variant:`outline`,className:`font-mono text-[9px] shrink-0 px-1 py-0 ${Ix[e.method]||``}`,children:e.method}),(0,B.jsx)(`span`,{className:`truncate`,children:e.desc})]},`${e.method}-${e.path}-${t}`))})})]},e.key)})}),(0,B.jsxs)(`div`,{className:`p-3 border-t space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h4`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:`Query Parameters`}),(0,B.jsxs)(`button`,{onClick:()=>M(),className:`inline-flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,B.jsx)(am,{className:`h-3 w-3`}),`Add`]})]}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Zse.map(e=>(0,B.jsx)(`button`,{onClick:()=>M(e.key,``),className:`text-[10px] px-1.5 py-0.5 rounded border bg-muted/30 text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors font-mono`,title:e.hint,children:e.key},e.key))}),g.length>0&&(0,B.jsx)(`div`,{className:`space-y-1`,children:g.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>F(e.id),className:`h-3 w-3 shrink-0 rounded border accent-primary`}),(0,B.jsx)(`input`,{type:`text`,value:e.key,onChange:t=>P(e.id,`key`,t.target.value),placeholder:`key`,className:`flex-1 min-w-0 rounded border bg-background px-1.5 py-0.5 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-ring`}),(0,B.jsx)(`input`,{type:`text`,value:e.value,onChange:t=>P(e.id,`value`,t.target.value),placeholder:`value`,className:`flex-1 min-w-0 rounded border bg-background px-1.5 py-0.5 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-ring`}),(0,B.jsx)(`button`,{onClick:()=>N(e.id),className:`shrink-0 p-0.5 rounded text-muted-foreground hover:text-destructive transition-colors`,children:(0,B.jsx)(xm,{className:`h-3 w-3`})})]},e.id))})]})]}),(0,B.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`select`,{value:k,onChange:e=>d(e.target.value),className:`rounded-md border bg-background px-2 py-1.5 font-mono text-xs font-semibold focus:outline-none focus:ring-1 focus:ring-ring ${Ix[k]||``}`,children:[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`].map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))}),(0,B.jsx)(`input`,{type:`text`,value:A,onChange:e=>p(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:`/api/v1/...`,onKeyDown:e=>{e.key===`Enter`&&I()}}),(0,B.jsxs)(`button`,{onClick:I,disabled:v||!j,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:[v?(0,B.jsx)(Qp,{className:`h-3.5 w-3.5 animate-spin`}):(0,B.jsx)(im,{className:`h-3.5 w-3.5`}),`Send`]})]}),g.some(e=>e.enabled&&e.key.trim())&&(0,B.jsxs)(`div`,{className:`text-[10px] font-mono text-muted-foreground truncate pl-1`,children:[`→ `,j]})]}),(0,B.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-auto`,children:[[`POST`,`PATCH`,`PUT`].includes(k)&&(0,B.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,B.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,B.jsx)(`textarea`,{value:m,onChange:e=>h(e.target.value),rows:5,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:`{ "key": "value" }`})]}),v&&(0,B.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin mr-2`}),`Sending request...`]}),b&&!v&&(0,B.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-mono font-semibold ${ie(b.status)}`,children:b.status||`ERR`}),(0,B.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,B.jsx)(zp,{className:`h-3 w-3`}),b.duration,`ms`]})]}),(0,B.jsxs)(`button`,{onClick:re,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[E?(0,B.jsx)(Np,{className:`h-3 w-3`}):(0,B.jsx)(Vp,{className:`h-3 w-3`}),E?`Copied`:`Copy`]})]}),(0,B.jsx)(`pre`,{className:`flex-1 overflow-auto p-3 text-xs font-mono bg-muted/10 whitespace-pre-wrap break-all`,children:b.body})]}),!b&&!v&&(0,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,B.jsx)(qp,{className:`h-10 w-10 mx-auto opacity-20`}),(0,B.jsxs)(`p`,{children:[`Select an endpoint or type a URL and click `,(0,B.jsx)(`strong`,{children:`Send`})]}),(0,B.jsx)(`p`,{className:`text-xs opacity-60`,children:`All registered APIs are auto-discovered from the platform`})]})}),S.length>0&&(0,B.jsxs)(`div`,{className:`border-t`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,B.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:[`History (`,S.length,`)`]}),(0,B.jsxs)(`button`,{onClick:()=>C([]),className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,B.jsx)(gm,{className:`h-3 w-3`}),`Clear`]})]}),(0,B.jsx)(`div`,{className:`space-y-0.5 px-2 pb-2 max-h-60 overflow-auto`,children:S.map(e=>(0,B.jsxs)(`div`,{className:`rounded border`,children:[(0,B.jsxs)(`button`,{onClick:()=>T(w===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:[w===e.id?(0,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(yx,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${Ix[e.method]||``}`,children:e.method}),(0,B.jsx)(`span`,{className:`font-mono truncate text-left flex-1`,children:e.url}),(0,B.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${ie(e.status)}`,children:e.status}),(0,B.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]}),(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),ne(e)},className:`shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,title:`Replay request`,children:(0,B.jsx)(im,{className:`h-2.5 w-2.5`})})]}),w===e.id&&(0,B.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))})]})]})]})]})}var Rx=`ToastProvider`,[zx,$se,ece]=Cy(`Toast`),[Bx,tce]=xh(`Toast`,[ece]),[nce,Vx]=Bx(Rx),rce=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=L.useState(null),[l,u]=L.useState(0),d=L.useRef(!1),f=L.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Rx}\`. Expected non-empty \`string\`.`),(0,B.jsx)(zx.Provider,{scope:t,children:(0,B.jsx)(nce,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:L.useCallback(()=>u(e=>e+1),[]),onToastRemove:L.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};rce.displayName=Rx;var ice=`ToastViewport`,ace=[`F8`],Hx=`toast.viewportPause`,Ux=`toast.viewportResume`,oce=L.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=ace,label:i=`Notifications ({hotkey})`,...a}=e,o=Vx(ice,n),s=$se(n),c=L.useRef(null),l=L.useRef(null),u=L.useRef(null),d=L.useRef(null),f=Tm(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;L.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),L.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(Hx);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(Ux);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=L.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...kce(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return L.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Jx(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,B.jsxs)(jne,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,B.jsx)(Wx,{ref:l,onFocusFromOutsideViewport:()=>{Jx(h({tabbingDirection:`forwards`}))}}),(0,B.jsx)(zx.Slot,{scope:n,children:(0,B.jsx)(Eh.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,B.jsx)(Wx,{ref:u,onFocusFromOutsideViewport:()=>{Jx(h({tabbingDirection:`backwards`}))}})]})});oce.displayName=ice;var sce=`ToastFocusProxy`,Wx=L.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=Vx(sce,n);return(0,B.jsx)(Tv,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});Wx.displayName=sce;var Gx=`Toast`,cce=`toast.swipeStart`,lce=`toast.swipeMove`,uce=`toast.swipeCancel`,dce=`toast.swipeEnd`,fce=L.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=wh({prop:r,defaultProp:i??!0,onChange:a,caller:Gx});return(0,B.jsx)(Ih,{present:n||s,children:(0,B.jsx)(hce,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:Oh(e.onPause),onResume:Oh(e.onResume),onSwipeStart:H(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:H(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:H(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:H(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});fce.displayName=Gx;var[pce,mce]=Bx(Gx,{onClose(){}}),hce=L.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=Vx(Gx,n),[g,_]=L.useState(null),v=Tm(t,e=>_(e)),y=L.useRef(null),b=L.useRef(null),x=i||h.duration,S=L.useRef(0),C=L.useRef(x),w=L.useRef(0),{onToastAdd:T,onToastRemove:E}=h,D=Oh(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),O=L.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),S.current=new Date().getTime(),w.current=window.setTimeout(D,e))},[D]);L.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{O(C.current),l?.()},n=()=>{let e=new Date().getTime()-S.current;C.current-=e,window.clearTimeout(w.current),c?.()};return e.addEventListener(Hx,n),e.addEventListener(Ux,t),()=>{e.removeEventListener(Hx,n),e.removeEventListener(Ux,t)}}},[h.viewport,x,c,l,O]),L.useEffect(()=>{a&&!h.isClosePausedRef.current&&O(x)},[a,x,h.isClosePausedRef,O]),L.useEffect(()=>(T(),()=>E()),[T,E]);let ee=L.useMemo(()=>g?Tce(g):null,[g]);return h.viewport?(0,B.jsxs)(B.Fragment,{children:[ee&&(0,B.jsx)(gce,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:ee}),(0,B.jsx)(pce,{scope:n,onClose:D,children:yh.createPortal((0,B.jsx)(zx.ItemSlot,{scope:n,children:(0,B.jsx)(Ane,{asChild:!0,onEscapeKeyDown:H(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||D(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,B.jsx)(Eh.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:H(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:H(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:H(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!b.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(b.current=l,qx(lce,d,f,{discrete:!1})):Ece(l,h.swipeDirection,c)?(b.current=l,qx(cce,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:H(e.onPointerUp,e=>{let t=b.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),b.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};Ece(t,h.swipeDirection,h.swipeThreshold)?qx(dce,p,r,{discrete:!0}):qx(uce,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),gce=e=>{let{__scopeToast:t,children:n,...r}=e,i=Vx(Gx,t),[a,o]=L.useState(!1),[s,c]=L.useState(!1);return Dce(()=>o(!0)),L.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,B.jsx)(Fh,{asChild:!0,children:(0,B.jsx)(Tv,{...r,children:a&&(0,B.jsxs)(B.Fragment,{children:[i.label,` `,n]})})})},_ce=`ToastTitle`,vce=L.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,B.jsx)(Eh.div,{...r,ref:t})});vce.displayName=_ce;var yce=`ToastDescription`,bce=L.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,B.jsx)(Eh.div,{...r,ref:t})});bce.displayName=yce;var xce=`ToastAction`,Sce=L.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,B.jsx)(wce,{altText:n,asChild:!0,children:(0,B.jsx)(Kx,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${xce}\`. Expected non-empty \`string\`.`),null)});Sce.displayName=xce;var Cce=`ToastClose`,Kx=L.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=mce(Cce,n);return(0,B.jsx)(wce,{asChild:!0,children:(0,B.jsx)(Eh.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,i.onClose)})})});Kx.displayName=Cce;var wce=L.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,B.jsx)(Eh.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Tce(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Oce(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Tce(e))}}),t}function qx(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Dh(i,a):i.dispatchEvent(a)}var Ece=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function Dce(e=()=>{}){let t=Oh(e);Sh(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function Oce(e){return e.nodeType===e.ELEMENT_NODE}function kce(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Jx(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var Ace=rce,jce=oce,Mce=fce,Nce=vce,Pce=bce,Fce=Sce,Ice=Kx,Lce=Ace,Rce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(jce,{ref:n,className:V(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));Rce.displayName=jce.displayName;var zce=Pm(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),Bce=L.forwardRef(({className:e,variant:t,...n},r)=>(0,B.jsx)(Mce,{ref:r,className:V(zce({variant:t}),e),...n}));Bce.displayName=Mce.displayName;var Vce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Fce,{ref:n,className:V(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));Vce.displayName=Fce.displayName;var Hce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Ice,{ref:n,className:V(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,B.jsx)(xm,{className:`h-4 w-4`})}));Hce.displayName=Ice.displayName;var Uce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Nce,{ref:n,className:V(`text-sm font-semibold`,e),...t}));Uce.displayName=Nce.displayName;var Wce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Pce,{ref:n,className:V(`text-sm opacity-90`,e),...t}));Wce.displayName=Pce.displayName;function Gce(){let{toasts:e}=Use();return(0,B.jsxs)(Lce,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,B.jsxs)(Bce,{...i,children:[(0,B.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,B.jsx)(Uce,{children:t}),n&&(0,B.jsx)(Wce,{children:n})]}),r,(0,B.jsx)(Hce,{})]},e)}),(0,B.jsx)(Rce,{})]})}var Kce=`vercel.ai.error`,qce=Symbol.for(Kce),Jce,Yce,Yx=class e extends (Yce=Error,Jce=qce,Yce){constructor({name:e,message:t,cause:n}){super(t),this[Jce]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Kce)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},Xce=`AI_APICallError`,Zce=`vercel.ai.error.${Xce}`,Qce=Symbol.for(Zce),$ce,ele,Xx=class extends (ele=Yx,$ce=Qce,ele){constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=r!=null&&(r===408||r===409||r===429||r>=500),data:c}){super({name:Xce,message:e,cause:o}),this[$ce]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=c}static isInstance(e){return Yx.hasMarker(e,Zce)}},tle=`AI_EmptyResponseBodyError`,nle=`vercel.ai.error.${tle}`,rle=Symbol.for(nle),ile,ale,ole=class extends (ale=Yx,ile=rle,ale){constructor({message:e=`Empty response body`}={}){super({name:tle,message:e}),this[ile]=!0}static isInstance(e){return Yx.hasMarker(e,nle)}};function Zx(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var sle=`AI_InvalidArgumentError`,cle=`vercel.ai.error.${sle}`,lle=Symbol.for(cle),ule,dle,fle=class extends (dle=Yx,ule=lle,dle){constructor({message:e,cause:t,argument:n}){super({name:sle,message:e,cause:t}),this[ule]=!0,this.argument=n}static isInstance(e){return Yx.hasMarker(e,cle)}},ple=`AI_InvalidPromptError`,mle=`vercel.ai.error.${ple}`,hle=Symbol.for(mle),gle,_le,Qx=class extends (_le=Yx,gle=hle,_le){constructor({prompt:e,message:t,cause:n}){super({name:ple,message:`Invalid prompt: ${t}`,cause:n}),this[gle]=!0,this.prompt=e}static isInstance(e){return Yx.hasMarker(e,mle)}},vle=`AI_JSONParseError`,yle=`vercel.ai.error.${vle}`,ble=Symbol.for(yle),xle,Sle,$x=class extends (Sle=Yx,xle=ble,Sle){constructor({text:e,cause:t}){super({name:vle,message:`JSON parsing failed: Text: ${e}. +Error message: ${Zx(t)}`,cause:t}),this[xle]=!0,this.text=e}static isInstance(e){return Yx.hasMarker(e,yle)}},Cle=`AI_TypeValidationError`,wle=`vercel.ai.error.${Cle}`,Tle=Symbol.for(wle),Ele,Dle,eS=class e extends (Dle=Yx,Ele=Tle,Dle){constructor({value:e,cause:t,context:n}){let r=`Type validation failed`;if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=` (`;let e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(`, `),r+=`)`}super({name:Cle,message:`${r}: Value: ${JSON.stringify(e)}. +Error message: ${Zx(t)}`,cause:t}),this[Ele]=!0,this.value=e,this.context=n}static isInstance(e){return Yx.hasMarker(e,wle)}static wrap({value:t,cause:n,context:r}){return e.isInstance(n)&&n.value===t&&n.context?.field===r?.field&&n.context?.entityName===r?.entityName&&n.context?.entityId===r?.entityId?n:new e({value:t,cause:n,context:r})}},Ole=`AI_UnsupportedFunctionalityError`,kle=`vercel.ai.error.${Ole}`,Ale=Symbol.for(kle),jle,Mle,Nle=class extends (Mle=Yx,jle=Ale,Mle){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:Ole,message:t}),this[jle]=!0,this.functionality=e}static isInstance(e){return Yx.hasMarker(e,kle)}},tS;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(tS||={});var Ple;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Ple||={});var U=tS.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),nS=e=>{switch(typeof e){case`undefined`:return U.undefined;case`string`:return U.string;case`number`:return Number.isNaN(e)?U.nan:U.number;case`boolean`:return U.boolean;case`function`:return U.function;case`bigint`:return U.bigint;case`symbol`:return U.symbol;case`object`:return Array.isArray(e)?U.array:e===null?U.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?U.promise:typeof Map<`u`&&e instanceof Map?U.map:typeof Set<`u`&&e instanceof Set?U.set:typeof Date<`u`&&e instanceof Date?U.date:U.object;default:return U.unknown}},W=tS.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),rS=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;re.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};rS.create=e=>new rS(e);var iS=(e,t)=>{let n;switch(e.code){case W.invalid_type:n=e.received===U.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,tS.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${tS.joinValues(e.keys,`, `)}`;break;case W.invalid_union:n=`Invalid input`;break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tS.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${tS.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n=`Invalid function arguments`;break;case W.invalid_return_type:n=`Invalid function return type`;break;case W.invalid_date:n=`Invalid date`;break;case W.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:tS.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case W.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case W.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case W.custom:n=`Invalid input`;break;case W.invalid_intersection_types:n=`Intersection results could not be merged`;break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,tS.assertNever(e)}return{message:n}},Fle=iS;function aS(){return Fle}var oS=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function G(e,t){let n=aS(),r=oS({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===iS?void 0:iS].filter(e=>!!e)});e.common.issues.push(r)}var sS=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return cS;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return cS;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},cS=Object.freeze({status:`aborted`}),lS=e=>({status:`dirty`,value:e}),uS=e=>({status:`valid`,value:e}),Ile=e=>e.status===`aborted`,Lle=e=>e.status===`dirty`,dS=e=>e.status===`valid`,fS=e=>typeof Promise<`u`&&e instanceof Promise,pS;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(pS||={});var mS=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Rle=(e,t)=>{if(dS(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new rS(e.common.issues),this._error}}};function hS(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var gS=class{get description(){return this._def.description}_getType(e){return nS(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sS,ctx:{common:e.parent.common,data:e.data,parsedType:nS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(fS(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nS(e)};return Rle(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nS(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return dS(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>dS(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nS(e)},r=this._parse({data:e,path:n.path,parent:n});return Rle(n,await(fS(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:W.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new WS({schema:this,typeName:K.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return GS.create(this,this._def)}nullable(){return KS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return kS.create(this)}promise(){return US.create(this,this._def)}or(e){return MS.create([this,e],this._def)}and(e){return FS.create(this,e,this._def)}transform(e){return new WS({...hS(this._def),schema:this,typeName:K.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new qS({...hS(this._def),innerType:this,defaultValue:t,typeName:K.ZodDefault})}brand(){return new mue({typeName:K.ZodBranded,type:this,...hS(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new JS({...hS(this._def),innerType:this,catchValue:t,typeName:K.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return hue.create(this,e)}readonly(){return XS.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zle=/^c[^\s-]{8,}$/i,Ble=/^[0-9a-z]+$/,Vle=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Hle=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ule=/^[a-z0-9_-]{21}$/i,Wle=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gle=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Kle=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qle=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Jle,Yle=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xle=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Zle=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Qle=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$le=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eue=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tue=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,nue=RegExp(`^${tue}$`);function rue(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function iue(e){return RegExp(`^${rue(e)}$`)}function aue(e){let t=`${tue}T${rue(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function oue(e,t){return!!((t===`v4`||!t)&&Yle.test(e)||(t===`v6`||!t)&&Zle.test(e))}function sue(e,t){if(!Wle.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function cue(e,t){return!!((t===`v4`||!t)&&Xle.test(e)||(t===`v6`||!t)&&Qle.test(e))}var _S=class e extends gS{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==U.string){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.string,received:t.parsedType}),cS}let t=new sS,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.lengthr.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.lengthe.test(t),{validation:t,code:W.invalid_string,...pS.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...pS.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...pS.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...pS.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...pS.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...pS.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...pS.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...pS.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...pS.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...pS.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...pS.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...pS.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...pS.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...pS.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...pS.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...pS.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...pS.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...pS.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...pS.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...pS.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...pS.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...pS.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...pS.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...pS.errToObj(t)})}nonempty(e){return this.min(1,pS.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew _S({checks:[],typeName:K.ZodString,coerce:e?.coerce??!1,...hS(e)});function lue(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var vS=class e extends gS{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==U.number){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.number,received:t.parsedType}),cS}let t,n=new sS;for(let r of this._def.checks)r.kind===`int`?tS.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?lue(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_finite,message:r.message}),n.dirty()):tS.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,pS.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,pS.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,pS.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,pS.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pS.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:pS.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:pS.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:pS.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:pS.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:pS.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:pS.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:pS.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:pS.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:pS.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuee.kind===`int`||e.kind===`multipleOf`&&tS.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.valuenew vS({checks:[],typeName:K.ZodNumber,coerce:e?.coerce||!1,...hS(e)});var yS=class e extends gS{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==U.bigint)return this._getInvalidInput(e);let t,n=new sS;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):tS.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.bigint,received:t.parsedType}),cS}gte(e,t){return this.setLimit(`min`,e,!0,pS.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,pS.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,pS.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,pS.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pS.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:pS.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:pS.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:pS.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:pS.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:pS.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew yS({checks:[],typeName:K.ZodBigInt,coerce:e?.coerce??!1,...hS(e)});var bS=class extends gS{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==U.boolean){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.boolean,received:t.parsedType}),cS}return uS(e.data)}};bS.create=e=>new bS({typeName:K.ZodBoolean,coerce:e?.coerce||!1,...hS(e)});var xS=class e extends gS{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==U.date){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.date,received:t.parsedType}),cS}if(Number.isNaN(e.data.getTime()))return G(this._getOrReturnCtx(e),{code:W.invalid_date}),cS;let t=new sS,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):tS.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:pS.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:pS.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew xS({checks:[],coerce:e?.coerce||!1,typeName:K.ZodDate,...hS(e)});var SS=class extends gS{_parse(e){if(this._getType(e)!==U.symbol){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.symbol,received:t.parsedType}),cS}return uS(e.data)}};SS.create=e=>new SS({typeName:K.ZodSymbol,...hS(e)});var CS=class extends gS{_parse(e){if(this._getType(e)!==U.undefined){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.undefined,received:t.parsedType}),cS}return uS(e.data)}};CS.create=e=>new CS({typeName:K.ZodUndefined,...hS(e)});var wS=class extends gS{_parse(e){if(this._getType(e)!==U.null){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.null,received:t.parsedType}),cS}return uS(e.data)}};wS.create=e=>new wS({typeName:K.ZodNull,...hS(e)});var TS=class extends gS{constructor(){super(...arguments),this._any=!0}_parse(e){return uS(e.data)}};TS.create=e=>new TS({typeName:K.ZodAny,...hS(e)});var ES=class extends gS{constructor(){super(...arguments),this._unknown=!0}_parse(e){return uS(e.data)}};ES.create=e=>new ES({typeName:K.ZodUnknown,...hS(e)});var DS=class extends gS{_parse(e){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.never,received:t.parsedType}),cS}};DS.create=e=>new DS({typeName:K.ZodNever,...hS(e)});var OS=class extends gS{_parse(e){if(this._getType(e)!==U.undefined){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.void,received:t.parsedType}),cS}return uS(e.data)}};OS.create=e=>new OS({typeName:K.ZodVoid,...hS(e)});var kS=class e extends gS{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==U.array)return G(t,{code:W.invalid_type,expected:U.array,received:t.parsedType}),cS;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(G(t,{code:W.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new mS(t,e,t.path,n)))).then(e=>sS.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new mS(t,e,t.path,n)));return sS.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:pS.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:pS.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:pS.toString(n)}})}nonempty(e){return this.min(1,e)}};kS.create=(e,t)=>new kS({type:e,minLength:null,maxLength:null,exactLength:null,typeName:K.ZodArray,...hS(t)});function AS(e){if(e instanceof jS){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=GS.create(AS(r))}return new jS({...e._def,shape:()=>t})}else if(e instanceof kS)return new kS({...e._def,type:AS(e.element)});else if(e instanceof GS)return GS.create(AS(e.unwrap()));else if(e instanceof KS)return KS.create(AS(e.unwrap()));else if(e instanceof IS)return IS.create(e.items.map(e=>AS(e)));else return e}var jS=class e extends gS{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:tS.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==U.object){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.object,received:t.parsedType}),cS}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof DS&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new mS(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof DS){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(G(n,{code:W.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new mS(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>sS.mergeObjectSync(t,e)):sS.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return pS.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:pS.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:K.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of tS.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of tS.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return AS(this)}partial(t){let n={};for(let e of tS.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of tS.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof GS;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return pue(tS.objectKeys(this.shape))}};jS.create=(e,t)=>new jS({shape:()=>e,unknownKeys:`strip`,catchall:DS.create(),typeName:K.ZodObject,...hS(t)}),jS.strictCreate=(e,t)=>new jS({shape:()=>e,unknownKeys:`strict`,catchall:DS.create(),typeName:K.ZodObject,...hS(t)}),jS.lazycreate=(e,t)=>new jS({shape:e,unknownKeys:`strip`,catchall:DS.create(),typeName:K.ZodObject,...hS(t)});var MS=class extends gS{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new rS(e.ctx.common.issues));return G(t,{code:W.invalid_union,unionErrors:n}),cS}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new rS(e));return G(t,{code:W.invalid_union,unionErrors:i}),cS}}get options(){return this._def.options}};MS.create=(e,t)=>new MS({options:e,typeName:K.ZodUnion,...hS(t)});var NS=e=>e instanceof zS?NS(e.schema):e instanceof WS?NS(e.innerType()):e instanceof BS?[e.value]:e instanceof VS?e.options:e instanceof HS?tS.objectValues(e.enum):e instanceof qS?NS(e._def.innerType):e instanceof CS?[void 0]:e instanceof wS?[null]:e instanceof GS?[void 0,...NS(e.unwrap())]:e instanceof KS?[null,...NS(e.unwrap())]:e instanceof mue||e instanceof XS?NS(e.unwrap()):e instanceof JS?NS(e._def.innerType):[],uue=class e extends gS{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.object)return G(t,{code:W.invalid_type,expected:U.object,received:t.parsedType}),cS;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(G(t,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),cS)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=NS(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:K.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...hS(r)})}};function PS(e,t){let n=nS(e),r=nS(t);if(e===t)return{valid:!0,data:e};if(n===U.object&&r===U.object){let n=tS.objectKeys(t),r=tS.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=PS(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===U.array&&r===U.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r{if(Ile(e)||Ile(r))return cS;let i=PS(e.value,r.value);return i.valid?((Lle(e)||Lle(r))&&t.dirty(),{status:t.value,value:i.data}):(G(n,{code:W.invalid_intersection_types}),cS)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};FS.create=(e,t,n)=>new FS({left:e,right:t,typeName:K.ZodIntersection,...hS(n)});var IS=class e extends gS{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.array)return G(n,{code:W.invalid_type,expected:U.array,received:n.parsedType}),cS;if(n.data.lengththis._def.items.length&&(G(n,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new mS(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>sS.mergeArray(t,e)):sS.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};IS.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new IS({items:e,typeName:K.ZodTuple,rest:null,...hS(t)})};var due=class e extends gS{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.object)return G(n,{code:W.invalid_type,expected:U.object,received:n.parsedType}),cS;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new mS(n,e,n.path,e)),value:a._parse(new mS(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?sS.mergeObjectAsync(t,r):sS.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof gS?new e({keyType:t,valueType:n,typeName:K.ZodRecord,...hS(r)}):new e({keyType:_S.create(),valueType:t,typeName:K.ZodRecord,...hS(n)})}},LS=class extends gS{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.map)return G(n,{code:W.invalid_type,expected:U.map,received:n.parsedType}),cS;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new mS(n,e,n.path,[a,`key`])),value:i._parse(new mS(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return cS;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return cS;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};LS.create=(e,t,n)=>new LS({valueType:t,keyType:e,typeName:K.ZodMap,...hS(n)});var RS=class e extends gS{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.set)return G(n,{code:W.invalid_type,expected:U.set,received:n.parsedType}),cS;let r=this._def;r.minSize!==null&&n.data.sizer.maxSize.value&&(G(n,{code:W.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return cS;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new mS(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:pS.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:pS.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};RS.create=(e,t)=>new RS({valueType:e,minSize:null,maxSize:null,typeName:K.ZodSet,...hS(t)});var fue=class e extends gS{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.function)return G(t,{code:W.invalid_type,expected:U.function,received:t.parsedType}),cS;function n(e,n){return oS({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,aS(),iS].filter(e=>!!e),issueData:{code:W.invalid_arguments,argumentsError:n}})}function r(e,n){return oS({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,aS(),iS].filter(e=>!!e),issueData:{code:W.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof US){let e=this;return uS(async function(...t){let o=new rS([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return uS(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new rS([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new rS([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:IS.create(t).rest(ES.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||IS.create([]).rest(ES.create()),returns:n||ES.create(),typeName:K.ZodFunction,...hS(r)})}},zS=class extends gS{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};zS.create=(e,t)=>new zS({getter:e,typeName:K.ZodLazy,...hS(t)});var BS=class extends gS{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return G(t,{received:t.data,code:W.invalid_literal,expected:this._def.value}),cS}return{status:`valid`,value:e.data}}get value(){return this._def.value}};BS.create=(e,t)=>new BS({value:e,typeName:K.ZodLiteral,...hS(t)});function pue(e,t){return new VS({values:e,typeName:K.ZodEnum,...hS(t)})}var VS=class e extends gS{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{expected:tS.joinValues(n),received:t.parsedType,code:W.invalid_type}),cS}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{received:t.data,code:W.invalid_enum_value,options:n}),cS}return uS(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};VS.create=pue;var HS=class extends gS{_parse(e){let t=tS.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==U.string&&n.parsedType!==U.number){let e=tS.objectValues(t);return G(n,{expected:tS.joinValues(e),received:n.parsedType,code:W.invalid_type}),cS}if(this._cache||=new Set(tS.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=tS.objectValues(t);return G(n,{received:n.data,code:W.invalid_enum_value,options:e}),cS}return uS(e.data)}get enum(){return this._def.values}};HS.create=(e,t)=>new HS({values:e,typeName:K.ZodNativeEnum,...hS(t)});var US=class extends gS{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==U.promise&&t.common.async===!1?(G(t,{code:W.invalid_type,expected:U.promise,received:t.parsedType}),cS):uS((t.parsedType===U.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};US.create=(e,t)=>new US({type:e,typeName:K.ZodPromise,...hS(t)});var WS=class extends gS{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===K.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{G(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return cS;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?cS:r.status===`dirty`||t.value===`dirty`?lS(r.value):r});{if(t.value===`aborted`)return cS;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?cS:r.status===`dirty`||t.value===`dirty`?lS(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?cS:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?cS:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!dS(e))return cS;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>dS(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):cS);tS.assertNever(r)}};WS.create=(e,t,n)=>new WS({schema:e,typeName:K.ZodEffects,effect:t,...hS(n)}),WS.createWithPreprocess=(e,t,n)=>new WS({schema:t,effect:{type:`preprocess`,transform:e},typeName:K.ZodEffects,...hS(n)});var GS=class extends gS{_parse(e){return this._getType(e)===U.undefined?uS(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};GS.create=(e,t)=>new GS({innerType:e,typeName:K.ZodOptional,...hS(t)});var KS=class extends gS{_parse(e){return this._getType(e)===U.null?uS(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};KS.create=(e,t)=>new KS({innerType:e,typeName:K.ZodNullable,...hS(t)});var qS=class extends gS{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===U.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};qS.create=(e,t)=>new qS({innerType:e,typeName:K.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...hS(t)});var JS=class extends gS{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return fS(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new rS(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new rS(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};JS.create=(e,t)=>new JS({innerType:e,typeName:K.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...hS(t)});var YS=class extends gS{_parse(e){if(this._getType(e)!==U.nan){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.nan,received:t.parsedType}),cS}return{status:`valid`,value:e.data}}};YS.create=e=>new YS({typeName:K.ZodNaN,...hS(e)});var mue=class extends gS{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},hue=class e extends gS{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?cS:e.status===`dirty`?(t.dirty(),lS(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?cS:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:K.ZodPipeline})}},XS=class extends gS{_parse(e){let t=this._def.innerType._parse(e),n=e=>(dS(e)&&(e.value=Object.freeze(e.value)),e);return fS(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};XS.create=(e,t)=>new XS({innerType:e,typeName:K.ZodReadonly,...hS(t)}),jS.lazycreate;var K;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(K||={}),_S.create,vS.create,YS.create,yS.create,bS.create,xS.create,SS.create,CS.create,wS.create,TS.create,ES.create,DS.create,OS.create,kS.create,jS.create,jS.strictCreate,MS.create,uue.create,FS.create,IS.create,due.create,LS.create,RS.create,fue.create,zS.create,BS.create,VS.create,HS.create,US.create,WS.create,GS.create,KS.create,WS.createWithPreprocess,hue.create;var gue=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function ZS(e){}function _ue(e){if(typeof e==`function`)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=ZS,onError:n=ZS,onRetry:r=ZS,onComment:i}=e,a=``,o=!0,s,c=``,l=``;function u(e){let t=o?e.replace(/^\xEF\xBB\xBF/,``):e,[n,r]=vue(`${a}${t}`);for(let e of n)d(e);a=r,o=!1}function d(e){if(e===``){p();return}if(e.startsWith(`:`)){i&&i(e.slice(e.startsWith(`: `)?2:1));return}let t=e.indexOf(`:`);if(t!==-1){let n=e.slice(0,t),r=e[t+1]===` `?2:1;f(n,e.slice(t+r),e);return}f(e,``,e)}function f(e,t,i){switch(e){case`event`:l=t;break;case`data`:c=`${c}${t} +`;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new gue(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new gue(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function p(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(` +`)?c.slice(0,-1):c}),s=void 0,c=``,l=``}function m(e={}){a&&e.consume&&d(a),o=!0,s=void 0,c=``,l=``,a=``}return{feed:u,reset:m}}function vue(e){let t=[],n=``,r=0;for(;r{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};function QS(...e){return e.reduce((e,t)=>({...e,...t??{}}),{})}async function bue(e,t){if(e==null)return Promise.resolve();let n=t?.abortSignal;return new Promise((t,r)=>{if(n?.aborted){r(xue());return}let i=setTimeout(()=>{a(),t()},e),a=()=>{clearTimeout(i),n?.removeEventListener(`abort`,o)},o=()=>{a(),r(xue())};n?.addEventListener(`abort`,o)})}function xue(){return new DOMException(`Delay was aborted`,`AbortError`)}var $S=class{constructor(){this.status={type:`pending`},this._resolve=void 0,this._reject=void 0}get promise(){return this._promise||=new Promise((e,t)=>{this.status.type===`resolved`?e(this.status.value):this.status.type===`rejected`&&t(this.status.error),this._resolve=e,this._reject=t}),this._promise}resolve(e){var t;this.status={type:`resolved`,value:e},this._promise&&((t=this._resolve)==null||t.call(this,e))}reject(e){var t;this.status={type:`rejected`,error:e},this._promise&&((t=this._reject)==null||t.call(this,e))}isResolved(){return this.status.type===`resolved`}isRejected(){return this.status.type===`rejected`}isPending(){return this.status.type===`pending`}};function eC(e){return Object.fromEntries([...e.headers])}var{btoa:Sue,atob:Cue}=globalThis;function tC(e){let t=Cue(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.codePointAt(0))}function nC(e){let t=``;for(let n=0;nn)throw new rC({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes (Content-Length: ${e}).`})}let i=e.body;if(i==null)return new Uint8Array;let a=i.getReader(),o=[],s=0;try{for(;;){let{done:e,value:r}=await a.read();if(e)break;if(s+=r.length,s>n)throw new rC({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes.`});o.push(r)}}finally{try{await a.cancel()}finally{a.releaseLock()}}let c=new Uint8Array(s),l=0;for(let e of o)c.set(e,l),l+=e.length;return c}function jue(e){let t;try{t=new URL(e)}catch{throw new rC({url:e,message:`Invalid URL: ${e}`})}if(t.protocol===`data:`)return;if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new rC({url:e,message:`URL scheme must be http, https, or data, got ${t.protocol}`});let n=t.hostname;if(!n)throw new rC({url:e,message:`URL must have a hostname`});if(n===`localhost`||n.endsWith(`.local`)||n.endsWith(`.localhost`))throw new rC({url:e,message:`URL with hostname ${n} is not allowed`});if(n.startsWith(`[`)&&n.endsWith(`]`)){if(Nue(n.slice(1,-1)))throw new rC({url:e,message:`URL with IPv6 address ${n} is not allowed`});return}if(Mue(n)){if(iC(n))throw new rC({url:e,message:`URL with IP address ${n} is not allowed`});return}}function Mue(e){let t=e.split(`.`);return t.length===4?t.every(e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255&&String(t)===e}):!1}function iC(e){let[t,n]=e.split(`.`).map(Number);return t===0||t===10||t===127||t===169&&n===254||t===172&&n>=16&&n<=31||t===192&&n===168}function Nue(e){let t=e.toLowerCase();if(t===`::1`||t===`::`)return!0;if(t.startsWith(`::ffff:`)){let e=t.slice(7);if(Mue(e))return iC(e);let n=e.split(`:`);if(n.length===2){let e=parseInt(n[0],16),t=parseInt(n[1],16);if(!isNaN(e)&&!isNaN(t))return iC(`${e>>8&255}.${e&255}.${t>>8&255}.${t&255}`)}}return!!(t.startsWith(`fc`)||t.startsWith(`fd`)||t.startsWith(`fe80`))}var aC=({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i`${e}${r}${i()}`},Pue=aC();function oC(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}function sC(e){return(e instanceof Error||e instanceof DOMException)&&(e.name===`AbortError`||e.name===`ResponseAborted`||e.name===`TimeoutError`)}var Fue=[`fetch failed`,`failed to fetch`],Iue=[`ConnectionRefused`,`ConnectionClosed`,`FailedToOpenSocket`,`ECONNRESET`,`ECONNREFUSED`,`ETIMEDOUT`,`EPIPE`];function Lue(e){if(!(e instanceof Error))return!1;let t=e.code;return!!(typeof t==`string`&&Iue.includes(t))}function Rue({error:e,url:t,requestBodyValues:n}){if(sC(e))return e;if(e instanceof TypeError&&Fue.includes(e.message.toLowerCase())){let r=e.cause;if(r!=null)return new Xx({message:`Cannot connect to API: ${r.message}`,cause:r,url:t,requestBodyValues:n,isRetryable:!0})}return Lue(e)?new Xx({message:`Cannot connect to API: ${e.message}`,cause:e,url:t,requestBodyValues:n,isRetryable:!0}):e}function cC(e=globalThis){return e.window?`runtime/browser`:e.navigator?.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:e.process?.versions?.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?`runtime/vercel-edge`:`runtime/unknown`}function lC(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}function uC(e,...t){let n=new Headers(lC(e)),r=n.get(`user-agent`)||``;return n.set(`user-agent`,[r,...t].filter(Boolean).join(` `)),Object.fromEntries(n.entries())}var zue=`4.0.23`,Bue=()=>globalThis.fetch,dC=async({url:e,headers:t={},successfulResponseHandler:n,failedResponseHandler:r,abortSignal:i,fetch:a=Bue()})=>{try{let o=await a(e,{method:`GET`,headers:uC(t,`ai-sdk/provider-utils/${zue}`,cC()),signal:i}),s=eC(o);if(!o.ok){let t;try{t=await r({response:o,url:e,requestBodyValues:{}})}catch(t){throw sC(t)||Xx.isInstance(t)?t:new Xx({message:`Failed to process error response`,cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}throw t.value}try{return await n({response:o,url:e,requestBodyValues:{}})}catch(t){throw t instanceof Error&&(sC(t)||Xx.isInstance(t))?t:new Xx({message:`Failed to process successful response`,cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}}catch(t){throw Rue({error:t,url:e,requestBodyValues:{}})}};function Vue({mediaType:e,url:t,supportedUrls:n}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(n).map(([e,t])=>{let n=e.toLowerCase();return n===`*`||n===`*/*`?{mediaTypePrefix:``,regexes:t}:{mediaTypePrefix:n.replace(/\*/,``),regexes:t}}).filter(({mediaTypePrefix:t})=>e.startsWith(t)).flatMap(({regexes:e})=>e).some(e=>e.test(t))}function fC({settingValue:e,environmentVariableName:t}){if(typeof e==`string`||!(e!=null||typeof process>`u`)&&(e={}[t],!(e==null||typeof e!=`string`)))return e}var Hue=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Uue=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Wue(e){let t=JSON.parse(e);return typeof t!=`object`||!t||Hue.test(e)===!1&&Uue.test(e)===!1?t:Gue(t)}function Gue(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&n.constructor!==null&&typeof n.constructor==`object`&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function Kue(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return Wue(e)}try{return Wue(e)}finally{Error.stackTraceLimit=t}}function pC(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){e.additionalProperties=!1;let{properties:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=mC(t[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(mC):mC(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(mC)),e.allOf!=null&&(e.allOf=e.allOf.map(mC)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(mC));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=mC(t[e]);return e}function mC(e){return typeof e==`boolean`?e:pC(e)}var que=Symbol(`Let zodToJsonSchema decide on which parser to use`),Jue={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`},Yue=e=>typeof e==`string`?{...Jue,name:e}:{...Jue,...e};function hC(){return{}}function Xue(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==K.ZodAny&&(n.items=wC(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}function Zue(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function Que(){return{type:`boolean`}}function $ue(e,t){return wC(e.type._def,t)}var ede=(e,t)=>wC(e.innerType._def,t);function tde(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>tde(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return nde(e)}}var nde=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value;break}return t};function rde(e,t){return{...wC(e.innerType._def,t),default:e.defaultValue()}}function ide(e,t){return t.effectStrategy===`input`?wC(e.schema._def,t):hC()}function ade(e){return{type:`string`,enum:Array.from(e.values)}}var ode=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function sde(e,t){let n=[wC(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),wC(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(ode(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}r.push(t)}}),r.length?{allOf:r}:void 0}function cde(e){let t=typeof e.value;return t!==`bigint`&&t!==`number`&&t!==`boolean`&&t!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:{type:t===`bigint`?`integer`:t,const:e.value}}var gC=void 0,_C={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(gC===void 0&&(gC=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),gC),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function lde(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value;break;case`max`:n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`email`:switch(t.emailStrategy){case`format:email`:yC(n,`email`,r.message,t);break;case`format:idn-email`:yC(n,`idn-email`,r.message,t);break;case`pattern:zod`:bC(n,_C.email,r.message,t);break}break;case`url`:yC(n,`uri`,r.message,t);break;case`uuid`:yC(n,`uuid`,r.message,t);break;case`regex`:bC(n,r.regex,r.message,t);break;case`cuid`:bC(n,_C.cuid,r.message,t);break;case`cuid2`:bC(n,_C.cuid2,r.message,t);break;case`startsWith`:bC(n,RegExp(`^${vC(r.value,t)}`),r.message,t);break;case`endsWith`:bC(n,RegExp(`${vC(r.value,t)}$`),r.message,t);break;case`datetime`:yC(n,`date-time`,r.message,t);break;case`date`:yC(n,`date`,r.message,t);break;case`time`:yC(n,`time`,r.message,t);break;case`duration`:yC(n,`duration`,r.message,t);break;case`length`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`includes`:bC(n,RegExp(vC(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&yC(n,`ipv4`,r.message,t),r.version!==`v4`&&yC(n,`ipv6`,r.message,t);break;case`base64url`:bC(n,_C.base64url,r.message,t);break;case`jwt`:bC(n,_C.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&bC(n,_C.ipv4Cidr,r.message,t),r.version!==`v4`&&bC(n,_C.ipv6Cidr,r.message,t);break;case`emoji`:bC(n,_C.emoji(),r.message,t);break;case`ulid`:bC(n,_C.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:yC(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:bC(n,_C.base64,r.message,t);break}break;case`nanoid`:bC(n,_C.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:}return n}function vC(e,t){return t.patternStrategy===`escape`?dde(e):e}var ude=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function dde(e){let t=``;for(let n=0;ne.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function bC(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:xC(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=xC(t,r)}function xC(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;etypeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function mde(){return{not:hC()}}function hde(){return{type:`null`}}var CC={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function gde(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in CC&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=CC[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return _de(e,t)}var _de=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>wC(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function vde(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[CC[e.innerType._def.typeName],`null`]};let n=wC(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function yde(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function bde(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=Sde(a),s=wC(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=xde(e,t);return a!==void 0&&(n.additionalProperties=a),n}function xde(e,t){if(e.catchall._def.typeName!==`ZodNever`)return wC(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Sde(e){try{return e.isOptional()}catch{return!0}}var Cde=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return wC(e.innerType._def,t);let n=wC(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:hC()},n]}:hC()},wde=(e,t)=>{if(t.pipeStrategy===`input`)return wC(e.in._def,t);if(t.pipeStrategy===`output`)return wC(e.out._def,t);let n=wC(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,wC(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function Tde(e,t){return wC(e.type._def,t)}function Ede(e,t){let n={type:`array`,uniqueItems:!0,items:wC(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function Dde(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>wC(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:wC(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>wC(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function Ode(){return{not:hC()}}function kde(){return hC()}var Ade=(e,t)=>wC(e.innerType._def,t),jde=(e,t,n)=>{switch(t){case K.ZodString:return lde(e,n);case K.ZodNumber:return yde(e);case K.ZodObject:return bde(e,n);case K.ZodBigInt:return Zue(e);case K.ZodBoolean:return Que();case K.ZodDate:return tde(e,n);case K.ZodUndefined:return Ode();case K.ZodNull:return hde();case K.ZodArray:return Xue(e,n);case K.ZodUnion:case K.ZodDiscriminatedUnion:return gde(e,n);case K.ZodIntersection:return sde(e,n);case K.ZodTuple:return Dde(e,n);case K.ZodRecord:return SC(e,n);case K.ZodLiteral:return cde(e);case K.ZodEnum:return ade(e);case K.ZodNativeEnum:return pde(e);case K.ZodNullable:return vde(e,n);case K.ZodOptional:return Cde(e,n);case K.ZodMap:return fde(e,n);case K.ZodSet:return Ede(e,n);case K.ZodLazy:return()=>e.getter()._def;case K.ZodPromise:return Tde(e,n);case K.ZodNaN:case K.ZodNever:return mde();case K.ZodEffects:return ide(e,n);case K.ZodAny:return hC();case K.ZodUnknown:return kde();case K.ZodDefault:return rde(e,n);case K.ZodBranded:return $ue(e,n);case K.ZodReadonly:return Ade(e,n);case K.ZodCatch:return ede(e,n);case K.ZodPipeline:return wde(e,n);case K.ZodFunction:case K.ZodVoid:case K.ZodSymbol:return;default:return(e=>void 0)(t)}},Mde=(e,t)=>{let n=0;for(;n{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:Mde(t.currentPath,e.path)};case`none`:case`seen`:return e.path.lengtht.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),hC()):t.$refStrategy===`seen`?hC():void 0}},Pde=(e,t,n)=>(e.description&&(n.description=e.description),n),Fde=e=>{let t=Yue(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},Ide=(e,t)=>{let n=Fde(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:wC(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??hC()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=wC(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??hC(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},TC=Symbol.for(`vercel.ai.schema`);function EC(e){let t;return()=>(t??=e(),t)}function DC(e,{validate:t}={}){return{[TC]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function Lde(e){return typeof e==`object`&&!!e&&TC in e&&e[TC]===!0&&`jsonSchema`in e&&`validate`in e}function OC(e){return e==null?DC({properties:{},additionalProperties:!1}):Lde(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?kC(e):Rde(e):e()}function Rde(e){return DC(()=>pC(e[`~standard`].jsonSchema.input({target:`draft-07`})),{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new eS({value:t,cause:n.issues})}}})}function zde(e,t){let n=t?.useReferences??!1;return DC(()=>Ide(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Bde(e,t){let n=t?.useReferences??!1;return DC(()=>pC(s(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await f(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Vde(e){return`_zod`in e}function kC(e,t){return Vde(e)?Bde(e,t):zde(e,t)}async function AC({value:e,schema:t,context:n}){let r=await jC({value:e,schema:t,context:n});if(!r.success)throw eS.wrap({value:e,cause:r.error,context:n});return r.value}async function jC({value:e,schema:t,context:n}){let r=OC(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:eS.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:eS.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function Hde({text:e,schema:t}){try{let n=Kue(e);return t==null?n:AC({value:n,schema:t})}catch(t){throw $x.isInstance(t)||eS.isInstance(t)?t:new $x({text:e,cause:t})}}async function MC({text:e,schema:t}){try{let n=Kue(e);return t==null?{success:!0,value:n,rawValue:n}:await jC({value:n,schema:t})}catch(t){return{success:!1,error:$x.isInstance(t)?t:new $x({text:e,cause:t}),rawValue:void 0}}}function NC({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new yue).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await MC({text:e,schema:t}))}}))}var Ude=()=>globalThis.fetch,PC=async({url:e,headers:t,body:n,failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o})=>Wde({url:e,headers:{"Content-Type":`application/json`,...t},body:{content:JSON.stringify(n),values:n},failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o}),Wde=async({url:e,headers:t={},body:n,successfulResponseHandler:r,failedResponseHandler:i,abortSignal:a,fetch:o=Ude()})=>{try{let s=await o(e,{method:`POST`,headers:uC(t,`ai-sdk/provider-utils/${zue}`,cC()),body:n.content,signal:a}),c=eC(s);if(!s.ok){let t;try{t=await i({response:s,url:e,requestBodyValues:n.values})}catch(t){throw sC(t)||Xx.isInstance(t)?t:new Xx({message:`Failed to process error response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}throw t.value}try{return await r({response:s,url:e,requestBodyValues:n.values})}catch(t){throw t instanceof Error&&(sC(t)||Xx.isInstance(t))?t:new Xx({message:`Failed to process successful response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}}catch(t){throw Rue({error:t,url:e,requestBodyValues:n.values})}};function FC(e){return e}function IC({id:e,inputSchema:t,outputSchema:n,supportsDeferredResults:r}){return({execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:c,onInputAvailable:l,...u})=>FC({type:`provider`,id:e,args:u,inputSchema:t,outputSchema:n,execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:c,onInputAvailable:l,supportsDeferredResults:r})}async function LC(e){return typeof e==`function`&&(e=e()),Promise.resolve(e)}var RC=({errorSchema:e,errorToMessage:t,isRetryable:n})=>async({response:r,url:i,requestBodyValues:a})=>{let o=await r.text(),s=eC(r);if(o.trim()===``)return{responseHeaders:s,value:new Xx({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})};try{let c=await Hde({text:o,schema:e});return{responseHeaders:s,value:new Xx({message:t(c),url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,data:c,isRetryable:n?.(r,c)})}}catch{return{responseHeaders:s,value:new Xx({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})}}},Gde=e=>async({response:t})=>{let n=eC(t);if(t.body==null)throw new ole({});return{responseHeaders:n,value:NC({stream:t.body,schema:e})}},zC=e=>async({response:t,url:n,requestBodyValues:r})=>{let i=await t.text(),a=await MC({text:i,schema:e}),o=eC(t);if(!a.success)throw new Xx({message:`Invalid JSON response`,cause:a.error,statusCode:t.status,responseHeaders:o,responseBody:i,url:n,requestBodyValues:r});return{responseHeaders:o,value:a.value,rawValue:a.rawValue}};function Kde(e){return e?.replace(/\/$/,``)}function qde(e){return e!=null&&typeof e[Symbol.asyncIterator]==`function`}async function*Jde({execute:e,input:t,options:n}){let r=e(t,n);if(qde(r)){let e;for await(let t of r)e=t,yield{type:`preliminary`,output:t};yield{type:`final`,output:e}}else yield{type:`final`,output:await r}}var Yde=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);var u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}})),BC=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getContext:()=>u.getContext,getVercelOidcToken:()=>d,getVercelOidcTokenSync:()=>f}),t.exports=c(l);var u=Yde();async function d(){return``}function f(){return``}}))(),VC=Symbol.for(`vercel.ai.gateway.error`),HC,UC,WC=class e extends (UC=Error,HC=VC,UC){constructor({message:e,statusCode:t=500,cause:n,generationId:r}){super(r?`${e} [${r}]`:e),this[HC]=!0,this.statusCode=t,this.cause=n,this.generationId=r}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return typeof e==`object`&&!!e&&VC in e&&e[VC]===!0}},GC=`GatewayAuthenticationError`,Xde=`vercel.ai.gateway.error.${GC}`,KC=Symbol.for(Xde),qC,JC,YC=class e extends (JC=WC,qC=KC,JC){constructor({message:e=`Authentication failed`,statusCode:t=401,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[qC]=!0,this.name=GC,this.type=`authentication_error`}static isInstance(e){return WC.hasMarker(e)&&KC in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,message:r=`Authentication failed`,statusCode:i=401,cause:a,generationId:o}){let s;return s=t?`AI Gateway authentication failed: Invalid API key. + +Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys + +Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:n?`AI Gateway authentication failed: Invalid OIDC token. + +Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token. + +Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`:`AI Gateway authentication failed: No authentication provided. + +Option 1 - API key: +Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys +Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable. + +Option 2 - OIDC token: +Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,new e({message:s,statusCode:i,cause:a,generationId:o})}},XC=`GatewayInvalidRequestError`,Zde=`vercel.ai.gateway.error.${XC}`,ZC=Symbol.for(Zde),QC,$C,Qde=class extends ($C=WC,QC=ZC,$C){constructor({message:e=`Invalid request`,statusCode:t=400,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[QC]=!0,this.name=XC,this.type=`invalid_request_error`}static isInstance(e){return WC.hasMarker(e)&&ZC in e}},ew=`GatewayRateLimitError`,$de=`vercel.ai.gateway.error.${ew}`,tw=Symbol.for($de),nw,rw,efe=class extends (rw=WC,nw=tw,rw){constructor({message:e=`Rate limit exceeded`,statusCode:t=429,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[nw]=!0,this.name=ew,this.type=`rate_limit_exceeded`}static isInstance(e){return WC.hasMarker(e)&&tw in e}},iw=`GatewayModelNotFoundError`,tfe=`vercel.ai.gateway.error.${iw}`,aw=Symbol.for(tfe),nfe=EC(()=>kC(h({modelId:r()}))),ow,sw,rfe=class extends (sw=WC,ow=aw,sw){constructor({message:e=`Model not found`,statusCode:t=404,modelId:n,cause:r,generationId:i}={}){super({message:e,statusCode:t,cause:r,generationId:i}),this[ow]=!0,this.name=iw,this.type=`model_not_found`,this.modelId=n}static isInstance(e){return WC.hasMarker(e)&&aw in e}},cw=`GatewayInternalServerError`,ife=`vercel.ai.gateway.error.${cw}`,lw=Symbol.for(ife),uw,dw,fw=class extends (dw=WC,uw=lw,dw){constructor({message:e=`Internal server error`,statusCode:t=500,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[uw]=!0,this.name=cw,this.type=`internal_server_error`}static isInstance(e){return WC.hasMarker(e)&&lw in e}},pw=`GatewayResponseError`,afe=`vercel.ai.gateway.error.${pw}`,mw=Symbol.for(afe),hw,gw,ofe=class extends (gw=WC,hw=mw,gw){constructor({message:e=`Invalid response from Gateway`,statusCode:t=502,response:n,validationError:r,cause:i,generationId:a}={}){super({message:e,statusCode:t,cause:i,generationId:a}),this[hw]=!0,this.name=pw,this.type=`response_error`,this.response=n,this.validationError=r}static isInstance(e){return WC.hasMarker(e)&&mw in e}};async function _w({response:e,statusCode:t,defaultMessage:n=`Gateway request failed`,cause:r,authMethod:i}){let a=await jC({value:e,schema:sfe});if(!a.success){let i=typeof e==`object`&&e&&`generationId`in e?e.generationId:void 0;return new ofe({message:`Invalid error response format: ${n}`,statusCode:t,response:e,validationError:a.error,cause:r,generationId:i})}let o=a.value,s=o.error.type,c=o.error.message,l=o.generationId??void 0;switch(s){case`authentication_error`:return YC.createContextualError({apiKeyProvided:i===`api-key`,oidcTokenProvided:i===`oidc`,statusCode:t,cause:r,generationId:l});case`invalid_request_error`:return new Qde({message:c,statusCode:t,cause:r,generationId:l});case`rate_limit_exceeded`:return new efe({message:c,statusCode:t,cause:r,generationId:l});case`model_not_found`:{let e=await jC({value:o.error.param,schema:nfe});return new rfe({message:c,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:r,generationId:l})}case`internal_server_error`:return new fw({message:c,statusCode:t,cause:r,generationId:l});default:return new fw({message:c,statusCode:t,cause:r,generationId:l})}}var sfe=EC(()=>kC(h({error:h({message:r(),type:r().nullish(),param:u().nullish(),code:l([r(),P()]).nullish()}),generationId:r().nullish()}))),vw=`GatewayTimeoutError`,cfe=`vercel.ai.gateway.error.${vw}`,yw=Symbol.for(cfe),bw,xw,Sw=class e extends (xw=WC,bw=yw,xw){constructor({message:e=`Request timed out`,statusCode:t=408,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[bw]=!0,this.name=vw,this.type=`timeout_error`}static isInstance(e){return WC.hasMarker(e)&&yw in e}static createTimeoutError({originalMessage:t,statusCode:n=408,cause:r,generationId:i}){return new e({message:`Gateway request timed out: ${t} + + This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`,statusCode:n,cause:r,generationId:i})}};function Cw(e){if(!(e instanceof Error))return!1;let t=e.code;return typeof t==`string`?[`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CONNECT_TIMEOUT`].includes(t):!1}async function ww(e,t){return WC.isInstance(e)?e:Cw(e)?Sw.createTimeoutError({originalMessage:e instanceof Error?e.message:`Unknown error`,cause:e}):Xx.isInstance(e)?e.cause&&Cw(e.cause)?Sw.createTimeoutError({originalMessage:e.message,cause:e}):await _w({response:lfe(e),statusCode:e.statusCode??500,defaultMessage:`Gateway request failed`,cause:e,authMethod:t}):await _w({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:`Unknown Gateway error`,cause:e,authMethod:t})}function lfe(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return JSON.parse(e.responseBody)}catch{return e.responseBody}return{}}var Tw=`ai-gateway-auth-method`;async function Ew(e){let t=await jC({value:e[Tw],schema:ufe});return t.success?t.value:void 0}var ufe=EC(()=>kC(l([m(`api-key`),m(`oidc`)]))),Dw=class{constructor(e){this.config=e}async getAvailableModels(){try{let{value:e}=await dC({url:`${this.config.baseURL}/config`,headers:await LC(this.config.headers()),successfulResponseHandler:zC(dfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await ww(e)}}async getCredits(){try{let{value:e}=await dC({url:`${new URL(this.config.baseURL).origin}/v1/credits`,headers:await LC(this.config.headers()),successfulResponseHandler:zC(ffe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await ww(e)}}},dfe=EC(()=>kC(h({models:C(h({id:r(),name:r(),description:r().nullish(),pricing:h({input:r(),output:r(),input_cache_read:r().nullish(),input_cache_write:r().nullish()}).transform(({input:e,output:t,input_cache_read:n,input_cache_write:r})=>({input:e,output:t,...n?{cachedInputTokens:n}:{},...r?{cacheCreationInputTokens:r}:{}})).nullish(),specification:h({specificationVersion:m(`v3`),provider:r(),modelId:r()}),modelType:E([`embedding`,`image`,`language`,`video`]).nullish()}))}))),ffe=EC(()=>kC(h({balance:r(),total_used:r()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),pfe=class{constructor(e){this.config=e}async getSpendReport(e){try{let t=new URL(this.config.baseURL),n=new URLSearchParams;n.set(`start_date`,e.startDate),n.set(`end_date`,e.endDate),e.groupBy&&n.set(`group_by`,e.groupBy),e.datePart&&n.set(`date_part`,e.datePart),e.userId&&n.set(`user_id`,e.userId),e.model&&n.set(`model`,e.model),e.provider&&n.set(`provider`,e.provider),e.credentialType&&n.set(`credential_type`,e.credentialType),e.tags&&e.tags.length>0&&n.set(`tags`,e.tags.join(`,`));let{value:r}=await dC({url:`${t.origin}/v1/report?${n.toString()}`,headers:await LC(this.config.headers()),successfulResponseHandler:zC(mfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),fetch:this.config.fetch});return r}catch(e){throw await ww(e)}}},mfe=EC(()=>kC(h({results:C(h({day:r().optional(),hour:r().optional(),user:r().optional(),model:r().optional(),tag:r().optional(),provider:r().optional(),credential_type:E([`byok`,`system`]).optional(),total_cost:P(),market_cost:P().optional(),input_tokens:P().optional(),output_tokens:P().optional(),cached_input_tokens:P().optional(),cache_creation_input_tokens:P().optional(),reasoning_tokens:P().optional(),request_count:P().optional()}).transform(({credential_type:e,total_cost:t,market_cost:n,input_tokens:r,output_tokens:i,cached_input_tokens:a,cache_creation_input_tokens:o,reasoning_tokens:s,request_count:c,...l})=>({...l,...e===void 0?{}:{credentialType:e},totalCost:t,...n===void 0?{}:{marketCost:n},...r===void 0?{}:{inputTokens:r},...i===void 0?{}:{outputTokens:i},...a===void 0?{}:{cachedInputTokens:a},...o===void 0?{}:{cacheCreationInputTokens:o},...s===void 0?{}:{reasoningTokens:s},...c===void 0?{}:{requestCount:c}})))}))),hfe=class{constructor(e){this.config=e}async getGenerationInfo(e){try{let{value:t}=await dC({url:`${new URL(this.config.baseURL).origin}/v1/generation?id=${encodeURIComponent(e.id)}`,headers:await LC(this.config.headers()),successfulResponseHandler:zC(gfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await ww(e)}}},gfe=EC(()=>kC(h({data:h({id:r(),total_cost:P(),upstream_inference_cost:P(),usage:P(),created_at:r(),model:r(),is_byok:S(),provider_name:r(),streamed:S(),finish_reason:r(),latency:P(),generation_time:P(),native_tokens_prompt:P(),native_tokens_completion:P(),native_tokens_reasoning:P(),native_tokens_cached:P(),native_tokens_cache_creation:P(),billable_web_search_calls:P()}).transform(({total_cost:e,upstream_inference_cost:t,created_at:n,is_byok:r,provider_name:i,finish_reason:a,generation_time:o,native_tokens_prompt:s,native_tokens_completion:c,native_tokens_reasoning:l,native_tokens_cached:u,native_tokens_cache_creation:d,billable_web_search_calls:f,...p})=>({...p,totalCost:e,upstreamInferenceCost:t,createdAt:n,isByok:r,providerName:i,finishReason:a,generationTime:o,promptTokens:s,completionTokens:c,reasoningTokens:l,cachedTokens:u,cacheCreationTokens:d,billableWebSearchCalls:f}))}).transform(({data:e})=>e))),_fe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`,this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(e){let{abortSignal:t,...n}=e;return{args:this.maybeEncodeFileParts(n),warnings:[]}}async doGenerate(e){let{args:t,warnings:n}=await this.getArgs(e),{abortSignal:r}=e,i=await LC(this.config.headers());try{let{responseHeaders:a,value:o,rawValue:s}=await PC({url:this.getUrl(),headers:QS(i,e.headers,this.getModelConfigHeaders(this.modelId,!1),await LC(this.config.o11yHeaders)),body:t,successfulResponseHandler:zC(D()),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{...o,request:{body:t},response:{headers:a,body:s},warnings:n}}catch(e){throw await ww(e,await Ew(i))}}async doStream(e){let{args:t,warnings:n}=await this.getArgs(e),{abortSignal:r}=e,i=await LC(this.config.headers());try{let{value:a,responseHeaders:o}=await PC({url:this.getUrl(),headers:QS(i,e.headers,this.getModelConfigHeaders(this.modelId,!0),await LC(this.config.o11yHeaders)),body:t,successfulResponseHandler:Gde(D()),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{stream:a.pipeThrough(new TransformStream({start(e){n.length>0&&e.enqueue({type:`stream-start`,warnings:n})},transform(t,n){if(t.success){let r=t.value;if(r.type===`raw`&&!e.includeRawChunks)return;r.type===`response-metadata`&&r.timestamp&&typeof r.timestamp==`string`&&(r.timestamp=new Date(r.timestamp)),n.enqueue(r)}else n.error(t.error)}})),request:{body:t},response:{headers:o}}}catch(e){throw await ww(e,await Ew(i))}}isFilePart(e){return e&&typeof e==`object`&&`type`in e&&e.type===`file`}maybeEncodeFileParts(e){for(let t of e.prompt)for(let e of t.content)if(this.isFilePart(e)){let t=e;if(t.data instanceof Uint8Array){let e=Uint8Array.from(t.data),n=Buffer.from(e).toString(`base64`);t.data=new URL(`data:${t.mediaType||`application/octet-stream`};base64,${n}`)}}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":`3`,"ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},vfe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`,this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:r}){let i=await LC(this.config.headers());try{let{responseHeaders:a,value:o,rawValue:s}=await PC({url:this.getUrl(),headers:QS(i,t??{},this.getModelConfigHeaders(),await LC(this.config.o11yHeaders)),body:{values:e,...r?{providerOptions:r}:{}},successfulResponseHandler:zC(yfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{embeddings:o.embeddings,usage:o.usage??void 0,providerMetadata:o.providerMetadata,response:{headers:a,body:s},warnings:[]}}catch(e){throw await ww(e,await Ew(i))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":`3`,"ai-model-id":this.modelId}}},yfe=EC(()=>kC(h({embeddings:C(C(P())),usage:h({tokens:P()}).nullish(),providerMetadata:d(r(),d(r(),u())).optional()}))),bfe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`,this.maxImagesPerCall=2**53-1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:n,aspectRatio:r,seed:i,files:a,mask:o,providerOptions:s,headers:c,abortSignal:l}){let u=await LC(this.config.headers());try{let{responseHeaders:d,value:f,rawValue:p}=await PC({url:this.getUrl(),headers:QS(u,c??{},this.getModelConfigHeaders(),await LC(this.config.o11yHeaders)),body:{prompt:e,n:t,...n&&{size:n},...r&&{aspectRatio:r},...i&&{seed:i},...s&&{providerOptions:s},...a&&{files:a.map(e=>Ow(e))},...o&&{mask:Ow(o)}},successfulResponseHandler:zC(wfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...l&&{abortSignal:l},fetch:this.config.fetch});return{images:f.images,warnings:f.warnings??[],providerMetadata:f.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:d},...f.usage!=null&&{usage:{inputTokens:f.usage.inputTokens??void 0,outputTokens:f.usage.outputTokens??void 0,totalTokens:f.usage.totalTokens??void 0}}}}catch(e){throw await ww(e,await Ew(u))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":`3`,"ai-model-id":this.modelId}}};function Ow(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:nC(e.data)}:e}var xfe=h({images:C(u()).optional()}).catchall(u()),Sfe=I(`type`,[h({type:m(`unsupported`),feature:r(),details:r().optional()}),h({type:m(`compatibility`),feature:r(),details:r().optional()}),h({type:m(`other`),message:r()})]),Cfe=h({inputTokens:P().nullish(),outputTokens:P().nullish(),totalTokens:P().nullish()}),wfe=h({images:C(r()),warnings:C(Sfe).optional(),providerMetadata:d(r(),xfe).optional(),usage:Cfe.optional()}),Tfe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`,this.maxVideosPerCall=2**53-1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,aspectRatio:n,resolution:r,duration:i,fps:a,seed:o,image:s,providerOptions:c,headers:l,abortSignal:u}){let d=await LC(this.config.headers());try{let{responseHeaders:f,value:p}=await PC({url:this.getUrl(),headers:QS(d,l??{},this.getModelConfigHeaders(),await LC(this.config.o11yHeaders),{accept:`text/event-stream`}),body:{prompt:e,n:t,...n&&{aspectRatio:n},...r&&{resolution:r},...i&&{duration:i},...a&&{fps:a},...o&&{seed:o},...c&&{providerOptions:c},...s&&{image:Efe(s)}},successfulResponseHandler:async({response:e,url:t,requestBodyValues:n})=>{if(e.body==null)throw new Xx({message:`SSE response body is empty`,url:t,requestBodyValues:n,statusCode:e.status});let r=NC({stream:e.body,schema:Afe}).getReader(),{done:i,value:a}=await r.read();if(r.releaseLock(),i||!a)throw new Xx({message:`SSE stream ended without a data event`,url:t,requestBodyValues:n,statusCode:e.status});if(!a.success)throw new Xx({message:`Failed to parse video SSE event`,cause:a.error,url:t,requestBodyValues:n,statusCode:e.status});let o=a.value;if(o.type===`error`)throw new Xx({message:o.message,statusCode:o.statusCode,url:t,requestBodyValues:n,responseHeaders:Object.fromEntries([...e.headers]),responseBody:JSON.stringify(o),data:{error:{message:o.message,type:o.errorType,param:o.param}}});return{value:{videos:o.videos,warnings:o.warnings,providerMetadata:o.providerMetadata},responseHeaders:Object.fromEntries([...e.headers])}},failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...u&&{abortSignal:u},fetch:this.config.fetch});return{videos:p.videos,warnings:p.warnings??[],providerMetadata:p.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:f}}}catch(e){throw await ww(e,await Ew(d))}}getUrl(){return`${this.config.baseURL}/video-model`}getModelConfigHeaders(){return{"ai-video-model-specification-version":`3`,"ai-model-id":this.modelId}}};function Efe(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:nC(e.data)}:e}var Dfe=h({videos:C(u()).optional()}).catchall(u()),Ofe=l([h({type:m(`url`),url:r(),mediaType:r()}),h({type:m(`base64`),data:r(),mediaType:r()})]),kfe=I(`type`,[h({type:m(`unsupported`),feature:r(),details:r().optional()}),h({type:m(`compatibility`),feature:r(),details:r().optional()}),h({type:m(`other`),message:r()})]),Afe=I(`type`,[h({type:m(`result`),videos:C(Ofe),warnings:C(kfe).optional(),providerMetadata:d(r(),Dfe).optional()}),h({type:m(`error`),message:r(),errorType:r(),statusCode:P(),param:u().nullable()})]),jfe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`}get provider(){return this.config.provider}async doRerank({documents:e,query:t,topN:n,headers:r,abortSignal:i,providerOptions:a}){let o=await LC(this.config.headers());try{let{responseHeaders:s,value:c,rawValue:l}=await PC({url:this.getUrl(),headers:QS(o,r??{},this.getModelConfigHeaders(),await LC(this.config.o11yHeaders)),body:{documents:e,query:t,...n==null?{}:{topN:n},...a?{providerOptions:a}:{}},successfulResponseHandler:zC(Mfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...i&&{abortSignal:i},fetch:this.config.fetch});return{ranking:c.ranking,providerMetadata:c.providerMetadata,response:{headers:s,body:l},warnings:[]}}catch(e){throw await ww(e,await Ew(o))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":`3`,"ai-model-id":this.modelId}}},Mfe=EC(()=>kC(h({ranking:C(h({index:P(),relevanceScore:P()})),providerMetadata:d(r(),d(r(),u())).optional()}))),Nfe=IC({id:`gateway.parallel_search`,inputSchema:EC(()=>kC(h({objective:r().describe(`Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters.`),search_queries:C(r()).optional().describe(`Optional search queries to supplement the objective. Maximum 200 characters per query.`),mode:E([`one-shot`,`agentic`]).optional().describe(`Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.`),max_results:P().optional().describe(`Maximum number of results to return (1-20). Defaults to 10 if not specified.`),source_policy:h({include_domains:C(r()).optional().describe(`List of domains to include in search results.`),exclude_domains:C(r()).optional().describe(`List of domains to exclude from search results.`),after_date:r().optional().describe(`Only include results published after this date (ISO 8601 format).`)}).optional().describe(`Source policy for controlling which domains to include/exclude and freshness.`),excerpts:h({max_chars_per_result:P().optional().describe(`Maximum characters per result.`),max_chars_total:P().optional().describe(`Maximum total characters across all results.`)}).optional().describe(`Excerpt configuration for controlling result length.`),fetch_policy:h({max_age_seconds:P().optional().describe(`Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.`)}).optional().describe(`Fetch policy for controlling content freshness.`)}))),outputSchema:EC(()=>kC(l([h({searchId:r(),results:C(h({url:r(),title:r(),excerpt:r(),publishDate:r().nullable().optional(),relevanceScore:P().optional()}))}),h({error:E([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`configuration_error`,`unknown`]),statusCode:P().optional(),message:r()})])))}),Pfe=(e={})=>Nfe(e),Ffe=IC({id:`gateway.perplexity_search`,inputSchema:EC(()=>kC(h({query:l([r(),C(r())]).describe(`Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries.`),max_results:P().optional().describe(`Maximum number of search results to return (1-20, default: 10)`),max_tokens_per_page:P().optional().describe(`Maximum number of tokens to extract per search result page (256-2048, default: 2048)`),max_tokens:P().optional().describe(`Maximum total tokens across all search results (default: 25000, max: 1000000)`),country:r().optional().describe(`Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')`),search_domain_filter:C(r()).optional().describe(`List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']`),search_language_filter:C(r()).optional().describe(`List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']`),search_after_date:r().optional().describe(`Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter.`),search_before_date:r().optional().describe(`Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter.`),last_updated_after_filter:r().optional().describe(`Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter.`),last_updated_before_filter:r().optional().describe(`Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter.`),search_recency_filter:E([`day`,`week`,`month`,`year`]).optional().describe(`Filter results by relative time period. Cannot be used with search_after_date or search_before_date.`)}))),outputSchema:EC(()=>kC(l([h({results:C(h({title:r(),url:r(),snippet:r(),date:r().optional(),lastUpdated:r().optional()})),id:r()}),h({error:E([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`unknown`]),statusCode:P().optional(),message:r()})])))}),Ife={parallelSearch:Pfe,perplexitySearch:(e={})=>Ffe(e)};async function Lfe(){return(0,BC.getContext)().headers?.[`x-vercel-id`]}var Rfe=`3.0.96`,zfe=`0.0.1`;function Bfe(e={}){let t=null,n=null,r=e.metadataCacheRefreshMillis??1e3*60*5,i=0,a=Kde(e.baseURL)??`https://ai-gateway.vercel.sh/v3/ai`,o=async()=>{try{let t=await Hfe(e);return uC({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":zfe,[Tw]:t.authMethod,...e.headers},`ai-sdk/gateway/${Rfe}`)}catch(e){throw YC.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},s=()=>{let e=fC({settingValue:void 0,environmentVariableName:`VERCEL_DEPLOYMENT_ID`}),t=fC({settingValue:void 0,environmentVariableName:`VERCEL_ENV`}),n=fC({settingValue:void 0,environmentVariableName:`VERCEL_REGION`}),r=fC({settingValue:void 0,environmentVariableName:`VERCEL_PROJECT_ID`});return async()=>{let i=await Lfe();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...n&&{"ai-o11y-region":n},...i&&{"ai-o11y-request-id":i},...r&&{"ai-o11y-project-id":r}}}},c=t=>new _fe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()}),l=async()=>{var s;let c=((s=e._internal)?.currentDate)?.call(s).getTime()??Date.now();return(!t||c-i>r)&&(i=c,t=new Dw({baseURL:a,headers:o,fetch:e.fetch}).getAvailableModels().then(e=>(n=e,e)).catch(async e=>{throw await ww(e,await Ew(await o()))})),n?Promise.resolve(n):t},u=async()=>new Dw({baseURL:a,headers:o,fetch:e.fetch}).getCredits().catch(async e=>{throw await ww(e,await Ew(await o()))}),d=async t=>new pfe({baseURL:a,headers:o,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await ww(e,await Ew(await o()))}),f=async t=>new hfe({baseURL:a,headers:o,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await ww(e,await Ew(await o()))}),p=function(e){if(new.target)throw Error(`The Gateway Provider model function cannot be called with the new keyword.`);return c(e)};p.specificationVersion=`v3`,p.getAvailableModels=l,p.getCredits=u,p.getSpendReport=d,p.getGenerationInfo=f,p.imageModel=t=>new bfe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()}),p.languageModel=c;let m=t=>new vfe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()});p.embeddingModel=m,p.textEmbeddingModel=m,p.videoModel=t=>new Tfe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()});let h=t=>new jfe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()});return p.rerankingModel=h,p.reranking=h,p.chat=p.languageModel,p.embedding=p.embeddingModel,p.image=p.imageModel,p.video=p.videoModel,p.tools=Ife,p}var Vfe=Bfe();async function Hfe(e){let t=fC({settingValue:e.apiKey,environmentVariableName:`AI_GATEWAY_API_KEY`});return t?{token:t,authMethod:`api-key`}:{token:await(0,BC.getVercelOidcToken)(),authMethod:`oidc`}}var Ufe=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},kw=`1.9.0`,Aw=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Wfe(e){var t=new Set([e]),n=new Set,r=e.match(Aw);if(!r)return function(){return!1};var i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;var r=e.match(Aw);if(!r)return a(e);var s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var Gfe=Wfe(kw),Kfe=kw.split(`.`)[0],jw=Symbol.for(`opentelemetry.js.api.`+Kfe),Mw=Ufe;function Nw(e,t,n,r){r===void 0&&(r=!1);var i=Mw[jw]=Mw[jw]??{version:kw};if(!r&&i[e]){var a=Error(`@opentelemetry/api: Attempted duplicate registration of API: `+e);return n.error(a.stack||a.message),!1}if(i.version!==`1.9.0`){var a=Error(`@opentelemetry/api: Registration of version v`+i.version+` for `+e+` does not match previously registered API v`+kw);return n.error(a.stack||a.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for `+e+` v`+kw+`.`),!0}function Pw(e){var t=Mw[jw]?.version;if(!(!t||!Gfe(t)))return Mw[jw]?.[e]}function Fw(e,t){t.debug(`@opentelemetry/api: Unregistering a global for `+e+` v`+kw+`.`);var n=Mw[jw];n&&delete n[e]}var qfe=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Jfe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;rLw.ALL&&(e=Lw.ALL),t||={};function n(n,r){var i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,Lw.ERROR),warn:n(`warn`,Lw.WARN),info:n(`info`,Lw.INFO),debug:n(`debug`,Lw.DEBUG),verbose:n(`verbose`,Lw.VERBOSE)}}var Zfe=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Qfe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r`;i.warn(`Current logger will be overwritten from `+o),a.warn(`Current logger will overwrite one already registered from `+o)}return Nw(`diag`,a,t,!0)},t.disable=function(){Fw($fe,t)},t.createComponentLogger=function(e){return new Yfe(e)},t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}return e.instance=function(){return this._instance||=new e,this._instance},e}();function epe(e){return Symbol.for(e)}var tpe=new(function(){function e(t){var n=this;n._currentContext=t?new Map(t):new Map,n.getValue=function(e){return n._currentContext.get(e)},n.setValue=function(t,r){var i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=function(t){var r=new e(n._currentContext);return r._currentContext.delete(t),r}}return e}()),npe=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},rpe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},ope=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r{for(var n in t)Spe(e,n,{get:t[n],enumerable:!0})},eT=`AI_InvalidArgumentError`,tT=`vercel.ai.error.${eT}`,wpe=Symbol.for(tT),nT,rT=class extends Yx{constructor({parameter:e,value:t,message:n}){super({name:eT,message:`Invalid argument for parameter ${e}: ${n}`}),this[nT]=!0,this.parameter=e,this.value=t}static isInstance(e){return Yx.hasMarker(e,tT)}};nT=wpe;var iT=`AI_InvalidToolApprovalError`,aT=`vercel.ai.error.${iT}`,Tpe=Symbol.for(aT),oT,Epe=class extends Yx{constructor({approvalId:e}){super({name:iT,message:`Tool approval response references unknown approvalId: "${e}". No matching tool-approval-request found in message history.`}),this[oT]=!0,this.approvalId=e}static isInstance(e){return Yx.hasMarker(e,aT)}};oT=Tpe;var sT=`AI_InvalidToolInputError`,cT=`vercel.ai.error.${sT}`,Dpe=Symbol.for(cT),lT,uT=class extends Yx{constructor({toolInput:e,toolName:t,cause:n,message:r=`Invalid input for tool ${t}: ${Zx(n)}`}){super({name:sT,message:r,cause:n}),this[lT]=!0,this.toolInput=e,this.toolName=t}static isInstance(e){return Yx.hasMarker(e,cT)}};lT=Dpe;var dT=`AI_ToolCallNotFoundForApprovalError`,fT=`vercel.ai.error.${dT}`,Ope=Symbol.for(fT),pT,mT=class extends Yx{constructor({toolCallId:e,approvalId:t}){super({name:dT,message:`Tool call "${e}" not found for approval request "${t}".`}),this[pT]=!0,this.toolCallId=e,this.approvalId=t}static isInstance(e){return Yx.hasMarker(e,fT)}};pT=Ope;var hT=`AI_MissingToolResultsError`,gT=`vercel.ai.error.${hT}`,kpe=Symbol.for(gT),_T,vT=class extends Yx{constructor({toolCallIds:e}){super({name:hT,message:`Tool result${e.length>1?`s are`:` is`} missing for tool call${e.length>1?`s`:``} ${e.join(`, `)}.`}),this[_T]=!0,this.toolCallIds=e}static isInstance(e){return Yx.hasMarker(e,gT)}};_T=kpe;var yT=`AI_NoObjectGeneratedError`,bT=`vercel.ai.error.${yT}`,Ape=Symbol.for(bT),xT,ST=class extends Yx{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:yT,message:e,cause:t}),this[xT]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return Yx.hasMarker(e,bT)}};xT=Ape;var CT=`AI_NoOutputGeneratedError`,wT=`vercel.ai.error.${CT}`,jpe=Symbol.for(wT),TT,ET=class extends Yx{constructor({message:e=`No output generated.`,cause:t}={}){super({name:CT,message:e,cause:t}),this[TT]=!0}static isInstance(e){return Yx.hasMarker(e,wT)}};TT=jpe;var DT=`AI_NoSuchToolError`,OT=`vercel.ai.error.${DT}`,Mpe=Symbol.for(OT),kT,AT=class extends Yx{constructor({toolName:e,availableTools:t=void 0,message:n=`Model tried to call unavailable tool '${e}'. ${t===void 0?`No tools are available.`:`Available tools: ${t.join(`, `)}.`}`}){super({name:DT,message:n}),this[kT]=!0,this.toolName=e,this.availableTools=t}static isInstance(e){return Yx.hasMarker(e,OT)}};kT=Mpe;var jT=`AI_ToolCallRepairError`,MT=`vercel.ai.error.${jT}`,Npe=Symbol.for(MT),NT,Ppe=class extends Yx{constructor({cause:e,originalError:t,message:n=`Error repairing tool call: ${Zx(e)}`}){super({name:jT,message:n,cause:e}),this[NT]=!0,this.originalError=t}static isInstance(e){return Yx.hasMarker(e,MT)}};NT=Npe;var Fpe=class extends Yx{constructor(e){super({name:`AI_UnsupportedModelVersionError`,message:`Unsupported model version ${e.version} for provider "${e.provider}" and model "${e.modelId}". AI SDK 5 only supports models that implement specification version "v2".`}),this.version=e.version,this.provider=e.provider,this.modelId=e.modelId}},PT=`AI_UIMessageStreamError`,FT=`vercel.ai.error.${PT}`,Ipe=Symbol.for(FT),IT,LT=class extends Yx{constructor({chunkType:e,chunkId:t,message:n}){super({name:PT,message:n}),this[IT]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Yx.hasMarker(e,FT)}};IT=Ipe;var RT=`AI_InvalidMessageRoleError`,zT=`vercel.ai.error.${RT}`,Lpe=Symbol.for(zT),BT,Rpe=class extends Yx{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:RT,message:t}),this[BT]=!0,this.role=e}static isInstance(e){return Yx.hasMarker(e,zT)}};BT=Lpe;var VT=`AI_RetryError`,HT=`vercel.ai.error.${VT}`,zpe=Symbol.for(HT),UT,WT=class extends Yx{constructor({message:e,reason:t,errors:n}){super({name:VT,message:e}),this[UT]=!0,this.reason=t,this.errors=n,this.lastError=n[n.length-1]}static isInstance(e){return Yx.hasMarker(e,HT)}};UT=zpe;function GT(e){return e===void 0?[]:Array.isArray(e)?e:[e]}async function KT(e){for(let t of GT(e.callbacks))if(t!=null)try{await t(e.event)}catch{}}function Bpe({warning:e,provider:t,model:n}){let r=`AI SDK Warning (${t} / ${n}):`;switch(e.type){case`unsupported`:{let t=`${r} The feature "${e.feature}" is not supported.`;return e.details&&(t+=` ${e.details}`),t}case`compatibility`:{let t=`${r} The feature "${e.feature}" is used in a compatibility mode.`;return e.details&&(t+=` ${e.details}`),t}case`other`:return`${r} ${e.message}`;default:return`${r} ${JSON.stringify(e,null,2)}`}}var Vpe=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,qT=!1,JT=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}qT||(qT=!0,console.info(Vpe));for(let t of e.warnings)console.warn(Bpe({warning:t,provider:e.provider,model:e.model}))}};function Hpe({provider:e,modelId:t}){JT({warnings:[{type:`compatibility`,feature:`specificationVersion`,details:`Using v2 specification compatibility mode. Some features may not be available.`}],provider:e,model:t})}function Upe(e){return e.specificationVersion===`v3`?e:(Hpe({provider:e.provider,modelId:e.modelId}),new Proxy(e,{get(e,t){switch(t){case`specificationVersion`:return`v3`;case`doGenerate`:return async(...t)=>{let n=await e.doGenerate(...t);return{...n,finishReason:YT(n.finishReason),usage:XT(n.usage)}};case`doStream`:return async(...t)=>{let n=await e.doStream(...t);return{...n,stream:Wpe(n.stream)}};default:return e[t]}}}))}function Wpe(e){return e.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`finish`:t.enqueue({...e,finishReason:YT(e.finishReason),usage:XT(e.usage)});break;default:t.enqueue(e);break}}}))}function YT(e){return{unified:e===`unknown`?`other`:e,raw:void 0}}function XT(e){return{inputTokens:{total:e.inputTokens,noCache:void 0,cacheRead:e.cachedInputTokens,cacheWrite:void 0},outputTokens:{total:e.outputTokens,text:void 0,reasoning:e.reasoningTokens}}}function ZT(e){if(typeof e!=`string`){if(e.specificationVersion!==`v3`&&e.specificationVersion!==`v2`){let t=e;throw new Fpe({version:t.specificationVersion,provider:t.provider,modelId:t.modelId})}return Upe(e)}return Gpe().languageModel(e)}function Gpe(){return globalThis.AI_SDK_DEFAULT_PROVIDER??Vfe}function QT(e){if(e!=null)return typeof e==`number`?e:e.totalMs}function $T(e){if(!(e==null||typeof e==`number`))return e.stepMs}function Kpe(e){if(!(e==null||typeof e==`number`))return e.chunkMs}var qpe=[{mediaType:`image/gif`,bytesPrefix:[71,73,70]},{mediaType:`image/png`,bytesPrefix:[137,80,78,71]},{mediaType:`image/jpeg`,bytesPrefix:[255,216]},{mediaType:`image/webp`,bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:`image/bmp`,bytesPrefix:[66,77]},{mediaType:`image/tiff`,bytesPrefix:[73,73,42,0]},{mediaType:`image/tiff`,bytesPrefix:[77,77,0,42]},{mediaType:`image/avif`,bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:`image/heic`,bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}],Jpe=e=>{let t=typeof e==`string`?tC(e):e,n=(t[6]&127)<<21|(t[7]&127)<<14|(t[8]&127)<<7|t[9]&127;return t.slice(n+10)};function Ype(e){return typeof e==`string`&&e.startsWith(`SUQz`)||typeof e!=`string`&&e.length>10&&e[0]===73&&e[1]===68&&e[2]===51?Jpe(e):e}function Xpe({data:e,signatures:t}){let n=Ype(e),r=typeof n==`string`?tC(n.substring(0,Math.min(n.length,24))):n;for(let e of t)if(r.length>=e.bytesPrefix.length&&e.bytesPrefix.every((e,t)=>e===null||r[t]===e))return e.mediaType}var eE=`6.0.159`,Zpe=async({url:e,maxBytes:t,abortSignal:n})=>{let r=e.toString();jue(r);try{let e=await fetch(r,{headers:uC({},`ai-sdk/${eE}`,cC()),signal:n});if(e.redirected&&jue(e.url),!e.ok)throw new rC({url:r,statusCode:e.status,statusText:e.statusText});return{data:await Aue({response:e,url:r,maxBytes:t??kue}),mediaType:e.headers.get(`content-type`)??void 0}}catch(e){throw rC.isInstance(e)?e:new rC({url:r,cause:e})}},Qpe=(e=Zpe)=>t=>Promise.all(t.map(async t=>t.isUrlSupportedByModel?null:e(t)));function $pe(e){try{let[t,n]=e.split(`,`);return{mediaType:t.split(`;`)[0].split(`:`)[1],base64Content:n}}catch{return{mediaType:void 0,base64Content:void 0}}}var tE=l([r(),b(Uint8Array),b(ArrayBuffer),g(e=>globalThis.Buffer?.isBuffer(e)??!1,{message:`Must be a Buffer`})]);function nE(e){if(e instanceof Uint8Array)return{data:e,mediaType:void 0};if(e instanceof ArrayBuffer)return{data:new Uint8Array(e),mediaType:void 0};if(typeof e==`string`)try{e=new URL(e)}catch{}if(e instanceof URL&&e.protocol===`data:`){let{mediaType:t,base64Content:n}=$pe(e.toString());if(t==null||n==null)throw new Yx({name:`InvalidDataContentError`,message:`Invalid data URL format in content ${e.toString()}`});return{data:n,mediaType:t}}return{data:e,mediaType:void 0}}function eme(e){return typeof e==`string`?e:e instanceof ArrayBuffer?nC(new Uint8Array(e)):nC(e)}async function rE({prompt:e,supportedUrls:t,download:n=Qpe()}){let r=await nme(e.messages,n,t),i=new Map;for(let t of e.messages)if(t.role===`assistant`&&Array.isArray(t.content))for(let e of t.content)e.type===`tool-approval-request`&&`approvalId`in e&&`toolCallId`in e&&i.set(e.approvalId,e.toolCallId);let a=new Set;for(let t of e.messages)if(t.role===`tool`){for(let e of t.content)if(e.type===`tool-approval-response`){let t=i.get(e.approvalId);t&&a.add(t)}}let o=[...e.system==null?[]:typeof e.system==`string`?[{role:`system`,content:e.system}]:GT(e.system).map(e=>({role:`system`,content:e.content,providerOptions:e.providerOptions})),...e.messages.map(e=>tme({message:e,downloadedAssets:r}))],s=[];for(let e of o){if(e.role!==`tool`){s.push(e);continue}let t=s.at(-1);t?.role===`tool`?t.content.push(...e.content):s.push(e)}let c=new Set;for(let e of s)switch(e.role){case`assistant`:for(let t of e.content)t.type===`tool-call`&&!t.providerExecuted&&c.add(t.toolCallId);break;case`tool`:for(let t of e.content)t.type===`tool-result`&&c.delete(t.toolCallId);break;case`user`:case`system`:for(let e of a)c.delete(e);if(c.size>0)throw new vT({toolCallIds:Array.from(c)});break}for(let e of a)c.delete(e);if(c.size>0)throw new vT({toolCallIds:Array.from(c)});return s.filter(e=>e.role!==`tool`||e.content.length>0)}function tme({message:e,downloadedAssets:t}){let n=e.role;switch(n){case`system`:return{role:`system`,content:e.content,providerOptions:e.providerOptions};case`user`:return typeof e.content==`string`?{role:`user`,content:[{type:`text`,text:e.content}],providerOptions:e.providerOptions}:{role:`user`,content:e.content.map(e=>rme(e,t)).filter(e=>e.type!==`text`||e.text!==``),providerOptions:e.providerOptions};case`assistant`:return typeof e.content==`string`?{role:`assistant`,content:[{type:`text`,text:e.content}],providerOptions:e.providerOptions}:{role:`assistant`,content:e.content.filter(e=>e.type!==`text`||e.text!==``||e.providerOptions!=null).filter(e=>e.type!==`tool-approval-request`).map(e=>{let t=e.providerOptions;switch(e.type){case`file`:{let{data:n,mediaType:r}=nE(e.data);return{type:`file`,data:n,filename:e.filename,mediaType:r??e.mediaType,providerOptions:t}}case`reasoning`:return{type:`reasoning`,text:e.text,providerOptions:t};case`text`:return{type:`text`,text:e.text,providerOptions:t};case`tool-call`:return{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,providerExecuted:e.providerExecuted,providerOptions:t};case`tool-result`:return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:iE(e.output),providerOptions:t}}}),providerOptions:e.providerOptions};case`tool`:return{role:`tool`,content:e.content.filter(e=>e.type!==`tool-approval-response`||e.providerExecuted).map(e=>{switch(e.type){case`tool-result`:return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:iE(e.output),providerOptions:e.providerOptions};case`tool-approval-response`:return{type:`tool-approval-response`,approvalId:e.approvalId,approved:e.approved,reason:e.reason}}}),providerOptions:e.providerOptions};default:throw new Rpe({role:n})}}async function nme(e,t,n){let r=e.filter(e=>e.role===`user`).map(e=>e.content).filter(e=>Array.isArray(e)).flat().filter(e=>e.type===`image`||e.type===`file`).map(e=>{let t=e.mediaType??(e.type===`image`?`image/*`:void 0),n=e.type===`image`?e.image:e.data;if(typeof n==`string`)try{n=new URL(n)}catch{}return{mediaType:t,data:n}}).filter(e=>e.data instanceof URL).map(e=>({url:e.data,isUrlSupportedByModel:e.mediaType!=null&&Vue({url:e.data.toString(),mediaType:e.mediaType,supportedUrls:n})})),i=await t(r);return Object.fromEntries(i.map((e,t)=>e==null?null:[r[t].url.toString(),{data:e.data,mediaType:e.mediaType}]).filter(e=>e!=null))}function rme(e,t){if(e.type===`text`)return{type:`text`,text:e.text,providerOptions:e.providerOptions};let n,r=e.type;switch(r){case`image`:n=e.image;break;case`file`:n=e.data;break;default:throw Error(`Unsupported part type: ${r}`)}let{data:i,mediaType:a}=nE(n),o=a??e.mediaType,s=i;if(s instanceof URL){let e=t[s.toString()];e&&(s=e.data,o??=e.mediaType)}switch(r){case`image`:return(s instanceof Uint8Array||typeof s==`string`)&&(o=Xpe({data:s,signatures:qpe})??o),{type:`file`,mediaType:o??`image/*`,filename:void 0,data:s,providerOptions:e.providerOptions};case`file`:if(o==null)throw Error(`Media type is missing for file part`);return{type:`file`,mediaType:o,filename:e.filename,data:s,providerOptions:e.providerOptions}}}function iE(e){return e.type===`content`?{type:`content`,value:e.value.map(e=>e.type===`media`?e.mediaType.startsWith(`image/`)?{type:`image-data`,data:e.data,mediaType:e.mediaType}:{type:`file-data`,data:e.data,mediaType:e.mediaType}:e)}:e}async function aE({toolCallId:e,input:t,output:n,tool:r,errorMode:i}){return i===`text`?{type:`error-text`,value:Zx(n)}:i===`json`?{type:`error-json`,value:oE(n)}:r?.toModelOutput?await r.toModelOutput({toolCallId:e,input:t,output:n}):typeof n==`string`?{type:`text`,value:n}:{type:`json`,value:oE(n)}}function oE(e){return e===void 0?null:e}function sE({maxOutputTokens:e,temperature:t,topP:n,topK:r,presencePenalty:i,frequencyPenalty:a,seed:o,stopSequences:s}){if(e!=null){if(!Number.isInteger(e))throw new rT({parameter:`maxOutputTokens`,value:e,message:`maxOutputTokens must be an integer`});if(e<1)throw new rT({parameter:`maxOutputTokens`,value:e,message:`maxOutputTokens must be >= 1`})}if(t!=null&&typeof t!=`number`)throw new rT({parameter:`temperature`,value:t,message:`temperature must be a number`});if(n!=null&&typeof n!=`number`)throw new rT({parameter:`topP`,value:n,message:`topP must be a number`});if(r!=null&&typeof r!=`number`)throw new rT({parameter:`topK`,value:r,message:`topK must be a number`});if(i!=null&&typeof i!=`number`)throw new rT({parameter:`presencePenalty`,value:i,message:`presencePenalty must be a number`});if(a!=null&&typeof a!=`number`)throw new rT({parameter:`frequencyPenalty`,value:a,message:`frequencyPenalty must be a number`});if(o!=null&&!Number.isInteger(o))throw new rT({parameter:`seed`,value:o,message:`seed must be an integer`});return{maxOutputTokens:e,temperature:t,topP:n,topK:r,presencePenalty:i,frequencyPenalty:a,stopSequences:s,seed:o}}function ime(e){return e!=null&&Object.keys(e).length>0}async function cE({tools:e,toolChoice:t,activeTools:n}){if(!ime(e))return{tools:void 0,toolChoice:void 0};let r=n==null?Object.entries(e):Object.entries(e).filter(([e])=>n.includes(e)),i=[];for(let[e,t]of r){let n=t.type;switch(n){case void 0:case`dynamic`:case`function`:i.push({type:`function`,name:e,description:t.description,inputSchema:await OC(t.inputSchema).jsonSchema,...t.inputExamples==null?{}:{inputExamples:t.inputExamples},providerOptions:t.providerOptions,...t.strict==null?{}:{strict:t.strict}});break;case`provider`:i.push({type:`provider`,name:e,id:t.id,args:t.args});break;default:throw Error(`Unsupported tool type: ${n}`)}}return{tools:i,toolChoice:t==null?{type:`auto`}:typeof t==`string`?{type:t}:{type:`tool`,toolName:t.toolName}}}var lE=F(()=>l([x(),r(),P(),S(),d(r(),lE.optional()),C(lE)])),uE=d(r(),d(r(),lE.optional())),dE=h({type:m(`text`),text:r(),providerOptions:uE.optional()}),ame=h({type:m(`image`),image:l([tE,b(URL)]),mediaType:r().optional(),providerOptions:uE.optional()}),fE=h({type:m(`file`),data:l([tE,b(URL)]),filename:r().optional(),mediaType:r(),providerOptions:uE.optional()}),ome=h({type:m(`reasoning`),text:r(),providerOptions:uE.optional()}),sme=h({type:m(`tool-call`),toolCallId:r(),toolName:r(),input:u(),providerOptions:uE.optional(),providerExecuted:S().optional()}),cme=I(`type`,[h({type:m(`text`),value:r(),providerOptions:uE.optional()}),h({type:m(`json`),value:lE,providerOptions:uE.optional()}),h({type:m(`execution-denied`),reason:r().optional(),providerOptions:uE.optional()}),h({type:m(`error-text`),value:r(),providerOptions:uE.optional()}),h({type:m(`error-json`),value:lE,providerOptions:uE.optional()}),h({type:m(`content`),value:C(l([h({type:m(`text`),text:r(),providerOptions:uE.optional()}),h({type:m(`media`),data:r(),mediaType:r()}),h({type:m(`file-data`),data:r(),mediaType:r(),filename:r().optional(),providerOptions:uE.optional()}),h({type:m(`file-url`),url:r(),providerOptions:uE.optional()}),h({type:m(`file-id`),fileId:l([r(),d(r(),r())]),providerOptions:uE.optional()}),h({type:m(`image-data`),data:r(),mediaType:r(),providerOptions:uE.optional()}),h({type:m(`image-url`),url:r(),providerOptions:uE.optional()}),h({type:m(`image-file-id`),fileId:l([r(),d(r(),r())]),providerOptions:uE.optional()}),h({type:m(`custom`),providerOptions:uE.optional()})]))})]),pE=h({type:m(`tool-result`),toolCallId:r(),toolName:r(),output:cme,providerOptions:uE.optional()}),lme=h({type:m(`tool-approval-request`),approvalId:r(),toolCallId:r()}),ume=h({type:m(`tool-approval-response`),approvalId:r(),approved:S(),reason:r().optional()}),dme=l([h({role:m(`system`),content:r(),providerOptions:uE.optional()}),h({role:m(`user`),content:l([r(),C(l([dE,ame,fE]))]),providerOptions:uE.optional()}),h({role:m(`assistant`),content:l([r(),C(l([dE,fE,ome,sme,pE,lme]))]),providerOptions:uE.optional()}),h({role:m(`tool`),content:C(l([pE,ume])),providerOptions:uE.optional()})]);async function mE(e){if(e.prompt==null&&e.messages==null)throw new Qx({prompt:e,message:`prompt or messages must be defined`});if(e.prompt!=null&&e.messages!=null)throw new Qx({prompt:e,message:`prompt and messages cannot be defined at the same time`});if(e.system!=null&&typeof e.system!=`string`&&!GT(e.system).every(e=>typeof e==`object`&&!!e&&`role`in e&&e.role===`system`))throw new Qx({prompt:e,message:`system must be a string, SystemModelMessage, or array of SystemModelMessage`});let t;if(e.prompt!=null&&typeof e.prompt==`string`)t=[{role:`user`,content:e.prompt}];else if(e.prompt!=null&&Array.isArray(e.prompt))t=e.prompt;else if(e.messages!=null)t=e.messages;else throw new Qx({prompt:e,message:`prompt or messages must be defined`});if(t.length===0)throw new Qx({prompt:e,message:`messages must not be empty`});let n=await jC({value:t,schema:C(dme)});if(!n.success)throw new Qx({prompt:e,message:`The messages do not match the ModelMessage[] schema.`,cause:n.error});return{messages:t,system:e.system}}function hE(e){if(!YC.isInstance(e))return e;let t=(process==null?void 0:`production`)===`production`,n=`https://ai-sdk.dev/unauthenticated-ai-gateway`;return t?new Yx({name:`GatewayError`,message:`Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${n}`}):Object.assign(Error(`\x1B[1m\x1B[31mUnauthenticated request to AI Gateway.\x1B[0m + +To authenticate, set the \x1B[33mAI_GATEWAY_API_KEY\x1B[0m environment variable with your API key. + +Alternatively, you can use a provider module instead of the AI Gateway. + +Learn more: \x1B[34m${n}\x1B[0m + +`),{name:`GatewayAuthenticationError`})}function gE({operationId:e,telemetry:t}){return{"operation.name":`${e}${t?.functionId==null?``:` ${t.functionId}`}`,"resource.name":t?.functionId,"ai.operationId":e,"ai.telemetry.functionId":t?.functionId}}function _E({model:e,settings:t,telemetry:n,headers:r}){return{"ai.model.provider":e.provider,"ai.model.id":e.modelId,...Object.entries(t).reduce((e,[t,n])=>{if(t===`timeout`){let r=QT(n);r!=null&&(e[`ai.settings.${t}`]=r)}else e[`ai.settings.${t}`]=n;return e},{}),...Object.entries(n?.metadata??{}).reduce((e,[t,n])=>(e[`ai.telemetry.metadata.${t}`]=n,e),{}),...Object.entries(r??{}).reduce((e,[t,n])=>(n!==void 0&&(e[`ai.request.headers.${t}`]=n),e),{})}}var fme={startSpan(){return vE},startActiveSpan(e,t,n,r){if(typeof t==`function`)return t(vE);if(typeof n==`function`)return n(vE);if(typeof r==`function`)return r(vE)}},vE={spanContext(){return pme},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},addLink(){return this},addLinks(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this}},pme={traceId:``,spanId:``,traceFlags:0};function yE({isEnabled:e=!1,tracer:t}={}){return e?t||xpe.getTracer(`ai`):fme}async function bE({name:e,tracer:t,attributes:n,fn:r,endWhenDone:i=!0}){return t.startActiveSpan(e,{attributes:await n},async e=>{let t=Qw.active();try{let n=await Qw.with(t,()=>r(e));return i&&e.end(),n}catch(t){try{xE(e,t)}finally{e.end()}throw t}})}function xE(e,t){t instanceof Error?(e.recordException({name:t.name,message:t.message,stack:t.stack}),e.setStatus({code:Zw.ERROR,message:t.message})):e.setStatus({code:Zw.ERROR})}async function SE({telemetry:e,attributes:t}){if(e?.isEnabled!==!0)return{};let n={};for(let[r,i]of Object.entries(t))if(i!=null){if(typeof i==`object`&&`input`in i&&typeof i.input==`function`){if(e?.recordInputs===!1)continue;let t=await i.input();t!=null&&(n[r]=t);continue}if(typeof i==`object`&&`output`in i&&typeof i.output==`function`){if(e?.recordOutputs===!1)continue;let t=await i.output();t!=null&&(n[r]=t);continue}n[r]=i}return n}function CE(e){return JSON.stringify(e.map(e=>({...e,content:typeof e.content==`string`?e.content:e.content.map(e=>e.type===`file`?{...e,data:e.data instanceof Uint8Array?eme(e.data):e.data}:e)})))}function mme(){return globalThis.AI_SDK_TELEMETRY_INTEGRATIONS??[]}function wE(){let e=mme();return t=>{let n=GT(t),r=[...e,...n];function i(e){let t=r.map(e).filter(Boolean);return async e=>{for(let n of t)try{await n(e)}catch{}}}return{onStart:i(e=>e.onStart),onStepStart:i(e=>e.onStepStart),onToolCallStart:i(e=>e.onToolCallStart),onToolCallFinish:i(e=>e.onToolCallFinish),onStepFinish:i(e=>e.onStepFinish),onFinish:i(e=>e.onFinish)}}}function TE(e){return{inputTokens:e.inputTokens.total,inputTokenDetails:{noCacheTokens:e.inputTokens.noCache,cacheReadTokens:e.inputTokens.cacheRead,cacheWriteTokens:e.inputTokens.cacheWrite},outputTokens:e.outputTokens.total,outputTokenDetails:{textTokens:e.outputTokens.text,reasoningTokens:e.outputTokens.reasoning},totalTokens:OE(e.inputTokens.total,e.outputTokens.total),raw:e.raw,reasoningTokens:e.outputTokens.reasoning,cachedInputTokens:e.inputTokens.cacheRead}}function EE(){return{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}}function DE(e,t){return{inputTokens:OE(e.inputTokens,t.inputTokens),inputTokenDetails:{noCacheTokens:OE(e.inputTokenDetails?.noCacheTokens,t.inputTokenDetails?.noCacheTokens),cacheReadTokens:OE(e.inputTokenDetails?.cacheReadTokens,t.inputTokenDetails?.cacheReadTokens),cacheWriteTokens:OE(e.inputTokenDetails?.cacheWriteTokens,t.inputTokenDetails?.cacheWriteTokens)},outputTokens:OE(e.outputTokens,t.outputTokens),outputTokenDetails:{textTokens:OE(e.outputTokenDetails?.textTokens,t.outputTokenDetails?.textTokens),reasoningTokens:OE(e.outputTokenDetails?.reasoningTokens,t.outputTokenDetails?.reasoningTokens)},totalTokens:OE(e.totalTokens,t.totalTokens),reasoningTokens:OE(e.reasoningTokens,t.reasoningTokens),cachedInputTokens:OE(e.cachedInputTokens,t.cachedInputTokens)}}function OE(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function kE(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);o&&s?n[r]=kE(a,i):n[r]=i}return n}function hme({error:e,exponentialBackoffDelay:t}){let n=e.responseHeaders;if(!n)return t;let r,i=n[`retry-after-ms`];if(i){let e=parseFloat(i);Number.isNaN(e)||(r=e)}let a=n[`retry-after`];if(a&&r===void 0){let e=parseFloat(a);r=Number.isNaN(e)?Date.parse(a)-Date.now():e*1e3}return r!=null&&!Number.isNaN(r)&&0<=r&&(r<60*1e3||rasync i=>AE(i,{maxRetries:e,delayInMs:t,backoffFactor:n,abortSignal:r});async function AE(e,{maxRetries:t,delayInMs:n,backoffFactor:r,abortSignal:i},a=[]){try{return await e()}catch(o){if(sC(o)||t===0)throw o;let s=oC(o),c=[...a,o],l=c.length;if(l>t)throw new WT({message:`Failed after ${l} attempts. Last error: ${s}`,reason:`maxRetriesExceeded`,errors:c});if(o instanceof Error&&Xx.isInstance(o)&&o.isRetryable===!0&&l<=t)return await bue(hme({error:o,exponentialBackoffDelay:n}),{abortSignal:i}),AE(e,{maxRetries:t,delayInMs:r*n,backoffFactor:r,abortSignal:i},c);throw l===1?o:new WT({message:`Failed after ${l} attempts with non-retryable error: '${s}'`,reason:`errorNotRetryable`,errors:c})}}function jE({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new rT({parameter:`maxRetries`,value:e,message:`maxRetries must be an integer`});if(e<0)throw new rT({parameter:`maxRetries`,value:e,message:`maxRetries must be >= 0`})}let n=e??2;return{maxRetries:n,retry:gme({maxRetries:n,abortSignal:t})}}function ME({messages:e}){let t=e.at(-1);if(t?.role!=`tool`)return{approvedToolApprovals:[],deniedToolApprovals:[]};let n={};for(let t of e)if(t.role===`assistant`&&typeof t.content!=`string`){let e=t.content;for(let t of e)t.type===`tool-call`&&(n[t.toolCallId]=t)}let r={};for(let t of e)if(t.role===`assistant`&&typeof t.content!=`string`){let e=t.content;for(let t of e)t.type===`tool-approval-request`&&(r[t.approvalId]=t)}let i={};for(let e of t.content)e.type===`tool-result`&&(i[e.toolCallId]=e);let a=[],o=[],s=t.content.filter(e=>e.type===`tool-approval-response`);for(let e of s){let t=r[e.approvalId];if(t==null)throw new Epe({approvalId:e.approvalId});if(i[t.toolCallId]!=null)continue;let s=n[t.toolCallId];if(s==null)throw new mT({toolCallId:t.toolCallId,approvalId:t.approvalId});let c={approvalRequest:t,approvalResponse:e,toolCall:s};e.approved?a.push(c):o.push(c)}return{approvedToolApprovals:a,deniedToolApprovals:o}}function NE(){return(globalThis==null?void 0:globalThis.performance)?.now()??Date.now()}async function PE({toolCall:e,tools:t,tracer:n,telemetry:r,messages:i,abortSignal:a,experimental_context:o,stepNumber:s,model:c,onPreliminaryToolResult:l,onToolCallStart:u,onToolCallFinish:d}){let{toolName:f,toolCallId:p,input:m}=e,h=t?.[f];if(h?.execute==null)return;let g={stepNumber:s,model:c,toolCall:e,messages:i,abortSignal:a,functionId:r?.functionId,metadata:r?.metadata,experimental_context:o};return bE({name:`ai.toolCall`,attributes:SE({telemetry:r,attributes:{...gE({operationId:`ai.toolCall`,telemetry:r}),"ai.toolCall.name":f,"ai.toolCall.id":p,"ai.toolCall.args":{output:()=>JSON.stringify(m)}}}),tracer:n,fn:async t=>{let n;await KT({event:g,callbacks:u});let s=NE();try{let t=Jde({execute:h.execute.bind(h),input:m,options:{toolCallId:p,messages:i,abortSignal:a,experimental_context:o}});for await(let r of t)r.type===`preliminary`?l?.({...e,type:`tool-result`,output:r.output,preliminary:!0}):n=r.output}catch(n){let r=NE()-s;return await KT({event:{...g,success:!1,error:n,durationMs:r},callbacks:d}),xE(t,n),{type:`tool-error`,toolCallId:p,toolName:f,input:m,error:n,dynamic:h.type===`dynamic`,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}}let c=NE()-s;await KT({event:{...g,success:!0,output:n,durationMs:c},callbacks:d});try{t.setAttributes(await SE({telemetry:r,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(n)}}}))}catch{}return{type:`tool-result`,toolCallId:p,toolName:f,input:m,output:n,dynamic:h.type===`dynamic`,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}}})}function FE(e){let t=e.filter(e=>e.type===`reasoning`);return t.length===0?void 0:t.map(e=>e.text).join(` +`)}function IE(e){let t=e.filter(e=>e.type===`text`);if(t.length!==0)return t.map(e=>e.text).join(``)}var LE=class{constructor({data:e,mediaType:t}){let n=e instanceof Uint8Array;this.base64Data=n?void 0:e,this.uint8ArrayData=n?e:void 0,this.mediaType=t}get base64(){return this.base64Data??=nC(this.uint8ArrayData),this.base64Data}get uint8Array(){return this.uint8ArrayData??=tC(this.base64Data),this.uint8ArrayData}},_me=class extends LE{constructor(e){super(e),this.type=`file`}};async function RE({tool:e,toolCall:t,messages:n,experimental_context:r}){return e.needsApproval==null?!1:typeof e.needsApproval==`boolean`?e.needsApproval:await e.needsApproval(t.input,{toolCallId:t.toolCallId,messages:n,experimental_context:r})}Cpe({},{array:()=>bme,choice:()=>xme,json:()=>Sme,object:()=>yme,text:()=>BE});function vme(e){let t=[`ROOT`],n=-1,r=null;function i(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function a(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function o(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let s=0;s=0;n--)switch(t[n]){case`INSIDE_STRING`:s+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:s+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:s+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?s+=`true`.slice(t.length):`false`.startsWith(t)?s+=`false`.slice(t.length):`null`.startsWith(t)&&(s+=`null`.slice(t.length))}}return s}async function zE(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await MC({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await MC({text:vme(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}var BE=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),yme=({schema:e,name:t,description:n})=>{let r=OC(e);return{name:`object`,responseFormat:LC(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await MC({text:e});if(!n.success)throw new ST({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await jC({value:n.value,schema:r});if(!i.success)throw new ST({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await zE(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},bme=({element:e,name:t,description:n})=>{let r=OC(e);return{name:`array`,responseFormat:LC(r.jsonSchema).then(e=>{let{$schema:r,...i}=e;return{type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:i}},required:[`elements`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:e},t){let n=await MC({text:e});if(!n.success)throw new ST({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=n.value;if(typeof i!=`object`||!i||!(`elements`in i)||!Array.isArray(i.elements))throw new ST({message:`No object generated: response did not match schema.`,cause:new eS({value:i,cause:`response must be an object with an elements array`}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(let n of i.elements){let i=await jC({value:n,schema:r});if(!i.success)throw new ST({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return i.elements},async parsePartialOutput({text:e}){let t=await zE(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let e=t.value;if(typeof e!=`object`||!e||!(`elements`in e)||!Array.isArray(e.elements))return;let n=t.state===`repaired-parse`&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of n){let t=await jC({value:e,schema:r});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(t!=null)for(;e({name:`choice`,responseFormat:Promise.resolve({type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:t},n){let r=await MC({text:t});if(!r.success)throw new ST({message:`No object generated: could not parse the response.`,cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=r.value;if(typeof i!=`object`||!i||!(`result`in i)||typeof i.result!=`string`||!e.includes(i.result))throw new ST({message:`No object generated: response did not match schema.`,cause:new eS({value:i,cause:`response must be an object that contains a choice value.`}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.result},async parsePartialOutput({text:t}){let n=await zE(t);switch(n.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let t=n.value;if(typeof t!=`object`||!t||!(`result`in t)||typeof t.result!=`string`)return;let r=e.filter(e=>e.startsWith(t.result));return n.state===`successful-parse`?r.includes(t.result)?{partial:t.result}:void 0:r.length===1?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),Sme=({name:e,description:t}={})=>({name:`json`,responseFormat:Promise.resolve({type:`json`,...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:e},t){let n=await MC({text:e});if(!n.success)throw new ST({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await zE(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return t.value===void 0?void 0:{partial:t.value}}},createElementStreamTransform(){}});async function VE({toolCall:e,tools:t,repairToolCall:n,system:r,messages:i}){try{if(t==null){if(e.providerExecuted&&e.dynamic)return await HE(e);throw new AT({toolName:e.toolName})}try{return await UE({toolCall:e,tools:t})}catch(a){if(n==null||!(AT.isInstance(a)||uT.isInstance(a)))throw a;let o=null;try{o=await n({toolCall:e,tools:t,inputSchema:async({toolName:e})=>{let{inputSchema:n}=t[e];return await OC(n).jsonSchema},system:r,messages:i,error:a})}catch(e){throw new Ppe({cause:e,originalError:a})}if(o==null)throw a;return await UE({toolCall:o,tools:t})}}catch(n){let r=await MC({text:e.input}),i=r.success?r.value:e.input;return{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:i,dynamic:!0,invalid:!0,error:n,title:t?.[e.toolName]?.title,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}}}async function HE(e){let t=e.input.trim()===``?{success:!0,value:{}}:await MC({text:e.input});if(t.success===!1)throw new uT({toolName:e.toolName,toolInput:e.input,cause:t.error});return{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:t.value,providerExecuted:!0,dynamic:!0,providerMetadata:e.providerMetadata}}async function UE({toolCall:e,tools:t}){let n=e.toolName,r=t[n];if(r==null){if(e.providerExecuted&&e.dynamic)return await HE(e);throw new AT({toolName:e.toolName,availableTools:Object.keys(t)})}let i=OC(r.inputSchema),a=e.input.trim()===``?await jC({value:{},schema:i}):await MC({text:e.input,schema:i});if(a.success===!1)throw new uT({toolName:n,toolInput:e.input,cause:a.error});return r.type===`dynamic`?{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:a.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,dynamic:!0,title:r.title}:{type:`tool-call`,toolCallId:e.toolCallId,toolName:n,input:a.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:r.title}}var WE=class{constructor({stepNumber:e,model:t,functionId:n,metadata:r,experimental_context:i,content:a,finishReason:o,rawFinishReason:s,usage:c,warnings:l,request:u,response:d,providerMetadata:f}){this.stepNumber=e,this.model=t,this.functionId=n,this.metadata=r,this.experimental_context=i,this.content=a,this.finishReason=o,this.rawFinishReason=s,this.usage=c,this.warnings=l,this.request=u,this.response=d,this.providerMetadata=f}get text(){return this.content.filter(e=>e.type===`text`).map(e=>e.text).join(``)}get reasoning(){return this.content.filter(e=>e.type===`reasoning`)}get reasoningText(){return this.reasoning.length===0?void 0:this.reasoning.map(e=>e.text).join(``)}get files(){return this.content.filter(e=>e.type===`file`).map(e=>e.file)}get sources(){return this.content.filter(e=>e.type===`source`)}get toolCalls(){return this.content.filter(e=>e.type===`tool-call`)}get staticToolCalls(){return this.toolCalls.filter(e=>e.dynamic!==!0)}get dynamicToolCalls(){return this.toolCalls.filter(e=>e.dynamic===!0)}get toolResults(){return this.content.filter(e=>e.type===`tool-result`)}get staticToolResults(){return this.toolResults.filter(e=>e.dynamic!==!0)}get dynamicToolResults(){return this.toolResults.filter(e=>e.dynamic===!0)}};function GE(e){return({steps:t})=>t.length===e}async function KE({stopConditions:e,steps:t}){return(await Promise.all(e.map(e=>e({steps:t})))).some(e=>e)}async function qE({content:e,tools:t}){let n=[],r=[];for(let n of e)if(n.type!==`source`&&!((n.type===`tool-result`||n.type===`tool-error`)&&!n.providerExecuted)&&!(n.type===`text`&&n.text.length===0))switch(n.type){case`text`:r.push({type:`text`,text:n.text,providerOptions:n.providerMetadata});break;case`reasoning`:r.push({type:`reasoning`,text:n.text,providerOptions:n.providerMetadata});break;case`file`:r.push({type:`file`,data:n.file.base64,mediaType:n.file.mediaType,providerOptions:n.providerMetadata});break;case`tool-call`:r.push({type:`tool-call`,toolCallId:n.toolCallId,toolName:n.toolName,input:n.invalid&&typeof n.input!=`object`?{}:n.input,providerExecuted:n.providerExecuted,providerOptions:n.providerMetadata});break;case`tool-result`:{let e=await aE({toolCallId:n.toolCallId,input:n.input,tool:t?.[n.toolName],output:n.output,errorMode:`none`});r.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,output:e,providerOptions:n.providerMetadata});break}case`tool-error`:{let e=await aE({toolCallId:n.toolCallId,input:n.input,tool:t?.[n.toolName],output:n.error,errorMode:`json`});r.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,output:e,providerOptions:n.providerMetadata});break}case`tool-approval-request`:r.push({type:`tool-approval-request`,approvalId:n.approvalId,toolCallId:n.toolCall.toolCallId});break}r.length>0&&n.push({role:`assistant`,content:r});let i=[];for(let n of e){if(!(n.type===`tool-result`||n.type===`tool-error`)||n.providerExecuted)continue;let e=await aE({toolCallId:n.toolCallId,input:n.input,tool:t?.[n.toolName],output:n.type===`tool-result`?n.output:n.error,errorMode:n.type===`tool-error`?`text`:`none`});i.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,output:e,...n.providerMetadata==null?{}:{providerOptions:n.providerMetadata}})}return i.length>0&&n.push({role:`tool`,content:i}),n}function JE(...e){let t=e.filter(e=>e!=null);if(t.length===0)return;if(t.length===1)return t[0];let n=new AbortController;for(let e of t){if(e.aborted)return n.abort(e.reason),n.signal;e.addEventListener(`abort`,()=>{n.abort(e.reason)},{once:!0})}return n.signal}var Cme=aC({prefix:`aitxt`,size:24});async function YE({model:e,tools:t,toolChoice:n,system:r,prompt:i,messages:a,maxRetries:o,abortSignal:s,timeout:c,headers:l,stopWhen:u=GE(1),experimental_output:d,output:f=d,experimental_telemetry:p,providerOptions:m,experimental_activeTools:h,activeTools:g=h,experimental_prepareStep:_,prepareStep:v=_,experimental_repairToolCall:y,experimental_download:b,experimental_context:x,experimental_include:S,_internal:{generateId:C=Cme}={},experimental_onStart:w,experimental_onStepStart:T,experimental_onToolCallStart:E,experimental_onToolCallFinish:D,onStepFinish:O,onFinish:ee,...te}){let k=ZT(e),A=wE(),j=GT(u),M=QT(c),N=$T(c),P=N==null?void 0:new AbortController,F=JE(s,M==null?void 0:AbortSignal.timeout(M),P?.signal),{maxRetries:I,retry:ne}=jE({maxRetries:o,abortSignal:F}),re=sE(te),ie=uC(l??{},`ai/${eE}`),ae=_E({model:k,telemetry:p,headers:ie,settings:{...re,maxRetries:I}}),oe={provider:k.provider,modelId:k.modelId},se=await mE({system:r,prompt:i,messages:a}),ce=A(p?.integrations);await KT({event:{model:oe,system:r,prompt:i,messages:a,tools:t,toolChoice:n,activeTools:g,maxOutputTokens:re.maxOutputTokens,temperature:re.temperature,topP:re.topP,topK:re.topK,presencePenalty:re.presencePenalty,frequencyPenalty:re.frequencyPenalty,stopSequences:re.stopSequences,seed:re.seed,maxRetries:I,timeout:c,headers:l,providerOptions:m,stopWhen:u,output:f,abortSignal:s,include:S,functionId:p?.functionId,metadata:p?.metadata,experimental_context:x},callbacks:[w,ce.onStart]});let le=yE(p);try{return await bE({name:`ai.generateText`,attributes:SE({telemetry:p,attributes:{...gE({operationId:`ai.generateText`,telemetry:p}),...ae,"ai.model.provider":k.provider,"ai.model.id":k.modelId,"ai.prompt":{input:()=>JSON.stringify({system:r,prompt:i,messages:a})}}}),tracer:le,fn:async e=>{let i=se.messages,a=[],{approvedToolApprovals:o,deniedToolApprovals:d}=ME({messages:i}),h=o.filter(e=>!e.toolCall.providerExecuted);if(d.length>0||h.length>0){let e=await XE({toolCalls:h.map(e=>e.toolCall),tools:t,tracer:le,telemetry:p,messages:i,abortSignal:F,experimental_context:x,stepNumber:0,model:oe,onToolCallStart:[E,ce.onToolCallStart],onToolCallFinish:[D,ce.onToolCallFinish]}),n=[];for(let r of e){let e=await aE({toolCallId:r.toolCallId,input:r.input,tool:t?.[r.toolName],output:r.type===`tool-result`?r.output:r.error,errorMode:r.type===`tool-error`?`text`:`none`});n.push({type:`tool-result`,toolCallId:r.toolCallId,toolName:r.toolName,output:e})}for(let e of d)n.push({type:`tool-result`,toolCallId:e.toolCall.toolCallId,toolName:e.toolCall.toolName,output:{type:`execution-denied`,reason:e.approvalResponse.reason,...e.toolCall.providerExecuted&&{providerOptions:{openai:{approvalId:e.approvalResponse.approvalId}}}}});a.push({role:`tool`,content:n})}let _=sE(te),w,A=[],M=[],I=[],re=new Map;do{let e=N==null?void 0:setTimeout(()=>P.abort(),N);try{let e=[...i,...a],o=await v?.({model:k,steps:I,stepNumber:I.length,messages:e,experimental_context:x}),d=ZT(o?.model??k),h={provider:d.provider,modelId:d.modelId},ee=await rE({prompt:{system:o?.system??se.system,messages:o?.messages??e},supportedUrls:await d.supportedUrls,download:b});x=o?.experimental_context??x;let j=o?.activeTools??g,{toolChoice:N,tools:P}=await cE({tools:t,toolChoice:o?.toolChoice??n,activeTools:j}),oe=o?.messages??e,L=o?.system??se.system,ue=kE(m,o?.providerOptions);await KT({event:{stepNumber:I.length,model:h,system:L,messages:oe,tools:t,toolChoice:N,activeTools:j,steps:[...I],providerOptions:ue,timeout:c,headers:l,stopWhen:u,output:f,abortSignal:s,include:S,functionId:p?.functionId,metadata:p?.metadata,experimental_context:x},callbacks:[T,ce.onStepStart]}),w=await ne(()=>bE({name:`ai.generateText.doGenerate`,attributes:SE({telemetry:p,attributes:{...gE({operationId:`ai.generateText.doGenerate`,telemetry:p}),...ae,"ai.model.provider":d.provider,"ai.model.id":d.modelId,"ai.prompt.messages":{input:()=>CE(ee)},"ai.prompt.tools":{input:()=>P?.map(e=>JSON.stringify(e))},"ai.prompt.toolChoice":{input:()=>N==null?void 0:JSON.stringify(N)},"gen_ai.system":d.provider,"gen_ai.request.model":d.modelId,"gen_ai.request.frequency_penalty":te.frequencyPenalty,"gen_ai.request.max_tokens":te.maxOutputTokens,"gen_ai.request.presence_penalty":te.presencePenalty,"gen_ai.request.stop_sequences":te.stopSequences,"gen_ai.request.temperature":te.temperature??void 0,"gen_ai.request.top_k":te.topK,"gen_ai.request.top_p":te.topP}}),tracer:le,fn:async e=>{let t=await d.doGenerate({..._,tools:P,toolChoice:N,responseFormat:await f?.responseFormat,prompt:ee,providerOptions:ue,abortSignal:F,headers:ie}),n={id:t.response?.id??C(),timestamp:t.response?.timestamp??new Date,modelId:t.response?.modelId??d.modelId,headers:t.response?.headers,body:t.response?.body},r=TE(t.usage);return e.setAttributes(await SE({telemetry:p,attributes:{"ai.response.finishReason":t.finishReason.unified,"ai.response.text":{output:()=>IE(t.content)},"ai.response.reasoning":{output:()=>FE(t.content)},"ai.response.toolCalls":{output:()=>{let e=ZE(t.content);return e==null?void 0:JSON.stringify(e)}},"ai.response.id":n.id,"ai.response.model":n.modelId,"ai.response.timestamp":n.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(t.providerMetadata),"ai.usage.inputTokens":t.usage.inputTokens.total,"ai.usage.inputTokenDetails.noCacheTokens":t.usage.inputTokens.noCache,"ai.usage.inputTokenDetails.cacheReadTokens":t.usage.inputTokens.cacheRead,"ai.usage.inputTokenDetails.cacheWriteTokens":t.usage.inputTokens.cacheWrite,"ai.usage.outputTokens":t.usage.outputTokens.total,"ai.usage.outputTokenDetails.textTokens":t.usage.outputTokens.text,"ai.usage.outputTokenDetails.reasoningTokens":t.usage.outputTokens.reasoning,"ai.usage.totalTokens":r.totalTokens,"ai.usage.reasoningTokens":t.usage.outputTokens.reasoning,"ai.usage.cachedInputTokens":t.usage.inputTokens.cacheRead,"gen_ai.response.finish_reasons":[t.finishReason.unified],"gen_ai.response.id":n.id,"gen_ai.response.model":n.modelId,"gen_ai.usage.input_tokens":t.usage.inputTokens.total,"gen_ai.usage.output_tokens":t.usage.outputTokens.total}})),{...t,response:n}}}));let de=await Promise.all(w.content.filter(e=>e.type===`tool-call`).map(n=>VE({toolCall:n,tools:t,repairToolCall:y,system:r,messages:e}))),fe={};for(let n of de){if(n.invalid)continue;let r=t?.[n.toolName];r!=null&&(r?.onInputAvailable!=null&&await r.onInputAvailable({input:n.input,toolCallId:n.toolCallId,messages:e,abortSignal:F,experimental_context:x}),await RE({tool:r,toolCall:n,messages:e,experimental_context:x})&&(fe[n.toolCallId]={type:`tool-approval-request`,approvalId:C(),toolCall:n}))}let pe=de.filter(e=>e.invalid&&e.dynamic);M=[];for(let e of pe)M.push({type:`tool-error`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,error:oC(e.error),dynamic:!0});A=de.filter(e=>!e.providerExecuted),t!=null&&M.push(...await XE({toolCalls:A.filter(e=>!e.invalid&&fe[e.toolCallId]==null),tools:t,tracer:le,telemetry:p,messages:e,abortSignal:F,experimental_context:x,stepNumber:I.length,model:h,onToolCallStart:[E,ce.onToolCallStart],onToolCallFinish:[D,ce.onToolCallFinish]}));for(let e of de){if(!e.providerExecuted)continue;let n=t?.[e.toolName];n?.type===`provider`&&n.supportsDeferredResults&&(w.content.some(t=>t.type===`tool-result`&&t.toolCallId===e.toolCallId)||re.set(e.toolCallId,{toolName:e.toolName}))}for(let e of w.content)e.type===`tool-result`&&re.delete(e.toolCallId);let me=Tme({content:w.content,toolCalls:de,toolOutputs:M,toolApprovalRequests:Object.values(fe),tools:t});a.push(...await qE({content:me,tools:t}));let he=S?.requestBody??!0?w.request??{}:{...w.request,body:void 0},ge={...w.response,messages:structuredClone(a),body:S?.responseBody??!0?w.response?.body:void 0},_e=I.length,ve=new WE({stepNumber:_e,model:h,functionId:p?.functionId,metadata:p?.metadata,experimental_context:x,content:me,finishReason:w.finishReason.unified,rawFinishReason:w.finishReason.raw,usage:TE(w.usage),warnings:w.warnings,providerMetadata:w.providerMetadata,request:he,response:ge});JT({warnings:w.warnings??[],provider:h.provider,model:h.modelId}),I.push(ve),await KT({event:ve,callbacks:[O,ce.onStepFinish]})}finally{e!=null&&clearTimeout(e)}}while((A.length>0&&M.length===A.length||re.size>0)&&!await KE({stopConditions:j,steps:I}));e.setAttributes(await SE({telemetry:p,attributes:{"ai.response.finishReason":w.finishReason.unified,"ai.response.text":{output:()=>IE(w.content)},"ai.response.reasoning":{output:()=>FE(w.content)},"ai.response.toolCalls":{output:()=>{let e=ZE(w.content);return e==null?void 0:JSON.stringify(e)}},"ai.response.providerMetadata":JSON.stringify(w.providerMetadata)}}));let L=I[I.length-1],ue=I.reduce((e,t)=>DE(e,t.usage),{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0});e.setAttributes(await SE({telemetry:p,attributes:{"ai.usage.inputTokens":ue.inputTokens,"ai.usage.inputTokenDetails.noCacheTokens":ue.inputTokenDetails?.noCacheTokens,"ai.usage.inputTokenDetails.cacheReadTokens":ue.inputTokenDetails?.cacheReadTokens,"ai.usage.inputTokenDetails.cacheWriteTokens":ue.inputTokenDetails?.cacheWriteTokens,"ai.usage.outputTokens":ue.outputTokens,"ai.usage.outputTokenDetails.textTokens":ue.outputTokenDetails?.textTokens,"ai.usage.outputTokenDetails.reasoningTokens":ue.outputTokenDetails?.reasoningTokens,"ai.usage.totalTokens":ue.totalTokens,"ai.usage.reasoningTokens":ue.outputTokenDetails?.reasoningTokens,"ai.usage.cachedInputTokens":ue.inputTokenDetails?.cacheReadTokens}})),await KT({event:{stepNumber:L.stepNumber,model:L.model,functionId:L.functionId,metadata:L.metadata,experimental_context:L.experimental_context,finishReason:L.finishReason,rawFinishReason:L.rawFinishReason,usage:L.usage,content:L.content,text:L.text,reasoningText:L.reasoningText,reasoning:L.reasoning,files:L.files,sources:L.sources,toolCalls:L.toolCalls,staticToolCalls:L.staticToolCalls,dynamicToolCalls:L.dynamicToolCalls,toolResults:L.toolResults,staticToolResults:L.staticToolResults,dynamicToolResults:L.dynamicToolResults,request:L.request,response:L.response,warnings:L.warnings,providerMetadata:L.providerMetadata,steps:I,totalUsage:ue},callbacks:[ee,ce.onFinish]});let de;return L.finishReason===`stop`&&(de=await(f??BE()).parseCompleteOutput({text:L.text},{response:L.response,usage:L.usage,finishReason:L.finishReason})),new wme({steps:I,totalUsage:ue,output:de})}})}catch(e){throw hE(e)}}async function XE({toolCalls:e,tools:t,tracer:n,telemetry:r,messages:i,abortSignal:a,experimental_context:o,stepNumber:s,model:c,onToolCallStart:l,onToolCallFinish:u}){return(await Promise.all(e.map(async e=>PE({toolCall:e,tools:t,tracer:n,telemetry:r,messages:i,abortSignal:a,experimental_context:o,stepNumber:s,model:c,onToolCallStart:l,onToolCallFinish:u})))).filter(e=>e!=null)}var wme=class{constructor(e){this.steps=e.steps,this._output=e.output,this.totalUsage=e.totalUsage}get finalStep(){return this.steps[this.steps.length-1]}get content(){return this.finalStep.content}get text(){return this.finalStep.text}get files(){return this.finalStep.files}get reasoningText(){return this.finalStep.reasoningText}get reasoning(){return this.finalStep.reasoning}get toolCalls(){return this.finalStep.toolCalls}get staticToolCalls(){return this.finalStep.staticToolCalls}get dynamicToolCalls(){return this.finalStep.dynamicToolCalls}get toolResults(){return this.finalStep.toolResults}get staticToolResults(){return this.finalStep.staticToolResults}get dynamicToolResults(){return this.finalStep.dynamicToolResults}get sources(){return this.finalStep.sources}get finishReason(){return this.finalStep.finishReason}get rawFinishReason(){return this.finalStep.rawFinishReason}get warnings(){return this.finalStep.warnings}get providerMetadata(){return this.finalStep.providerMetadata}get response(){return this.finalStep.response}get request(){return this.finalStep.request}get usage(){return this.finalStep.usage}get experimental_output(){return this.output}get output(){if(this._output==null)throw new ET;return this._output}};function ZE(e){let t=e.filter(e=>e.type===`tool-call`);if(t.length!==0)return t.map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,input:e.input}))}function Tme({content:e,toolCalls:t,toolOutputs:n,toolApprovalRequests:r,tools:i}){let a=[];for(let n of e)switch(n.type){case`text`:case`reasoning`:case`source`:a.push(n);break;case`file`:a.push({type:`file`,file:new LE(n),...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}});break;case`tool-call`:a.push(t.find(e=>e.toolCallId===n.toolCallId));break;case`tool-result`:{let e=t.find(e=>e.toolCallId===n.toolCallId);if(e==null){let e=i?.[n.toolName];if(!(e?.type===`provider`&&e.supportsDeferredResults))throw Error(`Tool call ${n.toolCallId} not found.`);n.isError?a.push({type:`tool-error`,toolCallId:n.toolCallId,toolName:n.toolName,input:void 0,error:n.result,providerExecuted:!0,dynamic:n.dynamic,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}}):a.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,input:void 0,output:n.result,providerExecuted:!0,dynamic:n.dynamic,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}});break}n.isError?a.push({type:`tool-error`,toolCallId:n.toolCallId,toolName:n.toolName,input:e.input,error:n.result,providerExecuted:!0,dynamic:e.dynamic,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}}):a.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,input:e.input,output:n.result,providerExecuted:!0,dynamic:e.dynamic,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}});break}case`tool-approval-request`:{let e=t.find(e=>e.toolCallId===n.toolCallId);if(e==null)throw new mT({toolCallId:n.toolCallId,approvalId:n.approvalId});a.push({type:`tool-approval-request`,approvalId:n.approvalId,toolCall:e});break}}return[...a,...n,...r]}function QE(e,t){let n=new Headers(e??{});for(let[e,r]of Object.entries(t))n.has(e)||n.set(e,r);return n}function Eme({status:e,statusText:t,headers:n,textStream:r}){return new Response(r.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:QE(n,{"content-type":`text/plain; charset=utf-8`})})}function $E({response:e,status:t,statusText:n,headers:r,stream:i}){let a=t??200;n===void 0?e.writeHead(a,r):e.writeHead(a,n,r);let o=i.getReader();(async()=>{try{for(;;){let{done:t,value:n}=await o.read();if(t)break;e.write(n)||await new Promise(t=>{e.once(`drain`,t)})}}catch(e){throw e}finally{e.end()}})()}function Dme({response:e,status:t,statusText:n,headers:r,textStream:i}){$E({response:e,status:t,statusText:n,headers:Object.fromEntries(QE(r,{"content-type":`text/plain; charset=utf-8`}).entries()),stream:i.pipeThrough(new TextEncoderStream)})}var eD=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)} + +`)},flush(e){e.enqueue(`data: [DONE] + +`)}})}},tD={"content-type":`text/event-stream`,"cache-control":`no-cache`,connection:`keep-alive`,"x-vercel-ai-ui-message-stream":`v1`,"x-accel-buffering":`no`};function Ome({status:e,statusText:t,headers:n,stream:r,consumeSseStream:i}){let a=r.pipeThrough(new eD);if(i){let[e,t]=a.tee();a=e,i({stream:t})}return new Response(a.pipeThrough(new TextEncoderStream),{status:e,statusText:t,headers:QE(n,tD)})}function kme({originalMessages:e,responseMessageId:t}){if(e==null)return;let n=e[e.length-1];return n?.role===`assistant`?n.id:typeof t==`function`?t():t}var Ame=EC(()=>kC(l([T({type:m(`text-start`),id:r(),providerMetadata:uE.optional()}),T({type:m(`text-delta`),id:r(),delta:r(),providerMetadata:uE.optional()}),T({type:m(`text-end`),id:r(),providerMetadata:uE.optional()}),T({type:m(`error`),errorText:r()}),T({type:m(`tool-input-start`),toolCallId:r(),toolName:r(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional(),title:r().optional()}),T({type:m(`tool-input-delta`),toolCallId:r(),inputTextDelta:r()}),T({type:m(`tool-input-available`),toolCallId:r(),toolName:r(),input:u(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional(),title:r().optional()}),T({type:m(`tool-input-error`),toolCallId:r(),toolName:r(),input:u(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional(),errorText:r(),title:r().optional()}),T({type:m(`tool-approval-request`),approvalId:r(),toolCallId:r()}),T({type:m(`tool-output-available`),toolCallId:r(),output:u(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional(),preliminary:S().optional()}),T({type:m(`tool-output-error`),toolCallId:r(),errorText:r(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional()}),T({type:m(`tool-output-denied`),toolCallId:r()}),T({type:m(`reasoning-start`),id:r(),providerMetadata:uE.optional()}),T({type:m(`reasoning-delta`),id:r(),delta:r(),providerMetadata:uE.optional()}),T({type:m(`reasoning-end`),id:r(),providerMetadata:uE.optional()}),T({type:m(`source-url`),sourceId:r(),url:r(),title:r().optional(),providerMetadata:uE.optional()}),T({type:m(`source-document`),sourceId:r(),mediaType:r(),title:r(),filename:r().optional(),providerMetadata:uE.optional()}),T({type:m(`file`),url:r(),mediaType:r(),providerMetadata:uE.optional()}),T({type:g(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:r().optional(),data:u(),transient:S().optional()}),T({type:m(`start-step`)}),T({type:m(`finish-step`)}),T({type:m(`start`),messageId:r().optional(),messageMetadata:u().optional()}),T({type:m(`finish`),finishReason:E([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`other`]).optional(),messageMetadata:u().optional()}),T({type:m(`abort`),reason:r().optional()}),T({type:m(`message-metadata`),messageMetadata:u()})])));function jme(e){return e.type.startsWith(`data-`)}function nD(e){return e.type.startsWith(`tool-`)}function Mme(e){return e.type===`dynamic-tool`}function rD(e){return nD(e)||Mme(e)}function iD(e){return e.type.split(`-`).slice(1).join(`-`)}function aD({lastMessage:e,messageId:t}){return{message:e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function oD({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await r(async({state:r,write:c})=>{function l(e){let t=r.message.parts.filter(rD).find(t=>t.toolCallId===e);if(t==null)throw new LT({chunkType:`tool-invocation`,chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function u(e){let t=r.message.parts.find(t=>nD(t)&&t.toolCallId===e.toolCallId),n=e,i=t;if(t!=null){t.state=e.state,i.input=n.input,i.output=n.output,i.errorText=n.errorText,i.rawInput=n.rawInput,i.preliminary=n.preliminary,e.title!==void 0&&(i.title=e.title),i.providerExecuted=n.providerExecuted??t.providerExecuted;let r=n.providerMetadata;if(r!=null)if(e.state===`output-available`||e.state===`output-error`){let e=t;e.resultProviderMetadata=r}else t.callProviderMetadata=r}else r.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,input:n.input,output:n.output,rawInput:n.rawInput,errorText:n.errorText,providerExecuted:n.providerExecuted,preliminary:n.preliminary,...n.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:n.providerMetadata}:{},...n.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:n.providerMetadata}:{}})}function d(e){let t=r.message.parts.find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),n=e,i=t;if(t!=null){t.state=e.state,i.toolName=e.toolName,i.input=n.input,i.output=n.output,i.errorText=n.errorText,i.rawInput=n.rawInput??i.rawInput,i.preliminary=n.preliminary,e.title!==void 0&&(i.title=e.title),i.providerExecuted=n.providerExecuted??t.providerExecuted;let r=n.providerMetadata;if(r!=null)if(e.state===`output-available`||e.state===`output-error`){let e=t;e.resultProviderMetadata=r}else t.callProviderMetadata=r}else r.message.parts.push({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:n.input,output:n.output,errorText:n.errorText,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:e.title,...n.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:n.providerMetadata}:{},...n.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:n.providerMetadata}:{}})}async function f(e){if(e!=null){let n=r.message.metadata==null?e:kE(r.message.metadata,e);t!=null&&await AC({value:n,schema:t,context:{field:`message.metadata`,entityId:r.message.id}}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),c();break}case`text-delta`:{let t=r.activeTextParts[e.id];if(t==null)throw new LT({chunkType:`text-delta`,chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,c();break}case`text-end`:{let t=r.activeTextParts[e.id];if(t==null)throw new LT({chunkType:`text-end`,chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state=`done`,t.providerMetadata=e.providerMetadata??t.providerMetadata,delete r.activeTextParts[e.id],c();break}case`reasoning-start`:{let t={type:`reasoning`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),c();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new LT({chunkType:`reasoning-delta`,chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,c();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new LT({chunkType:`reasoning-end`,chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=e.providerMetadata??t.providerMetadata,t.state=`done`,delete r.activeReasoningParts[e.id],c();break}case`file`:r.message.parts.push({type:`file`,mediaType:e.mediaType,url:e.url,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}),c();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),c();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),c();break;case`tool-input-start`:{let t=r.message.parts.filter(nD);r.partialToolCalls[e.toolCallId]={text:``,toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title},e.dynamic?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}),c();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];if(t==null)throw new LT({chunkType:`tool-input-delta`,chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let{value:n}=await zE(t.text);t.dynamic?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n,title:t.title}):u({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n,title:t.title}),c();break}case`tool-input-available`:e.dynamic?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}),c(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:{let t=r.message.parts.filter(rD).find(t=>t.toolCallId===e.toolCallId);(t==null?e.dynamic:t.type===`dynamic-tool`)?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c();break}case`tool-approval-request`:{let t=l(e.toolCallId);t.state=`approval-requested`,t.approval={id:e.approvalId},c();break}case`tool-output-denied`:{let t=l(e.toolCallId);t.state=`output-denied`,c();break}case`tool-output-available`:{let t=l(e.toolCallId);t.type===`dynamic-tool`?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}):u({toolCallId:e.toolCallId,toolName:iD(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title}),c();break}case`tool-output-error`:{let t=l(e.toolCallId);t.type===`dynamic-tool`?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}):u({toolCallId:e.toolCallId,toolName:iD(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}),c();break}case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:r.activeTextParts={},r.activeReasoningParts={};break;case`start`:e.messageId!=null&&(r.message.id=e.messageId),await f(e.messageMetadata),(e.messageId!=null||e.messageMetadata!=null)&&c();break;case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await f(e.messageMetadata),e.messageMetadata!=null&&c();break;case`message-metadata`:await f(e.messageMetadata),e.messageMetadata!=null&&c();break;case`error`:i?.(Error(e.errorText));break;default:if(jme(e)){if(n?.[e.type]!=null){let t=r.message.parts.findIndex(t=>`id`in t&&`data`in t&&t.id===e.id&&t.type===e.type),i=t>=0?t:r.message.parts.length;await AC({value:e.data,schema:n[e.type],context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}let t=e;if(t.transient){o?.(t);break}let i=t.id==null?void 0:r.message.parts.find(e=>t.type===e.type&&t.id===e.id);i==null?r.message.parts.push(t):i.data=t.data,o?.(t),c()}}s.enqueue(e)})}}))}function Nme({messageId:e,originalMessages:t=[],onStepFinish:n,onFinish:r,onError:i,stream:a}){let o=t?.[t.length-1];o?.role===`assistant`?e=o.id:o=void 0;let s=!1,c=a.pipeThrough(new TransformStream({transform(t,n){if(t.type===`start`){let n=t;n.messageId==null&&e!=null&&(n.messageId=e)}t.type===`abort`&&(s=!0),n.enqueue(t)}}));if(r==null&&n==null)return c;let l=aD({lastMessage:o?structuredClone(o):void 0,messageId:e??``}),u=async e=>{await e({state:l,write:()=>{}})},d=!1,f=async()=>{if(d||!r)return;d=!0;let e=l.message.id===o?.id;await r({isAborted:s,isContinuation:e,responseMessage:l.message,messages:[...e?t.slice(0,-1):t,l.message],finishReason:l.finishReason})},p=async()=>{if(!n)return;let e=l.message.id===o?.id;try{await n({isContinuation:e,responseMessage:structuredClone(l.message),messages:[...e?t.slice(0,-1):t,structuredClone(l.message)]})}catch(e){i(e)}};return oD({stream:c,runUpdateMessageJob:u,onError:i}).pipeThrough(new TransformStream({async transform(e,t){e.type===`finish-step`&&await p(),t.enqueue(e)},async cancel(){await f()},async flush(){await f()}}))}function Pme({response:e,status:t,statusText:n,headers:r,stream:i,consumeSseStream:a}){let o=i.pipeThrough(new eD);if(a){let[e,t]=o.tee();o=e,a({stream:t})}$E({response:e,status:t,statusText:n,headers:Object.fromEntries(QE(r,tD).entries()),stream:o.pipeThrough(new TextEncoderStream)})}function sD(e){let t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){let e=this.getReader(),t=!1;async function n(n){if(!t){t=!0;try{n&&await e.cancel?.call(e)}finally{try{e.releaseLock()}catch{}}}}return{async next(){if(t)return{done:!0,value:void 0};let{done:r,value:i}=await e.read();return r?(await n(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(e){throw await n(!0),e}}},t}async function cD({stream:e,onError:t}){let n=e.getReader();try{for(;;){let{done:e}=await n.read();if(e)break}}catch(e){t?.(e)}finally{n.releaseLock()}}function lD(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Fme(){let e=[],t=null,n=!1,r=lD(),i=()=>{n=!0,r.resolve(),e.forEach(e=>e.cancel()),e=[],t?.close()},a=async()=>{if(n&&e.length===0){t?.close();return}if(e.length===0)return r=lD(),await r.promise,a();try{let{value:r,done:i}=await e[0].read();i?(e.shift(),e.length===0&&n?t?.close():await a()):t?.enqueue(r)}catch(n){t?.error(n),e.shift(),i()}};return{stream:new ReadableStream({start(e){t=e},pull:a,async cancel(){for(let t of e)await t.cancel();e=[],n=!0}}),addStream:t=>{if(n)throw Error(`Cannot add inner stream: outer stream is closed`);e.push(t.getReader()),r.resolve()},close:()=>{n=!0,r.resolve(),e.length===0&&t?.close()},terminate:i}}function Ime({tools:e,generatorStream:t,tracer:n,telemetry:r,system:i,messages:a,abortSignal:o,repairToolCall:s,experimental_context:c,generateId:l,stepNumber:u,model:d,onToolCallStart:f,onToolCallFinish:p}){let m=null,h=new ReadableStream({start(e){m=e}}),g=new Set,_=new Map,v=new Map,y=!1,b;function x(){y&&g.size===0&&(b!=null&&m.enqueue(b),m.close())}let S=new TransformStream({async transform(t,h){let y=t.type;switch(y){case`stream-start`:case`text-start`:case`text-delta`:case`text-end`:case`reasoning-start`:case`reasoning-delta`:case`reasoning-end`:case`tool-input-start`:case`tool-input-delta`:case`tool-input-end`:case`source`:case`response-metadata`:case`error`:case`raw`:h.enqueue(t);break;case`file`:h.enqueue({type:`file`,file:new _me({data:t.data,mediaType:t.mediaType}),...t.providerMetadata==null?{}:{providerMetadata:t.providerMetadata}});break;case`finish`:b={type:`finish`,finishReason:t.finishReason.unified,rawFinishReason:t.finishReason.raw,usage:TE(t.usage),providerMetadata:t.providerMetadata};break;case`tool-approval-request`:{let e=v.get(t.toolCallId);if(e==null){m.enqueue({type:`error`,error:new mT({toolCallId:t.toolCallId,approvalId:t.approvalId})});break}h.enqueue({type:`tool-approval-request`,approvalId:t.approvalId,toolCall:e});break}case`tool-call`:try{let y=await VE({toolCall:t,tools:e,repairToolCall:s,system:i,messages:a});if(v.set(y.toolCallId,y),h.enqueue(y),y.invalid){m.enqueue({type:`tool-error`,toolCallId:y.toolCallId,toolName:y.toolName,input:y.input,error:oC(y.error),dynamic:!0,title:y.title});break}let b=e?.[y.toolName];if(b==null)break;if(b.onInputAvailable!=null&&await b.onInputAvailable({input:y.input,toolCallId:y.toolCallId,messages:a,abortSignal:o,experimental_context:c}),await RE({tool:b,toolCall:y,messages:a,experimental_context:c})){m.enqueue({type:`tool-approval-request`,approvalId:l(),toolCall:y});break}if(_.set(y.toolCallId,y.input),b.execute!=null&&y.providerExecuted!==!0){let t=l();g.add(t),PE({toolCall:y,tools:e,tracer:n,telemetry:r,messages:a,abortSignal:o,experimental_context:c,stepNumber:u,model:d,onToolCallStart:f,onToolCallFinish:p,onPreliminaryToolResult:e=>{m.enqueue(e)}}).then(e=>{m.enqueue(e)}).catch(e=>{m.enqueue({type:`error`,error:e})}).finally(()=>{g.delete(t),x()})}}catch(e){m.enqueue({type:`error`,error:e})}break;case`tool-result`:{let e=t.toolName;t.isError?m.enqueue({type:`tool-error`,toolCallId:t.toolCallId,toolName:e,input:_.get(t.toolCallId),providerExecuted:!0,error:t.result,dynamic:t.dynamic,...t.providerMetadata==null?{}:{providerMetadata:t.providerMetadata}}):h.enqueue({type:`tool-result`,toolCallId:t.toolCallId,toolName:e,input:_.get(t.toolCallId),output:t.result,providerExecuted:!0,dynamic:t.dynamic,...t.providerMetadata==null?{}:{providerMetadata:t.providerMetadata}});break}default:throw Error(`Unhandled chunk type: ${y}`)}},flush(){y=!0,x()}});return new ReadableStream({async start(e){return Promise.all([t.pipeThrough(S).pipeTo(new WritableStream({write(t){e.enqueue(t)},close(){}})),h.pipeTo(new WritableStream({write(t){e.enqueue(t)},close(){e.close()}}))])}})}var Lme=aC({prefix:`aitxt`,size:24});function Rme({model:e,tools:t,toolChoice:n,system:r,prompt:i,messages:a,maxRetries:o,abortSignal:s,timeout:c,headers:l,stopWhen:u=GE(1),experimental_output:d,output:f=d,experimental_telemetry:p,prepareStep:m,providerOptions:h,experimental_activeTools:g,activeTools:_=g,experimental_repairToolCall:v,experimental_transform:y,experimental_download:b,includeRawChunks:x=!1,onChunk:S,onError:C=({error:e})=>{console.error(e)},onFinish:w,onAbort:T,onStepFinish:E,experimental_onStart:D,experimental_onStepStart:O,experimental_onToolCallStart:ee,experimental_onToolCallFinish:te,experimental_context:k,experimental_include:A,_internal:{now:j=NE,generateId:M=Lme}={},...N}){let P=QT(c),F=$T(c),I=Kpe(c),ne=F==null?void 0:new AbortController,re=I==null?void 0:new AbortController;return new Bme({model:ZT(e),telemetry:p,headers:l,settings:N,maxRetries:o,abortSignal:JE(s,P==null?void 0:AbortSignal.timeout(P),ne?.signal,re?.signal),stepTimeoutMs:F,stepAbortController:ne,chunkTimeoutMs:I,chunkAbortController:re,system:r,prompt:i,messages:a,tools:t,toolChoice:n,transforms:GT(y),activeTools:_,repairToolCall:v,stopConditions:GT(u),output:f,providerOptions:h,prepareStep:m,includeRawChunks:x,timeout:c,stopWhen:u,originalAbortSignal:s,onChunk:S,onError:C,onFinish:w,onAbort:T,onStepFinish:E,onStart:D,onStepStart:O,onToolCallStart:ee,onToolCallFinish:te,now:j,generateId:M,experimental_context:k,download:b,include:A})}function zme(e){let t,n=``,r=``,i,a=``;function o({controller:e,partialOutput:n=void 0}){e.enqueue({part:{type:`text-delta`,id:t,text:r,providerMetadata:i},partialOutput:n}),r=``}return new TransformStream({async transform(s,c){if(s.type===`finish-step`&&r.length>0&&o({controller:c}),s.type!==`text-delta`&&s.type!==`text-start`&&s.type!==`text-end`){c.enqueue({part:s,partialOutput:void 0});return}if(t==null)t=s.id;else if(s.id!==t){c.enqueue({part:s,partialOutput:void 0});return}if(s.type===`text-start`){c.enqueue({part:s,partialOutput:void 0});return}if(s.type===`text-end`){r.length>0&&o({controller:c}),c.enqueue({part:s,partialOutput:void 0});return}n+=s.text,r+=s.text,i=s.providerMetadata??i;let l=await e.parsePartialOutput({text:n});if(l!==void 0){let e=typeof l.partial==`string`?l.partial:JSON.stringify(l.partial);e!==a&&(o({controller:c,partialOutput:l.partial}),a=e)}}})}var Bme=class{constructor({model:e,telemetry:t,headers:n,settings:r,maxRetries:i,abortSignal:a,stepTimeoutMs:o,stepAbortController:s,chunkTimeoutMs:c,chunkAbortController:l,system:u,prompt:d,messages:f,tools:p,toolChoice:m,transforms:h,activeTools:g,repairToolCall:_,stopConditions:v,output:y,providerOptions:b,prepareStep:x,includeRawChunks:S,now:C,generateId:w,timeout:T,stopWhen:E,originalAbortSignal:D,onChunk:O,onError:ee,onFinish:te,onAbort:k,onStepFinish:A,onStart:j,onStepStart:M,onToolCallStart:N,onToolCallFinish:P,experimental_context:F,download:I,include:ne}){this._totalUsage=new $S,this._finishReason=new $S,this._rawFinishReason=new $S,this._steps=new $S,this.outputSpecification=y,this.includeRawChunks=S,this.tools=p;let re=wE()(t?.integrations),ie,ae=[],oe=[],se,ce,le,L={},ue=[],de=[],fe=new Map,pe,me={},he={},ge=new TransformStream({async transform(e,t){t.enqueue(e);let{part:n}=e;if((n.type===`text-delta`||n.type===`reasoning-delta`||n.type===`source`||n.type===`tool-call`||n.type===`tool-result`||n.type===`tool-input-start`||n.type===`tool-input-delta`||n.type===`raw`)&&await O?.({chunk:n}),n.type===`error`&&await ee({error:hE(n.error)}),n.type===`text-start`&&(me[n.id]={type:`text`,text:``,providerMetadata:n.providerMetadata},ae.push(me[n.id])),n.type===`text-delta`){let e=me[n.id];if(e==null){t.enqueue({part:{type:`error`,error:`text part ${n.id} not found`},partialOutput:void 0});return}e.text+=n.text,e.providerMetadata=n.providerMetadata??e.providerMetadata}if(n.type===`text-end`){let e=me[n.id];if(e==null){t.enqueue({part:{type:`error`,error:`text part ${n.id} not found`},partialOutput:void 0});return}e.providerMetadata=n.providerMetadata??e.providerMetadata,delete me[n.id]}if(n.type===`reasoning-start`&&(he[n.id]={type:`reasoning`,text:``,providerMetadata:n.providerMetadata},ae.push(he[n.id])),n.type===`reasoning-delta`){let e=he[n.id];if(e==null){t.enqueue({part:{type:`error`,error:`reasoning part ${n.id} not found`},partialOutput:void 0});return}e.text+=n.text,e.providerMetadata=n.providerMetadata??e.providerMetadata}if(n.type===`reasoning-end`){let e=he[n.id];if(e==null){t.enqueue({part:{type:`error`,error:`reasoning part ${n.id} not found`},partialOutput:void 0});return}e.providerMetadata=n.providerMetadata??e.providerMetadata,delete he[n.id]}if(n.type===`file`&&ae.push({type:`file`,file:n.file,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}}),n.type===`source`&&ae.push(n),n.type===`tool-call`&&ae.push(n),n.type===`tool-result`&&!n.preliminary&&ae.push(n),n.type===`tool-approval-request`&&ae.push(n),n.type===`tool-error`&&ae.push(n),n.type===`start-step`&&(ae=[],he={},me={},L=n.request,ue=n.warnings),n.type===`finish-step`){let e=await qE({content:ae,tools:p}),t=new WE({stepNumber:de.length,model:Ee,...De,experimental_context:F,content:ae,finishReason:n.finishReason,rawFinishReason:n.rawFinishReason,usage:n.usage,warnings:ue,request:L,response:{...n.response,messages:[...oe,...e]},providerMetadata:n.providerMetadata});await KT({event:t,callbacks:[A,re.onStepFinish]}),JT({warnings:ue,provider:Ee.provider,model:Ee.modelId}),de.push(t),oe.push(...e),ie.resolve()}n.type===`finish`&&(le=n.totalUsage,se=n.finishReason,ce=n.rawFinishReason)},async flush(e){try{if(de.length===0){let e=a?.aborted?a.reason:new ET({message:`No output generated. Check the stream for errors.`});Te._finishReason.reject(e),Te._rawFinishReason.reject(e),Te._totalUsage.reject(e),Te._steps.reject(e);return}let e=se??`other`,n=le??EE();Te._finishReason.resolve(e),Te._rawFinishReason.resolve(ce),Te._totalUsage.resolve(n),Te._steps.resolve(de);let r=de[de.length-1];await KT({event:{stepNumber:r.stepNumber,model:r.model,functionId:r.functionId,metadata:r.metadata,experimental_context:r.experimental_context,finishReason:r.finishReason,rawFinishReason:r.rawFinishReason,totalUsage:n,usage:r.usage,content:r.content,text:r.text,reasoningText:r.reasoningText,reasoning:r.reasoning,files:r.files,sources:r.sources,toolCalls:r.toolCalls,staticToolCalls:r.staticToolCalls,dynamicToolCalls:r.dynamicToolCalls,toolResults:r.toolResults,staticToolResults:r.staticToolResults,dynamicToolResults:r.dynamicToolResults,request:r.request,response:r.response,warnings:r.warnings,providerMetadata:r.providerMetadata,steps:de},callbacks:[te,re.onFinish]}),pe.setAttributes(await SE({telemetry:t,attributes:{"ai.response.finishReason":e,"ai.response.text":{output:()=>r.text},"ai.response.reasoning":{output:()=>r.reasoningText},"ai.response.toolCalls":{output:()=>r.toolCalls?.length?JSON.stringify(r.toolCalls):void 0},"ai.response.providerMetadata":JSON.stringify(r.providerMetadata),"ai.usage.inputTokens":n.inputTokens,"ai.usage.inputTokenDetails.noCacheTokens":n.inputTokenDetails?.noCacheTokens,"ai.usage.inputTokenDetails.cacheReadTokens":n.inputTokenDetails?.cacheReadTokens,"ai.usage.inputTokenDetails.cacheWriteTokens":n.inputTokenDetails?.cacheWriteTokens,"ai.usage.outputTokens":n.outputTokens,"ai.usage.outputTokenDetails.textTokens":n.outputTokenDetails?.textTokens,"ai.usage.outputTokenDetails.reasoningTokens":n.outputTokenDetails?.reasoningTokens,"ai.usage.totalTokens":n.totalTokens,"ai.usage.reasoningTokens":n.outputTokenDetails?.reasoningTokens,"ai.usage.cachedInputTokens":n.inputTokenDetails?.cacheReadTokens}}))}catch(t){e.error(t)}finally{pe.end()}}}),_e=Fme();this.addStream=_e.addStream,this.closeStream=_e.close;let ve=_e.stream.getReader(),ye=new ReadableStream({async start(e){e.enqueue({type:`start`})},async pull(e){function t(){k?.({steps:de}),e.enqueue({type:`abort`,...a?.reason===void 0?{}:{reason:Zx(a.reason)}}),e.close()}try{let{done:n,value:r}=await ve.read();if(n){e.close();return}if(a?.aborted){t();return}e.enqueue(r)}catch(n){sC(n)&&a?.aborted?t():e.error(n)}},cancel(e){return _e.stream.cancel(e)}});for(let e of h)ye=ye.pipeThrough(e({tools:p,stopStream(){_e.terminate()}}));this.baseStream=ye.pipeThrough(zme(y??BE())).pipeThrough(ge);let{maxRetries:be,retry:xe}=jE({maxRetries:i,abortSignal:a}),Se=yE(t),Ce=sE(r),we=_E({model:e,telemetry:t,headers:n,settings:{...Ce,maxRetries:be}}),Te=this,Ee={provider:e.provider,modelId:e.modelId},De={functionId:t?.functionId,metadata:t?.metadata};bE({name:`ai.streamText`,attributes:SE({telemetry:t,attributes:{...gE({operationId:`ai.streamText`,telemetry:t}),...we,"ai.prompt":{input:()=>JSON.stringify({system:u,prompt:d,messages:f})}}}),tracer:Se,endWhenDone:!1,fn:async r=>{pe=r;let i=await mE({system:u,prompt:d,messages:f});await KT({event:{model:Ee,system:u,prompt:d,messages:f,tools:p,toolChoice:m,activeTools:g,maxOutputTokens:Ce.maxOutputTokens,temperature:Ce.temperature,topP:Ce.topP,topK:Ce.topK,presencePenalty:Ce.presencePenalty,frequencyPenalty:Ce.frequencyPenalty,stopSequences:Ce.stopSequences,seed:Ce.seed,maxRetries:be,timeout:T,headers:n,providerOptions:b,stopWhen:E,output:y,abortSignal:D,include:ne,...De,experimental_context:F},callbacks:[j,re.onStart]});let h=i.messages,S=[],{approvedToolApprovals:O,deniedToolApprovals:ee}=ME({messages:h});if(ee.length>0||O.length>0){let e=O.filter(e=>!e.toolCall.providerExecuted),n=ee.filter(e=>!e.toolCall.providerExecuted),r=ee.filter(e=>e.toolCall.providerExecuted),i,o=new ReadableStream({start(e){i=e}});Te.addStream(o);try{for(let e of[...n,...r])i?.enqueue({type:`tool-output-denied`,toolCallId:e.toolCall.toolCallId,toolName:e.toolCall.toolName});let o=[];if(await Promise.all(e.map(async e=>{let n=await PE({toolCall:e.toolCall,tools:p,tracer:Se,telemetry:t,messages:h,abortSignal:a,experimental_context:F,stepNumber:de.length,model:Ee,onToolCallStart:[N,re.onToolCallStart],onToolCallFinish:[P,re.onToolCallFinish],onPreliminaryToolResult:e=>{i?.enqueue(e)}});n!=null&&(i?.enqueue(n),o.push(n))})),o.length>0||n.length>0){let e=[];for(let t of o)e.push({type:`tool-result`,toolCallId:t.toolCallId,toolName:t.toolName,output:await aE({toolCallId:t.toolCallId,input:t.input,tool:p?.[t.toolName],output:t.type===`tool-result`?t.output:t.error,errorMode:t.type===`tool-error`?`text`:`none`})});for(let t of n)e.push({type:`tool-result`,toolCallId:t.toolCall.toolCallId,toolName:t.toolCall.toolName,output:{type:`execution-denied`,reason:t.approvalResponse.reason}});S.push({role:`tool`,content:e})}}finally{i?.close()}}oe.push(...S);async function te({currentStep:r,responseMessages:d,usage:f}){let S=Te.includeRawChunks,O=o==null?void 0:setTimeout(()=>s.abort(),o),ee;function k(){c!=null&&(ee!=null&&clearTimeout(ee),ee=setTimeout(()=>l.abort(),c))}function A(){ee!=null&&(clearTimeout(ee),ee=void 0)}function j(){O!=null&&clearTimeout(O)}try{ie=new $S;let o=[...h,...d],s=await x?.({model:e,steps:de,stepNumber:de.length,messages:o,experimental_context:F}),c=ZT(s?.model??e),l={provider:c.provider,modelId:c.modelId},O=await rE({prompt:{system:s?.system??i.system,messages:s?.messages??o},supportedUrls:await c.supportedUrls,download:I}),ee=s?.activeTools??g,{toolChoice:ae,tools:oe}=await cE({tools:p,toolChoice:s?.toolChoice??m,activeTools:ee});F=s?.experimental_context??F;let se=s?.messages??o,ce=s?.system??i.system,le=kE(b,s?.providerOptions);await KT({event:{stepNumber:de.length,model:l,system:ce,messages:se,tools:p,toolChoice:ae,activeTools:ee,steps:[...de],providerOptions:le,timeout:T,headers:n,stopWhen:E,output:y,abortSignal:D,include:ne,...De,experimental_context:F},callbacks:[M,re.onStepStart]});let{result:{stream:L,response:ue,request:pe},doStreamSpan:me,startTimestampMs:he}=await xe(()=>bE({name:`ai.streamText.doStream`,attributes:SE({telemetry:t,attributes:{...gE({operationId:`ai.streamText.doStream`,telemetry:t}),...we,"ai.model.provider":c.provider,"ai.model.id":c.modelId,"ai.prompt.messages":{input:()=>CE(O)},"ai.prompt.tools":{input:()=>oe?.map(e=>JSON.stringify(e))},"ai.prompt.toolChoice":{input:()=>ae==null?void 0:JSON.stringify(ae)},"gen_ai.system":c.provider,"gen_ai.request.model":c.modelId,"gen_ai.request.frequency_penalty":Ce.frequencyPenalty,"gen_ai.request.max_tokens":Ce.maxOutputTokens,"gen_ai.request.presence_penalty":Ce.presencePenalty,"gen_ai.request.stop_sequences":Ce.stopSequences,"gen_ai.request.temperature":Ce.temperature,"gen_ai.request.top_k":Ce.topK,"gen_ai.request.top_p":Ce.topP}}),tracer:Se,endWhenDone:!1,fn:async e=>({startTimestampMs:C(),doStreamSpan:e,result:await c.doStream({...Ce,tools:oe,toolChoice:ae,responseFormat:await y?.responseFormat,prompt:O,providerOptions:le,abortSignal:a,headers:n,includeRawChunks:S})})})),ge=Ime({tools:p,generatorStream:L,tracer:Se,telemetry:t,system:u,messages:o,repairToolCall:_,abortSignal:a,experimental_context:F,generateId:w,stepNumber:de.length,model:l,onToolCallStart:[N,re.onToolCallStart],onToolCallFinish:[P,re.onToolCallFinish]}),_e=ne?.requestBody??!0?pe??{}:{...pe,body:void 0},ve=[],ye=[],be,Oe={},ke=`other`,Ae,je=EE(),Me,Ne=!0,Pe={id:w(),timestamp:new Date,modelId:Ee.modelId},Fe=``;Te.addStream(ge.pipeThrough(new TransformStream({async transform(e,t){if(k(),e.type===`stream-start`){be=e.warnings;return}if(Ne){let e=C()-he;Ne=!1,me.addEvent(`ai.stream.firstChunk`,{"ai.response.msToFirstChunk":e}),me.setAttributes({"ai.response.msToFirstChunk":e}),t.enqueue({type:`start-step`,request:_e,warnings:be??[]})}let n=e.type;switch(n){case`tool-approval-request`:case`text-start`:case`text-end`:t.enqueue(e);break;case`text-delta`:e.delta.length>0&&(t.enqueue({type:`text-delta`,id:e.id,text:e.delta,providerMetadata:e.providerMetadata}),Fe+=e.delta);break;case`reasoning-start`:case`reasoning-end`:t.enqueue(e);break;case`reasoning-delta`:t.enqueue({type:`reasoning-delta`,id:e.id,text:e.delta,providerMetadata:e.providerMetadata});break;case`tool-call`:t.enqueue(e),ve.push(e);break;case`tool-result`:t.enqueue(e),e.preliminary||ye.push(e);break;case`tool-error`:t.enqueue(e),ye.push(e);break;case`response-metadata`:Pe={id:e.id??Pe.id,timestamp:e.timestamp??Pe.timestamp,modelId:e.modelId??Pe.modelId};break;case`finish`:{je=e.usage,ke=e.finishReason,Ae=e.rawFinishReason,Me=e.providerMetadata;let t=C()-he;me.addEvent(`ai.stream.finish`),me.setAttributes({"ai.response.msToFinish":t,"ai.response.avgOutputTokensPerSecond":1e3*(je.outputTokens??0)/t});break}case`file`:t.enqueue(e);break;case`source`:t.enqueue(e);break;case`tool-input-start`:{Oe[e.id]=e.toolName;let n=p?.[e.toolName];n?.onInputStart!=null&&await n.onInputStart({toolCallId:e.id,messages:o,abortSignal:a,experimental_context:F}),t.enqueue({...e,dynamic:e.dynamic??n?.type===`dynamic`,title:n?.title});break}case`tool-input-end`:delete Oe[e.id],t.enqueue(e);break;case`tool-input-delta`:{let n=Oe[e.id],r=p?.[n];r?.onInputDelta!=null&&await r.onInputDelta({inputTextDelta:e.delta,toolCallId:e.id,messages:o,abortSignal:a,experimental_context:F}),t.enqueue(e);break}case`error`:t.enqueue(e),ke=`error`;break;case`raw`:S&&t.enqueue(e);break;default:throw Error(`Unknown chunk type: ${n}`)}},async flush(e){let n=ve.length>0?JSON.stringify(ve):void 0;try{me.setAttributes(await SE({telemetry:t,attributes:{"ai.response.finishReason":ke,"ai.response.toolCalls":{output:()=>n},"ai.response.id":Pe.id,"ai.response.model":Pe.modelId,"ai.response.timestamp":Pe.timestamp.toISOString(),"ai.usage.inputTokens":je.inputTokens,"ai.usage.inputTokenDetails.noCacheTokens":je.inputTokenDetails?.noCacheTokens,"ai.usage.inputTokenDetails.cacheReadTokens":je.inputTokenDetails?.cacheReadTokens,"ai.usage.inputTokenDetails.cacheWriteTokens":je.inputTokenDetails?.cacheWriteTokens,"ai.usage.outputTokens":je.outputTokens,"ai.usage.outputTokenDetails.textTokens":je.outputTokenDetails?.textTokens,"ai.usage.outputTokenDetails.reasoningTokens":je.outputTokenDetails?.reasoningTokens,"ai.usage.totalTokens":je.totalTokens,"ai.usage.reasoningTokens":je.outputTokenDetails?.reasoningTokens,"ai.usage.cachedInputTokens":je.inputTokenDetails?.cacheReadTokens,"gen_ai.response.finish_reasons":[ke],"gen_ai.response.id":Pe.id,"gen_ai.response.model":Pe.modelId,"gen_ai.usage.input_tokens":je.inputTokens,"gen_ai.usage.output_tokens":je.outputTokens}}))}catch{}e.enqueue({type:`finish-step`,finishReason:ke,rawFinishReason:Ae,usage:je,providerMetadata:Me,response:{...Pe,headers:ue?.headers}});let i=DE(f,je);await ie.promise;let a=de[de.length-1];try{me.setAttributes(await SE({telemetry:t,attributes:{"ai.response.text":{output:()=>a.text},"ai.response.reasoning":{output:()=>a.reasoningText},"ai.response.providerMetadata":JSON.stringify(a.providerMetadata)}}))}catch{}finally{me.end()}let o=ve.filter(e=>e.providerExecuted!==!0),s=ye.filter(e=>e.providerExecuted!==!0);for(let e of ve){if(e.providerExecuted!==!0)continue;let t=p?.[e.toolName];t?.type===`provider`&&t.supportsDeferredResults&&(ye.some(t=>(t.type===`tool-result`||t.type===`tool-error`)&&t.toolCallId===e.toolCallId)||fe.set(e.toolCallId,{toolName:e.toolName}))}for(let e of ye)(e.type===`tool-result`||e.type===`tool-error`)&&fe.delete(e.toolCallId);if(j(),A(),(o.length>0&&s.length===o.length||fe.size>0)&&!await KE({stopConditions:v,steps:de})){d.push(...await qE({content:de[de.length-1].content,tools:p}));try{await te({currentStep:r+1,responseMessages:d,usage:i})}catch(t){e.enqueue({type:`error`,error:t}),Te.closeStream()}}else e.enqueue({type:`finish`,finishReason:ke,rawFinishReason:Ae,totalUsage:i}),Te.closeStream()}})))}finally{j(),A()}}await te({currentStep:0,responseMessages:S,usage:EE()})}}).catch(e=>{Te.addStream(new ReadableStream({start(t){t.enqueue({type:`error`,error:e}),t.close()}})),Te.closeStream()})}get steps(){return this.consumeStream(),this._steps.promise}get finalStep(){return this.steps.then(e=>e[e.length-1])}get content(){return this.finalStep.then(e=>e.content)}get warnings(){return this.finalStep.then(e=>e.warnings)}get providerMetadata(){return this.finalStep.then(e=>e.providerMetadata)}get text(){return this.finalStep.then(e=>e.text)}get reasoningText(){return this.finalStep.then(e=>e.reasoningText)}get reasoning(){return this.finalStep.then(e=>e.reasoning)}get sources(){return this.finalStep.then(e=>e.sources)}get files(){return this.finalStep.then(e=>e.files)}get toolCalls(){return this.finalStep.then(e=>e.toolCalls)}get staticToolCalls(){return this.finalStep.then(e=>e.staticToolCalls)}get dynamicToolCalls(){return this.finalStep.then(e=>e.dynamicToolCalls)}get toolResults(){return this.finalStep.then(e=>e.toolResults)}get staticToolResults(){return this.finalStep.then(e=>e.staticToolResults)}get dynamicToolResults(){return this.finalStep.then(e=>e.dynamicToolResults)}get usage(){return this.finalStep.then(e=>e.usage)}get request(){return this.finalStep.then(e=>e.request)}get response(){return this.finalStep.then(e=>e.response)}get totalUsage(){return this.consumeStream(),this._totalUsage.promise}get finishReason(){return this.consumeStream(),this._finishReason.promise}get rawFinishReason(){return this.consumeStream(),this._rawFinishReason.promise}teeStream(){let[e,t]=this.baseStream.tee();return this.baseStream=t,e}get textStream(){return sD(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){e.type===`text-delta`&&t.enqueue(e.text)}})))}get fullStream(){return sD(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){t.enqueue(e)}})))}async consumeStream(e){var t;try{await cD({stream:this.fullStream,onError:e?.onError})}catch(n){(t=e?.onError)==null||t.call(e,n)}}get experimental_partialOutputStream(){return this.partialOutputStream}get partialOutputStream(){return sD(this.teeStream().pipeThrough(new TransformStream({transform({partialOutput:e},t){e!=null&&t.enqueue(e)}})))}get elementStream(){let e=this.outputSpecification?.createElementStreamTransform();if(e==null)throw new Nle({functionality:`element streams in ${this.outputSpecification?.name??`text`} mode`});return sD(this.teeStream().pipeThrough(e))}get output(){return this.finalStep.then(e=>(this.outputSpecification??BE()).parseCompleteOutput({text:e.text},{response:e.response,usage:e.usage,finishReason:e.finishReason}))}toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:n,messageMetadata:r,sendReasoning:i=!0,sendSources:a=!1,sendStart:o=!0,sendFinish:s=!0,onError:c=Zx}={}){let l=t==null?void 0:kme({originalMessages:e,responseMessageId:t}),u=e=>{let t=this.tools?.[e.toolName];return t==null?e.dynamic:t?.type===`dynamic`?!0:void 0};return sD(Nme({stream:this.fullStream.pipeThrough(new TransformStream({transform:async(e,t)=>{let n=r?.({part:e}),d=e.type;switch(d){case`text-start`:t.enqueue({type:`text-start`,id:e.id,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`text-delta`:t.enqueue({type:`text-delta`,id:e.id,delta:e.text,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`text-end`:t.enqueue({type:`text-end`,id:e.id,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`reasoning-start`:t.enqueue({type:`reasoning-start`,id:e.id,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`reasoning-delta`:i&&t.enqueue({type:`reasoning-delta`,id:e.id,delta:e.text,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`reasoning-end`:t.enqueue({type:`reasoning-end`,id:e.id,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`file`:t.enqueue({type:`file`,mediaType:e.file.mediaType,url:`data:${e.file.mediaType};base64,${e.file.base64}`,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`source`:a&&e.sourceType===`url`&&t.enqueue({type:`source-url`,sourceId:e.id,url:e.url,title:e.title,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}),a&&e.sourceType===`document`&&t.enqueue({type:`source-document`,sourceId:e.id,mediaType:e.mediaType,title:e.title,filename:e.filename,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`tool-input-start`:{let n=u(e);t.enqueue({type:`tool-input-start`,toolCallId:e.id,toolName:e.toolName,...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...n==null?{}:{dynamic:n},...e.title==null?{}:{title:e.title}});break}case`tool-input-delta`:t.enqueue({type:`tool-input-delta`,toolCallId:e.id,inputTextDelta:e.delta});break;case`tool-call`:{let n=u(e);e.invalid?t.enqueue({type:`tool-input-error`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...n==null?{}:{dynamic:n},errorText:c(e.error),...e.title==null?{}:{title:e.title}}):t.enqueue({type:`tool-input-available`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...n==null?{}:{dynamic:n},...e.title==null?{}:{title:e.title}});break}case`tool-approval-request`:t.enqueue({type:`tool-approval-request`,approvalId:e.approvalId,toolCallId:e.toolCall.toolCallId});break;case`tool-result`:{let n=u(e);t.enqueue({type:`tool-output-available`,toolCallId:e.toolCallId,output:e.output,...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...e.preliminary==null?{}:{preliminary:e.preliminary},...n==null?{}:{dynamic:n}});break}case`tool-error`:{let n=u(e);t.enqueue({type:`tool-output-error`,toolCallId:e.toolCallId,errorText:e.providerExecuted?typeof e.error==`string`?e.error:JSON.stringify(e.error):c(e.error),...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...n==null?{}:{dynamic:n}});break}case`tool-output-denied`:t.enqueue({type:`tool-output-denied`,toolCallId:e.toolCallId});break;case`error`:t.enqueue({type:`error`,errorText:c(e.error)});break;case`start-step`:t.enqueue({type:`start-step`});break;case`finish-step`:t.enqueue({type:`finish-step`});break;case`start`:o&&t.enqueue({type:`start`,...n==null?{}:{messageMetadata:n},...l==null?{}:{messageId:l}});break;case`finish`:s&&t.enqueue({type:`finish`,finishReason:e.finishReason,...n==null?{}:{messageMetadata:n}});break;case`abort`:t.enqueue(e);break;case`tool-input-end`:break;case`raw`:break;default:throw Error(`Unknown chunk type: ${d}`)}n!=null&&d!==`start`&&d!==`finish`&&t.enqueue({type:`message-metadata`,messageMetadata:n})}})),messageId:l??t?.(),originalMessages:e,onFinish:n,onError:c}))}pipeUIMessageStreamToResponse(e,{originalMessages:t,generateMessageId:n,onFinish:r,messageMetadata:i,sendReasoning:a,sendSources:o,sendFinish:s,sendStart:c,onError:l,...u}={}){Pme({response:e,stream:this.toUIMessageStream({originalMessages:t,generateMessageId:n,onFinish:r,messageMetadata:i,sendReasoning:a,sendSources:o,sendFinish:s,sendStart:c,onError:l}),...u})}pipeTextStreamToResponse(e,t){Dme({response:e,textStream:this.textStream,...t})}toUIMessageStreamResponse({originalMessages:e,generateMessageId:t,onFinish:n,messageMetadata:r,sendReasoning:i,sendSources:a,sendFinish:o,sendStart:s,onError:c,...l}={}){return Ome({stream:this.toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:n,messageMetadata:r,sendReasoning:i,sendSources:a,sendFinish:o,sendStart:s,onError:c}),...l})}toTextStreamResponse(e){return Eme({textStream:this.textStream,...e})}};aC({prefix:`aiobj`,size:24});var Vme=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){n(e)}}),this.processQueue()})}};aC({prefix:`aiobj`,size:24});async function Hme(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error(`FileList is not supported in the current environment`);return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e;return{type:`file`,mediaType:n,filename:t,url:await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{t(e.target?.result)},r.onerror=e=>n(e),r.readAsDataURL(e)})}}))}var Ume=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){let n=await LC(this.body),r=await LC(this.headers),i=await LC(this.credentials),a={...lC(r),...lC(t.headers)},o=await this.prepareSendMessagesRequest?.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...n,...t.body},headers:a,credentials:i,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId}),s=o?.api??this.api,c=o?.headers===void 0?a:lC(o.headers),l=o?.body===void 0?{...n,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId}:o.body,u=o?.credentials??i,d=await(this.fetch??globalThis.fetch)(s,{method:`POST`,headers:{"Content-Type":`application/json`,...c},body:JSON.stringify(l),credentials:u,signal:e});if(!d.ok)throw Error(await d.text()??`Failed to fetch the chat response.`);if(!d.body)throw Error(`The response body is empty.`);return this.processResponseStream(d.body)}async reconnectToStream(e){let t=await LC(this.body),n=await LC(this.headers),r=await LC(this.credentials),i={...lC(n),...lC(e.headers)},a=await this.prepareReconnectToStreamRequest?.call(this,{api:this.api,id:e.chatId,body:{...t,...e.body},headers:i,credentials:r,requestMetadata:e.metadata}),o=a?.api??`${this.api}/${e.chatId}/stream`,s=a?.headers===void 0?i:lC(a.headers),c=a?.credentials??r,l=await(this.fetch??globalThis.fetch)(o,{method:`GET`,headers:s,credentials:c});if(l.status===204)return null;if(!l.ok)throw Error(await l.text()??`Failed to fetch the chat response.`);if(!l.body)throw Error(`The response body is empty.`);return this.processResponseStream(l.body)}},uD=class extends Ume{constructor(e={}){super(e)}processResponseStream(e){return NC({stream:e,schema:Ame}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},Wme=class{constructor({generateId:e=Pue,id:t=e(),transport:n=new uD,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new Vme,this.sendMessage=async(e,t)=>{if(e==null){await this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...t});return}let n;if(n=`text`in e||`files`in e?{parts:[...Array.isArray(e.files)?e.files:await Hme(e.files),...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}:e,e.messageId!=null){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw Error(`message with id ${e.messageId} not found`);if(this.state.messages[t].role!==`user`)throw Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...n,id:e.messageId,role:n.role??`user`,metadata:e.metadata})}else this.state.pushMessage({...n,id:n.id??this.generateId(),role:n.role??`user`,metadata:e.metadata});await this.makeRequest({trigger:`submit-message`,messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let n=e==null?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(n===-1)throw Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,this.messages[n].role===`assistant`?n:n+1),await this.makeRequest({trigger:`regenerate-message`,messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:`resume-stream`,...e})},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n,options:r})=>this.jobExecutor.run(async()=>{let i=this.state.messages,a=i[i.length-1],o=r=>rD(r)&&r.state===`approval-requested`&&r.approval.id===e?{...r,state:`approval-responded`,approval:{id:e,approved:t,reason:n}}:r;this.state.replaceMessage(i.length-1,{...a,parts:a.parts.map(o)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{e&&this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...r})})}),this.addToolOutput=async({state:e=`output-available`,toolCallId:t,output:n,errorText:r,options:i})=>this.jobExecutor.run(async()=>{let a=this.state.messages,o=a[a.length-1],s=i=>rD(i)&&i.toolCallId===t?{...i,state:e,output:n,errorText:r}:i;this.state.replaceMessage(a.length-1,{...o,parts:o.parts.map(s)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(s)),this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{e&&this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...i})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{this.status!==`streaming`&&this.status!==`submitted`||this.activeResponse?.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e==`object`&&`then`in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:i}){var a;let o;if(e===`resume-stream`)try{let e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:r});if(e==null)return;o=e}catch(e){this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e});return}this.setStatus({status:`submitted`,error:void 0});let s=this.lastMessage,c=!1,l=!1,u=!1;try{let a={state:aD({lastMessage:this.state.snapshot(s),messageId:this.generateId()}),abortController:new AbortController};a.abortController.signal.addEventListener(`abort`,()=>{c=!0}),this.activeResponse=a;let l;l=e===`resume-stream`?o:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:a.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i}),await cD({stream:oD({stream:l,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:e=>this.jobExecutor.run(()=>e({state:a.state,write:()=>{this.setStatus({status:`streaming`}),a.state.message.id===this.lastMessage?.id?this.state.replaceMessage(this.state.messages.length-1,a.state.message):this.state.pushMessage(a.state.message)}})),onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:`ready`})}catch(e){if(c||e.name===`AbortError`)return c=!0,this.setStatus({status:`ready`}),null;u=!0,e instanceof TypeError&&(e.message.toLowerCase().includes(`fetch`)||e.message.toLowerCase().includes(`network`))&&(l=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e})}finally{try{(a=this.onFinish)==null||a.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:l,isError:u,finishReason:this.activeResponse?.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}!u&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,metadata:t,headers:n,body:r})}},Gme=t(n(((e,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=t-(a-r);o<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},o)}}t.exports=n}))(),1),dD=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},fD=(e,t,n)=>(dD(e,t,`read from private field`),n?n.call(e):t.get(e)),pD=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},mD=(e,t,n,r)=>(dD(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n);function Kme(e,t){return t==null?e:(0,Gme.default)(e,t)}var hD,gD,_D,vD,yD,bD,xD,SD,CD,qme=class{constructor(e=[]){pD(this,hD,void 0),pD(this,gD,`ready`),pD(this,_D,void 0),pD(this,vD,new Set),pD(this,yD,new Set),pD(this,bD,new Set),this.pushMessage=e=>{mD(this,hD,fD(this,hD).concat(e)),fD(this,xD).call(this)},this.popMessage=()=>{mD(this,hD,fD(this,hD).slice(0,-1)),fD(this,xD).call(this)},this.replaceMessage=(e,t)=>{mD(this,hD,[...fD(this,hD).slice(0,e),this.snapshot(t),...fD(this,hD).slice(e+1)]),fD(this,xD).call(this)},this.snapshot=e=>structuredClone(e),this[`~registerMessagesCallback`]=(e,t)=>{let n=t?Kme(e,t):e;return fD(this,vD).add(n),()=>{fD(this,vD).delete(n)}},this[`~registerStatusCallback`]=e=>(fD(this,yD).add(e),()=>{fD(this,yD).delete(e)}),this[`~registerErrorCallback`]=e=>(fD(this,bD).add(e),()=>{fD(this,bD).delete(e)}),pD(this,xD,()=>{fD(this,vD).forEach(e=>e())}),pD(this,SD,()=>{fD(this,yD).forEach(e=>e())}),pD(this,CD,()=>{fD(this,bD).forEach(e=>e())}),mD(this,hD,e)}get status(){return fD(this,gD)}set status(e){mD(this,gD,e),fD(this,SD).call(this)}get error(){return fD(this,_D)}set error(e){mD(this,_D,e),fD(this,CD).call(this)}get messages(){return fD(this,hD)}set messages(e){mD(this,hD,[...e]),fD(this,xD).call(this)}};hD=new WeakMap,gD=new WeakMap,_D=new WeakMap,vD=new WeakMap,yD=new WeakMap,bD=new WeakMap,xD=new WeakMap,SD=new WeakMap,CD=new WeakMap;var wD,TD=class extends Wme{constructor({messages:e,...t}){let n=new qme(e);super({...t,state:n}),pD(this,wD,void 0),this[`~registerMessagesCallback`]=(e,t)=>fD(this,wD)[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>fD(this,wD)[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>fD(this,wD)[`~registerErrorCallback`](e),mD(this,wD,n)}};wD=new WeakMap;function ED({experimental_throttle:e,resume:t=!1,...n}={}){let r=(0,L.useRef)(`chat`in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});`chat`in n||(r.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});let i={...n,onToolCall:e=>{var t;return(t=r.current).onToolCall?.call(t,e)},onData:e=>{var t;return(t=r.current).onData?.call(t,e)},onFinish:e=>{var t;return(t=r.current).onFinish?.call(t,e)},onError:e=>{var t;return(t=r.current).onError?.call(t,e)},sendAutomaticallyWhen:e=>{var t;return(t=r.current).sendAutomaticallyWhen?.call(t,e)??!1}},a=(0,L.useRef)(`chat`in n?n.chat:new TD(i));(`chat`in n&&n.chat!==a.current||`id`in n&&a.current.id!==n.id)&&(a.current=`chat`in n?n.chat:new TD(i));let o=(0,L.useSyncExternalStore)((0,L.useCallback)(t=>a.current[`~registerMessagesCallback`](t,e),[e,a.current.id]),()=>a.current.messages,()=>a.current.messages),s=(0,L.useSyncExternalStore)(a.current[`~registerStatusCallback`],()=>a.current.status,()=>a.current.status),c=(0,L.useSyncExternalStore)(a.current[`~registerErrorCallback`],()=>a.current.error,()=>a.current.error),l=(0,L.useCallback)(e=>{typeof e==`function`&&(e=e(a.current.messages)),a.current.messages=e},[a]);return(0,L.useEffect)(()=>{t&&a.current.resumeStream()},[t,a]),{id:a.current.id,messages:o,setMessages:l,sendMessage:a.current.sendMessage,regenerate:a.current.regenerate,clearError:a.current.clearError,stop:a.current.stop,error:c,resumeStream:a.current.resumeStream,status:s,addToolResult:a.current.addToolOutput,addToolOutput:a.current.addToolOutput,addToolApprovalResponse:a.current.addToolApprovalResponse}}function DD(e,[t,n]){return Math.min(n,Math.max(t,e))}function Jme(e,t){return L.useReducer((e,n)=>t[e][n]??e,e)}var OD=`ScrollArea`,[kD,Yme]=xh(OD),[Xme,AD]=kD(OD),jD=L.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=L.useState(null),[l,u]=L.useState(null),[d,f]=L.useState(null),[p,m]=L.useState(null),[h,g]=L.useState(null),[_,v]=L.useState(0),[y,b]=L.useState(0),[x,S]=L.useState(!1),[C,w]=L.useState(!1),T=Tm(t,e=>c(e)),E=wy(i);return(0,B.jsx)(Xme,{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,B.jsx)(Eh.div,{dir:E,...o,ref:T,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});jD.displayName=OD;var MD=`ScrollAreaViewport`,ND=L.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=AD(MD,n),s=Tm(t,L.useRef(null),o.onViewportChange);return(0,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsx)(Eh.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,B.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});ND.displayName=MD;var PD=`ScrollAreaScrollbar`,FD=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=AD(PD,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return L.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,B.jsx)(Zme,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,B.jsx)(Qme,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,B.jsx)(ID,{...r,ref:t,forceMount:n}):i.type===`always`?(0,B.jsx)(LD,{...r,ref:t}):null});FD.displayName=PD;var Zme=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=AD(PD,e.__scopeScrollArea),[a,o]=L.useState(!1);return L.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,B.jsx)(Ih,{present:n||a,children:(0,B.jsx)(ID,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Qme=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=AD(PD,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=XD(()=>c(`SCROLL_END`),100),[s,c]=Jme(`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 L.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),L.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,B.jsx)(Ih,{present:n||s!==`hidden`,children:(0,B.jsx)(LD,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:H(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:H(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),ID=L.forwardRef((e,t)=>{let n=AD(PD,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=L.useState(!1),s=e.orientation===`horizontal`,c=XD(()=>{if(n.viewport){let e=n.viewport.offsetWidth{let{orientation:n=`vertical`,...r}=e,i=AD(PD,e.__scopeScrollArea),a=L.useRef(null),o=L.useRef(0),[s,c]=L.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=GD(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 ihe(e,o.current,s,t)}return n===`horizontal`?(0,B.jsx)($me,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=qD(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,B.jsx)(ehe,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=qD(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}),$me=L.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=AD(PD,e.__scopeScrollArea),[o,s]=L.useState(),c=L.useRef(null),l=Tm(t,c,a.onScrollbarXChange);return L.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(zD,{"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":KD(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),YD(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:WD(o.paddingLeft),paddingEnd:WD(o.paddingRight)}})}})}),ehe=L.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=AD(PD,e.__scopeScrollArea),[o,s]=L.useState(),c=L.useRef(null),l=Tm(t,c,a.onScrollbarYChange);return L.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(zD,{"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":KD(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),YD(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:WD(o.paddingTop),paddingEnd:WD(o.paddingBottom)}})}})}),[the,RD]=kD(PD),zD=L.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=AD(PD,n),[m,h]=L.useState(null),g=Tm(t,e=>h(e)),_=L.useRef(null),v=L.useRef(``),y=p.viewport,b=r.content-r.viewport,x=Oh(u),S=Oh(c),C=XD(d,10);function w(e){_.current&&l({x:e.clientX-_.current.left,y:e.clientY-_.current.top})}return L.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]),L.useEffect(S,[r,S]),ZD(m,C),ZD(p.content,C),(0,B.jsx)(the,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Oh(a),onThumbPointerUp:Oh(o),onThumbPositionChange:S,onThumbPointerDown:Oh(s),children:(0,B.jsx)(Eh.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:H(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:H(e.onPointerMove,w),onPointerUp:H(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})})})}),BD=`ScrollAreaThumb`,VD=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=RD(BD,e.__scopeScrollArea);return(0,B.jsx)(Ih,{present:n||i.hasThumb,children:(0,B.jsx)(nhe,{ref:t,...r})})}),nhe=L.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=AD(BD,n),o=RD(BD,n),{onThumbPositionChange:s}=o,c=Tm(t,e=>o.onThumbChange(e)),l=L.useRef(void 0),u=XD(()=>{l.current&&=(l.current(),void 0)},100);return L.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=ahe(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,B.jsx)(Eh.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:H(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:H(e.onPointerUp,o.onThumbPointerUp)})});VD.displayName=BD;var HD=`ScrollAreaCorner`,UD=L.forwardRef((e,t)=>{let n=AD(HD,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,B.jsx)(rhe,{...e,ref:t}):null});UD.displayName=HD;var rhe=L.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=AD(HD,n),[a,o]=L.useState(0),[s,c]=L.useState(0),l=!!(a&&s);return ZD(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),ZD(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,B.jsx)(Eh.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 WD(e){return e?parseInt(e,10):0}function GD(e,t){let n=e/t;return isNaN(n)?0:n}function KD(e){let t=GD(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function ihe(e,t,n,r=`ltr`){let i=KD(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 JD([c,l],d)(e)}function qD(e,t,n=`ltr`){let r=KD(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=DD(e,n===`ltr`?[0,o]:[o*-1,0]);return JD([0,o],[0,s])(c)}function JD(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 YD(e,t){return e>0&&e{})=>{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 XD(e,t){let n=Oh(e),r=L.useRef(0);return L.useEffect(()=>()=>window.clearTimeout(r.current),[]),L.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ZD(e,t){let n=Oh(t);Sh(()=>{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 QD=jD,ohe=ND,she=UD,$D=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(QD,{ref:r,className:V(`relative overflow-hidden`,e),...n,children:[(0,B.jsx)(ohe,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,B.jsx)(eO,{}),(0,B.jsx)(she,{})]}));$D.displayName=QD.displayName;var eO=L.forwardRef(({className:e,orientation:t=`vertical`,...n},r)=>(0,B.jsx)(FD,{ref:r,orientation:t,className:V(`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,B.jsx)(VD,{className:`relative flex-1 rounded-full bg-border`})}));eO.displayName=FD.displayName;function tO(e){let t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var che=[` `,`Enter`,`ArrowUp`,`ArrowDown`],lhe=[` `,`Enter`],nO=`Select`,[rO,iO,uhe]=Cy(nO),[aO,dhe]=xh(nO,[uhe,uv]),oO=uv(),[fhe,sO]=aO(nO),[phe,mhe]=aO(nO),cO=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=oO(t),[g,_]=L.useState(null),[v,y]=L.useState(null),[b,x]=L.useState(!1),S=wy(l),[C,w]=wh({prop:r,defaultProp:i??!1,onChange:a,caller:nO}),[T,E]=wh({prop:o,defaultProp:s,onChange:c,caller:nO}),D=L.useRef(null),O=g?m||!!g.closest(`form`):!0,[ee,te]=L.useState(new Set),k=Array.from(ee).map(e=>e.props.value).join(`;`);return(0,B.jsx)(bv,{...h,children:(0,B.jsxs)(fhe,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:Ch(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,B.jsx)(rO.Provider,{scope:t,children:(0,B.jsx)(phe,{scope:e.__scopeSelect,onNativeOptionAdd:L.useCallback(e=>{te(t=>new Set(t).add(e))},[]),onNativeOptionRemove:L.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,B.jsxs)(UO,{"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,B.jsx)(`option`,{value:``}):null,Array.from(ee)]},k):null]})})};cO.displayName=nO;var lO=`SelectTrigger`,uO=L.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=oO(n),o=sO(lO,n),s=o.disabled||r,c=Tm(t,o.onTriggerChange),l=iO(n),u=L.useRef(`touch`),[d,f,p]=GO(e=>{let t=l().filter(e=>!e.disabled),n=KO(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,B.jsx)(xv,{asChild:!0,...a,children:(0,B.jsx)(Eh.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":WO(o.value)?``:void 0,...i,ref:c,onClick:H(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:H(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:H(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&che.includes(e.key)&&(m(),e.preventDefault())})})})});uO.displayName=lO;var dO=`SelectValue`,fO=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=sO(dO,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Tm(t,c.onValueNodeChange);return Sh(()=>{l(u)},[l,u]),(0,B.jsx)(Eh.span,{...s,ref:d,style:{pointerEvents:`none`},children:WO(c.value)?(0,B.jsx)(B.Fragment,{children:o}):a})});fO.displayName=dO;var hhe=`SelectIcon`,pO=L.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(Eh.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});pO.displayName=hhe;var ghe=`SelectPortal`,mO=e=>(0,B.jsx)(Fh,{asChild:!0,...e});mO.displayName=ghe;var hO=`SelectContent`,gO=L.forwardRef((e,t)=>{let n=sO(hO,e.__scopeSelect),[r,i]=L.useState();if(Sh(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?yh.createPortal((0,B.jsx)(vO,{scope:e.__scopeSelect,children:(0,B.jsx)(rO.Slot,{scope:e.__scopeSelect,children:(0,B.jsx)(`div`,{children:e.children})})}),t):null}return(0,B.jsx)(bO,{...e,ref:t})});gO.displayName=hO;var _O=10,[vO,yO]=aO(hO),_he=`SelectContentImpl`,vhe=Th(`SelectContent.RemoveScroll`),bO=L.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=sO(hO,n),[y,b]=L.useState(null),[x,S]=L.useState(null),C=Tm(t,e=>b(e)),[w,T]=L.useState(null),[E,D]=L.useState(null),O=iO(n),[ee,te]=L.useState(!1),k=L.useRef(!1);L.useEffect(()=>{if(y)return _g(y)},[y]),zh();let A=L.useCallback(e=>{let[t,...n]=O().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},[O,x]),j=L.useCallback(()=>A([w,y]),[A,w,y]);L.useEffect(()=>{ee&&j()},[ee,j]);let{onOpenChange:M,triggerPointerDownPosRef:N}=v;L.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||M(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.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,N]),L.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[P,F]=GO(e=>{let t=O().filter(e=>!e.disabled),n=KO(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),I=L.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]),ne=L.useCallback(()=>y?.focus(),[y]),re=L.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ie=r===`popper`?SO:xO,ae=ie===SO?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,B.jsx)(vO,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:I,selectedItem:w,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:j,selectedItemText:E,position:r,isPositioned:ee,searchRef:P,children:(0,B.jsx)(dg,{as:vhe,allowPinchZoom:!0,children:(0,B.jsx)(Nh,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:H(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(Ah,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,B.jsx)(ie,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ae,onPlaced:()=>te(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:H(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&F(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().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()}})})})})})})});bO.displayName=_he;var yhe=`SelectItemAlignedPosition`,xO=L.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=sO(hO,n),o=yO(hO,n),[s,c]=L.useState(null),[l,u]=L.useState(null),d=Tm(t,e=>u(e)),f=iO(n),p=L.useRef(!1),m=L.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=L.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-_O,d=DD(a,[_O,Math.max(_O,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-_O,d=DD(a,[_O,Math.max(_O,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-_O*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-_O,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,te=m+v+ee,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(D,O+(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)+O)+k;s.style.height=t+`px`,h.scrollTop=te-E+h.offsetTop}s.style.margin=`${_O}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]);Sh(()=>y(),[y]);let[b,x]=L.useState();return Sh(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,B.jsx)(xhe,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:L.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,B.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,B.jsx)(Eh.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});xO.displayName=yhe;var bhe=`SelectPopperPosition`,SO=L.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=_O,...a}=e,o=oO(n);return(0,B.jsx)(Sv,{...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)`}})});SO.displayName=bhe;var[xhe,CO]=aO(hO,{}),wO=`SelectViewport`,TO=L.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=yO(wO,n),o=CO(wO,n),s=Tm(t,a.onViewportChange),c=L.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsx)(rO.Slot,{scope:n,children:(0,B.jsx)(Eh.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:H(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-_O*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});TO.displayName=wO;var EO=`SelectGroup`,[She,Che]=aO(EO),whe=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ch();return(0,B.jsx)(She,{scope:n,id:i,children:(0,B.jsx)(Eh.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});whe.displayName=EO;var DO=`SelectLabel`,OO=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Che(DO,n);return(0,B.jsx)(Eh.div,{id:i.id,...r,ref:t})});OO.displayName=DO;var kO=`SelectItem`,[The,AO]=aO(kO),jO=L.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=sO(kO,n),c=yO(kO,n),l=s.value===r,[u,d]=L.useState(a??``),[f,p]=L.useState(!1),m=Tm(t,e=>c.itemRefCallback?.(e,r,i)),h=Ch(),g=L.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A 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,B.jsx)(The,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:L.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(rO.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,B.jsx)(Eh.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:H(o.onFocus,()=>p(!0)),onBlur:H(o.onBlur,()=>p(!1)),onClick:H(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:H(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:H(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:H(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:H(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:H(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(lhe.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});jO.displayName=kO;var MO=`SelectItemText`,NO=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=sO(MO,n),s=yO(MO,n),c=AO(MO,n),l=mhe(MO,n),[u,d]=L.useState(null),f=Tm(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=L.useMemo(()=>(0,B.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Sh(()=>(h(m),()=>g(m)),[h,g,m]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Eh.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?yh.createPortal(a.children,o.valueNode):null]})});NO.displayName=MO;var PO=`SelectItemIndicator`,FO=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return AO(PO,n).isSelected?(0,B.jsx)(Eh.span,{"aria-hidden":!0,...r,ref:t}):null});FO.displayName=PO;var IO=`SelectScrollUpButton`,LO=L.forwardRef((e,t)=>{let n=yO(IO,e.__scopeSelect),r=CO(IO,e.__scopeSelect),[i,a]=L.useState(!1),o=Tm(t,r.onScrollButtonChange);return Sh(()=>{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,B.jsx)(BO,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});LO.displayName=IO;var RO=`SelectScrollDownButton`,zO=L.forwardRef((e,t)=>{let n=yO(RO,e.__scopeSelect),r=CO(RO,e.__scopeSelect),[i,a]=L.useState(!1),o=Tm(t,r.onScrollButtonChange);return Sh(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(BO,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});zO.displayName=RO;var BO=L.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=yO(`SelectScrollButton`,n),o=L.useRef(null),s=iO(n),c=L.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return L.useEffect(()=>()=>c(),[c]),Sh(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,B.jsx)(Eh.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:H(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:H(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:H(i.onPointerLeave,()=>{c()})})}),Ehe=`SelectSeparator`,VO=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(Eh.div,{"aria-hidden":!0,...r,ref:t})});VO.displayName=Ehe;var HO=`SelectArrow`,Dhe=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=oO(n),a=sO(HO,n),o=yO(HO,n);return a.open&&o.position===`popper`?(0,B.jsx)(Cv,{...i,...r,ref:t}):null});Dhe.displayName=HO;var Ohe=`SelectBubbleInput`,UO=L.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=L.useRef(null),a=Tm(r,i),o=tO(t);return L.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,B.jsx)(Eh.select,{...n,style:{...wv,...n.style},ref:a,defaultValue:t})});UO.displayName=Ohe;function WO(e){return e===``||e===void 0}function GO(e){let t=Oh(e),n=L.useRef(``),r=L.useRef(0),i=L.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=L.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return L.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function KO(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=khe(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 khe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ahe=cO,qO=uO,jhe=fO,Mhe=pO,Nhe=mO,JO=gO,Phe=TO,YO=OO,XO=jO,Fhe=NO,Ihe=FO,ZO=LO,QO=zO,$O=VO,ek=Ahe,tk=jhe,nk=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(qO,{ref:r,className:V(`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,B.jsx)(Mhe,{asChild:!0,children:(0,B.jsx)(Pp,{className:`h-4 w-4 opacity-50`})})]}));nk.displayName=qO.displayName;var rk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(ZO,{ref:n,className:V(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(kee,{className:`h-4 w-4`})}));rk.displayName=ZO.displayName;var ik=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(QO,{ref:n,className:V(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(Pp,{className:`h-4 w-4`})}));ik.displayName=QO.displayName;var ak=L.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,B.jsx)(Nhe,{children:(0,B.jsxs)(JO,{ref:i,className:V(`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,B.jsx)(rk,{}),(0,B.jsx)(Phe,{className:V(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,B.jsx)(ik,{})]})}));ak.displayName=JO.displayName;var Lhe=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(YO,{ref:n,className:V(`px-2 py-1.5 text-sm font-semibold`,e),...t}));Lhe.displayName=YO.displayName;var ok=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(XO,{ref:r,className:V(`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,B.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(Ihe,{children:(0,B.jsx)(Np,{className:`h-4 w-4`})})}),(0,B.jsx)(Fhe,{children:t})]}));ok.displayName=XO.displayName;var Rhe=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)($O,{ref:n,className:V(`-mx-1 my-1 h-px bg-muted`,e),...t}));Rhe.displayName=$O.displayName;var sk=`objectstack:ai-chat-messages`,ck=`objectstack:ai-chat-panel-open`;function zhe(){try{let e=localStorage.getItem(sk);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function lk(e){try{localStorage.setItem(sk,JSON.stringify(e))}catch{}}function Bhe(){try{return localStorage.getItem(ck)===`true`}catch{return!1}}function Vhe(){let[e,t]=(0,L.useState)(Bhe),n=(0,L.useCallback)(e=>{t(e);try{localStorage.setItem(ck,String(e))}catch{}},[]),r=(0,L.useCallback)(()=>{t(e=>{let t=!e;try{localStorage.setItem(ck,String(t))}catch{}return t})},[]);return(0,L.useEffect)(()=>{function e(e){e.shiftKey&&(e.ctrlKey||e.metaKey)&&e.key===`I`&&(e.preventDefault(),r())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),{isOpen:e,setOpen:n,toggle:r}}var Hhe=380,Uhe=48,Whe=`objectstack:ai-chat-agent`,uk=`__general__`;function Ghe(e){return(e.parts??[]).filter(e=>e.type===`text`).map(e=>e.text).join(``)}function Khe(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function qhe(e){if(!e||typeof e!=`object`)return``;let t=Object.entries(e);return t.length===0?``:t.slice(0,4).map(([e,t])=>{let n;try{n=typeof t==`string`?t:JSON.stringify(t)??String(t)}catch{n=String(t)}return`${e}: ${n.length>30?n.slice(0,30)+`…`:n}`}).join(`, `)}function Jhe(e){return e.type===`dynamic-tool`}function Yhe(e,t=80){let n;try{n=typeof e==`string`?e:JSON.stringify(e)??``}catch{n=String(e??``)}return n.length>t?n.slice(0,t)+`…`:n}function Xhe(e,t){return!t||t===`__general__`?`${e}/api/v1/ai/chat`:`${e}/api/v1/ai/agents/${t}/chat`}function Zhe(){try{return localStorage.getItem(`objectstack:ai-chat-agent`)??`__general__`}catch{return uk}}function dk(e){try{localStorage.setItem(Whe,e)}catch{}}function Qhe(e){let[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)(!0);return(0,L.useEffect)(()=>{let t=!1;return i(!0),fetch(`${e}/api/v1/ai/agents`,{credentials:`include`}).then(e=>e.ok?e.json():{agents:[]}).then(e=>{t||n(e.agents??[])}).catch(()=>{t||n([])}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),{agents:t,loading:r}}function $he({reasoning:e}){let[t,n]=(0,L.useState)(!1);return e.length===0?null:(0,B.jsxs)(`div`,{"data-testid":`reasoning-display`,className:`flex flex-col gap-1 rounded-md border border-border/30 bg-muted/30 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1.5 text-left text-muted-foreground hover:text-foreground transition-colors`,children:[t?(0,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(Tee,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(`span`,{className:`font-medium`,children:`Thinking`}),(0,B.jsxs)(`span`,{className:`text-[10px] opacity-60`,children:[`(`,e.length,` step`,e.length===1?``:`s`,`)`]})]}),t&&(0,B.jsx)(`div`,{className:`mt-1 space-y-1 pl-5 text-muted-foreground italic border-l-2 border-border/30`,children:e.map((e,t)=>(0,B.jsx)(`p`,{className:`text-[11px] leading-relaxed`,children:e},t))})]})}function ege({activeSteps:e,completedSteps:t}){if(e.size===0)return null;let n=t.length+e.size,r=t.length+1;return(0,B.jsxs)(`div`,{"data-testid":`step-progress`,className:`flex flex-col gap-1.5 rounded-md border border-blue-500/30 bg-blue-500/5 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Sm,{className:`h-3 w-3 shrink-0 text-blue-600 dark:text-blue-400`}),(0,B.jsxs)(`span`,{className:`font-medium text-blue-700 dark:text-blue-300`,children:[`Step `,r,` of `,n]})]}),Array.from(e.values()).map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 pl-5`,children:[(0,B.jsx)(Qp,{className:`h-3 w-3 shrink-0 animate-spin text-blue-600 dark:text-blue-400`}),(0,B.jsx)(`span`,{className:`text-blue-700 dark:text-blue-300`,children:e.stepName})]},t))]})}function tge({part:e,onApprove:t,onDeny:n}){let r=Khe(e.toolName),i=qhe(e.input);switch(e.state){case`input-streaming`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-planning`,className:`flex items-start gap-2 rounded-md border border-blue-500/40 bg-blue-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Qp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-blue-600 dark:text-blue-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium text-blue-700 dark:text-blue-300`,children:[`Planning to call `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-blue-600/80 dark:text-blue-300/80`,children:i})]})]});case`input-available`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-calling`,className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Qp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-primary`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Calling `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-muted-foreground`,children:i})]})]});case`approval-requested`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-confirm`,className:`flex flex-col gap-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(lm,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-yellow-600 dark:text-yellow-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Confirm: `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:i})]})]}),e.approval&&t&&n&&(0,B.jsxs)(`div`,{className:`flex gap-2 pl-5`,children:[(0,B.jsxs)(_h,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>t(e.approval.id),children:[(0,B.jsx)(Lp,{className:`mr-1 h-3 w-3`}),`Approve`]}),(0,B.jsxs)(_h,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs text-destructive hover:text-destructive`,onClick:()=>n(e.approval.id),children:[(0,B.jsx)(Rp,{className:`mr-1 h-3 w-3`}),`Deny`]})]})]});case`output-available`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-result`,className:`flex items-start gap-2 rounded-md border border-green-500/30 bg-green-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Lp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:r}),(0,B.jsx)(`p`,{className:`mt-0.5 text-muted-foreground truncate`,children:Yhe(e.output)})]})]});case`output-error`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-error`,className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Rp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[r,` failed`]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-destructive/80`,children:e.errorText})]})]});case`output-denied`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-denied`,className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Rp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,B.jsxs)(`span`,{className:`font-medium text-muted-foreground`,children:[r,` — denied`]})]});default:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-unknown`,className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(bm,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`font-medium`,children:r})]})}}function nge(){let{isOpen:e,setOpen:t,toggle:n}=Vhe(),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(Zhe),[s,c]=(0,L.useState)({reasoning:[],activeSteps:new Map,completedSteps:[]}),l=(0,L.useRef)(null),u=(0,L.useRef)(null),d=xx(),{agents:f,loading:p}=Qhe(d);(0,L.useEffect)(()=>{p||a!==`__general__`&&(f.some(e=>e.name===a)||(o(uk),dk(uk)))},[f,p,a]);let m=(0,L.useMemo)(()=>zhe(),[]),{messages:h,sendMessage:g,setMessages:_,status:v,error:y,addToolApprovalResponse:b}=ED({transport:(0,L.useMemo)(()=>new uD({api:Xhe(d,a)}),[d,a]),messages:m,onFinish:()=>{c({reasoning:[],activeSteps:new Map,completedSteps:[]})}}),x=v===`streaming`||v===`submitted`;(0,L.useEffect)(()=>{if(!x||h.length===0)return;let e=h[h.length-1];if(e.role!==`assistant`)return;let t=[],n=new Map,r=[];(e.parts||[]).forEach(e=>{e.type===`reasoning-delta`||e.type===`reasoning`?t.push(e.text):e.type===`step-start`?n.set(e.stepId,{stepName:e.stepName,startedAt:Date.now()}):e.type===`step-finish`&&r.push(e.stepName)}),c({reasoning:t,activeSteps:n,completedSteps:r})},[h,x]),(0,L.useEffect)(()=>{h.length>0&&lk(h)},[h]),(0,L.useEffect)(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[h]),(0,L.useEffect)(()=>{e&&u.current&&u.current.focus()},[e]);let S=()=>{_([]),lk([])},C=(0,L.useCallback)(e=>{o(e),dk(e),_([]),lk([])},[_]),w=()=>{let e=r.trim();!e||x||(i(``),g({text:e}))};return e?(0,B.jsxs)(`aside`,{"data-testid":`ai-chat-panel`,className:V(`fixed right-0 top-0 z-50 h-full`,`flex flex-col border-l border-border`,`bg-background shadow-xl`,`animate-in slide-in-from-right duration-200`),style:{width:Hhe},children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b`,children:[(0,B.jsxs)(`div`,{className:`flex h-12 items-center justify-between px-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,B.jsx)(jp,{className:`h-4 w-4 text-primary`}),`AI Chat`]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsxs)(_h,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:S,children:[(0,B.jsx)(gm,{className:`h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Clear chat`})]})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Clear history`})})]})}),(0,B.jsxs)(_h,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>t(!1),children:[(0,B.jsx)(xm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}),(0,B.jsx)(`div`,{className:`px-3 pb-2`,children:(0,B.jsxs)(ek,{value:a,onValueChange:C,disabled:p||x,children:[(0,B.jsx)(nk,{"data-testid":`agent-selector`,className:`h-8 text-xs`,children:(0,B.jsx)(tk,{placeholder:`Select agent…`})}),(0,B.jsxs)(ak,{children:[(0,B.jsx)(ok,{value:uk,children:`General Chat`}),f.map(e=>(0,B.jsx)(ok,{value:e.name,children:e.label},e.name))]})]})})]}),(0,B.jsx)($D,{className:`flex-1 overflow-hidden`,children:(0,B.jsxs)(`div`,{ref:l,className:`flex flex-col gap-3 p-3 overflow-y-auto h-full`,children:[h.length===0&&(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-12 text-center text-muted-foreground`,children:[(0,B.jsx)(dm,{className:`h-8 w-8 opacity-40`}),(0,B.jsx)(`p`,{className:`text-sm`,children:`Ask anything about your project.`}),(0,B.jsxs)(`p`,{className:`text-xs opacity-60`,children:[(0,B.jsx)(`kbd`,{children:`⌘⇧I`}),` to toggle this panel`]})]}),h.map(e=>{let t=Ghe(e),n=(e.parts??[]).filter(Jhe);return!(t||n.length>0)&&e.role!==`user`?null:(0,B.jsxs)(`div`,{className:V(`flex flex-col gap-1.5 rounded-lg px-3 py-2 text-sm`,e.role===`user`?`ml-8 bg-primary text-primary-foreground`:`mr-8 bg-muted text-foreground`),children:[(0,B.jsx)(`span`,{className:`text-[10px] font-medium opacity-60 uppercase`,children:e.role===`user`?`You`:`Assistant`}),t&&(0,B.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:t}),n.map(e=>(0,B.jsx)(tge,{part:e,onApprove:e=>b({id:e,approved:!0}),onDeny:e=>b({id:e,approved:!1,reason:`User denied the operation`})},e.toolCallId))]},e.id)}),x&&(0,B.jsxs)(B.Fragment,{children:[s.reasoning.length>0&&(0,B.jsx)(`div`,{className:`mr-8`,children:(0,B.jsx)($he,{reasoning:s.reasoning})}),s.activeSteps.size>0&&(0,B.jsx)(`div`,{className:`mr-8`,children:(0,B.jsx)(ege,{activeSteps:s.activeSteps,completedSteps:s.completedSteps})}),s.reasoning.length===0&&s.activeSteps.size===0&&(0,B.jsxs)(`div`,{className:`mr-8 flex items-center gap-2 rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`inline-block h-2 w-2 animate-pulse rounded-full bg-primary`}),`Thinking…`]})]}),y&&(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,B.jsx)(lm,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`font-medium`,children:`Chat Error`}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs opacity-80`,children:y.message||`Something went wrong`}),y.message&&/unexpected|json|parse|stream/i.test(y.message)&&(0,B.jsx)(`p`,{className:`mt-1 text-xs opacity-70`,children:`The server may not be returning the expected Vercel AI Data Stream format. Ensure the backend endpoint supports SSE streaming.`})]})]})]})}),(0,B.jsx)(`div`,{className:`shrink-0 border-t p-3`,children:(0,B.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,B.jsx)(`textarea`,{ref:u,"data-testid":`ai-chat-input`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),w())},placeholder:`Ask AI…`,rows:1,className:V(`flex-1 resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`max-h-32 min-h-[36px]`)}),(0,B.jsxs)(_h,{type:`button`,size:`icon`,className:`h-9 w-9 shrink-0`,disabled:!r.trim()||x,onClick:w,children:[(0,B.jsx)(cm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Send`})]})]})})]}):(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(`button`,{onClick:n,"data-testid":`ai-chat-toggle`,className:V(`fixed right-0 top-1/2 -translate-y-1/2 z-50`,`flex items-center justify-center`,`h-10 rounded-l-md border border-r-0 border-border`,`bg-background text-foreground shadow-md`,`hover:bg-accent transition-colors`),style:{width:Uhe},children:(0,B.jsx)(dm,{className:`h-5 w-5`})})}),(0,B.jsx)(Kv,{side:`left`,children:(0,B.jsxs)(`p`,{children:[`AI Chat `,(0,B.jsx)(`kbd`,{className:`ml-1 text-[10px] opacity-60`,children:`⌘⇧I`})]})})]})})}function rge(){return{plugins:new Map,viewers:new Map,panels:new Map,actions:new Map,commands:new Map,metadataIcons:new Map,activated:new Set}}var ige=class{state;listeners=new Set;constructor(){this.state=rge()}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getSnapshot(){return this.state}notify(){this.state={...this.state},this.listeners.forEach(e=>e())}register(e){let{id:t}=e.manifest;this.state.plugins.has(t)&&(console.warn(`[PluginRegistry] Plugin "${t}" is already registered, replacing.`),this.deactivate(t)),this.state.plugins.set(t,e),this.notify()}async registerAndActivate(e){this.register(e),await this.activate(e.manifest.id)}async activate(e){let t=this.state.plugins.get(e);if(!t){console.error(`[PluginRegistry] Cannot activate unknown plugin "${e}"`);return}if(this.state.activated.has(e))return;let n=this.createPluginAPI(e,t);try{await t.activate(n),this.state.activated.add(e),console.log(`[PluginRegistry] Activated plugin "${e}"`),this.notify()}catch(t){console.error(`[PluginRegistry] Failed to activate "${e}":`,t)}}deactivate(e){let t=this.state.plugins.get(e);if(t){try{t.deactivate?.()}catch(t){console.error(`[PluginRegistry] Error deactivating "${e}":`,t)}for(let[t,n]of this.state.viewers)n.pluginId===e&&this.state.viewers.delete(t);for(let[t,n]of this.state.panels)n.pluginId===e&&this.state.panels.delete(t);for(let[t,n]of this.state.actions)n.pluginId===e&&this.state.actions.delete(t);for(let[t,n]of this.state.commands)n.pluginId===e&&this.state.commands.delete(t);for(let[e,n]of this.state.metadataIcons)n.metadataType&&t.manifest.contributes.metadataIcons?.some(t=>t.metadataType===e)&&this.state.metadataIcons.delete(e);this.state.activated.delete(e),this.state.plugins.delete(e),this.notify()}}getViewer(e,t=`preview`){let n=null;for(let r of this.state.viewers.values())!r.metadataTypes.includes(e)&&!r.metadataTypes.includes(`*`)||r.modes.includes(t)&&(!n||r.priority>n.priority)&&(n=r);return n}getViewers(e){return Array.from(this.state.viewers.values()).filter(t=>t.metadataTypes.includes(e)||t.metadataTypes.includes(`*`)).sort((e,t)=>t.priority-e.priority)}getAvailableModes(e){let t=new Set;for(let n of this.state.viewers.values())(n.metadataTypes.includes(e)||n.metadataTypes.includes(`*`))&&n.modes.forEach(e=>t.add(e));return Array.from(t)}getActions(e,t){return Array.from(this.state.actions.values()).filter(n=>t&&n.location!==t?!1:n.metadataTypes.length===0||n.metadataTypes.includes(e))}getCommands(){return Array.from(this.state.commands.values())}getPanels(e){return Array.from(this.state.panels.values()).filter(t=>!e||t.location===e)}getPlugins(){return Array.from(this.state.plugins.values())}getSidebarGroups(){let e=new Map;for(let t of this.state.plugins.values())for(let n of t.manifest.contributes.sidebarGroups){let t=e.get(n.key);if(t){let e=new Set([...t.metadataTypes,...n.metadataTypes]);t.metadataTypes=Array.from(e),n.ordere.order-t.order)}getMetadataIcon(e){return this.state.metadataIcons.get(e)||null}getAllMetadataIcons(){return new Map(this.state.metadataIcons)}isActivated(e){return this.state.activated.has(e)}createPluginAPI(e,t){let n=this;return{registerViewer(r,i){let a=t.manifest.contributes.metadataViewers.find(e=>e.id===r);if(!a){console.warn(`[PluginRegistry] Viewer "${r}" not declared in manifest of "${e}"`);return}let o={id:r,pluginId:e,label:a.label,metadataTypes:a.metadataTypes,modes:a.modes,priority:a.priority,component:i};n.state.viewers.set(r,o),n.notify()},registerPanel(r,i){let a=t.manifest.contributes.panels.find(e=>e.id===r);if(!a){console.warn(`[PluginRegistry] Panel "${r}" not declared in manifest of "${e}"`);return}n.state.panels.set(r,{id:r,pluginId:e,label:a.label,icon:a.icon,location:a.location,component:i}),n.notify()},registerAction(r,i){let a=t.manifest.contributes.actions.find(e=>e.id===r);if(!a){console.warn(`[PluginRegistry] Action "${r}" not declared in manifest of "${e}"`);return}n.state.actions.set(r,{id:r,pluginId:e,label:a.label,icon:a.icon,location:a.location,metadataTypes:a.metadataTypes,handler:i}),n.notify()},registerCommand(r,i){let a=t.manifest.contributes.commands.find(e=>e.id===r);if(!a){console.warn(`[PluginRegistry] Command "${r}" not declared in manifest of "${e}"`);return}n.state.commands.set(r,{id:r,pluginId:e,label:a.label,shortcut:a.shortcut,icon:a.icon,handler:i}),n.notify()},registerMetadataIcon(e,r,i){let a=t.manifest.contributes.metadataIcons.find(t=>t.metadataType===e);n.state.metadataIcons.set(e,{metadataType:e,label:i||a?.label||e,icon:r}),n.notify()}}}},fk=null;function age(){return fk||=new ige,fk}var pk=(0,L.createContext)(null);function mk(){let e=(0,L.useContext)(pk);if(!e)throw Error(`usePluginRegistry must be used within a `);return e}function oge({plugins:e=[],registry:t,children:n}){let r=(0,L.useMemo)(()=>t||age(),[t]),[i,a]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{let t=!1;async function n(){for(let n of e){if(t)break;try{await r.registerAndActivate(n)}catch(e){console.error(`[PluginRegistryProvider] Failed to init plugin "${n.manifest.id}":`,e)}}t||a(!0)}return n(),()=>{t=!0}},[r,e]),i?(0,B.jsx)(pk.Provider,{value:r,children:n}):(0,B.jsx)(pk.Provider,{value:r,children:(0,B.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,B.jsx)(`div`,{className:`h-8 w-8 mx-auto animate-spin rounded-full border-4 border-muted border-t-primary`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading plugins…`})]})})})}function hk(){let e=mk();return(0,L.useSyncExternalStore)((0,L.useCallback)(t=>e.subscribe(t),[e]),(0,L.useCallback)(()=>e.getSnapshot(),[e]))}function sge(e,t=`preview`){let n=mk();return hk(),(0,L.useMemo)(()=>n.getViewer(e,t),[n,e,t])}function cge(e){let t=mk();return hk(),(0,L.useMemo)(()=>t.getViewers(e),[t,e])}function lge(e){let t=mk();return hk(),(0,L.useMemo)(()=>t.getAvailableModes(e),[t,e])}function uge(e,t){let n=mk();return hk(),(0,L.useMemo)(()=>n.getActions(e,t),[n,e,t])}var dge={preview:{icon:Wp,label:`Preview`},design:{icon:Hee,label:`Design`},code:{icon:Bp,label:`Code`},data:{icon:mm,label:`Data`}};function gk({metadataType:e,metadataName:t,data:n,packageId:r}){let[i,a]=(0,L.useState)(`preview`),o=lge(e),s=cge(e),c=sge(e,i),l=uge(e,`toolbar`),u=o.includes(i)?i:o[0]||`preview`,d=(0,L.useMemo)(()=>s.filter(e=>e.modes.includes(u)),[s,u]),[f,p]=(0,L.useState)(0),m=d[f]||c;if(!m)return(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,B.jsxs)(`p`,{className:`text-sm`,children:[`No viewer available for `,(0,B.jsx)(yx,{variant:`outline`,children:e})]}),(0,B.jsx)(`p`,{className:`text-xs`,children:`Install a plugin that supports this metadata type.`})]})});let h=m.component;return(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 border-b px-4 bg-muted/30 min-h-10`,children:[(0,B.jsx)(`div`,{className:`flex items-center gap-0.5`,children:o.map(e=>{let t=dge[e],n=t.icon;return(0,B.jsxs)(`button`,{onClick:()=>{a(e),p(0)},className:` + flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-colors + ${e===u?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`} + `,children:[(0,B.jsx)(n,{className:`h-3.5 w-3.5`}),t.label]},e)})}),d.length>1&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border`}),(0,B.jsxs)(ex,{children:[(0,B.jsx)(tx,{asChild:!0,children:(0,B.jsxs)(_h,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 text-xs`,children:[m.label,(0,B.jsx)(Pp,{className:`h-3 w-3`})]})}),(0,B.jsx)(nx,{align:`start`,children:d.map((e,t)=>(0,B.jsxs)(rx,{onClick:()=>p(t),className:t===f?`bg-accent`:``,children:[(0,B.jsx)(`span`,{className:`text-xs`,children:e.label}),(0,B.jsx)(yx,{variant:`outline`,className:`ml-2 text-[10px]`,children:e.pluginId})]},e.id))})]})]}),(0,B.jsx)(`div`,{className:`flex-1`}),l.map(r=>(0,B.jsx)(_h,{variant:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:()=>r.handler({metadataType:e,metadataName:t,data:n}),children:r.label},r.id)),(0,B.jsx)(yx,{variant:`secondary`,className:`text-[10px] font-mono`,children:m.pluginId})]}),(0,B.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,B.jsx)(h,{metadataType:e,metadataName:t,data:n,mode:u,packageId:r})})]})}var fge=E([`preview`,`design`,`code`,`data`]),pge=h({id:r().describe(`Unique viewer identifier`),metadataTypes:C(r()).min(1).describe(`Metadata types this viewer can handle`),label:r().describe(`Viewer display label`),priority:P().default(0).describe(`Viewer priority (higher wins)`),modes:C(fge).default([`preview`]).describe(`Supported view modes`)}),mge=h({key:r().describe(`Unique group key`),label:r().describe(`Group display label`),icon:r().optional().describe(`Lucide icon name`),metadataTypes:C(r()).describe(`Metadata types in this group`),order:P().default(100).describe(`Sort order (lower = higher)`)}),hge=E([`toolbar`,`contextMenu`,`commandPalette`]),gge=h({id:r().describe(`Unique action identifier`),label:r().describe(`Action display label`),icon:r().optional().describe(`Lucide icon name`),location:hge.describe(`UI location`),metadataTypes:C(r()).default([]).describe(`Applicable metadata types`)}),_ge=h({metadataType:r().describe(`Metadata type`),label:r().describe(`Display label`),icon:r().describe(`Lucide icon name`)}),vge=E([`bottom`,`right`,`modal`]),yge=h({id:r().describe(`Unique panel identifier`),label:r().describe(`Panel display label`),icon:r().optional().describe(`Lucide icon name`),location:vge.default(`bottom`).describe(`Panel location`)}),bge=h({id:r().describe(`Unique command identifier`),label:r().describe(`Command display label`),shortcut:r().optional().describe(`Keyboard shortcut`),icon:r().optional().describe(`Lucide icon name`)}),xge=h({metadataViewers:C(pge).default([]),sidebarGroups:C(mge).default([]),actions:C(gge).default([]),metadataIcons:C(_ge).default([]),panels:C(yge).default([]),commands:C(bge).default([])}),Sge=r().describe(`Activation event pattern`),Cge=h({id:r().regex(/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/).describe(`Plugin ID (dot-separated lowercase)`),name:r().describe(`Plugin display name`),version:r().default(`0.0.1`).describe(`Plugin version`),description:r().optional().describe(`Plugin description`),author:r().optional().describe(`Author`),contributes:xge.default({metadataViewers:[],sidebarGroups:[],actions:[],metadataIcons:[],panels:[],commands:[]}),activationEvents:C(Sge).default([`*`])});function _k(e){return Cge.parse(e)}var wge=h({key:r().describe(`Section key (e.g., "basics", "constraints", "security")`),label:r().describe(`Section display label`),icon:r().optional().describe(`Lucide icon name`),defaultExpanded:S().default(!0).describe(`Whether section is expanded by default`),order:P().default(0).describe(`Sort order (lower = higher)`)}),Tge=h({key:r().describe(`Group key matching field.group values`),label:r().describe(`Group display label`),icon:r().optional().describe(`Lucide icon name`),defaultExpanded:S().default(!0).describe(`Whether group is expanded by default`),order:P().default(0).describe(`Sort order (lower = higher)`)}),Ege=h({inlineEditing:S().default(!0).describe(`Enable inline editing of field properties`),dragReorder:S().default(!0).describe(`Enable drag-and-drop field reordering`),showFieldGroups:S().default(!0).describe(`Show field group headers`),showPropertyPanel:S().default(!0).describe(`Show the right-side property panel`),propertySections:C(wge).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:C(Tge).default([]).describe(`Field group definitions`),paginationThreshold:P().default(50).describe(`Number of fields before pagination is enabled`),batchOperations:S().default(!0).describe(`Enable batch add/remove field operations`),showUsageStats:S().default(!1).describe(`Show field usage statistics`)}),Dge=h({type:E([`lookup`,`master_detail`,`tree`]).describe(`Relationship type`),lineStyle:E([`solid`,`dashed`,`dotted`]).default(`solid`).describe(`Line style in diagrams`),color:r().default(`#94a3b8`).describe(`Line color (CSS value)`),highlightColor:r().default(`#0891b2`).describe(`Highlighted color on hover/select`),cardinalityLabel:r().default(`1:N`).describe(`Cardinality label (e.g., "1:N", "1:1", "N:M")`)}),Oge=h({visualCreation:S().default(!0).describe(`Enable drag-to-create relationships`),showReverseRelationships:S().default(!0).describe(`Show reverse/child-to-parent relationships`),showCascadeWarnings:S().default(!0).describe(`Show cascade delete behavior warnings`),displayConfig:C(Dge).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`)}),kge=E([`force`,`hierarchy`,`grid`,`circular`]).describe(`ER diagram layout algorithm`),Age=h({showFields:S().default(!0).describe(`Show field list inside entity nodes`),maxFieldsVisible:P().default(8).describe(`Max fields visible before "N more..." collapse`),showFieldTypes:S().default(!0).describe(`Show field type badges`),showRequiredIndicator:S().default(!0).describe(`Show required field indicators`),showRecordCount:S().default(!1).describe(`Show live record count on nodes`),showIcon:S().default(!0).describe(`Show object icon on node header`),showDescription:S().default(!0).describe(`Show description tooltip on hover`)}),jge=h({enabled:S().default(!0).describe(`Enable ER diagram panel`),layout:kge.default(`force`).describe(`Default layout algorithm`),nodeDisplay:Age.default({showFields:!0,maxFieldsVisible:8,showFieldTypes:!0,showRequiredIndicator:!0,showRecordCount:!1,showIcon:!0,showDescription:!0}).describe(`Node display configuration`),showMinimap:S().default(!0).describe(`Show minimap for large diagrams`),zoomControls:S().default(!0).describe(`Show zoom in/out/fit controls`),minZoom:P().default(.1).describe(`Minimum zoom level`),maxZoom:P().default(3).describe(`Maximum zoom level`),showEdgeLabels:S().default(!0).describe(`Show cardinality labels on relationship edges`),highlightOnHover:S().default(!0).describe(`Highlight connected entities on node hover`),clickToNavigate:S().default(!0).describe(`Click node to navigate to object detail`),dragToConnect:S().default(!0).describe(`Drag between nodes to create relationships`),hideOrphans:S().default(!1).describe(`Hide objects with no relationships`),autoFit:S().default(!0).describe(`Auto-fit diagram to viewport on load`),exportFormats:C(E([`png`,`svg`,`json`])).default([`png`,`svg`]).describe(`Available export formats for diagram`)}),Mge=E([`table`,`cards`,`tree`]).describe(`Object list display mode`),Nge=E([`name`,`label`,`fieldCount`,`updatedAt`]).describe(`Object list sort field`),Pge=h({package:r().optional().describe(`Filter by owning package`),tags:C(r()).optional().describe(`Filter by object tags`),includeSystem:S().default(!0).describe(`Include system-level objects`),includeAbstract:S().default(!1).describe(`Include abstract base objects`),hasFieldType:r().optional().describe(`Filter to objects containing a specific field type`),hasRelationships:S().optional().describe(`Filter to objects with lookup/master_detail fields`),searchQuery:r().optional().describe(`Free-text search across name, label, and description`)}),Fge=h({defaultDisplayMode:Mge.default(`table`).describe(`Default list display mode`),defaultSortField:Nge.default(`label`).describe(`Default sort field`),defaultSortDirection:E([`asc`,`desc`]).default(`asc`).describe(`Default sort direction`),defaultFilter:Pge.default({includeSystem:!0,includeAbstract:!1}).describe(`Default filter configuration`),showFieldCount:S().default(!0).describe(`Show field count badge`),showRelationshipCount:S().default(!0).describe(`Show relationship count badge`),showQuickPreview:S().default(!0).describe(`Show quick field preview tooltip on hover`),enableComparison:S().default(!1).describe(`Enable side-by-side object comparison`),showERDiagramToggle:S().default(!0).describe(`Show ER diagram toggle in toolbar`),showCreateAction:S().default(!0).describe(`Show create object action`),showStatsSummary:S().default(!0).describe(`Show statistics summary bar`)}),Ige=h({tabs:C(h({key:r().describe(`Tab key`),label:r().describe(`Tab display label`),icon:r().optional().describe(`Lucide icon name`),enabled:S().default(!0).describe(`Whether this tab is available`),order:P().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:r().default(`fields`).describe(`Default active tab key`),showHeader:S().default(!0).describe(`Show object summary header`),showBreadcrumbs:S().default(!0).describe(`Show navigation breadcrumbs`)});h({defaultView:E([`field-editor`,`relationship-mapper`,`er-diagram`,`object-manager`]).describe(`Default view when entering the Object Designer`).default(`field-editor`).describe(`Default view`),fieldEditor:Ege.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:Oge.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:jge.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:Fge.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:Ige.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 Lge=h({enabled:S().default(!0).describe(`Enable snap-to-grid`),gridSize:P().int().min(1).default(8).describe(`Snap grid size in pixels`),showGrid:S().default(!0).describe(`Show grid overlay on canvas`),showGuides:S().default(!0).describe(`Show alignment guides when dragging`)}),Rge=h({min:P().min(.1).default(.25).describe(`Minimum zoom level`),max:P().max(10).default(3).describe(`Maximum zoom level`),default:P().default(1).describe(`Default zoom level`),step:P().default(.1).describe(`Zoom step increment`)}),zge=h({type:r().describe(`Component type (e.g. "element:button", "element:text")`),label:r().describe(`Display label in palette`),icon:r().optional().describe(`Icon name for palette display`),category:E([`content`,`interactive`,`data`,`layout`]).describe(`Palette category grouping`),defaultWidth:P().int().min(1).default(4).describe(`Default width in grid columns`),defaultHeight:P().int().min(1).default(2).describe(`Default height in grid rows`)});h({snap:Lge.optional().describe(`Canvas snap settings`),zoom:Rge.optional().describe(`Canvas zoom settings`),palette:C(zge).optional().describe(`Custom element palette (defaults to all registered elements)`),showLayerPanel:S().default(!0).describe(`Show layer ordering panel`),showPropertyPanel:S().default(!0).describe(`Show property inspector panel`),undoLimit:P().int().min(1).default(50).describe(`Maximum undo history steps`)});var Bge=E([`rounded_rect`,`circle`,`diamond`,`parallelogram`,`hexagon`,`diamond_thick`,`attached_circle`,`screen_rect`]).describe(`Visual shape for rendering a flow node on the canvas`),Vge=h({action:r().describe(`FlowNodeAction value (e.g., "parallel_gateway")`),shape:Bge.describe(`Shape to render`),icon:r().describe(`Lucide icon name`),defaultLabel:r().describe(`Default display label`),defaultWidth:P().int().min(20).default(120).describe(`Default width in pixels`),defaultHeight:P().int().min(20).default(60).describe(`Default height in pixels`),fillColor:r().default(`#ffffff`).describe(`Node fill color (CSS value)`),borderColor:r().default(`#94a3b8`).describe(`Node border color (CSS value)`),allowBoundaryEvents:S().default(!1).describe(`Whether boundary events can be attached to this node type`),paletteCategory:E([`event`,`gateway`,`activity`,`data`,`subflow`]).describe(`Palette category for grouping`)}).describe(`Visual render descriptor for a flow node type`);h({nodeId:r().describe(`Corresponding FlowNode.id`),x:P().describe(`X position on canvas`),y:P().describe(`Y position on canvas`),width:P().int().min(20).optional().describe(`Width override in pixels`),height:P().int().min(20).optional().describe(`Height override in pixels`),collapsed:S().default(!1).describe(`Whether the node is collapsed`),fillColor:r().optional().describe(`Fill color override`),borderColor:r().optional().describe(`Border color override`),annotation:r().optional().describe(`User annotation displayed near the node`)}).describe(`Canvas layout data for a flow node`);var Hge=E([`solid`,`dashed`,`dotted`,`bold`]).describe(`Edge line style`);h({edgeId:r().describe(`Corresponding FlowEdge.id`),style:Hge.default(`solid`).describe(`Line style`),color:r().default(`#94a3b8`).describe(`Edge line color`),labelPosition:P().min(0).max(1).default(.5).describe(`Position of the condition label along the edge`),waypoints:C(h({x:P().describe(`Waypoint X`),y:P().describe(`Waypoint Y`)})).optional().describe(`Manual waypoints for edge routing`),animated:S().default(!1).describe(`Show animated flow indicator`)}).describe(`Canvas layout and visual data for a flow edge`);var Uge=E([`dagre`,`elk`,`force`,`manual`]).describe(`Auto-layout algorithm for the flow canvas`),Wge=E([`TB`,`BT`,`LR`,`RL`]).describe(`Auto-layout direction`);h({snap:h({enabled:S().default(!0).describe(`Enable snap-to-grid`),gridSize:P().int().min(1).default(16).describe(`Snap grid size in pixels`),showGrid:S().default(!0).describe(`Show grid overlay`)}).default({enabled:!0,gridSize:16,showGrid:!0}).describe(`Canvas snap-to-grid settings`),zoom:h({min:P().min(.1).default(.25).describe(`Minimum zoom level`),max:P().max(10).default(3).describe(`Maximum zoom level`),default:P().default(1).describe(`Default zoom level`),step:P().default(.1).describe(`Zoom step`)}).default({min:.25,max:3,default:1,step:.1}).describe(`Canvas zoom settings`),layoutAlgorithm:Uge.default(`dagre`).describe(`Default auto-layout algorithm`),layoutDirection:Wge.default(`TB`).describe(`Default auto-layout direction`),nodeDescriptors:C(Vge).optional().describe(`Custom node render descriptors (merged with built-in defaults)`),showMinimap:S().default(!0).describe(`Show minimap panel`),showPropertyPanel:S().default(!0).describe(`Show property panel`),showPalette:S().default(!0).describe(`Show node palette sidebar`),undoLimit:P().int().min(1).default(50).describe(`Maximum undo history steps`),animateExecution:S().default(!0).describe(`Animate edges during execution preview`),connectionValidation:S().default(!0).describe(`Validate connections before creating edges`)}).describe(`Studio Flow Builder configuration`);var vk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,B.jsx)(`table`,{ref:n,className:V(`w-full caption-bottom text-sm`,e),...t})}));vk.displayName=`Table`;var yk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`thead`,{ref:n,className:V(`[&_tr]:border-b`,e),...t}));yk.displayName=`TableHeader`;var bk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`tbody`,{ref:n,className:V(`[&_tr:last-child]:border-0`,e),...t}));bk.displayName=`TableBody`;var Gge=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`tfoot`,{ref:n,className:V(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,e),...t}));Gge.displayName=`TableFooter`;var xk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`tr`,{ref:n,className:V(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));xk.displayName=`TableRow`;var Sk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`th`,{ref:n,className:V(`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}));Sk.displayName=`TableHead`;var Ck=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`td`,{ref:n,className:V(`p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));Ck.displayName=`TableCell`;var Kge=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`caption`,{ref:n,className:V(`mt-4 text-sm text-muted-foreground`,e),...t}));Kge.displayName=`TableCaption`;function qge({value:e,type:t}){if(e==null)return(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`—`});if(t===`boolean`)return e?(0,B.jsxs)(yx,{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,B.jsx)(Np,{className:`h-3 w-3`}),` Yes`]}):(0,B.jsxs)(yx,{variant:`secondary`,className:`gap-1`,children:[(0,B.jsx)(xm,{className:`h-3 w-3`}),` No`]});if(t===`number`)return(0,B.jsx)(`span`,{className:`font-mono text-sm tabular-nums`,children:e});if(t===`select`)return(0,B.jsx)(yx,{variant:`outline`,children:String(e)});let n=String(e);return n.length>50?(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsxs)(`span`,{className:`cursor-default`,children:[n.slice(0,50),`…`]})}),(0,B.jsx)(Kv,{className:`max-w-sm`,children:(0,B.jsx)(`p`,{className:`text-xs`,children:n})})]})}):(0,B.jsx)(`span`,{children:n})}function Jge({cols:e}){return(0,B.jsx)(B.Fragment,{children:Array.from({length:3}).map((t,n)=>(0,B.jsx)(xk,{children:Array.from({length:e+1}).map((e,t)=>(0,B.jsx)(Ck,{children:(0,B.jsx)(Yg,{className:`h-4 w-full`})},t))},n))})}function Yge({objectApiName:e,onEdit:t}){let n=_p(),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)([]),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(1),[d,f]=(0,L.useState)(0),[p,m]=(0,L.useState)(``);(0,L.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,L.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||(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||(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||(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,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{children:[(0,B.jsx)(Yg,{className:`h-6 w-48`}),(0,B.jsx)(Yg,{className:`h-4 w-32 mt-1`})]}),(0,B.jsx)(Ex,{children:(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{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,B.jsxs)(Sx,{className:`flex flex-col shadow-sm`,children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(wx,{className:`text-xl font-semibold tracking-tight`,children:r.label}),(0,B.jsxs)(Tx,{children:[d>0?d:a.length,` records • `,(0,B.jsx)(`code`,{className:`text-xs bg-muted px-1 py-0.5 rounded`,children:r.name})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,onClick:g,className:`gap-1.5`,children:[(0,B.jsx)(om,{className:`h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:`Refresh`})]}),(0,B.jsxs)(_h,{onClick:()=>t({}),size:`sm`,className:`gap-1.5`,children:[(0,B.jsx)(am,{className:`h-3.5 w-3.5`}),`New `,r.label]})]})]}),(0,B.jsxs)(`div`,{className:`relative mt-3`,children:[(0,B.jsx)(sm,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(vh,{placeholder:`Search ${r.label.toLowerCase()}...`,value:p,onChange:e=>m(e.target.value),className:`pl-9 h-9`})]})]}),(0,B.jsx)(Ex,{className:`p-0`,children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(vk,{children:[(0,B.jsx)(yk,{children:(0,B.jsxs)(xk,{className:`hover:bg-transparent`,children:[v.map(e=>(0,B.jsx)(Sk,{className:`font-medium whitespace-nowrap`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.label,(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] px-1 py-0 font-normal opacity-50 hidden lg:inline-flex`,children:e.type})]})},e.name)),(0,B.jsx)(Sk,{className:`w-15 sticky right-0 bg-background`})]})}),(0,B.jsxs)(bk,{children:[s&&a.length===0?(0,B.jsx)(Jge,{cols:v.length}):y.map(e=>(0,B.jsxs)(xk,{className:`group`,children:[v.map(t=>(0,B.jsx)(Ck,{className:`py-2.5`,children:(0,B.jsx)(qge,{value:e[t.name],type:t.type})},t.name)),(0,B.jsx)(Ck,{className:`py-2.5 sticky right-0 bg-background`,children:(0,B.jsxs)(ex,{children:[(0,B.jsx)(tx,{asChild:!0,children:(0,B.jsxs)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,B.jsx)(Pee,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Actions`})]})}),(0,B.jsxs)(nx,{align:`end`,children:[(0,B.jsxs)(rx,{onClick:()=>t(e),children:[(0,B.jsx)(qee,{className:`mr-2 h-4 w-4`}),`Edit`]}),(0,B.jsx)(ax,{}),(0,B.jsxs)(rx,{onClick:()=>h(e.id),className:`text-destructive focus:text-destructive`,children:[(0,B.jsx)(gm,{className:`mr-2 h-4 w-4`}),`Delete`]})]})]})})]},e.id)),!s&&y.length===0&&(0,B.jsx)(xk,{children:(0,B.jsx)(Ck,{colSpan:v.length+1,className:`h-32 text-center`,children:(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 text-muted-foreground`,children:[(0,B.jsx)(sm,{className:`h-8 w-8 opacity-30`}),(0,B.jsx)(`span`,{className:`text-sm font-medium`,children:`No records found`}),(0,B.jsx)(`span`,{className:`text-xs`,children:p?`Try a different search term`:`Create your first record to get started`})]})})})]})]})})}),(0,B.jsxs)(Dx,{className:`py-3 px-4 border-t flex justify-between items-center`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Page `,l,` of `,b]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,disabled:l===1,onClick:()=>u(e=>Math.max(1,e-1)),className:`h-8 gap-1`,children:[(0,B.jsx)(Cee,{className:`h-3.5 w-3.5`}),`Previous`]}),(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,disabled:l>=b,onClick:()=>u(e=>e+1),className:`h-8 gap-1`,children:[`Next`,(0,B.jsx)(kp,{className:`h-3.5 w-3.5`})]})]})]})]})}var Xge={text:Yee,textarea:Kp,number:Jp,boolean:Jee,select:zee,lookup:Zp,formula:Eee,date:Dee,datetime:Dee,autonumber:Jp},Zge={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 Qge({text:e}){let[t,n]=(0,L.useState)(!1);return(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{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,B.jsx)(Np,{className:`h-3 w-3 text-emerald-500`}):(0,B.jsx)(Vp,{className:`h-3 w-3`})})}),(0,B.jsx)(Kv,{children:`Copy field name`})]})})}function $ge({objectApiName:e}){let t=_p(),[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(!0),[o,s]=(0,L.useState)(``);if((0,L.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,B.jsxs)(Sx,{children:[(0,B.jsx)(Cx,{children:(0,B.jsx)(Yg,{className:`h-6 w-48`})}),(0,B.jsxs)(Ex,{className:`space-y-3`,children:[(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`})]})]});if(!n)return(0,B.jsx)(Sx,{children:(0,B.jsxs)(Ex,{className:`py-12 text-center text-muted-foreground`,children:[`Object definition not found: `,(0,B.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,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(Sx,{children:[(0,B.jsx)(Cx,{className:`pb-3`,children:(0,B.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(wx,{className:`text-xl`,children:n.label}),d&&(0,B.jsx)(yx,{variant:`secondary`,className:`font-mono text-xs`,children:d})]}),(0,B.jsxs)(Tx,{className:`flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:u}),(0,B.jsx)(`span`,{children:`·`}),(0,B.jsxs)(`span`,{children:[l.length,` fields`]}),p&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:`·`}),(0,B.jsxs)(`span`,{className:`text-xs`,children:[`owned by `,(0,B.jsx)(`code`,{className:`font-mono`,children:p})]})]})]})]})})}),d&&(0,B.jsx)(Ex,{className:`pt-0 pb-3`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground bg-muted/50 rounded-md px-3 py-2`,children:[(0,B.jsx)(Up,{className:`h-3.5 w-3.5`}),(0,B.jsxs)(`span`,{children:[`Namespace: `,(0,B.jsx)(`strong`,{children:d}),` · Short name: `,(0,B.jsx)(`strong`,{children:f}),` · Table: `,(0,B.jsx)(`code`,{className:`font-mono bg-muted px-1 rounded`,children:u})]})]})})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(wx,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(Bp,{className:`h-4 w-4`}),`Field Definitions`]}),(0,B.jsxs)(yx,{variant:`secondary`,className:`text-xs`,children:[m.length,` / `,l.length]})]}),(0,B.jsxs)(`div`,{className:`relative mt-2`,children:[(0,B.jsx)(sm,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(vh,{placeholder:`Filter fields by name, label, or type...`,value:o,onChange:e=>s(e.target.value),className:`pl-9 h-8 text-sm`})]})]}),(0,B.jsx)(Ex,{className:`p-0`,children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(vk,{children:[(0,B.jsx)(yk,{children:(0,B.jsxs)(xk,{className:`hover:bg-transparent`,children:[(0,B.jsx)(Sk,{className:`w-8`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Field Name`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Label`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Type`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Required`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Details`})]})}),(0,B.jsxs)(bk,{children:[m.map((e,t)=>{let n=Xge[e.type]||jee,r=Zge[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,B.jsxs)(xk,{className:`group`,children:[(0,B.jsx)(Ck,{className:`py-2 text-center text-xs text-muted-foreground tabular-nums`,children:t+1}),(0,B.jsx)(Ck,{className:`py-2`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`code`,{className:`font-mono text-sm font-medium`,children:e.name}),(0,B.jsx)(Qge,{text:e.name}),e.required&&(0,B.jsx)(Lee,{className:`h-3 w-3 text-amber-500`})]})}),(0,B.jsx)(Ck,{className:`py-2 text-sm`,children:e.label}),(0,B.jsx)(Ck,{className:`py-2`,children:(0,B.jsxs)(yx,{variant:`outline`,className:`gap-1 text-xs ${r}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),e.type,e.multiple&&`[]`]})}),(0,B.jsx)(Ck,{className:`py-2`,children:e.required?(0,B.jsx)(yx,{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,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Optional`})}),(0,B.jsx)(Ck,{className:`py-2`,children:(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.reference&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] font-mono gap-1`,children:[(0,B.jsx)(Zp,{className:`h-2.5 w-2.5`}),` → `,e.reference]}),e.defaultValue!==void 0&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] font-mono`,children:[`default: `,JSON.stringify(e.defaultValue)]}),e.maxLength&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] font-mono`,children:[`max: `,e.maxLength]}),e.options&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px]`,children:[e.options.length,` options`]}),e.formula&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] font-mono`,children:[`ƒ `,String(e.formula).slice(0,30)]})]})})]},e.name)}),m.length===0&&(0,B.jsx)(xk,{children:(0,B.jsx)(Ck,{colSpan:6,className:`h-24 text-center text-muted-foreground text-sm`,children:o?`No fields matching filter`:`No fields defined`})})]})]})})})]})]})}var wk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`textarea`,{className:V(`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}));wk.displayName=`Textarea`;var e_e=`Label`,Tk=L.forwardRef((e,t)=>(0,B.jsx)(Qte.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Tk.displayName=e_e;var Ek=Tk,t_e=Pm(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Dk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Ek,{ref:n,className:V(t_e(),e),...t}));Dk.displayName=Ek.displayName;var Ok=`Switch`,[n_e,r_e]=xh(Ok),[i_e,a_e]=n_e(Ok),kk=L.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]=L.useState(null),m=Tm(t,e=>p(e)),h=L.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=wh({prop:i,defaultProp:a??!1,onChange:l,caller:Ok});return(0,B.jsxs)(i_e,{scope:n,checked:_,disabled:s,children:[(0,B.jsx)(Eh.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":Nk(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:H(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,B.jsx)(Mk,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});kk.displayName=Ok;var Ak=`SwitchThumb`,jk=L.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=a_e(Ak,n);return(0,B.jsx)(Eh.span,{"data-state":Nk(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});jk.displayName=Ak;var o_e=`SwitchBubbleInput`,Mk=L.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=L.useRef(null),s=Tm(o,a),c=tO(n),l=sv(t);return L.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,B.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}})});Mk.displayName=o_e;function Nk(e){return e?`checked`:`unchecked`}var Pk=kk,s_e=jk,Fk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Pk,{className:V(`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,B.jsx)(s_e,{className:V(`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`)})}));Fk.displayName=Pk.displayName;var Ik=Bg,c_e=Vg,Lk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Hg,{ref:n,className:V(`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}));Lk.displayName=Hg.displayName;var Rk=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(c_e,{children:[(0,B.jsx)(Lk,{}),(0,B.jsxs)(Ug,{ref:r,className:V(`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,B.jsxs)(Kg,{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,B.jsx)(xm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Rk.displayName=Ug.displayName;var zk=({className:e,...t})=>(0,B.jsx)(`div`,{className:V(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});zk.displayName=`DialogHeader`;var Bk=({className:e,...t})=>(0,B.jsx)(`div`,{className:V(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Bk.displayName=`DialogFooter`;var Vk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Wg,{ref:n,className:V(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Vk.displayName=Wg.displayName;var Hk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Gg,{ref:n,className:V(`text-sm text-muted-foreground`,e),...t}));Hk.displayName=Gg.displayName;function l_e({objectApiName:e,record:t,onSuccess:n,onCancel:r}){let i=_p(),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)({}),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null);(0,L.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,B.jsx)(Ik,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Rk,{className:`sm:max-w-lg`,children:[(0,B.jsxs)(zk,{children:[(0,B.jsx)(Vk,{children:`Loading...`}),(0,B.jsx)(Hk,{children:`Fetching object definition`})]}),(0,B.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,B.jsx)(Qp,{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,B.jsx)(Ik,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Rk,{className:`sm:max-w-lg max-h-[85vh] flex flex-col p-0 gap-0`,children:[(0,B.jsxs)(zk,{className:`px-6 pt-6 pb-4 border-b`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(Vk,{className:`text-lg`,children:[_?`Edit`:`New`,` `,a.label]}),(0,B.jsx)(yx,{variant:_?`secondary`:`default`,className:`text-xs`,children:_?`Editing`:`Creating`})]}),(0,B.jsx)(Hk,{children:_?`Update the fields below to modify this ${a.label.toLowerCase()}.`:`Fill in the fields below to create a new ${a.label.toLowerCase()}.`})]}),(0,B.jsxs)(`form`,{onSubmit:p,className:`flex-1 flex flex-col overflow-hidden`,children:[(0,B.jsx)($D,{className:`flex-1`,children:(0,B.jsxs)(`div`,{className:`p-6 space-y-5`,children:[d&&(0,B.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,B.jsx)(Ip,{className:`h-4 w-4 shrink-0`}),d]}),g.map(e=>{let t=h[e],n=t.label||e,r=t.required;return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Dk,{htmlFor:e,className:`text-sm font-medium`,children:n}),r&&(0,B.jsx)(`span`,{className:`text-xs text-destructive`,children:`*`}),(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] px-1 py-0 font-normal opacity-40 ml-auto`,children:t.type})]}),t.type===`boolean`?(0,B.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border p-3`,children:[(0,B.jsx)(Fk,{id:e,checked:!!s[e],onCheckedChange:t=>m(e,t)}),(0,B.jsx)(Dk,{htmlFor:e,className:`text-sm text-muted-foreground cursor-pointer`,children:s[e]?`Enabled`:`Disabled`})]}):t.type===`select`?(0,B.jsxs)(ek,{value:s[e]||``,onValueChange:t=>m(e,t),children:[(0,B.jsx)(nk,{id:e,children:(0,B.jsx)(tk,{placeholder:`Select an option...`})}),(0,B.jsx)(ak,{children:t.options?.map(e=>(0,B.jsx)(ok,{value:e.value,children:e.label},e.value))})]}):t.type===`textarea`?(0,B.jsx)(wk,{id:e,value:s[e]||``,onChange:t=>m(e,t.target.value),rows:3,required:r,placeholder:`Enter ${n.toLowerCase()}...`,className:`resize-none`}):(0,B.jsx)(vh,{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,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description})]},e)})]})}),(0,B.jsxs)(Bk,{className:`px-6 py-4 border-t bg-muted/30`,children:[(0,B.jsx)(_h,{variant:`outline`,onClick:r,type:`button`,className:`gap-1.5`,children:`Cancel`}),(0,B.jsx)(_h,{type:`submit`,disabled:l,className:`gap-1.5`,children:l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin`}),` Saving...`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Gee,{className:`h-4 w-4`}),` `,_?`Update`:`Create`]})})]})]})]})})}var Uk={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`},u_e={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 d_e({objectApiName:e}){let t=_p(),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,L.useState)(n[0]),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)([]),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(!1),y=a||r.path,b=(0,L.useCallback)(e=>{i(e),o(e.path),c(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),f(null)},[]),x=(0,L.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,L.useCallback)(()=>{d?.body&&(navigator.clipboard.writeText(d.body),v(!0),setTimeout(()=>v(!1),1500))},[d]),C=e=>u_e[String(e)[0]]??`text-muted-foreground`;return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[280px_1fr] gap-4 h-full`,children:[(0,B.jsxs)(`div`,{className:`space-y-3 lg:border-r lg:pr-4`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wider`,children:`Endpoints`}),(0,B.jsx)(`div`,{className:`space-y-1`,children:n.map((e,t)=>(0,B.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,B.jsx)(yx,{variant:`outline`,className:`font-mono text-[10px] shrink-0 ${Uk[e.method]}`,children:e.method}),(0,B.jsx)(`span`,{className:`truncate text-xs`,children:e.desc})]},t))}),(0,B.jsxs)(`div`,{className:`pt-3 border-t`,children:[(0,B.jsx)(`h4`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Query Parameters`}),(0,B.jsxs)(`div`,{className:`space-y-1 text-xs text-muted-foreground`,children:[(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$top=10`}),` — limit`]}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$skip=20`}),` — offset`]}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$sort=name`}),` — sort`]}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$select=name,email`}),` — fields`]}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$count=true`}),` — total count`]})]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(yx,{variant:`outline`,className:`font-mono text-xs shrink-0 ${Uk[r.method]}`,children:r.method}),(0,B.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,B.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,B.jsx)(Qp,{className:`h-3.5 w-3.5 animate-spin`}):(0,B.jsx)(im,{className:`h-3.5 w-3.5`}),`Send`]})]}),[`POST`,`PATCH`].includes(r.method)&&(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,B.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,B.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col rounded-lg border overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-mono font-semibold ${C(d.status)}`,children:d.status||`ERR`}),(0,B.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,B.jsx)(zp,{className:`h-3 w-3`}),d.duration,`ms`]})]}),(0,B.jsxs)(`button`,{onClick:S,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[_?(0,B.jsx)(Np,{className:`h-3 w-3`}):(0,B.jsx)(Vp,{className:`h-3 w-3`}),_?`Copied`:`Copy`]})]}),(0,B.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,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,B.jsx)(qp,{className:`h-8 w-8 mx-auto opacity-30`}),(0,B.jsxs)(`p`,{children:[`Select an endpoint and click `,(0,B.jsx)(`strong`,{children:`Send`}),` to test`]})]})}),p.length>0&&(0,B.jsxs)(`div`,{className:`border-t pt-3 space-y-1`,children:[(0,B.jsx)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`History`}),(0,B.jsx)(`div`,{className:`space-y-1 max-h-48 overflow-auto`,children:p.map(e=>(0,B.jsxs)(`div`,{className:`rounded border`,children:[(0,B.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,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(yx,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${Uk[e.method]}`,children:e.method}),(0,B.jsx)(`span`,{className:`font-mono truncate`,children:e.url}),(0,B.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${C(e.status)}`,children:e.status}),(0,B.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]})]}),h===e.id&&(0,B.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 f_e({objectApiName:e}){let[t,n]=(0,L.useState)(`schema`),[r,i]=(0,L.useState)(null),[a,o]=(0,L.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,B.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 border-b px-4 bg-muted/30`,children:[[{id:`schema`,label:`Schema`,icon:Bp},{id:`data`,label:`Data`,icon:mm},{id:`api`,label:`API`,icon:qp}].map(e=>{let r=e.icon;return(0,B.jsxs)(`button`,{onClick:()=>n(e.id),className:` + flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors border-b-2 + ${t===e.id?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-border`} + `,children:[(0,B.jsx)(r,{className:`h-3.5 w-3.5`}),e.label]},e.id)}),(0,B.jsx)(`div`,{className:`ml-auto flex items-center gap-2 py-2`,children:(0,B.jsxs)(yx,{variant:`outline`,className:`font-mono text-xs gap-1`,children:[(0,B.jsx)(Up,{className:`h-3 w-3`}),e]})})]}),(0,B.jsxs)(`div`,{className:`flex-1 overflow-auto p-4`,children:[t===`schema`&&(0,B.jsx)($ge,{objectApiName:e}),t===`data`&&(0,B.jsx)(Yge,{objectApiName:e,onEdit:s}),t===`api`&&(0,B.jsx)(d_e,{objectApiName:e})]}),a&&(0,B.jsx)(l_e,{objectApiName:e,record:r&&Object.keys(r).length>0?r:void 0,onSuccess:c,onCancel:()=>{o(!1),i(null)}})]})}function p_e({metadataName:e}){return(0,B.jsx)(f_e,{objectApiName:e})}var m_e={manifest:_k({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`],label:`Object Explorer`,priority:100,modes:[`preview`,`data`,`code`]}],sidebarGroups:[{key:`data`,label:`Data`,icon:`database`,metadataTypes:[`object`,`hook`,`mapping`,`analyticsCube`,`data`],order:10}],metadataIcons:[{metadataType:`object`,label:`Objects`,icon:`package`},{metadataType:`hook`,label:`Hooks`,icon:`anchor`},{metadataType:`mapping`,label:`Mappings`,icon:`map`},{metadataType:`analyticsCube`,label:`Analytics Cubes`,icon:`pie-chart`},{metadataType:`data`,label:`Seed Data`,icon:`database`}]}}),activate(e){e.registerViewer(`object-explorer`,p_e),e.registerMetadataIcon(`object`,nm,`Objects`),e.registerMetadataIcon(`hook`,Dp,`Hooks`),e.registerMetadataIcon(`mapping`,em,`Mappings`),e.registerMetadataIcon(`analyticsCube`,Oee,`Analytics Cubes`),e.registerMetadataIcon(`data`,Up,`Seed Data`)}};function Wk(e){return typeof e==`string`?e:e&&typeof e==`object`&&`defaultValue`in e?String(e.defaultValue):e&&typeof e==`object`&&`key`in e?String(e.key):``}var h_e={actions:Sm,dashboards:Mp,reports:Kp,flows:ym,agent:jp,agents:jp,tool:bm,tools:bm,apis:qp,ragPipeline:Ap,ragPipelines:Ap,profiles:um,sharingRules:um},g_e={actions:`Action`,dashboards:`Dashboard`,reports:`Report`,flows:`Flow`,agent:`Agent`,agents:`Agent`,tool:`Tool`,tools:`Tool`,apis:`API`,ragPipeline:`RAG Pipeline`,ragPipelines:`RAG Pipeline`,profiles:`Profile`,sharingRules:`Sharing Rule`};function Gk({text:e}){let[t,n]=(0,L.useState)(!1);return(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,B.jsx)(Np,{className:`h-3 w-3 text-emerald-500`}):(0,B.jsx)(Vp,{className:`h-3 w-3`})})}),(0,B.jsx)(Kv,{children:`Copy`})]})})}function Kk({data:e,depth:t=0}){let[n,r]=(0,L.useState)({});if(e==null)return(0,B.jsx)(`span`,{className:`text-muted-foreground italic`,children:`null`});if(typeof e==`boolean`)return(0,B.jsx)(yx,{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,B.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,B.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-400 font-mono text-sm break-all`,children:[`"`,e.slice(0,120),`…"`]}):(0,B.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,B.jsx)(`span`,{className:`text-muted-foreground font-mono text-sm`,children:`[]`}):e.length<=5&&e.every(e=>typeof e!=`object`)?(0,B.jsxs)(`span`,{className:`font-mono text-sm`,children:[`[`,e.map((e,n)=>(0,B.jsxs)(`span`,{children:[n>0&&`, `,(0,B.jsx)(Kk,{data:e,depth:t+1})]},n)),`]`]}):(0,B.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,B.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[`Array(`,e.length,`)`]}),(0,B.jsx)(`div`,{className:`ml-4 border-l pl-3 space-y-0.5`,children:e.map((e,n)=>(0,B.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,B.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs shrink-0 mt-0.5`,children:[`[`,n,`]`]}),(0,B.jsx)(Kk,{data:e,depth:t+1})]},n))})]});if(typeof e==`object`){let i=Object.keys(e);return i.length===0?(0,B.jsx)(`span`,{className:`text-muted-foreground font-mono text-sm`,children:`{}`}):(0,B.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,B.jsx)(`div`,{children:(0,B.jsxs)(`div`,{className:`flex items-start gap-1 group`,children:[o?(0,B.jsx)(`button`,{onClick:()=>r(e=>({...e,[i]:!s})),className:`shrink-0 mt-0.5 p-0.5 rounded hover:bg-muted`,children:s?(0,B.jsx)(Fp,{className:`h-3 w-3 text-muted-foreground`}):(0,B.jsx)(Pp,{className:`h-3 w-3 text-muted-foreground`})}):(0,B.jsx)(`span`,{className:`w-4 shrink-0`}),(0,B.jsxs)(`span`,{className:`text-blue-600 dark:text-blue-400 font-mono text-sm shrink-0`,children:[i,`:`]}),o&&s?(0,B.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:Array.isArray(a)?`Array(${a.length})`:`{${Object.keys(a).length} keys}`}):(0,B.jsx)(`div`,{className:`min-w-0`,children:(0,B.jsx)(Kk,{data:a,depth:t+1})})]})},i)})})}return(0,B.jsx)(`span`,{className:`font-mono text-sm`,children:String(e)})}function __e({metaType:e,metaName:t,packageId:n}){let r=_p(),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(!0),[c,l]=(0,L.useState)(``),u=h_e[e]||Kp,d=g_e[e]||e.charAt(0).toUpperCase()+e.slice(1);if((0,L.useEffect)(()=>{let i=!0;s(!0),a(null);async function o(){try{let o=await r.meta.getItem(e,t,n?{packageId:n}:void 0);i&&a(o?.item||o)}catch(n){console.error(`[MetadataInspector] Failed to load ${e}/${t}:`,n)}finally{i&&s(!1)}}return o(),()=>{i=!1}},[r,e,t,n]),o)return(0,B.jsx)(`div`,{className:`space-y-4 p-4`,children:(0,B.jsxs)(Sx,{children:[(0,B.jsx)(Cx,{children:(0,B.jsx)(Yg,{className:`h-6 w-48`})}),(0,B.jsxs)(Ex,{className:`space-y-3`,children:[(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`})]})]})});if(!i)return(0,B.jsx)(`div`,{className:`p-4`,children:(0,B.jsx)(Sx,{children:(0,B.jsxs)(Ex,{className:`py-12 text-center text-muted-foreground`,children:[d,` definition not found: `,(0,B.jsx)(`code`,{className:`font-mono`,children:t})]})})});let f=Wk(i.label)||i.name||t,p=i.name||t,m=Wk(i.description),[h]=p.includes(`__`)?p.split(`__`):[null],g=Object.keys(i),_=c?g.filter(e=>e.toLowerCase().includes(c.toLowerCase())||JSON.stringify(i[e]).toLowerCase().includes(c.toLowerCase())):g;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(Sx,{children:(0,B.jsx)(Cx,{className:`pb-3`,children:(0,B.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(u,{className:`h-5 w-5 text-muted-foreground`}),(0,B.jsx)(wx,{className:`text-xl`,children:f}),h&&(0,B.jsx)(yx,{variant:`secondary`,className:`font-mono text-xs`,children:h}),(0,B.jsx)(yx,{variant:`outline`,className:`text-xs`,children:d})]}),(0,B.jsxs)(Tx,{className:`flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:p}),(0,B.jsx)(Gk,{text:p}),m&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:`·`}),(0,B.jsx)(`span`,{className:`text-xs`,children:m})]})]})]})})})}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(wx,{className:`text-base`,children:`Properties`}),(0,B.jsxs)(yx,{variant:`secondary`,className:`text-xs`,children:[_.length,` / `,g.length,` keys`]})]}),(0,B.jsxs)(`div`,{className:`relative mt-2`,children:[(0,B.jsx)(sm,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(vh,{placeholder:`Filter properties...`,value:c,onChange:e=>l(e.target.value),className:`pl-9 h-8 text-sm`})]})]}),(0,B.jsx)(Ex,{children:(0,B.jsx)($D,{className:`max-h-[60vh]`,children:(0,B.jsxs)(`div`,{className:`space-y-3`,children:[_.map(e=>(0,B.jsxs)(`div`,{className:`group rounded-md border p-3 hover:bg-muted/30 transition-colors`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,B.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400 font-mono text-sm font-medium`,children:e}),(0,B.jsx)(Gk,{text:JSON.stringify(i[e],null,2)}),(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] font-mono ml-auto`,children:Array.isArray(i[e])?`array(${i[e].length})`:typeof i[e]})]}),(0,B.jsx)(`div`,{className:`pl-1`,children:(0,B.jsx)(Kk,{data:i[e]})})]},e)),_.length===0&&(0,B.jsx)(`p`,{className:`text-sm text-center text-muted-foreground py-8`,children:c?`No properties match filter`:`No properties`})]})})})]})]})}var qk=`Tabs`,[v_e,y_e]=xh(qk,[ky]),Jk=ky(),[b_e,Yk]=v_e(qk),Xk=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=wy(s),[d,f]=wh({prop:r,onChange:i,defaultProp:a??``,caller:qk});return(0,B.jsx)(b_e,{scope:n,baseId:Ch(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,B.jsx)(Eh.div,{dir:u,"data-orientation":o,...l,ref:t})})});Xk.displayName=qk;var Zk=`TabsList`,Qk=L.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Yk(Zk,n),o=Jk(n);return(0,B.jsx)(Py,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,B.jsx)(Eh.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Qk.displayName=Zk;var $k=`TabsTrigger`,eA=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Yk($k,n),s=Jk(n),c=rA(o.baseId,r),l=iA(o.baseId,r),u=r===o.value;return(0,B.jsx)(Fy,{asChild:!0,...s,focusable:!i,active:u,children:(0,B.jsx)(Eh.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:H(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:H(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:H(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});eA.displayName=$k;var tA=`TabsContent`,nA=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Yk(tA,n),c=rA(s.baseId,r),l=iA(s.baseId,r),u=r===s.value,d=L.useRef(u);return L.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,B.jsx)(Ih,{present:i||u,children:({present:n})=>(0,B.jsx)(Eh.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});nA.displayName=tA;function rA(e,t){return`${e}-trigger-${t}`}function iA(e,t){return`${e}-content-${t}`}var x_e=Xk,aA=Qk,oA=eA,sA=nA,S_e=x_e,cA=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(aA,{ref:n,className:V(`inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground`,e),...t}));cA.displayName=aA.displayName;var lA=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(oA,{ref:n,className:V(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow`,e),...t}));lA.displayName=oA.displayName;var C_e=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(sA,{ref:n,className:V(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,e),...t}));C_e.displayName=sA.displayName;var uA={object:{label:`Object`,icon:Up},view:{label:`View`,icon:Vee},flow:{label:`Flow`,icon:ym},agent:{label:`Agent`,icon:jp},tool:{label:`Tool`,icon:bm},app:{label:`App`,icon:Op}};function dA(e,t){let n=` `.repeat(t);return e.split(` +`).map(e=>e.trim()?n+e:e).join(` +`)}function fA(e,t=0){if(e==null)return`undefined`;if(typeof e==`string`)return`'${e.replace(/'/g,`\\'`)}'`;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(Array.isArray(e)){if(e.length===0)return`[]`;let n=e.map(e=>fA(e,t+1));return n.join(`, `).length<60?`[${n.join(`, `)}]`:`[\n${n.map(e=>dA(e,t+1)).join(`, +`)}\n${dA(`]`,t)}`}if(typeof e==`object`){let n=Object.entries(e);if(n.length===0)return`{}`;let r=n.map(([e,n])=>`${dA(`${e}: ${fA(n,t+1)}`,t+1)}`);return r.join(`, `).length<60&&!r.some(e=>e.includes(` +`))?`{ ${n.map(([e,n])=>`${e}: ${fA(n,t+1)}`).join(`, `)} }`:`{\n${r.join(`, +`)}\n${dA(`}`,t)}`}return String(e)}function w_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` objects: {`,` ${t||e.name||`my_object`}: ${fA(e,2)},`,` },`,`});`].join(` +`)}function T_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` views: {`,` ${t||e.name||`my_view`}: ${fA(e,2)},`,` },`,`});`].join(` +`)}function E_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` flows: {`,` ${t||e.name||`my_flow`}: ${fA(e,2)},`,` },`,`});`].join(` +`)}function D_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` agents: {`,` ${t||e.name||`my_agent`}: ${fA(e,2)},`,` },`,`});`].join(` +`)}function O_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` apps: {`,` ${t||e.name||`my_app`}: ${fA(e,2)},`,` },`,`});`].join(` +`)}function k_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` tools: {`,` ${t||e.name||`my_tool`}: ${fA(e,2)},`,` },`,`});`].join(` +`)}var A_e={object:w_e,view:T_e,flow:E_e,agent:D_e,tool:k_e,app:O_e};function j_e({type:e,definition:t,name:n}){let[r,i]=(0,L.useState)(`typescript`),[a,o]=(0,L.useState)(!1),s=(0,L.useMemo)(()=>{let r=A_e[e];return r?r(t,n):`// Unknown export type`},[e,t,n]),c=(0,L.useMemo)(()=>JSON.stringify(t,null,2),[t]),l=r===`typescript`?s:c,u=(0,L.useCallback)(()=>{navigator.clipboard.writeText(l),o(!0),setTimeout(()=>o(!1),1500)},[l]),d=uA[e]?.icon??Bp;return(0,B.jsxs)(Sx,{children:[(0,B.jsx)(Cx,{className:`pb-3`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(wx,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(Bp,{className:`h-4 w-4`}),`Export as Code`]}),(0,B.jsxs)(Tx,{className:`flex items-center gap-1.5`,children:[(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] gap-1`,children:[(0,B.jsx)(d,{className:`h-3 w-3`}),uA[e]?.label??e]}),n&&(0,B.jsx)(`code`,{className:`text-xs font-mono bg-muted px-1 py-0.5 rounded`,children:n})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(S_e,{value:r,onValueChange:e=>i(e),children:(0,B.jsxs)(cA,{className:`h-7`,children:[(0,B.jsx)(lA,{value:`typescript`,className:`text-xs px-2 py-0.5`,children:`TypeScript`}),(0,B.jsx)(lA,{value:`json`,className:`text-xs px-2 py-0.5`,children:`JSON`})]})}),(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,onClick:u,className:`h-7 gap-1 text-xs`,children:[a?(0,B.jsx)(Np,{className:`h-3 w-3`}):(0,B.jsx)(Vp,{className:`h-3 w-3`}),a?`Copied!`:`Copy to Clipboard`]})]})]})}),(0,B.jsx)(Ex,{className:`p-0`,children:(0,B.jsx)(`pre`,{className:`overflow-auto p-4 text-xs font-mono bg-muted/30 rounded-b-lg whitespace-pre max-h-[60vh]`,children:(0,B.jsx)(`code`,{children:l})})})]})}var M_e={object:`object`,view:`view`,flow:`flow`,agent:`agent`,tool:`tool`,app:`app`};function N_e({metadataType:e,metadataName:t,packageId:n}){return(0,B.jsx)(__e,{metaType:e,metaName:t,packageId:n})}function P_e({metadataType:e,metadataName:t,data:n,packageId:r}){let i=_p(),[a,o]=(0,L.useState)(n??null),[s,c]=(0,L.useState)(!n);return(0,L.useEffect)(()=>{if(n){o(n),c(!1);return}let a=!0;c(!0);async function s(){try{let n=await i.meta.getItem(e,t,r?{packageId:r}:void 0);a&&o(n?.item||n)}catch(n){console.error(`[CodeViewer] Failed to load ${e}/${t}:`,n)}finally{a&&c(!1)}}return s(),()=>{a=!1}},[i,e,t,n,r]),s?(0,B.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading definition…`}):a?(0,B.jsx)(`div`,{className:`p-4`,children:(0,B.jsx)(j_e,{type:M_e[e]??`object`,definition:a,name:t})}):(0,B.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[`Definition not found: `,(0,B.jsx)(`code`,{className:`font-mono`,children:t})]})}var F_e={manifest:_k({id:`objectstack.default-inspector`,name:`Default Metadata Inspector`,version:`1.0.0`,description:`JSON tree viewer and code exporter for any metadata type. Fallback when no specialized viewer is available.`,contributes:{metadataViewers:[{id:`json-inspector`,metadataTypes:[`*`],label:`JSON Inspector`,priority:-1,modes:[`preview`]},{id:`code-exporter`,metadataTypes:[`*`],label:`Code Export`,priority:-1,modes:[`code`]}]}}),activate(e){e.registerViewer(`json-inspector`,N_e),e.registerViewer(`code-exporter`,P_e)}},pA=e=>`objectstack:agent-playground:${e}`;function I_e(e){return(e.parts??[]).filter(e=>e.type===`text`).map(e=>e.text).join(``)}function L_e(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function R_e(e){if(!e||typeof e!=`object`)return``;let t=Object.entries(e);return t.length===0?``:t.slice(0,4).map(([e,t])=>{let n;try{n=typeof t==`string`?t:JSON.stringify(t)??String(t)}catch{n=String(t)}return`${e}: ${n.length>30?n.slice(0,30)+`…`:n}`}).join(`, `)}function z_e(e){return e.type===`dynamic-tool`}function B_e(e,t=80){let n;try{n=typeof e==`string`?e:JSON.stringify(e)??``}catch{n=String(e??``)}return n.length>t?n.slice(0,t)+`…`:n}function V_e({reasoning:e}){let[t,n]=(0,L.useState)(!1);return e.length===0?null:(0,B.jsxs)(`div`,{"data-testid":`reasoning-display`,className:`flex flex-col gap-1 rounded-md border border-border/30 bg-muted/30 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1.5 text-left text-muted-foreground hover:text-foreground transition-colors`,children:[t?(0,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(Tee,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(`span`,{className:`font-medium`,children:`Thinking`}),(0,B.jsxs)(`span`,{className:`text-[10px] opacity-60`,children:[`(`,e.length,` step`,e.length===1?``:`s`,`)`]})]}),t&&(0,B.jsx)(`div`,{className:`mt-1 space-y-1 pl-5 text-muted-foreground italic border-l-2 border-border/30`,children:e.map((e,t)=>(0,B.jsx)(`p`,{className:`text-[11px] leading-relaxed`,children:e},t))})]})}function H_e({activeSteps:e,completedSteps:t}){if(e.size===0)return null;let n=t.length+e.size,r=t.length+1;return(0,B.jsxs)(`div`,{"data-testid":`step-progress`,className:`flex flex-col gap-1.5 rounded-md border border-blue-500/30 bg-blue-500/5 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Sm,{className:`h-3 w-3 shrink-0 text-blue-600 dark:text-blue-400`}),(0,B.jsxs)(`span`,{className:`font-medium text-blue-700 dark:text-blue-300`,children:[`Step `,r,` of `,n]})]}),Array.from(e.values()).map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 pl-5`,children:[(0,B.jsx)(Qp,{className:`h-3 w-3 shrink-0 animate-spin text-blue-600 dark:text-blue-400`}),(0,B.jsx)(`span`,{className:`text-blue-700 dark:text-blue-300`,children:e.stepName})]},t))]})}function U_e({part:e,onApprove:t,onDeny:n}){let r=L_e(e.toolName),i=R_e(e.input);switch(e.state){case`input-streaming`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-blue-500/40 bg-blue-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Qp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-blue-600 dark:text-blue-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium text-blue-700 dark:text-blue-300`,children:[`Planning to call `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-blue-600/80 dark:text-blue-300/80`,children:i})]})]});case`input-available`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Qp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-primary`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Calling `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-muted-foreground`,children:i})]})]});case`approval-requested`:return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(lm,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-yellow-600 dark:text-yellow-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Confirm: `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:i})]})]}),e.approval&&t&&n&&(0,B.jsxs)(`div`,{className:`flex gap-2 pl-5`,children:[(0,B.jsxs)(_h,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>t(e.approval.id),children:[(0,B.jsx)(Lp,{className:`mr-1 h-3 w-3`}),`Approve`]}),(0,B.jsxs)(_h,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs text-destructive hover:text-destructive`,onClick:()=>n(e.approval.id),children:[(0,B.jsx)(Rp,{className:`mr-1 h-3 w-3`}),`Deny`]})]})]});case`output-available`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-green-500/30 bg-green-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Lp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:r}),(0,B.jsx)(`p`,{className:`mt-0.5 text-muted-foreground truncate`,children:B_e(e.output)})]})]});case`output-error`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Rp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[r,` failed`]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-destructive/80`,children:e.errorText})]})]});case`output-denied`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Rp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,B.jsxs)(`span`,{className:`font-medium text-muted-foreground`,children:[r,` — denied`]})]});default:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(bm,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`font-medium`,children:r})]})}}function W_e({metadataType:e,metadataName:t,data:n,packageId:r}){let i=_p(),[a,o]=(0,L.useState)(n??null),[s,c]=(0,L.useState)(!n),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)({reasoning:[],activeSteps:new Map,completedSteps:[]}),[p,m]=(0,L.useState)(!1),h=(0,L.useRef)(null),g=(0,L.useRef)(null),_=xx();(0,L.useEffect)(()=>{if(n){o(n),c(!1);return}let a=!0;c(!0);async function s(){try{let n=await i.meta.getItem(e,t,r?{packageId:r}:void 0);a&&o(n?.item||n)}catch(e){console.error(`[AgentPlayground] Failed to load agent ${t}:`,e)}finally{a&&c(!1)}}return s(),()=>{a=!1}},[i,e,t,n,r]);let v=(0,L.useCallback)(()=>{try{let e=pA(t),n=localStorage.getItem(e);return n?JSON.parse(n):[]}catch{return[]}},[t]),y=(0,L.useCallback)(e=>{try{let n=pA(t);localStorage.setItem(n,JSON.stringify(e))}catch{}},[t]),b=(0,L.useMemo)(()=>v(),[v]),{messages:x,sendMessage:S,setMessages:C,status:w,error:T,addToolApprovalResponse:E}=ED({transport:(0,L.useMemo)(()=>new uD({api:`${_}/api/v1/ai/agents/${t}/chat`}),[_,t]),messages:b,onFinish:()=>{f({reasoning:[],activeSteps:new Map,completedSteps:[]})}}),D=w===`streaming`||w===`submitted`;(0,L.useEffect)(()=>{if(!D||x.length===0)return;let e=x[x.length-1];if(e.role!==`assistant`)return;let t=[],n=new Map,r=[];(e.parts||[]).forEach(e=>{e.type===`reasoning-delta`||e.type===`reasoning`?t.push(e.text):e.type===`step-start`?n.set(e.stepId,{stepName:e.stepName,startedAt:Date.now()}):e.type===`step-finish`&&r.push(e.stepName)}),f({reasoning:t,activeSteps:n,completedSteps:r})},[x,D]),(0,L.useEffect)(()=>{x.length>0&&y(x)},[x,y]),(0,L.useEffect)(()=>{h.current&&(h.current.scrollTop=h.current.scrollHeight)},[x]);let O=()=>{C([]),y([])},ee=()=>{let e=new Blob([JSON.stringify(x,null,2)],{type:`application/json`}),n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`agent-${t}-conversation-${Date.now()}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},te=()=>{let e=l.trim();!e||D||(u(``),S({text:e}))};return s?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin`}),(0,B.jsx)(`span`,{children:`Loading agent...`})]})}):a?(0,B.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b bg-background`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(jp,{className:`h-5 w-5 text-primary`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold`,children:a.label}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a.role})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>m(!p),children:(0,B.jsx)(Pp,{className:V(`h-4 w-4 transition-transform`,p&&`rotate-180`)})})}),(0,B.jsx)(Kv,{children:(0,B.jsxs)(`p`,{children:[p?`Hide`:`Show`,` metadata`]})})]})}),(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:ee,disabled:x.length===0,children:(0,B.jsx)(Nee,{className:`h-4 w-4`})})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Download conversation`})})]})}),(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:O,children:(0,B.jsx)(gm,{className:`h-4 w-4`})})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Clear history`})})]})})]})]}),p&&(0,B.jsx)(`div`,{className:`px-4 pb-3 border-t`,children:(0,B.jsxs)(`div`,{className:`mt-3 text-xs space-y-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Instructions:`}),(0,B.jsx)(`p`,{className:`mt-1 text-foreground whitespace-pre-wrap`,children:a.instructions})]}),a.model&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Model:`}),(0,B.jsx)(`span`,{className:`ml-2 font-mono`,children:a.model.model})]}),a.skills&&a.skills.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Skills:`}),(0,B.jsx)(`span`,{className:`ml-2`,children:a.skills.join(`, `)})]}),a.tools&&a.tools.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Tools:`}),(0,B.jsx)(`span`,{className:`ml-2`,children:a.tools.map(e=>e.name).join(`, `)})]})]})})]}),(0,B.jsx)($D,{className:`flex-1`,children:(0,B.jsxs)(`div`,{ref:h,className:`flex flex-col gap-3 p-4 overflow-y-auto h-full`,children:[x.length===0&&(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-12 text-center text-muted-foreground`,children:[(0,B.jsx)(dm,{className:`h-8 w-8 opacity-40`}),(0,B.jsxs)(`p`,{className:`text-sm`,children:[`Start testing `,a.label]}),(0,B.jsx)(`p`,{className:`text-xs opacity-60`,children:`Send a message to begin the conversation`})]}),x.map(e=>{let t=I_e(e),n=(e.parts??[]).filter(z_e);return!(t||n.length>0)&&e.role!==`user`?null:(0,B.jsxs)(`div`,{className:V(`flex flex-col gap-1.5 rounded-lg px-3 py-2 text-sm`,e.role===`user`?`ml-8 bg-primary text-primary-foreground`:`mr-8 bg-muted text-foreground`),children:[(0,B.jsx)(`span`,{className:`text-[10px] font-medium opacity-60 uppercase`,children:e.role===`user`?`You`:`Assistant`}),t&&(0,B.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:t}),n.map(e=>(0,B.jsx)(U_e,{part:e,onApprove:e=>E({id:e,approved:!0}),onDeny:e=>E({id:e,approved:!1,reason:`User denied the operation`})},e.toolCallId))]},e.id)}),D&&(0,B.jsxs)(B.Fragment,{children:[d.reasoning.length>0&&(0,B.jsx)(`div`,{className:`mr-8`,children:(0,B.jsx)(V_e,{reasoning:d.reasoning})}),d.activeSteps.size>0&&(0,B.jsx)(`div`,{className:`mr-8`,children:(0,B.jsx)(H_e,{activeSteps:d.activeSteps,completedSteps:d.completedSteps})}),d.reasoning.length===0&&d.activeSteps.size===0&&(0,B.jsxs)(`div`,{className:`mr-8 flex items-center gap-2 rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`inline-block h-2 w-2 animate-pulse rounded-full bg-primary`}),`Thinking…`]})]}),T&&(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,B.jsx)(lm,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`font-medium`,children:`Error`}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs opacity-80`,children:T.message||`Something went wrong`})]})]})]})}),(0,B.jsx)(`div`,{className:`shrink-0 border-t p-4`,children:(0,B.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,B.jsx)(`textarea`,{ref:g,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),te())},placeholder:`Type your message...`,rows:1,className:V(`flex-1 resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`max-h-32 min-h-[36px]`)}),(0,B.jsx)(_h,{type:`button`,size:`icon`,className:`h-9 w-9 shrink-0`,disabled:!l.trim()||D,onClick:te,children:(0,B.jsx)(cm,{className:`h-4 w-4`})})]})})]}):(0,B.jsxs)(`div`,{className:`p-8 text-center text-muted-foreground`,children:[(0,B.jsx)(jp,{className:`h-12 w-12 mx-auto mb-4 opacity-40`}),(0,B.jsxs)(`p`,{className:`text-sm`,children:[`Agent not found: `,(0,B.jsx)(`code`,{className:`font-mono`,children:t})]})]})}var G_e={manifest:_k({id:`objectstack.agent-playground`,name:`Agent Playground`,version:`1.0.0`,description:`Interactive testing environment for AI agents with embedded chat interface.`,contributes:{metadataViewers:[{id:`agent-playground`,metadataTypes:[`agent`],label:`Playground`,priority:10,modes:[`preview`]}]}}),activate(e){e.registerViewer(`agent-playground`,W_e)}},mA=`Checkbox`,[K_e,q_e]=xh(mA),[J_e,hA]=K_e(mA);function Y_e(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=wh({prop:n,defaultProp:i??!1,onChange:c,caller:mA}),[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useRef(!1),y=m?!!o||!!m.closest(`form`):!0,b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:CA(i)?!1:i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,B.jsx)(J_e,{scope:t,...b,children:X_e(d)?d(b):r})}var gA=`CheckboxTrigger`,_A=L.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=hA(gA,e),h=Tm(i,u),g=L.useRef(c);return L.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,B.jsx)(Eh.button,{type:`button`,role:`checkbox`,"aria-checked":CA(c)?`mixed`:c,"aria-required":l,"data-state":wA(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:H(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:H(n,e=>{d(e=>CA(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});_A.displayName=gA;var vA=L.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,B.jsx)(Y_e,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_A,{...d,ref:t,__scopeCheckbox:n}),e&&(0,B.jsx)(SA,{__scopeCheckbox:n})]})})});vA.displayName=mA;var yA=`CheckboxIndicator`,bA=L.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=hA(yA,n);return(0,B.jsx)(Ih,{present:r||CA(a.checked)||a.checked===!0,children:(0,B.jsx)(Eh.span,{"data-state":wA(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});bA.displayName=yA;var xA=`CheckboxBubbleInput`,SA=L.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=hA(xA,e),m=Tm(n,p),h=tO(a),g=sv(r);L.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=CA(a),n.call(e,CA(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=L.useRef(CA(a)?!1:a);return(0,B.jsx)(Eh.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});SA.displayName=xA;function X_e(e){return typeof e==`function`}function CA(e){return e===`indeterminate`}function wA(e){return CA(e)?`indeterminate`:e?`checked`:`unchecked`}var TA=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(vA,{ref:n,className:V(`peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,B.jsx)(bA,{className:V(`flex items-center justify-center text-current`),children:(0,B.jsx)(Np,{className:`h-3.5 w-3.5`})})}));TA.displayName=vA.displayName;var EA=e=>`objectstack:tool-playground:${e}`;function Z_e(e){return{properties:e.properties||{},required:e.required||[]}}function Q_e({name:e,property:t,value:n,onChange:r,required:i}){let{type:a,description:o,enum:s}=t,c=e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return s&&s.length>0?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsxs)(ek,{value:n||``,onValueChange:r,children:[(0,B.jsx)(nk,{id:e,children:(0,B.jsx)(tk,{placeholder:`Select ${c}`})}),(0,B.jsx)(ak,{children:s.map(e=>(0,B.jsx)(ok,{value:String(e),children:String(e)},String(e)))})]})]}):a===`boolean`?(0,B.jsxs)(`div`,{className:`flex items-start space-x-2`,children:[(0,B.jsx)(TA,{id:e,checked:!!n,onCheckedChange:e=>r(e)}),(0,B.jsxs)(`div`,{className:`grid gap-1.5 leading-none`,children:[(0,B.jsxs)(Dk,{htmlFor:e,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o})]})]}):a===`number`||a===`integer`?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(vh,{id:e,type:`number`,value:n??``,onChange:e=>{let t=e.target.value;r(t===``?void 0:a===`integer`?parseInt(t,10):parseFloat(t))},placeholder:`Enter ${c}`})]}):a===`array`?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(wk,{id:e,value:n?JSON.stringify(n,null,2):``,onChange:e=>{try{r(JSON.parse(e.target.value))}catch{}},placeholder:`Enter JSON array`,rows:3,className:`font-mono text-xs`})]}):a===`object`?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(wk,{id:e,value:n?JSON.stringify(n,null,2):``,onChange:e=>{try{r(JSON.parse(e.target.value))}catch{}},placeholder:`Enter JSON object`,rows:4,className:`font-mono text-xs`})]}):(o?.length||0)>100?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(wk,{id:e,value:n||``,onChange:e=>r(e.target.value),placeholder:`Enter ${c}`,rows:3})]}):(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(vh,{id:e,type:`text`,value:n||``,onChange:e=>r(e.target.value),placeholder:`Enter ${c}`})]})}function $_e({entry:e}){let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(!1),a=e=>{navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),2e3)};return(0,B.jsxs)(`div`,{className:`border rounded-md overflow-hidden`,children:[(0,B.jsxs)(`button`,{onClick:()=>n(!t),className:`w-full flex items-center justify-between px-3 py-2 bg-muted/50 hover:bg-muted transition-colors text-left`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[t?(0,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),e.status===`success`?(0,B.jsx)(Lp,{className:`h-3 w-3 shrink-0 text-green-600 dark:text-green-400`}):(0,B.jsx)(Rp,{className:`h-3 w-3 shrink-0 text-destructive`}),(0,B.jsx)(zp,{className:`h-3 w-3 shrink-0 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.timestamp).toLocaleTimeString()}),e.duration&&(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.duration,`ms)`]})]}),(0,B.jsx)(`div`,{className:`flex items-center gap-1`,children:r?(0,B.jsx)(Np,{className:`h-3 w-3 text-green-600`}):(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),a(JSON.stringify(e.status===`success`?e.result:e.error,null,2))},className:`p-1 hover:bg-background rounded`,children:(0,B.jsx)(Vp,{className:`h-3 w-3`})})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Copy result`})})]})})})]}),t&&(0,B.jsxs)(`div`,{className:`px-3 py-2 border-t space-y-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Parameters:`}),(0,B.jsx)(`pre`,{className:`text-xs bg-background rounded p-2 overflow-auto max-h-32`,children:JSON.stringify(e.parameters,null,2)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:e.status===`success`?`Result:`:`Error:`}),(0,B.jsx)(`pre`,{className:V(`text-xs rounded p-2 overflow-auto max-h-48`,e.status===`success`?`bg-green-500/10 text-green-700 dark:text-green-300`:`bg-destructive/10 text-destructive`),children:e.status===`success`?JSON.stringify(e.result,null,2):e.error})]})]})]})}function eve({metadataType:e,metadataName:t,data:n,packageId:r}){let i=_p(),[a,o]=(0,L.useState)(n??null),[s,c]=(0,L.useState)(!n),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)({}),[p,m]=(0,L.useState)([]),h=(0,L.useRef)(null),g=xx();(0,L.useEffect)(()=>{if(n){o(n),c(!1);return}let a=!0;c(!0);async function s(){try{let n=await i.meta.getItem(e,t,r?{packageId:r}:void 0);a&&o(n?.item||n)}catch(e){console.error(`[ToolPlayground] Failed to load tool ${t}:`,e)}finally{a&&c(!1)}}return s(),()=>{a=!1}},[i,e,t,n,r]),(0,L.useEffect)(()=>{try{let e=EA(t),n=localStorage.getItem(e);n&&m(JSON.parse(n))}catch{}},[t]);let _=e=>{try{let n=EA(t),r=e.slice(-50);localStorage.setItem(n,JSON.stringify(r)),m(r)}catch{}},v=()=>{try{let e=EA(t);localStorage.removeItem(e),m([])}catch{}},y=async()=>{if(!a||l)return;u(!0);let e=Date.now(),n=`exec-${Date.now()}`;try{let r=await fetch(`${g}/api/v1/ai/tools/${t}/execute`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({parameters:d})}),i=Date.now()-e;if(r.ok){let e=await r.json(),t={id:n,timestamp:Date.now(),parameters:{...d},status:`success`,result:e.result||e,duration:i};_([...p,t])}else{let e=await r.json().catch(()=>({error:r.statusText})),t={id:n,timestamp:Date.now(),parameters:{...d},status:`error`,error:e.error||`Tool execution failed`,duration:i};_([...p,t])}}catch(t){let r=Date.now()-e,i={id:n,timestamp:Date.now(),parameters:{...d},status:`error`,error:t instanceof Error?t.message:`Unknown error`,duration:r};_([...p,i])}finally{u(!1)}},b=()=>{f({})};if(s)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin`}),(0,B.jsx)(`span`,{children:`Loading tool...`})]})});if(!a)return(0,B.jsxs)(`div`,{className:`p-8 text-center text-muted-foreground`,children:[(0,B.jsx)(bm,{className:`h-12 w-12 mx-auto mb-4 opacity-40`}),(0,B.jsxs)(`p`,{className:`text-sm`,children:[`Tool not found: `,(0,B.jsx)(`code`,{className:`font-mono`,children:t})]})]});let{properties:x,required:S}=Z_e(a.parameters),C=Object.keys(x);return(0,B.jsxs)(`div`,{className:`grid grid-cols-2 h-full divide-x`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b bg-background px-4 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(bm,{className:`h-5 w-5 text-primary`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold`,children:a.label}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a.category||`Tool`})]})]}),a.description&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:a.description})]}),(0,B.jsx)($D,{className:`flex-1`,children:(0,B.jsx)(`div`,{className:`p-4 space-y-4`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Parameters`}),C.length===0?(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This tool has no parameters.`}):(0,B.jsx)(`div`,{className:`space-y-4`,children:C.map(e=>(0,B.jsx)(Q_e,{name:e,property:x[e],value:d[e],onChange:t=>f({...d,[e]:t}),required:S.includes(e)},e))})]})})}),(0,B.jsxs)(`div`,{className:`shrink-0 border-t p-4 flex gap-2`,children:[(0,B.jsx)(_h,{onClick:y,disabled:l,className:`flex-1`,children:l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qp,{className:`mr-2 h-4 w-4 animate-spin`}),`Executing...`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(im,{className:`mr-2 h-4 w-4`}),`Execute Tool`]})}),(0,B.jsx)(_h,{variant:`outline`,onClick:b,children:`Reset`})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b bg-background px-4 py-3 flex items-center justify-between`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium`,children:`Execution History`}),(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:v,disabled:p.length===0,children:(0,B.jsx)(gm,{className:`h-4 w-4`})})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Clear history`})})]})})]}),(0,B.jsx)($D,{className:`flex-1`,children:(0,B.jsx)(`div`,{ref:h,className:`p-4 space-y-2`,children:p.length===0?(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center text-muted-foreground`,children:[(0,B.jsx)(zp,{className:`h-8 w-8 opacity-40 mb-2`}),(0,B.jsx)(`p`,{className:`text-sm`,children:`No executions yet`}),(0,B.jsx)(`p`,{className:`text-xs opacity-60`,children:`Execute the tool to see results here`})]}):p.slice().reverse().map(e=>(0,B.jsx)($_e,{entry:e},e.id))})})]})]})}var tve=[F_e,m_e,G_e,{manifest:_k({id:`objectstack.tool-playground`,name:`Tool Playground`,version:`1.0.0`,description:`Interactive testing environment for AI tools with auto-generated parameter forms.`,contributes:{metadataViewers:[{id:`tool-playground`,metadataTypes:[`tool`],label:`Playground`,priority:10,modes:[`preview`]}]}}),activate(e){e.registerViewer(`tool-playground`,eve)}},{manifest:_k({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:[`action`,`view`,`page`,`dashboard`,`report`,`theme`],order:20}],metadataIcons:[{metadataType:`action`,label:`Actions`,icon:`zap`},{metadataType:`view`,label:`Views`,icon:`eye`},{metadataType:`page`,label:`Pages`,icon:`file-code`},{metadataType:`dashboard`,label:`Dashboards`,icon:`bar-chart-3`},{metadataType:`report`,label:`Reports`,icon:`file-text`},{metadataType:`theme`,label:`Themes`,icon:`palette`}]}}),activate(e){e.registerMetadataIcon(`action`,Sm,`Actions`),e.registerMetadataIcon(`view`,Wp,`Views`),e.registerMetadataIcon(`page`,Gp,`Pages`),e.registerMetadataIcon(`dashboard`,Mp,`Dashboards`),e.registerMetadataIcon(`report`,Kp,`Reports`),e.registerMetadataIcon(`theme`,rm,`Themes`)}},{manifest:_k({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:[`flow`,`workflow`,`approval`,`webhook`],order:30}],metadataIcons:[{metadataType:`flow`,label:`Flows`,icon:`workflow`},{metadataType:`workflow`,label:`Workflows`,icon:`workflow`},{metadataType:`approval`,label:`Approvals`,icon:`check-square`},{metadataType:`webhook`,label:`Webhooks`,icon:`webhook`}]}}),activate(e){e.registerMetadataIcon(`flow`,ym,`Flows`),e.registerMetadataIcon(`workflow`,ym,`Workflows`),e.registerMetadataIcon(`approval`,fm,`Approvals`),e.registerMetadataIcon(`webhook`,vm,`Webhooks`)}},{manifest:_k({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:[`role`,`permission`,`profile`,`sharingRule`,`policy`],order:40}],metadataIcons:[{metadataType:`role`,label:`Roles`,icon:`user-cog`},{metadataType:`permission`,label:`Permissions`,icon:`lock`},{metadataType:`profile`,label:`Profiles`,icon:`shield`},{metadataType:`sharingRule`,label:`Sharing Rules`,icon:`shield`},{metadataType:`policy`,label:`Policies`,icon:`shield`}]}}),activate(e){e.registerMetadataIcon(`role`,_m,`Roles`),e.registerMetadataIcon(`permission`,$p,`Permissions`),e.registerMetadataIcon(`profile`,um,`Profiles`),e.registerMetadataIcon(`sharingRule`,um,`Sharing Rules`),e.registerMetadataIcon(`policy`,um,`Policies`)}},{manifest:_k({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:[`agent`,`tool`,`ragPipeline`],order:50}],metadataIcons:[{metadataType:`agent`,label:`Agents`,icon:`bot`},{metadataType:`tool`,label:`Tools`,icon:`wrench`},{metadataType:`ragPipeline`,label:`RAG Pipelines`,icon:`book-open`}]}}),activate(e){e.registerMetadataIcon(`agent`,jp,`Agents`),e.registerMetadataIcon(`tool`,bm,`Tools`),e.registerMetadataIcon(`ragPipeline`,Ap,`RAG Pipelines`)}},{manifest:_k({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:[`api`,`connector`],order:60}],metadataIcons:[{metadataType:`api`,label:`APIs`,icon:`globe`},{metadataType:`connector`,label:`Connectors`,icon:`link-2`}]}}),activate(e){e.registerMetadataIcon(`api`,qp,`APIs`),e.registerMetadataIcon(`connector`,Xp,`Connectors`)}}];function nve(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)([]),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(`overview`);(0,L.useEffect)(()=>{let e=xx();console.log(`[App] Connecting to API: ${e} (mode: ${bx.mode})`),t(new mp({baseUrl:e}))},[]),(0,L.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,L.useCallback)(e=>{a(e),s(null),l(null),d(`overview`)},[]),p=(0,L.useCallback)(e=>{e?(s(e),d(`object`)):(s(null),d(`overview`))},[]),m=(0,L.useCallback)(e=>{d(e),s(null),l(null)},[]),h=(0,L.useCallback)((e,t)=>{l({type:e,name:t}),s(null),d(`metadata`)},[]),g=(0,L.useCallback)((e,t)=>{e===`packages`?m(`packages`):t&&p(t)},[m,p]);return e?(0,B.jsx)(gp,{client:e,children:(0,B.jsx)(oge,{plugins:tve,children:(0,B.jsx)(Zee,{children:(0,B.jsxs)(Yv,{children:[(0,B.jsx)(Ese,{selectedObject:o,onSelectObject:p,selectedMeta:c,onSelectMeta:h,packages:n,selectedPackage:i,onSelectPackage:f,onSelectView:m,selectedView:u}),(0,B.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col h-svh overflow-hidden bg-background`,children:[(0,B.jsx)(Lse,{selectedObject:o,selectedMeta:c,selectedView:u,packageLabel:i?.manifest?.name||i?.manifest?.id}),(0,B.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:u===`object`&&o?(0,B.jsx)(gk,{metadataType:`object`,metadataName:o,packageId:i?.manifest?.id}):u===`metadata`&&c?(0,B.jsx)(gk,{metadataType:c.type,metadataName:c.name,packageId:i?.manifest?.id}):u===`packages`?(0,B.jsx)(Wse,{}):u===`api-console`?(0,B.jsx)(Qse,{}):(0,B.jsx)(Rse,{packages:n,selectedPackage:i,onNavigate:g})})]}),(0,B.jsx)(Gce,{}),(0,B.jsx)(nge,{})]})})})}):(0,B.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,B.jsx)(`div`,{className:`h-8 w-8 mx-auto animate-spin rounded-full border-4 border-muted border-t-primary`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connecting to ObjectStack…`})]})})}var rve=Object.defineProperty,DA=(e,t)=>{for(var n in t)rve(e,n,{get:t[n],enumerable:!0})};DA({},{AggregationFunctionEnum:()=>ive,AppNameSchema:()=>dve,BaseMetadataRecordSchema:()=>sve,CacheStrategyEnum:()=>ove,CorsConfigSchema:()=>IA,EventNameSchema:()=>AA,FieldMappingSchema:()=>MA,FieldNameSchema:()=>lve,FlowNameSchema:()=>fve,HttpMethod:()=>NA,HttpMethodSchema:()=>PA,HttpRequestSchema:()=>FA,IsolationLevelEnum:()=>VA,MAP_SUPPORTED_FIELDS:()=>uj,METADATA_ALIASES:()=>hj,MetadataFormatSchema:()=>HA,MutationEventEnum:()=>ave,ObjectNameSchema:()=>cve,PLURAL_TO_SINGULAR:()=>dj,RateLimitConfigSchema:()=>LA,RoleNameSchema:()=>pve,SINGULAR_TO_PLURAL:()=>fj,SnakeCaseIdentifierSchema:()=>kA,SortDirectionEnum:()=>zA,SortItemSchema:()=>BA,StaticMountSchema:()=>RA,SystemIdentifierSchema:()=>OA,TransformTypeSchema:()=>jA,ViewNameSchema:()=>uve,findClosestMatches:()=>ij,formatSuggestion:()=>oj,formatZodError:()=>lj,formatZodIssue:()=>cj,levenshteinDistance:()=>rj,normalizeMetadataCollection:()=>pj,normalizePluginMetadata:()=>gj,normalizeStackInput:()=>mj,objectStackErrorMap:()=>sj,pluralToSingular:()=>Sve,safeParsePretty:()=>xve,singularToPlural:()=>Cve,suggestFieldType:()=>aj});var OA=r().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)`),kA=r().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)`),AA=r().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)`),jA=I(`type`,[h({type:m(`constant`),value:u().describe(`Constant value to use`)}).describe(`Set a constant value`),h({type:m(`cast`),targetType:E([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),h({type:m(`lookup`),table:r().describe(`Lookup table name`),keyField:r().describe(`Field to match on`),valueField:r().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),h({type:m(`javascript`),expression:r().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),h({type:m(`map`),mappings:d(r(),u()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]),MA=h({source:r().describe(`Source field name`),target:r().describe(`Target field name`),transform:jA.optional().describe(`Transformation to apply`),defaultValue:u().optional().describe(`Default if source is null/undefined`)}),NA=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),PA=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),FA=h({url:r().describe(`API endpoint URL`),method:PA.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)}),IA=h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(NA).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),LA=h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),RA=h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)}),ive=E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`),zA=E([`asc`,`desc`]).describe(`Sort order direction`),BA=h({field:r().describe(`Field name to sort by`),order:zA.describe(`Sort direction`)}).describe(`Sort field and direction pair`),ave=E([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),VA=E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),ove=E([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`),HA=E([`yaml`,`json`,`typescript`,`javascript`]).describe(`Metadata file format`),sve=h({id:r().describe(`Unique metadata record identifier`),type:r().describe(`Metadata type (e.g. "object", "view", "flow")`),name:kA.describe(`Machine name (snake_case)`),format:HA.optional().describe(`Source file format`)}).describe(`Base metadata record fields shared across kernel and system`),cve=kA.brand().describe(`Branded object name (snake_case, no dots)`),lve=kA.brand().describe(`Branded field name (snake_case, no dots)`),uve=OA.brand().describe(`Branded view name (system identifier)`),dve=OA.brand().describe(`Branded app name (system identifier)`),fve=OA.brand().describe(`Branded flow name (system identifier)`),pve=OA.brand().describe(`Branded role name (system identifier)`),UA=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),WA=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),GA=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),KA=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:UA.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:WA.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:GA.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`),mve=h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:KA.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`),qA=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),JA=h({field:r().describe(`Field name to apply masking to`),strategy:qA.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`),hve=h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(JA).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`),YA=E(`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(`.`)),XA=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:OA.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)}),gve=h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)}),ZA=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}),_ve=h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),vve=h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)}),QA=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),$A=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),ej=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),tj=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),nj=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:YA.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(XA).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:ZA.optional().describe(`Configuration for currency field type`),vectorConfig:QA.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:$A.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:KA.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:JA.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:tj.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:ej.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),yve={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 rj(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 ij(e,t,n=3,r=3){let i=e.toLowerCase().replace(/[-\s]/g,`_`);return t.map(e=>({value:e,distance:rj(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 bve={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 aj(e){let t=e.toLowerCase().replace(/[-\s]/g,`_`),n=bve[t];return n?[n]:ij(t,YA.options)}function oj(e){return e.length===0?``:e.length===1?`Did you mean '${e[0]}'?`:`Did you mean one of: ${e.map(e=>`'${e}'`).join(`, `)}?`}var sj=e=>{if(e.code===`invalid_value`){let t=e.values,n=e.input,r=String(n??``),i=t.map(String),a=YA.options;if(i.length>10&&a.every(e=>i.includes(e))){let e=oj(aj(r)),t=`Invalid field type '${r}'.`;return{message:e?`${t} ${e}`:`${t} Valid types: ${i.slice(0,10).join(`, `)}...`}}let o=oj(ij(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 cj(e){return` \u2717 ${e.path.length>0?e.path.join(`.`):`(root)`}: ${e.message}`}function lj(e,t){let n=e.issues.length;return`${t?`${t} (${n} issue${n===1?``:`s`}):`:`Validation failed (${n} issue${n===1?``:`s`}):`} + +${e.issues.map(cj).join(` +`)}`}function xve(e,t,n){let r=e.safeParse(t,{error:sj});return r.success?{success:!0,data:r.data}:{success:!1,error:r.error,formatted:lj(r.error,n)}}var uj=[`objects`,`apps`,`pages`,`dashboards`,`reports`,`actions`,`themes`,`workflows`,`approvals`,`flows`,`roles`,`permissions`,`sharingRules`,`policies`,`apis`,`webhooks`,`agents`,`ragPipelines`,`hooks`,`mappings`,`analyticsCubes`,`connectors`,`datasources`],dj={objects:`object`,apps:`app`,pages:`page`,dashboards:`dashboard`,reports:`report`,actions:`action`,themes:`theme`,workflows:`workflow`,approvals:`approval`,flows:`flow`,roles:`role`,permissions:`permission`,profiles:`profile`,sharingRules:`sharingRule`,policies:`policy`,apis:`api`,webhooks:`webhook`,agents:`agent`,ragPipelines:`ragPipeline`,hooks:`hook`,mappings:`mapping`,analyticsCubes:`analyticsCube`,connectors:`connector`,datasources:`datasource`,views:`view`},fj=Object.fromEntries(Object.entries(dj).map(([e,t])=>[t,e]));function Sve(e){return dj[e]??e}function Cve(e){return fj[e]??e}function pj(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 mj(e){let t={...e};for(let e of uj)e in t&&(t[e]=pj(t[e]));return t}var hj={triggers:`hooks`};function gj(e){let t={...e};for(let[e,n]of Object.entries(hj))if(e in t){let r=pj(t[e]),i=pj(t[n]);Array.isArray(r)&&(t[n]=Array.isArray(i)?[...i,...r]:r),delete t[e]}for(let e of uj)e in t&&(t[e]=pj(t[e]));return Array.isArray(t.plugins)&&(t.plugins=t.plugins.map(e=>e&&typeof e==`object`&&!Array.isArray(e)?gj(e):e)),t}DA({},{ALL_OPERATORS:()=>Nve,AddressSchema:()=>vve,AggregationFunction:()=>Dj,AggregationMetricType:()=>CN,AggregationNodeSchema:()=>Oj,AggregationPipelineSchema:()=>nye,AggregationStageSchema:()=>oN,AnalyticsQuerySchema:()=>AN,ApiMethod:()=>oM,AsyncValidationSchema:()=>Gj,BaseEngineOptionsSchema:()=>EM,CDCConfigSchema:()=>mM,ComparisonOperatorSchema:()=>Tve,ComputedFieldCacheSchema:()=>tj,ConditionalValidationSchema:()=>Jj,ConsistencyLevelSchema:()=>$M,CrossFieldValidationSchema:()=>Uj,CubeJoinSchema:()=>ON,CubeSchema:()=>kN,CurrencyConfigSchema:()=>ZA,CurrencyValueSchema:()=>_ve,CustomValidatorSchema:()=>Kj,DataEngineAggregateOptionsSchema:()=>Kve,DataEngineAggregateRequestSchema:()=>VM,DataEngineBatchRequestSchema:()=>WM,DataEngineContractSchema:()=>Jve,DataEngineCountOptionsSchema:()=>qve,DataEngineCountRequestSchema:()=>BM,DataEngineDeleteOptionsSchema:()=>Gve,DataEngineDeleteRequestSchema:()=>zM,DataEngineExecuteRequestSchema:()=>HM,DataEngineFilterSchema:()=>wM,DataEngineFindOneRequestSchema:()=>IM,DataEngineFindRequestSchema:()=>FM,DataEngineInsertOptionsSchema:()=>OM,DataEngineInsertRequestSchema:()=>LM,DataEngineQueryOptionsSchema:()=>Uve,DataEngineRequestSchema:()=>Yve,DataEngineSortSchema:()=>TM,DataEngineUpdateOptionsSchema:()=>Wve,DataEngineUpdateRequestSchema:()=>RM,DataEngineVectorFindRequestSchema:()=>UM,DataQualityRulesSchema:()=>ej,DataTypeMappingSchema:()=>XM,DatasetLoadResultSchema:()=>mN,DatasetMode:()=>sN,DatasetSchema:()=>cN,DatasourceCapabilities:()=>xN,DatasourceSchema:()=>SN,DimensionSchema:()=>DN,DimensionType:()=>wN,DocumentSchema:()=>sye,DocumentSchemaValidationSchema:()=>rN,DocumentTemplateSchema:()=>gN,DocumentVersionSchema:()=>hN,DriverCapabilitiesSchema:()=>KM,DriverConfigSchema:()=>JM,DriverDefinitionSchema:()=>lye,DriverInterfaceSchema:()=>Xve,DriverOptionsSchema:()=>GM,DriverType:()=>bN,ESignatureConfigSchema:()=>_N,EngineAggregateOptionsSchema:()=>jM,EngineCountOptionsSchema:()=>MM,EngineDeleteOptionsSchema:()=>AM,EngineQueryOptionsSchema:()=>DM,EngineUpdateOptionsSchema:()=>kM,EqualityOperatorSchema:()=>wve,ExternalDataSourceSchema:()=>vN,ExternalFieldMappingSchema:()=>yN,ExternalLookupSchema:()=>cye,FILTER_OPERATORS:()=>wj,FeedActorSchema:()=>FN,FeedFilterMode:()=>RN,FeedItemSchema:()=>LN,FeedItemType:()=>jN,FeedVisibility:()=>IN,Field:()=>yve,FieldChangeEntrySchema:()=>NN,FieldMappingSchema:()=>xM,FieldNodeSchema:()=>Fj,FieldOperatorsSchema:()=>vj,FieldReferenceSchema:()=>_j,FieldSchema:()=>nj,FieldType:()=>YA,FileAttachmentConfigSchema:()=>$A,FilterConditionSchema:()=>yj,FormatValidationSchema:()=>Hj,FullTextSearchSchema:()=>Ij,HookContextSchema:()=>Hve,HookEvent:()=>vM,HookSchema:()=>yM,IndexSchema:()=>cM,JSONValidationSchema:()=>Wj,JoinNodeSchema:()=>jj,JoinStrategy:()=>Aj,JoinType:()=>kj,LOGICAL_OPERATORS:()=>Tj,LocationCoordinatesSchema:()=>gve,MappingSchema:()=>SM,MentionSchema:()=>MN,MetricSchema:()=>EN,NoSQLDataTypeMappingSchema:()=>iN,NoSQLDatabaseTypeSchema:()=>QM,NoSQLDriverConfigSchema:()=>tye,NoSQLIndexSchema:()=>rye,NoSQLIndexTypeSchema:()=>eN,NoSQLOperationTypeSchema:()=>eye,NoSQLQueryOptionsSchema:()=>aN,NoSQLTransactionOptionsSchema:()=>iye,NormalizedFilterSchema:()=>bj,NotificationChannel:()=>BN,ObjectCapabilities:()=>sM,ObjectDependencyGraphSchema:()=>dN,ObjectDependencyNodeSchema:()=>uN,ObjectExtensionSchema:()=>_M,ObjectOwnershipEnum:()=>Vve,ObjectSchema:()=>gM,PartitioningConfigSchema:()=>pM,PoolConfigSchema:()=>qM,QueryFilterSchema:()=>Ave,QuerySchema:()=>Lj,RangeOperatorSchema:()=>Dve,ReactionSchema:()=>PN,RecordSubscriptionSchema:()=>VN,ReferenceResolutionErrorSchema:()=>fN,ReferenceResolutionSchema:()=>lN,ReplicationConfigSchema:()=>nN,SQLDialectSchema:()=>YM,SQLDriverConfigSchema:()=>Zve,SQLiteAlterTableLimitations:()=>$ve,SQLiteDataTypeMappingDefaults:()=>Qve,SSLConfigSchema:()=>ZM,ScriptValidationSchema:()=>zj,SearchConfigSchema:()=>lM,SeedLoaderConfigSchema:()=>pN,SeedLoaderRequestSchema:()=>oye,SeedLoaderResultSchema:()=>aye,SelectOptionSchema:()=>XA,SetOperatorSchema:()=>Eve,ShardingConfigSchema:()=>tN,SoftDeleteConfigSchema:()=>dM,SortNodeSchema:()=>Ej,SpecialOperatorSchema:()=>kve,StateMachineValidationSchema:()=>Vj,StringOperatorSchema:()=>Ove,SubscriptionEventType:()=>zN,TenancyConfigSchema:()=>uM,TenantDatabaseLifecycleSchema:()=>WN,TenantResolverStrategySchema:()=>HN,TimeUpdateInterval:()=>TN,TransformType:()=>bM,TursoGroupSchema:()=>UN,TursoMultiTenantConfigSchema:()=>uye,UniquenessValidationSchema:()=>Bj,VALID_AST_OPERATORS:()=>xj,ValidationRuleSchema:()=>qj,VectorConfigSchema:()=>QA,VersioningConfigSchema:()=>fM,WindowFunction:()=>Mj,WindowFunctionNodeSchema:()=>Pj,WindowSpecSchema:()=>Nj,isFilterAST:()=>Sj,parseFilterAST:()=>Cj});var _j=h({$field:r().describe(`Field Reference/Column Name`)}),wve=h({$eq:D().optional(),$ne:D().optional()}),Tve=h({$gt:l([P(),N(),_j]).optional(),$gte:l([P(),N(),_j]).optional(),$lt:l([P(),N(),_j]).optional(),$lte:l([P(),N(),_j]).optional()}),Eve=h({$in:C(D()).optional(),$nin:C(D()).optional()}),Dve=h({$between:w([l([P(),N(),_j]),l([P(),N(),_j])]).optional()}),Ove=h({$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional()}),kve=h({$null:S().optional(),$exists:S().optional()}),vj=h({$eq:D().optional(),$ne:D().optional(),$gt:l([P(),N(),_j]).optional(),$gte:l([P(),N(),_j]).optional(),$lt:l([P(),N(),_j]).optional(),$lte:l([P(),N(),_j]).optional(),$in:C(D()).optional(),$nin:C(D()).optional(),$between:w([l([P(),N(),_j]),l([P(),N(),_j])]).optional(),$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional(),$null:S().optional(),$exists:S().optional()}),yj=F(()=>d(r(),u()).and(h({$and:C(yj).optional(),$or:C(yj).optional(),$not:yj.optional()}))),Ave=h({where:yj.optional()}),bj=F(()=>h({$and:C(l([d(r(),vj),bj])).optional(),$or:C(l([d(r(),vj),bj])).optional(),$not:l([d(r(),vj),bj]).optional()})),xj=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function Sj(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=>Sj(e));if(e.length>=2&&typeof e[1]==`string`)return xj.has(e[1].toLowerCase())}return e.every(e=>Sj(e))?e.length>0:!1}var jve={"=":`$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 Mve(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=jve[i];return a?{[t]:{[a]:r}}:{[t]:{[`$${i}`]:r}}}function Cj(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=>Cj(e)).filter(Boolean);return r.length===0?void 0:r.length===1?r[0]:{[n]:r}}if(e.length>=2&&typeof t==`string`)return Mve(e);if(e.every(e=>Array.isArray(e))){let t=e.map(e=>Cj(e)).filter(Boolean);return t.length===0?void 0:t.length===1?t[0]:{$and:t}}}var wj=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],Tj=[`$and`,`$or`,`$not`],Nve=[...wj,...Tj],Ej=h({field:r(),order:E([`asc`,`desc`]).default(`asc`)}),Dj=E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),Oj=h({function:Dj.describe(`Aggregation function`),field:r().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:r().describe(`Result column alias`),distinct:S().optional().describe(`Apply DISTINCT before aggregation`),filter:yj.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)}),kj=E([`inner`,`left`,`right`,`full`]),Aj=E([`auto`,`database`,`hash`,`loop`]),jj=F(()=>h({type:kj.describe(`Join type`),strategy:Aj.optional().describe(`Execution strategy hint`),object:r().describe(`Object/table to join`),alias:r().optional().describe(`Table alias`),on:yj.describe(`Join condition`),subquery:F(()=>Lj).optional().describe(`Subquery instead of object`)})),Mj=E([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),Nj=h({partitionBy:C(r()).optional().describe(`PARTITION BY fields`),orderBy:C(Ej).optional().describe(`ORDER BY specification`),frame:h({type:E([`rows`,`range`]).optional(),start:r().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:r().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)}),Pj=h({function:Mj.describe(`Window function name`),field:r().optional().describe(`Field to operate on (for aggregate window functions)`),alias:r().describe(`Result column alias`),over:Nj.describe(`Window specification (OVER clause)`)}),Fj=F(()=>l([r(),h({field:r(),fields:C(Fj).optional(),alias:r().optional()})])),Ij=h({query:r().describe(`Search query text`),fields:C(r()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:S().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:E([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:d(r(),P()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:P().optional().describe(`Minimum relevance score threshold`),language:r().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:S().optional().default(!1).describe(`Enable search result highlighting`)}),Lj=h({object:r().describe(`Object name (e.g. account)`),fields:C(Fj).optional().describe(`Fields to retrieve`),where:yj.optional().describe(`Filtering criteria (WHERE)`),search:Ij.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:C(Ej).optional().describe(`Sorting instructions (ORDER BY)`),limit:P().optional().describe(`Max records to return (LIMIT)`),offset:P().optional().describe(`Records to skip (OFFSET)`),top:P().optional().describe(`Alias for limit (OData compatibility)`),cursor:d(r(),u()).optional().describe(`Cursor for keyset pagination`),joins:C(jj).optional().describe(`Explicit Table Joins`),aggregations:C(Oj).optional().describe(`Aggregation functions`),groupBy:C(r()).optional().describe(`GROUP BY fields`),having:yj.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:C(Pj).optional().describe(`Window functions with OVER clause`),distinct:S().optional().describe(`SELECT DISTINCT flag`)}).extend({expand:F(()=>d(r(),Lj)).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.`)}),Rj=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label for the rule listing`),description:r().optional().describe(`Administrative notes explaining the business reason`),active:S().default(!0),events:C(E([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:P().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:C(r()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:E([`error`,`warning`,`info`]).default(`error`),message:r().describe(`Error message to display to the user`)}),zj=Rj.extend({type:m(`script`),condition:r().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),Bj=Rj.extend({type:m(`unique`),fields:C(r()).describe(`Fields that must be combined unique`),scope:r().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:S().default(!0)}),Vj=Rj.extend({type:m(`state_machine`),field:r().describe(`State field (e.g. status)`),transitions:d(r(),C(r())).describe(`Map of { OldState: [AllowedNewStates] }`)}),Hj=Rj.extend({type:m(`format`),field:r(),regex:r().optional(),format:E([`email`,`url`,`phone`,`json`]).optional()}),Uj=Rj.extend({type:m(`cross_field`),condition:r().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:C(r()).describe(`Fields involved in the validation`)}),Wj=Rj.extend({type:m(`json_schema`),field:r().describe(`JSON field to validate`),schema:d(r(),u()).describe(`JSON Schema object definition`)}),Gj=Rj.extend({type:m(`async`),field:r().describe(`Field to validate`),validatorUrl:r().optional().describe(`External API endpoint for validation`),method:E([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:d(r(),r()).optional().describe(`Custom headers for the request`),validatorFunction:r().optional().describe(`Reference to custom validator function`),timeout:P().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:P().optional().describe(`Debounce delay in milliseconds`),params:d(r(),u()).optional().describe(`Additional parameters to pass to validator`)}),Kj=Rj.extend({type:m(`custom`),handler:r().describe(`Name of the custom validation function registered in the system`),params:d(r(),u()).optional().describe(`Parameters passed to the custom handler`)}),qj=F(()=>I(`type`,[zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,Jj])),Jj=Rj.extend({type:m(`conditional`),when:r().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:qj.describe(`Validation rule to apply when condition is true`),otherwise:qj.optional().describe(`Validation rule to apply when condition is false`)}),Yj=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),Xj=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),Zj=h({target:r().optional().describe(`Target State ID`),cond:Xj.optional().describe(`Condition (Guard) required to take this path`),actions:C(Yj).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)}),Pve=h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)}),Qj=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(Yj).optional().describe(`Actions to run when entering this state`),exit:C(Yj).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),Zj,C(Zj)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(Zj).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),Qj).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),$j=h({id:kA.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),Qj).describe(`State Nodes`),on:d(r(),l([r(),Zj,C(Zj)])).optional()}),Fve=h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}),q=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),eM=h({ariaLabel:q.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`),Ive=h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`),tM=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),nM=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`),Lve=h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:tM.optional().describe(`Default number formatting rules`),dateFormat:nM.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`),rM=h({name:r(),label:q,type:YA,required:S().default(!1),options:C(h({label:q,value:r()})).optional()}),iM=E([`script`,`url`,`modal`,`flow`,`api`]),Rve=new Set(iM.options.filter(e=>e!==`script`)),aM=h({name:kA.describe(`Machine name (lowercase snake_case)`),label:q.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:iM.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(rM).optional().describe(`Input parameters required from user`),variant:E([`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:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:eM.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(Rve.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),zve={create:e=>aM.parse(e)},oM=E([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),sM=h({trackHistory:S().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:S().default(!0).describe(`Index records for global search`),apiEnabled:S().default(!0).describe(`Expose object via automatic APIs`),apiMethods:C(oM).optional().describe(`Whitelist of allowed API operations`),files:S().default(!1).describe(`Enable file attachments and document management`),feeds:S().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:S().default(!1).describe(`Enable standard tasks and events tracking`),trash:S().default(!0).describe(`Enable soft-delete with restore capability`),mru:S().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:S().default(!0).describe(`Allow record deep cloning`)}),cM=h({name:r().optional().describe(`Index name (auto-generated if not provided)`),fields:C(r()).describe(`Fields included in the index`),type:E([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:S().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:r().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),lM=h({fields:C(r()).describe(`Fields to index for full-text search weighting`),displayFields:C(r()).optional().describe(`Fields to display in search result cards`),filters:C(r()).optional().describe(`Default filters for search results`)}),uM=h({enabled:S().describe(`Enable multi-tenancy for this object`),strategy:E([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:r().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:S().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),dM=h({enabled:S().describe(`Enable soft delete (trash/recycle bin)`),field:r().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:S().default(!1).describe(`Cascade soft delete to related records`)}),fM=h({enabled:S().describe(`Enable record versioning`),strategy:E([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:P().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:r().default(`version`).describe(`Field name for version number/timestamp`)}),pM=h({enabled:S().describe(`Enable table partitioning`),strategy:E([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:r().describe(`Field name to partition by`),interval:r().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"`}),mM=h({enabled:S().describe(`Enable Change Data Capture`),events:C(E([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:r().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),hM=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:r().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:r().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:r().optional().describe(`Developer documentation / description`),icon:r().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:r().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:C(r()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:S().optional().default(!0).describe(`Is the object active and usable`),isSystem:S().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:S().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:r().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:r().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:d(r().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),nj).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:C(cM).optional().describe(`Database performance indexes`),tenancy:uM.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:dM.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:fM.optional().describe(`Record versioning and history tracking configuration`),partitioning:pM.optional().describe(`Table partitioning configuration for performance`),cdc:mM.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:C(qj).optional().describe(`Object-level validation rules`),stateMachines:d(r(),$j).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:r().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:h({type:E([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:r().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:P().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:r().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:C(r()).optional().describe(`Primary fields for hover/cards/lookups`),search:lM.optional().describe(`Search engine configuration`),enable:sM.optional().describe(`Enabled system features modules`),recordTypes:C(r()).optional().describe(`Record type names for this object`),sharingModel:E([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:r().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:C(aM).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function Bve(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var gM=Object.assign(hM,{create:e=>{let t={...e,label:e.label??Bve(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return hM.parse(t)}}),Vve=E([`own`,`extend`]),_M=h({extend:r().describe(`Target object name (FQN) to extend`),fields:d(r(),nj).optional().describe(`Fields to add/override`),label:r().optional().describe(`Override label for the extended object`),pluralLabel:r().optional().describe(`Override plural label for the extended object`),description:r().optional().describe(`Override description for the extended object`),validations:C(qj).optional().describe(`Additional validation rules to merge into the target object`),indexes:C(cM).optional().describe(`Additional indexes to merge into the target object`),priority:P().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)}),vM=E([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]),yM=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:r().optional().describe(`Description of what this hook does`),object:l([r(),C(r())]).describe(`Target object(s)`),events:C(vM).describe(`Lifecycle events`),handler:l([r(),M()]).optional().describe(`Handler function name (string) or inline function reference`),priority:P().default(100).describe(`Execution priority`),async:S().default(!1).describe(`Run specifically as fire-and-forget`),condition:r().optional().describe(`Formula expression; hook runs only when TRUE (e.g., "status = 'closed' AND amount > 1000")`),description:r().optional().describe(`Human-readable description of what this hook does`),retryPolicy:h({maxRetries:P().default(3).describe(`Maximum retry attempts on failure`),backoffMs:P().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:P().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:E([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)}),Hve=h({id:r().optional().describe(`Unique execution ID for tracing`),object:r(),event:vM,input:d(r(),u()).describe(`Mutable input parameters`),result:u().optional().describe(`Operation result (After hooks only)`),previous:d(r(),u()).optional().describe(`Record state before operation`),session:h({userId:r().optional(),tenantId:r().optional(),roles:C(r()).optional(),accessToken:r().optional()}).optional().describe(`Current session context`),transaction:u().optional().describe(`Database transaction handle`),ql:u().describe(`ObjectQL Engine Reference`),api:u().optional().describe(`Cross-object data access (ScopedContext)`),user:h({id:r().optional(),name:r().optional(),email:r().optional()}).optional().describe(`Current user info shortcut`)}),bM=E([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),xM=h({source:l([r(),C(r())]).describe(`Source column header(s)`),target:l([r(),C(r())]).describe(`Target object field(s)`),transform:bM.default(`none`),params:h({value:u().optional(),object:r().optional(),fromField:r().optional(),toField:r().optional(),autoCreate:S().optional(),valueMap:d(r(),u()).optional(),separator:r().optional()}).optional()}),SM=h({name:kA.describe(`Mapping unique name (lowercase snake_case)`),label:r().optional(),sourceFormat:E([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:r().describe(`Target Object Name`),fieldMapping:C(xM),mode:E([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:C(r()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:Lj.optional().describe(`Query to run for export only`),errorPolicy:E([`skip`,`abort`,`retry`]).default(`skip`),batchSize:P().default(1e3)}),CM=h({userId:r().optional(),tenantId:r().optional(),roles:C(r()).default([]),permissions:C(r()).default([]),isSystem:S().default(!1),accessToken:r().optional(),transaction:u().optional(),traceId:r().optional()}),wM=l([d(r(),u()),yj]).describe(`Data Engine query filter conditions`),TM=l([d(r(),E([`asc`,`desc`])),d(r(),l([m(1),m(-1)])),C(Ej)]).describe(`Sort order definition`),EM=h({context:CM.optional()}),DM=EM.extend({where:l([d(r(),u()),yj]).optional(),fields:C(Fj).optional(),orderBy:C(Ej).optional(),limit:P().optional(),offset:P().optional(),top:P().optional(),cursor:d(r(),u()).optional(),search:Ij.optional(),expand:F(()=>d(r(),Lj)).optional(),distinct:S().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`),Uve=EM.extend({filter:wM.optional(),select:C(r()).optional(),sort:TM.optional(),limit:P().int().min(1).optional(),skip:P().int().min(0).optional(),top:P().int().min(1).optional(),populate:C(r()).optional()}).describe(`Query options for IDataEngine.find() operations`),OM=EM.extend({returning:S().default(!0).optional()}).describe(`Options for DataEngine.insert operations`),kM=EM.extend({where:l([d(r(),u()),yj]).optional(),upsert:S().default(!1).optional(),multi:S().default(!1).optional(),returning:S().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`),Wve=EM.extend({filter:wM.optional(),upsert:S().default(!1).optional(),multi:S().default(!1).optional(),returning:S().default(!1).optional()}).describe(`Options for DataEngine.update operations`),AM=EM.extend({where:l([d(r(),u()),yj]).optional(),multi:S().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`),Gve=EM.extend({filter:wM.optional(),multi:S().default(!1).optional()}).describe(`Options for DataEngine.delete operations`),jM=EM.extend({where:l([d(r(),u()),yj]).optional(),groupBy:C(r()).optional(),aggregations:C(Oj).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`),Kve=EM.extend({filter:wM.optional(),groupBy:C(r()).optional(),aggregations:C(h({field:r(),method:E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:r().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`),MM=EM.extend({where:l([d(r(),u()),yj]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`),qve=EM.extend({filter:wM.optional()}).describe(`Options for DataEngine.count operations`),Jve=h({find:M().input(w([r(),DM.optional()])).output(i(C(u()))),findOne:M().input(w([r(),DM.optional()])).output(i(u())),insert:M().input(w([r(),l([d(r(),u()),C(d(r(),u()))]),OM.optional()])).output(i(u())),update:M().input(w([r(),d(r(),u()),kM.optional()])).output(i(u())),delete:M().input(w([r(),AM.optional()])).output(i(u())),count:M().input(w([r(),MM.optional()])).output(i(P())),aggregate:M().input(w([r(),jM])).output(i(C(u())))}).describe(`Standard Data Engine Contract`),NM={filter:wM.optional()},PM=DM.extend({...NM,select:C(r()).optional(),sort:TM.optional(),skip:P().int().min(0).optional(),populate:C(r()).optional()}),FM=h({method:m(`find`),object:r(),query:PM.optional()}),IM=h({method:m(`findOne`),object:r(),query:PM.optional()}),LM=h({method:m(`insert`),object:r(),data:l([d(r(),u()),C(d(r(),u()))]),options:OM.optional()}),RM=h({method:m(`update`),object:r(),data:d(r(),u()),id:l([r(),P()]).optional().describe(`ID for single update, or use where in options`),options:kM.extend(NM).optional()}),zM=h({method:m(`delete`),object:r(),id:l([r(),P()]).optional().describe(`ID for single delete, or use where in options`),options:AM.extend(NM).optional()}),BM=h({method:m(`count`),object:r(),query:MM.extend(NM).optional()}),VM=h({method:m(`aggregate`),object:r(),query:jM.extend(NM)}),HM=h({method:m(`execute`),command:u(),options:d(r(),u()).optional()}),UM=h({method:m(`vectorFind`),object:r(),vector:C(P()),where:l([d(r(),u()),yj]).optional(),fields:C(r()).optional(),limit:P().int().default(5).optional(),threshold:P().optional()}),WM=h({method:m(`batch`),requests:C(I(`method`,[FM,IM,LM,RM,zM,BM,VM,HM,UM])),transaction:S().default(!0).optional()}),Yve=I(`method`,[FM,IM,LM,RM,zM,BM,VM,WM,HM,UM]).describe(`Virtual ObjectQL Request Protocol`),GM=h({transaction:u().optional().describe(`Transaction handle`),timeout:P().optional().describe(`Timeout in ms`),skipCache:S().optional().describe(`Bypass cache`),traceContext:d(r(),r()).optional().describe(`OpenTelemetry context or request ID`),tenantId:r().optional().describe(`Tenant Isolation identifier`)}),KM=h({create:S().default(!0).describe(`Supports CREATE operations`),read:S().default(!0).describe(`Supports READ operations`),update:S().default(!0).describe(`Supports UPDATE operations`),delete:S().default(!0).describe(`Supports DELETE operations`),bulkCreate:S().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:S().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:S().default(!1).describe(`Supports bulk DELETE operations`),transactions:S().default(!1).describe(`Supports ACID transactions`),savepoints:S().default(!1).describe(`Supports transaction savepoints`),isolationLevels:C(VA).optional().describe(`Supported isolation levels`),queryFilters:S().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:S().default(!1).describe(`Supports GROUP BY and aggregation functions`),querySorting:S().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:S().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:S().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:S().default(!1).describe(`Supports subqueries`),queryCTE:S().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:S().default(!1).describe(`Supports SQL joins`),fullTextSearch:S().default(!1).describe(`Supports full-text search`),jsonQuery:S().default(!1).describe(`Supports JSON field querying`),geospatialQuery:S().default(!1).describe(`Supports geospatial queries`),streaming:S().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:S().default(!1).describe(`Supports JSON field types`),arrayFields:S().default(!1).describe(`Supports array field types`),vectorSearch:S().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:S().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:S().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:S().default(!1).describe(`Supports database migrations`),indexes:S().default(!1).describe(`Supports index creation and management`),connectionPooling:S().default(!1).describe(`Supports connection pooling`),preparedStatements:S().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:S().default(!1).describe(`Supports query result caching`)}),Xve=h({name:r().describe(`Driver unique name`),version:r().describe(`Driver version`),supports:KM,connect:M().input(w([])).output(i(te())).describe(`Establish connection`),disconnect:M().input(w([])).output(i(te())).describe(`Close connection`),checkHealth:M().input(w([])).output(i(S())).describe(`Health check`),getPoolStats:M().input(w([])).output(h({total:P(),idle:P(),active:P(),waiting:P()}).optional()).optional().describe(`Get connection pool statistics`),execute:M().input(w([u(),C(u()).optional(),GM.optional()])).output(i(u())).describe(`Execute raw command`),find:M().input(w([r(),Lj,GM.optional()])).output(i(C(d(r(),u())))).describe(`Find records`),findStream:M().input(w([r(),Lj,GM.optional()])).output(u()).describe(`Stream records (AsyncIterable)`),findOne:M().input(w([r(),Lj,GM.optional()])).output(i(d(r(),u()).nullable())).describe(`Find one record`),create:M().input(w([r(),d(r(),u()),GM.optional()])).output(i(d(r(),u()))).describe(`Create record`),update:M().input(w([r(),r().or(P()),d(r(),u()),GM.optional()])).output(i(d(r(),u()))).describe(`Update record`),upsert:M().input(w([r(),d(r(),u()),C(r()).optional(),GM.optional()])).output(i(d(r(),u()))).describe(`Upsert record`),delete:M().input(w([r(),r().or(P()),GM.optional()])).output(i(S())).describe(`Delete record`),count:M().input(w([r(),Lj.optional(),GM.optional()])).output(i(P())).describe(`Count records`),bulkCreate:M().input(w([r(),C(d(r(),u())),GM.optional()])).output(i(C(d(r(),u())))),bulkUpdate:M().input(w([r(),C(h({id:r().or(P()),data:d(r(),u())})),GM.optional()])).output(i(C(d(r(),u())))),bulkDelete:M().input(w([r(),C(r().or(P())),GM.optional()])).output(i(te())),updateMany:M().input(w([r(),Lj,d(r(),u()),GM.optional()])).output(i(P())).optional(),deleteMany:M().input(w([r(),Lj,GM.optional()])).output(i(P())).optional(),beginTransaction:M().input(w([h({isolationLevel:VA.optional()}).optional()])).output(i(u())).describe(`Start transaction`),commit:M().input(w([u()])).output(i(te())).describe(`Commit transaction`),rollback:M().input(w([u()])).output(i(te())).describe(`Rollback transaction`),syncSchema:M().input(w([r(),u(),GM.optional()])).output(i(te())).describe(`Sync object schema to DB`),syncSchemasBatch:M().input(w([C(h({object:r(),schema:u()})),GM.optional()])).output(i(te())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:M().input(w([r(),GM.optional()])).output(i(te())),explain:M().input(w([r(),Lj,GM.optional()])).output(i(u())).optional()}),qM=h({min:P().min(0).default(2).describe(`Minimum number of connections in pool`),max:P().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:P().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:P().min(0).default(5e3).describe(`Time in ms to wait for available connection`)}),JM=h({name:r().describe(`Driver instance name`),type:E([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:KM.describe(`Driver capability flags`),connectionString:r().optional().describe(`Database connection string (driver-specific format)`),poolConfig:qM.optional().describe(`Connection pool configuration`)}),YM=E([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`]),XM=h({text:r().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:r().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:r().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:r().describe(`SQL type for date fields (e.g., DATE)`),datetime:r().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:r().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:r().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:r().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)}),ZM=h({rejectUnauthorized:S().default(!0).describe(`Reject connections with invalid certificates`),ca:r().optional().describe(`CA certificate file path or content`),cert:r().optional().describe(`Client certificate file path or content`),key:r().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`}),Zve=JM.extend({type:m(`sql`).describe(`Driver type must be "sql"`),dialect:YM.describe(`SQL database dialect`),dataTypeMapping:XM.describe(`SQL data type mapping configuration`),ssl:S().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:ZM.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`}),Qve={text:`TEXT`,number:`REAL`,boolean:`INTEGER`,date:`TEXT`,datetime:`TEXT`,json:`TEXT`,uuid:`TEXT`,binary:`BLOB`},$ve={supportsAddColumn:!0,supportsRenameColumn:!0,supportsDropColumn:!0,supportsModifyColumn:!1,supportsAddConstraint:!1,rebuildStrategy:`create_copy_drop_rename`},QM=E([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]),eye=E([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]),$M=E([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`]),eN=E([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`]),tN=h({enabled:S().default(!1).describe(`Enable sharding`),shardKey:r().optional().describe(`Field to use as shard key`),shardingStrategy:E([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:P().int().positive().optional().describe(`Number of shards`)}),nN=h({enabled:S().default(!1).describe(`Enable replication`),replicaSetName:r().optional().describe(`Replica set name`),replicas:P().int().positive().optional().describe(`Number of replicas`),readPreference:E([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:E([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)}),rN=h({enabled:S().default(!1).describe(`Enable schema validation`),validationLevel:E([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:E([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:d(r(),u()).optional().describe(`JSON Schema for validation`)}),iN=h({text:r().describe(`NoSQL type for text fields`),number:r().describe(`NoSQL type for number fields`),boolean:r().describe(`NoSQL type for boolean fields`),date:r().describe(`NoSQL type for date fields`),datetime:r().describe(`NoSQL type for datetime fields`),json:r().optional().describe(`NoSQL type for JSON/object fields`),uuid:r().optional().describe(`NoSQL type for UUID fields`),binary:r().optional().describe(`NoSQL type for binary fields`),array:r().optional().describe(`NoSQL type for array fields`),objectId:r().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:r().optional().describe(`NoSQL type for geospatial point fields`)}),tye=JM.extend({type:m(`nosql`).describe(`Driver type must be "nosql"`),databaseType:QM.describe(`Specific NoSQL database type`),dataTypeMapping:iN.describe(`NoSQL data type mapping configuration`),consistency:$M.optional().describe(`Consistency level for operations`),replication:nN.optional().describe(`Replication configuration`),sharding:tN.optional().describe(`Sharding configuration`),schemaValidation:rN.optional().describe(`Document schema validation`),region:r().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:r().optional().describe(`AWS access key ID`),secretAccessKey:r().optional().describe(`AWS secret access key`),ttlField:r().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:P().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:r().optional().describe(`Prefix for collection/table names`)}),aN=h({consistency:$M.optional().describe(`Consistency level override`),readFromSecondary:S().optional().describe(`Allow reading from secondary replicas`),projection:d(r(),l([m(0),m(1)])).optional().describe(`Field projection`),timeout:P().int().positive().optional().describe(`Query timeout (ms)`),useCursor:S().optional().describe(`Use cursor instead of loading all results`),batchSize:P().int().positive().optional().describe(`Cursor batch size`),profile:S().optional().describe(`Enable query profiling`),hint:r().optional().describe(`Index hint for query optimization`)}),oN=h({operator:r().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:d(r(),u()).describe(`Stage-specific options`)}),nye=h({collection:r().describe(`Collection/table name`),stages:C(oN).describe(`Aggregation pipeline stages`),options:aN.optional().describe(`Query options`)}),rye=h({name:r().describe(`Index name`),type:eN.describe(`Index type`),fields:C(h({field:r().describe(`Field name`),order:E([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:S().default(!1).describe(`Enforce uniqueness`),sparse:S().default(!1).describe(`Sparse index`),expireAfterSeconds:P().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:d(r(),u()).optional().describe(`Partial index filter`),background:S().default(!1).describe(`Create index in background`)}),iye=h({readConcern:E([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:E([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:E([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:P().int().positive().optional().describe(`Transaction commit timeout (ms)`)}),sN=E([`insert`,`update`,`upsert`,`replace`,`ignore`]),cN=h({object:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:r().default(`name`).describe(`Field match for uniqueness check`),mode:sN.default(`upsert`).describe(`Conflict resolution strategy`),env:C(E([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:C(d(r(),u())).describe(`Data records`)}),lN=h({field:r().describe(`Source field name containing the reference value`),targetObject:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:r().default(`name`).describe(`Field on target object used for matching`),fieldType:E([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`),uN=h({object:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:C(r()).describe(`Objects this object depends on`),references:C(lN).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`),dN=h({nodes:C(uN).describe(`All objects in the dependency graph`),insertOrder:C(r()).describe(`Topologically sorted insert order`),circularDependencies:C(C(r())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`),fN=h({sourceObject:r().describe(`Object with the broken reference`),field:r().describe(`Field name with unresolved reference`),targetObject:r().describe(`Target object searched for the reference`),targetField:r().describe(`ExternalId field used for matching`),attemptedValue:u().describe(`Value that failed to resolve`),recordIndex:P().int().min(0).describe(`Index of the record in the dataset`),message:r().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`),pN=h({dryRun:S().default(!1).describe(`Validate references without writing data`),haltOnError:S().default(!1).describe(`Stop on first reference resolution error`),multiPass:S().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:sN.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:P().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:S().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:E([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`)}).describe(`Seed data loader configuration`),mN=h({object:r().describe(`Object that was loaded`),mode:sN.describe(`Import mode used`),inserted:P().int().min(0).describe(`Records inserted`),updated:P().int().min(0).describe(`Records updated`),skipped:P().int().min(0).describe(`Records skipped`),errored:P().int().min(0).describe(`Records with errors`),total:P().int().min(0).describe(`Total records in dataset`),referencesResolved:P().int().min(0).describe(`References resolved via externalId`),referencesDeferred:P().int().min(0).describe(`References deferred to second pass`),errors:C(fN).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`),aye=h({success:S().describe(`Overall success status`),dryRun:S().describe(`Whether this was a dry-run`),dependencyGraph:dN.describe(`Object dependency graph`),results:C(mN).describe(`Per-object load results`),errors:C(fN).describe(`All reference resolution errors`),summary:h({objectsProcessed:P().int().min(0).describe(`Total objects processed`),totalRecords:P().int().min(0).describe(`Total records across all objects`),totalInserted:P().int().min(0).describe(`Total records inserted`),totalUpdated:P().int().min(0).describe(`Total records updated`),totalSkipped:P().int().min(0).describe(`Total records skipped`),totalErrored:P().int().min(0).describe(`Total records with errors`),totalReferencesResolved:P().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:P().int().min(0).describe(`Total references deferred`),circularDependencyCount:P().int().min(0).describe(`Circular dependency chains detected`),durationMs:P().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`),oye=h({datasets:C(cN).min(1).describe(`Datasets to load`),config:a(e=>e??{},pN).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`),hN=h({versionNumber:P().describe(`Version number`),createdAt:P().describe(`Creation timestamp`),createdBy:r().describe(`Creator user ID`),size:P().describe(`File size in bytes`),checksum:r().describe(`File checksum`),downloadUrl:r().url().describe(`Download URL`),isLatest:S().optional().default(!1).describe(`Is latest version`)}),gN=h({id:r().describe(`Template ID`),name:r().describe(`Template name`),description:r().optional().describe(`Template description`),fileUrl:r().url().describe(`Template file URL`),fileType:r().describe(`File MIME type`),placeholders:C(h({key:r().describe(`Placeholder key`),label:r().describe(`Placeholder label`),type:E([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:S().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)}),_N=h({provider:E([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:S().optional().default(!1).describe(`E-signature enabled`),signers:C(h({email:r().email().describe(`Signer email`),name:r().describe(`Signer name`),role:r().describe(`Signer role`),order:P().describe(`Signing order`)})).describe(`Document signers`),expirationDays:P().optional().default(30).describe(`Expiration days`),reminderDays:P().optional().default(7).describe(`Reminder interval days`)}),sye=h({id:r().describe(`Document ID`),name:r().describe(`Document name`),description:r().optional().describe(`Document description`),fileType:r().describe(`File MIME type`),fileSize:P().describe(`File size in bytes`),category:r().optional().describe(`Document category`),tags:C(r()).optional().describe(`Document tags`),versioning:h({enabled:S().describe(`Versioning enabled`),versions:C(hN).describe(`Version history`),majorVersion:P().describe(`Major version`),minorVersion:P().describe(`Minor version`)}).optional().describe(`Version control`),template:gN.optional().describe(`Document template`),eSignature:_N.optional().describe(`E-signature config`),access:h({isPublic:S().optional().default(!1).describe(`Public access`),sharedWith:C(r()).optional().describe(`Shared with`),expiresAt:P().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),vN=h({id:r().describe(`Data source ID`),name:r().describe(`Data source name`),type:E([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:r().url().describe(`API endpoint URL`),authentication:h({type:E([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:d(r(),u()).describe(`Auth configuration`)}).describe(`Authentication`)}),yN=MA.extend({type:r().optional().describe(`Field type`),readonly:S().optional().default(!0).describe(`Read-only field`)}),cye=h({fieldName:r().describe(`Field name`),dataSource:vN.describe(`External data source`),query:h({endpoint:r().describe(`Query endpoint path`),method:E([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:d(r(),u()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:C(yN).describe(`Field mappings`),caching:h({enabled:S().optional().default(!0).describe(`Cache enabled`),ttl:P().optional().default(300).describe(`Cache TTL (seconds)`),strategy:E([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:h({enabled:S().optional().default(!0).describe(`Fallback enabled`),defaultValue:u().optional().describe(`Default fallback value`),showError:S().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:h({requestsPerSecond:P().describe(`Requests per second limit`),burstSize:P().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:h({maxRetries:P().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:P().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:P().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:C(P()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:h({request:h({headers:d(r(),r()).optional().describe(`Additional request headers`),queryParams:d(r(),r()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:h({dataPath:r().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:r().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:h({type:E([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:P().default(100).describe(`Items per page`),maxPages:P().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)}),bN=r().describe(`Underlying driver identifier`),lye=h({id:r().describe(`Unique driver identifier (e.g. "postgres")`),label:r().describe(`Display label (e.g. "PostgreSQL")`),description:r().optional(),icon:r().optional(),configSchema:d(r(),u()).describe(`JSON Schema for connection configuration`),capabilities:F(()=>xN).optional()}),xN=h({transactions:S().default(!1),queryFilters:S().default(!1),queryAggregations:S().default(!1),querySorting:S().default(!1),queryPagination:S().default(!1),queryWindowFunctions:S().default(!1),querySubqueries:S().default(!1),joins:S().default(!1),fullTextSearch:S().default(!1),readOnly:S().default(!1),dynamicSchema:S().default(!1)}),SN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:r().optional().describe(`Display label`),driver:bN.describe(`Underlying driver type`),config:d(r(),u()).describe(`Driver specific configuration`),pool:h({min:P().default(0).describe(`Minimum connections`),max:P().default(10).describe(`Maximum connections`),idleTimeoutMillis:P().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:P().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:C(d(r(),u())).optional().describe(`Read-only replica configurations`),capabilities:xN.optional().describe(`Capability overrides`),healthCheck:h({enabled:S().default(!0).describe(`Enable health check endpoint`),intervalMs:P().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:P().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:h({enabled:S().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:S().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:r().optional().describe(`CA certificate (PEM format or path to file)`),cert:r().optional().describe(`Client certificate (PEM format or path to file)`),key:r().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:h({maxRetries:P().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:P().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:P().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:P().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:r().optional().describe(`Internal description`),active:S().default(!0).describe(`Is datasource enabled`)}),CN=E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),wN=E([`string`,`number`,`boolean`,`time`,`geo`]),TN=E([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),EN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:r().describe(`Human readable label`),description:r().optional(),type:CN,sql:r().describe(`SQL expression or field reference`),filters:C(h({sql:r()})).optional(),format:r().optional()}),DN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:r().describe(`Human readable label`),description:r().optional(),type:wN,sql:r().describe(`SQL expression or column reference`),granularities:C(TN).optional()}),ON=h({name:r().describe(`Target cube name`),relationship:E([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:r().describe(`Join condition (ON clause)`)}),kN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:r().optional(),description:r().optional(),sql:r().describe(`Base SQL statement or Table Name`),measures:d(r(),EN).describe(`Quantitative metrics`),dimensions:d(r(),DN).describe(`Qualitative attributes`),joins:d(r(),ON).optional(),refreshKey:h({every:r().optional(),sql:r().optional()}).optional(),public:S().default(!1)}),AN=h({cube:r().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:C(r()).describe(`List of metrics to calculate`),dimensions:C(r()).optional().describe(`List of dimensions to group by`),filters:C(h({member:r().describe(`Dimension or Measure`),operator:E([`equals`,`notEquals`,`contains`,`notContains`,`gt`,`gte`,`lt`,`lte`,`set`,`notSet`,`inDateRange`]),values:C(r()).optional()})).optional(),timeDimensions:C(h({dimension:r(),granularity:TN.optional(),dateRange:l([r(),C(r())]).optional()})).optional(),order:d(r(),E([`asc`,`desc`])).optional(),limit:P().optional(),offset:P().optional(),timezone:r().optional().default(`UTC`)}),jN=E([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),MN=h({type:E([`user`,`team`,`record`]).describe(`Mention target type`),id:r().describe(`Target ID`),name:r().describe(`Display name for rendering`),offset:P().int().min(0).describe(`Character offset in body text`),length:P().int().min(1).describe(`Length of mention token in body text`)}),NN=h({field:r().describe(`Field machine name`),fieldLabel:r().optional().describe(`Field display label`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`),oldDisplayValue:r().optional().describe(`Human-readable old value`),newDisplayValue:r().optional().describe(`Human-readable new value`)}),PN=h({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:C(r()).describe(`Users who reacted`),count:P().int().min(1).describe(`Total reaction count`)}),FN=h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`),avatarUrl:r().url().optional().describe(`Actor avatar URL`),source:r().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),IN=E([`public`,`internal`,`private`]),LN=h({id:r().describe(`Feed item ID`),type:jN.describe(`Activity type`),object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID this feed item belongs to`),actor:FN.describe(`Who performed this action`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(MN).optional().describe(`Mentioned users/teams/records`),changes:C(NN).optional().describe(`Field-level changes`),reactions:C(PN).optional().describe(`Emoji reactions on this item`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),replyCount:P().int().min(0).default(0).describe(`Number of replies`),pinned:S().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:r().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:r().optional().describe(`User ID who pinned the item`),starred:S().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:r().datetime().optional().describe(`Timestamp when the item was starred`),visibility:IN.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:r().datetime().describe(`Creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),editedAt:r().datetime().optional().describe(`When comment was last edited`),isEdited:S().default(!1).describe(`Whether comment has been edited`)}),RN=E([`all`,`comments_only`,`changes_only`,`tasks_only`]),zN=E([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),BN=E([`in_app`,`email`,`push`,`slack`]),VN=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),userId:r().describe(`Subscribing user ID`),events:C(zN).default([`all`]).describe(`Event types to receive notifications for`),channels:C(BN).default([`in_app`]).describe(`Notification delivery channels`),active:S().default(!0).describe(`Whether the subscription is active`),createdAt:r().datetime().describe(`Subscription creation timestamp`)}),HN=E([`header`,`subdomain`,`path`,`token`,`lookup`]).describe(`Strategy for resolving tenant identity from request context`),UN=h({name:r().min(1).describe(`Turso database group name`),primaryLocation:r().min(2).describe(`Primary Turso region code (e.g., iad, lhr, nrt)`),replicaLocations:C(r().min(2)).default([]).describe(`Additional replica region codes`),schemaDatabase:r().optional().describe(`Schema database name for multi-db schemas`)}).describe(`Turso database group configuration`),WN=h({onTenantCreate:h({autoCreate:S().default(!0).describe(`Auto-create database on tenant registration`),group:r().optional().describe(`Turso group for the new database`),applyGroupSchema:S().default(!0).describe(`Apply shared schema from group`),seedData:S().default(!1).describe(`Populate seed data on creation`)}).describe(`Tenant creation hook`),onTenantDelete:h({immediate:S().default(!1).describe(`Destroy database immediately`),gracePeriodHours:P().int().min(0).default(72).describe(`Grace period before permanent deletion`),createBackup:S().default(!0).describe(`Create backup before deletion`)}).describe(`Tenant deletion hook`),onTenantSuspend:h({revokeTokens:S().default(!0).describe(`Revoke auth tokens on suspension`),readOnly:S().default(!0).describe(`Set database to read-only on suspension`)}).describe(`Tenant suspension hook`)}).describe(`Tenant database lifecycle hooks`),uye=h({organizationSlug:r().min(1).describe(`Turso organization slug`),urlTemplate:r().min(1).describe(`URL template with {tenant_id} placeholder`),groupAuthToken:r().min(1).describe(`Group-level auth token for platform operations`),tenantResolverStrategy:HN.default(`token`),group:UN.optional().describe(`Database group configuration`),lifecycle:WN.optional().describe(`Lifecycle hooks`),maxCachedConnections:P().int().min(1).default(100).describe(`Max cached tenant connections (LRU)`),connectionCacheTTL:P().int().min(0).default(300).describe(`Connection cache TTL in seconds`)}).describe(`Turso multi-tenant router configuration`);DA({},{AuditPolicySchema:()=>sP,CriteriaSharingRuleSchema:()=>eP,FieldPermissionSchema:()=>YN,NetworkPolicySchema:()=>aP,OWDModel:()=>gye,ObjectPermissionSchema:()=>JN,OwnerSharingRuleSchema:()=>tP,PasswordPolicySchema:()=>iP,PermissionSetSchema:()=>XN,PolicySchema:()=>cP,RLS:()=>hye,RLSAuditConfigSchema:()=>qN,RLSAuditEventSchema:()=>dye,RLSConfigSchema:()=>fye,RLSEvaluationResultSchema:()=>mye,RLSOperation:()=>GN,RLSUserContextSchema:()=>pye,RowLevelSecurityPolicySchema:()=>KN,SessionPolicySchema:()=>oP,ShareRecipientType:()=>QN,SharingLevel:()=>ZN,SharingRuleSchema:()=>nP,SharingRuleType:()=>_ye,TerritoryModelSchema:()=>vye,TerritorySchema:()=>yye,TerritoryType:()=>rP});var GN=E([`select`,`insert`,`update`,`delete`,`all`]),KN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy unique identifier (snake_case)`),label:r().optional().describe(`Human-readable policy label`),description:r().optional().describe(`Policy description and business justification`),object:r().describe(`Target object name`),operation:GN.describe(`Database operation this policy applies to`),using:r().optional().describe(`Filter condition for SELECT/UPDATE/DELETE (PostgreSQL SQL WHERE clause syntax with parameterized context variables). Optional for INSERT-only policies.`),check:r().optional().describe(`Validation condition for INSERT/UPDATE (defaults to USING clause if not specified - enforced at application level)`),roles:C(r()).optional().describe(`Roles this policy applies to (omit for all roles)`),enabled:S().default(!0).describe(`Whether this policy is active`),priority:P().int().default(0).describe(`Policy evaluation priority (higher = evaluated first)`),tags:C(r()).optional().describe(`Policy categorization tags`)}).superRefine((e,t)=>{!e.using&&!e.check&&t.addIssue({code:de.custom,message:`At least one of "using" or "check" must be specified. For SELECT/UPDATE/DELETE operations, provide "using". For INSERT operations, provide "check".`})}),dye=h({timestamp:r().describe(`ISO 8601 timestamp of the evaluation`),userId:r().describe(`User ID whose access was evaluated`),operation:E([`select`,`insert`,`update`,`delete`]).describe(`Database operation being performed`),object:r().describe(`Target object name`),policyName:r().describe(`Name of the RLS policy evaluated`),granted:S().describe(`Whether access was granted`),evaluationDurationMs:P().describe(`Policy evaluation duration in milliseconds`),matchedCondition:r().optional().describe(`Which USING/CHECK clause matched`),rowCount:P().optional().describe(`Number of rows affected`),metadata:d(r(),u()).optional().describe(`Additional audit event metadata`)}),qN=h({enabled:S().describe(`Enable RLS audit logging`),logLevel:E([`all`,`denied_only`,`granted_only`,`none`]).describe(`Which evaluations to log`),destination:E([`system_log`,`audit_trail`,`external`]).describe(`Audit log destination`),sampleRate:P().min(0).max(1).describe(`Sampling rate (0-1) for high-traffic environments`),retentionDays:P().int().default(90).describe(`Audit log retention period in days`),includeRowData:S().default(!1).describe(`Include row data in audit logs (security-sensitive)`),alertOnDenied:S().default(!0).describe(`Send alerts when access is denied`)}),fye=h({enabled:S().default(!0).describe(`Enable RLS enforcement globally`),defaultPolicy:E([`deny`,`allow`]).default(`deny`).describe(`Default action when no policies match`),allowSuperuserBypass:S().default(!0).describe(`Allow superusers to bypass RLS`),bypassRoles:C(r()).optional().describe(`Roles that bypass RLS (see all data)`),logEvaluations:S().default(!1).describe(`Log RLS policy evaluations for debugging`),cacheResults:S().default(!0).describe(`Cache RLS evaluation results`),cacheTtlSeconds:P().int().positive().default(300).describe(`Cache TTL in seconds`),prefetchUserContext:S().default(!0).describe(`Pre-fetch user context for performance`),audit:qN.optional().describe(`RLS audit logging configuration`)}),pye=h({id:r().describe(`User ID`),email:r().email().optional().describe(`User email`),tenantId:r().optional().describe(`Tenant/Organization ID`),role:l([r(),C(r())]).optional().describe(`User role(s)`),department:r().optional().describe(`User department`),attributes:d(r(),u()).optional().describe(`Additional custom user attributes`)}),mye=h({policyName:r().describe(`Policy name`),granted:S().describe(`Whether access was granted`),durationMs:P().optional().describe(`Evaluation duration in milliseconds`),error:r().optional().describe(`Error message if evaluation failed`),usingResult:S().optional().describe(`USING clause evaluation result`),checkResult:S().optional().describe(`CHECK clause evaluation result`)}),hye={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})},JN=h({allowCreate:S().default(!1).describe(`Create permission`),allowRead:S().default(!1).describe(`Read permission`),allowEdit:S().default(!1).describe(`Edit permission`),allowDelete:S().default(!1).describe(`Delete permission`),allowTransfer:S().default(!1).describe(`Change record ownership`),allowRestore:S().default(!1).describe(`Restore from trash (Undelete)`),allowPurge:S().default(!1).describe(`Permanently delete (Hard Delete/GDPR)`),viewAllRecords:S().default(!1).describe(`View All Data (Bypass Sharing)`),modifyAllRecords:S().default(!1).describe(`Modify All Data (Bypass Sharing)`)}),YN=h({readable:S().default(!0).describe(`Field read access`),editable:S().default(!1).describe(`Field edit access`)}),XN=h({name:kA.describe(`Permission set unique name (lowercase snake_case)`),label:r().optional().describe(`Display label`),isProfile:S().default(!1).describe(`Whether this is a user profile`),objects:d(r(),JN).describe(`Entity permissions`),fields:d(r(),YN).optional().describe(`Field level security`),systemPermissions:C(r()).optional().describe(`System level capabilities`),tabPermissions:d(r(),E([`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:C(KN).optional().describe(`Row-level security policies (see rls.zod.ts for full spec)`),contextVariables:d(r(),u()).optional().describe(`Context variables for RLS evaluation`)}),gye=E([`private`,`public_read`,`public_read_write`,`controlled_by_parent`]),_ye=E([`owner`,`criteria`]),ZN=E([`read`,`edit`,`full`]),QN=E([`user`,`group`,`role`,`role_and_subordinates`,`guest`]),$N=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label`),description:r().optional().describe(`Administrative notes`),object:r().describe(`Target Object Name`),active:S().default(!0),accessLevel:ZN.default(`read`),sharedWith:h({type:QN,value:r().describe(`ID or Code of the User/Group/Role`)}).describe(`The recipient of the shared access`)}),eP=$N.extend({type:m(`criteria`),condition:r().describe(`Formula condition (e.g. "department = 'Sales'")`)}),tP=$N.extend({type:m(`owner`),ownedBy:h({type:QN,value:r()}).describe(`Source group/role whose records are being shared`)}),nP=I(`type`,[eP,tP]),rP=E([`geography`,`industry`,`named_account`,`product_line`]),vye=h({name:r().describe(`Model Name (e.g. FY24 Planning)`),state:E([`planning`,`active`,`archived`]).default(`planning`),startDate:r().optional(),endDate:r().optional()}),yye=h({name:kA.describe(`Territory unique name (lowercase snake_case)`),label:r().describe(`Territory Label (e.g. "West Coast")`),modelId:r().describe(`Belongs to which Territory Model`),parent:r().optional().describe(`Parent Territory`),type:rP.default(`geography`),assignmentRule:r().optional().describe(`Criteria based assignment rule`),assignedUsers:C(r()).optional(),accountAccess:E([`read`,`edit`]).default(`read`),opportunityAccess:E([`read`,`edit`]).default(`read`),caseAccess:E([`read`,`edit`]).default(`read`)}),iP=h({minLength:P().default(8),requireUppercase:S().default(!0),requireLowercase:S().default(!0),requireNumbers:S().default(!0),requireSymbols:S().default(!1),expirationDays:P().optional().describe(`Force password change every X days`),historyCount:P().default(3).describe(`Prevent reusing last X passwords`)}),aP=h({trustedRanges:C(r()).describe(`CIDR ranges allowed to access (e.g. 10.0.0.0/8)`),blockUnknown:S().default(!1).describe(`Block all IPs not in trusted ranges`),vpnRequired:S().default(!1)}),oP=h({idleTimeout:P().default(30).describe(`Minutes before idle session logout`),absoluteTimeout:P().default(480).describe(`Max session duration (minutes)`),forceMfa:S().default(!1).describe(`Require 2FA for all users`)}),sP=h({logRetentionDays:P().default(180),sensitiveFields:C(r()).describe(`Fields to redact in logs (e.g. password, ssn)`),captureRead:S().default(!1).describe(`Log read access (High volume!)`)}),cP=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy Name`),password:iP.optional(),network:aP.optional(),session:oP.optional(),audit:sP.optional(),isDefault:S().default(!1).describe(`Apply to all users by default`),assignedProfiles:C(r()).optional().describe(`Apply to specific profiles`)});DA({},{AIChatWindowProps:()=>JF,Action:()=>zve,ActionNavItemSchema:()=>OP,ActionParamSchema:()=>rM,ActionSchema:()=>aM,ActionType:()=>iM,AddRecordConfigSchema:()=>ZP,AnimationSchema:()=>vI,AnimationTriggerSchema:()=>NI,App:()=>bye,AppBrandingSchema:()=>jP,AppSchema:()=>NP,AppearanceConfigSchema:()=>YP,AriaPropsSchema:()=>eM,BlankPageLayoutItemSchema:()=>DF,BlankPageLayoutSchema:()=>OF,BorderRadiusSchema:()=>hI,BreakpointColumnMapSchema:()=>gP,BreakpointName:()=>hP,BreakpointOrderMapSchema:()=>_P,BreakpointsSchema:()=>_I,CalendarConfigSchema:()=>$P,ChartAnnotationSchema:()=>fP,ChartAxisSchema:()=>uP,ChartConfigSchema:()=>mP,ChartInteractionSchema:()=>pP,ChartSeriesSchema:()=>dP,ChartTypeSchema:()=>lP,ColorPaletteSchema:()=>fI,ColumnSummarySchema:()=>IP,ComponentAnimationSchema:()=>PI,ComponentPropsMap:()=>Dye,ConflictResolutionSchema:()=>TI,Dashboard:()=>Cye,DashboardHeaderActionSchema:()=>uF,DashboardHeaderSchema:()=>dF,DashboardNavItemSchema:()=>wP,DashboardSchema:()=>gF,DashboardWidgetSchema:()=>pF,DateFormatSchema:()=>nM,DensityMode:()=>jye,DensityModeSchema:()=>xI,DndConfigSchema:()=>Lye,DragConstraintSchema:()=>HI,DragHandleSchema:()=>BI,DragItemSchema:()=>WI,DropEffectSchema:()=>VI,DropZoneSchema:()=>UI,EasingFunctionSchema:()=>jI,ElementButtonPropsSchema:()=>QF,ElementDataSourceSchema:()=>wF,ElementFilterPropsSchema:()=>$F,ElementFormPropsSchema:()=>eI,ElementImagePropsSchema:()=>ZF,ElementNumberPropsSchema:()=>XF,ElementRecordPickerPropsSchema:()=>tI,ElementTextPropsSchema:()=>YF,EmbedConfigSchema:()=>xP,EvictionPolicySchema:()=>OI,FieldWidgetPropsSchema:()=>Eye,FocusManagementSchema:()=>dI,FocusTrapConfigSchema:()=>lI,FormFieldSchema:()=>iF,FormSectionSchema:()=>aF,FormViewSchema:()=>oF,GalleryConfigSchema:()=>UP,GanttConfigSchema:()=>eF,GestureConfigSchema:()=>cI,GestureTypeSchema:()=>rI,GlobalFilterOptionsFromSchema:()=>mF,GlobalFilterSchema:()=>hF,GroupNavItemSchema:()=>kP,GroupingConfigSchema:()=>HP,GroupingFieldSchema:()=>VP,HttpMethodSchema:()=>PA,HttpRequestSchema:()=>FA,I18nLabelSchema:()=>q,I18nObjectSchema:()=>Fve,InterfacePageConfigSchema:()=>jF,KanbanConfigSchema:()=>QP,KeyboardNavigationConfigSchema:()=>kye,KeyboardShortcutSchema:()=>uI,ListColumnSchema:()=>LP,ListViewSchema:()=>rF,LocaleConfigSchema:()=>Lve,LongPressGestureConfigSchema:()=>sI,MotionConfigSchema:()=>Pye,NavigationAreaSchema:()=>MP,NavigationConfigSchema:()=>nF,NavigationItemSchema:()=>AP,NavigationModeSchema:()=>tF,NotificationActionSchema:()=>zI,NotificationConfigSchema:()=>Iye,NotificationPositionSchema:()=>RI,NotificationSchema:()=>Fye,NotificationSeveritySchema:()=>LI,NotificationTypeSchema:()=>II,NumberFormatSchema:()=>tM,ObjectNavItemSchema:()=>CP,OfflineCacheConfigSchema:()=>kI,OfflineConfigSchema:()=>Nye,OfflineStrategySchema:()=>wI,PageAccordionProps:()=>qF,PageCardProps:()=>BF,PageComponentSchema:()=>TF,PageComponentType:()=>CF,PageHeaderProps:()=>RF,PageNavItemSchema:()=>TP,PageRegionSchema:()=>SF,PageSchema:()=>MF,PageTabsProps:()=>zF,PageTransitionSchema:()=>FI,PageTypeSchema:()=>kF,PageVariableSchema:()=>EF,PaginationConfigSchema:()=>zP,PerformanceConfigSchema:()=>yP,PersistStorageSchema:()=>DI,PinchGestureConfigSchema:()=>oI,PluralRuleSchema:()=>Ive,RecordActivityProps:()=>WF,RecordChatterProps:()=>GF,RecordDetailsProps:()=>VF,RecordHighlightsProps:()=>UF,RecordPathProps:()=>KF,RecordRelatedListProps:()=>HF,RecordReviewConfigSchema:()=>AF,Report:()=>wye,ReportChartSchema:()=>bF,ReportColumnSchema:()=>vF,ReportGroupingSchema:()=>yF,ReportNavItemSchema:()=>DP,ReportSchema:()=>xF,ReportType:()=>_F,ResponsiveConfigSchema:()=>vP,RowColorConfigSchema:()=>KP,RowHeightSchema:()=>BP,SelectionConfigSchema:()=>RP,ShadowSchema:()=>gI,SharingConfigSchema:()=>bP,SpacingSchema:()=>mI,SwipeDirectionSchema:()=>iI,SwipeGestureConfigSchema:()=>aI,SyncConfigSchema:()=>EI,ThemeMode:()=>Aye,ThemeModeSchema:()=>bI,ThemeSchema:()=>CI,TimelineConfigSchema:()=>WP,TouchInteractionSchema:()=>Oye,TouchTargetConfigSchema:()=>nI,TransitionConfigSchema:()=>MI,TransitionPresetSchema:()=>AI,TypographySchema:()=>pI,UrlNavItemSchema:()=>EP,UserActionsConfigSchema:()=>JP,ViewDataSchema:()=>PP,ViewFilterRuleSchema:()=>FP,ViewSchema:()=>sF,ViewSharingSchema:()=>GP,ViewTabSchema:()=>XP,VisualizationTypeSchema:()=>qP,WcagContrastLevel:()=>Mye,WcagContrastLevelSchema:()=>SI,WidgetActionTypeSchema:()=>lF,WidgetColorVariantSchema:()=>cF,WidgetEventSchema:()=>PF,WidgetLifecycleSchema:()=>NF,WidgetManifestSchema:()=>Tye,WidgetMeasureSchema:()=>fF,WidgetPropertySchema:()=>FF,WidgetSourceSchema:()=>IF,ZIndexSchema:()=>yI,defineApp:()=>xye,defineView:()=>Sye});var lP=E(`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(`.`)),uP=h({field:r().describe(`Data field key`),title:q.optional().describe(`Axis display title`),format:r().optional().describe(`Value format string (e.g., "$0,0.00")`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),stepSize:P().optional().describe(`Step size for ticks`),showGridLines:S().default(!0),position:E([`left`,`right`,`top`,`bottom`]).optional().describe(`Axis position`),logarithmic:S().default(!1)}),dP=h({name:r().describe(`Field name or series identifier`),label:q.optional().describe(`Series display label`),type:lP.optional().describe(`Override chart type for this series`),color:r().optional().describe(`Series color (hex/rgb/token)`),stack:r().optional().describe(`Stack identifier to group series`),yAxis:E([`left`,`right`]).default(`left`).describe(`Bind to specific Y-Axis`)}),fP=h({type:E([`line`,`region`]).default(`line`),axis:E([`x`,`y`]).default(`y`),value:l([P(),r()]).describe(`Start value`),endValue:l([P(),r()]).optional().describe(`End value for regions`),color:r().optional(),label:q.optional(),style:E([`solid`,`dashed`,`dotted`]).default(`dashed`)}),pP=h({tooltips:S().default(!0),zoom:S().default(!1),brush:S().default(!1),clickAction:r().optional().describe(`Action ID to trigger on click`)}),mP=h({type:lP,title:q.optional().describe(`Chart title`),subtitle:q.optional().describe(`Chart subtitle`),description:q.optional().describe(`Accessibility description`),xAxis:uP.optional().describe(`X-Axis configuration`),yAxis:C(uP).optional().describe(`Y-Axis configuration (support dual axis)`),series:C(dP).optional().describe(`Defined series configuration`),colors:C(r()).optional().describe(`Color palette`),height:P().optional().describe(`Fixed height in pixels`),showLegend:S().default(!0).describe(`Display legend`),showDataLabels:S().default(!1).describe(`Display data labels`),annotations:C(fP).optional(),interaction:pP.optional(),aria:eM.optional().describe(`ARIA accessibility attributes`)}),hP=E([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),gP=h({xs:P().min(1).max(12).optional(),sm:P().min(1).max(12).optional(),md:P().min(1).max(12).optional(),lg:P().min(1).max(12).optional(),xl:P().min(1).max(12).optional(),"2xl":P().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),_P=h({xs:P().optional(),sm:P().optional(),md:P().optional(),lg:P().optional(),xl:P().optional(),"2xl":P().optional()}).describe(`Display order per breakpoint`),vP=h({breakpoint:hP.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:C(hP).optional().describe(`Hide on these breakpoints`),columns:gP.optional().describe(`Grid columns per breakpoint`),order:_P.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),yP=h({lazyLoad:S().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:h({enabled:S().default(!1).describe(`Enable virtual scrolling`),itemHeight:P().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:P().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:E([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:S().optional().describe(`Prefetch data before component is visible`),pageSize:P().optional().describe(`Number of items per page for pagination`),debounceMs:P().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),bP=h({enabled:S().default(!1).describe(`Enable public sharing`),publicLink:r().optional().describe(`Generated public share URL`),password:r().optional().describe(`Password required to access shared link`),allowedDomains:C(r()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:r().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:S().optional().default(!1).describe(`Allow access without authentication`)}),xP=h({enabled:S().default(!1).describe(`Enable iframe embedding`),allowedOrigins:C(r()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:r().optional().default(`100%`).describe(`Embed width (CSS value)`),height:r().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:S().optional().default(!0).describe(`Show interface header in embed`),showNavigation:S().optional().default(!1).describe(`Show navigation in embed`),responsive:S().optional().default(!0).describe(`Enable responsive resizing`)}),SP=h({id:kA.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:q.describe(`Display proper label`),icon:r().optional().describe(`Icon name`),order:P().optional().describe(`Sort order within the same level (lower = first)`),badge:l([r(),P()]).optional().describe(`Badge text or count displayed on the item`),visible:r().optional().describe(`Visibility formula condition`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this item`)}),CP=SP.extend({type:m(`object`),objectName:r().describe(`Target object name`),viewName:r().optional().describe(`Default list view to open. Defaults to "all"`)}),wP=SP.extend({type:m(`dashboard`),dashboardName:r().describe(`Target dashboard name`)}),TP=SP.extend({type:m(`page`),pageName:r().describe(`Target custom page component name`),params:d(r(),u()).optional().describe(`Parameters passed to the page context`)}),EP=SP.extend({type:m(`url`),url:r().describe(`Target external URL`),target:E([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),DP=SP.extend({type:m(`report`),reportName:r().describe(`Target report name`)}),OP=SP.extend({type:m(`action`),actionDef:h({actionName:r().describe(`Action machine name to execute`),params:d(r(),u()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),kP=SP.extend({type:m(`group`),expanded:S().default(!1).describe(`Default expansion state in sidebar`)}),AP=F(()=>l([CP.extend({children:C(AP).optional().describe(`Child navigation items (e.g. specific views)`)}),wP,TP,EP,DP,OP,kP.extend({children:C(AP).describe(`Child navigation items`)})])),jP=h({primaryColor:r().optional().describe(`Primary theme color hex code`),logo:r().optional().describe(`Custom logo URL for this app`),favicon:r().optional().describe(`Custom favicon URL for this app`)}),MP=h({id:kA.describe(`Unique area identifier (lowercase snake_case)`),label:q.describe(`Area display label`),icon:r().optional().describe(`Area icon name`),order:P().optional().describe(`Sort order among areas (lower = first)`),description:q.optional().describe(`Area description`),visible:r().optional().describe(`Visibility formula condition for this area`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this area`),navigation:C(AP).describe(`Navigation items within this area`)}),NP=h({name:kA.describe(`App unique machine name (lowercase snake_case)`),label:q.describe(`App display label`),version:r().optional().describe(`App version`),description:q.optional().describe(`App description`),icon:r().optional().describe(`App icon used in the App Launcher`),branding:jP.optional().describe(`App-specific branding`),active:S().optional().default(!0).describe(`Whether the app is enabled`),isDefault:S().optional().default(!1).describe(`Is default app`),navigation:C(AP).optional().describe(`Full navigation tree for the app sidebar`),areas:C(MP).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:r().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this app`),objects:C(u()).optional().describe(`Objects belonging to this app`),apis:C(u()).optional().describe(`Custom APIs belonging to this app`),sharing:bP.optional().describe(`Public sharing configuration`),embed:xP.optional().describe(`Iframe embedding configuration`),mobileNavigation:h({mode:E([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:C(r()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:eM.optional().describe(`ARIA accessibility attributes for the application`)}),bye={create:e=>NP.parse(e)};function xye(e){return NP.parse(e)}var PP=I(`provider`,[h({provider:m(`object`),object:r().describe(`Target object name`)}),h({provider:m(`api`),read:FA.optional().describe(`Configuration for fetching data`),write:FA.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),h({provider:m(`value`),items:C(u()).describe(`Static data array`)})]),FP=h({field:r().describe(`Field name to filter on`),operator:r().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),IP=E([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),LP=h({field:r().describe(`Field name (snake_case)`),label:q.optional().describe(`Display label override`),width:P().positive().optional().describe(`Column width in pixels`),align:E([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:S().optional().describe(`Hide column by default`),sortable:S().optional().describe(`Allow sorting by this column`),resizable:S().optional().describe(`Allow resizing this column`),wrap:S().optional().describe(`Allow text wrapping`),type:r().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:E([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:IP.optional().describe(`Footer aggregation function for this column`),link:S().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:r().optional().describe(`Registered Action ID to execute when clicked`)}),RP=h({type:E([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),zP=h({pageSize:P().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:C(P().int().positive()).optional().describe(`Available page size options`)}),BP=E([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),VP=h({field:r().describe(`Field name to group by`),order:E([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:S().default(!1).describe(`Collapse groups by default`)}),HP=h({fields:C(VP).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),UP=h({coverField:r().optional().describe(`Attachment/image field to display as card cover`),coverFit:E([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:E([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:r().optional().describe(`Field to display as card title`),visibleFields:C(r()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),WP=h({startDateField:r().describe(`Field for timeline item start date`),endDateField:r().optional().describe(`Field for timeline item end date`),titleField:r().describe(`Field to display as timeline item title`),groupByField:r().optional().describe(`Field to group timeline rows`),colorField:r().optional().describe(`Field to determine item color`),scale:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),GP=h({type:E([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:r().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),KP=h({field:r().describe(`Field to derive color from (typically a select/status field)`),colors:d(r(),r()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),qP=E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),JP=h({sort:S().default(!0).describe(`Allow users to sort records`),search:S().default(!0).describe(`Allow users to search records`),filter:S().default(!0).describe(`Allow users to filter records`),rowHeight:S().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:S().default(!1).describe(`Add records through a form instead of inline`),buttons:C(r()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),YP=h({showDescription:S().default(!0).describe(`Show the view description text`),allowedVisualizations:C(qP).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),XP=h({name:kA.describe(`Tab identifier (snake_case)`),label:q.optional().describe(`Display label`),icon:r().optional().describe(`Tab icon name`),view:r().optional().describe(`Referenced list view name from listViews`),filter:C(FP).optional().describe(`Tab-specific filter criteria`),order:P().int().min(0).optional().describe(`Tab display order`),pinned:S().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:S().default(!1).describe(`Set as the default active tab`),visible:S().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),ZP=h({enabled:S().default(!0).describe(`Show the add record entry point`),position:E([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:E([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:r().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),QP=h({groupByField:r().describe(`Field to group columns by (usually status/select)`),summarizeField:r().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:C(r()).describe(`Fields to show on cards`)}),$P=h({startDateField:r(),endDateField:r().optional(),titleField:r(),colorField:r().optional()}),eF=h({startDateField:r(),endDateField:r(),titleField:r(),progressField:r().optional(),dependenciesField:r().optional()}),tF=E([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]),nF=h({mode:tF.default(`page`),view:r().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:S().default(!1).describe(`Disable standard navigation entirely`),openNewTab:S().default(!1).describe(`Force open in new tab (applies to page mode)`),width:l([r(),P()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),rF=h({name:kA.optional().describe(`Internal view name (lowercase snake_case)`),label:q.optional(),type:E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:PP.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:l([C(r()),C(LP)]).describe(`Fields to display as columns`),filter:C(FP).optional().describe(`Filter criteria (JSON Rules)`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional(),searchableFields:C(r()).optional().describe(`Fields enabled for search`),filterableFields:C(r()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:C(h({field:r().describe(`Field name to filter by`),label:r().optional().describe(`Display label for the chip`),operator:E([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:S().optional().describe(`Enable column resizing`),striped:S().optional().describe(`Striped row styling`),bordered:S().optional().describe(`Show borders`),selection:RP.optional().describe(`Row selection configuration`),navigation:nF.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:zP.optional().describe(`Pagination configuration`),kanban:QP.optional(),calendar:$P.optional(),gantt:eF.optional(),gallery:UP.optional(),timeline:WP.optional(),description:q.optional().describe(`View description for documentation/tooltips`),sharing:GP.optional().describe(`View sharing and access configuration`),rowHeight:BP.optional().describe(`Row height / density setting`),grouping:HP.optional().describe(`Group records by one or more fields`),rowColor:KP.optional().describe(`Color rows based on field value`),hiddenFields:C(r()).optional().describe(`Fields to hide in this specific view`),fieldOrder:C(r()).optional().describe(`Explicit field display order for this view`),rowActions:C(r()).optional().describe(`Actions available for individual row items`),bulkActions:C(r()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:S().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:C(h({condition:r().describe(`Condition expression to evaluate`),style:d(r(),r()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:S().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:C(E([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:JP.optional().describe(`User action toggles for the view toolbar`),appearance:YP.optional().describe(`Appearance and visualization configuration`),tabs:C(XP).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:ZP.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at the bottom of the list`),allowPrinting:S().optional().describe(`Allow users to print the view`),emptyState:h({title:q.optional(),message:q.optional(),icon:r().optional()}).optional().describe(`Empty state configuration when no records found`),aria:eM.optional().describe(`ARIA accessibility attributes for the list view`),responsive:vP.optional().describe(`Responsive layout configuration`),performance:yP.optional().describe(`Performance optimization settings`)}),iF=h({field:r().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:S().optional().describe(`Read-only override`),required:S().optional().describe(`Required override`),hidden:S().optional().describe(`Hidden override`),colSpan:P().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:r().optional().describe(`Custom widget/component name`),dependsOn:r().optional().describe(`Parent field name for cascading`),visibleOn:r().optional().describe(`Visibility condition expression`)}),aF=h({label:q.optional(),collapsible:S().default(!1),collapsed:S().default(!1),columns:E([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:C(l([r(),iF]))}),oF=h({type:E([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:PP.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:C(aF).optional(),groups:C(aF).optional(),defaultSort:C(h({field:r().describe(`Field name to sort by`),order:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:bP.optional().describe(`Public sharing configuration for this form`),aria:eM.optional().describe(`ARIA accessibility attributes for the form view`)}),sF=h({list:rF.optional(),form:oF.optional(),listViews:d(r(),rF).optional().describe(`Additional named list views`),formViews:d(r(),oF).optional().describe(`Additional named form views`)});function Sye(e){return sF.parse(e)}var cF=E([`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`]).describe(`Widget color variant`),lF=E([`script`,`url`,`modal`,`flow`,`api`]).describe(`Widget action type`),uF=h({label:q.describe(`Action button label`),actionUrl:r().describe(`URL or target for the action`),actionType:lF.optional().describe(`Type of action`),icon:r().optional().describe(`Icon identifier for the action button`)}).describe(`Dashboard header action`),dF=h({showTitle:S().default(!0).describe(`Show dashboard title in header`),showDescription:S().default(!0).describe(`Show dashboard description in header`),actions:C(uF).optional().describe(`Header action buttons`)}).describe(`Dashboard header configuration`),fF=h({valueField:r().describe(`Field to aggregate`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).default(`count`).describe(`Aggregate function`),label:q.optional().describe(`Measure display label`),format:r().optional().describe(`Number format string`)}).describe(`Widget measure definition`),pF=h({id:kA.describe(`Unique widget identifier (snake_case)`),title:q.optional().describe(`Widget title`),description:q.optional().describe(`Widget description text below the header`),type:lP.default(`metric`).describe(`Visualization type`),chartConfig:mP.optional().describe(`Chart visualization configuration`),colorVariant:cF.optional().describe(`Widget color variant for theming`),actionUrl:r().optional().describe(`URL or target for the widget action button`),actionType:lF.optional().describe(`Type of action for the widget action button`),actionIcon:r().optional().describe(`Icon identifier for the widget action button`),object:r().optional().describe(`Data source object name`),filter:yj.optional().describe(`Data filter criteria`),categoryField:r().optional().describe(`Field for grouping (X-Axis)`),valueField:r().optional().describe(`Field for values (Y-Axis)`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).optional().default(`count`).describe(`Aggregate function`),measures:C(fF).optional().describe(`Multiple measures for pivot/matrix analysis`),layout:h({x:P(),y:P(),w:P(),h:P()}).describe(`Grid layout position`),options:u().optional().describe(`Widget specific configuration`),responsive:vP.optional().describe(`Responsive layout configuration`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),mF=h({object:r().describe(`Source object name`),valueField:r().describe(`Field to use as option value`),labelField:r().describe(`Field to use as option label`),filter:yj.optional().describe(`Filter to apply to source object`)}).describe(`Dynamic filter options from object`),hF=h({field:r().describe(`Field name to filter on`),label:q.optional().describe(`Display label for the filter`),type:E([`text`,`select`,`date`,`number`,`lookup`]).optional().describe(`Filter input type`),options:C(h({value:l([r(),P(),S()]).describe(`Option value`),label:q})).optional().describe(`Static filter options`),optionsFrom:mF.optional().describe(`Dynamic filter options from object`),defaultValue:l([r(),P(),S()]).optional().describe(`Default filter value`),scope:E([`dashboard`,`widget`]).default(`dashboard`).describe(`Filter application scope`),targetWidgets:C(r()).optional().describe(`Widget IDs to apply this filter to`)}),gF=h({name:kA.describe(`Dashboard unique name`),label:q.describe(`Dashboard label`),description:q.optional().describe(`Dashboard description`),header:dF.optional().describe(`Dashboard header configuration`),widgets:C(pF).describe(`Widgets to display`),refreshInterval:P().optional().describe(`Auto-refresh interval in seconds`),dateRange:h({field:r().optional().describe(`Default date field name for time-based filtering`),defaultRange:E([`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:S().default(!0).describe(`Allow users to pick a custom date range`)}).optional().describe(`Global dashboard date range filter configuration`),globalFilters:C(hF).optional().describe(`Global filters that apply to all widgets in the dashboard`),aria:eM.optional().describe(`ARIA accessibility attributes`),performance:yP.optional().describe(`Performance optimization settings`)}),Cye={create:e=>gF.parse(e)},_F=E([`tabular`,`summary`,`matrix`,`joined`]),vF=h({field:r().describe(`Field name`),label:q.optional().describe(`Override label`),aggregate:E([`sum`,`avg`,`max`,`min`,`count`,`unique`]).optional().describe(`Aggregation function`),responsive:vP.optional().describe(`Responsive visibility for this column`)}),yF=h({field:r().describe(`Field to group by`),sortOrder:E([`asc`,`desc`]).default(`asc`),dateGranularity:E([`day`,`week`,`month`,`quarter`,`year`]).optional().describe(`For date fields`)}),bF=mP.extend({xAxis:r().describe(`Grouping field for X-Axis`),yAxis:r().describe(`Summary field for Y-Axis`),groupBy:r().optional().describe(`Additional grouping field`)}),xF=h({name:kA.describe(`Report unique name`),label:q.describe(`Report label`),description:q.optional(),objectName:r().describe(`Primary object`),type:_F.default(`tabular`).describe(`Report format type`),columns:C(vF).describe(`Columns to display`),groupingsDown:C(yF).optional().describe(`Row groupings`),groupingsAcross:C(yF).optional().describe(`Column groupings (Matrix only)`),filter:yj.optional().describe(`Filter criteria`),chart:bF.optional().describe(`Embedded chart configuration`),aria:eM.optional().describe(`ARIA accessibility attributes`),performance:yP.optional().describe(`Performance optimization settings`)}),wye={create:e=>xF.parse(e)},SF=h({name:r().describe(`Region name (e.g. "sidebar", "main", "header")`),width:E([`small`,`medium`,`large`,`full`]).optional(),components:C(F(()=>TF)).describe(`Components in this region`)}),CF=E(`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(`.`)),wF=h({object:r().describe(`Object to query`),view:r().optional().describe(`Named view to apply`),filter:yj.optional().describe(`Additional filter criteria`),sort:C(BA).optional().describe(`Sort order`),limit:P().int().positive().optional().describe(`Max records to display`)}),TF=h({type:l([CF,r()]).describe(`Component Type (Standard enum or custom string)`),id:r().optional().describe(`Unique instance ID`),label:q.optional(),properties:d(r(),u()).describe(`Component props passed to the widget. See component.zod.ts for schemas.`),events:d(r(),r()).optional().describe(`Event handlers map`),style:d(r(),r()).optional().describe(`Inline styles or utility classes`),className:r().optional().describe(`CSS class names`),visibility:r().optional().describe(`Visibility filter/formula`),dataSource:wF.optional().describe(`Per-element data binding for multi-object pages`),responsive:vP.optional().describe(`Responsive layout configuration`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),EF=h({name:r().describe(`Variable name`),type:E([`string`,`number`,`boolean`,`object`,`array`,`record_id`]).default(`string`),defaultValue:u().optional(),source:r().optional().describe(`Component ID that writes to this variable`)}),DF=h({componentId:r().describe(`Reference to a PageComponent.id in the page`),x:P().int().min(0).describe(`Grid column position (0-based)`),y:P().int().min(0).describe(`Grid row position (0-based)`),width:P().int().min(1).describe(`Width in grid columns`),height:P().int().min(1).describe(`Height in grid rows`)}),OF=h({columns:P().int().min(1).default(12).describe(`Number of grid columns`),rowHeight:P().int().min(1).default(40).describe(`Height of each grid row in pixels`),gap:P().int().min(0).default(8).describe(`Gap between grid items in pixels`),items:C(DF).describe(`Positioned components on the canvas`)}),kF=E([`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`),AF=h({object:r().describe(`Target object for review`),filter:yj.optional().describe(`Filter criteria for review queue`),sort:C(BA).optional().describe(`Sort order for review queue`),displayFields:C(r()).optional().describe(`Fields to display on the review page`),actions:C(h({label:r().describe(`Action button label`),type:E([`approve`,`reject`,`skip`,`custom`]).describe(`Action type`),field:r().optional().describe(`Field to update on action`),value:l([r(),P(),S()]).optional().describe(`Value to set on action`),nextRecord:S().optional().default(!0).describe(`Auto-advance to next record after action`)})).describe(`Review actions`),navigation:E([`sequential`,`random`,`filtered`]).optional().default(`sequential`).describe(`Record navigation mode`),showProgress:S().optional().default(!0).describe(`Show review progress indicator`)}),jF=h({source:r().optional().describe(`Source object name for the page`),levels:P().int().min(1).optional().describe(`Number of hierarchy levels to display`),filterBy:C(FP).optional().describe(`Page-level filter criteria`),appearance:YP.optional().describe(`Appearance and visualization configuration`),userFilters:h({elements:C(E([`grid`,`gallery`,`kanban`])).optional().describe(`Visualization element types available in user filter bar`),tabs:C(XP).optional().describe(`User-configurable tabs`)}).optional().describe(`User filter configuration`),userActions:JP.optional().describe(`User action toggles`),addRecord:ZP.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at page bottom`),allowPrinting:S().optional().describe(`Allow users to print the page`)}).describe(`Interface-level page configuration (Airtable parity)`),MF=h({name:kA.describe(`Page unique name (lowercase snake_case)`),label:q,description:q.optional(),icon:r().optional().describe(`Page icon name`),type:kF.default(`record`).describe(`Page type`),variables:C(EF).optional().describe(`Local page state variables`),object:r().optional().describe(`Bound object (for Record pages)`),recordReview:AF.optional().describe(`Record review configuration (required when type is "record_review")`),blankLayout:OF.optional().describe(`Free-form grid layout for blank pages (used when type is "blank")`),template:r().default(`default`).describe(`Layout template name (e.g. "header-sidebar-main")`),regions:C(SF).describe(`Defined regions with components`),isDefault:S().default(!1),assignedProfiles:C(r()).optional(),interfaceConfig:jF.optional().describe(`Interface-level page configuration (for Airtable-style interface pages)`),aria:eM.optional().describe(`ARIA accessibility attributes`)}).superRefine((e,t)=>{e.type===`record_review`&&!e.recordReview&&t.addIssue({code:de.custom,path:[`recordReview`],message:`recordReview is required when type is "record_review"`}),e.type===`blank`&&!e.blankLayout&&t.addIssue({code:de.custom,path:[`blankLayout`],message:`blankLayout is required when type is "blank"`})}),NF=h({onMount:r().optional().describe(`Initialization code when widget mounts`),onUpdate:r().optional().describe(`Code to run when props change`),onUnmount:r().optional().describe(`Cleanup code when widget unmounts`),onValidate:r().optional().describe(`Custom validation logic`),onFocus:r().optional().describe(`Code to run on focus`),onBlur:r().optional().describe(`Code to run on blur`),onError:r().optional().describe(`Error handling code`)}),PF=h({name:r().describe(`Event name`),label:q.optional().describe(`Human-readable event label`),description:q.optional().describe(`Event description and usage`),bubbles:S().default(!1).describe(`Whether event bubbles`),cancelable:S().default(!1).describe(`Whether event is cancelable`),payload:d(r(),u()).optional().describe(`Event payload schema`)}),FF=h({name:r().describe(`Property name (camelCase)`),label:q.optional().describe(`Human-readable label`),type:E([`string`,`number`,`boolean`,`array`,`object`,`function`,`any`]).describe(`TypeScript type`),required:S().default(!1).describe(`Whether property is required`),default:u().optional().describe(`Default value`),description:q.optional().describe(`Property description`),validation:d(r(),u()).optional().describe(`Validation rules`),category:r().optional().describe(`Property category`)}),IF=I(`type`,[h({type:m(`npm`),packageName:r().describe(`NPM package name`),version:r().default(`latest`),exportName:r().optional().describe(`Named export (default: default)`)}),h({type:m(`remote`),url:r().url().describe(`Remote entry URL (.js)`),moduleName:r().describe(`Exposed module name`),scope:r().describe(`Remote scope name`)}),h({type:m(`inline`),code:r().describe(`JavaScript code body`)})]),Tye=h({name:kA.describe(`Widget identifier (snake_case)`),label:q.describe(`Widget display name`),description:q.optional().describe(`Widget description`),version:r().optional().describe(`Widget version (semver)`),author:r().optional().describe(`Widget author`),icon:r().optional().describe(`Widget icon`),fieldTypes:C(r()).optional().describe(`Supported field types`),category:E([`input`,`display`,`picker`,`editor`,`custom`]).default(`custom`).describe(`Widget category`),lifecycle:NF.optional().describe(`Lifecycle hooks`),events:C(PF).optional().describe(`Custom events`),properties:C(FF).optional().describe(`Configuration properties`),implementation:IF.optional().describe(`Widget implementation source`),dependencies:C(h({name:r(),version:r().optional(),url:r().url().optional()})).optional().describe(`Widget dependencies`),screenshots:C(r().url()).optional().describe(`Screenshot URLs`),documentation:r().url().optional().describe(`Documentation URL`),license:r().optional().describe(`License (SPDX identifier)`),tags:C(r()).optional().describe(`Tags for categorization`),aria:eM.optional().describe(`ARIA accessibility attributes`),performance:yP.optional().describe(`Performance optimization settings`)}),Eye=h({value:u().describe(`Current field value`),onChange:M().input(w([u()])).output(te()).describe(`Callback to update field value`),readonly:S().default(!1).describe(`Read-only mode flag`),required:S().default(!1).describe(`Required field flag`),error:r().optional().describe(`Validation error message`),field:nj.describe(`Field schema definition`),record:d(r(),u()).optional().describe(`Complete record data`),options:d(r(),u()).optional().describe(`Custom widget options`)}),LF=h({}),RF=h({title:q.describe(`Page title`),subtitle:q.optional().describe(`Page subtitle`),icon:r().optional().describe(`Icon name`),breadcrumb:S().default(!0).describe(`Show breadcrumb`),actions:C(r()).optional().describe(`Action IDs to show in header`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),zF=h({type:E([`line`,`card`,`pill`]).default(`line`),position:E([`top`,`left`]).default(`top`),items:C(h({label:q,icon:r().optional(),children:C(u()).describe(`Child components`)})),aria:eM.optional().describe(`ARIA accessibility attributes`)}),BF=h({title:q.optional(),bordered:S().default(!0),actions:C(r()).optional(),body:C(u()).optional().describe(`Card content components (slot)`),footer:C(u()).optional().describe(`Card footer components (slot)`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),VF=h({columns:E([`1`,`2`,`3`,`4`]).default(`2`).describe(`Number of columns for field layout (1-4)`),layout:E([`auto`,`custom`]).default(`auto`).describe(`Layout mode: auto uses object compactLayout, custom uses explicit sections`),sections:C(r()).optional().describe(`Section IDs to show (required when layout is "custom")`),fields:C(r()).optional().describe(`Explicit field list to display (optional, overrides compactLayout)`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),HF=h({objectName:r().describe(`Related object name (e.g., "task", "opportunity")`),relationshipField:r().describe(`Field on related object that points to this record (e.g., "account_id")`),columns:C(r()).describe(`Fields to display in the related list`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional().describe(`Sort order for related records`),limit:P().int().positive().default(5).describe(`Number of records to display initially`),filter:C(FP).optional().describe(`Additional filter criteria for related records`),title:q.optional().describe(`Custom title for the related list`),showViewAll:S().default(!0).describe(`Show "View All" link to see all related records`),actions:C(r()).optional().describe(`Action IDs available for related records`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),UF=h({fields:C(r()).min(1).max(7).describe(`Key fields to highlight (1-7 fields max, typically displayed as prominent cards)`),layout:E([`horizontal`,`vertical`]).default(`horizontal`).describe(`Layout orientation for highlight fields`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),WF=h({types:C(jN).optional().describe(`Feed item types to show (default: all)`),filterMode:RN.default(`all`).describe(`Default activity filter`),showFilterToggle:S().default(!0).describe(`Show filter dropdown in panel header`),limit:P().int().positive().default(20).describe(`Number of items to load per page`),showCompleted:S().default(!1).describe(`Include completed activities`),unifiedTimeline:S().default(!0).describe(`Mix field changes and comments in one timeline (Airtable style)`),showCommentInput:S().default(!0).describe(`Show "Leave a comment" input at the bottom`),enableMentions:S().default(!0).describe(`Enable @mentions in comments`),enableReactions:S().default(!1).describe(`Enable emoji reactions on feed items`),enableThreading:S().default(!1).describe(`Enable threaded replies on comments`),showSubscriptionToggle:S().default(!0).describe(`Show bell icon for record-level notification subscription`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),GF=h({position:E([`sidebar`,`inline`,`drawer`]).default(`sidebar`).describe(`Where to render the chatter panel`),width:l([r(),P()]).optional().describe(`Panel width (e.g., "350px", "30%")`),collapsible:S().default(!0).describe(`Whether the panel can be collapsed`),defaultCollapsed:S().default(!1).describe(`Whether the panel starts collapsed`),feed:WF.optional().describe(`Embedded activity feed configuration`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),KF=h({statusField:r().describe(`Field name representing the current status/stage`),stages:C(h({value:r(),label:q})).optional().describe(`Explicit stage definitions (if not using field metadata)`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),qF=h({items:C(h({label:q,icon:r().optional(),collapsed:S().default(!1),children:C(u()).describe(`Child components`)})),allowMultiple:S().default(!1).describe(`Allow multiple panels to be expanded simultaneously`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),JF=h({mode:E([`float`,`sidebar`,`inline`]).default(`float`).describe(`Display mode for the chat window`),agentId:r().optional().describe(`Specific AI agent to use`),context:d(r(),u()).optional().describe(`Contextual data to pass to the AI`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),YF=h({content:r().describe(`Text or Markdown content`),variant:E([`heading`,`subheading`,`body`,`caption`]).optional().default(`body`).describe(`Text style variant`),align:E([`left`,`center`,`right`]).optional().default(`left`).describe(`Text alignment`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),XF=h({object:r().describe(`Source object`),field:r().optional().describe(`Field to aggregate`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function`),filter:yj.optional().describe(`Filter criteria`),format:E([`number`,`currency`,`percent`]).optional().describe(`Number display format`),prefix:r().optional().describe(`Prefix text (e.g. "$")`),suffix:r().optional().describe(`Suffix text (e.g. "%")`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),ZF=h({src:r().describe(`Image URL or attachment field`),alt:r().optional().describe(`Alt text for accessibility`),fit:E([`cover`,`contain`,`fill`]).optional().default(`cover`).describe(`Image object-fit mode`),height:P().optional().describe(`Fixed height in pixels`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),QF=h({label:q.describe(`Button display label`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().default(`primary`).describe(`Button visual variant`),size:E([`small`,`medium`,`large`]).optional().default(`medium`).describe(`Button size`),icon:r().optional().describe(`Icon name (Lucide icon)`),iconPosition:E([`left`,`right`]).optional().default(`left`).describe(`Icon position relative to label`),disabled:S().optional().default(!1).describe(`Disable the button`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),$F=h({object:r().describe(`Object to filter`),fields:C(r()).describe(`Filterable field names`),targetVariable:r().optional().describe(`Page variable to store filter state`),layout:E([`inline`,`dropdown`,`sidebar`]).optional().default(`inline`).describe(`Filter display layout`),showSearch:S().optional().default(!0).describe(`Show search input`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),eI=h({object:r().describe(`Object for the form`),fields:C(r()).optional().describe(`Fields to display (defaults to all editable fields)`),mode:E([`create`,`edit`]).optional().default(`create`).describe(`Form mode`),submitLabel:q.optional().describe(`Submit button label`),onSubmit:r().optional().describe(`Action expression on form submit`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),tI=h({object:r().describe(`Object to pick records from`),displayField:r().describe(`Field to display as the record label`),searchFields:C(r()).optional().describe(`Fields to search against`),filter:yj.optional().describe(`Filter criteria for available records`),multiple:S().optional().default(!1).describe(`Allow multiple record selection`),targetVariable:r().optional().describe(`Page variable to bind selected record ID(s)`),placeholder:q.optional().describe(`Placeholder text`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),Dye={"page:header":RF,"page:tabs":zF,"page:card":BF,"page:footer":LF,"page:sidebar":LF,"page:accordion":qF,"page:section":LF,"record:details":VF,"record:related_list":HF,"record:highlights":UF,"record:activity":WF,"record:chatter":GF,"record:path":KF,"app:launcher":LF,"nav:menu":LF,"nav:breadcrumb":LF,"global:search":LF,"global:notifications":LF,"user:profile":LF,"ai:chat_window":JF,"ai:suggestion":h({context:r().optional()}),"element:text":YF,"element:number":XF,"element:image":ZF,"element:divider":LF,"element:button":QF,"element:filter":$F,"element:form":eI,"element:record_picker":tI},nI=h({minWidth:P().default(44).describe(`Minimum touch target width in pixels (WCAG 2.5.5: 44px)`),minHeight:P().default(44).describe(`Minimum touch target height in pixels (WCAG 2.5.5: 44px)`),padding:P().optional().describe(`Additional padding around touch target in pixels`),hitSlop:h({top:P().optional().describe(`Extra hit area above the element`),right:P().optional().describe(`Extra hit area to the right of the element`),bottom:P().optional().describe(`Extra hit area below the element`),left:P().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)`),rI=E([`swipe`,`pinch`,`long_press`,`double_tap`,`drag`,`rotate`,`pan`]).describe(`Touch gesture type`),iI=E([`up`,`down`,`left`,`right`]),aI=h({direction:C(iI).describe(`Allowed swipe directions`),threshold:P().optional().describe(`Minimum distance in pixels to recognize swipe`),velocity:P().optional().describe(`Minimum velocity (px/ms) to trigger swipe`)}).describe(`Swipe gesture recognition settings`),oI=h({minScale:P().optional().describe(`Minimum scale factor (e.g., 0.5 for 50%)`),maxScale:P().optional().describe(`Maximum scale factor (e.g., 3.0 for 300%)`)}).describe(`Pinch/zoom gesture recognition settings`),sI=h({duration:P().default(500).describe(`Hold duration in milliseconds to trigger long press`),moveTolerance:P().optional().describe(`Max movement in pixels allowed during press`)}).describe(`Long press gesture recognition settings`),cI=h({type:rI.describe(`Gesture type to configure`),label:q.optional().describe(`Descriptive label for the gesture action`),enabled:S().default(!0).describe(`Whether this gesture is active`),swipe:aI.optional().describe(`Swipe gesture settings (when type is swipe)`),pinch:oI.optional().describe(`Pinch gesture settings (when type is pinch)`),longPress:sI.optional().describe(`Long press settings (when type is long_press)`)}).describe(`Per-gesture configuration`),Oye=h({gestures:C(cI).optional().describe(`Configured gesture recognizers`),touchTarget:nI.optional().describe(`Touch target sizing and hit area`),hapticFeedback:S().optional().describe(`Enable haptic feedback on touch interactions`)}).merge(eM.partial()).describe(`Touch and gesture interaction configuration`),lI=h({enabled:S().default(!1).describe(`Enable focus trapping within this container`),initialFocus:r().optional().describe(`CSS selector for the element to focus on activation`),returnFocus:S().default(!0).describe(`Return focus to trigger element on deactivation`),escapeDeactivates:S().default(!0).describe(`Allow Escape key to deactivate the focus trap`)}).describe(`Focus trap configuration for modal-like containers`),uI=h({key:r().describe(`Key combination (e.g., "Ctrl+S", "Alt+N", "Escape")`),action:r().describe(`Action identifier to invoke when shortcut is triggered`),description:q.optional().describe(`Human-readable description of what the shortcut does`),scope:E([`global`,`view`,`form`,`modal`,`list`]).default(`global`).describe(`Scope in which this shortcut is active`)}).describe(`Keyboard shortcut binding`),dI=h({tabOrder:E([`auto`,`manual`]).default(`auto`).describe(`Tab order strategy: auto (DOM order) or manual (explicit tabIndex)`),skipLinks:S().default(!1).describe(`Provide skip-to-content navigation links`),focusVisible:S().default(!0).describe(`Show visible focus indicators for keyboard users`),focusTrap:lI.optional().describe(`Focus trap settings`),arrowNavigation:S().default(!1).describe(`Enable arrow key navigation between focusable items`)}).describe(`Focus and tab navigation management`),kye=h({shortcuts:C(uI).optional().describe(`Registered keyboard shortcuts`),focusManagement:dI.optional().describe(`Focus and tab order management`),rovingTabindex:S().default(!1).describe(`Enable roving tabindex pattern for composite widgets`)}).merge(eM.partial()).describe(`Keyboard navigation and shortcut configuration`),fI=h({primary:r().describe(`Primary brand color (hex, rgb, or hsl)`),secondary:r().optional().describe(`Secondary brand color`),accent:r().optional().describe(`Accent color for highlights`),success:r().optional().describe(`Success state color (default: green)`),warning:r().optional().describe(`Warning state color (default: yellow)`),error:r().optional().describe(`Error state color (default: red)`),info:r().optional().describe(`Info state color (default: blue)`),background:r().optional().describe(`Background color`),surface:r().optional().describe(`Surface/card background color`),text:r().optional().describe(`Primary text color`),textSecondary:r().optional().describe(`Secondary text color`),border:r().optional().describe(`Border color`),disabled:r().optional().describe(`Disabled state color`),primaryLight:r().optional().describe(`Lighter shade of primary`),primaryDark:r().optional().describe(`Darker shade of primary`),secondaryLight:r().optional().describe(`Lighter shade of secondary`),secondaryDark:r().optional().describe(`Darker shade of secondary`)}),pI=h({fontFamily:h({base:r().optional().describe(`Base font family (default: system fonts)`),heading:r().optional().describe(`Heading font family`),mono:r().optional().describe(`Monospace font family for code`)}).optional(),fontSize:h({xs:r().optional().describe(`Extra small font size (e.g., 0.75rem)`),sm:r().optional().describe(`Small font size (e.g., 0.875rem)`),base:r().optional().describe(`Base font size (e.g., 1rem)`),lg:r().optional().describe(`Large font size (e.g., 1.125rem)`),xl:r().optional().describe(`Extra large font size (e.g., 1.25rem)`),"2xl":r().optional().describe(`2X large font size (e.g., 1.5rem)`),"3xl":r().optional().describe(`3X large font size (e.g., 1.875rem)`),"4xl":r().optional().describe(`4X large font size (e.g., 2.25rem)`)}).optional(),fontWeight:h({light:P().optional().describe(`Light weight (default: 300)`),normal:P().optional().describe(`Normal weight (default: 400)`),medium:P().optional().describe(`Medium weight (default: 500)`),semibold:P().optional().describe(`Semibold weight (default: 600)`),bold:P().optional().describe(`Bold weight (default: 700)`)}).optional(),lineHeight:h({tight:r().optional().describe(`Tight line height (e.g., 1.25)`),normal:r().optional().describe(`Normal line height (e.g., 1.5)`),relaxed:r().optional().describe(`Relaxed line height (e.g., 1.75)`),loose:r().optional().describe(`Loose line height (e.g., 2)`)}).optional(),letterSpacing:h({tighter:r().optional().describe(`Tighter letter spacing (e.g., -0.05em)`),tight:r().optional().describe(`Tight letter spacing (e.g., -0.025em)`),normal:r().optional().describe(`Normal letter spacing (e.g., 0)`),wide:r().optional().describe(`Wide letter spacing (e.g., 0.025em)`),wider:r().optional().describe(`Wider letter spacing (e.g., 0.05em)`)}).optional()}),mI=h({0:r().optional().describe(`0 spacing (0)`),1:r().optional().describe(`Spacing unit 1 (e.g., 0.25rem)`),2:r().optional().describe(`Spacing unit 2 (e.g., 0.5rem)`),3:r().optional().describe(`Spacing unit 3 (e.g., 0.75rem)`),4:r().optional().describe(`Spacing unit 4 (e.g., 1rem)`),5:r().optional().describe(`Spacing unit 5 (e.g., 1.25rem)`),6:r().optional().describe(`Spacing unit 6 (e.g., 1.5rem)`),8:r().optional().describe(`Spacing unit 8 (e.g., 2rem)`),10:r().optional().describe(`Spacing unit 10 (e.g., 2.5rem)`),12:r().optional().describe(`Spacing unit 12 (e.g., 3rem)`),16:r().optional().describe(`Spacing unit 16 (e.g., 4rem)`),20:r().optional().describe(`Spacing unit 20 (e.g., 5rem)`),24:r().optional().describe(`Spacing unit 24 (e.g., 6rem)`)}),hI=h({none:r().optional().describe(`No border radius (0)`),sm:r().optional().describe(`Small border radius (e.g., 0.125rem)`),base:r().optional().describe(`Base border radius (e.g., 0.25rem)`),md:r().optional().describe(`Medium border radius (e.g., 0.375rem)`),lg:r().optional().describe(`Large border radius (e.g., 0.5rem)`),xl:r().optional().describe(`Extra large border radius (e.g., 0.75rem)`),"2xl":r().optional().describe(`2X large border radius (e.g., 1rem)`),full:r().optional().describe(`Full border radius (50%)`)}),gI=h({none:r().optional().describe(`No shadow`),sm:r().optional().describe(`Small shadow`),base:r().optional().describe(`Base shadow`),md:r().optional().describe(`Medium shadow`),lg:r().optional().describe(`Large shadow`),xl:r().optional().describe(`Extra large shadow`),"2xl":r().optional().describe(`2X large shadow`),inner:r().optional().describe(`Inner shadow (inset)`)}),_I=h({xs:r().optional().describe(`Extra small breakpoint (e.g., 480px)`),sm:r().optional().describe(`Small breakpoint (e.g., 640px)`),md:r().optional().describe(`Medium breakpoint (e.g., 768px)`),lg:r().optional().describe(`Large breakpoint (e.g., 1024px)`),xl:r().optional().describe(`Extra large breakpoint (e.g., 1280px)`),"2xl":r().optional().describe(`2X large breakpoint (e.g., 1536px)`)}),vI=h({duration:h({fast:r().optional().describe(`Fast animation (e.g., 150ms)`),base:r().optional().describe(`Base animation (e.g., 300ms)`),slow:r().optional().describe(`Slow animation (e.g., 500ms)`)}).optional(),timing:h({linear:r().optional().describe(`Linear timing function`),ease:r().optional().describe(`Ease timing function`),ease_in:r().optional().describe(`Ease-in timing function`),ease_out:r().optional().describe(`Ease-out timing function`),ease_in_out:r().optional().describe(`Ease-in-out timing function`)}).optional()}),yI=h({base:P().optional().describe(`Base z-index (e.g., 0)`),dropdown:P().optional().describe(`Dropdown z-index (e.g., 1000)`),sticky:P().optional().describe(`Sticky z-index (e.g., 1020)`),fixed:P().optional().describe(`Fixed z-index (e.g., 1030)`),modalBackdrop:P().optional().describe(`Modal backdrop z-index (e.g., 1040)`),modal:P().optional().describe(`Modal z-index (e.g., 1050)`),popover:P().optional().describe(`Popover z-index (e.g., 1060)`),tooltip:P().optional().describe(`Tooltip z-index (e.g., 1070)`)}),bI=E([`light`,`dark`,`auto`]),Aye=bI,xI=E([`compact`,`regular`,`spacious`]),jye=xI,SI=E([`AA`,`AAA`]),Mye=SI,CI=h({name:kA.describe(`Unique theme identifier (snake_case)`),label:r().describe(`Human-readable theme name`),description:r().optional().describe(`Theme description`),mode:bI.default(`light`).describe(`Theme mode (light, dark, or auto)`),colors:fI.describe(`Color palette configuration`),typography:pI.optional().describe(`Typography settings`),spacing:mI.optional().describe(`Spacing scale`),borderRadius:hI.optional().describe(`Border radius scale`),shadows:gI.optional().describe(`Box shadow effects`),breakpoints:_I.optional().describe(`Responsive breakpoints`),animation:vI.optional().describe(`Animation settings`),zIndex:yI.optional().describe(`Z-index scale for layering`),customVars:d(r(),r()).optional().describe(`Custom CSS variables (key-value pairs)`),logo:h({light:r().optional().describe(`Logo URL for light mode`),dark:r().optional().describe(`Logo URL for dark mode`),favicon:r().optional().describe(`Favicon URL`)}).optional().describe(`Logo assets`),extends:r().optional().describe(`Base theme to extend from`),density:xI.optional().describe(`Display density: compact, regular, or spacious`),wcagContrast:SI.optional().describe(`WCAG color contrast level (AA or AAA)`),rtl:S().optional().describe(`Enable right-to-left layout direction`),touchTarget:nI.optional().describe(`Touch target sizing defaults`),keyboardNavigation:dI.optional().describe(`Keyboard focus management settings`)}),wI=E([`cache_first`,`network_first`,`stale_while_revalidate`,`network_only`,`cache_only`]).describe(`Data fetching strategy for offline/online transitions`),TI=E([`client_wins`,`server_wins`,`manual`,`last_write_wins`]).describe(`How to resolve conflicts when syncing offline changes`),EI=h({strategy:wI.default(`network_first`).describe(`Sync fetch strategy`),conflictResolution:TI.default(`last_write_wins`).describe(`Conflict resolution policy`),retryInterval:P().optional().describe(`Retry interval in milliseconds between sync attempts`),maxRetries:P().optional().describe(`Maximum number of sync retry attempts`),batchSize:P().optional().describe(`Number of mutations to sync per batch`)}).describe(`Offline-to-online synchronization configuration`),DI=E([`indexeddb`,`localstorage`,`sqlite`]).describe(`Client-side storage backend for offline cache`),OI=E([`lru`,`lfu`,`fifo`]).describe(`Cache eviction policy`),kI=h({maxSize:P().optional().describe(`Maximum cache size in bytes`),ttl:P().optional().describe(`Time-to-live for cached entries in milliseconds`),persistStorage:DI.default(`indexeddb`).describe(`Storage backend`),evictionPolicy:OI.default(`lru`).describe(`Cache eviction policy when full`)}).describe(`Client-side offline cache configuration`),Nye=h({enabled:S().default(!1).describe(`Enable offline support`),strategy:wI.default(`network_first`).describe(`Default offline fetch strategy`),cache:kI.optional().describe(`Cache settings for offline data`),sync:EI.optional().describe(`Sync settings for offline mutations`),offlineIndicator:S().default(!0).describe(`Show a visual indicator when offline`),offlineMessage:q.optional().describe(`Customizable offline status message shown to users`),queueMaxSize:P().optional().describe(`Maximum number of queued offline mutations`)}).describe(`Offline support configuration`),AI=E([`fade`,`slide_up`,`slide_down`,`slide_left`,`slide_right`,`scale`,`rotate`,`flip`,`none`]).describe(`Transition preset type`),jI=E([`linear`,`ease`,`ease_in`,`ease_out`,`ease_in_out`,`spring`]).describe(`Animation easing function`),MI=h({preset:AI.optional().describe(`Transition preset to apply`),duration:P().optional().describe(`Transition duration in milliseconds`),easing:jI.optional().describe(`Easing function for the transition`),delay:P().optional().describe(`Delay before transition starts in milliseconds`),customKeyframes:r().optional().describe(`CSS @keyframes name for custom animations`),themeToken:r().optional().describe(`Reference to a theme animation token (e.g. "animation.duration.fast")`)}).describe(`Animation transition configuration`),NI=E([`on_mount`,`on_unmount`,`on_hover`,`on_focus`,`on_click`,`on_scroll`,`on_visible`]).describe(`Event that triggers the animation`),PI=h({label:q.optional().describe(`Descriptive label for this animation configuration`),enter:MI.optional().describe(`Enter/mount animation`),exit:MI.optional().describe(`Exit/unmount animation`),hover:MI.optional().describe(`Hover state animation`),trigger:NI.optional().describe(`When to trigger the animation`),reducedMotion:E([`respect`,`disable`,`alternative`]).default(`respect`).describe(`Accessibility: how to handle prefers-reduced-motion`)}).merge(eM.partial()).describe(`Component-level animation configuration`),FI=h({type:AI.default(`fade`).describe(`Page transition type`),duration:P().default(300).describe(`Transition duration in milliseconds`),easing:jI.default(`ease_in_out`).describe(`Easing function for the transition`),crossFade:S().default(!1).describe(`Whether to cross-fade between pages`)}).describe(`Page-level transition configuration`),Pye=h({label:q.optional().describe(`Descriptive label for the motion configuration`),defaultTransition:MI.optional().describe(`Default transition applied to all animations`),pageTransitions:FI.optional().describe(`Page navigation transition settings`),componentAnimations:d(r(),PI).optional().describe(`Component name to animation configuration mapping`),reducedMotion:S().default(!1).describe(`When true, respect prefers-reduced-motion and suppress animations globally`),enabled:S().default(!0).describe(`Enable or disable all animations globally`)}).describe(`Top-level motion and animation design configuration`),II=E([`toast`,`snackbar`,`banner`,`alert`,`inline`]).describe(`Notification presentation style`),LI=E([`info`,`success`,`warning`,`error`]).describe(`Notification severity level`),RI=E([`top_left`,`top_center`,`top_right`,`bottom_left`,`bottom_center`,`bottom_right`]).describe(`Screen position for notification placement`),zI=h({label:q.describe(`Action button label`),action:r().describe(`Action identifier to execute`),variant:E([`primary`,`secondary`,`link`]).default(`primary`).describe(`Button variant style`)}).describe(`Notification action button`),Fye=h({type:II.default(`toast`).describe(`Notification presentation style`),severity:LI.default(`info`).describe(`Notification severity level`),title:q.optional().describe(`Notification title`),message:q.describe(`Notification message body`),icon:r().optional().describe(`Icon name override`),duration:P().optional().describe(`Auto-dismiss duration in ms, omit for persistent`),dismissible:S().default(!0).describe(`Allow user to dismiss the notification`),actions:C(zI).optional().describe(`Action buttons`),position:RI.optional().describe(`Override default position`)}).merge(eM.partial()).describe(`Notification instance definition`),Iye=h({defaultPosition:RI.default(`top_right`).describe(`Default screen position for notifications`),defaultDuration:P().default(5e3).describe(`Default auto-dismiss duration in ms`),maxVisible:P().default(5).describe(`Maximum number of notifications visible at once`),stackDirection:E([`up`,`down`]).default(`down`).describe(`Stack direction for multiple notifications`),pauseOnHover:S().default(!0).describe(`Pause auto-dismiss timer on hover`)}).describe(`Global notification system configuration`),BI=E([`element`,`handle`,`grip_icon`]).describe(`Drag initiation method`),VI=E([`move`,`copy`,`link`,`none`]).describe(`Drop operation effect`),HI=h({axis:E([`x`,`y`,`both`]).default(`both`).describe(`Constrain drag axis`),bounds:E([`parent`,`viewport`,`none`]).default(`none`).describe(`Constrain within bounds`),grid:w([P(),P()]).optional().describe(`Snap to grid [x, y] in pixels`)}).describe(`Drag movement constraints`),UI=h({label:q.optional().describe(`Accessible label for the drop zone`),accept:C(r()).describe(`Accepted drag item types`),maxItems:P().optional().describe(`Maximum items allowed in drop zone`),highlightOnDragOver:S().default(!0).describe(`Highlight drop zone when dragging over`),dropEffect:VI.default(`move`).describe(`Visual effect on drop`)}).merge(eM.partial()).describe(`Drop zone configuration`),WI=h({type:r().describe(`Drag item type identifier for matching with drop zones`),label:q.optional().describe(`Accessible label describing the draggable item`),handle:BI.default(`element`).describe(`How to initiate drag`),constraint:HI.optional().describe(`Drag movement constraints`),preview:E([`element`,`custom`,`none`]).default(`element`).describe(`Drag preview type`),disabled:S().default(!1).describe(`Disable dragging`)}).merge(eM.partial()).describe(`Draggable item configuration`),Lye=h({enabled:S().default(!1).describe(`Enable drag and drop`),dragItem:WI.optional().describe(`Configuration for draggable item`),dropZone:UI.optional().describe(`Configuration for drop target`),sortable:S().default(!1).describe(`Enable sortable list behavior`),autoScroll:S().default(!0).describe(`Auto-scroll during drag near edges`),touchDelay:P().default(200).describe(`Delay in ms before drag starts on touch devices`)}).describe(`Drag and drop interaction configuration`);DA({},{AccessControlConfigSchema:()=>gL,AddFieldOperation:()=>PR,AdvancedAuthConfigSchema:()=>XR,AnalyzerConfigSchema:()=>CL,AppCompatibilityCheckSchema:()=>Axe,AppInstallRequestSchema:()=>jxe,AppInstallResultSchema:()=>Mxe,AppManifestSchema:()=>kxe,AppTranslationBundleSchema:()=>Nbe,AuditConfigSchema:()=>nbe,AuditEventActorSchema:()=>ML,AuditEventChangeSchema:()=>PL,AuditEventFilterSchema:()=>tbe,AuditEventSchema:()=>ebe,AuditEventSeverity:()=>jL,AuditEventTargetSchema:()=>NL,AuditEventType:()=>AL,AuditFindingSchema:()=>rz,AuditFindingSeveritySchema:()=>tz,AuditFindingStatusSchema:()=>nz,AuditLogConfigSchema:()=>ez,AuditRetentionPolicySchema:()=>FL,AuditScheduleSchema:()=>iz,AuditStorageConfigSchema:()=>LL,AuthConfigSchema:()=>mbe,AuthPluginConfigSchema:()=>GR,AuthProviderConfigSchema:()=>WR,AwarenessEventSchema:()=>Wbe,AwarenessSessionSchema:()=>Hbe,AwarenessUpdateSchema:()=>Ube,AwarenessUserStateSchema:()=>uB,BackupConfigSchema:()=>eL,BackupRetentionSchema:()=>$I,BackupStrategySchema:()=>QI,BatchProgressSchema:()=>Ebe,BatchTask:()=>jbe,BatchTaskSchema:()=>Oz,BucketConfigSchema:()=>yL,CRDTMergeResultSchema:()=>Bbe,CRDTStateSchema:()=>iB,CRDTType:()=>Rbe,CacheAvalanchePreventionSchema:()=>XI,CacheConfigSchema:()=>JI,CacheConsistencySchema:()=>YI,CacheInvalidationSchema:()=>qI,CacheStrategySchema:()=>GI,CacheTierSchema:()=>KI,CacheWarmupSchema:()=>ZI,ChangeImpactSchema:()=>MR,ChangePrioritySchema:()=>AR,ChangeRequestSchema:()=>pbe,ChangeSetSchema:()=>UR,ChangeStatusSchema:()=>jR,ChangeTypeSchema:()=>kR,CollaborationMode:()=>dB,CollaborationSessionConfigSchema:()=>fB,CollaborationSessionSchema:()=>Gbe,CollaborativeCursorSchema:()=>cB,ComplianceAuditRequirementSchema:()=>wR,ComplianceConfigSchema:()=>hbe,ComplianceEncryptionRequirementSchema:()=>TR,ComplianceFrameworkSchema:()=>CR,ConsoleDestinationConfigSchema:()=>UL,ConsumerConfigSchema:()=>sL,CoreServiceName:()=>yB,CounterOperationSchema:()=>zbe,CoverageBreakdownEntrySchema:()=>qz,CreateObjectOperation:()=>LR,CronScheduleSchema:()=>_z,CursorColorPreset:()=>aB,CursorSelectionSchema:()=>sB,CursorStyleSchema:()=>oB,CursorUpdateSchema:()=>Vbe,DEFAULT_SUSPICIOUS_ACTIVITY_RULES:()=>rbe,DataClassificationPolicySchema:()=>OR,DataClassificationSchema:()=>SR,DatabaseLevelIsolationStrategySchema:()=>DB,DatabaseProviderSchema:()=>SB,DeadLetterQueueSchema:()=>cL,DeleteObjectOperation:()=>zR,DeployBundleSchema:()=>Oxe,DeployDiffSchema:()=>Txe,DeployManifestSchema:()=>RB,DeployStatusEnum:()=>wxe,DeployValidationIssueSchema:()=>LB,DeployValidationResultSchema:()=>Dxe,DisasterRecoveryPlanSchema:()=>zye,DistributedCacheConfigSchema:()=>Rye,EmailAndPasswordConfigSchema:()=>JR,EmailTemplateSchema:()=>Az,EmailVerificationConfigSchema:()=>YR,EncryptionAlgorithmSchema:()=>UA,EncryptionConfigSchema:()=>KA,ExecuteSqlOperation:()=>BR,ExtendedLogLevel:()=>VL,ExternalServiceDestinationConfigSchema:()=>KL,FacetConfigSchema:()=>TL,FailoverConfigSchema:()=>nL,FailoverModeSchema:()=>tL,FeatureSchema:()=>vxe,FieldEncryptionSchema:()=>mve,FieldTranslationSchema:()=>Iz,FileDestinationConfigSchema:()=>WL,FileMetadataSchema:()=>uL,GCounterSchema:()=>Qz,GDPRConfigSchema:()=>ZR,HIPAAConfigSchema:()=>QR,HistogramBucketConfigSchema:()=>QL,HttpDestinationConfigSchema:()=>GL,HttpServerConfig:()=>Qye,HttpServerConfigSchema:()=>EL,InAppNotificationSchema:()=>Nz,IncidentCategorySchema:()=>oz,IncidentNotificationMatrixSchema:()=>uz,IncidentNotificationRuleSchema:()=>lz,IncidentResponsePhaseSchema:()=>cz,IncidentResponsePolicySchema:()=>_be,IncidentSchema:()=>gbe,IncidentSeveritySchema:()=>az,IncidentStatusSchema:()=>sz,IntervalScheduleSchema:()=>vz,JobExecutionSchema:()=>Cbe,JobExecutionStatus:()=>Sz,JobSchema:()=>Sbe,KernelServiceMapSchema:()=>dxe,KeyManagementProviderSchema:()=>WA,KeyRotationPolicySchema:()=>GA,LWWRegisterSchema:()=>Zz,LicenseMetricType:()=>OB,LicenseSchema:()=>bxe,LifecycleActionSchema:()=>mL,LifecyclePolicyConfigSchema:()=>vL,LifecyclePolicyRuleSchema:()=>_L,LocaleSchema:()=>Fz,LogDestinationSchema:()=>qL,LogDestinationType:()=>HL,LogEnrichmentConfigSchema:()=>JL,LogEntrySchema:()=>ibe,LogFormat:()=>zL,LogLevel:()=>RL,LoggerConfigSchema:()=>BL,LoggingConfigSchema:()=>obe,MaskingConfigSchema:()=>hve,MaskingRuleSchema:()=>JA,MaskingStrategySchema:()=>qA,MaskingVisibilityRuleSchema:()=>ER,MessageFormatSchema:()=>Vz,MessageQueueConfigSchema:()=>Bye,MessageQueueProviderSchema:()=>aL,MetadataCollectionInfoSchema:()=>exe,MetadataDiffResultSchema:()=>sxe,MetadataExportOptionsSchema:()=>txe,MetadataFallbackStrategySchema:()=>_B,MetadataFormatSchema:()=>hB,MetadataHistoryQueryOptionsSchema:()=>axe,MetadataHistoryQueryResultSchema:()=>oxe,MetadataHistoryRecordSchema:()=>vB,MetadataHistoryRetentionPolicySchema:()=>cxe,MetadataImportOptionsSchema:()=>nxe,MetadataLoadOptionsSchema:()=>Ybe,MetadataLoadResultSchema:()=>Xbe,MetadataLoaderContractSchema:()=>Jbe,MetadataManagerConfigSchema:()=>ixe,MetadataRecordSchema:()=>Kbe,MetadataSaveOptionsSchema:()=>Zbe,MetadataSaveResultSchema:()=>Qbe,MetadataScopeSchema:()=>pB,MetadataSourceSchema:()=>rxe,MetadataStateSchema:()=>mB,MetadataStatsSchema:()=>gB,MetadataWatchEventSchema:()=>$be,MetricAggregationConfigSchema:()=>nR,MetricAggregationType:()=>ZL,MetricDataPointSchema:()=>sbe,MetricDefinitionSchema:()=>eR,MetricExportConfigSchema:()=>aR,MetricLabelsSchema:()=>$L,MetricType:()=>YL,MetricUnit:()=>XL,MetricsConfigSchema:()=>lbe,MiddlewareConfig:()=>$ye,MiddlewareConfigSchema:()=>OL,MiddlewareType:()=>DL,MigrationDependencySchema:()=>HR,MigrationOperationSchema:()=>VR,MigrationPlanSchema:()=>Exe,MigrationStatementSchema:()=>IB,ModifyFieldOperation:()=>FR,MultipartUploadConfigSchema:()=>hL,MutualTLSConfigSchema:()=>KR,NotificationChannelSchema:()=>Pz,NotificationConfigSchema:()=>Mbe,ORSetElementSchema:()=>eB,ORSetSchema:()=>tB,OTComponentSchema:()=>Jz,OTOperationSchema:()=>Yz,OTOperationType:()=>Ibe,OTTransformResultSchema:()=>Lbe,ObjectMetadataSchema:()=>Vye,ObjectStorageConfigSchema:()=>xL,ObjectTranslationDataSchema:()=>Lz,ObjectTranslationNodeSchema:()=>Wz,OnceScheduleSchema:()=>yz,OpenTelemetryCompatibilitySchema:()=>xR,OtelExporterType:()=>bR,PCIDSSConfigSchema:()=>$R,PKG_CONVENTIONS:()=>Nxe,PNCounterSchema:()=>$z,PackagePublishResultSchema:()=>qbe,PlanSchema:()=>yxe,PresignedUrlConfigSchema:()=>Hye,ProvisioningStepSchema:()=>PB,PushNotificationSchema:()=>Mz,QueueConfig:()=>kbe,QueueConfigSchema:()=>Dz,QuotaEnforcementResultSchema:()=>mxe,RPOSchema:()=>rL,RTOSchema:()=>iL,RegistryConfigSchema:()=>xxe,RegistrySyncPolicySchema:()=>kB,RegistryUpstreamSchema:()=>AB,RemoveFieldOperation:()=>IR,RenameObjectOperation:()=>RR,RetryPolicySchema:()=>xz,RollbackPlanSchema:()=>NR,RouteHandlerMetadataSchema:()=>Jye,RowLevelIsolationStrategySchema:()=>TB,SMSTemplateSchema:()=>jz,SamplingDecision:()=>hR,SamplingStrategyType:()=>gR,ScheduleSchema:()=>bz,SchemaChangeSchema:()=>FB,SchemaLevelIsolationStrategySchema:()=>EB,SearchConfigSchema:()=>qye,SearchIndexConfigSchema:()=>wL,SearchProviderSchema:()=>SL,SecurityContextConfigSchema:()=>fbe,SecurityEventCorrelationSchema:()=>DR,ServerCapabilitiesSchema:()=>Xye,ServerEventSchema:()=>Yye,ServerEventType:()=>kL,ServerStatusSchema:()=>Zye,ServiceConfigSchema:()=>fxe,ServiceCriticalitySchema:()=>bB,ServiceLevelIndicatorSchema:()=>rR,ServiceLevelObjectiveSchema:()=>iR,ServiceRequirementDef:()=>lxe,ServiceStatusSchema:()=>uxe,SocialProviderConfigSchema:()=>qR,SpanAttributeValueSchema:()=>dR,SpanAttributesSchema:()=>fR,SpanEventSchema:()=>pR,SpanKind:()=>lR,SpanLinkSchema:()=>mR,SpanSchema:()=>ube,SpanStatus:()=>uR,StorageAclSchema:()=>fL,StorageClassSchema:()=>pL,StorageConnectionSchema:()=>bL,StorageNameMapping:()=>Ixe,StorageProviderSchema:()=>dL,StorageScopeSchema:()=>lL,StructuredLogEntrySchema:()=>abe,SupplierAssessmentStatusSchema:()=>fz,SupplierRiskLevelSchema:()=>dz,SupplierSecurityAssessmentSchema:()=>vbe,SupplierSecurityPolicySchema:()=>ybe,SupplierSecurityRequirementSchema:()=>pz,SuspiciousActivityRuleSchema:()=>IL,SystemFieldName:()=>Fxe,SystemObjectName:()=>Pxe,TASK_PRIORITY_VALUES:()=>wbe,TRANSLATE_PLACEHOLDER:()=>Fbe,Task:()=>Obe,TaskExecutionResultSchema:()=>Tbe,TaskPriority:()=>Cz,TaskRetryPolicySchema:()=>Tz,TaskSchema:()=>Ez,TaskStatus:()=>wz,TenantConnectionConfigSchema:()=>CB,TenantIsolationConfigSchema:()=>gxe,TenantIsolationLevel:()=>xB,TenantPlanSchema:()=>MB,TenantProvisioningRequestSchema:()=>Sxe,TenantProvisioningResultSchema:()=>Cxe,TenantProvisioningStatusEnum:()=>jB,TenantQuotaSchema:()=>wB,TenantRegionSchema:()=>NB,TenantSchema:()=>hxe,TenantSecurityPolicySchema:()=>_xe,TenantUsageSchema:()=>pxe,TextCRDTOperationSchema:()=>nB,TextCRDTStateSchema:()=>rB,TimeSeriesDataPointSchema:()=>tR,TimeSeriesSchema:()=>cbe,TopicConfigSchema:()=>oL,TraceContextPropagationSchema:()=>yR,TraceContextSchema:()=>cR,TraceFlagsSchema:()=>sR,TracePropagationFormat:()=>vR,TraceSamplingConfigSchema:()=>_R,TraceStateSchema:()=>oR,TracingConfigSchema:()=>dbe,TrainingCategorySchema:()=>mz,TrainingCompletionStatusSchema:()=>hz,TrainingCourseSchema:()=>gz,TrainingPlanSchema:()=>xbe,TrainingRecordSchema:()=>bbe,TranslationBundleSchema:()=>zz,TranslationConfigSchema:()=>Hz,TranslationCoverageResultSchema:()=>Pbe,TranslationDataSchema:()=>Rz,TranslationDiffItemSchema:()=>Kz,TranslationDiffStatusSchema:()=>Gz,TranslationFileOrganizationSchema:()=>Bz,UserActivityStatus:()=>lB,VectorClockSchema:()=>Xz,WorkerConfig:()=>Abe,WorkerConfigSchema:()=>kz,WorkerStatsSchema:()=>Dbe,azureBlobStorageExample:()=>Gye,gcsStorageExample:()=>Kye,minioStorageExample:()=>Wye,s3StorageExample:()=>Uye});var GI=E([`lru`,`lfu`,`fifo`,`ttl`,`adaptive`]).describe(`Cache eviction strategy`),KI=h({name:r().describe(`Unique cache tier name`),type:E([`memory`,`redis`,`memcached`,`cdn`]).describe(`Cache backend type`),maxSize:P().optional().describe(`Max size in MB`),ttl:P().default(300).describe(`Default TTL in seconds`),strategy:GI.default(`lru`).describe(`Eviction strategy`),warmup:S().default(!1).describe(`Pre-populate cache on startup`)}).describe(`Configuration for a single cache tier in the hierarchy`),qI=h({trigger:E([`create`,`update`,`delete`,`manual`]).describe(`Event that triggers invalidation`),scope:E([`key`,`pattern`,`tag`,`all`]).describe(`Invalidation scope`),pattern:r().optional().describe(`Key pattern for pattern-based invalidation`),tags:C(r()).optional().describe(`Cache tags to invalidate`)}).describe(`Rule defining when and how cached entries are invalidated`),JI=h({enabled:S().default(!1).describe(`Enable application-level caching`),tiers:C(KI).describe(`Ordered cache tier hierarchy`),invalidation:C(qI).describe(`Cache invalidation rules`),prefetch:S().default(!1).describe(`Enable cache prefetching`),compression:S().default(!1).describe(`Enable data compression in cache`),encryption:S().default(!1).describe(`Enable encryption for cached data`)}).describe(`Top-level application cache configuration`),YI=E([`write_through`,`write_behind`,`write_around`,`refresh_ahead`]).describe(`Distributed cache write consistency strategy`),XI=h({jitterTtl:h({enabled:S().default(!1).describe(`Add random jitter to TTL values`),maxJitterSeconds:P().default(60).describe(`Maximum jitter added to TTL in seconds`)}).optional().describe(`TTL jitter to prevent simultaneous expiration`),circuitBreaker:h({enabled:S().default(!1).describe(`Enable circuit breaker for backend protection`),failureThreshold:P().default(5).describe(`Failures before circuit opens`),resetTimeout:P().default(30).describe(`Seconds before half-open state`)}).optional().describe(`Circuit breaker for backend protection`),lockout:h({enabled:S().default(!1).describe(`Enable cache locking for key regeneration`),lockTimeoutMs:P().default(5e3).describe(`Maximum lock wait time in milliseconds`)}).optional().describe(`Lock-based stampede prevention`)}).describe(`Cache avalanche/stampede prevention configuration`),ZI=h({enabled:S().default(!1).describe(`Enable cache warmup`),strategy:E([`eager`,`lazy`,`scheduled`]).default(`lazy`).describe(`Warmup strategy: eager (at startup), lazy (on first access), scheduled (cron)`),schedule:r().optional().describe(`Cron expression for scheduled warmup`),patterns:C(r()).optional().describe(`Key patterns to warm up (e.g., "user:*", "config:*")`),concurrency:P().default(10).describe(`Maximum concurrent warmup operations`)}).describe(`Cache warmup strategy`),Rye=JI.extend({consistency:YI.optional().describe(`Distributed cache consistency strategy`),avalanchePrevention:XI.optional().describe(`Cache avalanche and stampede prevention`),warmup:ZI.optional().describe(`Cache warmup strategy`)}).describe(`Distributed cache configuration with consistency and avalanche prevention`),QI=E([`full`,`incremental`,`differential`]).describe(`Backup strategy type`),$I=h({days:P().min(1).describe(`Retention period in days`),minCopies:P().min(1).default(3).describe(`Minimum backup copies to retain`),maxCopies:P().optional().describe(`Maximum backup copies to store`)}).describe(`Backup retention policy`),eL=h({strategy:QI.default(`incremental`).describe(`Backup strategy`),schedule:r().optional().describe(`Cron expression for backup schedule (e.g., "0 2 * * *")`),retention:$I.describe(`Backup retention policy`),destination:h({type:E([`s3`,`gcs`,`azure_blob`,`local`]).describe(`Storage backend type`),bucket:r().optional().describe(`Cloud storage bucket/container name`),path:r().optional().describe(`Storage path prefix`),region:r().optional().describe(`Cloud storage region`)}).describe(`Backup storage destination`),encryption:h({enabled:S().default(!0).describe(`Enable backup encryption`),algorithm:E([`AES-256-GCM`,`AES-256-CBC`,`ChaCha20-Poly1305`]).default(`AES-256-GCM`).describe(`Encryption algorithm`),keyId:r().optional().describe(`KMS key ID for encryption`)}).optional().describe(`Backup encryption settings`),compression:h({enabled:S().default(!0).describe(`Enable backup compression`),algorithm:E([`gzip`,`zstd`,`lz4`,`snappy`]).default(`zstd`).describe(`Compression algorithm`)}).optional().describe(`Backup compression settings`),verifyAfterBackup:S().default(!0).describe(`Verify backup integrity after creation`)}).describe(`Backup configuration`),tL=E([`active_passive`,`active_active`,`pilot_light`,`warm_standby`]).describe(`Failover mode`),nL=h({mode:tL.default(`active_passive`).describe(`Failover mode`),autoFailover:S().default(!0).describe(`Enable automatic failover`),healthCheckInterval:P().default(30).describe(`Health check interval in seconds`),failureThreshold:P().default(3).describe(`Consecutive failures before failover`),regions:C(h({name:r().describe(`Region identifier (e.g., "us-east-1", "eu-west-1")`),role:E([`primary`,`secondary`,`witness`]).describe(`Region role`),endpoint:r().optional().describe(`Region endpoint URL`),priority:P().optional().describe(`Failover priority (lower = higher priority)`)})).min(2).describe(`Multi-region configuration (minimum 2 regions)`),dns:h({ttl:P().default(60).describe(`DNS TTL in seconds for failover`),provider:E([`route53`,`cloudflare`,`azure_dns`,`custom`]).optional().describe(`DNS provider for automatic failover`)}).optional().describe(`DNS failover settings`)}).describe(`Failover configuration`),rL=h({value:P().min(0).describe(`RPO value`),unit:E([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RPO time unit`)}).describe(`Recovery Point Objective (maximum acceptable data loss)`),iL=h({value:P().min(0).describe(`RTO value`),unit:E([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RTO time unit`)}).describe(`Recovery Time Objective (maximum acceptable downtime)`),zye=h({enabled:S().default(!1).describe(`Enable disaster recovery plan`),rpo:rL.describe(`Recovery Point Objective`),rto:iL.describe(`Recovery Time Objective`),backup:eL.describe(`Backup configuration`),failover:nL.optional().describe(`Multi-region failover configuration`),replication:h({mode:E([`synchronous`,`asynchronous`,`semi_synchronous`]).default(`asynchronous`).describe(`Data replication mode`),maxLagSeconds:P().optional().describe(`Maximum acceptable replication lag in seconds`),includeObjects:C(r()).optional().describe(`Objects to replicate (empty = all)`),excludeObjects:C(r()).optional().describe(`Objects to exclude from replication`)}).optional().describe(`Data replication settings`),testing:h({enabled:S().default(!1).describe(`Enable automated DR testing`),schedule:r().optional().describe(`Cron expression for DR test schedule`),notificationChannel:r().optional().describe(`Notification channel for DR test results`)}).optional().describe(`Automated disaster recovery testing`),runbookUrl:r().optional().describe(`URL to disaster recovery runbook/playbook`),contacts:C(h({name:r().describe(`Contact name`),role:r().describe(`Contact role (e.g., "DBA", "SRE Lead")`),email:r().optional().describe(`Contact email`),phone:r().optional().describe(`Contact phone`)})).optional().describe(`Emergency contact list for DR incidents`)}).describe(`Complete disaster recovery plan configuration`),aL=E([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Supported message queue backend provider`),oL=h({name:r().describe(`Topic name identifier`),partitions:P().default(1).describe(`Number of partitions for parallel consumption`),replicationFactor:P().default(1).describe(`Number of replicas for fault tolerance`),retentionMs:P().optional().describe(`Message retention period in milliseconds`),compressionType:E([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression algorithm`)}).describe(`Configuration for a message queue topic`),sL=h({groupId:r().describe(`Consumer group identifier`),autoOffsetReset:E([`earliest`,`latest`]).default(`latest`).describe(`Where to start reading when no offset exists`),enableAutoCommit:S().default(!0).describe(`Automatically commit consumed offsets`),maxPollRecords:P().default(500).describe(`Maximum records returned per poll`)}).describe(`Consumer group configuration for topic consumption`),cL=h({enabled:S().default(!1).describe(`Enable dead letter queue for failed messages`),maxRetries:P().default(3).describe(`Maximum delivery attempts before sending to DLQ`),queueName:r().describe(`Name of the dead letter queue`)}).describe(`Dead letter queue configuration for unprocessable messages`),Bye=h({provider:aL.describe(`Message queue backend provider`),topics:C(oL).describe(`List of topic configurations`),consumers:C(sL).optional().describe(`Consumer group configurations`),deadLetterQueue:cL.optional().describe(`Dead letter queue for failed messages`),ssl:S().default(!1).describe(`Enable SSL/TLS for broker connections`),sasl:h({mechanism:E([`plain`,`scram-sha-256`,`scram-sha-512`]).describe(`SASL authentication mechanism`),username:r().describe(`SASL username`),password:r().describe(`SASL password`)}).optional().describe(`SASL authentication configuration`)}).describe(`Top-level message queue configuration`),lL=E([`global`,`tenant`,`user`,`session`,`temp`,`cache`,`data`,`logs`,`config`,`public`]).describe(`Storage scope classification`),uL=h({path:r().describe(`File path`),name:r().describe(`File name`),size:P().int().describe(`File size in bytes`),mimeType:r().describe(`MIME type`),lastModified:r().datetime().describe(`Last modified timestamp`),created:r().datetime().describe(`Creation timestamp`),etag:r().optional().describe(`Entity tag`)}),dL=E([`s3`,`azure_blob`,`gcs`,`minio`,`r2`,`spaces`,`wasabi`,`backblaze`,`local`]).describe(`Storage provider type`),fL=E([`private`,`public_read`,`public_read_write`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full_control`]).describe(`Storage access control level`),pL=E([`standard`,`intelligent`,`infrequent_access`,`glacier`,`deep_archive`]).describe(`Storage class/tier for cost optimization`),mL=E([`transition`,`delete`,`abort`]).describe(`Lifecycle policy action type`),Vye=h({contentType:r().describe(`MIME type (e.g., image/jpeg, application/pdf)`),contentLength:P().min(0).describe(`File size in bytes`),contentEncoding:r().optional().describe(`Content encoding (e.g., gzip)`),contentDisposition:r().optional().describe(`Content disposition header`),contentLanguage:r().optional().describe(`Content language`),cacheControl:r().optional().describe(`Cache control directives`),etag:r().optional().describe(`Entity tag for versioning/caching`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),versionId:r().optional().describe(`Object version identifier`),storageClass:pL.optional().describe(`Storage class/tier`),encryption:h({algorithm:r().describe(`Encryption algorithm (e.g., AES256, aws:kms)`),keyId:r().optional().describe(`KMS key ID if using managed encryption`)}).optional().describe(`Server-side encryption configuration`),custom:d(r(),r()).optional().describe(`Custom user-defined metadata`)}),Hye=h({operation:E([`get`,`put`,`delete`,`head`]).describe(`Allowed operation`),expiresIn:P().min(1).max(604800).describe(`Expiration time in seconds (max 7 days)`),contentType:r().optional().describe(`Required content type for PUT operations`),maxSize:P().min(0).optional().describe(`Maximum file size in bytes for PUT operations`),responseContentType:r().optional().describe(`Override content-type for GET operations`),responseContentDisposition:r().optional().describe(`Override content-disposition for GET operations`)}),hL=h({enabled:S().default(!0).describe(`Enable multipart uploads`),partSize:P().min(5*1024*1024).max(5*1024*1024*1024).default(10*1024*1024).describe(`Part size in bytes (min 5MB, max 5GB)`),maxParts:P().min(1).max(1e4).default(1e4).describe(`Maximum number of parts (max 10,000)`),threshold:P().min(0).default(100*1024*1024).describe(`File size threshold to trigger multipart upload (bytes)`),maxConcurrent:P().min(1).max(100).default(4).describe(`Maximum concurrent part uploads`),abortIncompleteAfterDays:P().min(1).optional().describe(`Auto-abort incomplete uploads after N days`)}),gL=h({acl:fL.default(`private`).describe(`Default access control level`),allowedOrigins:C(r()).optional().describe(`CORS allowed origins`),allowedMethods:C(E([`GET`,`PUT`,`POST`,`DELETE`,`HEAD`])).optional().describe(`CORS allowed HTTP methods`),allowedHeaders:C(r()).optional().describe(`CORS allowed headers`),exposeHeaders:C(r()).optional().describe(`CORS exposed headers`),maxAge:P().min(0).optional().describe(`CORS preflight cache duration in seconds`),corsEnabled:S().default(!1).describe(`Enable CORS configuration`),publicAccess:h({allowPublicRead:S().default(!1).describe(`Allow public read access`),allowPublicWrite:S().default(!1).describe(`Allow public write access`),allowPublicList:S().default(!1).describe(`Allow public bucket listing`)}).optional().describe(`Public access control`),allowedIps:C(r()).optional().describe(`Allowed IP addresses/CIDR blocks`),blockedIps:C(r()).optional().describe(`Blocked IP addresses/CIDR blocks`)}),_L=h({id:OA.describe(`Rule identifier`),enabled:S().default(!0).describe(`Enable this rule`),action:mL.describe(`Action to perform`),prefix:r().optional().describe(`Object key prefix filter (e.g., "uploads/")`),tags:d(r(),r()).optional().describe(`Object tag filters`),daysAfterCreation:P().min(0).optional().describe(`Days after object creation`),daysAfterModification:P().min(0).optional().describe(`Days after last modification`),targetStorageClass:pL.optional().describe(`Target storage class for transition action`)}).refine(e=>!(e.action===`transition`&&!e.targetStorageClass),{message:`targetStorageClass is required when action is "transition"`}),vL=h({enabled:S().default(!1).describe(`Enable lifecycle policies`),rules:C(_L).default([]).describe(`Lifecycle rules`)}),yL=h({name:OA.describe(`Bucket identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),bucketName:r().describe(`Actual bucket/container name in storage provider`),region:r().optional().describe(`Storage region (e.g., us-east-1, westus)`),provider:dL.describe(`Storage provider`),endpoint:r().optional().describe(`Custom endpoint URL (for S3-compatible providers)`),pathStyle:S().default(!1).describe(`Use path-style URLs (for S3-compatible providers)`),versioning:S().default(!1).describe(`Enable object versioning`),encryption:h({enabled:S().default(!1).describe(`Enable server-side encryption`),algorithm:E([`AES256`,`aws:kms`,`azure:kms`,`gcp:kms`]).default(`AES256`).describe(`Encryption algorithm`),kmsKeyId:r().optional().describe(`KMS key ID for managed encryption`)}).optional().describe(`Server-side encryption configuration`),accessControl:gL.optional().describe(`Access control configuration`),lifecyclePolicy:vL.optional().describe(`Lifecycle policy configuration`),multipartConfig:hL.optional().describe(`Multipart upload configuration`),tags:d(r(),r()).optional().describe(`Bucket tags for organization`),description:r().optional().describe(`Bucket description`),enabled:S().default(!0).describe(`Enable this bucket`)}),bL=h({accessKeyId:r().optional().describe(`AWS access key ID or MinIO access key`),secretAccessKey:r().optional().describe(`AWS secret access key or MinIO secret key`),sessionToken:r().optional().describe(`AWS session token for temporary credentials`),accountName:r().optional().describe(`Azure storage account name`),accountKey:r().optional().describe(`Azure storage account key`),sasToken:r().optional().describe(`Azure SAS token`),projectId:r().optional().describe(`GCP project ID`),credentials:r().optional().describe(`GCP service account credentials JSON`),endpoint:r().optional().describe(`Custom endpoint URL`),region:r().optional().describe(`Default region`),useSSL:S().default(!0).describe(`Use SSL/TLS for connections`),timeout:P().min(0).optional().describe(`Connection timeout in milliseconds`)}),xL=h({name:OA.describe(`Storage configuration identifier`),label:r().describe(`Display label`),provider:dL.describe(`Primary storage provider`),scope:lL.optional().default(`global`).describe(`Storage scope`),connection:bL.describe(`Connection credentials`),buckets:C(yL).default([]).describe(`Configured buckets`),defaultBucket:r().optional().describe(`Default bucket name for operations`),location:r().optional().describe(`Root path (local) or base location`),quota:P().int().positive().optional().describe(`Max size in bytes`),options:d(r(),u()).optional().describe(`Provider-specific configuration options`),enabled:S().default(!0).describe(`Enable this storage configuration`),description:r().optional().describe(`Configuration description`)}),Uye=xL.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}),Wye=xL.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}),Gye=xL.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}),Kye=xL.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}),SL=E([`elasticsearch`,`algolia`,`meilisearch`,`typesense`,`opensearch`]).describe(`Supported full-text search engine provider`),CL=h({type:E([`standard`,`simple`,`whitespace`,`keyword`,`pattern`,`language`]).describe(`Text analyzer type`),language:r().optional().describe(`Language for language-specific analysis`),stopwords:C(r()).optional().describe(`Custom stopwords to filter during analysis`),customFilters:C(r()).optional().describe(`Additional token filter names to apply`)}).describe(`Text analyzer configuration for index tokenization and normalization`),wL=h({indexName:r().describe(`Name of the search index`),objectName:r().describe(`Source ObjectQL object`),fields:C(h({name:r().describe(`Field name to index`),type:E([`text`,`keyword`,`number`,`date`,`boolean`,`geo`]).describe(`Index field data type`),analyzer:r().optional().describe(`Named analyzer to use for this field`),searchable:S().default(!0).describe(`Include field in full-text search`),filterable:S().default(!1).describe(`Allow filtering on this field`),sortable:S().default(!1).describe(`Allow sorting by this field`),boost:P().default(1).describe(`Relevance boost factor for this field`)})).describe(`Fields to include in the search index`),replicas:P().default(1).describe(`Number of index replicas for availability`),shards:P().default(1).describe(`Number of index shards for distribution`)}).describe(`Search index definition mapping an ObjectQL object to a search engine index`),TL=h({field:r().describe(`Field name to generate facets from`),maxValues:P().default(10).describe(`Maximum number of facet values to return`),sort:E([`count`,`alpha`]).default(`count`).describe(`Facet value sort order`)}).describe(`Faceted search configuration for a single field`),qye=h({provider:SL.describe(`Search engine backend provider`),indexes:C(wL).describe(`Search index definitions`),analyzers:d(r(),CL).optional().describe(`Named text analyzer configurations`),facets:C(TL).optional().describe(`Faceted search configurations`),typoTolerance:S().default(!0).describe(`Enable typo-tolerant search`),synonyms:d(r(),C(r())).optional().describe(`Synonym mappings for search expansion`),ranking:C(E([`typo`,`geo`,`words`,`filters`,`proximity`,`attribute`,`exact`,`custom`])).optional().describe(`Custom ranking rule order`)}).describe(`Top-level full-text search engine configuration`),EL=h({port:P().int().min(1).max(65535).default(3e3).describe(`Port number to listen on`),host:r().default(`0.0.0.0`).describe(`Host address to bind to`),cors:IA.optional().describe(`CORS configuration`),requestTimeout:P().int().default(3e4).describe(`Request timeout in milliseconds`),bodyLimit:r().default(`10mb`).describe(`Maximum request body size`),compression:S().default(!0).describe(`Enable response compression`),security:h({helmet:S().default(!0).describe(`Enable security headers via helmet`),rateLimit:LA.optional().describe(`Global rate limiting configuration`)}).optional().describe(`Security configuration`),static:C(RA).optional().describe(`Static file serving configuration`),trustProxy:S().default(!1).describe(`Trust X-Forwarded-* headers`)}),Jye=h({method:NA.describe(`HTTP method`),path:r().describe(`URL path pattern`),handler:r().describe(`Handler identifier or name`),metadata:h({summary:r().optional().describe(`Route summary for documentation`),description:r().optional().describe(`Route description`),tags:C(r()).optional().describe(`Tags for grouping`),operationId:r().optional().describe(`Unique operation identifier`)}).optional(),security:h({authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:r().optional().describe(`Rate limit policy override`)}).optional()}),DL=E([`authentication`,`authorization`,`logging`,`validation`,`transformation`,`error`,`custom`]),OL=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Middleware name (snake_case)`),type:DL.describe(`Middleware type`),enabled:S().default(!0).describe(`Whether middleware is enabled`),order:P().int().default(100).describe(`Execution order priority`),config:d(r(),u()).optional().describe(`Middleware configuration object`),paths:h({include:C(r()).optional().describe(`Include path patterns (glob)`),exclude:C(r()).optional().describe(`Exclude path patterns (glob)`)}).optional().describe(`Path filtering`)}),kL=E([`starting`,`started`,`stopping`,`stopped`,`request`,`response`,`error`]),Yye=h({type:kL.describe(`Event type`),timestamp:r().datetime().describe(`Event timestamp (ISO 8601)`),data:d(r(),u()).optional().describe(`Event-specific data`)}),Xye=h({httpVersions:C(E([`1.0`,`1.1`,`2.0`,`3.0`])).default([`1.1`]).describe(`Supported HTTP versions`),websocket:S().default(!1).describe(`WebSocket support`),sse:S().default(!1).describe(`Server-Sent Events support`),serverPush:S().default(!1).describe(`HTTP/2 Server Push support`),streaming:S().default(!0).describe(`Response streaming support`),middleware:S().default(!0).describe(`Middleware chain support`),routeParams:S().default(!0).describe(`URL parameter support (/users/:id)`),compression:S().default(!0).describe(`Built-in compression support`)}),Zye=h({state:E([`stopped`,`starting`,`running`,`stopping`,`error`]).describe(`Current server state`),uptime:P().int().optional().describe(`Server uptime in milliseconds`),server:h({port:P().int().describe(`Listening port`),host:r().describe(`Bound host`),url:r().optional().describe(`Full server URL`)}).optional(),connections:h({active:P().int().describe(`Active connections`),total:P().int().describe(`Total connections handled`)}).optional(),requests:h({total:P().int().describe(`Total requests processed`),success:P().int().describe(`Successful requests`),errors:P().int().describe(`Failed requests`)}).optional()}),Qye=Object.assign(EL,{create:e=>e}),$ye=Object.assign(OL,{create:e=>e}),AL=E(`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(`,`)),jL=E([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ML=h({type:E([`user`,`system`,`service`,`api_client`,`integration`]).describe(`Actor type`),id:r().describe(`Actor identifier`),name:r().optional().describe(`Actor display name`),email:r().email().optional().describe(`Actor email address`),ipAddress:r().optional().describe(`Actor IP address`),userAgent:r().optional().describe(`User agent string`)}),NL=h({type:r().describe(`Target type`),id:r().describe(`Target identifier`),name:r().optional().describe(`Target display name`),metadata:d(r(),u()).optional().describe(`Target metadata`)}),PL=h({field:r().describe(`Changed field name`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`)}),ebe=h({id:r().describe(`Audit event ID`),eventType:AL.describe(`Event type`),severity:jL.default(`info`).describe(`Event severity`),timestamp:r().datetime().describe(`Event timestamp`),actor:ML.describe(`Event actor`),target:NL.optional().describe(`Event target`),description:r().describe(`Event description`),changes:C(PL).optional().describe(`List of changes`),result:E([`success`,`failure`,`partial`]).default(`success`).describe(`Action result`),errorMessage:r().optional().describe(`Error message`),tenantId:r().optional().describe(`Tenant identifier`),requestId:r().optional().describe(`Request ID for tracing`),metadata:d(r(),u()).optional().describe(`Additional metadata`),location:h({country:r().optional(),region:r().optional(),city:r().optional()}).optional().describe(`Geographic location`)}),FL=h({retentionDays:P().int().min(1).default(180).describe(`Retention period in days`),archiveAfterRetention:S().default(!0).describe(`Archive logs after retention period`),archiveStorage:h({type:E([`s3`,`gcs`,`azure_blob`,`filesystem`]).describe(`Archive storage type`),endpoint:r().optional().describe(`Storage endpoint URL`),bucket:r().optional().describe(`Storage bucket/container name`),path:r().optional().describe(`Storage path prefix`),credentials:d(r(),u()).optional().describe(`Storage credentials`)}).optional().describe(`Archive storage configuration`),customRetention:d(r(),P().int().positive()).optional().describe(`Custom retention by event type`),minimumRetentionDays:P().int().positive().optional().describe(`Minimum retention for compliance`)}),IL=h({id:r().describe(`Rule identifier`),name:r().describe(`Rule name`),description:r().optional().describe(`Rule description`),enabled:S().default(!0).describe(`Rule enabled status`),eventTypes:C(AL).describe(`Event types to monitor`),condition:h({threshold:P().int().positive().describe(`Event threshold`),windowSeconds:P().int().positive().describe(`Time window in seconds`),groupBy:C(r()).optional().describe(`Grouping criteria`),filters:d(r(),u()).optional().describe(`Additional filters`)}).describe(`Detection condition`),actions:C(E([`alert`,`lock_account`,`block_ip`,`require_mfa`,`log_critical`,`webhook`])).describe(`Actions to take`),alertSeverity:jL.default(`warning`).describe(`Alert severity`),notifications:h({email:C(r().email()).optional().describe(`Email recipients`),slack:r().url().optional().describe(`Slack webhook URL`),webhook:r().url().optional().describe(`Custom webhook URL`)}).optional().describe(`Notification configuration`)}),LL=h({type:E([`database`,`elasticsearch`,`mongodb`,`clickhouse`,`s3`,`gcs`,`azure_blob`,`custom`]).describe(`Storage backend type`),connectionString:r().optional().describe(`Connection string`),config:d(r(),u()).optional().describe(`Storage-specific configuration`),bufferEnabled:S().default(!0).describe(`Enable buffering`),bufferSize:P().int().positive().default(100).describe(`Buffer size`),flushIntervalSeconds:P().int().positive().default(5).describe(`Flush interval in seconds`),compression:S().default(!0).describe(`Enable compression`)}),tbe=h({eventTypes:C(AL).optional().describe(`Event types to include`),severities:C(jL).optional().describe(`Severity levels to include`),actorId:r().optional().describe(`Actor identifier`),tenantId:r().optional().describe(`Tenant identifier`),timeRange:h({from:r().datetime().describe(`Start time`),to:r().datetime().describe(`End time`)}).optional().describe(`Time range filter`),result:E([`success`,`failure`,`partial`]).optional().describe(`Result status`),searchQuery:r().optional().describe(`Search query`),customFilters:d(r(),u()).optional().describe(`Custom filters`)}),nbe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().default(!0).describe(`Enable audit logging`),eventTypes:C(AL).optional().describe(`Event types to audit`),excludeEventTypes:C(AL).optional().describe(`Event types to exclude`),minimumSeverity:jL.default(`info`).describe(`Minimum severity level`),storage:LL.describe(`Storage configuration`),retentionPolicy:FL.optional().describe(`Retention policy`),suspiciousActivityRules:C(IL).default([]).describe(`Suspicious activity rules`),includeSensitiveData:S().default(!1).describe(`Include sensitive data`),redactFields:C(r()).default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`]).describe(`Fields to redact`),logReads:S().default(!1).describe(`Log read operations`),readSamplingRate:P().min(0).max(1).default(.1).describe(`Read sampling rate`),logSystemEvents:S().default(!0).describe(`Log system events`),customHandlers:C(h({eventType:AL.describe(`Event type to handle`),handlerId:r().describe(`Unique identifier for the handler`)})).optional().describe(`Custom event handler references`),compliance:h({standards:C(E([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),immutableLogs:S().default(!0).describe(`Enforce immutable logs`),requireSigning:S().default(!1).describe(`Require log signing`),signingKey:r().optional().describe(`Signing key`)}).optional().describe(`Compliance configuration`)}),rbe=[{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`}],RL=E([`debug`,`info`,`warn`,`error`,`fatal`,`silent`]).describe(`Log severity level`),zL=E([`json`,`text`,`pretty`]).describe(`Log output format`),BL=h({name:r().optional().describe(`Logger name identifier`),level:RL.optional().default(`info`),format:zL.optional().default(`json`),redact:C(r()).optional().default([`password`,`token`,`secret`,`key`]).describe(`Keys to redact from log context`),sourceLocation:S().optional().default(!1).describe(`Include file and line number`),file:r().optional().describe(`Path to log file`),rotation:h({maxSize:r().optional().default(`10m`),maxFiles:P().optional().default(5)}).optional()}),ibe=h({timestamp:r().datetime().describe(`ISO 8601 timestamp`),level:RL,message:r().describe(`Log message`),context:d(r(),u()).optional().describe(`Structured context data`),error:d(r(),u()).optional().describe(`Error object if present`),traceId:r().optional().describe(`Distributed trace ID`),spanId:r().optional().describe(`Span ID`),service:r().optional().describe(`Service name`),component:r().optional().describe(`Component name (e.g. plugin id)`)}),VL=E([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]).describe(`Extended log severity level`),HL=E([`console`,`file`,`syslog`,`elasticsearch`,`cloudwatch`,`stackdriver`,`azure_monitor`,`datadog`,`splunk`,`loki`,`http`,`kafka`,`redis`,`custom`]).describe(`Log destination type`),UL=h({stream:E([`stdout`,`stderr`]).optional().default(`stdout`),colors:S().optional().default(!0),prettyPrint:S().optional().default(!1)}).describe(`Console destination configuration`),WL=h({path:r().describe(`Log file path`),rotation:h({maxSize:r().optional().default(`10m`),maxFiles:P().int().positive().optional().default(5),compress:S().optional().default(!0),interval:E([`hourly`,`daily`,`weekly`,`monthly`]).optional()}).optional(),encoding:r().optional().default(`utf8`),append:S().optional().default(!0)}).describe(`File destination configuration`),GL=h({url:r().url().describe(`HTTP endpoint URL`),method:E([`POST`,`PUT`]).optional().default(`POST`),headers:d(r(),r()).optional(),auth:h({type:E([`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional(),apiKeyHeader:r().optional().default(`X-API-Key`)}).optional(),batch:h({maxSize:P().int().positive().optional().default(100),flushInterval:P().int().positive().optional().default(5e3)}).optional(),retry:h({maxAttempts:P().int().positive().optional().default(3),initialDelay:P().int().positive().optional().default(1e3),backoffMultiplier:P().positive().optional().default(2)}).optional(),timeout:P().int().positive().optional().default(3e4)}).describe(`HTTP destination configuration`),KL=h({endpoint:r().url().optional(),region:r().optional(),credentials:h({accessKeyId:r().optional(),secretAccessKey:r().optional(),apiKey:r().optional(),projectId:r().optional()}).optional(),logGroup:r().optional(),logStream:r().optional(),index:r().optional(),config:d(r(),u()).optional()}).describe(`External service destination configuration`),qL=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Destination name (snake_case)`),type:HL.describe(`Destination type`),level:VL.optional().default(`info`),enabled:S().optional().default(!0),console:UL.optional(),file:WL.optional(),http:GL.optional(),externalService:KL.optional(),format:E([`json`,`text`,`pretty`]).optional().default(`json`),filterId:r().optional().describe(`Filter function identifier`)}).describe(`Log destination configuration`),JL=h({staticFields:d(r(),u()).optional().describe(`Static fields added to every log`),dynamicEnrichers:C(r()).optional().describe(`Dynamic enricher function IDs`),addHostname:S().optional().default(!0),addProcessId:S().optional().default(!0),addEnvironment:S().optional().default(!0),addTimestampFormats:h({unix:S().optional().default(!1),iso:S().optional().default(!0)}).optional(),addCaller:S().optional().default(!1),addCorrelationIds:S().optional().default(!0)}).describe(`Log enrichment configuration`),abe=h({timestamp:r().datetime().describe(`ISO 8601 timestamp`),level:VL.describe(`Log severity level`),message:r().describe(`Log message`),context:d(r(),u()).optional().describe(`Structured context`),error:h({name:r().optional(),message:r().optional(),stack:r().optional(),code:r().optional(),details:d(r(),u()).optional()}).optional().describe(`Error details`),trace:h({traceId:r().describe(`Trace ID`),spanId:r().describe(`Span ID`),parentSpanId:r().optional().describe(`Parent span ID`),traceFlags:P().int().optional().describe(`Trace flags`)}).optional().describe(`Distributed tracing context`),source:h({service:r().optional().describe(`Service name`),component:r().optional().describe(`Component name`),file:r().optional().describe(`Source file`),line:P().int().optional().describe(`Line number`),function:r().optional().describe(`Function name`)}).optional().describe(`Source information`),host:h({hostname:r().optional(),pid:P().int().optional(),ip:r().optional()}).optional().describe(`Host information`),environment:r().optional().describe(`Environment (e.g., production, staging)`),user:h({id:r().optional(),username:r().optional(),email:r().optional()}).optional().describe(`User context`),request:h({id:r().optional(),method:r().optional(),path:r().optional(),userAgent:r().optional(),ip:r().optional()}).optional().describe(`Request context`),labels:d(r(),r()).optional().describe(`Custom labels`),metadata:d(r(),u()).optional().describe(`Additional metadata`)}).describe(`Structured log entry`),obe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),level:VL.optional().default(`info`),default:BL.optional().describe(`Default logger configuration`),loggers:d(r(),BL).optional().describe(`Named logger configurations`),destinations:C(qL).describe(`Log destinations`),enrichment:JL.optional(),redact:C(r()).optional().default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`,`authorization`]).describe(`Fields to redact`),sampling:h({enabled:S().optional().default(!1),rate:P().min(0).max(1).optional().default(1),rateByLevel:d(r(),P().min(0).max(1)).optional()}).optional(),buffer:h({enabled:S().optional().default(!0),size:P().int().positive().optional().default(1e3),flushInterval:P().int().positive().optional().default(1e3),flushOnShutdown:S().optional().default(!0)}).optional(),performance:h({async:S().optional().default(!0),workers:P().int().positive().optional().default(1)}).optional()}).describe(`Logging configuration`),YL=E([`counter`,`gauge`,`histogram`,`summary`]).describe(`Metric type`),XL=E([`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`),ZL=E([`sum`,`avg`,`min`,`max`,`count`,`p50`,`p75`,`p90`,`p95`,`p99`,`p999`,`rate`,`stddev`]).describe(`Metric aggregation type`),QL=h({type:E([`linear`,`exponential`,`explicit`]).describe(`Bucket type`),linear:h({start:P().describe(`Start value`),width:P().positive().describe(`Bucket width`),count:P().int().positive().describe(`Number of buckets`)}).optional(),exponential:h({start:P().positive().describe(`Start value`),factor:P().positive().describe(`Growth factor`),count:P().int().positive().describe(`Number of buckets`)}).optional(),explicit:h({boundaries:C(P()).describe(`Bucket boundaries`)}).optional()}).describe(`Histogram bucket configuration`),$L=d(r(),r()).describe(`Metric labels`),eR=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Metric name (snake_case)`),label:r().optional().describe(`Display label`),type:YL.describe(`Metric type`),unit:XL.optional().describe(`Metric unit`),description:r().optional().describe(`Metric description`),labelNames:C(r()).optional().default([]).describe(`Label names`),histogram:QL.optional(),summary:h({quantiles:C(P().min(0).max(1)).optional().default([.5,.9,.99]),maxAge:P().int().positive().optional().default(600),ageBuckets:P().int().positive().optional().default(5)}).optional(),enabled:S().optional().default(!0)}).describe(`Metric definition`),sbe=h({name:r().describe(`Metric name`),type:YL.describe(`Metric type`),timestamp:r().datetime().describe(`Observation timestamp`),value:P().optional().describe(`Metric value`),labels:$L.optional().describe(`Metric labels`),histogram:h({count:P().int().nonnegative().describe(`Total count`),sum:P().describe(`Sum of all values`),buckets:C(h({upperBound:P().describe(`Upper bound of bucket`),count:P().int().nonnegative().describe(`Count in bucket`)})).describe(`Histogram buckets`)}).optional(),summary:h({count:P().int().nonnegative().describe(`Total count`),sum:P().describe(`Sum of all values`),quantiles:C(h({quantile:P().min(0).max(1).describe(`Quantile (0-1)`),value:P().describe(`Quantile value`)})).describe(`Summary quantiles`)}).optional()}).describe(`Metric data point`),tR=h({timestamp:r().datetime().describe(`Timestamp`),value:P().describe(`Value`),labels:d(r(),r()).optional().describe(`Labels`)}).describe(`Time series data point`),cbe=h({name:r().describe(`Series name`),labels:d(r(),r()).optional().describe(`Series labels`),dataPoints:C(tR).describe(`Data points`),startTime:r().datetime().optional().describe(`Start time`),endTime:r().datetime().optional().describe(`End time`)}).describe(`Time series`),nR=h({type:ZL.describe(`Aggregation type`),window:h({size:P().int().positive().describe(`Window size in seconds`),sliding:S().optional().default(!1),slideInterval:P().int().positive().optional()}).optional(),groupBy:C(r()).optional().describe(`Group by label names`),filters:d(r(),u()).optional().describe(`Filter criteria`)}).describe(`Metric aggregation configuration`),rR=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLI name (snake_case)`),label:r().describe(`Display label`),description:r().optional().describe(`SLI description`),metric:r().describe(`Base metric name`),type:E([`availability`,`latency`,`throughput`,`error_rate`,`saturation`,`custom`]).describe(`SLI type`),successCriteria:h({threshold:P().describe(`Threshold value`),operator:E([`lt`,`lte`,`gt`,`gte`,`eq`]).describe(`Comparison operator`),percentile:P().min(0).max(1).optional().describe(`Percentile (0-1)`)}).describe(`Success criteria`),window:h({size:P().int().positive().describe(`Window size in seconds`),rolling:S().optional().default(!0)}).describe(`Measurement window`),enabled:S().optional().default(!0)}).describe(`Service Level Indicator`),iR=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLO name (snake_case)`),label:r().describe(`Display label`),description:r().optional().describe(`SLO description`),sli:r().describe(`SLI name`),target:P().min(0).max(100).describe(`Target percentage`),period:h({type:E([`rolling`,`calendar`]).describe(`Period type`),duration:P().int().positive().optional().describe(`Duration in seconds`),calendar:E([`daily`,`weekly`,`monthly`,`quarterly`,`yearly`]).optional()}).describe(`Time period`),errorBudget:h({enabled:S().optional().default(!0),alertThreshold:P().min(0).max(100).optional().default(80),burnRateWindows:C(h({window:P().int().positive().describe(`Window size`),threshold:P().positive().describe(`Burn rate threshold`)})).optional()}).optional(),alerts:C(h({name:r().describe(`Alert name`),severity:E([`info`,`warning`,`critical`]).describe(`Alert severity`),condition:h({type:E([`slo_breach`,`error_budget`,`burn_rate`]).describe(`Condition type`),threshold:P().optional().describe(`Threshold value`)}).describe(`Alert condition`)})).optional().default([]),enabled:S().optional().default(!0)}).describe(`Service Level Objective`),aR=h({type:E([`prometheus`,`openmetrics`,`graphite`,`statsd`,`influxdb`,`datadog`,`cloudwatch`,`stackdriver`,`azure_monitor`,`http`,`custom`]).describe(`Export type`),endpoint:r().optional().describe(`Export endpoint`),interval:P().int().positive().optional().default(60),batch:h({enabled:S().optional().default(!0),size:P().int().positive().optional().default(1e3)}).optional(),auth:h({type:E([`none`,`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional()}).optional(),config:d(r(),u()).optional().describe(`Additional configuration`)}).describe(`Metric export configuration`),lbe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),metrics:C(eR).optional().default([]),defaultLabels:$L.optional().default({}),aggregations:C(nR).optional().default([]),slis:C(rR).optional().default([]),slos:C(iR).optional().default([]),exports:C(aR).optional().default([]),collectionInterval:P().int().positive().optional().default(15),retention:h({period:P().int().positive().optional().default(604800),downsampling:C(h({afterSeconds:P().int().positive().describe(`Downsample after seconds`),resolution:P().int().positive().describe(`Downsampled resolution`)})).optional()}).optional(),cardinalityLimits:h({maxLabelCombinations:P().int().positive().optional().default(1e4),onLimitExceeded:E([`drop`,`sample`,`alert`]).optional().default(`alert`)}).optional()}).describe(`Metrics configuration`),oR=h({entries:d(r(),r()).describe(`Trace state entries`)}).describe(`Trace state`),sR=P().int().min(0).max(255).describe(`Trace flags bitmap`),cR=h({traceId:r().regex(/^[0-9a-f]{32}$/).describe(`Trace ID (32 hex chars)`),spanId:r().regex(/^[0-9a-f]{16}$/).describe(`Span ID (16 hex chars)`),traceFlags:sR.optional().default(1),traceState:oR.optional(),parentSpanId:r().regex(/^[0-9a-f]{16}$/).optional().describe(`Parent span ID (16 hex chars)`),sampled:S().optional().default(!0),remote:S().optional().default(!1)}).describe(`Trace context (W3C Trace Context)`),lR=E([`internal`,`server`,`client`,`producer`,`consumer`]).describe(`Span kind`),uR=E([`unset`,`ok`,`error`]).describe(`Span status`),dR=l([r(),P(),S(),C(r()),C(P()),C(S())]).describe(`Span attribute value`),fR=d(r(),dR).describe(`Span attributes`),pR=h({name:r().describe(`Event name`),timestamp:r().datetime().describe(`Event timestamp`),attributes:fR.optional().describe(`Event attributes`)}).describe(`Span event`),mR=h({context:cR.describe(`Linked trace context`),attributes:fR.optional().describe(`Link attributes`)}).describe(`Span link`),ube=h({context:cR.describe(`Trace context`),name:r().describe(`Span name`),kind:lR.optional().default(`internal`),startTime:r().datetime().describe(`Span start time`),endTime:r().datetime().optional().describe(`Span end time`),duration:P().nonnegative().optional().describe(`Duration in milliseconds`),status:h({code:uR.describe(`Status code`),message:r().optional().describe(`Status message`)}).optional(),attributes:fR.optional().default({}),events:C(pR).optional().default([]),links:C(mR).optional().default([]),resource:fR.optional().describe(`Resource attributes`),instrumentationLibrary:h({name:r().describe(`Library name`),version:r().optional().describe(`Library version`)}).optional()}).describe(`OpenTelemetry span`),hR=E([`drop`,`record_only`,`record_and_sample`]).describe(`Sampling decision`),gR=E([`always_on`,`always_off`,`trace_id_ratio`,`rate_limiting`,`parent_based`,`probability`,`composite`,`custom`]).describe(`Sampling strategy type`),_R=h({type:gR.describe(`Sampling strategy`),ratio:P().min(0).max(1).optional().describe(`Sample ratio (0-1)`),rateLimit:P().positive().optional().describe(`Traces per second`),parentBased:h({whenParentSampled:gR.optional().default(`always_on`),whenParentNotSampled:gR.optional().default(`always_off`),root:gR.optional().default(`trace_id_ratio`),rootRatio:P().min(0).max(1).optional().default(.1)}).optional(),composite:C(h({strategy:gR.describe(`Strategy type`),ratio:P().min(0).max(1).optional(),condition:d(r(),u()).optional().describe(`Condition for this strategy`)})).optional(),rules:C(h({name:r().describe(`Rule name`),match:h({service:r().optional(),spanName:r().optional(),attributes:d(r(),u()).optional()}).optional(),decision:hR.describe(`Sampling decision`),rate:P().min(0).max(1).optional()})).optional().default([]),customSamplerId:r().optional().describe(`Custom sampler identifier`)}).describe(`Trace sampling configuration`),vR=E([`w3c`,`b3`,`b3_multi`,`jaeger`,`xray`,`ottrace`,`custom`]).describe(`Trace propagation format`),yR=h({formats:C(vR).optional().default([`w3c`]),extract:S().optional().default(!0),inject:S().optional().default(!0),headers:h({traceId:r().optional(),spanId:r().optional(),traceFlags:r().optional(),traceState:r().optional()}).optional(),baggage:h({enabled:S().optional().default(!0),maxSize:P().int().positive().optional().default(8192),allowedKeys:C(r()).optional()}).optional()}).describe(`Trace context propagation`),bR=E([`otlp_http`,`otlp_grpc`,`jaeger`,`zipkin`,`console`,`datadog`,`honeycomb`,`lightstep`,`newrelic`,`custom`]).describe(`OpenTelemetry exporter type`),xR=h({sdkVersion:r().optional().describe(`OTel SDK version`),exporter:h({type:bR.describe(`Exporter type`),endpoint:r().url().optional().describe(`Exporter endpoint`),protocol:r().optional().describe(`Protocol version`),headers:d(r(),r()).optional().describe(`HTTP headers`),timeout:P().int().positive().optional().default(1e4),compression:E([`none`,`gzip`]).optional().default(`none`),batch:h({maxBatchSize:P().int().positive().optional().default(512),maxQueueSize:P().int().positive().optional().default(2048),exportTimeout:P().int().positive().optional().default(3e4),scheduledDelay:P().int().positive().optional().default(5e3)}).optional()}).describe(`Exporter configuration`),resource:h({serviceName:r().describe(`Service name`),serviceVersion:r().optional().describe(`Service version`),serviceInstanceId:r().optional().describe(`Service instance ID`),serviceNamespace:r().optional().describe(`Service namespace`),deploymentEnvironment:r().optional().describe(`Deployment environment`),attributes:fR.optional().describe(`Additional resource attributes`)}).describe(`Resource attributes`),instrumentation:h({autoInstrumentation:S().optional().default(!0),libraries:C(r()).optional().describe(`Enabled libraries`),disabledLibraries:C(r()).optional().describe(`Disabled libraries`)}).optional(),semanticConventionsVersion:r().optional().describe(`Semantic conventions version`)}).describe(`OpenTelemetry compatibility configuration`),dbe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),sampling:_R.optional().default({type:`always_on`,rules:[]}),propagation:yR.optional().default({formats:[`w3c`],extract:!0,inject:!0}),openTelemetry:xR.optional(),spanLimits:h({maxAttributes:P().int().positive().optional().default(128),maxEvents:P().int().positive().optional().default(128),maxLinks:P().int().positive().optional().default(128),maxAttributeValueLength:P().int().positive().optional().default(4096)}).optional(),traceIdGenerator:E([`random`,`uuid`,`custom`]).optional().default(`random`),customTraceIdGeneratorId:r().optional().describe(`Custom generator identifier`),performance:h({asyncExport:S().optional().default(!0),exportInterval:P().int().positive().optional().default(5e3)}).optional()}).describe(`Tracing configuration`),SR=E([`pii`,`phi`,`pci`,`financial`,`confidential`,`internal`,`public`]).describe(`Data classification level`),CR=E([`gdpr`,`hipaa`,`sox`,`pci_dss`,`ccpa`,`iso27001`]).describe(`Compliance framework identifier`),wR=h({framework:CR.describe(`Compliance framework identifier`),requiredEvents:C(r()).describe(`Audit event types required by this framework (e.g., "data.delete", "auth.login")`),retentionDays:P().min(1).describe(`Minimum audit log retention period required by this framework (in days)`),alertOnMissing:S().default(!0).describe(`Raise alert if a required audit event is not being captured`)}).describe(`Compliance framework audit event requirements`),TR=h({framework:CR.describe(`Compliance framework identifier`),dataClassifications:C(SR).describe(`Data classifications that must be encrypted under this framework`),minimumAlgorithm:E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).default(`aes-256-gcm`).describe(`Minimum encryption algorithm strength required`),keyRotationMaxDays:P().min(1).default(90).describe(`Maximum key rotation interval required (in days)`)}).describe(`Compliance framework encryption requirements`),ER=h({dataClassification:SR.describe(`Data classification this rule applies to`),defaultMasked:S().default(!0).describe(`Whether data is masked by default`),unmaskRoles:C(r()).optional().describe(`Roles allowed to view unmasked data`),auditUnmask:S().default(!0).describe(`Log an audit event when data is unmasked`),requireApproval:S().default(!1).describe(`Require explicit approval before unmasking`),approvalRoles:C(r()).optional().describe(`Roles that can approve unmasking requests`)}).describe(`Masking visibility and audit rule per data classification`),DR=h({enabled:S().default(!0).describe(`Enable cross-subsystem security event correlation`),correlationId:S().default(!0).describe(`Inject a shared correlation ID into audit, encryption, and masking events`),linkAuthToAudit:S().default(!0).describe(`Link authentication events to subsequent data operation audit trails`),linkEncryptionToAudit:S().default(!0).describe(`Log encryption/decryption operations in the audit trail`),linkMaskingToAudit:S().default(!0).describe(`Log masking/unmasking operations in the audit trail`)}).describe(`Cross-subsystem security event correlation configuration`),OR=h({classification:SR.describe(`Data classification level`),requireEncryption:S().default(!1).describe(`Encryption required for this classification`),requireMasking:S().default(!1).describe(`Masking required for this classification`),requireAudit:S().default(!1).describe(`Audit trail required for access to this classification`),retentionDays:P().optional().describe(`Data retention limit in days (for compliance)`)}).describe(`Security policy for a specific data classification level`),fbe=h({enabled:S().default(!0).describe(`Enable unified security context governance`),complianceAuditRequirements:C(wR).optional().describe(`Compliance-driven audit event requirements`),complianceEncryptionRequirements:C(TR).optional().describe(`Compliance-driven encryption requirements by data classification`),maskingVisibility:C(ER).optional().describe(`Masking visibility rules per data classification`),dataClassifications:C(OR).optional().describe(`Data classification policies for unified security enforcement`),eventCorrelation:DR.optional().describe(`Cross-subsystem security event correlation settings`),enforceOnWrite:S().default(!0).describe(`Enforce encryption and masking requirements on data write operations`),enforceOnRead:S().default(!0).describe(`Enforce masking and audit requirements on data read operations`),failOpen:S().default(!1).describe(`When false (default), deny access if security context cannot be evaluated`)}).describe(`Unified security context governance configuration`),kR=E([`standard`,`normal`,`emergency`,`major`]),AR=E([`critical`,`high`,`medium`,`low`]),jR=E([`draft`,`submitted`,`in-review`,`approved`,`scheduled`,`in-progress`,`completed`,`failed`,`rolled-back`,`cancelled`]),MR=h({level:E([`low`,`medium`,`high`,`critical`]).describe(`Impact level`),affectedSystems:C(r()).describe(`Affected systems`),affectedUsers:P().optional().describe(`Affected user count`),downtime:h({required:S().describe(`Downtime required`),durationMinutes:P().optional().describe(`Downtime duration`)}).optional().describe(`Downtime information`)}),NR=h({description:r().describe(`Rollback description`),steps:C(h({order:P().describe(`Step order`),description:r().describe(`Step description`),estimatedMinutes:P().describe(`Estimated duration`)})).describe(`Rollback steps`),testProcedure:r().optional().describe(`Test procedure`)}),pbe=h({id:r().describe(`Change request ID`),title:r().describe(`Change title`),description:r().describe(`Change description`),type:kR.describe(`Change type`),priority:AR.describe(`Change priority`),status:jR.describe(`Change status`),requestedBy:r().describe(`Requester user ID`),requestedAt:P().describe(`Request timestamp`),impact:MR.describe(`Impact assessment`),implementation:h({description:r().describe(`Implementation description`),steps:C(h({order:P().describe(`Step order`),description:r().describe(`Step description`),estimatedMinutes:P().describe(`Estimated duration`)})).describe(`Implementation steps`),testing:r().optional().describe(`Testing procedure`)}).describe(`Implementation plan`),rollbackPlan:NR.describe(`Rollback plan`),schedule:h({plannedStart:P().describe(`Planned start time`),plannedEnd:P().describe(`Planned end time`),actualStart:P().optional().describe(`Actual start time`),actualEnd:P().optional().describe(`Actual end time`)}).optional().describe(`Schedule`),securityImpact:h({assessed:S().describe(`Whether security impact has been assessed`),riskLevel:E([`none`,`low`,`medium`,`high`,`critical`]).optional().describe(`Security risk level`),affectedDataClassifications:C(SR).optional().describe(`Affected data classifications`),requiresSecurityApproval:S().default(!1).describe(`Whether security team approval is required`),reviewedBy:r().optional().describe(`Security reviewer user ID`),reviewedAt:P().optional().describe(`Security review timestamp`),reviewNotes:r().optional().describe(`Security review notes or conditions`)}).optional().describe(`Security impact assessment per ISO 27001:2022 A.8.32`),approval:h({required:S().describe(`Approval required`),approvers:C(h({userId:r().describe(`Approver user ID`),approvedAt:P().optional().describe(`Approval timestamp`),comments:r().optional().describe(`Approver comments`)})).describe(`Approvers`)}).optional().describe(`Approval workflow`),attachments:C(h({name:r().describe(`Attachment name`),url:r().url().describe(`Attachment URL`)})).optional().describe(`Attachments`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs for extensibility`)}),PR=h({type:m(`add_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to add`),field:nj.describe(`Full field definition to add`)}).describe(`Add a new field to an existing object`),FR=h({type:m(`modify_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to modify`),changes:d(r(),u()).describe(`Partial field definition updates`)}).describe(`Modify properties of an existing field`),IR=h({type:m(`remove_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to remove`)}).describe(`Remove a field from an existing object`),LR=h({type:m(`create_object`),object:gM.describe(`Full object definition to create`)}).describe(`Create a new object`),RR=h({type:m(`rename_object`),oldName:r().describe(`Current object name`),newName:r().describe(`New object name`)}).describe(`Rename an existing object`),zR=h({type:m(`delete_object`),objectName:r().describe(`Name of the object to delete`)}).describe(`Delete an existing object`),BR=h({type:m(`execute_sql`),sql:r().describe(`Raw SQL statement to execute`),description:r().optional().describe(`Human-readable description of the SQL`)}).describe(`Execute a raw SQL statement`),VR=I(`type`,[PR,FR,IR,LR,RR,zR,BR]),HR=h({migrationId:r().describe(`ID of the migration this depends on`),package:r().optional().describe(`Package that owns the dependency migration`)}).describe(`Dependency reference to another migration that must run first`),UR=h({id:r().uuid().describe(`Unique identifier for this change set`),name:r().describe(`Human readable name for the migration`),description:r().optional().describe(`Detailed description of what this migration does`),author:r().optional().describe(`Author who created this migration`),createdAt:r().datetime().optional().describe(`ISO 8601 timestamp when the migration was created`),dependencies:C(HR).optional().describe(`Migrations that must run before this one`),operations:C(VR).describe(`Ordered list of atomic migration operations`),rollback:C(VR).optional().describe(`Operations to reverse this migration`)}).describe(`A versioned set of atomic schema migration operations`),WR=h({id:r().describe(`Provider ID (github, google)`),clientId:r().describe(`OAuth Client ID`),clientSecret:r().describe(`OAuth Client Secret`),scope:C(r()).optional().describe(`Requested permissions`)}),GR=h({organization:S().default(!1).describe(`Enable Organization/Teams support`),twoFactor:S().default(!1).describe(`Enable 2FA`),passkeys:S().default(!1).describe(`Enable Passkey support`),magicLink:S().default(!1).describe(`Enable Magic Link login`)}),KR=h({enabled:S().default(!1).describe(`Enable mutual TLS authentication`),clientCertRequired:S().default(!1).describe(`Require client certificates for all connections`),trustedCAs:C(r()).describe(`PEM-encoded CA certificates or file paths`),crlUrl:r().optional().describe(`Certificate Revocation List (CRL) URL`),ocspUrl:r().optional().describe(`Online Certificate Status Protocol (OCSP) URL`),certificateValidation:E([`strict`,`relaxed`,`none`]).describe(`Certificate validation strictness level`),allowedCNs:C(r()).optional().describe(`Allowed Common Names (CN) on client certificates`),allowedOUs:C(r()).optional().describe(`Allowed Organizational Units (OU) on client certificates`),pinning:h({enabled:S().describe(`Enable certificate pinning`),pins:C(r()).describe(`Pinned certificate hashes`)}).optional().describe(`Certificate pinning configuration`)}),qR=d(r(),h({clientId:r().describe(`OAuth Client ID`),clientSecret:r().describe(`OAuth Client Secret`),enabled:S().optional().default(!0).describe(`Enable this provider`),scope:C(r()).optional().describe(`Additional OAuth scopes`)}).catchall(u())).optional().describe(`Social/OAuth provider map forwarded to better-auth socialProviders. Keys are provider ids (google, github, apple, …).`),JR=h({enabled:S().default(!0).describe(`Enable email/password auth`),disableSignUp:S().optional().describe(`Disable new user registration via email/password`),requireEmailVerification:S().optional().describe(`Require email verification before creating a session`),minPasswordLength:P().optional().describe(`Minimum password length (default 8)`),maxPasswordLength:P().optional().describe(`Maximum password length (default 128)`),resetPasswordTokenExpiresIn:P().optional().describe(`Reset-password token TTL in seconds (default 3600)`),autoSignIn:S().optional().describe(`Auto sign-in after sign-up (default true)`),revokeSessionsOnPasswordReset:S().optional().describe(`Revoke all other sessions on password reset`)}).optional().describe(`Email and password authentication options forwarded to better-auth`),YR=h({sendOnSignUp:S().optional().describe(`Automatically send verification email after sign-up`),sendOnSignIn:S().optional().describe(`Send verification email on sign-in when not yet verified`),autoSignInAfterVerification:S().optional().describe(`Auto sign-in the user after email verification`),expiresIn:P().optional().describe(`Verification token TTL in seconds (default 3600)`)}).optional().describe(`Email verification options forwarded to better-auth`),XR=h({crossSubDomainCookies:h({enabled:S().describe(`Enable cross-subdomain cookies`),additionalCookies:C(r()).optional().describe(`Extra cookies shared across subdomains`),domain:r().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:S().optional().describe(`Force Secure flag on cookies`),disableCSRFCheck:S().optional().describe(`⚠ Disable CSRF check — security risk, use with caution`),cookiePrefix:r().optional().describe(`Prefix for auth cookie names`)}).optional().describe(`Advanced / low-level Better-Auth options`),mbe=h({secret:r().optional().describe(`Encryption secret`),baseUrl:r().optional().describe(`Base URL for auth routes`),databaseUrl:r().optional().describe(`Database connection string`),providers:C(WR).optional(),plugins:GR.optional(),session:h({expiresIn:P().default(3600*24*7).describe(`Session duration in seconds`),updateAge:P().default(3600*24).describe(`Session update frequency`)}).optional(),trustedOrigins:C(r()).optional().describe(`Trusted origins for CSRF protection. Supports wildcards (e.g. "https://*.example.com"). The baseUrl origin is always trusted implicitly.`),socialProviders:qR,emailAndPassword:JR,emailVerification:YR,advanced:XR,mutualTls:KR.optional().describe(`Mutual TLS (mTLS) configuration`)}).catchall(u()),ZR=h({enabled:S().describe(`Enable GDPR compliance controls`),dataSubjectRights:h({rightToAccess:S().default(!0).describe(`Allow data subjects to access their data`),rightToRectification:S().default(!0).describe(`Allow data subjects to correct their data`),rightToErasure:S().default(!0).describe(`Allow data subjects to request deletion`),rightToRestriction:S().default(!0).describe(`Allow data subjects to restrict processing`),rightToPortability:S().default(!0).describe(`Allow data subjects to export their data`),rightToObjection:S().default(!0).describe(`Allow data subjects to object to processing`)}).describe(`Data subject rights configuration per GDPR Articles 15-21`),legalBasis:E([`consent`,`contract`,`legal-obligation`,`vital-interests`,`public-task`,`legitimate-interests`]).describe(`Legal basis for data processing under GDPR Article 6`),consentTracking:S().default(!0).describe(`Track and record user consent`),dataRetentionDays:P().optional().describe(`Maximum data retention period in days`),dataProcessingAgreement:r().optional().describe(`URL or reference to the data processing agreement`)}).describe(`GDPR (General Data Protection Regulation) compliance configuration`),QR=h({enabled:S().describe(`Enable HIPAA compliance controls`),phi:h({encryption:S().default(!0).describe(`Encrypt Protected Health Information at rest`),accessControl:S().default(!0).describe(`Enforce role-based access to PHI`),auditTrail:S().default(!0).describe(`Log all PHI access events`),backupAndRecovery:S().default(!0).describe(`Enable PHI backup and disaster recovery`)}).describe(`Protected Health Information safeguards`),businessAssociateAgreement:S().default(!1).describe(`BAA is in place with third-party processors`)}).describe(`HIPAA (Health Insurance Portability and Accountability Act) compliance configuration`),$R=h({enabled:S().describe(`Enable PCI-DSS compliance controls`),level:E([`1`,`2`,`3`,`4`]).describe(`PCI-DSS compliance level (1 = highest)`),cardDataFields:C(r()).describe(`Field names containing cardholder data`),tokenization:S().default(!0).describe(`Replace card data with secure tokens`),encryptionInTransit:S().default(!0).describe(`Encrypt cardholder data during transmission`),encryptionAtRest:S().default(!0).describe(`Encrypt stored cardholder data`)}).describe(`PCI-DSS (Payment Card Industry Data Security Standard) compliance configuration`),ez=h({enabled:S().default(!0).describe(`Enable audit logging`),retentionDays:P().default(365).describe(`Number of days to retain audit logs`),immutable:S().default(!0).describe(`Prevent modification or deletion of audit logs`),signLogs:S().default(!1).describe(`Cryptographically sign log entries for tamper detection`),events:C(E([`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`),tz=E([`critical`,`major`,`minor`,`observation`]),nz=E([`open`,`in_remediation`,`remediated`,`verified`,`accepted_risk`,`closed`]),rz=h({id:r().describe(`Unique finding identifier`),title:r().describe(`Finding title`),description:r().describe(`Finding description`),severity:tz.describe(`Finding severity`),status:nz.describe(`Finding status`),controlReference:r().optional().describe(`ISO 27001 control reference`),framework:CR.optional().describe(`Related compliance framework`),identifiedAt:P().describe(`Identification timestamp`),identifiedBy:r().describe(`Identifier (auditor name or system)`),remediationPlan:r().optional().describe(`Remediation plan`),remediationDeadline:P().optional().describe(`Remediation deadline timestamp`),verifiedAt:P().optional().describe(`Verification timestamp`),verifiedBy:r().optional().describe(`Verifier name or role`),notes:r().optional().describe(`Additional notes`)}).describe(`Audit finding with remediation tracking per ISO 27001:2022 A.5.35`),iz=h({id:r().describe(`Unique audit schedule identifier`),title:r().describe(`Audit title`),scope:C(r()).describe(`Audit scope areas`),framework:CR.describe(`Target compliance framework`),scheduledAt:P().describe(`Scheduled audit timestamp`),completedAt:P().optional().describe(`Completion timestamp`),assessor:r().describe(`Assessor or audit team`),isExternal:S().default(!1).describe(`Whether this is an external audit`),recurrenceMonths:P().default(0).describe(`Recurrence interval in months (0 = one-time)`),findings:C(rz).optional().describe(`Audit findings`)}).describe(`Audit schedule for independent security reviews per ISO 27001:2022 A.5.35`),hbe=h({gdpr:ZR.optional().describe(`GDPR compliance settings`),hipaa:QR.optional().describe(`HIPAA compliance settings`),pciDss:$R.optional().describe(`PCI-DSS compliance settings`),auditLog:ez.describe(`Audit log configuration`),auditSchedules:C(iz).optional().describe(`Scheduled compliance audits (A.5.35)`)}).describe(`Unified compliance configuration spanning GDPR, HIPAA, PCI-DSS, and audit governance`),az=E([`critical`,`high`,`medium`,`low`]),oz=E([`data_breach`,`malware`,`unauthorized_access`,`denial_of_service`,`social_engineering`,`insider_threat`,`physical_security`,`configuration_error`,`vulnerability_exploit`,`policy_violation`,`other`]),sz=E([`reported`,`triaged`,`investigating`,`containing`,`eradicating`,`recovering`,`resolved`,`closed`]),cz=h({phase:E([`identification`,`containment`,`eradication`,`recovery`,`lessons_learned`]).describe(`Response phase name`),description:r().describe(`Phase description and objectives`),assignedTo:r().describe(`Responsible team or role`),targetHours:P().min(0).describe(`Target completion time in hours`),completedAt:P().optional().describe(`Actual completion timestamp`),notes:r().optional().describe(`Phase notes and findings`)}).describe(`Incident response phase with timing and assignment`),lz=h({severity:az.describe(`Minimum severity to trigger notification`),channels:C(E([`email`,`sms`,`slack`,`pagerduty`,`webhook`])).describe(`Notification channels`),recipients:C(r()).describe(`Roles or teams to notify`),withinMinutes:P().min(1).describe(`Notification deadline in minutes from detection`),notifyRegulators:S().default(!1).describe(`Whether to notify regulatory authorities`),regulatorDeadlineHours:P().optional().describe(`Regulatory notification deadline in hours`)}).describe(`Incident notification rule per severity level`),uz=h({rules:C(lz).describe(`Notification rules by severity level`),escalationTimeoutMinutes:P().default(30).describe(`Auto-escalation timeout in minutes`),escalationChain:C(r()).default([]).describe(`Ordered escalation chain of roles`)}).describe(`Incident notification matrix with escalation policies`),gbe=h({id:r().describe(`Unique incident identifier`),title:r().describe(`Incident title`),description:r().describe(`Detailed incident description`),severity:az.describe(`Incident severity level`),category:oz.describe(`Incident category`),status:sz.describe(`Current incident status`),reportedBy:r().describe(`Reporter user ID or system name`),reportedAt:P().describe(`Report timestamp`),detectedAt:P().optional().describe(`Detection timestamp`),resolvedAt:P().optional().describe(`Resolution timestamp`),affectedSystems:C(r()).describe(`Affected systems`),affectedDataClassifications:C(SR).optional().describe(`Affected data classifications`),responsePhases:C(cz).optional().describe(`Incident response phases`),rootCause:r().optional().describe(`Root cause analysis`),correctiveActions:C(r()).optional().describe(`Corrective actions taken or planned`),lessonsLearned:r().optional().describe(`Lessons learned from the incident`),relatedChangeRequestIds:C(r()).optional().describe(`Related change request IDs`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Security incident record per ISO 27001:2022 A.5.24–A.5.28`),_be=h({enabled:S().default(!0).describe(`Enable incident response management`),notificationMatrix:uz.describe(`Notification and escalation matrix`),defaultResponseTeam:r().describe(`Default incident response team or role`),triageDeadlineHours:P().default(1).describe(`Maximum hours to begin triage after detection`),requirePostIncidentReview:S().default(!0).describe(`Require post-incident review for all incidents`),regulatoryNotificationThreshold:az.default(`high`).describe(`Minimum severity requiring regulatory notification`),retentionDays:P().default(2555).describe(`Incident record retention period in days (default ~7 years)`)}).describe(`Organization-level incident response policy per ISO 27001:2022`),dz=E([`critical`,`high`,`medium`,`low`]),fz=E([`pending`,`in_progress`,`completed`,`expired`,`failed`]),pz=h({id:r().describe(`Requirement identifier`),description:r().describe(`Requirement description`),controlReference:r().optional().describe(`ISO 27001 control reference`),mandatory:S().default(!0).describe(`Whether this requirement is mandatory`),compliant:S().optional().describe(`Whether the supplier meets this requirement`),evidence:r().optional().describe(`Compliance evidence or assessment notes`)}).describe(`Individual supplier security requirement`),vbe=h({supplierId:r().describe(`Unique supplier identifier`),supplierName:r().describe(`Supplier display name`),riskLevel:dz.describe(`Supplier risk classification`),status:fz.describe(`Assessment status`),assessedBy:r().describe(`Assessor user ID or team`),assessedAt:P().describe(`Assessment timestamp`),validUntil:P().describe(`Assessment validity expiry timestamp`),requirements:C(pz).describe(`Security requirements and their compliance status`),overallCompliant:S().describe(`Whether supplier meets all mandatory requirements`),dataClassificationsShared:C(SR).optional().describe(`Data classifications shared with supplier`),servicesProvided:C(r()).optional().describe(`Services provided by this supplier`),certifications:C(r()).optional().describe(`Supplier certifications (e.g., ISO 27001, SOC 2)`),remediationItems:C(h({requirementId:r().describe(`Non-compliant requirement ID`),action:r().describe(`Required remediation action`),deadline:P().describe(`Remediation deadline timestamp`),status:E([`pending`,`in_progress`,`completed`]).default(`pending`).describe(`Remediation status`)})).optional().describe(`Remediation items for non-compliant requirements`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Supplier security assessment record per ISO 27001:2022 A.5.19–A.5.21`),ybe=h({enabled:S().default(!0).describe(`Enable supplier security management`),reassessmentIntervalDays:P().default(365).describe(`Supplier reassessment interval in days`),requirePreOnboardingAssessment:S().default(!0).describe(`Require security assessment before supplier onboarding`),formalAssessmentThreshold:dz.default(`medium`).describe(`Minimum risk level requiring formal assessment`),monitorChanges:S().default(!0).describe(`Monitor supplier security posture changes`),requiredCertifications:C(r()).default([]).describe(`Required certifications for critical-risk suppliers`)}).describe(`Organization-level supplier security management policy per ISO 27001:2022`),mz=E([`security_awareness`,`data_protection`,`incident_response`,`access_control`,`phishing_awareness`,`compliance`,`secure_development`,`physical_security`,`business_continuity`,`other`]),hz=E([`not_started`,`in_progress`,`completed`,`failed`,`expired`]),gz=h({id:r().describe(`Unique course identifier`),title:r().describe(`Course title`),description:r().describe(`Course description and learning objectives`),category:mz.describe(`Training category`),durationMinutes:P().min(1).describe(`Estimated course duration in minutes`),mandatory:S().default(!1).describe(`Whether training is mandatory`),targetRoles:C(r()).describe(`Target roles or groups`),validityDays:P().optional().describe(`Certification validity period in days`),passingScore:P().min(0).max(100).optional().describe(`Minimum passing score percentage`),version:r().optional().describe(`Course content version`)}).describe(`Security training course definition`),bbe=h({courseId:r().describe(`Training course identifier`),userId:r().describe(`User identifier`),status:hz.describe(`Training completion status`),assignedAt:P().describe(`Assignment timestamp`),completedAt:P().optional().describe(`Completion timestamp`),score:P().min(0).max(100).optional().describe(`Assessment score percentage`),expiresAt:P().optional().describe(`Certification expiry timestamp`),notes:r().optional().describe(`Training notes or comments`)}).describe(`Individual training completion record`),xbe=h({enabled:S().default(!0).describe(`Enable training management`),courses:C(gz).describe(`Training courses`),recertificationIntervalDays:P().default(365).describe(`Default recertification interval in days`),trackCompletion:S().default(!0).describe(`Track training completion for compliance`),gracePeriodDays:P().default(30).describe(`Grace period in days after certification expiry`),sendReminders:S().default(!0).describe(`Send reminders for upcoming training deadlines`),reminderDaysBefore:P().default(14).describe(`Days before deadline to send first reminder`)}).describe(`Organizational training plan per ISO 27001:2022 A.6.3`),_z=h({type:m(`cron`),expression:r().describe(`Cron expression (e.g., "0 0 * * *" for daily at midnight)`),timezone:r().optional().default(`UTC`).describe(`Timezone for cron execution (e.g., "America/New_York")`)}),vz=h({type:m(`interval`),intervalMs:P().int().positive().describe(`Interval in milliseconds`)}),yz=h({type:m(`once`),at:r().datetime().describe(`ISO 8601 datetime when to execute`)}),bz=I(`type`,[_z,vz,yz]),xz=h({maxRetries:P().int().min(0).default(3).describe(`Maximum number of retry attempts`),backoffMs:P().int().positive().default(1e3).describe(`Initial backoff delay in milliseconds`),backoffMultiplier:P().positive().default(2).describe(`Multiplier for exponential backoff`)}),Sbe=h({id:r().describe(`Unique job identifier`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Job name (snake_case)`),schedule:bz.describe(`Job schedule configuration`),handler:r().describe(`Handler path (e.g. "path/to/file:functionName") or script ID`),retryPolicy:xz.optional().describe(`Retry policy configuration`),timeout:P().int().positive().optional().describe(`Timeout in milliseconds`),enabled:S().default(!0).describe(`Whether the job is enabled`)}),Sz=E([`running`,`success`,`failed`,`timeout`]),Cbe=h({jobId:r().describe(`Job identifier`),startedAt:r().datetime().describe(`ISO 8601 datetime when execution started`),completedAt:r().datetime().optional().describe(`ISO 8601 datetime when execution completed`),status:Sz.describe(`Execution status`),error:r().optional().describe(`Error message if failed`),duration:P().int().optional().describe(`Execution duration in milliseconds`)}),Cz=E([`critical`,`high`,`normal`,`low`,`background`]),wbe={critical:0,high:1,normal:2,low:3,background:4},wz=E([`pending`,`queued`,`processing`,`completed`,`failed`,`cancelled`,`timeout`,`dead`]),Tz=h({maxRetries:P().int().min(0).default(3).describe(`Maximum retry attempts`),backoffStrategy:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy between retries`),initialDelayMs:P().int().positive().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().int().positive().default(6e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:P().positive().default(2).describe(`Multiplier for exponential backoff`)}),Ez=h({id:r().describe(`Unique task identifier`),type:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),payload:u().describe(`Task payload data`),queue:r().default(`default`).describe(`Queue name`),priority:Cz.default(`normal`).describe(`Task priority level`),retryPolicy:Tz.optional().describe(`Retry policy configuration`),timeoutMs:P().int().positive().optional().describe(`Task timeout in milliseconds`),scheduledAt:r().datetime().optional().describe(`ISO 8601 datetime to execute task`),attempts:P().int().min(0).default(0).describe(`Number of execution attempts`),status:wz.default(`pending`).describe(`Current task status`),metadata:h({createdAt:r().datetime().optional().describe(`When task was created`),updatedAt:r().datetime().optional().describe(`Last update time`),createdBy:r().optional().describe(`User who created task`),tags:C(r()).optional().describe(`Task tags for filtering`)}).optional().describe(`Task metadata`)}),Tbe=h({taskId:r().describe(`Task identifier`),status:wz.describe(`Execution status`),result:u().optional().describe(`Execution result data`),error:h({message:r().describe(`Error message`),stack:r().optional().describe(`Error stack trace`),code:r().optional().describe(`Error code`)}).optional().describe(`Error details if failed`),durationMs:P().int().optional().describe(`Execution duration in milliseconds`),startedAt:r().datetime().describe(`When execution started`),completedAt:r().datetime().optional().describe(`When execution completed`),attempt:P().int().min(1).describe(`Attempt number (1-indexed)`),willRetry:S().describe(`Whether task will be retried`)}),Dz=h({name:r().describe(`Queue name (snake_case)`),concurrency:P().int().min(1).default(5).describe(`Max concurrent task executions`),rateLimit:h({max:P().int().positive().describe(`Maximum tasks per duration`),duration:P().int().positive().describe(`Duration in milliseconds`)}).optional().describe(`Rate limit configuration`),defaultRetryPolicy:Tz.optional().describe(`Default retry policy for tasks`),deadLetterQueue:r().optional().describe(`Dead letter queue name`),priority:P().int().min(0).default(0).describe(`Queue priority (lower = higher priority)`),autoScale:h({enabled:S().default(!1).describe(`Enable auto-scaling`),minWorkers:P().int().min(1).default(1).describe(`Minimum workers`),maxWorkers:P().int().min(1).default(10).describe(`Maximum workers`),scaleUpThreshold:P().int().positive().default(100).describe(`Queue size to scale up`),scaleDownThreshold:P().int().min(0).default(10).describe(`Queue size to scale down`)}).optional().describe(`Auto-scaling configuration`)}),Oz=h({id:r().describe(`Unique batch job identifier`),type:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),items:C(u()).describe(`Array of items to process`),batchSize:P().int().min(1).default(100).describe(`Number of items per batch`),queue:r().default(`batch`).describe(`Queue for batch tasks`),priority:Cz.default(`normal`).describe(`Batch task priority`),parallel:S().default(!0).describe(`Process batches in parallel`),stopOnError:S().default(!1).describe(`Stop batch if any item fails`),onProgress:M().input(w([h({processed:P(),total:P(),failed:P()})])).output(te()).optional().describe(`Progress callback function (called after each batch)`)}),Ebe=h({batchId:r().describe(`Batch job identifier`),total:P().int().min(0).describe(`Total number of items`),processed:P().int().min(0).default(0).describe(`Items processed`),succeeded:P().int().min(0).default(0).describe(`Items succeeded`),failed:P().int().min(0).default(0).describe(`Items failed`),percentage:P().min(0).max(100).describe(`Progress percentage`),status:E([`pending`,`running`,`completed`,`failed`,`cancelled`]).describe(`Batch status`),startedAt:r().datetime().optional().describe(`When batch started`),completedAt:r().datetime().optional().describe(`When batch completed`)}),kz=h({name:r().describe(`Worker name`),queues:C(r()).min(1).describe(`Queue names to process`),queueConfigs:C(Dz).optional().describe(`Queue configurations`),pollIntervalMs:P().int().positive().default(1e3).describe(`Queue polling interval in milliseconds`),visibilityTimeoutMs:P().int().positive().default(3e4).describe(`How long a task is invisible after being claimed`),defaultTimeoutMs:P().int().positive().default(3e5).describe(`Default task timeout in milliseconds`),shutdownTimeoutMs:P().int().positive().default(3e4).describe(`Graceful shutdown timeout in milliseconds`),handlers:d(r(),M()).optional().describe(`Task type handlers`)}),Dbe=h({workerName:r().describe(`Worker name`),totalProcessed:P().int().min(0).describe(`Total tasks processed`),succeeded:P().int().min(0).describe(`Successful tasks`),failed:P().int().min(0).describe(`Failed tasks`),active:P().int().min(0).describe(`Currently active tasks`),avgExecutionMs:P().min(0).optional().describe(`Average execution time in milliseconds`),uptimeMs:P().int().min(0).describe(`Worker uptime in milliseconds`),queues:d(r(),h({pending:P().int().min(0).describe(`Pending tasks`),active:P().int().min(0).describe(`Active tasks`),completed:P().int().min(0).describe(`Completed tasks`),failed:P().int().min(0).describe(`Failed tasks`)})).optional().describe(`Per-queue statistics`)}),Obe=Object.assign(Ez,{create:e=>e}),kbe=Object.assign(Dz,{create:e=>e}),Abe=Object.assign(kz,{create:e=>e}),jbe=Object.assign(Oz,{create:e=>e}),Az=h({id:r().describe(`Template identifier`),subject:r().describe(`Email subject`),body:r().describe(`Email body content`),bodyType:E([`text`,`html`,`markdown`]).optional().default(`html`).describe(`Body content type`),variables:C(r()).optional().describe(`Template variables`),attachments:C(h({name:r().describe(`Attachment filename`),url:r().url().describe(`Attachment URL`)})).optional().describe(`Email attachments`)}),jz=h({id:r().describe(`Template identifier`),message:r().describe(`SMS message content`),maxLength:P().optional().default(160).describe(`Maximum message length`),variables:C(r()).optional().describe(`Template variables`)}),Mz=h({title:r().describe(`Notification title`),body:r().describe(`Notification body`),icon:r().url().optional().describe(`Notification icon URL`),badge:P().optional().describe(`Badge count`),data:d(r(),u()).optional().describe(`Custom data`),actions:C(h({action:r().describe(`Action identifier`),title:r().describe(`Action button title`)})).optional().describe(`Notification actions`)}),Nz=h({title:r().describe(`Notification title`),message:r().describe(`Notification message`),type:E([`info`,`success`,`warning`,`error`]).describe(`Notification type`),actionUrl:r().optional().describe(`Action URL`),dismissible:S().optional().default(!0).describe(`User dismissible`),expiresAt:P().optional().describe(`Expiration timestamp`)}),Pz=E([`email`,`sms`,`push`,`in-app`,`slack`,`teams`,`webhook`]),Mbe=h({id:r().describe(`Notification ID`),name:r().describe(`Notification name`),channel:Pz.describe(`Notification channel`),template:l([Az,jz,Mz,Nz]).describe(`Notification template`),recipients:h({to:C(r()).describe(`Primary recipients`),cc:C(r()).optional().describe(`CC recipients`),bcc:C(r()).optional().describe(`BCC recipients`)}).describe(`Recipients`),schedule:h({type:E([`immediate`,`delayed`,`scheduled`]).describe(`Schedule type`),delay:P().optional().describe(`Delay in milliseconds`),scheduledAt:P().optional().describe(`Scheduled timestamp`)}).optional().describe(`Scheduling`),retryPolicy:h({enabled:S().optional().default(!0).describe(`Enable retries`),maxRetries:P().optional().default(3).describe(`Max retry attempts`),backoffStrategy:E([`exponential`,`linear`,`fixed`]).describe(`Backoff strategy`)}).optional().describe(`Retry policy`),tracking:h({trackOpens:S().optional().default(!1).describe(`Track opens`),trackClicks:S().optional().default(!1).describe(`Track clicks`),trackDelivery:S().optional().default(!0).describe(`Track delivery`)}).optional().describe(`Tracking configuration`)}),Fz=r().describe(`BCP-47 Language Tag (e.g. en-US, zh-CN)`),Iz=h({label:r().optional().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),placeholder:r().optional().describe(`Translated placeholder text for form inputs`),options:d(r(),r()).optional().describe(`Option value to translated label map`)}).describe(`Translation data for a single field`),Lz=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),fields:d(r(),Iz).optional().describe(`Field-level translations`)}).describe(`Translation data for a single object`),Rz=h({objects:d(r(),Lz).optional().describe(`Object translations keyed by object name`),apps:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID`),validationMessages:d(r(),r()).optional().describe(`Translatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})`)}).describe(`Translation data for objects, apps, and UI messages`),zz=d(Fz,Rz).describe(`Map of locale codes to translation data`),Bz=E([`bundled`,`per_locale`,`per_namespace`]).describe(`Translation file organization strategy`),Vz=E([`icu`,`simple`]).describe(`Message interpolation format: ICU MessageFormat or simple {variable} replacement`),Hz=h({defaultLocale:Fz.describe(`Default locale (e.g., "en")`),supportedLocales:C(Fz).describe(`Supported BCP-47 locale codes`),fallbackLocale:Fz.optional().describe(`Fallback locale code`),fileOrganization:Bz.default(`per_locale`).describe(`File organization strategy`),messageFormat:Vz.default(`simple`).describe(`Message interpolation format (ICU MessageFormat or simple)`),lazyLoad:S().default(!1).describe(`Load translations on demand`),cache:S().default(!0).describe(`Cache loaded translations`)}).describe(`Internationalization configuration`),Uz=d(r(),r()).describe(`Option value to translated label map`),Wz=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),description:r().optional().describe(`Translated object description`),helpText:r().optional().describe(`Translated help text for the object`),fields:d(r(),Iz).optional().describe(`Field translations keyed by field name`),_options:d(r(),Uz).optional().describe(`Object-scoped picklist option translations keyed by field name`),_views:d(r(),h({label:r().optional().describe(`Translated view label`),description:r().optional().describe(`Translated view description`)})).optional().describe(`View translations keyed by view name`),_sections:d(r(),h({label:r().optional().describe(`Translated section label`)})).optional().describe(`Section translations keyed by section name`),_actions:d(r(),h({label:r().optional().describe(`Translated action label`),confirmMessage:r().optional().describe(`Translated confirmation message`)})).optional().describe(`Action translations keyed by action name`),_notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Notification translations keyed by notification name`),_errors:d(r(),r()).optional().describe(`Error message translations keyed by error code`)}).describe(`Object-first aggregated translation node`),Nbe=h({_meta:h({locale:r().optional().describe(`BCP-47 locale code for this bundle`),direction:E([`ltr`,`rtl`]).optional().describe(`Text direction: left-to-right or right-to-left`)}).optional().describe(`Bundle-level metadata (locale, bidi direction)`),namespace:r().optional().describe(`Namespace for plugin isolation to avoid translation key collisions`),o:d(r(),Wz).optional().describe(`Object-first translations keyed by object name`),_globalOptions:d(r(),Uz).optional().describe(`Global picklist option translations keyed by option set name`),app:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),nav:d(r(),r()).optional().describe(`Navigation item translations keyed by nav item name`),dashboard:d(r(),h({label:r().optional().describe(`Translated dashboard label`),description:r().optional().describe(`Translated dashboard description`)})).optional().describe(`Dashboard translations keyed by dashboard name`),reports:d(r(),h({label:r().optional().describe(`Translated report label`),description:r().optional().describe(`Translated report description`)})).optional().describe(`Report translations keyed by report name`),pages:d(r(),h({title:r().optional().describe(`Translated page title`),description:r().optional().describe(`Translated page description`)})).optional().describe(`Page translations keyed by page name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID (supports ICU MessageFormat)`),validationMessages:d(r(),r()).optional().describe(`Validation error message translations keyed by rule name (supports ICU MessageFormat)`),notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Global notification translations keyed by notification name`),errors:d(r(),r()).optional().describe(`Global error message translations keyed by error code`)}).describe(`Object-first application translation bundle for a single locale`),Gz=E([`missing`,`redundant`,`stale`]).describe(`Translation diff status: missing from bundle, redundant (no matching metadata), or stale (metadata changed)`),Kz=h({key:r().describe(`Dot-path translation key`),status:Gz.describe(`Diff status of this translation key`),objectName:r().optional().describe(`Associated object name (snake_case)`),locale:r().describe(`BCP-47 locale code`),sourceHash:r().optional().describe(`Hash of source metadata for precise stale detection`),aiSuggested:r().optional().describe(`AI-suggested translation for this key`),aiConfidence:P().min(0).max(1).optional().describe(`AI suggestion confidence score (0–1)`)}).describe(`A single translation diff item`),qz=h({group:r().describe(`Translation group category`),totalKeys:P().int().nonnegative().describe(`Total keys in this group`),translatedKeys:P().int().nonnegative().describe(`Translated keys in this group`),coveragePercent:P().min(0).max(100).describe(`Coverage percentage for this group`)}).describe(`Coverage breakdown for a single translation group`),Pbe=h({locale:r().describe(`BCP-47 locale code`),objectName:r().optional().describe(`Object name scope (omit for full bundle)`),totalKeys:P().int().nonnegative().describe(`Total translatable keys from metadata`),translatedKeys:P().int().nonnegative().describe(`Number of translated keys`),missingKeys:P().int().nonnegative().describe(`Number of missing translations`),redundantKeys:P().int().nonnegative().describe(`Number of redundant translations`),staleKeys:P().int().nonnegative().describe(`Number of stale translations`),coveragePercent:P().min(0).max(100).describe(`Translation coverage percentage`),items:C(Kz).describe(`Detailed diff items`),breakdown:C(qz).optional().describe(`Per-group coverage breakdown`)}).describe(`Aggregated translation coverage result`),Fbe=`__TRANSLATE__`,Ibe=E([`insert`,`delete`,`retain`]),Jz=I(`type`,[h({type:m(`insert`),text:r().describe(`Text to insert`),attributes:d(r(),u()).optional().describe(`Text formatting attributes (e.g., bold, italic)`)}),h({type:m(`delete`),count:P().int().positive().describe(`Number of characters to delete`)}),h({type:m(`retain`),count:P().int().positive().describe(`Number of characters to retain`),attributes:d(r(),u()).optional().describe(`Attribute changes to apply`)})]),Yz=h({operationId:r().uuid().describe(`Unique operation identifier`),documentId:r().describe(`Document identifier`),userId:r().describe(`User who created the operation`),sessionId:r().uuid().describe(`Session identifier`),components:C(Jz).describe(`Operation components`),baseVersion:P().int().nonnegative().describe(`Document version this operation is based on`),timestamp:r().datetime().describe(`ISO 8601 datetime when operation was created`),metadata:d(r(),u()).optional().describe(`Additional operation metadata`)}),Lbe=h({operation:Yz.describe(`Transformed operation`),transformed:S().describe(`Whether transformation was applied`),conflicts:C(r()).optional().describe(`Conflict descriptions if any`)}),Rbe=E([`lww-register`,`g-counter`,`pn-counter`,`g-set`,`or-set`,`lww-map`,`text`,`tree`,`json`]),Xz=h({clock:d(r(),P().int().nonnegative()).describe(`Map of replica ID to logical timestamp`)}),Zz=h({type:m(`lww-register`),value:u().describe(`Current register value`),timestamp:r().datetime().describe(`ISO 8601 datetime of last write`),replicaId:r().describe(`ID of replica that performed last write`),vectorClock:Xz.optional().describe(`Optional vector clock for causality tracking`)}),zbe=h({replicaId:r().describe(`Replica identifier`),delta:P().int().describe(`Change amount (positive for increment, negative for decrement)`),timestamp:r().datetime().describe(`ISO 8601 datetime of operation`)}),Qz=h({type:m(`g-counter`),counts:d(r(),P().int().nonnegative()).describe(`Map of replica ID to count`)}),$z=h({type:m(`pn-counter`),positive:d(r(),P().int().nonnegative()).describe(`Positive increments per replica`),negative:d(r(),P().int().nonnegative()).describe(`Negative increments per replica`)}),eB=h({value:u().describe(`Element value`),timestamp:r().datetime().describe(`Addition timestamp`),replicaId:r().describe(`Replica that added the element`),uid:r().uuid().describe(`Unique identifier for this addition`),removed:S().optional().default(!1).describe(`Whether element has been removed`)}),tB=h({type:m(`or-set`),elements:C(eB).describe(`Set elements with metadata`)}),nB=h({operationId:r().uuid().describe(`Unique operation identifier`),replicaId:r().describe(`Replica identifier`),position:P().int().nonnegative().describe(`Position in document`),insert:r().optional().describe(`Text to insert`),delete:P().int().positive().optional().describe(`Number of characters to delete`),timestamp:r().datetime().describe(`ISO 8601 datetime of operation`),lamportTimestamp:P().int().nonnegative().describe(`Lamport timestamp for ordering`)}),rB=h({type:m(`text`),documentId:r().describe(`Document identifier`),content:r().describe(`Current text content`),operations:C(nB).describe(`History of operations`),lamportClock:P().int().nonnegative().describe(`Current Lamport clock value`),vectorClock:Xz.describe(`Vector clock for causality`)}),iB=I(`type`,[Zz,Qz,$z,tB,rB]),Bbe=h({state:iB.describe(`Merged CRDT state`),conflicts:C(h({type:r().describe(`Conflict type`),description:r().describe(`Conflict description`),resolved:S().describe(`Whether conflict was automatically resolved`)})).optional().describe(`Conflicts encountered during merge`)}),aB=E([`blue`,`green`,`red`,`yellow`,`purple`,`orange`,`pink`,`teal`,`indigo`,`cyan`]),oB=h({color:l([aB,r()]).describe(`Cursor color (preset or custom hex)`),opacity:P().min(0).max(1).optional().default(1).describe(`Cursor opacity (0-1)`),label:r().optional().describe(`Label to display with cursor (usually username)`),showLabel:S().optional().default(!0).describe(`Whether to show label`),pulseOnUpdate:S().optional().default(!0).describe(`Whether to pulse when cursor moves`)}),sB=h({anchor:h({line:P().int().nonnegative().describe(`Anchor line number`),column:P().int().nonnegative().describe(`Anchor column number`)}).describe(`Selection anchor (start point)`),focus:h({line:P().int().nonnegative().describe(`Focus line number`),column:P().int().nonnegative().describe(`Focus column number`)}).describe(`Selection focus (end point)`),direction:E([`forward`,`backward`]).optional().describe(`Selection direction`)}),cB=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier`),userName:r().describe(`Display name of user`),position:h({line:P().int().nonnegative().describe(`Cursor line number (0-indexed)`),column:P().int().nonnegative().describe(`Cursor column number (0-indexed)`)}).describe(`Current cursor position`),selection:sB.optional().describe(`Current text selection`),style:oB.describe(`Visual style for this cursor`),isTyping:S().optional().default(!1).describe(`Whether user is currently typing`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last cursor update`),metadata:d(r(),u()).optional().describe(`Additional cursor metadata`)}),Vbe=h({position:h({line:P().int().nonnegative(),column:P().int().nonnegative()}).optional().describe(`Updated cursor position`),selection:sB.optional().describe(`Updated selection`),isTyping:S().optional().describe(`Updated typing state`),metadata:d(r(),u()).optional().describe(`Updated metadata`)}),lB=E([`active`,`idle`,`viewing`,`disconnected`]),uB=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),userName:r().describe(`Display name`),userAvatar:r().optional().describe(`User avatar URL`),status:lB.describe(`Current activity status`),currentDocument:r().optional().describe(`Document ID user is currently editing`),currentView:r().optional().describe(`Current view/page user is on`),lastActivity:r().datetime().describe(`ISO 8601 datetime of last activity`),joinedAt:r().datetime().describe(`ISO 8601 datetime when user joined session`),permissions:C(r()).optional().describe(`User permissions in this session`),metadata:d(r(),u()).optional().describe(`Additional user state metadata`)}),Hbe=h({sessionId:r().uuid().describe(`Session identifier`),documentId:r().optional().describe(`Document ID this session is for`),users:C(uB).describe(`Active users in session`),startedAt:r().datetime().describe(`ISO 8601 datetime when session started`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last update`),metadata:d(r(),u()).optional().describe(`Session metadata`)}),Ube=h({status:lB.optional().describe(`Updated status`),currentDocument:r().optional().describe(`Updated current document`),currentView:r().optional().describe(`Updated current view`),metadata:d(r(),u()).optional().describe(`Updated metadata`)}),Wbe=h({eventId:r().uuid().describe(`Event identifier`),sessionId:r().uuid().describe(`Session identifier`),eventType:E([`user.joined`,`user.left`,`user.updated`,`session.created`,`session.ended`]).describe(`Type of awareness event`),userId:r().optional().describe(`User involved in event`),timestamp:r().datetime().describe(`ISO 8601 datetime of event`),payload:u().describe(`Event payload`)}),dB=E([`ot`,`crdt`,`lock`,`hybrid`]),fB=h({mode:dB.describe(`Collaboration mode to use`),enableCursorSharing:S().optional().default(!0).describe(`Enable cursor sharing`),enablePresence:S().optional().default(!0).describe(`Enable presence tracking`),enableAwareness:S().optional().default(!0).describe(`Enable awareness state`),maxUsers:P().int().positive().optional().describe(`Maximum concurrent users`),idleTimeout:P().int().positive().optional().default(3e5).describe(`Idle timeout in milliseconds`),conflictResolution:E([`ot`,`crdt`,`manual`]).optional().default(`ot`).describe(`Conflict resolution strategy`),persistence:S().optional().default(!0).describe(`Enable operation persistence`),snapshot:h({enabled:S().describe(`Enable periodic snapshots`),interval:P().int().positive().describe(`Snapshot interval in milliseconds`)}).optional().describe(`Snapshot configuration`)}),Gbe=h({sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier`),config:fB.describe(`Session configuration`),users:C(uB).describe(`Active users`),cursors:C(cB).describe(`Active cursors`),version:P().int().nonnegative().describe(`Current document version`),operations:C(l([Yz,nB])).optional().describe(`Recent operations`),createdAt:r().datetime().describe(`ISO 8601 datetime when session was created`),lastActivity:r().datetime().describe(`ISO 8601 datetime of last activity`),status:E([`active`,`idle`,`ended`]).describe(`Session status`)}),pB=E([`system`,`platform`,`user`]),mB=E([`draft`,`active`,`archived`,`deprecated`]),Kbe=h({id:r(),name:r(),type:r(),namespace:r().default(`default`),packageId:r().optional().describe(`Package ID that owns/delivered this metadata`),managedBy:E([`package`,`platform`,`user`]).optional().describe(`Who manages this metadata record lifecycle`),scope:pB.default(`platform`),metadata:d(r(),u()),extends:r().optional().describe(`Name of the parent metadata to extend/override`),strategy:E([`merge`,`replace`]).default(`merge`),owner:r().optional(),state:mB.default(`active`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant isolation`),version:P().default(1).describe(`Record version for optimistic concurrency control`),checksum:r().optional().describe(`Content checksum for change detection`),source:E([`filesystem`,`database`,`api`,`migration`]).optional().describe(`Origin of this metadata record`),tags:C(r()).optional().describe(`Classification tags for filtering and grouping`),publishedDefinition:u().optional().describe(`Snapshot of the last published definition`),publishedAt:r().datetime().optional().describe(`When this metadata was last published`),publishedBy:r().optional().describe(`Who published this version`),createdBy:r().optional(),createdAt:r().datetime().optional().describe(`Creation timestamp`),updatedBy:r().optional(),updatedAt:r().datetime().optional().describe(`Last update timestamp`)}),qbe=h({success:S().describe(`Whether the publish succeeded`),packageId:r().describe(`The package ID that was published`),version:P().int().describe(`New version number after publish`),publishedAt:r().datetime().describe(`Publish timestamp`),itemsPublished:P().int().describe(`Total metadata items published`),validationErrors:C(h({type:r().describe(`Metadata type that failed validation`),name:r().describe(`Item name that failed validation`),message:r().describe(`Validation error message`)})).optional().describe(`Validation errors if publish failed`)}),hB=E([`json`,`yaml`,`yml`,`ts`,`js`,`typescript`,`javascript`]),gB=h({path:r().optional(),size:P().optional(),mtime:r().datetime().optional(),hash:r().optional(),etag:r().optional(),modifiedAt:r().datetime().optional(),format:hB.optional()}),Jbe=h({name:r(),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Loader protocol identifier`),description:r().optional(),supportedFormats:C(r()).optional(),supportsWatch:S().optional(),supportsWrite:S().optional(),supportsCache:S().optional(),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)})}),Ybe=h({scope:pB.optional(),namespace:r().optional(),raw:S().optional().describe(`Return raw file content instead of parsed JSON`),cache:S().optional(),useCache:S().optional(),validate:S().optional(),ifNoneMatch:r().optional(),recursive:S().optional(),limit:P().optional(),patterns:C(r()).optional(),loader:r().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),Xbe=h({data:u(),stats:gB.optional(),format:hB.optional(),source:r().optional(),fromCache:S().optional(),etag:r().optional(),notModified:S().optional(),loadTime:P().optional()}),Zbe=h({format:hB.optional(),create:S().default(!0),overwrite:S().default(!0),path:r().optional(),prettify:S().optional(),indent:P().optional(),sortKeys:S().optional(),backup:S().optional(),atomic:S().optional(),loader:r().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),Qbe=h({success:S(),path:r().optional(),stats:gB.optional(),etag:r().optional(),size:P().optional(),saveTime:P().optional(),backupPath:r().optional()}),$be=h({type:E([`add`,`change`,`unlink`,`added`,`changed`,`deleted`]),path:r(),name:r().optional(),stats:gB.optional(),metadataType:r().optional(),data:u().optional(),timestamp:r().datetime().optional()}),exe=h({type:r(),count:P(),namespaces:C(r())}),txe=h({types:C(r()).optional(),namespaces:C(r()).optional(),output:r().describe(`Output directory or file`),format:hB.default(`json`)}),nxe=h({source:r().describe(`Input directory or file`),strategy:E([`merge`,`replace`,`skip`]).default(`merge`),validate:S().default(!0)}),_B=E([`filesystem`,`memory`,`none`]),rxe=E([`filesystem`,`database`,`api`,`migration`]),ixe=h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:_B.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory for filesystem-based metadata`),formats:C(hB).optional().describe(`Enabled metadata formats`),watch:S().optional().describe(`Enable file watching for filesystem loaders`),cache:S().optional().describe(`Enable metadata caching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`)}).optional().describe(`File watcher options`)}),vB=h({id:r(),metadataId:r().describe(`Foreign key to sys_metadata.id`),name:r(),type:r(),version:P().describe(`Version number at this snapshot`),operationType:E([`create`,`update`,`publish`,`revert`,`delete`]).describe(`Type of operation that created this history entry`),metadata:l([r(),d(r(),u())]).nullable().optional().describe(`Snapshot of metadata definition at this version (raw JSON string or parsed object)`),checksum:r().describe(`SHA-256 checksum of metadata content`),previousChecksum:r().optional().describe(`Checksum of the previous version`),changeNote:r().optional().describe(`Description of changes made in this version`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant isolation`),recordedBy:r().optional().describe(`User who made this change`),recordedAt:r().datetime().describe(`Timestamp when this version was recorded`)}),axe=h({limit:P().int().positive().optional().describe(`Maximum number of history records to return`),offset:P().int().nonnegative().optional().describe(`Number of records to skip`),since:r().datetime().optional().describe(`Only return history after this timestamp`),until:r().datetime().optional().describe(`Only return history before this timestamp`),operationType:E([`create`,`update`,`publish`,`revert`,`delete`]).optional().describe(`Filter by operation type`),includeMetadata:S().optional().default(!0).describe(`Include full metadata payload`)}),oxe=h({records:C(vB),total:P().int().nonnegative(),hasMore:S()}),sxe=h({type:r(),name:r(),version1:P(),version2:P(),checksum1:r(),checksum2:r(),identical:S(),patch:C(u()).optional().describe(`JSON patch operations`),summary:r().optional().describe(`Human-readable summary of changes`)}),cxe=h({maxVersions:P().int().positive().optional().describe(`Maximum number of versions to retain`),maxAgeDays:P().int().positive().optional().describe(`Maximum age of history records in days`),autoCleanup:S().default(!1).describe(`Enable automatic cleanup of old history`),cleanupIntervalHours:P().int().positive().default(24).describe(`How often to run cleanup (in hours)`)}),yB=E([`metadata`,`data`,`auth`,`file-storage`,`search`,`cache`,`queue`,`automation`,`graphql`,`analytics`,`realtime`,`job`,`notification`,`ai`,`i18n`,`ui`,`workflow`]),bB=E([`required`,`core`,`optional`]),lxe={data:`required`,metadata:`core`,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`},uxe=h({name:yB,enabled:S(),status:E([`running`,`stopped`,`degraded`,`initializing`]),version:r().optional(),provider:r().optional().describe(`Implementation provider (e.g. "s3" for storage)`),features:C(r()).optional().describe(`List of supported sub-features`)}),dxe=d(yB,u().describe(`Service Instance implementing the protocol interface`)),fxe=h({id:r(),name:yB,options:d(r(),u()).optional()}),xB=E([`shared_schema`,`isolated_schema`,`isolated_db`]),SB=E([`turso`,`postgres`,`memory`]).describe(`Database provider for tenant data`),CB=h({url:r().min(1).describe(`Database connection URL`),authToken:r().optional().describe(`Database auth token (encrypted at rest)`),group:r().optional().describe(`Turso database group name`)}).describe(`Tenant database connection configuration`),wB=h({maxUsers:P().int().positive().optional().describe(`Maximum number of users`),maxStorage:P().int().positive().optional().describe(`Maximum storage in bytes`),apiRateLimit:P().int().positive().optional().describe(`API requests per minute`),maxObjects:P().int().positive().optional().describe(`Maximum number of custom objects`),maxRecordsPerObject:P().int().positive().optional().describe(`Maximum records per object`),maxDeploymentsPerDay:P().int().positive().optional().describe(`Maximum deployments per day`),maxStorageBytes:P().int().positive().optional().describe(`Maximum storage in bytes`)}),pxe=h({currentObjectCount:P().int().min(0).default(0).describe(`Current number of custom objects`),currentRecordCount:P().int().min(0).default(0).describe(`Total records across all objects`),currentStorageBytes:P().int().min(0).default(0).describe(`Current storage usage in bytes`),deploymentsToday:P().int().min(0).default(0).describe(`Deployments executed today`),currentUsers:P().int().min(0).default(0).describe(`Current number of active users`),apiRequestsThisMinute:P().int().min(0).default(0).describe(`API requests in the current minute`),lastUpdatedAt:r().datetime().optional().describe(`Last usage update time`)}).describe(`Current tenant resource usage`),mxe=h({allowed:S().describe(`Whether the operation is within quota`),exceededQuota:r().optional().describe(`Name of the exceeded quota`),currentUsage:P().optional().describe(`Current usage value`),limit:P().optional().describe(`Quota limit`),message:r().optional().describe(`Human-readable quota message`)}).describe(`Quota enforcement check result`),hxe=h({id:r().describe(`Unique tenant identifier`),name:r().describe(`Tenant display name`),isolationLevel:xB,databaseProvider:SB.optional().describe(`Database provider`),connectionConfig:CB.optional().describe(`Database connection config`),provisioningStatus:E([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).optional().describe(`Current provisioning lifecycle status`),plan:E([`free`,`pro`,`enterprise`]).optional().describe(`Subscription plan`),customizations:d(r(),u()).optional().describe(`Custom configuration values`),quotas:wB.optional()}),TB=h({strategy:m(`shared_schema`).describe(`Row-level isolation strategy`),database:h({enableRLS:S().default(!0).describe(`Enable PostgreSQL Row-Level Security`),contextMethod:E([`session_variable`,`search_path`,`application_name`]).default(`session_variable`).describe(`How to set tenant context`),contextVariable:r().default(`app.current_tenant`).describe(`Session variable name`),applicationValidation:S().default(!0).describe(`Application-level tenant validation`)}).optional().describe(`Database configuration`),performance:h({usePartialIndexes:S().default(!0).describe(`Use partial indexes per tenant`),usePartitioning:S().default(!1).describe(`Use table partitioning by tenant_id`),poolSizePerTenant:P().int().positive().optional().describe(`Connection pool size per tenant`)}).optional().describe(`Performance settings`)}),EB=h({strategy:m(`isolated_schema`).describe(`Schema-level isolation strategy`),schema:h({namingPattern:r().default(`tenant_{tenant_id}`).describe(`Schema naming pattern`),includePublicSchema:S().default(!0).describe(`Include public schema`),sharedSchema:r().default(`public`).describe(`Schema for shared resources`),autoCreateSchema:S().default(!0).describe(`Auto-create schema`)}).optional().describe(`Schema configuration`),migrations:h({strategy:E([`parallel`,`sequential`,`on_demand`]).default(`parallel`).describe(`Migration strategy`),maxConcurrent:P().int().positive().default(10).describe(`Max concurrent migrations`),rollbackOnError:S().default(!0).describe(`Rollback on error`)}).optional().describe(`Migration configuration`),performance:h({poolPerSchema:S().default(!1).describe(`Separate pool per schema`),schemaCacheTTL:P().int().positive().default(3600).describe(`Schema cache TTL`)}).optional().describe(`Performance settings`)}),DB=h({strategy:m(`isolated_db`).describe(`Database-level isolation strategy`),database:h({namingPattern:r().default(`tenant_{tenant_id}`).describe(`Database naming pattern`),serverStrategy:E([`shared`,`sharded`,`dedicated`]).default(`shared`).describe(`Server assignment strategy`),separateCredentials:S().default(!0).describe(`Separate credentials per tenant`),autoCreateDatabase:S().default(!0).describe(`Auto-create database`)}).optional().describe(`Database configuration`),connectionPool:h({poolSize:P().int().positive().default(10).describe(`Connection pool size`),maxActivePools:P().int().positive().default(100).describe(`Max active pools`),idleTimeout:P().int().positive().default(300).describe(`Idle pool timeout`),usePooler:S().default(!0).describe(`Use connection pooler`)}).optional().describe(`Connection pool configuration`),backup:h({strategy:E([`individual`,`consolidated`,`on_demand`]).default(`individual`).describe(`Backup strategy`),frequencyHours:P().int().positive().default(24).describe(`Backup frequency`),retentionDays:P().int().positive().default(30).describe(`Backup retention days`)}).optional().describe(`Backup configuration`),encryption:h({perTenantKeys:S().default(!1).describe(`Per-tenant encryption keys`),algorithm:r().default(`AES-256-GCM`).describe(`Encryption algorithm`),keyManagement:E([`aws_kms`,`azure_key_vault`,`gcp_kms`,`hashicorp_vault`,`custom`]).optional().describe(`Key management service`)}).optional().describe(`Encryption configuration`)}),gxe=I(`strategy`,[TB,EB,DB]),_xe=h({encryption:h({atRest:S().default(!0).describe(`Require encryption at rest`),inTransit:S().default(!0).describe(`Require encryption in transit`),fieldLevel:S().default(!1).describe(`Require field-level encryption`)}).optional().describe(`Encryption requirements`),accessControl:h({requireMFA:S().default(!1).describe(`Require MFA`),requireSSO:S().default(!1).describe(`Require SSO`),ipWhitelist:C(r()).optional().describe(`Allowed IP addresses`),sessionTimeout:P().int().positive().default(3600).describe(`Session timeout`)}).optional().describe(`Access control requirements`),compliance:h({standards:C(E([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),requireAuditLog:S().default(!0).describe(`Require audit logging`),auditRetentionDays:P().int().positive().default(365).describe(`Audit retention days`),dataResidency:h({region:r().optional().describe(`Required region (e.g., US, EU, APAC)`),excludeRegions:C(r()).optional().describe(`Prohibited regions`)}).optional().describe(`Data residency requirements`)}).optional().describe(`Compliance requirements`)}),OB=E([`boolean`,`counter`,`gauge`]).describe(`License metric type`),vxe=h({code:r().regex(/^[a-z_][a-z0-9_.]*$/).describe(`Feature code (e.g. core.api_access)`),label:r(),description:r().optional(),type:OB.default(`boolean`),unit:E([`count`,`bytes`,`seconds`,`percent`]).optional(),requires:C(r()).optional()}),yxe=h({code:r().describe(`Plan code (e.g. pro_v1)`),label:r(),active:S().default(!0),features:C(r()).describe(`List of enabled boolean features`),limits:d(r(),P()).describe(`Map of metric codes to limit values (e.g. { storage_gb: 10 })`),currency:r().default(`USD`).optional(),priceMonthly:P().optional(),priceYearly:P().optional()}),bxe=h({spaceId:r().describe(`Target Space ID`),planCode:r(),issuedAt:r().datetime(),expiresAt:r().datetime().optional(),status:E([`active`,`expired`,`suspended`,`trial`]),customFeatures:C(r()).optional(),customLimits:d(r(),P()).optional(),plugins:C(r()).optional().describe(`List of enabled plugin package IDs`),signature:r().optional().describe(`Cryptographic signature of the license`)}),kB=E([`manual`,`auto`,`proxy`]).describe(`Registry synchronization strategy`),AB=h({url:r().url().describe(`Upstream registry endpoint`),syncPolicy:kB.default(`auto`),syncInterval:P().int().min(60).optional().describe(`Auto-sync interval in seconds`),auth:h({type:E([`none`,`basic`,`bearer`,`api-key`,`oauth2`]).default(`none`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional()}).optional(),tls:h({enabled:S().default(!0),verifyCertificate:S().default(!0),certificate:r().optional(),privateKey:r().optional()}).optional(),timeout:P().int().min(1e3).default(3e4).describe(`Request timeout in milliseconds`),retry:h({maxAttempts:P().int().min(0).default(3),backoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`)}).optional()}),xxe=h({type:E([`public`,`private`,`hybrid`]).describe(`Registry deployment type`),upstream:C(AB).optional().describe(`Upstream registries to sync from or proxy to`),scope:C(r()).optional().describe(`npm-style scopes managed by this registry (e.g., @my-corp, @enterprise)`),defaultScope:r().optional().describe(`Default scope prefix for new plugins`),storage:h({backend:E([`local`,`s3`,`gcs`,`azure-blob`,`oss`]).default(`local`),path:r().optional(),credentials:d(r(),u()).optional()}).optional(),visibility:E([`public`,`private`,`internal`]).default(`private`).describe(`Who can access this registry`),accessControl:h({requireAuthForRead:S().default(!1),requireAuthForWrite:S().default(!0),allowedPrincipals:C(r()).optional()}).optional(),cache:h({enabled:S().default(!0),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().optional().describe(`Maximum cache size in bytes`)}).optional(),mirrors:C(h({url:r().url(),priority:P().int().min(1).default(1)})).optional().describe(`Mirror registries for redundancy`)}),jB=E([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).describe(`Tenant provisioning lifecycle status`),MB=E([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),NB=E([`us-east`,`us-west`,`eu-west`,`eu-central`,`ap-southeast`,`ap-northeast`]).describe(`Available deployment region`),PB=h({name:r().min(1).describe(`Step name (e.g., create_database, sync_schema)`),status:E([`pending`,`running`,`completed`,`failed`,`skipped`]).describe(`Step status`),startedAt:r().datetime().optional().describe(`Step start time`),completedAt:r().datetime().optional().describe(`Step completion time`),durationMs:P().int().min(0).optional().describe(`Step duration in ms`),error:r().optional().describe(`Error message on failure`)}).describe(`Individual provisioning step status`),Sxe=h({orgId:r().min(1).describe(`Organization ID`),plan:MB.default(`free`),region:NB.default(`us-east`),displayName:r().optional().describe(`Tenant display name`),adminEmail:r().email().optional().describe(`Initial admin user email`),metadata:d(r(),u()).optional().describe(`Additional metadata`)}).describe(`Tenant provisioning request`),Cxe=h({tenantId:r().min(1).describe(`Provisioned tenant ID`),connectionUrl:r().min(1).describe(`Database connection URL`),status:jB,region:NB,plan:MB,steps:C(PB).default([]).describe(`Pipeline step statuses`),totalDurationMs:P().int().min(0).optional().describe(`Total provisioning duration`),provisionedAt:r().datetime().optional().describe(`Provisioning completion time`),error:r().optional().describe(`Error message on failure`)}).describe(`Tenant provisioning result`),wxe=E([`validating`,`diffing`,`migrating`,`registering`,`ready`,`failed`,`rolling_back`]).describe(`Deployment lifecycle status`),FB=h({entityType:E([`object`,`field`,`index`,`view`,`flow`,`permission`]).describe(`Entity type`),entityName:r().min(1).describe(`Entity name`),parentEntity:r().optional().describe(`Parent entity name`),changeType:E([`added`,`modified`,`removed`]).describe(`Change type`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`)}).describe(`Individual schema change`),Txe=h({changes:C(FB).default([]).describe(`List of schema changes`),summary:h({added:P().int().min(0).default(0).describe(`Number of added entities`),modified:P().int().min(0).default(0).describe(`Number of modified entities`),removed:P().int().min(0).default(0).describe(`Number of removed entities`)}).describe(`Change summary counts`),hasBreakingChanges:S().default(!1).describe(`Whether diff contains breaking changes`)}).describe(`Schema diff between current and desired state`),IB=h({sql:r().min(1).describe(`SQL DDL statement`),reversible:S().default(!0).describe(`Whether the statement can be reversed`),rollbackSql:r().optional().describe(`Reverse SQL for rollback`),order:P().int().min(0).describe(`Execution order`)}).describe(`Single DDL migration statement`),Exe=h({statements:C(IB).default([]).describe(`Ordered DDL statements`),dialect:r().min(1).describe(`Target SQL dialect`),reversible:S().default(!0).describe(`Whether the plan can be fully rolled back`),estimatedDurationMs:P().int().min(0).optional().describe(`Estimated execution time`)}).describe(`Ordered migration plan`),LB=h({severity:E([`error`,`warning`,`info`]).describe(`Issue severity`),path:r().describe(`Entity path (e.g., objects.project_task.fields.name)`),message:r().describe(`Issue description`),code:r().optional().describe(`Validation error code`)}).describe(`Validation issue`),Dxe=h({valid:S().describe(`Whether the bundle is valid`),issues:C(LB).default([]).describe(`Validation issues`),errorCount:P().int().min(0).default(0).describe(`Number of errors`),warningCount:P().int().min(0).default(0).describe(`Number of warnings`)}).describe(`Bundle validation result`),RB=h({version:r().min(1).describe(`Deployment version`),checksum:r().optional().describe(`SHA256 checksum`),objects:C(r()).default([]).describe(`Object names included`),views:C(r()).default([]).describe(`View names included`),flows:C(r()).default([]).describe(`Flow names included`),permissions:C(r()).default([]).describe(`Permission names included`),createdAt:r().datetime().optional().describe(`Bundle creation time`)}).describe(`Deployment manifest`),Oxe=h({manifest:RB,objects:C(d(r(),u())).default([]).describe(`Object definitions`),views:C(d(r(),u())).default([]).describe(`View definitions`),flows:C(d(r(),u())).default([]).describe(`Flow definitions`),permissions:C(d(r(),u())).default([]).describe(`Permission definitions`),seedData:C(d(r(),u())).default([]).describe(`Seed data records`)}).describe(`Deploy bundle containing all metadata for deployment`),kxe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`App identifier (snake_case)`),label:r().min(1).describe(`App display label`),version:r().min(1).describe(`App version (semver)`),description:r().optional().describe(`App description`),minKernelVersion:r().optional().describe(`Minimum required kernel version`),objects:C(r()).default([]).describe(`Object names provided`),views:C(r()).default([]).describe(`View names provided`),flows:C(r()).default([]).describe(`Flow names provided`),hasSeedData:S().default(!1).describe(`Whether app includes seed data`),seedData:C(d(r(),u())).default([]).describe(`Seed data records`),dependencies:C(r()).default([]).describe(`Required app dependencies`)}).describe(`App manifest for marketplace installation`),Axe=h({compatible:S().describe(`Whether the app is compatible`),issues:C(h({severity:E([`error`,`warning`]).describe(`Issue severity`),message:r().describe(`Issue description`),category:E([`kernel_version`,`object_conflict`,`dependency_missing`,`quota_exceeded`]).describe(`Issue category`)})).default([]).describe(`Compatibility issues`)}).describe(`App compatibility check result`),jxe=h({tenantId:r().min(1).describe(`Target tenant ID`),appId:r().min(1).describe(`App identifier`),configOverrides:d(r(),u()).optional().describe(`Configuration overrides`),skipSeedData:S().default(!1).describe(`Skip seed data population`)}).describe(`App install request`),Mxe=h({success:S().describe(`Whether installation succeeded`),appId:r().describe(`Installed app identifier`),version:r().describe(`Installed app version`),installedObjects:C(r()).default([]).describe(`Objects created/updated`),createdTables:C(r()).default([]).describe(`Database tables created`),seededRecords:P().int().min(0).default(0).describe(`Seed records inserted`),durationMs:P().int().min(0).optional().describe(`Installation duration`),error:r().optional().describe(`Error message on failure`)}).describe(`App install result`),Nxe={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`}},Pxe={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`,USER_PREFERENCE:`sys_user_preference`,ROLE:`sys_role`,PERMISSION_SET:`sys_permission_set`,AUDIT_LOG:`sys_audit_log`,METADATA:`sys_metadata`,PRESENCE:`sys_presence`},Fxe={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`},Ixe={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}};DA({},{ActivationEventSchema:()=>MH,AdvancedPluginLifecycleConfigSchema:()=>kSe,ArtifactChecksumSchema:()=>VB,ArtifactFileEntrySchema:()=>BB,ArtifactSignatureSchema:()=>HB,BreakingChangeSchema:()=>QH,CLICommandContributionSchema:()=>Lxe,CORE_PLUGIN_TYPES:()=>LV,CapabilityConformanceLevelSchema:()=>gV,CompatibilityLevelSchema:()=>ZH,CompatibilityMatrixEntrySchema:()=>eU,CustomizationOriginSchema:()=>aSe,CustomizationPolicySchema:()=>UV,DEFAULT_METADATA_TYPE_REGISTRY:()=>vSe,DeadLetterQueueEntrySchema:()=>Xxe,DependencyConflictSchema:()=>tU,DependencyGraphNodeSchema:()=>pU,DependencyGraphSchema:()=>mU,DependencyResolutionResultSchema:()=>QB,DependencyStatusEnum:()=>YB,DeprecationNoticeSchema:()=>$H,DevFixtureConfigSchema:()=>eV,DevPluginConfigSchema:()=>Kxe,DevPluginPreset:()=>nV,DevServiceOverrideSchema:()=>$B,DevToolsConfigSchema:()=>tV,DisablePackageRequestSchema:()=>mH,DisablePackageResponseSchema:()=>hH,DistributedStateConfigSchema:()=>CH,DynamicLoadRequestSchema:()=>BSe,DynamicLoadingConfigSchema:()=>USe,DynamicPluginOperationSchema:()=>AH,DynamicPluginResultSchema:()=>HSe,DynamicUnloadRequestSchema:()=>VSe,EVENT_PRIORITY_VALUES:()=>qxe,EnablePackageRequestSchema:()=>fH,EnablePackageResponseSchema:()=>pH,EventBusConfigSchema:()=>Qxe,EventHandlerSchema:()=>sV,EventLogEntrySchema:()=>Zxe,EventMessageQueueConfigSchema:()=>fV,EventMetadataSchema:()=>iV,EventPersistenceSchema:()=>cV,EventPhaseSchema:()=>DH,EventPriority:()=>rV,EventQueueConfigSchema:()=>lV,EventReplayConfigSchema:()=>Yxe,EventRouteSchema:()=>Jxe,EventSchema:()=>oV,EventSourcingConfigSchema:()=>uV,EventTypeDefinitionSchema:()=>aV,EventWebhookConfigSchema:()=>dV,ExecutionContextSchema:()=>CM,ExtensionPointSchema:()=>CV,FeatureFlag:()=>$xe,FeatureFlagSchema:()=>hV,FeatureStrategy:()=>mV,FieldChangeSchema:()=>zV,GetPackageRequestSchema:()=>oH,GetPackageResponseSchema:()=>sH,GracefulDegradationSchema:()=>TH,HealthStatusSchema:()=>rU,HookRegisteredEventSchema:()=>FSe,HookTriggeredEventSchema:()=>ISe,HotReloadConfigSchema:()=>wH,InstallPackageRequestSchema:()=>cH,InstallPackageResponseSchema:()=>lH,InstalledPackageSchema:()=>rH,KernelContextSchema:()=>JB,KernelEventBaseSchema:()=>kH,KernelReadyEventSchema:()=>LSe,KernelSecurityPolicySchema:()=>WH,KernelSecurityScanResultSchema:()=>UH,KernelSecurityVulnerabilitySchema:()=>HH,KernelShutdownEventSchema:()=>RSe,ListPackagesRequestSchema:()=>iH,ListPackagesResponseSchema:()=>aH,ManifestSchema:()=>RV,MergeConflictSchema:()=>VV,MergeResultSchema:()=>oSe,MergeStrategyConfigSchema:()=>HV,MetadataBulkRegisterRequestSchema:()=>ySe,MetadataBulkResultSchema:()=>eH,MetadataCategoryEnum:()=>zB,MetadataChangeTypeSchema:()=>gH,MetadataCollectionInfoSchema:()=>mSe,MetadataDependencySchema:()=>tH,MetadataDiffItemSchema:()=>_H,MetadataEventSchema:()=>gSe,MetadataExportOptionsSchema:()=>lSe,MetadataFallbackStrategySchema:()=>KV,MetadataFormatSchema:()=>WV,MetadataImportOptionsSchema:()=>uSe,MetadataLoadOptionsSchema:()=>sSe,MetadataLoadResultSchema:()=>dSe,MetadataLoaderContractSchema:()=>hSe,MetadataManagerConfigSchema:()=>qV,MetadataOverlaySchema:()=>BV,MetadataPluginConfigSchema:()=>$V,MetadataPluginManifestSchema:()=>_Se,MetadataQueryResultSchema:()=>ZV,MetadataQuerySchema:()=>XV,MetadataSaveOptionsSchema:()=>cSe,MetadataSaveResultSchema:()=>fSe,MetadataStatsSchema:()=>GV,MetadataTypeRegistryEntrySchema:()=>YV,MetadataTypeSchema:()=>JV,MetadataValidationResultSchema:()=>QV,MetadataWatchEventSchema:()=>pSe,MultiVersionSupportSchema:()=>QSe,NamespaceConflictErrorSchema:()=>xSe,NamespaceRegistryEntrySchema:()=>bSe,OclifPluginConfigSchema:()=>Rxe,OpsDomainModuleSchema:()=>GSe,OpsFilePathSchema:()=>qH,OpsPluginStructureSchema:()=>KSe,PackageArtifactSchema:()=>UB,PackageDependencyConflictSchema:()=>hU,PackageDependencyResolutionResultSchema:()=>gU,PackageDependencySchema:()=>fU,PackageStatusEnum:()=>nH,PermissionActionSchema:()=>IH,PermissionSchema:()=>RH,PermissionScopeSchema:()=>FH,PermissionSetSchema:()=>zH,PluginBuildOptionsSchema:()=>zxe,PluginBuildResultSchema:()=>Bxe,PluginCachingSchema:()=>MV,PluginCapabilityManifestSchema:()=>wV,PluginCapabilitySchema:()=>bV,PluginCodeSplittingSchema:()=>DV,PluginCompatibilityMatrixSchema:()=>XSe,PluginContextSchema:()=>nSe,PluginDependencyResolutionResultSchema:()=>ZSe,PluginDependencyResolutionSchema:()=>AV,PluginDependencySchema:()=>SV,PluginDiscoveryConfigSchema:()=>PH,PluginDiscoverySourceSchema:()=>NH,PluginDynamicImportSchema:()=>OV,PluginErrorEventSchema:()=>MSe,PluginEventBaseSchema:()=>OH,PluginHealthCheckSchema:()=>SH,PluginHealthReportSchema:()=>DSe,PluginHealthStatusSchema:()=>xH,PluginHotReloadSchema:()=>jV,PluginInitializationSchema:()=>kV,PluginInstallConfigSchema:()=>lCe,PluginInterfaceSchema:()=>xV,PluginLifecycleEventType:()=>zSe,PluginLifecyclePhaseEventSchema:()=>jSe,PluginLifecycleSchema:()=>IV,PluginLoadingConfigSchema:()=>FV,PluginLoadingEventSchema:()=>eSe,PluginLoadingStateSchema:()=>tSe,PluginLoadingStrategySchema:()=>TV,PluginMetadataSchema:()=>JSe,PluginPerformanceMonitoringSchema:()=>PV,PluginPreloadConfigSchema:()=>EV,PluginProvenanceSchema:()=>yU,PluginPublishOptionsSchema:()=>Uxe,PluginPublishResultSchema:()=>Wxe,PluginQualityMetricsSchema:()=>oU,PluginRegisteredEventSchema:()=>ASe,PluginRegistryEntrySchema:()=>sCe,PluginSandboxingSchema:()=>NV,PluginSchema:()=>iSe,PluginSearchFiltersSchema:()=>cCe,PluginSecurityManifestSchema:()=>WSe,PluginSecurityProtocol:()=>uCe,PluginSourceSchema:()=>jH,PluginStartupResultSchema:()=>iU,PluginStateSnapshotSchema:()=>OSe,PluginStatisticsSchema:()=>sU,PluginTrustLevelSchema:()=>GH,PluginTrustScoreSchema:()=>bU,PluginUpdateStrategySchema:()=>EH,PluginValidateOptionsSchema:()=>Vxe,PluginValidateResultSchema:()=>Hxe,PluginVendorSchema:()=>aU,PluginVersionMetadataSchema:()=>$Se,PreviewModeConfigSchema:()=>qB,ProtocolFeatureSchema:()=>yV,ProtocolReferenceSchema:()=>vV,ProtocolVersionSchema:()=>_V,RealTimeNotificationConfigSchema:()=>pV,RequiredActionSchema:()=>ZB,ResolvedDependencySchema:()=>XB,ResourceTypeSchema:()=>LH,RollbackPackageRequestSchema:()=>TSe,RollbackPackageResponseSchema:()=>ESe,RuntimeConfigSchema:()=>BH,RuntimeMode:()=>KB,SBOMEntrySchema:()=>_U,SBOMSchema:()=>vU,SandboxConfigSchema:()=>VH,ScopeConfigSchema:()=>rCe,ScopeInfoSchema:()=>iCe,SecurityPolicySchema:()=>dU,SecurityScanResultSchema:()=>uU,SecurityVulnerabilitySchema:()=>lU,SemanticVersionSchema:()=>XH,ServiceFactoryRegistrationSchema:()=>nCe,ServiceMetadataSchema:()=>eCe,ServiceRegisteredEventSchema:()=>NSe,ServiceRegistryConfigSchema:()=>tCe,ServiceScopeType:()=>nU,ServiceUnregisteredEventSchema:()=>PSe,StartupOptionsSchema:()=>aCe,StartupOrchestrationResultSchema:()=>oCe,TenantRuntimeContextSchema:()=>Gxe,UninstallPackageRequestSchema:()=>uH,UninstallPackageResponseSchema:()=>dH,UpgradeContextSchema:()=>rSe,UpgradeImpactLevelSchema:()=>vH,UpgradePackageRequestSchema:()=>CSe,UpgradePackageResponseSchema:()=>wSe,UpgradePhaseSchema:()=>bH,UpgradePlanSchema:()=>yH,UpgradeSnapshotSchema:()=>SSe,ValidationErrorSchema:()=>JH,ValidationFindingSchema:()=>GB,ValidationResultSchema:()=>qSe,ValidationSeverityEnum:()=>WB,ValidationWarningSchema:()=>YH,VersionConstraintSchema:()=>YSe,VulnerabilitySeverity:()=>cU});var Lxe=h({name:r().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:r().optional().describe(`Command description for help text`),module:r().optional().describe(`Module path exporting oclif Command classes`)}),Rxe=h({commands:h({strategy:E([`pattern`,`explicit`,`single`]).optional().describe(`Command discovery strategy`),target:r().optional().describe(`Target directory for command files`),glob:r().optional().describe(`Glob pattern for command file matching`)}).optional().describe(`Command discovery configuration`),topicSeparator:r().optional().describe(`Character separating topic and command names`)}).describe(`oclif plugin configuration section`),zB=E([`objects`,`views`,`pages`,`flows`,`dashboards`,`permissions`,`agents`,`reports`,`actions`,`translations`,`themes`,`datasets`,`apis`,`triggers`,`workflows`]).describe(`Metadata category within the artifact`),BB=h({path:r().describe(`Relative file path within the artifact`),size:P().int().nonnegative().describe(`File size in bytes`),category:zB.optional().describe(`Metadata category this file belongs to`)}).describe(`A single file entry within the artifact`),VB=h({algorithm:E([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm used for checksums`),files:d(r(),r().regex(/^[a-f0-9]+$/)).describe(`File path to hash value mapping`)}).describe(`Checksum manifest for artifact integrity verification`),HB=h({algorithm:E([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).default(`RSA-SHA256`).describe(`Signing algorithm used`),publicKeyRef:r().describe(`Public key reference (URL or fingerprint) for signature verification`),signature:r().describe(`Base64-encoded digital signature`),signedAt:r().datetime().optional().describe(`ISO 8601 timestamp of when the artifact was signed`),signedBy:r().optional().describe(`Identity of the signer (publisher ID or email)`)}).describe(`Digital signature for artifact authenticity verification`),UB=h({formatVersion:r().regex(/^\d+\.\d+$/).default(`1.0`).describe(`Artifact format version (e.g. "1.0")`),packageId:r().describe(`Package identifier from manifest`),version:r().describe(`Package version from manifest`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Archive format of the artifact`),size:P().int().positive().optional().describe(`Total artifact file size in bytes`),builtAt:r().datetime().describe(`ISO 8601 timestamp of when the artifact was built`),builtWith:r().optional().describe(`Build tool identifier (e.g. "os-cli@3.2.0")`),files:C(BB).optional().describe(`List of files contained in the artifact`),metadataCategories:C(zB).optional().describe(`Metadata categories included in this artifact`),checksums:VB.optional().describe(`SHA256 checksums for artifact integrity verification`),signature:HB.optional().describe(`Digital signature for artifact authenticity verification`)}).describe(`Package artifact structure and metadata`),zxe=h({directory:r().optional().describe(`Project root directory (defaults to current working directory)`),outDir:r().optional().describe(`Output directory for the built artifact (defaults to ./dist)`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Archive format for the artifact`),sign:S().default(!1).describe(`Whether to digitally sign the artifact`),privateKeyPath:r().optional().describe(`Path to RSA/ECDSA private key file for signing`),signAlgorithm:E([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).optional().describe(`Signing algorithm to use`),checksumAlgorithm:E([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm for file checksums`),includeData:S().default(!0).describe(`Whether to include seed data in the artifact`),includeLocales:S().default(!0).describe(`Whether to include locale/translation files`)}).describe(`Options for the os plugin build command`),Bxe=h({success:S().describe(`Whether the build succeeded`),artifactPath:r().optional().describe(`Absolute path to the generated artifact file`),artifact:UB.optional().describe(`Artifact metadata`),fileCount:P().int().min(0).optional().describe(`Total number of files in the artifact`),size:P().int().min(0).optional().describe(`Total artifact size in bytes`),durationMs:P().optional().describe(`Build duration in milliseconds`),errorMessage:r().optional().describe(`Error message if build failed`),warnings:C(r()).optional().describe(`Warnings emitted during build`)}).describe(`Result of the os plugin build command`),WB=E([`error`,`warning`,`info`]).describe(`Validation issue severity`),GB=h({severity:WB.describe(`Issue severity level`),rule:r().describe(`Validation rule identifier`),message:r().describe(`Human-readable finding description`),path:r().optional().describe(`Relative file path within the artifact`)}).describe(`A single validation finding`),Vxe=h({artifactPath:r().describe(`Path to the artifact file to validate`),verifySignature:S().default(!0).describe(`Whether to verify the digital signature`),publicKeyPath:r().optional().describe(`Path to the public key for signature verification`),verifyChecksums:S().default(!0).describe(`Whether to verify checksums of all files`),validateMetadata:S().default(!0).describe(`Whether to validate metadata against schemas`),platformVersion:r().optional().describe(`Platform version for compatibility verification`)}).describe(`Options for the os plugin validate command`),Hxe=h({valid:S().describe(`Whether the artifact passed validation`),artifact:UB.optional().describe(`Extracted artifact metadata`),checksumVerification:h({passed:S().describe(`Whether all checksums match`),checksums:VB.optional().describe(`Verified checksums`),mismatches:C(r()).optional().describe(`Files with checksum mismatches`)}).optional().describe(`Checksum verification result`),signatureVerification:h({passed:S().describe(`Whether the signature is valid`),signature:HB.optional().describe(`Signature details`),failureReason:r().optional().describe(`Signature verification failure reason`)}).optional().describe(`Signature verification result`),platformCompatibility:h({compatible:S().describe(`Whether artifact is compatible`),requiredRange:r().optional().describe(`Required platform version range`),targetVersion:r().optional().describe(`Target platform version`)}).optional().describe(`Platform compatibility check result`),findings:C(GB).describe(`All validation findings`),summary:h({errors:P().int().min(0).describe(`Error count`),warnings:P().int().min(0).describe(`Warning count`),infos:P().int().min(0).describe(`Info count`)}).optional().describe(`Finding counts by severity`)}).describe(`Result of the os plugin validate command`),Uxe=h({artifactPath:r().describe(`Path to the artifact file to publish`),registryUrl:r().url().optional().describe(`Marketplace API base URL`),token:r().optional().describe(`Authentication token for marketplace API`),releaseNotes:r().optional().describe(`Release notes for this version`),preRelease:S().default(!1).describe(`Whether this is a pre-release version`),skipValidation:S().default(!1).describe(`Whether to skip local validation before publish`),access:E([`public`,`restricted`]).default(`public`).describe(`Package access level on the marketplace`),tags:C(r()).optional().describe(`Tags for marketplace categorization`)}).describe(`Options for the os plugin publish command`),Wxe=h({success:S().describe(`Whether the publish succeeded`),packageId:r().optional().describe(`Published package identifier`),version:r().optional().describe(`Published version string`),artifactUrl:r().url().optional().describe(`URL of the published artifact in the marketplace`),sha256:r().optional().describe(`SHA256 checksum of the uploaded artifact`),submissionId:r().optional().describe(`Marketplace submission ID for review tracking`),errorMessage:r().optional().describe(`Error message if publish failed`),message:r().optional().describe(`Human-readable status message`)}).describe(`Result of the os plugin publish command`),KB=E([`development`,`production`,`test`,`provisioning`,`preview`]).describe(`Kernel operating mode`),qB=h({autoLogin:S().default(!0).describe(`Auto-login as simulated user, skipping login/registration pages`),simulatedRole:E([`admin`,`user`,`viewer`]).default(`admin`).describe(`Permission role for the simulated preview user`),simulatedUserName:r().default(`Preview User`).describe(`Display name for the simulated preview user`),readOnly:S().default(!1).describe(`Restrict the preview session to read-only operations`),expiresInSeconds:P().int().min(0).default(0).describe(`Preview session duration in seconds (0 = no expiration)`),bannerMessage:r().optional().describe(`Banner message displayed in the UI during preview mode`)}),JB=h({instanceId:r().uuid().describe(`Unique UUID for this running kernel process`),mode:KB.default(`production`),version:r().describe(`Kernel version`),appName:r().optional().describe(`Host application name`),cwd:r().describe(`Current working directory`),workspaceRoot:r().optional().describe(`Workspace root if different from cwd`),startTime:P().int().describe(`Boot timestamp (ms)`),features:d(r(),S()).default({}).describe(`Global feature toggles`),previewMode:qB.optional().describe(`Preview/demo mode configuration (used when mode is "preview")`)}),Gxe=JB.extend({tenantId:r().min(1).describe(`Resolved tenant identifier`),tenantPlan:E([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),tenantRegion:r().optional().describe(`Tenant deployment region`),tenantDbUrl:r().min(1).describe(`Tenant database connection URL`),tenantQuotas:wB.optional().describe(`Tenant resource quotas`)}).describe(`Tenant-aware kernel runtime context`),YB=E([`satisfied`,`needs_install`,`needs_upgrade`,`conflict`]).describe(`Resolution status for a dependency`),XB=h({packageId:r().describe(`Dependency package identifier`),requiredRange:r().describe(`SemVer range required (e.g. "^2.0.0")`),resolvedVersion:r().optional().describe(`Actual version resolved from registry`),installedVersion:r().optional().describe(`Currently installed version`),status:YB.describe(`Resolution status`),conflictReason:r().optional().describe(`Explanation of the conflict`)}).describe(`Resolution result for a single dependency`),ZB=h({type:E([`install`,`upgrade`,`confirm_conflict`]).describe(`Type of action required`),packageId:r().describe(`Target package identifier`),description:r().describe(`Human-readable action description`)}).describe(`Action required before installation can proceed`),QB=h({dependencies:C(XB).describe(`Resolution result for each dependency`),canProceed:S().describe(`Whether installation can proceed`),requiredActions:C(ZB).describe(`Actions required before proceeding`),installOrder:C(r()).describe(`Topologically sorted package IDs for installation`),circularDependencies:C(C(r())).optional().describe(`Circular dependency chains detected (e.g. [["A", "B", "A"]])`)}).describe(`Complete dependency resolution result`),$B=h({service:r().min(1).describe(`Target service identifier`),enabled:S().default(!0).describe(`Enable or disable this service`),strategy:E([`mock`,`memory`,`stub`,`passthrough`]).default(`memory`).describe(`Implementation strategy for development`),config:d(r(),u()).optional().describe(`Strategy-specific configuration for this service override`)}),eV=h({enabled:S().default(!0).describe(`Load fixture data on startup`),paths:C(r()).optional().describe(`Glob patterns for fixture files`),resetBeforeLoad:S().default(!0).describe(`Clear existing data before loading fixtures`),envFilter:C(r()).optional().describe(`Only load fixtures matching these environment tags`)}),tV=h({hotReload:S().default(!0).describe(`Enable HMR / live-reload`),requestInspector:S().default(!1).describe(`Enable request inspector`),dbExplorer:S().default(!1).describe(`Enable database explorer UI`),verboseLogging:S().default(!0).describe(`Enable verbose logging`),apiDocs:S().default(!0).describe(`Serve OpenAPI docs at /_dev/docs`),mailCatcher:S().default(!1).describe(`Capture outbound emails in dev`)}),nV=E([`minimal`,`standard`,`full`]).describe(`Predefined dev configuration profile`),Kxe=h({preset:nV.default(`standard`).describe(`Base configuration preset`),services:d(r().min(1),$B.omit({service:!0})).optional().describe(`Per-service dev overrides keyed by service name`),fixtures:eV.optional().describe(`Fixture data loading configuration`),tools:tV.optional().describe(`Developer tooling settings`),port:P().int().min(1).max(65535).default(4400).describe(`Port for the dev-tools dashboard`),open:S().default(!1).describe(`Auto-open dev dashboard in browser`),seedAdminUser:S().default(!0).describe(`Create a default admin user for development`),simulatedLatency:P().int().min(0).default(0).describe(`Artificial latency (ms) added to service calls`)}),rV=E([`critical`,`high`,`normal`,`low`,`background`]),qxe={critical:0,high:1,normal:2,low:3,background:4},iV=h({source:r().describe(`Event source (e.g., plugin name, system component)`),timestamp:r().datetime().describe(`ISO 8601 datetime when event was created`),userId:r().optional().describe(`User who triggered the event`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant systems`),correlationId:r().optional().describe(`Correlation ID for event tracing`),causationId:r().optional().describe(`ID of the event that caused this event`),priority:rV.optional().default(`normal`).describe(`Event priority`)}),aV=h({name:AA.describe(`Event type name (lowercase with dots)`),version:r().default(`1.0.0`).describe(`Event schema version`),schema:u().optional().describe(`JSON Schema for event payload validation`),description:r().optional().describe(`Event type description`),deprecated:S().optional().default(!1).describe(`Whether this event type is deprecated`),tags:C(r()).optional().describe(`Event type tags`)}),oV=h({id:r().optional().describe(`Unique event identifier`),name:AA.describe(`Event name (lowercase with dots, e.g., user.created, order.paid)`),payload:u().describe(`Event payload schema`),metadata:iV.describe(`Event metadata`)}),sV=h({id:r().optional().describe(`Unique handler identifier`),eventName:r().describe(`Name of event to handle (supports wildcards like user.*)`),handler:u().describe(`Handler function`),priority:P().int().default(0).describe(`Execution priority (lower numbers execute first)`),async:S().default(!0).describe(`Execute in background (true) or block (false)`),retry:h({maxRetries:P().int().min(0).default(3).describe(`Maximum retry attempts`),backoffMs:P().int().positive().default(1e3).describe(`Initial backoff delay`),backoffMultiplier:P().positive().default(2).describe(`Backoff multiplier`)}).optional().describe(`Retry policy for failed handlers`),timeoutMs:P().int().positive().optional().describe(`Handler timeout in milliseconds`),filter:u().optional().describe(`Optional filter to determine if handler should execute`)}),Jxe=h({from:r().describe(`Source event pattern (supports wildcards, e.g., user.* or *.created)`),to:C(r()).describe(`Target event names to route to`),transform:u().optional().describe(`Optional function to transform payload`)}),cV=h({enabled:S().default(!1).describe(`Enable event persistence`),retention:P().int().positive().describe(`Days to retain persisted events`),filter:u().optional().describe(`Optional filter function to select which events to persist`),storage:E([`database`,`file`,`s3`,`custom`]).default(`database`).describe(`Storage backend for persisted events`)}),lV=h({name:r().default(`events`).describe(`Event queue name`),concurrency:P().int().min(1).default(10).describe(`Max concurrent event handlers`),retryPolicy:h({maxRetries:P().int().min(0).default(3).describe(`Max retries for failed events`),backoffStrategy:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:P().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:P().int().positive().default(6e4).describe(`Maximum retry delay`)}).optional().describe(`Default retry policy for events`),deadLetterQueue:r().optional().describe(`Dead letter queue name for failed events`),priorityEnabled:S().default(!0).describe(`Process events based on priority`)}),Yxe=h({fromTimestamp:r().datetime().describe(`Start timestamp for replay (ISO 8601)`),toTimestamp:r().datetime().optional().describe(`End timestamp for replay (ISO 8601)`),eventTypes:C(r()).optional().describe(`Event types to replay (empty = all)`),filters:d(r(),u()).optional().describe(`Additional filters for event selection`),speed:P().positive().default(1).describe(`Replay speed multiplier (1 = real-time)`),targetHandlers:C(r()).optional().describe(`Handler IDs to execute (empty = all)`)}),uV=h({enabled:S().default(!1).describe(`Enable event sourcing`),snapshotInterval:P().int().positive().default(100).describe(`Create snapshot every N events`),snapshotRetention:P().int().positive().default(10).describe(`Number of snapshots to retain`),retention:P().int().positive().default(365).describe(`Days to retain events`),aggregateTypes:C(r()).optional().describe(`Aggregate types to enable event sourcing for`),storage:h({type:E([`database`,`file`,`s3`,`eventstore`]).default(`database`).describe(`Storage backend`),options:d(r(),u()).optional().describe(`Storage-specific options`)}).optional().describe(`Event store configuration`)}),Xxe=h({id:r().describe(`Unique entry identifier`),event:oV.describe(`Original event`),error:h({message:r().describe(`Error message`),stack:r().optional().describe(`Error stack trace`),code:r().optional().describe(`Error code`)}).describe(`Failure details`),retries:P().int().min(0).describe(`Number of retry attempts`),firstFailedAt:r().datetime().describe(`When event first failed`),lastFailedAt:r().datetime().describe(`When event last failed`),failedHandler:r().optional().describe(`Handler ID that failed`)}),Zxe=h({id:r().describe(`Unique log entry identifier`),event:oV.describe(`The event`),status:E([`pending`,`processing`,`completed`,`failed`]).describe(`Processing status`),handlersExecuted:C(h({handlerId:r().describe(`Handler identifier`),status:E([`success`,`failed`,`timeout`]).describe(`Handler execution status`),durationMs:P().int().optional().describe(`Execution duration`),error:r().optional().describe(`Error message if failed`)})).optional().describe(`Handlers that processed this event`),receivedAt:r().datetime().describe(`When event was received`),processedAt:r().datetime().optional().describe(`When event was processed`),totalDurationMs:P().int().optional().describe(`Total processing time`)}),dV=h({id:r().optional().describe(`Unique webhook identifier`),eventPattern:r().describe(`Event name pattern (supports wildcards)`),url:r().url().describe(`Webhook endpoint URL`),method:E([`GET`,`POST`,`PUT`,`PATCH`]).default(`POST`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`HTTP headers`),authentication:h({type:E([`none`,`bearer`,`basic`,`api-key`]).describe(`Auth type`),credentials:d(r(),r()).optional().describe(`Auth credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:h({maxRetries:P().int().min(0).default(3).describe(`Max retry attempts`),backoffStrategy:E([`fixed`,`linear`,`exponential`]).default(`exponential`),initialDelayMs:P().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:P().int().positive().default(6e4).describe(`Max retry delay`)}).optional().describe(`Retry policy`),timeoutMs:P().int().positive().default(3e4).describe(`Request timeout in milliseconds`),transform:u().optional().describe(`Transform event before sending`),enabled:S().default(!0).describe(`Whether webhook is enabled`)}),fV=h({provider:E([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Message queue provider`),topic:r().describe(`Topic or queue name`),eventPattern:r().default(`*`).describe(`Event name pattern to publish (supports wildcards)`),partitionKey:r().optional().describe(`JSON path for partition key (e.g., "metadata.tenantId")`),format:E([`json`,`avro`,`protobuf`]).default(`json`).describe(`Message serialization format`),includeMetadata:S().default(!0).describe(`Include event metadata in message`),compression:E([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression`),batchSize:P().int().min(1).default(1).describe(`Batch size for publishing`),flushIntervalMs:P().int().positive().default(1e3).describe(`Flush interval for batching`)}),pV=h({enabled:S().default(!0).describe(`Enable real-time notifications`),protocol:E([`websocket`,`sse`,`long-polling`]).default(`websocket`).describe(`Real-time protocol`),eventPattern:r().default(`*`).describe(`Event pattern to broadcast`),userFilter:S().default(!0).describe(`Filter events by user`),tenantFilter:S().default(!0).describe(`Filter events by tenant`),channels:C(h({name:r().describe(`Channel name`),eventPattern:r().describe(`Event pattern for channel`),filter:u().optional().describe(`Additional filter function`)})).optional().describe(`Named channels for event broadcasting`),rateLimit:h({maxEventsPerSecond:P().int().positive().describe(`Max events per second per client`),windowMs:P().int().positive().default(1e3).describe(`Rate limit window`)}).optional().describe(`Rate limiting configuration`)}),Qxe=h({persistence:cV.optional().describe(`Event persistence configuration`),queue:lV.optional().describe(`Event queue configuration`),eventSourcing:uV.optional().describe(`Event sourcing configuration`),replay:h({enabled:S().default(!0).describe(`Enable event replay capability`)}).optional().describe(`Event replay configuration`),webhooks:C(dV).optional().describe(`Webhook configurations`),messageQueue:fV.optional().describe(`Message queue integration`),realtime:pV.optional().describe(`Real-time notification configuration`),eventTypes:C(aV).optional().describe(`Event type definitions`),handlers:C(sV).optional().describe(`Global event handlers`)}),mV=E([`boolean`,`percentage`,`user_list`,`group`,`custom`]),hV=h({name:kA.describe(`Feature key (snake_case)`),label:r().optional().describe(`Display label`),description:r().optional(),enabled:S().default(!1).describe(`Is globally enabled`),strategy:mV.default(`boolean`),conditions:h({percentage:P().min(0).max(100).optional(),users:C(r()).optional(),groups:C(r()).optional(),expression:r().optional().describe(`Custom formula expression`)}).optional(),environment:E([`dev`,`staging`,`prod`,`all`]).default(`all`).describe(`Environment validity`),expiresAt:r().datetime().optional().describe(`Feature flag expiration date`)}),$xe=Object.assign(hV,{create:e=>e}),gV=E([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),_V=h({major:P().int().min(0),minor:P().int().min(0),patch:P().int().min(0)}).describe(`Semantic version of the protocol`),vV=h({id:r().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:r(),version:_V,specification:r().optional().describe(`URL or path to protocol specification`),description:r().optional()}),yV=h({name:r().describe(`Feature identifier within the protocol`),enabled:S().default(!0),description:r().optional(),sinceVersion:r().optional().describe(`Version when this feature was added`),deprecatedSince:r().optional().describe(`Version when deprecated`)}),bV=h({protocol:vV,conformance:gV.default(`full`),implementedFeatures:C(r()).optional().describe(`List of implemented feature names`),features:C(yV).optional(),metadata:d(r(),u()).optional(),certified:S().default(!1).describe(`Has passed official conformance tests`),certificationDate:r().datetime().optional()}),xV=h({id:r().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:r(),description:r().optional(),version:_V,methods:C(h({name:r().describe(`Method name`),description:r().optional(),parameters:C(h({name:r(),type:r().describe(`Type notation (e.g., string, number, User)`),required:S().default(!0),description:r().optional()})).optional(),returnType:r().optional().describe(`Return value type`),async:S().default(!1).describe(`Whether method returns a Promise`)})),events:C(h({name:r().describe(`Event name`),description:r().optional(),payload:r().optional().describe(`Event payload type`)})).optional(),stability:E([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),SV=h({pluginId:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:r().describe(`Semantic version constraint`),optional:S().default(!1),reason:r().optional(),requiredCapabilities:C(r()).optional().describe(`Protocol IDs the dependency must support`)}),CV=h({id:r().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:r(),description:r().optional(),type:E([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:h({input:r().optional().describe(`Input type/schema`),output:r().optional().describe(`Output type/schema`),signature:r().optional().describe(`Function signature if applicable`)}).optional(),cardinality:E([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),wV=h({implements:C(bV).optional().describe(`List of protocols this plugin conforms to`),provides:C(xV).optional().describe(`Services/APIs this plugin offers to others`),requires:C(SV).optional().describe(`Required plugins and their capabilities`),extensionPoints:C(CV).optional().describe(`Points where other plugins can extend this plugin`),extensions:C(h({targetPluginId:r().describe(`Plugin ID being extended`),extensionPointId:r().describe(`Extension point identifier`),implementation:r().describe(`Path to implementation module`),priority:P().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),TV=E([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),EV=h({enabled:S().default(!1),priority:P().int().min(0).default(100),resources:C(E([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:h({routes:C(r()).optional(),roles:C(r()).optional(),deviceType:C(E([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:E([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),DV=h({enabled:S().default(!0),strategy:E([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:E([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:P().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:h({enabled:S().default(!0),minChunks:P().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),OV=h({enabled:S().default(!0),mode:E([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:S().default(!1).describe(`Prefetch module in idle time`),preload:S().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:r().optional().describe(`Custom chunk name for webpack`),timeout:P().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:h({enabled:S().default(!0),maxAttempts:P().int().min(1).max(10).default(3),backoffMs:P().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),kV=h({mode:E([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:P().int().min(100).default(3e4),priority:P().int().min(0).default(100),critical:S().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:h({enabled:S().default(!1),maxAttempts:P().int().min(1).max(5).default(3),backoffMs:P().int().min(0).default(1e3)}).optional(),healthCheckInterval:P().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),AV=h({strategy:E([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:h({resolve:S().default(!0),onMissing:E([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:E([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:h({load:S().default(!0),onFailure:E([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:E([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:E([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),jV=h({enabled:S().default(!1),environment:E([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:E([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:C(r()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:C(r()).optional().describe(`Glob patterns for files to ignore`),debounceMs:P().int().min(0).default(300),preserveState:S().default(!1),stateSerialization:h({enabled:S().default(!1),handler:r().optional()}).optional(),hooks:h({beforeReload:r().optional().describe(`Function to call before reload`),afterReload:r().optional().describe(`Function to call after reload`),onError:r().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:h({healthValidation:S().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:S().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:P().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:S().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:P().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:P().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:P().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),MV=h({enabled:S().default(!0),storage:E([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:E([`version`,`hash`,`timestamp`]).default(`version`),ttl:P().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:P().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:C(E([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:h({enabled:S().default(!1),algorithm:E([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),NV=h({enabled:S().default(!1),scope:E([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:E([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:C(r()).optional().describe(`List of allowed capability IDs`),resourceQuotas:h({maxMemoryMB:P().int().min(1).optional(),maxCpuTimeMs:P().int().min(100).optional(),maxFileDescriptors:P().int().min(1).optional(),maxNetworkKBps:P().int().min(1).optional()}).optional(),permissions:h({allowedAPIs:C(r()).optional(),allowedPaths:C(r()).optional(),allowedEndpoints:C(r()).optional(),allowedEnvVars:C(r()).optional()}).optional(),ipc:h({enabled:S().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:E([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:P().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:P().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:C(r()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),PV=h({enabled:S().default(!1),metrics:C(E([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:P().min(0).max(1).default(1),reportingInterval:P().int().min(1).default(60),budgets:h({maxLoadTimeMs:P().int().min(0).optional(),maxInitTimeMs:P().int().min(0).optional(),maxMemoryMB:P().int().min(0).optional()}).optional(),onBudgetViolation:E([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),FV=h({strategy:TV.default(`lazy`),preload:EV.optional(),codeSplitting:DV.optional(),dynamicImport:OV.optional(),initialization:kV.optional(),dependencyResolution:AV.optional(),hotReload:jV.optional(),caching:MV.optional(),sandboxing:NV.optional(),monitoring:PV.optional()}).describe(`Complete plugin loading configuration`),eSe=h({type:E([`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:r(),timestamp:P().int().min(0),durationMs:P().int().min(0).optional(),metadata:d(r(),u()).optional(),error:h({message:r(),code:r().optional(),stack:r().optional()}).optional()}).describe(`Plugin loading lifecycle event`),tSe=h({pluginId:r(),state:E([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:P().min(0).max(100).default(0),startedAt:P().int().min(0).optional(),completedAt:P().int().min(0).optional(),lastError:r().optional(),retryCount:P().int().min(0).default(0)}).describe(`Plugin loading state`),nSe=h({ql:h({object:M().describe(`Get object handle for method chaining`),query:M().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:h({getCurrentUser:M().describe(`Get the current authenticated user`),getConfig:M().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:h({debug:M().describe(`Log debug message`),info:M().describe(`Log info message`),warn:M().describe(`Log warning message`),error:M().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:h({get:M().describe(`Get a value from storage`),set:M().describe(`Set a value in storage`),delete:M().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:h({t:M().describe(`Translate a key`),getLocale:M().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:d(r(),u()),events:d(r(),u()),app:h({router:h({get:M().describe(`Register GET route handler`),post:M().describe(`Register POST route handler`),use:M().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:h({register:M().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),rSe=h({previousVersion:r().describe(`Version before upgrade`),newVersion:r().describe(`Version after upgrade`),isMajorUpgrade:S().describe(`Whether this is a major version bump`),previousMetadata:d(r(),u()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`),IV=h({onInstall:M().optional().describe(`Called when plugin is installed`),onEnable:M().optional().describe(`Called when plugin is enabled`),onDisable:M().optional().describe(`Called when plugin is disabled`),onUninstall:M().optional().describe(`Called when plugin is uninstalled`),onUpgrade:M().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),LV=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`],iSe=IV.extend({id:r().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:E([`standard`,...LV]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:r().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:r().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:S().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:r().optional(),author:r().optional(),homepage:r().url().optional()}),RV=h({id:r().describe(`Unique package identifier (reverse domain style)`),namespace:r().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")`),defaultDatasource:r().optional().default(`default`).describe(`Default datasource for all objects in this package`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:E([`plugin`,...LV,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:r().describe(`Human-readable package name`),description:r().optional().describe(`Package description`),permissions:C(r()).optional().describe(`Array of required permission strings`),objects:C(r()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:C(r()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:d(r(),r()).optional().describe(`Package dependencies`),configuration:h({title:r().optional(),properties:d(r(),h({type:E([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:u().optional().describe(`Default value`),description:r().optional().describe(`Tooltip description`),required:S().optional().describe(`Is this setting required?`),secret:S().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:C(r()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:h({kinds:C(h({id:r().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:C(r()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:r().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:C(r()).optional().describe(`Events this plugin listens to`),menus:d(r(),C(h({id:r(),label:r(),command:r().optional()}))).optional().describe(`UI Menu contributions`),themes:C(h({id:r(),label:r(),path:r()})).optional().describe(`Theme contributions`),translations:C(h({locale:r(),path:r()})).optional().describe(`Translation resources`),actions:C(h({name:r().describe(`Unique action name`),label:r().optional(),description:r().optional(),input:u().optional().describe(`Input validation schema`),output:u().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:C(h({id:r().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:r().describe(`Human readable name`),description:r().optional()})).optional().describe(`Driver contributions`),fieldTypes:C(h({name:r().describe(`Unique field type name (e.g. "vector")`),label:r().describe(`Display label`),description:r().optional()})).optional().describe(`Field Type contributions`),functions:C(h({name:r().describe(`Function name (e.g. "distance")`),description:r().optional(),args:C(r()).optional().describe(`Argument types`),returnType:r().optional()})).optional().describe(`Query Function contributions`),routes:C(h({prefix:r().regex(/^\//).describe(`API path prefix`),service:r().describe(`Service name this plugin provides`),methods:C(r()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:C(h({name:r().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:r().optional().describe(`Command description for help text`),module:r().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:C(cN).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:wV.optional().describe(`Plugin capability declarations for interoperability`),extensions:d(r(),u()).optional().describe(`Extension points and contributions`),loading:FV.optional().describe(`Plugin loading and runtime behavior configuration`),engine:h({objectstack:r().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)}),aSe=E([`package`,`admin`,`user`,`migration`,`api`]),zV=h({path:r().describe(`JSON path to the changed field`),originalValue:u().optional().describe(`Original value from the package`),currentValue:u().describe(`Current customized value`),changedBy:r().optional().describe(`User or admin who made this change`),changedAt:r().datetime().optional().describe(`Timestamp of the change`)}),BV=h({id:r().describe(`Overlay record ID (UUID)`),baseType:r().describe(`Metadata type being customized`),baseName:r().describe(`Metadata name being customized`),packageId:r().optional().describe(`Package ID that delivered the base metadata`),packageVersion:r().optional().describe(`Package version when overlay was created`),scope:E([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:r().optional().describe(`Tenant identifier`),owner:r().optional().describe(`Owner user ID for user-scope overlays`),patch:d(r(),u()).describe(`JSON Merge Patch payload (changed fields only)`),changes:C(zV).optional().describe(`Field-level change tracking for conflict detection`),active:S().default(!0).describe(`Whether this overlay is active`),createdAt:r().datetime().optional(),createdBy:r().optional(),updatedAt:r().datetime().optional(),updatedBy:r().optional()}),VV=h({path:r().describe(`JSON path to the conflicting field`),baseValue:u().describe(`Value in the old package version`),incomingValue:u().describe(`Value in the new package version`),customValue:u().describe(`Customer customized value`),suggestedResolution:E([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:r().optional().describe(`Explanation for the suggested resolution`)}),HV=h({defaultStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:C(r()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:C(r()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:S().default(!0).describe(`Auto-resolve changes that do not conflict`)}),oSe=h({success:S().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:d(r(),u()).optional().describe(`Merged metadata result`),updatedOverlay:d(r(),u()).optional().describe(`Updated overlay after merge`),conflicts:C(VV).optional().describe(`Unresolved merge conflicts`),autoResolved:C(h({path:r(),resolution:r(),description:r().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:h({totalFields:P().int().min(0).describe(`Total fields evaluated`),unchanged:P().int().min(0).describe(`Fields with no changes`),autoResolved:P().int().min(0).describe(`Fields auto-resolved`),conflicts:P().int().min(0).describe(`Fields with conflicts`)}).optional()}),UV=h({metadataType:r().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:S().default(!0),lockedFields:C(r()).optional().describe(`Field paths that cannot be customized`),customizableFields:C(r()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:S().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:S().default(!1).describe(`Whether admins can delete package-delivered fields`)}),WV=E([`json`,`yaml`,`typescript`,`javascript`]),GV=h({size:P().int().min(0).describe(`File size in bytes`),modifiedAt:r().datetime().describe(`Last modified date`),etag:r().describe(`Entity tag for cache validation`),format:WV.describe(`Serialization format`),path:r().optional().describe(`File system path`),metadata:d(r(),u()).optional().describe(`Provider-specific metadata`)}),sSe=h({patterns:C(r()).optional().describe(`File glob patterns`),ifNoneMatch:r().optional().describe(`ETag for conditional request`),ifModifiedSince:r().datetime().optional().describe(`Only load if modified after this date`),validate:S().default(!0).describe(`Validate against schema`),useCache:S().default(!0).describe(`Enable caching`),filter:r().optional().describe(`Filter predicate as string`),limit:P().int().min(1).optional().describe(`Maximum items to load`),recursive:S().default(!0).describe(`Search subdirectories`)}),cSe=h({format:WV.default(`typescript`).describe(`Output format`),prettify:S().default(!0).describe(`Format with indentation`),indent:P().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:S().default(!1).describe(`Sort object keys`),includeDefaults:S().default(!1).describe(`Include default values`),backup:S().default(!1).describe(`Create backup file`),overwrite:S().default(!0).describe(`Overwrite existing file`),atomic:S().default(!0).describe(`Use atomic write operation`),path:r().optional().describe(`Custom output path`)}),lSe=h({output:r().describe(`Output file path`),format:WV.default(`json`).describe(`Export format`),filter:r().optional().describe(`Filter items to export`),includeStats:S().default(!1).describe(`Include metadata statistics`),compress:S().default(!1).describe(`Compress output (gzip)`),prettify:S().default(!0).describe(`Pretty print output`)}),uSe=h({conflictResolution:E([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Simulate import without saving`),continueOnError:S().default(!1).describe(`Continue if validation fails`),transform:r().optional().describe(`Transform items before import`)}),dSe=h({data:u().nullable().describe(`Loaded metadata`),fromCache:S().default(!1).describe(`Loaded from cache`),notModified:S().default(!1).describe(`Not modified since last request`),etag:r().optional().describe(`Entity tag`),stats:GV.optional().describe(`Metadata statistics`),loadTime:P().min(0).optional().describe(`Load duration in ms`)}),fSe=h({success:S().describe(`Save successful`),path:r().describe(`Output path`),etag:r().optional().describe(`Generated entity tag`),size:P().int().min(0).optional().describe(`File size`),saveTime:P().min(0).optional().describe(`Save duration in ms`),backupPath:r().optional().describe(`Backup file path`)}),pSe=h({type:E([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:r().describe(`Type of metadata`),name:r().describe(`Item identifier`),path:r().describe(`File path`),data:u().optional().describe(`Item data`),timestamp:r().datetime().describe(`Event timestamp`)}),mSe=h({type:r().describe(`Collection type`),count:P().int().min(0).describe(`Number of items`),formats:C(WV).describe(`Formats in collection`),totalSize:P().int().min(0).optional().describe(`Total size in bytes`),lastModified:r().datetime().optional().describe(`Last modification date`),location:r().optional().describe(`Collection location`)}),hSe=h({name:r().describe(`Loader identifier`),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)}).describe(`Loader capabilities`),supportedFormats:C(WV).describe(`Supported formats`),supportsWatch:S().default(!1).describe(`Supports file watching`),supportsWrite:S().default(!0).describe(`Supports write operations`),supportsCache:S().default(!0).describe(`Supports caching`)}),KV=E([`filesystem`,`memory`,`none`]),qV=h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:KV.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory path`),formats:C(WV).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:h({enabled:S().default(!0).describe(`Enable caching`),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:S().default(!1).describe(`Enable file watching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`),ignoreInitial:S().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:h({strict:S().default(!0).describe(`Strict validation`),throwOnError:S().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:d(r(),u()).optional().describe(`Loader-specific configuration`)}),JV=E([`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`]),YV=h({type:JV.describe(`Metadata type identifier`),label:r().describe(`Display label for the metadata type`),description:r().optional().describe(`Description of the metadata type`),filePatterns:C(r()).describe(`Glob patterns to discover files of this type`),supportsOverlay:S().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:S().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:S().default(!1).describe(`Whether version history is tracked`),loadOrder:P().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:E([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)}),XV=h({types:C(JV).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),packageId:r().optional().describe(`Filter by owning package`),search:r().optional().describe(`Full-text search query`),scope:E([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:E([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:C(r()).optional().describe(`Filter by tags`),sortBy:E([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(500).default(50).describe(`Items per page`)}),ZV=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),namespace:r().optional().describe(`Namespace`),label:r().optional().describe(`Display label`),scope:E([`system`,`platform`,`user`]).optional(),state:E([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:r().optional(),updatedAt:r().datetime().optional()})).describe(`Matched metadata items`),total:P().int().min(0).describe(`Total matching items`),page:P().int().min(1).describe(`Current page`),pageSize:P().int().min(1).describe(`Page size`)}),gSe=h({event:E([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:JV.describe(`Metadata type`),name:r().describe(`Metadata item name`),namespace:r().optional().describe(`Namespace`),packageId:r().optional().describe(`Owning package ID`),timestamp:r().datetime().describe(`Event timestamp`),actor:r().optional().describe(`User or system that triggered the event`),payload:d(r(),u()).optional().describe(`Event-specific payload`)}),QV=h({valid:S().describe(`Whether the metadata is valid`),errors:C(h({path:r().describe(`JSON path to the invalid field`),message:r().describe(`Error description`),code:r().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:C(h({path:r().describe(`JSON path to the field`),message:r().describe(`Warning description`)})).optional().describe(`Validation warnings`)}),$V=h({storage:qV.describe(`Storage backend configuration`),customizationPolicies:C(UV).optional().describe(`Default customization policies per type`),mergeStrategy:HV.optional().describe(`Merge strategy for package upgrades`),additionalTypes:C(YV.omit({type:!0}).extend({type:r().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:S().default(!0).describe(`Emit metadata change events`),validateOnWrite:S().default(!0).describe(`Validate metadata on write`),enableVersioning:S().default(!1).describe(`Track metadata version history`),cacheMaxItems:P().int().min(0).default(1e4).describe(`Max items in memory cache`)}),_Se=h({id:m(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:m(`ObjectStack Metadata Service`).describe(`Plugin name`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:m(`standard`).describe(`Plugin type`),description:r().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:h({crud:S().default(!0).describe(`Supports metadata CRUD`),query:S().default(!0).describe(`Supports metadata query`),overlay:S().default(!0).describe(`Supports customization overlays`),watch:S().default(!1).describe(`Supports file watching`),importExport:S().default(!0).describe(`Supports import/export`),validation:S().default(!0).describe(`Supports schema validation`),versioning:S().default(!1).describe(`Supports version history`),events:S().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:$V.optional().describe(`Plugin configuration`)}),vSe=[{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`}],ySe=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue if individual item fails`),validate:S().default(!0).describe(`Validate before register`)}),eH=h({total:P().int().min(0).describe(`Total items processed`),succeeded:P().int().min(0).describe(`Successfully processed`),failed:P().int().min(0).describe(`Failed items`),errors:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),error:r().describe(`Error message`)})).optional().describe(`Per-item errors`)}),tH=h({sourceType:r().describe(`Dependent metadata type`),sourceName:r().describe(`Dependent metadata name`),targetType:r().describe(`Referenced metadata type`),targetName:r().describe(`Referenced metadata name`),kind:E([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)}),nH=E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),rH=h({manifest:RV.describe(`Full package manifest`),status:nH.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:S().default(!0).describe(`Whether the package is currently enabled`),installedAt:r().datetime().optional().describe(`Installation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),installedVersion:r().optional().describe(`Currently installed version for quick access`),previousVersion:r().optional().describe(`Version before the last upgrade`),statusChangedAt:r().datetime().optional().describe(`Status change timestamp`),errorMessage:r().optional().describe(`Error message when status is error`),settings:d(r(),u()).optional().describe(`User-provided configuration settings`),upgradeHistory:C(h({fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Version after upgrade`),upgradedAt:r().datetime().describe(`Upgrade timestamp`),status:E([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:C(r()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:C(r()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`),bSe=h({namespace:r().describe(`Namespace prefix`),packageId:r().describe(`Owning package ID`),registeredAt:r().datetime().describe(`Registration timestamp`),status:E([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),xSe=h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package display name`),suggestion:r().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),iH=h({status:nH.optional().describe(`Filter by package status`),type:RV.shape.type.optional().describe(`Filter by package type`),enabled:S().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),aH=h({packages:C(rH).describe(`List of installed packages`),total:P().describe(`Total package count`)}).describe(`List packages response`),oH=h({id:r().describe(`Package identifier`)}).describe(`Get package request`),sH=h({package:rH.describe(`Package details`)}).describe(`Get package response`),cH=h({manifest:RV.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),lH=h({package:rH.describe(`Installed package details`),message:r().optional().describe(`Installation status message`),dependencyResolution:QB.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),uH=h({id:r().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),dH=h({id:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),fH=h({id:r().describe(`Package ID to enable`)}).describe(`Enable package request`),pH=h({package:rH.describe(`Enabled package details`),message:r().optional().describe(`Enable status message`)}).describe(`Enable package response`),mH=h({id:r().describe(`Package ID to disable`)}).describe(`Disable package request`),hH=h({package:rH.describe(`Disabled package details`),message:r().optional().describe(`Disable status message`)}).describe(`Disable package response`),gH=E([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),_H=h({type:r().describe(`Metadata type`),name:r().describe(`Metadata name`),changeType:gH.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:S().default(!1).describe(`Whether this change may conflict with customizations`),summary:r().optional().describe(`Human-readable change summary`),previousName:r().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),vH=E([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),yH=h({packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Currently installed version`),toVersion:r().describe(`Target upgrade version`),impactLevel:vH.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:C(_H).describe(`All metadata changes`),affectedCustomizations:P().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:S().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:C(r()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:C(h({packageId:r(),fromVersion:r(),toVersion:r()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:P().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:r().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`),SSe=h({id:r().describe(`Snapshot identifier`),packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Target upgrade version`),tenantId:r().optional().describe(`Tenant identifier`),previousManifest:RV.describe(`Complete manifest of the previous package version`),metadataSnapshot:C(h({type:r(),name:r(),metadata:d(r(),u())})).describe(`Snapshot of all package metadata`),customizationSnapshot:C(d(r(),u())).optional().describe(`Snapshot of customer customizations`),createdAt:r().datetime().describe(`Snapshot creation timestamp`),expiresAt:r().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),CSe=h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:RV.optional().describe(`New manifest (if installing from local)`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`),bH=E([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`),wSe=h({success:S().describe(`Whether the upgrade succeeded`),phase:bH.describe(`Current upgrade phase`),plan:yH.optional().describe(`Upgrade plan`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r(),baseValue:u(),incomingValue:u(),customValue:u()})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if upgrade failed`),message:r().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),TSe=h({packageId:r().describe(`Package ID to rollback`),snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),ESe=h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Version restored to`),message:r().optional().describe(`Rollback status message`)}).describe(`Rollback package response`),xH=E([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),SH=h({interval:P().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:P().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:P().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:P().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:r().optional().describe(`Method name to call for health check`),autoRestart:S().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:P().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)}),DSe=h({status:xH,timestamp:r().datetime(),message:r().optional(),metrics:h({uptime:P().describe(`Plugin uptime in milliseconds`),memoryUsage:P().optional().describe(`Memory usage in bytes`),cpuUsage:P().optional().describe(`CPU usage percentage`),activeConnections:P().optional().describe(`Number of active connections`),errorRate:P().optional().describe(`Error rate (errors per minute)`),responseTime:P().optional().describe(`Average response time in ms`)}).partial().optional(),checks:C(h({name:r().describe(`Check name`),status:E([`passed`,`failed`,`warning`]),message:r().optional(),data:d(r(),u()).optional()})).optional(),dependencies:C(h({pluginId:r(),status:xH,message:r().optional()})).optional()}),CH=h({provider:E([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:C(r()).optional().describe(`Backend connection endpoints`),keyPrefix:r().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:P().int().min(0).optional().describe(`State expiration time in seconds`),auth:h({username:r().optional(),password:r().optional(),token:r().optional(),certificate:r().optional()}).optional(),replication:h({enabled:S().default(!0),minReplicas:P().int().min(1).default(1)}).optional(),customConfig:d(r(),u()).optional().describe(`Provider-specific configuration`)}),wH=h({enabled:S().default(!1),watchPatterns:C(r()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:P().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:S().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:E([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:CH.optional().describe(`Configuration for distributed state management`),shutdownTimeout:P().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:C(r()).optional().describe(`Hook names to call before reload`),afterReload:C(r()).optional().describe(`Hook names to call after reload`)}),TH=h({enabled:S().default(!0),fallbackMode:E([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:C(r()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:C(r()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:C(h({feature:r().describe(`Feature name`),enabled:S().describe(`Whether feature is available in degraded mode`),reason:r().optional()})).optional(),autoRecovery:h({enabled:S().default(!0),retryInterval:P().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:P().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),EH=h({mode:E([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:h({major:S().default(!1).describe(`Allow major version updates`),minor:S().default(!0).describe(`Allow minor version updates`),patch:S().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:h({cron:r().optional(),timezone:r().default(`UTC`),maintenanceWindow:P().int().min(1).default(60)}).optional(),rollback:h({enabled:S().default(!0),automatic:S().default(!0),keepVersions:P().int().min(1).default(3),timeout:P().int().min(1e3).default(3e4)}).optional(),validation:h({checkCompatibility:S().default(!0),runTests:S().default(!1),testSuite:r().optional()}).optional()}),OSe=h({pluginId:r(),version:r(),timestamp:r().datetime(),state:d(r(),u()),metadata:h({checksum:r().optional().describe(`State checksum for verification`),compressed:S().default(!1),encryption:r().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),kSe=h({health:SH.optional(),hotReload:wH.optional(),degradation:TH.optional(),updates:EH.optional(),resources:h({maxMemory:P().int().optional().describe(`Maximum memory in bytes`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:P().int().optional().describe(`Maximum concurrent connections`),timeout:P().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:h({enableMetrics:S().default(!0),enableTracing:S().default(!0),enableProfiling:S().default(!1),metricsInterval:P().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()}),DH=E([`init`,`start`,`destroy`]).describe(`Plugin lifecycle phase`),OH=h({pluginName:r().describe(`Name of the plugin`),timestamp:P().int().describe(`Unix timestamp in milliseconds when event occurred`)}),ASe=OH.extend({version:r().optional().describe(`Plugin version`)}),jSe=OH.extend({duration:P().min(0).optional().describe(`Duration of the lifecycle phase in milliseconds`),phase:DH.optional().describe(`Lifecycle phase`)}),MSe=OH.extend({error:h({name:r().describe(`Error class name`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`),code:r().optional().describe(`Error code`)}).describe(`Serializable error representation`),phase:DH.describe(`Lifecycle phase where error occurred`),errorMessage:r().optional().describe(`Error message`),errorStack:r().optional().describe(`Error stack trace`)}),NSe=h({serviceName:r().describe(`Name of the registered service`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),serviceType:r().optional().describe(`Type or interface name of the service`)}),PSe=h({serviceName:r().describe(`Name of the unregistered service`),timestamp:P().int().describe(`Unix timestamp in milliseconds`)}),FSe=h({hookName:r().describe(`Name of the hook`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),handlerCount:P().int().min(0).describe(`Number of handlers registered for this hook`)}),ISe=h({hookName:r().describe(`Name of the hook`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),args:C(u()).describe(`Arguments passed to the hook handlers`),handlerCount:P().int().min(0).optional().describe(`Number of handlers that will handle this event`)}),kH=h({timestamp:P().int().describe(`Unix timestamp in milliseconds`)}),LSe=kH.extend({duration:P().min(0).optional().describe(`Total initialization duration in milliseconds`),pluginCount:P().int().min(0).optional().describe(`Number of plugins initialized`)}),RSe=kH.extend({reason:r().optional().describe(`Reason for kernel shutdown`)}),zSe=E([`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`),AH=E([`load`,`unload`,`reload`,`enable`,`disable`]).describe(`Runtime plugin operation type`),jH=h({type:E([`npm`,`local`,`url`,`registry`,`git`]).describe(`Plugin source type`),location:r().describe(`Package name, file path, URL, or git repository`),version:r().optional().describe(`Semver version range (e.g., "^1.0.0")`),integrity:r().optional().describe(`Subresource Integrity hash (e.g., "sha384-...")`)}).describe(`Plugin source location for dynamic resolution`),MH=h({type:E([`onCommand`,`onRoute`,`onObject`,`onEvent`,`onService`,`onSchedule`,`onStartup`]).describe(`Trigger type for lazy activation`),pattern:r().describe(`Match pattern for the activation trigger`)}).describe(`Lazy activation trigger for a dynamic plugin`),BSe=h({pluginId:r().describe(`Unique plugin identifier`),source:jH,activationEvents:C(MH).optional().describe(`Lazy activation triggers; if omitted plugin starts immediately`),config:d(r(),u()).optional().describe(`Runtime configuration overrides`),priority:P().int().min(0).default(100).describe(`Loading priority (lower is higher)`),sandbox:S().default(!1).describe(`Run in an isolated sandbox`),timeout:P().int().min(1e3).default(6e4).describe(`Maximum time to complete loading in ms`)}).describe(`Request to dynamically load a plugin at runtime`),VSe=h({pluginId:r().describe(`Plugin to unload`),strategy:E([`graceful`,`forceful`,`drain`]).default(`graceful`).describe(`How to handle in-flight work during unload`),timeout:P().int().min(1e3).default(3e4).describe(`Maximum time to complete unloading in ms`),cleanupCache:S().default(!1).describe(`Remove cached code and assets after unload`),dependentAction:E([`cascade`,`warn`,`block`]).default(`block`).describe(`How to handle plugins that depend on this one`)}).describe(`Request to dynamically unload a plugin at runtime`),HSe=h({success:S(),operation:AH,pluginId:r(),durationMs:P().int().min(0).optional(),version:r().optional(),error:h({code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),details:d(r(),u()).optional()}).optional(),warnings:C(r()).optional()}).describe(`Result of a dynamic plugin operation`),NH=h({type:E([`registry`,`npm`,`directory`,`url`]).describe(`Discovery source type`),endpoint:r().describe(`Registry URL, directory path, or manifest URL`),pollInterval:P().int().min(0).default(0).describe(`How often to re-scan for new plugins (0 = manual)`),filter:h({tags:C(r()).optional(),vendors:C(r()).optional(),minTrustLevel:E([`verified`,`trusted`,`community`,`untrusted`]).optional()}).optional()}).describe(`Source for runtime plugin discovery`),PH=h({enabled:S().default(!1),sources:C(NH).default([]),autoLoad:S().default(!1).describe(`Automatically load newly discovered plugins`),requireApproval:S().default(!0).describe(`Require admin approval before loading discovered plugins`)}).describe(`Runtime plugin discovery configuration`),USe=h({enabled:S().default(!1).describe(`Enable runtime load/unload of plugins`),maxDynamicPlugins:P().int().min(1).default(50).describe(`Upper limit on runtime-loaded plugins`),discovery:PH.optional(),defaultSandbox:S().default(!0).describe(`Sandbox dynamically loaded plugins by default`),allowedSources:C(E([`npm`,`local`,`url`,`registry`,`git`])).optional().describe(`Restrict which source types are permitted`),requireIntegrity:S().default(!0).describe(`Require integrity hash verification for remote sources`),operationTimeout:P().int().min(1e3).default(6e4).describe(`Default timeout for load/unload operations in ms`)}).describe(`Dynamic plugin loading subsystem configuration`),FH=E([`global`,`tenant`,`user`,`resource`,`plugin`]).describe(`Scope of permission application`),IH=E([`create`,`read`,`update`,`delete`,`execute`,`manage`,`configure`,`share`,`export`,`import`,`admin`]).describe(`Type of action being permitted`),LH=E([`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`),RH=h({id:r().describe(`Unique permission identifier`),resource:LH,actions:C(IH),scope:FH.default(`plugin`),filter:h({resourceIds:C(r()).optional(),condition:r().optional().describe(`Filter expression (e.g., owner = currentUser)`),fields:C(r()).optional().describe(`Allowed fields for data resources`)}).optional(),description:r(),required:S().default(!0),justification:r().optional().describe(`Why this permission is needed`)}),zH=h({permissions:C(RH),groups:C(h({name:r().describe(`Group name`),description:r(),permissions:C(r()).describe(`Permission IDs in this group`)})).optional(),defaultGrant:E([`prompt`,`allow`,`deny`,`inherit`]).default(`prompt`)}),BH=h({engine:E([`v8-isolate`,`wasm`,`container`,`process`]).default(`v8-isolate`).describe(`Execution environment engine`),engineConfig:h({wasm:h({maxMemoryPages:P().int().min(1).max(65536).optional().describe(`Maximum WASM memory pages (64KB each)`),instructionLimit:P().int().min(1).optional().describe(`Maximum instructions before timeout`),enableSimd:S().default(!1).describe(`Enable WebAssembly SIMD support`),enableThreads:S().default(!1).describe(`Enable WebAssembly threads`),enableBulkMemory:S().default(!0).describe(`Enable bulk memory operations`)}).optional(),container:h({image:r().optional().describe(`Container image to use`),runtime:E([`docker`,`podman`,`containerd`]).default(`docker`),resources:h({cpuLimit:r().optional().describe(`CPU limit (e.g., "0.5", "2")`),memoryLimit:r().optional().describe(`Memory limit (e.g., "512m", "1g")`)}).optional(),networkMode:E([`none`,`bridge`,`host`]).default(`bridge`)}).optional(),v8Isolate:h({heapSizeMb:P().int().min(1).optional(),enableSnapshot:S().default(!0)}).optional()}).optional(),resourceLimits:h({maxMemory:P().int().optional().describe(`Maximum memory allocation`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU usage percentage`),timeout:P().int().min(0).optional().describe(`Maximum execution time`)}).optional()}),VH=h({enabled:S().default(!0),level:E([`none`,`minimal`,`standard`,`strict`,`paranoid`]).default(`standard`),runtime:BH.optional().describe(`Execution environment and isolation settings`),filesystem:h({mode:E([`none`,`readonly`,`restricted`,`full`]).default(`restricted`),allowedPaths:C(r()).optional().describe(`Whitelisted paths`),deniedPaths:C(r()).optional().describe(`Blacklisted paths`),maxFileSize:P().int().optional().describe(`Maximum file size in bytes`)}).optional(),network:h({mode:E([`none`,`local`,`restricted`,`full`]).default(`restricted`),allowedHosts:C(r()).optional().describe(`Whitelisted hosts`),deniedHosts:C(r()).optional().describe(`Blacklisted hosts`),allowedPorts:C(P()).optional().describe(`Allowed port numbers`),maxConnections:P().int().optional()}).optional(),process:h({allowSpawn:S().default(!1).describe(`Allow spawning child processes`),allowedCommands:C(r()).optional().describe(`Whitelisted commands`),timeout:P().int().optional().describe(`Process timeout in ms`)}).optional(),memory:h({maxHeap:P().int().optional().describe(`Maximum heap size in bytes`),maxStack:P().int().optional().describe(`Maximum stack size in bytes`)}).optional(),cpu:h({maxCpuPercent:P().min(0).max(100).optional(),maxThreads:P().int().optional()}).optional(),environment:h({mode:E([`none`,`readonly`,`restricted`,`full`]).default(`readonly`),allowedVars:C(r()).optional(),deniedVars:C(r()).optional()}).optional()}),HH=h({cve:r().optional(),id:r(),severity:E([`critical`,`high`,`medium`,`low`,`info`]),category:r().optional(),title:r(),location:r().optional(),remediation:r().optional(),description:r(),affectedVersions:C(r()),fixedIn:C(r()).optional(),cvssScore:P().min(0).max(10).optional(),exploitAvailable:S().default(!1),patchAvailable:S().default(!1),workaround:r().optional(),references:C(r()).optional(),discoveredDate:r().datetime().optional(),publishedDate:r().datetime().optional()}),UH=h({timestamp:r().datetime(),scanner:h({name:r(),version:r()}),status:E([`passed`,`failed`,`warning`]),vulnerabilities:C(HH).optional(),codeIssues:C(h({severity:E([`error`,`warning`,`info`]),type:r().describe(`Issue type (e.g., sql-injection, xss)`),file:r(),line:P().int().optional(),message:r(),suggestion:r().optional()})).optional(),dependencyVulnerabilities:C(h({package:r(),version:r(),vulnerability:HH})).optional(),licenseCompliance:h({status:E([`compliant`,`non-compliant`,`unknown`]),issues:C(h({package:r(),license:r(),reason:r()})).optional()}).optional(),summary:h({totalVulnerabilities:P().int(),criticalCount:P().int(),highCount:P().int(),mediumCount:P().int(),lowCount:P().int(),infoCount:P().int()})}),WH=h({csp:h({directives:d(r(),C(r())).optional(),reportOnly:S().default(!1)}).optional(),cors:h({allowedOrigins:C(r()),allowedMethods:C(r()),allowedHeaders:C(r()),allowCredentials:S().default(!1),maxAge:P().int().optional()}).optional(),rateLimit:h({enabled:S().default(!0),maxRequests:P().int(),windowMs:P().int().describe(`Time window in milliseconds`),strategy:E([`fixed`,`sliding`,`token-bucket`]).default(`sliding`)}).optional(),authentication:h({required:S().default(!0),methods:C(E([`jwt`,`oauth2`,`api-key`,`session`,`certificate`])),tokenExpiration:P().int().optional().describe(`Token expiration in seconds`)}).optional(),encryption:h({dataAtRest:S().default(!1).describe(`Encrypt data at rest`),dataInTransit:S().default(!0).describe(`Enforce HTTPS/TLS`),algorithm:r().optional().describe(`Encryption algorithm`),minKeyLength:P().int().optional().describe(`Minimum key length in bits`)}).optional(),auditLog:h({enabled:S().default(!0),events:C(r()).optional().describe(`Events to log`),retention:P().int().optional().describe(`Log retention in days`)}).optional()}),GH=E([`verified`,`trusted`,`community`,`untrusted`,`blocked`]).describe(`Trust level of the plugin`),WSe=h({pluginId:r(),trustLevel:GH,permissions:zH,sandbox:VH,policy:WH.optional(),scanResults:C(UH).optional(),vulnerabilities:C(HH).optional(),codeSigning:h({signed:S(),signature:r().optional(),certificate:r().optional(),algorithm:r().optional(),timestamp:r().datetime().optional()}).optional(),certifications:C(h({name:r().describe(`Certification name (e.g., SOC 2, ISO 27001)`),issuer:r(),issuedDate:r().datetime(),expiryDate:r().datetime().optional(),certificateUrl:r().url().optional()})).optional(),securityContact:h({email:r().email().optional(),url:r().url().optional(),pgpKey:r().optional()}).optional(),vulnerabilityDisclosure:h({policyUrl:r().url().optional(),responseTime:P().int().optional().describe(`Expected response time in hours`),bugBounty:S().default(!1)}).optional()}),KH=/^[a-z][a-z0-9_]*$/,qH=r().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];KH.test(e)||t.addIssue({code:de.custom,message:`Domain directory '${e}' must be lowercase snake_case`})}let r=n[n.length-1];r===`index.ts`||r===`main.ts`||KH.test(r.split(`.`)[0])||t.addIssue({code:de.custom,message:`Filename '${r}' base name must be lowercase snake_case`})}),GSe=h({name:r().regex(KH).describe(`Module name (snake_case)`),files:C(r()).describe(`List of files in this module`),metadata:d(r(),u()).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:de.custom,message:`Module '${e.name}' is missing an 'index.ts' entry point.`})}),KSe=h({root:r().describe(`Root directory path of the plugin project`),files:C(r()).describe(`List of all file paths relative to root`),metadata:d(r(),u()).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:de.custom,message:`Missing 'objectstack.config.ts' configuration file.`}),e.files.filter(e=>e.startsWith(`src/`)).forEach(e=>{let n=qH.safeParse(e);n.success||n.error.issues.forEach(n=>{t.addIssue({...n,path:[e]})})})}),JH=h({field:r().describe(`Field name that failed validation`),message:r().describe(`Human-readable error message`),code:r().optional().describe(`Machine-readable error code`)}),YH=h({field:r().describe(`Field name with warning`),message:r().describe(`Human-readable warning message`),code:r().optional().describe(`Machine-readable warning code`)}),qSe=h({valid:S().describe(`Whether the plugin passed validation`),errors:C(JH).optional().describe(`Validation errors`),warnings:C(YH).optional().describe(`Validation warnings`)}),JSe=h({name:r().min(1).describe(`Unique plugin identifier`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic version (e.g., 1.0.0)`),dependencies:C(r()).optional().describe(`Array of plugin names this plugin depends on`),signature:r().optional().describe(`Cryptographic signature for plugin verification`)}).passthrough().describe(`Plugin metadata for validation`),XH=h({major:P().int().min(0).describe(`Major version (breaking changes)`),minor:P().int().min(0).describe(`Minor version (backward compatible features)`),patch:P().int().min(0).describe(`Patch version (backward compatible fixes)`),preRelease:r().optional().describe(`Pre-release identifier (alpha, beta, rc.1)`),build:r().optional().describe(`Build metadata`)}).describe(`Semantic version number`),YSe=l([r().regex(/^[\d.]+$/).describe("Exact version: `1.2.3`"),r().regex(/^\^[\d.]+$/).describe("Compatible with: `^1.2.3` (`>=1.2.3 <2.0.0`)"),r().regex(/^~[\d.]+$/).describe("Approximately: `~1.2.3` (`>=1.2.3 <1.3.0`)"),r().regex(/^>=[\d.]+$/).describe("Greater than or equal: `>=1.2.3`"),r().regex(/^>[\d.]+$/).describe("Greater than: `>1.2.3`"),r().regex(/^<=[\d.]+$/).describe("Less than or equal: `<=1.2.3`"),r().regex(/^<[\d.]+$/).describe("Less than: `<1.2.3`"),r().regex(/^[\d.]+ - [\d.]+$/).describe("Range: `1.2.3 - 2.3.4`"),m(`*`).describe(`Any version`),m(`latest`).describe(`Latest stable version`)]),ZH=E([`fully-compatible`,`backward-compatible`,`deprecated-compatible`,`breaking-changes`,`incompatible`]).describe(`Compatibility level between versions`),QH=h({introducedIn:r().describe(`Version that introduced this breaking change`),type:E([`api-removed`,`api-renamed`,`api-signature-changed`,`behavior-changed`,`dependency-changed`,`configuration-changed`,`protocol-changed`]),description:r(),migrationGuide:r().optional().describe(`How to migrate from old to new`),deprecatedIn:r().optional().describe(`Version where old API was deprecated`),removedIn:r().optional().describe(`Version where old API will be removed`),automatedMigration:S().default(!1).describe(`Whether automated migration tool is available`),severity:E([`critical`,`major`,`minor`]).describe(`Impact severity`)}),$H=h({feature:r().describe(`Deprecated feature identifier`),deprecatedIn:r(),removeIn:r().optional(),reason:r(),alternative:r().optional().describe(`What to use instead`),migrationPath:r().optional().describe(`How to migrate to alternative`)}),eU=h({from:r().describe(`Version being upgraded from`),to:r().describe(`Version being upgraded to`),compatibility:ZH,breakingChanges:C(QH).optional(),migrationRequired:S().default(!1),migrationComplexity:E([`trivial`,`simple`,`moderate`,`complex`,`major`]).optional(),estimatedMigrationTime:P().optional(),migrationScript:r().optional().describe(`Path to migration script`),testCoverage:P().min(0).max(100).optional().describe(`Percentage of migration covered by tests`)}),XSe=h({pluginId:r(),currentVersion:r(),compatibilityMatrix:C(eU),supportedVersions:C(h({version:r(),supported:S(),endOfLife:r().datetime().optional().describe(`End of support date`),securitySupport:S().default(!1).describe(`Still receives security updates`)})),minimumCompatibleVersion:r().optional().describe(`Oldest version that can be directly upgraded`)}),tU=h({type:E([`version-mismatch`,`missing-dependency`,`circular-dependency`,`incompatible-versions`,`conflicting-interfaces`]),plugins:C(h({pluginId:r(),version:r(),requirement:r().optional().describe(`What this plugin requires`)})),description:r(),resolutions:C(h({strategy:E([`upgrade`,`downgrade`,`replace`,`disable`,`manual`]),description:r(),automaticResolution:S().default(!1),riskLevel:E([`low`,`medium`,`high`])})).optional(),severity:E([`critical`,`error`,`warning`,`info`])}),ZSe=h({success:S(),resolved:C(h({pluginId:r(),version:r(),resolvedVersion:r()})).optional(),conflicts:C(tU).optional(),warnings:C(r()).optional(),installationOrder:C(r()).optional().describe(`Plugin IDs in order they should be installed`),dependencyGraph:d(r(),C(r())).optional().describe(`Map of plugin ID to its dependencies`)}),QSe=h({enabled:S().default(!1),maxConcurrentVersions:P().int().min(1).default(2).describe(`How many versions can run at the same time`),selectionStrategy:E([`latest`,`stable`,`compatible`,`pinned`,`canary`,`custom`]).default(`latest`),routing:C(h({condition:r().describe(`Routing condition (e.g., tenant, user, feature flag)`),version:r().describe(`Version to use when condition matches`),priority:P().int().default(100).describe(`Rule priority`)})).optional(),rollout:h({enabled:S().default(!1),strategy:E([`percentage`,`blue-green`,`canary`]),percentage:P().min(0).max(100).optional().describe(`Percentage of traffic to new version`),duration:P().int().optional().describe(`Rollout duration in milliseconds`)}).optional()}),$Se=h({pluginId:r(),version:XH,versionString:r().describe(`Full version string (e.g., 1.2.3-beta.1+build.123)`),releaseDate:r().datetime(),releaseNotes:r().optional(),breakingChanges:C(QH).optional(),deprecations:C($H).optional(),compatibilityMatrix:C(eU).optional(),securityFixes:C(h({cve:r().optional().describe(`CVE identifier`),severity:E([`critical`,`high`,`medium`,`low`]),description:r(),fixedIn:r().describe(`Version where vulnerability was fixed`)})).optional(),statistics:h({downloads:P().int().min(0).optional(),installations:P().int().min(0).optional(),ratings:P().min(0).max(5).optional()}).optional(),support:h({status:E([`active`,`maintenance`,`deprecated`,`eol`]),endOfLife:r().datetime().optional(),securitySupport:S().default(!0)})}),nU=E([`singleton`,`transient`,`scoped`]).describe(`Service scope type`),eCe=h({name:r().min(1).describe(`Unique service name identifier`),scope:nU.optional().default(`singleton`).describe(`Service scope type`),type:r().optional().describe(`Service type or interface name`),registeredAt:P().int().optional().describe(`Unix timestamp in milliseconds when service was registered`),metadata:d(r(),u()).optional().describe(`Additional service-specific metadata`)}),tCe=h({strictMode:S().optional().default(!0).describe(`Throw errors on invalid operations (duplicate registration, service not found, etc.)`),allowOverwrite:S().optional().default(!1).describe(`Allow overwriting existing service registrations`),enableLogging:S().optional().default(!1).describe(`Enable logging for service registration and retrieval`),scopeTypes:C(r()).optional().describe(`Supported scope types`),maxServices:P().int().min(1).optional().describe(`Maximum number of services that can be registered`)}),nCe=h({name:r().min(1).describe(`Unique service name identifier`),scope:nU.optional().default(`singleton`).describe(`Service scope type`),factoryType:E([`sync`,`async`]).optional().default(`sync`).describe(`Whether factory is synchronous or asynchronous`),singleton:S().optional().default(!0).describe(`Whether to cache the factory result (singleton pattern)`)}),rCe=h({scopeType:r().describe(`Type of scope`),scopeId:r().optional().describe(`Unique scope identifier`),metadata:d(r(),u()).optional().describe(`Scope-specific context metadata`)}),iCe=h({scopeId:r().describe(`Unique scope identifier`),scopeType:r().describe(`Type of scope`),createdAt:P().int().describe(`Unix timestamp in milliseconds when scope was created`),serviceCount:P().int().min(0).optional().describe(`Number of services registered in this scope`),metadata:d(r(),u()).optional().describe(`Scope-specific context metadata`)}),aCe=h({timeout:P().int().min(0).optional().default(3e4).describe(`Maximum time in milliseconds to wait for each plugin to start`),rollbackOnFailure:S().optional().default(!0).describe(`Whether to rollback already-started plugins if any plugin fails`),healthCheck:S().optional().default(!1).describe(`Whether to run health checks after plugin startup`),parallel:S().optional().default(!1).describe(`Whether to start plugins in parallel when dependencies allow`),context:u().optional().describe(`Custom context object to pass to plugin lifecycle methods`)}),rU=h({healthy:S().describe(`Whether the plugin is healthy`),timestamp:P().int().describe(`Unix timestamp in milliseconds when health check was performed`),details:d(r(),u()).optional().describe(`Optional plugin-specific health details`),message:r().optional().describe(`Error message if plugin is unhealthy`)}),iU=h({plugin:h({name:r(),version:r().optional()}).passthrough().describe(`Plugin metadata`),success:S().describe(`Whether the plugin started successfully`),duration:P().min(0).describe(`Time taken to start the plugin in milliseconds`),error:h({name:r().describe(`Error class name`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`),code:r().optional().describe(`Error code`)}).optional().describe(`Serializable error representation if startup failed`),health:rU.optional().describe(`Health status after startup if health check was enabled`)}),oCe=h({results:C(iU).describe(`Startup results for each plugin`),totalDuration:P().min(0).describe(`Total time taken for all plugins in milliseconds`),allSuccessful:S().describe(`Whether all plugins started successfully`),rolledBack:C(r()).optional().describe(`Names of plugins that were rolled back`)}),aU=h({id:r().regex(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+$/).describe(`Vendor identifier (reverse domain)`),name:r(),website:r().url().optional(),email:r().email().optional(),verified:S().default(!1).describe(`Whether vendor is verified by ObjectStack`),trustLevel:E([`official`,`verified`,`community`,`unverified`]).default(`unverified`)}),oU=h({testCoverage:P().min(0).max(100).optional(),documentationScore:P().min(0).max(100).optional(),codeQuality:P().min(0).max(100).optional(),securityScan:h({lastScanDate:r().datetime().optional(),vulnerabilities:h({critical:P().int().min(0).default(0),high:P().int().min(0).default(0),medium:P().int().min(0).default(0),low:P().int().min(0).default(0)}).optional(),passed:S().default(!1)}).optional(),conformanceTests:C(h({protocolId:r().describe(`Protocol being tested`),passed:S(),totalTests:P().int().min(0),passedTests:P().int().min(0),lastRunDate:r().datetime().optional()})).optional()}),sU=h({downloads:P().int().min(0).default(0),downloadsLastMonth:P().int().min(0).default(0),activeInstallations:P().int().min(0).default(0),ratings:h({average:P().min(0).max(5).default(0),count:P().int().min(0).default(0),distribution:h({5:P().int().min(0).default(0),4:P().int().min(0).default(0),3:P().int().min(0).default(0),2:P().int().min(0).default(0),1:P().int().min(0).default(0)}).optional()}).optional(),stars:P().int().min(0).optional(),dependents:P().int().min(0).default(0)}),sCe=h({id:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Plugin identifier (reverse domain notation)`),version:r().regex(/^\d+\.\d+\.\d+$/),name:r(),description:r().optional(),readme:r().optional(),category:E([`data`,`integration`,`ui`,`analytics`,`security`,`automation`,`ai`,`utility`,`driver`,`gateway`,`adapter`]).optional(),tags:C(r()).optional(),vendor:aU,capabilities:wV.optional(),compatibility:h({minObjectStackVersion:r().optional(),maxObjectStackVersion:r().optional(),nodeVersion:r().optional(),platforms:C(E([`linux`,`darwin`,`win32`,`browser`])).optional()}).optional(),links:h({homepage:r().url().optional(),repository:r().url().optional(),documentation:r().url().optional(),bugs:r().url().optional(),changelog:r().url().optional()}).optional(),media:h({icon:r().url().optional(),logo:r().url().optional(),screenshots:C(r().url()).optional(),video:r().url().optional()}).optional(),quality:oU.optional(),statistics:sU.optional(),license:r().optional().describe(`SPDX license identifier`),pricing:h({model:E([`free`,`freemium`,`paid`,`enterprise`]),price:P().min(0).optional(),currency:r().default(`USD`).optional(),billingPeriod:E([`one-time`,`monthly`,`yearly`]).optional()}).optional(),publishedAt:r().datetime().optional(),updatedAt:r().datetime().optional(),deprecated:S().default(!1),deprecationMessage:r().optional(),replacedBy:r().optional().describe(`Plugin ID that replaces this one`),flags:h({experimental:S().default(!1),beta:S().default(!1),featured:S().default(!1),verified:S().default(!1)}).optional()}),cCe=h({query:r().optional(),category:C(r()).optional(),tags:C(r()).optional(),trustLevel:C(E([`official`,`verified`,`community`,`unverified`])).optional(),implementsProtocols:C(r()).optional(),pricingModel:C(E([`free`,`freemium`,`paid`,`enterprise`])).optional(),minRating:P().min(0).max(5).optional(),sortBy:E([`relevance`,`downloads`,`rating`,`updated`,`name`]).optional(),sortOrder:E([`asc`,`desc`]).default(`desc`).optional(),page:P().int().min(1).default(1).optional(),limit:P().int().min(1).max(100).default(20).optional()}),lCe=h({pluginId:r(),version:r().optional().describe(`Defaults to latest`),config:d(r(),u()).optional(),autoUpdate:S().default(!1).optional(),options:h({skipDependencies:S().default(!1).optional(),force:S().default(!1).optional(),target:E([`system`,`space`,`user`]).default(`space`).optional()}).optional()}),cU=E([`critical`,`high`,`medium`,`low`,`info`]).describe(`Severity level of a security vulnerability`),lU=h({cve:r().regex(/^CVE-\d{4}-\d+$/).optional().describe(`CVE identifier`),id:r().describe(`Vulnerability ID`),title:r().describe(`Short title summarizing the vulnerability`),description:r().describe(`Detailed description of the vulnerability`),severity:cU.describe(`Severity level of this vulnerability`),cvss:P().min(0).max(10).optional().describe(`CVSS score ranging from 0 to 10`),package:h({name:r().describe(`Name of the affected package`),version:r().describe(`Version of the affected package`),ecosystem:r().optional().describe(`Package ecosystem (e.g., npm, pip, maven)`)}).describe(`Affected package information`),vulnerableVersions:r().describe(`Semver range of vulnerable versions`),patchedVersions:r().optional().describe(`Semver range of patched versions`),references:C(h({type:E([`advisory`,`article`,`report`,`web`]).describe(`Type of reference source`),url:r().url().describe(`URL of the reference`)})).default([]).describe(`External references related to the vulnerability`),cwe:C(r()).default([]).describe(`CWE identifiers associated with this vulnerability`),publishedAt:r().datetime().optional().describe(`ISO 8601 date when the vulnerability was published`),mitigation:r().optional().describe(`Recommended steps to mitigate the vulnerability`)}).describe(`A known security vulnerability in a package dependency`),uU=h({scanId:r().uuid().describe(`Unique identifier for this security scan`),plugin:h({id:r().describe(`Plugin identifier`),version:r().describe(`Plugin version that was scanned`)}).describe(`Plugin that was scanned`),scannedAt:r().datetime().describe(`ISO 8601 timestamp when the scan was performed`),scanner:h({name:r().describe(`Scanner name (e.g., snyk, osv, trivy)`),version:r().describe(`Version of the scanner tool`)}).describe(`Information about the scanner tool used`),status:E([`passed`,`failed`,`warning`]).describe(`Overall result status of the security scan`),vulnerabilities:C(lU).describe(`List of vulnerabilities discovered during the scan`),summary:h({critical:P().int().min(0).default(0).describe(`Count of critical severity vulnerabilities`),high:P().int().min(0).default(0).describe(`Count of high severity vulnerabilities`),medium:P().int().min(0).default(0).describe(`Count of medium severity vulnerabilities`),low:P().int().min(0).default(0).describe(`Count of low severity vulnerabilities`),info:P().int().min(0).default(0).describe(`Count of informational severity vulnerabilities`),total:P().int().min(0).default(0).describe(`Total count of all vulnerabilities`)}).describe(`Summary counts of vulnerabilities by severity`),licenseIssues:C(h({package:r().describe(`Name of the package with a license issue`),license:r().describe(`License identifier of the package`),reason:r().describe(`Reason the license is flagged`),severity:E([`error`,`warning`,`info`]).describe(`Severity of the license compliance issue`)})).default([]).describe(`License compliance issues found during the scan`),codeQuality:h({score:P().min(0).max(100).optional().describe(`Overall code quality score from 0 to 100`),issues:C(h({type:E([`security`,`quality`,`style`]).describe(`Category of the code quality issue`),severity:E([`error`,`warning`,`info`]).describe(`Severity of the code quality issue`),message:r().describe(`Description of the code quality issue`),file:r().optional().describe(`File path where the issue was found`),line:P().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:r().datetime().optional().describe(`ISO 8601 timestamp for the next scheduled scan`)}).describe(`Result of a security scan performed on a plugin`),dU=h({id:r().describe(`Unique identifier for the security policy`),name:r().describe(`Human-readable name of the security policy`),autoScan:h({enabled:S().default(!0).describe(`Whether automatic scanning is enabled`),frequency:E([`on-publish`,`daily`,`weekly`,`monthly`]).default(`daily`).describe(`How often automatic scans are performed`)}).describe(`Automatic security scanning configuration`),thresholds:h({maxCritical:P().int().min(0).default(0).describe(`Maximum allowed critical vulnerabilities before blocking`),maxHigh:P().int().min(0).default(0).describe(`Maximum allowed high vulnerabilities before blocking`),maxMedium:P().int().min(0).default(5).describe(`Maximum allowed medium vulnerabilities before warning`)}).describe(`Vulnerability count thresholds for policy enforcement`),allowedLicenses:C(r()).default([`MIT`,`Apache-2.0`,`BSD-3-Clause`,`BSD-2-Clause`,`ISC`]).describe(`List of SPDX license identifiers that are permitted`),prohibitedLicenses:C(r()).default([`GPL-3.0`,`AGPL-3.0`]).describe(`List of SPDX license identifiers that are prohibited`),codeSigning:h({required:S().default(!1).describe(`Whether code signing is required for plugins`),allowedSigners:C(r()).default([]).describe(`List of trusted signer identities`)}).optional().describe(`Code signing requirements for plugin artifacts`),sandbox:h({networkAccess:E([`none`,`localhost`,`allowlist`,`all`]).default(`all`).describe(`Level of network access granted to the plugin`),allowedDestinations:C(r()).default([]).describe(`Permitted network destinations when using allowlist mode`),filesystemAccess:E([`none`,`read-only`,`temp-only`,`full`]).default(`full`).describe(`Level of file system access granted to the plugin`),maxMemoryMB:P().int().positive().optional().describe(`Maximum memory allocation in megabytes`),maxCPUSeconds:P().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`),fU=h({name:r().describe(`Package name or identifier`),versionConstraint:r().describe("Semver range (e.g., `^1.0.0`, `>=2.0.0 <3.0.0`)"),type:E([`required`,`optional`,`peer`,`dev`]).default(`required`).describe(`Category of the dependency relationship`),resolvedVersion:r().optional().describe(`Concrete version resolved during dependency resolution`)}).describe(`A package dependency with its version constraint`),pU=h({id:r().describe(`Unique identifier of the package`),version:r().describe(`Resolved version of the package`),dependencies:C(fU).default([]).describe(`Dependencies required by this package`),depth:P().int().min(0).describe(`Depth level in the dependency tree (0 = root)`),isDirect:S().describe(`Whether this is a direct (top-level) dependency`),metadata:h({name:r().describe(`Display name of the package`),description:r().optional().describe(`Short description of the package`),license:r().optional().describe(`SPDX license identifier of the package`),homepage:r().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`),mU=h({root:h({id:r().describe(`Identifier of the root package`),version:r().describe(`Version of the root package`)}).describe(`Root package of the dependency graph`),nodes:C(pU).describe(`All resolved package nodes in the dependency graph`),edges:C(h({from:r().describe(`Package ID`),to:r().describe(`Package ID`),constraint:r().describe(`Version constraint`)})).describe(`Directed edges representing dependency relationships`),stats:h({totalDependencies:P().int().min(0).describe(`Total number of resolved dependencies`),directDependencies:P().int().min(0).describe(`Number of direct (top-level) dependencies`),maxDepth:P().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`),hU=h({package:r().describe(`Name of the package with conflicting version requirements`),conflicts:C(h({version:r().describe(`Conflicting version of the package`),requestedBy:C(r()).describe(`Packages that require this version`),constraint:r().describe(`Semver constraint that produced this version requirement`)})).describe(`List of conflicting version requirements`),resolution:h({strategy:E([`pick-highest`,`pick-lowest`,`manual`]).describe(`Strategy used to resolve the conflict`),version:r().optional().describe(`Resolved version selected by the strategy`),reason:r().optional().describe(`Explanation of why this resolution was chosen`)}).optional().describe(`Suggested resolution for the conflict`),severity:E([`error`,`warning`,`info`]).describe(`Severity level of the dependency conflict`)}).describe(`A detected conflict between dependency version requirements`),gU=h({status:E([`success`,`conflict`,`error`]).describe(`Overall status of the dependency resolution`),graph:mU.optional().describe(`Resolved dependency graph if resolution succeeded`),conflicts:C(hU).default([]).describe(`List of dependency conflicts detected during resolution`),errors:C(h({package:r().describe(`Name of the package that caused the error`),error:r().describe(`Error message describing what went wrong`)})).default([]).describe(`Errors encountered during dependency resolution`),installOrder:C(r()).default([]).describe(`Topologically sorted list of package IDs for installation`),resolvedIn:P().int().min(0).optional().describe(`Time taken to resolve dependencies in milliseconds`)}).describe(`Result of a dependency resolution process`),_U=h({name:r().describe(`Name of the software component`),version:r().describe(`Version of the software component`),purl:r().optional().describe(`Package URL identifier`),license:r().optional().describe(`SPDX license identifier of the component`),hashes:h({sha256:r().optional().describe(`SHA-256 hash of the component artifact`),sha512:r().optional().describe(`SHA-512 hash of the component artifact`)}).optional().describe(`Cryptographic hashes for integrity verification`),supplier:h({name:r().describe(`Name of the component supplier`),url:r().url().optional().describe(`URL of the component supplier`)}).optional().describe(`Supplier information for the component`),externalRefs:C(h({type:E([`website`,`repository`,`documentation`,`issue-tracker`]).describe(`Type of external reference`),url:r().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`),vU=h({format:E([`spdx`,`cyclonedx`]).default(`cyclonedx`).describe(`SBOM standard format used`),version:r().describe(`Version of the SBOM specification`),plugin:h({id:r().describe(`Plugin identifier`),version:r().describe(`Plugin version`),name:r().describe(`Human-readable plugin name`)}).describe(`Metadata about the plugin this SBOM describes`),components:C(_U).describe(`List of software components included in the plugin`),generatedAt:r().datetime().describe(`ISO 8601 timestamp when the SBOM was generated`),generator:h({name:r().describe(`Name of the SBOM generator tool`),version:r().describe(`Version of the SBOM generator tool`)}).optional().describe(`Tool used to generate this SBOM`)}).describe(`Software Bill of Materials for a plugin`),yU=h({pluginId:r().describe(`Unique identifier of the plugin`),version:r().describe(`Version of the plugin artifact`),build:h({timestamp:r().datetime().describe(`ISO 8601 timestamp when the build was produced`),environment:h({os:r().describe(`Operating system used for the build`),arch:r().describe(`CPU architecture used for the build`),nodeVersion:r().describe(`Node.js version used for the build`)}).optional().describe(`Environment details where the build was executed`),source:h({repository:r().url().describe(`URL of the source repository`),commit:r().regex(/^[a-f0-9]{40}$/).describe(`Full SHA-1 commit hash of the source`),branch:r().optional().describe(`Branch name the build was produced from`),tag:r().optional().describe(`Git tag associated with the build`)}).optional().describe(`Source repository information for the build`),builder:h({name:r().describe(`Name of the person or system that produced the build`),email:r().email().optional().describe(`Email address of the builder`)}).optional().describe(`Identity of the builder who produced the artifact`)}).describe(`Build provenance information`),artifacts:C(h({filename:r().describe(`Name of the artifact file`),sha256:r().describe(`SHA-256 hash of the artifact`),size:P().int().positive().describe(`Size of the artifact in bytes`)})).describe(`List of build artifacts with integrity hashes`),signatures:C(h({algorithm:E([`rsa`,`ecdsa`,`ed25519`]).describe(`Cryptographic algorithm used for signing`),publicKey:r().describe(`Public key used to verify the signature`),signature:r().describe(`Digital signature value`),signedBy:r().describe(`Identity of the signer`),timestamp:r().datetime().describe(`ISO 8601 timestamp when the signature was created`)})).default([]).describe(`Cryptographic signatures for the plugin artifact`),attestations:C(h({type:E([`code-review`,`security-scan`,`test-results`,`ci-build`]).describe(`Type of attestation`),status:E([`passed`,`failed`]).describe(`Result status of the attestation`),url:r().url().optional().describe(`URL with details about the attestation`),timestamp:r().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`),bU=h({pluginId:r().describe(`Unique identifier of the plugin`),score:P().min(0).max(100).describe(`Overall trust score from 0 to 100`),components:h({vendorReputation:P().min(0).max(100).describe(`Vendor reputation score from 0 to 100`),securityScore:P().min(0).max(100).describe(`Security scan results score from 0 to 100`),codeQuality:P().min(0).max(100).describe(`Code quality score from 0 to 100`),communityScore:P().min(0).max(100).describe(`Community engagement score from 0 to 100`),maintenanceScore:P().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:E([`verified`,`trusted`,`neutral`,`untrusted`,`blocked`]).describe(`Computed trust level based on the overall score`),badges:C(E([`official`,`verified-vendor`,`security-scanned`,`code-signed`,`open-source`,`popular`])).default([]).describe(`Verification badges earned by the plugin`),updatedAt:r().datetime().describe(`ISO 8601 timestamp when the trust score was last updated`)}).describe(`Trust score and verification status for a plugin`),uCe={VulnerabilitySeverity:cU,SecurityVulnerability:lU,SecurityScanResult:uU,SecurityPolicy:dU,PackageDependency:fU,DependencyGraphNode:pU,DependencyGraph:mU,DependencyConflict:hU,DependencyResolutionResult:gU,SBOMEntry:_U,SBOM:vU,PluginProvenance:yU,PluginTrustScore:bU};DA({},{AnalyticsTimeRangeSchema:()=>OU,AppDiscoveryRequestSchema:()=>PCe,AppDiscoveryResponseSchema:()=>FCe,AppSubscriptionSchema:()=>ICe,ArtifactDownloadResponseSchema:()=>fCe,ArtifactReferenceSchema:()=>SU,CreateListingRequestSchema:()=>bCe,CuratedCollectionSchema:()=>DCe,FeaturedListingSchema:()=>ECe,InstalledAppSummarySchema:()=>zU,ListInstalledAppsRequestSchema:()=>LCe,ListInstalledAppsResponseSchema:()=>RCe,ListReviewsRequestSchema:()=>MCe,ListReviewsResponseSchema:()=>NCe,ListingActionRequestSchema:()=>SCe,ListingStatusSchema:()=>wU,MarketplaceCategorySchema:()=>CU,MarketplaceHealthMetricsSchema:()=>kCe,MarketplaceInstallRequestSchema:()=>gCe,MarketplaceInstallResponseSchema:()=>_Ce,MarketplaceListingSchema:()=>EU,MarketplaceSearchRequestSchema:()=>mCe,MarketplaceSearchResponseSchema:()=>hCe,PackageSubmissionSchema:()=>pCe,PolicyActionSchema:()=>OCe,PolicyViolationTypeSchema:()=>NU,PricingModelSchema:()=>TU,PublisherProfileSchema:()=>vCe,PublisherSchema:()=>dCe,PublisherVerificationSchema:()=>xU,PublishingAnalyticsRequestSchema:()=>CCe,PublishingAnalyticsResponseSchema:()=>wCe,RecommendationReasonSchema:()=>IU,RecommendedAppSchema:()=>LU,RejectionReasonSchema:()=>MU,ReleaseChannelSchema:()=>DU,ReviewCriterionSchema:()=>AU,ReviewDecisionSchema:()=>jU,ReviewModerationStatusSchema:()=>PU,SubmissionReviewSchema:()=>TCe,SubmitReviewRequestSchema:()=>jCe,SubscriptionStatusSchema:()=>RU,TimeSeriesPointSchema:()=>kU,TrendingListingSchema:()=>ACe,UpdateListingRequestSchema:()=>xCe,UserReviewSchema:()=>FU,VersionReleaseSchema:()=>yCe});var xU=E([`unverified`,`pending`,`verified`,`trusted`,`partner`]).describe(`Publisher verification status`),dCe=h({id:r().describe(`Publisher ID`),name:r().describe(`Publisher display name`),type:E([`individual`,`organization`]).describe(`Publisher type`),verification:xU.default(`unverified`).describe(`Publisher verification status`),email:r().email().optional().describe(`Contact email`),website:r().url().optional().describe(`Publisher website`),logoUrl:r().url().optional().describe(`Publisher logo URL`),description:r().optional().describe(`Publisher description`),registeredAt:r().datetime().optional().describe(`Publisher registration timestamp`)}).describe(`Developer or organization that publishes packages`),SU=h({url:r().url().describe(`Artifact download URL`),sha256:r().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum`),size:P().int().positive().describe(`Artifact size in bytes`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Artifact format`),uploadedAt:r().datetime().describe(`Upload timestamp`)}).describe(`Reference to a downloadable package artifact`),fCe=h({downloadUrl:r().url().describe(`Artifact download URL (may be pre-signed)`),sha256:r().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum for verification`),size:P().int().positive().describe(`Artifact size in bytes`),format:E([`tgz`,`zip`]).describe(`Artifact format`),expiresAt:r().datetime().optional().describe(`URL expiration timestamp for pre-signed URLs`)}).describe(`Artifact download response with integrity metadata`),CU=E([`crm`,`erp`,`hr`,`finance`,`project`,`collaboration`,`analytics`,`integration`,`automation`,`ai`,`security`,`developer-tools`,`ui-theme`,`storage`,`other`]).describe(`Marketplace package category`),wU=E([`draft`,`submitted`,`in-review`,`approved`,`published`,`rejected`,`suspended`,`deprecated`,`unlisted`]).describe(`Marketplace listing status`),TU=E([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).describe(`Package pricing model`),EU=h({id:r().describe(`Listing ID (matches package manifest ID)`),packageId:r().describe(`Package identifier`),publisherId:r().describe(`Publisher ID`),status:wU.default(`draft`).describe(`Publication state: draft, published, under-review, suspended, deprecated, or unlisted`),name:r().describe(`Display name`),tagline:r().max(120).optional().describe(`Short tagline (max 120 chars)`),description:r().optional().describe(`Full description (Markdown)`),category:CU.describe(`Package category`),tags:C(r()).optional().describe(`Search tags`),iconUrl:r().url().optional().describe(`Package icon URL`),screenshots:C(h({url:r().url(),caption:r().optional()})).optional().describe(`Screenshots`),documentationUrl:r().url().optional().describe(`Documentation URL`),supportUrl:r().url().optional().describe(`Support URL`),repositoryUrl:r().url().optional().describe(`Source repository URL`),pricing:TU.default(`free`).describe(`Pricing model`),priceInCents:P().int().min(0).optional().describe(`Price in cents (e.g. 999 = $9.99)`),latestVersion:r().describe(`Latest published version`),minPlatformVersion:r().optional().describe(`Minimum ObjectStack platform version`),versions:C(h({version:r().describe(`Version string`),releaseDate:r().datetime().describe(`Release date`),releaseNotes:r().optional().describe(`Release notes`),minPlatformVersion:r().optional().describe(`Minimum platform version`),deprecated:S().default(!1).describe(`Whether this version is deprecated`),artifact:SU.optional().describe(`Downloadable artifact for this version`)})).optional().describe(`Published versions`),stats:h({totalInstalls:P().int().min(0).default(0).describe(`Total installs`),activeInstalls:P().int().min(0).default(0).describe(`Active installs`),averageRating:P().min(0).max(5).optional().describe(`Average user rating (0-5)`),totalRatings:P().int().min(0).default(0).describe(`Total ratings count`),totalReviews:P().int().min(0).default(0).describe(`Total reviews count`)}).optional().describe(`Aggregate marketplace statistics`),publishedAt:r().datetime().optional().describe(`First published timestamp`),updatedAt:r().datetime().optional().describe(`Last updated timestamp`)}).describe(`Public-facing package listing on the marketplace`),pCe=h({id:r().describe(`Submission ID`),packageId:r().describe(`Package identifier`),version:r().describe(`Version being submitted`),publisherId:r().describe(`Publisher submitting`),status:E([`pending`,`scanning`,`in-review`,`changes-requested`,`approved`,`rejected`]).default(`pending`).describe(`Review status`),artifactUrl:r().describe(`Package artifact URL for review`),releaseNotes:r().optional().describe(`Release notes for this version`),isNewListing:S().default(!1).describe(`Whether this is a new listing submission`),scanResults:h({passed:S(),securityScore:P().min(0).max(100).optional(),compatibilityCheck:S().optional(),issues:C(h({severity:E([`critical`,`high`,`medium`,`low`,`info`]),message:r(),file:r().optional(),line:P().optional()})).optional()}).optional().describe(`Automated scan results`),reviewerNotes:r().optional().describe(`Notes from the platform reviewer`),submittedAt:r().datetime().optional().describe(`Submission timestamp`),reviewedAt:r().datetime().optional().describe(`Review completion timestamp`)}).describe(`Developer submission of a package version for review`),mCe=h({query:r().optional().describe(`Full-text search query`),category:CU.optional().describe(`Filter by category`),tags:C(r()).optional().describe(`Filter by tags`),pricing:TU.optional().describe(`Filter by pricing model`),publisherVerification:xU.optional().describe(`Filter by publisher verification level`),sortBy:E([`relevance`,`popularity`,`rating`,`newest`,`updated`,`name`]).default(`relevance`).describe(`Sort field`),sortDirection:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(100).default(20).describe(`Items per page`),platformVersion:r().optional().describe(`Filter by platform version compatibility`)}).describe(`Marketplace search request`),hCe=h({items:C(EU).describe(`Search result listings`),total:P().int().min(0).describe(`Total matching results`),page:P().int().min(1).describe(`Current page number`),pageSize:P().int().min(1).describe(`Items per page`),facets:h({categories:C(h({category:CU,count:P().int().min(0)})).optional(),pricing:C(h({model:TU,count:P().int().min(0)})).optional()}).optional().describe(`Aggregation facets for refining search`)}).describe(`Marketplace search response`),gCe=h({listingId:r().describe(`Marketplace listing ID`),version:r().optional().describe(`Version to install`),licenseKey:r().optional().describe(`License key for paid packages`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),artifactRef:SU.optional().describe(`Artifact reference for direct installation`),tenantId:r().optional().describe(`Tenant identifier`)}).describe(`Install from marketplace request`),_Ce=h({success:S().describe(`Whether installation succeeded`),packageId:r().optional().describe(`Installed package identifier`),version:r().optional().describe(`Installed version`),message:r().optional().describe(`Installation status message`)}).describe(`Install from marketplace response`),vCe=h({organizationId:r().describe(`Identity Organization ID`),publisherId:r().describe(`Marketplace publisher ID`),verification:xU.default(`unverified`),agreementVersion:r().optional().describe(`Accepted developer agreement version`),website:r().url().optional().describe(`Publisher website`),supportEmail:r().email().optional().describe(`Publisher support email`),registeredAt:r().datetime()}),DU=E([`alpha`,`beta`,`rc`,`stable`]),yCe=h({version:r().describe(`Semver version (e.g., 2.1.0-beta.1)`),channel:DU.default(`stable`),releaseNotes:r().optional().describe(`Release notes (Markdown)`),changelog:C(h({type:E([`added`,`changed`,`fixed`,`removed`,`deprecated`,`security`]),description:r()})).optional().describe(`Structured changelog entries`),minPlatformVersion:r().optional(),artifactUrl:r().optional().describe(`Built package artifact URL`),artifactChecksum:r().optional().describe(`SHA-256 checksum`),deprecated:S().default(!1),deprecationMessage:r().optional(),releasedAt:r().datetime().optional()}),bCe=h({packageId:r().describe(`Package identifier`),name:r().describe(`App display name`),tagline:r().max(120).optional(),description:r().optional(),category:r().describe(`Marketplace category`),tags:C(r()).optional(),iconUrl:r().url().optional(),screenshots:C(h({url:r().url(),caption:r().optional()})).optional(),documentationUrl:r().url().optional(),supportUrl:r().url().optional(),repositoryUrl:r().url().optional(),pricing:E([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).default(`free`),priceInCents:P().int().min(0).optional()}),xCe=h({listingId:r().describe(`Listing ID to update`),name:r().optional(),tagline:r().max(120).optional(),description:r().optional(),category:r().optional(),tags:C(r()).optional(),iconUrl:r().url().optional(),screenshots:C(h({url:r().url(),caption:r().optional()})).optional(),documentationUrl:r().url().optional(),supportUrl:r().url().optional(),repositoryUrl:r().url().optional(),pricing:E([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).optional(),priceInCents:P().int().min(0).optional()}),SCe=h({listingId:r().describe(`Listing ID`),action:E([`submit`,`unlist`,`deprecate`,`reactivate`]).describe(`Action to perform on listing`),reason:r().optional()}),OU=E([`last_7d`,`last_30d`,`last_90d`,`last_365d`,`all_time`]),CCe=h({listingId:r().describe(`Listing to get analytics for`),timeRange:OU.default(`last_30d`),metrics:C(E([`installs`,`uninstalls`,`active_installs`,`ratings`,`revenue`,`page_views`])).optional().describe(`Metrics to include (default: all)`)}),kU=h({date:r(),value:P()}),wCe=h({listingId:r(),timeRange:OU,summary:h({totalInstalls:P().int().min(0),activeInstalls:P().int().min(0),totalUninstalls:P().int().min(0),averageRating:P().min(0).max(5).optional(),totalRatings:P().int().min(0),totalRevenue:P().min(0).optional().describe(`Revenue in cents`),pageViews:P().int().min(0)}),timeSeries:d(r(),C(kU)).optional().describe(`Time series keyed by metric name`),ratingDistribution:h({1:P().int().min(0).default(0),2:P().int().min(0).default(0),3:P().int().min(0).default(0),4:P().int().min(0).default(0),5:P().int().min(0).default(0)}).optional()}),AU=h({id:r().describe(`Criterion ID`),category:E([`security`,`performance`,`quality`,`ux`,`documentation`,`policy`,`compatibility`]),description:r(),required:S().default(!0),passed:S().optional(),notes:r().optional()}),jU=E([`approved`,`rejected`,`changes-requested`]),MU=E([`security-vulnerability`,`policy-violation`,`quality-below-standard`,`misleading-metadata`,`incompatible`,`duplicate`,`insufficient-documentation`,`other`]),TCe=h({id:r().describe(`Review ID`),submissionId:r().describe(`Submission being reviewed`),reviewerId:r().describe(`Platform reviewer ID`),decision:jU.optional().describe(`Final decision`),criteria:C(AU).optional().describe(`Review checklist results`),rejectionReasons:C(MU).optional(),feedback:r().optional().describe(`Detailed review feedback (Markdown)`),internalNotes:r().optional().describe(`Internal reviewer notes`),startedAt:r().datetime().optional(),completedAt:r().datetime().optional()}),ECe=h({listingId:r().describe(`Featured listing ID`),priority:P().int().min(0).default(0),bannerUrl:r().url().optional(),editorialNote:r().optional(),startDate:r().datetime(),endDate:r().datetime().optional(),active:S().default(!0)}),DCe=h({id:r().describe(`Collection ID`),name:r().describe(`Collection name`),description:r().optional(),coverImageUrl:r().url().optional(),listingIds:C(r()).min(1).describe(`Ordered listing IDs`),published:S().default(!1),sortOrder:P().int().min(0).default(0),createdBy:r().optional(),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional()}),NU=E([`malware`,`data-harvesting`,`spam`,`copyright`,`inappropriate-content`,`terms-of-service`,`security-risk`,`abandoned`]),OCe=h({id:r().describe(`Action ID`),listingId:r().describe(`Target listing ID`),violationType:NU,action:E([`warning`,`suspend`,`takedown`,`restrict`]),reason:r().describe(`Explanation of the violation`),actionBy:r().describe(`Admin user ID`),actionAt:r().datetime(),resolution:r().optional(),resolved:S().default(!1)}),kCe=h({totalListings:P().int().min(0),listingsByStatus:d(r(),P().int().min(0)).optional(),listingsByCategory:d(r(),P().int().min(0)).optional(),totalPublishers:P().int().min(0),verifiedPublishers:P().int().min(0),totalInstalls:P().int().min(0),averageReviewTime:P().min(0).optional(),pendingReviews:P().int().min(0),listingsByPricing:d(r(),P().int().min(0)).optional(),snapshotAt:r().datetime()}),ACe=h({listingId:r(),rank:P().int().min(1),trendScore:P().min(0),installVelocity:P().min(0),period:r()}),PU=E([`pending`,`approved`,`flagged`,`rejected`]),FU=h({id:r().describe(`Review ID`),listingId:r().describe(`Listing being reviewed`),userId:r().describe(`Review author user ID`),displayName:r().optional().describe(`Reviewer display name`),rating:P().int().min(1).max(5).describe(`Star rating (1-5)`),title:r().max(200).optional().describe(`Review title`),body:r().max(5e3).optional().describe(`Review text`),appVersion:r().optional().describe(`App version being reviewed`),moderationStatus:PU.default(`pending`),helpfulCount:P().int().min(0).default(0),publisherResponse:h({body:r(),respondedAt:r().datetime()}).optional().describe(`Publisher response to review`),submittedAt:r().datetime(),updatedAt:r().datetime().optional()}),jCe=h({listingId:r().describe(`Listing to review`),rating:P().int().min(1).max(5).describe(`Star rating`),title:r().max(200).optional(),body:r().max(5e3).optional()}),MCe=h({listingId:r().describe(`Listing to get reviews for`),sortBy:E([`newest`,`oldest`,`highest`,`lowest`,`most-helpful`]).default(`newest`),rating:P().int().min(1).max(5).optional(),page:P().int().min(1).default(1),pageSize:P().int().min(1).max(50).default(10)}),NCe=h({items:C(FU),total:P().int().min(0),page:P().int().min(1),pageSize:P().int().min(1),ratingSummary:h({averageRating:P().min(0).max(5),totalRatings:P().int().min(0),distribution:h({1:P().int().min(0).default(0),2:P().int().min(0).default(0),3:P().int().min(0).default(0),4:P().int().min(0).default(0),5:P().int().min(0).default(0)})}).optional()}),IU=E([`popular-in-category`,`similar-users`,`complements-installed`,`trending`,`new-release`,`editor-pick`]),LU=h({listingId:r(),name:r(),tagline:r().optional(),iconUrl:r().url().optional(),category:CU,pricing:TU,averageRating:P().min(0).max(5).optional(),activeInstalls:P().int().min(0).optional(),reason:IU}),PCe=h({tenantId:r().optional(),categories:C(CU).optional(),platformVersion:r().optional(),limit:P().int().min(1).max(50).default(10)}),FCe=h({featured:C(LU).optional(),recommended:C(LU).optional(),trending:C(LU).optional(),newArrivals:C(LU).optional(),collections:C(h({id:r(),name:r(),description:r().optional(),coverImageUrl:r().url().optional(),apps:C(LU)})).optional()}),RU=E([`active`,`trialing`,`past-due`,`cancelled`,`expired`]),ICe=h({id:r().describe(`Subscription ID`),listingId:r().describe(`App listing ID`),tenantId:r().describe(`Customer tenant ID`),status:RU,licenseKey:r().optional(),plan:r().optional().describe(`Subscription plan name`),billingCycle:E([`monthly`,`annual`]).optional(),priceInCents:P().int().min(0).optional(),currentPeriodStart:r().datetime().optional(),currentPeriodEnd:r().datetime().optional(),trialEndDate:r().datetime().optional(),autoRenew:S().default(!0),createdAt:r().datetime()}),zU=h({listingId:r(),packageId:r(),name:r(),iconUrl:r().url().optional(),installedVersion:r(),latestVersion:r().optional(),updateAvailable:S().default(!1),enabled:S().default(!0),subscriptionStatus:RU.optional(),installedAt:r().datetime()}),LCe=h({tenantId:r().optional(),enabled:S().optional(),updateAvailable:S().optional(),sortBy:E([`name`,`installed-date`,`updated-date`]).default(`name`),page:P().int().min(1).default(1),pageSize:P().int().min(1).max(100).default(20)}),RCe=h({items:C(zU),total:P().int().min(0),page:P().int().min(1),pageSize:P().int().min(1)});DA({},{TestActionSchema:()=>VU,TestActionTypeSchema:()=>BU,TestAssertionSchema:()=>UU,TestAssertionTypeSchema:()=>HU,TestContextSchema:()=>zCe,TestScenarioSchema:()=>GU,TestStepSchema:()=>WU,TestSuiteSchema:()=>BCe});var zCe=d(r(),u()).describe(`Initial context or variables for the test`),BU=E([`create_record`,`update_record`,`delete_record`,`read_record`,`query_records`,`api_call`,`run_script`,`wait`]).describe(`Type of test action to perform`),VU=h({type:BU.describe(`The action type to execute`),target:r().describe(`Target Object, API Endpoint, or Function Name`),payload:d(r(),u()).optional().describe(`Data to send or use`),user:r().optional().describe(`Run as specific user/role for impersonation testing`)}).describe(`A single test action to execute against the system`),HU=E([`equals`,`not_equals`,`contains`,`not_contains`,`is_null`,`not_null`,`gt`,`gte`,`lt`,`lte`,`error`]).describe(`Comparison operator for test assertions`),UU=h({field:r().describe(`Field path in the result to check (e.g. "body.data.0.status")`),operator:HU.describe(`Comparison operator to use`),expectedValue:u().describe(`Expected value to compare against`)}).describe(`A test assertion that validates the result of a test action`),WU=h({name:r().describe(`Step name for identification in test reports`),description:r().optional().describe(`Human-readable description of what this step tests`),action:VU.describe(`The action to execute in this step`),assertions:C(UU).optional().describe(`Assertions to validate after the action completes`),capture:d(r(),r()).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`),GU=h({id:r().describe(`Unique scenario identifier`),name:r().describe(`Scenario name for test reports`),description:r().optional().describe(`Detailed description of the test scenario`),tags:C(r()).optional().describe(`Tags for filtering and categorization (e.g. "critical", "regression", "crm")`),setup:C(WU).optional().describe(`Steps to run before main test (preconditions)`),steps:C(WU).describe(`Main test sequence to execute`),teardown:C(WU).optional().describe(`Steps to cleanup after test execution`),requires:h({params:C(r()).optional().describe(`Required environment variables or parameters`),plugins:C(r()).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`),BCe=h({name:r().describe(`Test suite name`),scenarios:C(GU).describe(`List of test scenarios in this suite`)}).describe(`A collection of test scenarios grouped into a test suite`);DA({},{AUTH_CONSTANTS:()=>KCe,AUTH_ERROR_CODES:()=>qCe,AccountSchema:()=>HCe,ApiKeySchema:()=>GCe,InvitationSchema:()=>XCe,InvitationStatus:()=>qU,MemberSchema:()=>YCe,OrganizationSchema:()=>JCe,RoleSchema:()=>KU,SCIM:()=>ewe,SCIMAddressSchema:()=>$U,SCIMBulkOperationSchema:()=>oW,SCIMBulkRequestSchema:()=>twe,SCIMBulkResponseOperationSchema:()=>sW,SCIMBulkResponseSchema:()=>nwe,SCIMEmailSchema:()=>ZU,SCIMEnterpriseUserSchema:()=>tW,SCIMErrorSchema:()=>QCe,SCIMGroupReferenceSchema:()=>eW,SCIMGroupSchema:()=>iW,SCIMListResponseSchema:()=>ZCe,SCIMMemberReferenceSchema:()=>rW,SCIMMetaSchema:()=>YU,SCIMNameSchema:()=>XU,SCIMPatchOperationSchema:()=>aW,SCIMPatchRequestSchema:()=>$Ce,SCIMPhoneNumberSchema:()=>QU,SCIMUserSchema:()=>nW,SCIM_SCHEMAS:()=>JU,SessionSchema:()=>UCe,UserSchema:()=>VCe,VerificationTokenSchema:()=>WCe});var VCe=h({id:r().describe(`Unique user identifier`),email:r().email().describe(`User email address`),emailVerified:S().default(!1).describe(`Whether email is verified`),name:r().optional().describe(`User display name`),image:r().url().optional().describe(`Profile image URL`),createdAt:r().datetime().describe(`Account creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),HCe=h({id:r().describe(`Unique account identifier`),userId:r().describe(`Associated user ID`),type:E([`oauth`,`oidc`,`email`,`credentials`,`saml`,`ldap`]).describe(`Account type`),provider:r().describe(`Provider name`),providerAccountId:r().describe(`Provider account ID`),refreshToken:r().optional().describe(`OAuth refresh token`),accessToken:r().optional().describe(`OAuth access token`),expiresAt:P().optional().describe(`Token expiry timestamp (Unix)`),tokenType:r().optional().describe(`OAuth token type`),scope:r().optional().describe(`OAuth scope`),idToken:r().optional().describe(`OAuth ID token`),sessionState:r().optional().describe(`Session state`),createdAt:r().datetime().describe(`Account creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),UCe=h({id:r().describe(`Unique session identifier`),sessionToken:r().describe(`Session token`),userId:r().describe(`Associated user ID`),activeOrganizationId:r().optional().describe(`Active organization ID for context switching`),expires:r().datetime().describe(`Session expiry timestamp`),createdAt:r().datetime().describe(`Session creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`),ipAddress:r().optional().describe(`IP address`),userAgent:r().optional().describe(`User agent string`),fingerprint:r().optional().describe(`Device fingerprint`)}),WCe=h({identifier:r().describe(`Token identifier (email or phone)`),token:r().describe(`Verification token`),expires:r().datetime().describe(`Token expiry timestamp`),createdAt:r().datetime().describe(`Token creation timestamp`)}),GCe=h({id:r().describe(`API key identifier`),name:r().describe(`API key display name`),start:r().optional().describe(`Key prefix for identification`),prefix:r().optional().describe(`Custom key prefix`),userId:r().describe(`Owner user ID`),organizationId:r().optional().describe(`Scoped organization ID`),expiresAt:r().datetime().optional().describe(`Expiration timestamp`),createdAt:r().datetime().describe(`Creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`),lastUsedAt:r().datetime().optional().describe(`Last used timestamp`),lastRefetchAt:r().datetime().optional().describe(`Last refetch timestamp`),enabled:S().default(!0).describe(`Whether the key is active`),rateLimitEnabled:S().optional().describe(`Whether rate limiting is enabled`),rateLimitTimeWindow:P().int().min(0).optional().describe(`Rate limit window (ms)`),rateLimitMax:P().int().min(0).optional().describe(`Max requests per window`),remaining:P().int().min(0).optional().describe(`Remaining requests`),permissions:d(r(),S()).optional().describe(`Granular permission flags`),scopes:C(r()).optional().describe(`High-level access scopes`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),KCe={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`},qCe={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`},KU=h({name:kA.describe(`Unique role name (lowercase snake_case)`),label:r().describe(`Display label (e.g. VP of Sales)`),parent:r().optional().describe(`Parent Role ID (Reports To)`),description:r().optional()}),JCe=h({id:r().describe(`Unique organization identifier`),name:r().describe(`Organization display name`),slug:r().regex(/^[a-z0-9_-]+$/).describe(`Unique URL-friendly slug (lowercase alphanumeric, hyphens, underscores)`),logo:r().url().optional().describe(`Organization logo URL`),metadata:d(r(),u()).optional().describe(`Custom metadata`),createdAt:r().datetime().describe(`Organization creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),YCe=h({id:r().describe(`Unique member identifier`),organizationId:r().describe(`Organization ID`),userId:r().describe(`User ID`),role:r().describe(`Member role (e.g., owner, admin, member, guest)`),createdAt:r().datetime().describe(`Member creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),qU=E([`pending`,`accepted`,`rejected`,`expired`]),XCe=h({id:r().describe(`Unique invitation identifier`),organizationId:r().describe(`Organization ID`),email:r().email().describe(`Invitee email address`),role:r().describe(`Role to assign upon acceptance`),status:qU.default(`pending`).describe(`Invitation status`),expiresAt:r().datetime().describe(`Invitation expiry timestamp`),inviterId:r().describe(`User ID of the inviter`),createdAt:r().datetime().describe(`Invitation creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),JU={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`},YU=h({resourceType:r().optional().describe(`Resource type`),created:r().datetime().optional().describe(`Creation timestamp`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),location:r().url().optional().describe(`Resource location URI`),version:r().optional().describe(`Entity tag (ETag) for concurrency control`)}),XU=h({formatted:r().optional().describe(`Formatted full name`),familyName:r().optional().describe(`Family name (last name)`),givenName:r().optional().describe(`Given name (first name)`),middleName:r().optional().describe(`Middle name`),honorificPrefix:r().optional().describe(`Honorific prefix (Mr., Ms., Dr.)`),honorificSuffix:r().optional().describe(`Honorific suffix (Jr., Sr.)`)}),ZU=h({value:r().email().describe(`Email address`),type:E([`work`,`home`,`other`]).optional().describe(`Email type`),display:r().optional().describe(`Display label`),primary:S().optional().default(!1).describe(`Primary email indicator`)}),QU=h({value:r().describe(`Phone number`),type:E([`work`,`home`,`mobile`,`fax`,`pager`,`other`]).optional().describe(`Phone number type`),display:r().optional().describe(`Display label`),primary:S().optional().default(!1).describe(`Primary phone indicator`)}),$U=h({formatted:r().optional().describe(`Formatted address`),streetAddress:r().optional().describe(`Street address`),locality:r().optional().describe(`City/Locality`),region:r().optional().describe(`State/Region`),postalCode:r().optional().describe(`Postal code`),country:r().optional().describe(`Country`),type:E([`work`,`home`,`other`]).optional().describe(`Address type`),primary:S().optional().default(!1).describe(`Primary address indicator`)}),eW=h({value:r().describe(`Group ID`),$ref:r().url().optional().describe(`URI reference to the group`),display:r().optional().describe(`Group display name`),type:E([`direct`,`indirect`]).optional().describe(`Membership type`)}),tW=h({employeeNumber:r().optional().describe(`Employee number`),costCenter:r().optional().describe(`Cost center`),organization:r().optional().describe(`Organization`),division:r().optional().describe(`Division`),department:r().optional().describe(`Department`),manager:h({value:r().describe(`Manager ID`),$ref:r().url().optional().describe(`Manager URI`),displayName:r().optional().describe(`Manager name`)}).optional().describe(`Manager reference`)}),nW=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.USER),`Must include core User schema URI`).default([JU.USER]).describe(`SCIM schema URIs (must include User schema)`),id:r().optional().describe(`Unique resource identifier`),externalId:r().optional().describe(`External identifier from client system`),userName:r().describe(`Unique username (REQUIRED)`),name:XU.optional().describe(`Structured name components`),displayName:r().optional().describe(`Display name for UI`),nickName:r().optional().describe(`Nickname`),profileUrl:r().url().optional().describe(`Profile page URL`),title:r().optional().describe(`Job title`),userType:r().optional().describe(`User type (employee, contractor)`),preferredLanguage:r().optional().describe(`Preferred language (ISO 639-1)`),locale:r().optional().describe(`Locale (e.g., en-US)`),timezone:r().optional().describe(`Timezone`),active:S().optional().default(!0).describe(`Account active status`),password:r().optional().describe(`Password (write-only)`),emails:C(ZU).optional().describe(`Email addresses`),phoneNumbers:C(QU).optional().describe(`Phone numbers`),ims:C(h({value:r(),type:r().optional(),primary:S().optional()})).optional().describe(`IM addresses`),photos:C(h({value:r().url(),type:E([`photo`,`thumbnail`]).optional(),primary:S().optional()})).optional().describe(`Photo URLs`),addresses:C($U).optional().describe(`Physical addresses`),groups:C(eW).optional().describe(`Group memberships`),entitlements:C(h({value:r(),type:r().optional(),primary:S().optional()})).optional().describe(`Entitlements`),roles:C(h({value:r(),type:r().optional(),primary:S().optional()})).optional().describe(`Roles`),x509Certificates:C(h({value:r(),type:r().optional(),primary:S().optional()})).optional().describe(`X509 certificates`),meta:YU.optional().describe(`Resource metadata`),[JU.ENTERPRISE_USER]:tW.optional().describe(`Enterprise user attributes`)}).superRefine((e,t)=>{e[JU.ENTERPRISE_USER]!=null&&((e.schemas||[]).includes(JU.ENTERPRISE_USER)||t.addIssue({code:de.custom,path:[`schemas`],message:`schemas must include "${JU.ENTERPRISE_USER}" when enterprise user extension attributes are present`}))}),rW=h({value:r().describe(`Member ID`),$ref:r().url().optional().describe(`URI reference to the member`),type:E([`User`,`Group`]).optional().describe(`Member type`),display:r().optional().describe(`Member display name`)}),iW=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.GROUP),`Must include core Group schema URI`).default([JU.GROUP]).describe(`SCIM schema URIs (must include Group schema)`),id:r().optional().describe(`Unique resource identifier`),externalId:r().optional().describe(`External identifier from client system`),displayName:r().describe(`Group display name (REQUIRED)`),members:C(rW).optional().describe(`Group members`),meta:YU.optional().describe(`Resource metadata`)}),ZCe=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.LIST_RESPONSE),{message:`schemas must include ${JU.LIST_RESPONSE}`}).default([JU.LIST_RESPONSE]).describe(`SCIM schema URIs`),totalResults:P().int().min(0).describe(`Total results count`),Resources:C(l([nW,iW,d(r(),u())])).describe(`Resources array (Users, Groups, or custom resources)`),startIndex:P().int().min(1).optional().describe(`Start index (1-based)`),itemsPerPage:P().int().min(0).optional().describe(`Items per page`)}),QCe=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.ERROR),{message:`schemas must include ${JU.ERROR}`}).default([JU.ERROR]).describe(`SCIM schema URIs`),status:P().int().min(400).max(599).describe(`HTTP status code`),scimType:E([`invalidFilter`,`tooMany`,`uniqueness`,`mutability`,`invalidSyntax`,`invalidPath`,`noTarget`,`invalidValue`,`invalidVers`,`sensitive`]).optional().describe(`SCIM error type`),detail:r().optional().describe(`Error detail message`)}),aW=h({op:E([`add`,`remove`,`replace`]).describe(`Operation type`),path:r().optional().describe(`Attribute path (optional for add)`),value:u().optional().describe(`Value to set`)}),$Ce=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.PATCH_OP),{message:`SCIM PATCH requests must include the PatchOp schema URI`}).default([JU.PATCH_OP]).describe(`SCIM schema URIs`),Operations:C(aW).min(1).describe(`Patch operations`)}),ewe={user:(e,t,n,r)=>({schemas:[JU.USER],userName:e,emails:[{value:t,type:`work`,primary:!0}],name:{givenName:n,familyName:r},active:!0}),group:(e,t)=>({schemas:[JU.GROUP],displayName:e,members:t||[]}),listResponse:(e,t)=>({schemas:[JU.LIST_RESPONSE],totalResults:t??e.length,Resources:e,startIndex:1,itemsPerPage:e.length}),error:(e,t,n)=>({schemas:[JU.ERROR],status:e,detail:t,scimType:n})},oW=h({method:E([`POST`,`PUT`,`PATCH`,`DELETE`]).describe(`HTTP method for the bulk operation`),path:r().describe(`Resource endpoint path (e.g. /Users, /Groups/{id})`),bulkId:r().optional().describe(`Client-assigned ID for cross-referencing between operations`),data:d(r(),u()).optional().describe(`Request body for POST/PUT/PATCH operations`),version:r().optional().describe(`ETag for optimistic concurrency control`)}),twe=h({schemas:C(m(JU.BULK_REQUEST)).default([JU.BULK_REQUEST]).describe(`SCIM schema URIs (BulkRequest)`),operations:C(oW).min(1).describe(`Bulk operations to execute (minimum 1)`),failOnErrors:P().int().optional().describe(`Stop processing after this many errors`)}),sW=h({method:E([`POST`,`PUT`,`PATCH`,`DELETE`]).describe(`HTTP method that was executed`),bulkId:r().optional().describe(`Client-assigned bulk operation ID`),location:r().optional().describe(`URL of the created or modified resource`),status:r().describe(`HTTP status code as string (e.g. "201", "400")`),response:u().optional().describe(`Response body (typically present for errors)`)}),nwe=h({schemas:C(m(JU.BULK_RESPONSE)).default([JU.BULK_RESPONSE]).describe(`SCIM schema URIs (BulkResponse)`),operations:C(sW).describe(`Results for each bulk operation`)});DA({},{AICodeReviewResultSchema:()=>gwe,AIKnowledgeSchema:()=>uW,AIModelConfigSchema:()=>cW,AIOperationCostSchema:()=>Pwe,AIOpsAgentConfigSchema:()=>wwe,AIOrchestrationExecutionResultSchema:()=>$we,AIOrchestrationSchema:()=>Zwe,AIOrchestrationTriggerSchema:()=>nK,AITaskSchema:()=>iK,AITaskTypeSchema:()=>rK,AIToolSchema:()=>lW,AgentActionResultSchema:()=>zW,AgentActionSchema:()=>MW,AgentActionSequenceResultSchema:()=>cwe,AgentActionSequenceSchema:()=>swe,AgentCommunicationProtocolSchema:()=>cK,AgentGroupMemberSchema:()=>uK,AgentGroupRoleSchema:()=>lK,AgentSchema:()=>mW,AnomalyDetectionConfigSchema:()=>QW,AutoScalingPolicySchema:()=>tG,BatchAIOrchestrationExecutionSchema:()=>Qwe,BillingPeriodSchema:()=>kG,BudgetLimitSchema:()=>Lwe,BudgetStatusSchema:()=>jG,BudgetTypeSchema:()=>AG,CICDPipelineConfigSchema:()=>WW,ChunkingStrategySchema:()=>BG,CodeContentSchema:()=>bK,CodeGenerationConfigSchema:()=>VW,CodeGenerationRequestSchema:()=>pwe,CodeGenerationTargetSchema:()=>BW,ComponentActionParamsSchema:()=>jW,ComponentActionTypeSchema:()=>wW,ComponentAgentActionSchema:()=>RW,ConversationAnalyticsSchema:()=>lTe,ConversationContextSchema:()=>OK,ConversationMessageSchema:()=>wK,ConversationSessionSchema:()=>oTe,ConversationSummarySchema:()=>sTe,CostAlertSchema:()=>NG,CostAlertTypeSchema:()=>MG,CostAnalyticsSchema:()=>IG,CostBreakdownDimensionSchema:()=>PG,CostBreakdownEntrySchema:()=>FG,CostEntrySchema:()=>Iwe,CostMetricTypeSchema:()=>Fwe,CostOptimizationRecommendationSchema:()=>LG,CostQueryFiltersSchema:()=>zwe,CostReportSchema:()=>Rwe,DataActionParamsSchema:()=>kW,DataActionTypeSchema:()=>SW,DataAgentActionSchema:()=>IW,DeploymentStrategySchema:()=>KW,DevOpsAgentSchema:()=>uwe,DevOpsToolSchema:()=>dwe,DevelopmentConfigSchema:()=>JW,DocumentChunkSchema:()=>Bwe,DocumentLoaderConfigSchema:()=>GG,DocumentMetadataSchema:()=>VG,EmbeddingModelSchema:()=>zG,EntitySchema:()=>ZG,EvaluationMetricsSchema:()=>hK,FeedbackLoopSchema:()=>uTe,FieldSynonymConfigSchema:()=>Ywe,FileContentSchema:()=>yK,FilterExpressionSchema:()=>KG,FilterGroupSchema:()=>qG,FormActionParamsSchema:()=>OW,FormActionTypeSchema:()=>xW,FormAgentActionSchema:()=>FW,FunctionCallSchema:()=>SK,GeneratedCodeSchema:()=>mwe,GitHubIntegrationSchema:()=>YW,HyperparametersSchema:()=>pK,ImageContentSchema:()=>vK,IntegrationConfigSchema:()=>ZW,IntentActionMappingSchema:()=>lwe,IssueSchema:()=>AK,MCPCapabilitySchema:()=>TG,MCPClientConfigSchema:()=>Nwe,MCPPromptArgumentSchema:()=>_G,MCPPromptMessageSchema:()=>vG,MCPPromptRequestSchema:()=>jwe,MCPPromptResponseSchema:()=>Mwe,MCPPromptSchema:()=>yG,MCPResourceRequestSchema:()=>Dwe,MCPResourceResponseSchema:()=>Owe,MCPResourceSchema:()=>pG,MCPResourceTemplateSchema:()=>mG,MCPResourceTypeSchema:()=>fG,MCPRootEntrySchema:()=>CG,MCPRootsConfigSchema:()=>wG,MCPSamplingConfigSchema:()=>SG,MCPServerConfigSchema:()=>DG,MCPServerInfoSchema:()=>EG,MCPStreamingConfigSchema:()=>bG,MCPToolApprovalSchema:()=>xG,MCPToolCallRequestSchema:()=>kwe,MCPToolCallResponseSchema:()=>Awe,MCPToolParameterSchema:()=>hG,MCPToolSchema:()=>gG,MCPTransportConfigSchema:()=>dG,MCPTransportTypeSchema:()=>uG,MessageContentSchema:()=>xK,MessageContentTypeSchema:()=>aTe,MessagePruningEventSchema:()=>cTe,MessageRoleSchema:()=>gK,MetadataFilterSchema:()=>JG,MetadataSourceSchema:()=>kK,ModelCapabilitySchema:()=>rG,ModelConfigSchema:()=>oG,ModelDriftSchema:()=>iTe,ModelFeatureSchema:()=>fK,ModelLimitsSchema:()=>iG,ModelPricingSchema:()=>aG,ModelProviderSchema:()=>nG,ModelRegistryEntrySchema:()=>lG,ModelRegistrySchema:()=>Twe,ModelSelectionCriteriaSchema:()=>Ewe,MonitoringConfigSchema:()=>qW,MultiAgentGroupSchema:()=>eTe,NLQAnalyticsSchema:()=>Jwe,NLQFieldMappingSchema:()=>$G,NLQModelConfigSchema:()=>qwe,NLQParseResultSchema:()=>tK,NLQRequestSchema:()=>Wwe,NLQResponseSchema:()=>Gwe,NLQTrainingExampleSchema:()=>Kwe,NavigationActionParamsSchema:()=>EW,NavigationActionTypeSchema:()=>yW,NavigationAgentActionSchema:()=>NW,PerformanceOptimizationSchema:()=>Cwe,PipelineStageSchema:()=>UW,PluginCompositionRequestSchema:()=>_we,PluginCompositionResultSchema:()=>vwe,PluginRecommendationRequestSchema:()=>ywe,PluginRecommendationSchema:()=>bwe,PluginScaffoldingTemplateSchema:()=>hwe,PostProcessingActionSchema:()=>sK,PredictionRequestSchema:()=>nTe,PredictionResultSchema:()=>rTe,PredictiveModelSchema:()=>tTe,PredictiveModelTypeSchema:()=>dK,PromptTemplateSchema:()=>cG,PromptVariableSchema:()=>sG,QueryContextSchema:()=>eK,QueryIntentSchema:()=>XG,QueryTemplateSchema:()=>Xwe,RAGPipelineConfigSchema:()=>YG,RAGPipelineStatusSchema:()=>Uwe,RAGQueryRequestSchema:()=>Vwe,RAGQueryResponseSchema:()=>Hwe,RerankingConfigSchema:()=>UG,ResolutionSchema:()=>jK,RetrievalStrategySchema:()=>HG,RootCauseAnalysisRequestSchema:()=>xwe,RootCauseAnalysisResultSchema:()=>Swe,SelfHealingActionSchema:()=>$W,SelfHealingConfigSchema:()=>eG,SkillSchema:()=>vW,SkillTriggerConditionSchema:()=>_W,StructuredOutputConfigSchema:()=>pW,StructuredOutputFormatSchema:()=>dW,TestingConfigSchema:()=>HW,TextContentSchema:()=>_K,TimeframeSchema:()=>QG,TokenBudgetConfigSchema:()=>EK,TokenBudgetStrategySchema:()=>TK,TokenUsageSchema:()=>OG,TokenUsageStatsSchema:()=>DK,ToolCallSchema:()=>CK,ToolCategorySchema:()=>hW,ToolSchema:()=>gW,TrainingConfigSchema:()=>mK,TransformPipelineStepSchema:()=>fW,TypedAgentActionSchema:()=>owe,UIActionTypeSchema:()=>TW,VectorStoreConfigSchema:()=>WG,VectorStoreProviderSchema:()=>RG,VercelIntegrationSchema:()=>XW,VersionManagementSchema:()=>GW,ViewActionParamsSchema:()=>DW,ViewActionTypeSchema:()=>bW,ViewAgentActionSchema:()=>PW,WorkflowActionParamsSchema:()=>AW,WorkflowActionTypeSchema:()=>CW,WorkflowAgentActionSchema:()=>LW,WorkflowFieldConditionSchema:()=>aK,WorkflowScheduleSchema:()=>oK,defineAgent:()=>rwe,defineSkill:()=>awe,defineTool:()=>iwe,fullStackDevOpsAgentExample:()=>fwe});var cW=h({provider:E([`openai`,`azure_openai`,`anthropic`,`local`]).default(`openai`),model:r().describe(`Model name (e.g. gpt-4, claude-3-opus)`),temperature:P().min(0).max(2).default(.7),maxTokens:P().optional(),topP:P().optional()}),lW=h({type:E([`action`,`flow`,`query`,`vector_search`]),name:r().describe(`Reference name (Action Name, Flow Name)`),description:r().optional().describe(`Override description for the LLM`)}),uW=h({topics:C(r()).describe(`Topics/Tags to recruit knowledge from`),indexes:C(r()).describe(`Vector Store Indexes`)}),dW=E([`json_object`,`json_schema`,`regex`,`grammar`,`xml`]).describe(`Output format for structured agent responses`),fW=E([`trim`,`parse_json`,`validate`,`coerce_types`]).describe(`Post-processing step for structured output`),pW=h({format:dW.describe(`Expected output format`),schema:d(r(),u()).optional().describe(`JSON Schema definition for output`),strict:S().default(!1).describe(`Enforce exact schema compliance`),retryOnValidationFailure:S().default(!0).describe(`Retry generation when output fails validation`),maxRetries:P().int().min(0).default(3).describe(`Maximum retries on validation failure`),fallbackFormat:dW.optional().describe(`Fallback format if primary format fails`),transformPipeline:C(fW).optional().describe(`Post-processing steps applied to output`)}).describe(`Structured output configuration for agent responses`),mW=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Agent unique identifier`),label:r().describe(`Agent display name`),avatar:r().optional(),role:r().describe(`The persona/role (e.g. "Senior Support Engineer")`),instructions:r().describe(`System Prompt / Prime Directives`),model:cW.optional(),lifecycle:$j.optional().describe(`State machine defining the agent conversation follow and constraints`),skills:C(r().regex(/^[a-z_][a-z0-9_]*$/)).optional().describe(`Skill names to attach (Agent→Skill→Tool architecture)`),tools:C(lW).optional().describe(`Direct tool references (legacy fallback)`),knowledge:uW.optional().describe(`RAG access`),active:S().default(!0),access:C(r()).optional().describe(`Who can chat with this agent`),permissions:C(r()).optional().describe(`Required permissions or roles`),tenantId:r().optional().describe(`Tenant/Organization ID`),visibility:E([`global`,`organization`,`private`]).default(`organization`),planning:h({strategy:E([`react`,`plan_and_execute`,`reflexion`,`tree_of_thought`]).default(`react`).describe(`Autonomous reasoning strategy`),maxIterations:P().int().min(1).max(100).default(10).describe(`Maximum planning loop iterations`),allowReplan:S().default(!0).describe(`Allow dynamic re-planning based on intermediate results`)}).optional().describe(`Autonomous reasoning and planning configuration`),memory:h({shortTerm:h({maxMessages:P().int().min(1).default(50).describe(`Max recent messages in working memory`),maxTokens:P().int().min(100).optional().describe(`Max tokens for short-term context window`)}).optional().describe(`Short-term / working memory`),longTerm:h({enabled:S().default(!1).describe(`Enable long-term memory persistence`),store:E([`vector`,`database`,`redis`]).default(`vector`).describe(`Long-term memory storage backend`),maxEntries:P().int().min(1).optional().describe(`Max entries in long-term memory`)}).optional().describe(`Long-term / persistent memory`),reflectionInterval:P().int().min(1).optional().describe(`Reflect every N interactions to improve behavior`)}).optional().describe(`Agent memory management`),guardrails:h({maxTokensPerInvocation:P().int().min(1).optional().describe(`Token budget per single invocation`),maxExecutionTimeSec:P().int().min(1).optional().describe(`Max execution time in seconds`),blockedTopics:C(r()).optional().describe(`Forbidden topics or action names`)}).optional().describe(`Safety guardrails for the agent`),structuredOutput:pW.optional().describe(`Structured output format and validation configuration`)});function rwe(e){return mW.parse(e)}var hW=E([`data`,`action`,`flow`,`integration`,`vector_search`,`analytics`,`utility`]).describe(`Tool operational category`),gW=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool unique identifier (snake_case)`),label:r().describe(`Tool display name`),description:r().describe(`Tool description for LLM function calling`),category:hW.optional().describe(`Tool category for grouping and filtering`),parameters:d(r(),u()).describe(`JSON Schema for tool parameters`),outputSchema:d(r(),u()).optional().describe(`JSON Schema for tool output`),objectName:r().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object name (snake_case)`),requiresConfirmation:S().default(!1).describe(`Require user confirmation before execution`),permissions:C(r()).optional().describe(`Required permissions or roles`),active:S().default(!0).describe(`Whether the tool is enabled`),builtIn:S().default(!1).describe(`Platform built-in tool flag`)});function iwe(e){return gW.parse(e)}var _W=h({field:r().describe(`Context field to evaluate`),operator:E([`eq`,`neq`,`in`,`not_in`,`contains`]).describe(`Comparison operator`),value:l([r(),C(r())]).describe(`Expected value or values`)}),vW=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Skill unique identifier (snake_case)`),label:r().describe(`Skill display name`),description:r().optional().describe(`Skill description`),instructions:r().optional().describe(`LLM instructions when skill is active`),tools:C(r().regex(/^[a-z_][a-z0-9_]*$/)).describe(`Tool names belonging to this skill`),triggerPhrases:C(r()).optional().describe(`Phrases that activate this skill`),triggerConditions:C(_W).optional().describe(`Programmatic activation conditions`),permissions:C(r()).optional().describe(`Required permissions or roles`),active:S().default(!0).describe(`Whether the skill is enabled`)});function awe(e){return vW.parse(e)}var yW=E([`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`]),bW=E([`change_view_mode`,`apply_filter`,`clear_filter`,`apply_sort`,`change_grouping`,`show_columns`,`expand_record`,`collapse_record`,`refresh_view`,`export_data`]),xW=E([`create_record`,`update_record`,`delete_record`,`fill_field`,`clear_field`,`submit_form`,`cancel_form`,`validate_form`,`save_draft`]),SW=E([`select_record`,`deselect_record`,`select_all`,`deselect_all`,`bulk_update`,`bulk_delete`,`bulk_export`]),CW=E([`trigger_flow`,`trigger_approval`,`trigger_webhook`,`run_report`,`send_email`,`send_notification`,`schedule_task`]),wW=E([`open_modal`,`close_modal`,`open_sidebar`,`close_sidebar`,`show_notification`,`hide_notification`,`open_dropdown`,`close_dropdown`,`toggle_section`]),TW=l([yW,bW,xW,SW,CW,wW]),EW=h({object:r().optional().describe(`Object name (for object-specific navigation)`),recordId:r().optional().describe(`Record ID (for detail page)`),viewType:E([`list`,`form`,`detail`,`kanban`,`calendar`,`gantt`]).optional(),dashboardId:r().optional().describe(`Dashboard ID`),reportId:r().optional().describe(`Report ID`),appName:r().optional().describe(`App name`),mode:E([`new`,`edit`,`view`]).optional().describe(`Form mode`),openInNewTab:S().optional().describe(`Open in new tab`)}),DW=h({viewMode:E([`list`,`kanban`,`calendar`,`gantt`,`pivot`]).optional(),filters:d(r(),u()).optional().describe(`Filter conditions`),sort:C(h({field:r(),order:E([`asc`,`desc`])})).optional(),groupBy:r().optional().describe(`Field to group by`),columns:C(r()).optional().describe(`Columns to show/hide`),recordId:r().optional().describe(`Record to expand/collapse`),exportFormat:E([`csv`,`xlsx`,`pdf`,`json`]).optional()}),OW=h({object:r().optional().describe(`Object name`),recordId:r().optional().describe(`Record ID (for edit/delete)`),fieldValues:d(r(),u()).optional().describe(`Field name-value pairs`),fieldName:r().optional().describe(`Specific field to fill/clear`),fieldValue:u().optional().describe(`Value to set`),validateOnly:S().optional().describe(`Validate without saving`)}),kW=h({recordIds:C(r()).optional().describe(`Record IDs to select/operate on`),filters:d(r(),u()).optional().describe(`Filter for bulk operations`),updateData:d(r(),u()).optional().describe(`Data for bulk update`),exportFormat:E([`csv`,`xlsx`,`pdf`,`json`]).optional()}),AW=h({flowName:r().optional().describe(`Flow/workflow name`),approvalProcessName:r().optional().describe(`Approval process name`),webhookUrl:r().optional().describe(`Webhook URL`),reportName:r().optional().describe(`Report name`),emailTemplate:r().optional().describe(`Email template`),recipients:C(r()).optional().describe(`Email recipients`),subject:r().optional().describe(`Email subject`),message:r().optional().describe(`Notification/email message`),taskData:d(r(),u()).optional().describe(`Task creation data`),scheduleTime:r().optional().describe(`Schedule time (ISO 8601)`),contextData:d(r(),u()).optional().describe(`Additional context data`)}),jW=h({componentId:r().optional().describe(`Component ID`),modalConfig:h({title:r().optional(),content:u().optional(),size:E([`small`,`medium`,`large`,`fullscreen`]).optional()}).optional(),notificationConfig:h({type:E([`info`,`success`,`warning`,`error`]).optional(),message:r(),duration:P().optional().describe(`Duration in ms`)}).optional(),sidebarConfig:h({position:E([`left`,`right`]).optional(),width:r().optional(),content:u().optional()}).optional()}),MW=h({id:r().optional().describe(`Unique action ID`),type:TW.describe(`Type of UI action to perform`),params:l([EW,DW,OW,kW,AW,jW]).describe(`Action-specific parameters`),requireConfirmation:S().default(!1).describe(`Require user confirmation before executing`),confirmationMessage:r().optional().describe(`Message to show in confirmation dialog`),successMessage:r().optional().describe(`Message to show on success`),onError:E([`retry`,`skip`,`abort`]).default(`abort`).describe(`Error handling strategy`),metadata:h({intent:r().optional().describe(`Original user intent/query`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),agentName:r().optional().describe(`Agent that generated this action`),timestamp:r().datetime().optional().describe(`Generation timestamp (ISO 8601)`)}).optional()}),NW=MW.extend({type:yW,params:EW}),PW=MW.extend({type:bW,params:DW}),FW=MW.extend({type:xW,params:OW}),IW=MW.extend({type:SW,params:kW}),LW=MW.extend({type:CW,params:AW}),RW=MW.extend({type:wW,params:jW}),owe=l([NW,PW,FW,IW,LW,RW]),swe=h({id:r().optional().describe(`Unique sequence ID`),actions:C(MW).describe(`Ordered list of actions`),mode:E([`sequential`,`parallel`]).default(`sequential`).describe(`Execution mode`),stopOnError:S().default(!0).describe(`Stop sequence on first error`),atomic:S().default(!1).describe(`Transaction mode (all-or-nothing)`),startTime:r().datetime().optional().describe(`Execution start time (ISO 8601)`),endTime:r().datetime().optional().describe(`Execution end time (ISO 8601)`),metadata:h({intent:r().optional().describe(`Original user intent`),confidence:P().min(0).max(1).optional().describe(`Overall confidence score`),agentName:r().optional().describe(`Agent that generated this sequence`)}).optional()}),zW=h({actionId:r().describe(`ID of the executed action`),status:E([`success`,`error`,`cancelled`,`pending`]).describe(`Execution status`),data:u().optional().describe(`Action result data`),error:h({code:r(),message:r(),details:u().optional()}).optional().describe(`Error details if status is "error"`),metadata:h({startTime:r().optional().describe(`Execution start time (ISO 8601)`),endTime:r().optional().describe(`Execution end time (ISO 8601)`),duration:P().optional().describe(`Execution duration in ms`)}).optional()}),cwe=h({sequenceId:r().describe(`ID of the executed sequence`),status:E([`success`,`partial_success`,`error`,`cancelled`]).describe(`Overall execution status`),results:C(zW).describe(`Results for each action`),summary:h({total:P().describe(`Total number of actions`),successful:P().describe(`Number of successful actions`),failed:P().describe(`Number of failed actions`),cancelled:P().describe(`Number of cancelled actions`)}),metadata:h({startTime:r().optional(),endTime:r().optional(),totalDuration:P().optional().describe(`Total execution time in ms`)}).optional()}),lwe=h({intent:r().describe(`Intent pattern (e.g., "open_new_record_form")`),examples:C(r()).optional().describe(`Example user queries`),actionTemplate:MW.describe(`Action to execute`),paramExtraction:d(r(),h({type:E([`entity`,`slot`,`context`]),required:S().default(!1),default:u().optional()})).optional().describe(`Rules for extracting parameters from user input`),minConfidence:P().min(0).max(1).default(.7).describe(`Minimum confidence to execute`)}),BW=E([`frontend`,`backend`,`api`,`database`,`tests`,`documentation`,`infrastructure`]).describe(`Code generation target`),VW=h({enabled:S().optional().default(!0).describe(`Enable code generation`),targets:C(BW).describe(`Code generation targets`),templateRepo:r().optional().describe(`Template repository for scaffolding`),styleGuide:r().optional().describe(`Code style guide to follow`),includeTests:S().optional().default(!0).describe(`Generate tests with code`),includeDocumentation:S().optional().default(!0).describe(`Generate documentation`),validationMode:E([`strict`,`moderate`,`permissive`]).optional().default(`strict`).describe(`Code validation strictness`)}),HW=h({enabled:S().optional().default(!0).describe(`Enable automated testing`),testTypes:C(E([`unit`,`integration`,`e2e`,`performance`,`security`,`accessibility`])).optional().default([`unit`,`integration`]).describe(`Types of tests to run`),coverageThreshold:P().min(0).max(100).optional().default(80).describe(`Minimum test coverage percentage`),framework:r().optional().describe(`Testing framework (e.g., vitest, jest, playwright)`),preCommitTests:S().optional().default(!0).describe(`Run tests before committing`),autoFix:S().optional().default(!1).describe(`Attempt to auto-fix failing tests`)}),UW=h({name:r().describe(`Pipeline stage name`),type:E([`build`,`test`,`lint`,`security_scan`,`deploy`,`smoke_test`,`rollback`]).describe(`Stage type`),order:P().int().min(0).describe(`Execution order`),parallel:S().optional().default(!1).describe(`Can run in parallel with other stages`),commands:C(r()).describe(`Commands to execute`),env:d(r(),r()).optional().describe(`Stage-specific environment variables`),timeout:P().int().min(60).optional().default(600).describe(`Stage timeout in seconds`),retryOnFailure:S().optional().default(!1).describe(`Retry stage on failure`),maxRetries:P().int().min(0).max(5).optional().default(0).describe(`Maximum retry attempts`)}),WW=h({name:r().describe(`Pipeline name`),trigger:E([`push`,`pull_request`,`release`,`schedule`,`manual`]).describe(`Pipeline trigger`),branches:C(r()).optional().describe(`Branches to run pipeline on`),stages:C(UW).describe(`Pipeline stages`),notifications:h({onSuccess:S().optional().default(!1),onFailure:S().optional().default(!0),channels:C(r()).optional().describe(`Notification channels (e.g., slack, email)`)}).optional().describe(`Pipeline notifications`)}),GW=h({scheme:E([`semver`,`calver`,`custom`]).optional().default(`semver`).describe(`Versioning scheme`),autoIncrement:E([`major`,`minor`,`patch`,`none`]).optional().default(`patch`).describe(`Auto-increment strategy`),prefix:r().optional().default(`v`).describe(`Version tag prefix`),generateChangelog:S().optional().default(!0).describe(`Generate changelog automatically`),changelogFormat:E([`conventional`,`keepachangelog`,`custom`]).optional().default(`conventional`).describe(`Changelog format`),tagReleases:S().optional().default(!0).describe(`Create Git tags for releases`)}),KW=h({type:E([`rolling`,`blue_green`,`canary`,`recreate`]).optional().default(`rolling`).describe(`Deployment strategy`),canaryPercentage:P().min(0).max(100).optional().default(10).describe(`Canary deployment percentage`),healthCheckUrl:r().optional().describe(`Health check endpoint`),healthCheckTimeout:P().int().min(10).optional().default(60).describe(`Health check timeout in seconds`),autoRollback:S().optional().default(!0).describe(`Automatically rollback on failure`),smokeTests:C(r()).optional().describe(`Smoke test commands to run post-deployment`)}),qW=h({enabled:S().optional().default(!0).describe(`Enable monitoring`),metrics:C(E([`performance`,`errors`,`usage`,`availability`,`latency`])).optional().default([`performance`,`errors`,`availability`]).describe(`Metrics to monitor`),alerts:C(h({name:r().describe(`Alert name`),metric:r().describe(`Metric to monitor`),threshold:P().describe(`Alert threshold`),severity:E([`info`,`warning`,`critical`]).describe(`Alert severity`)})).optional().describe(`Alert configurations`),integrations:C(r()).optional().describe(`Monitoring service integrations`)}),JW=h({specificationSource:r().describe(`Path to ObjectStack specification`),codeGeneration:VW.describe(`Code generation settings`),testing:HW.optional().describe(`Testing configuration`),linting:h({enabled:S().optional().default(!0),autoFix:S().optional().default(!0),rules:d(r(),u()).optional()}).optional().describe(`Code linting configuration`),formatting:h({enabled:S().optional().default(!0),autoFormat:S().optional().default(!0),config:d(r(),u()).optional()}).optional().describe(`Code formatting configuration`)}),YW=h({connector:r().describe(`GitHub connector name`),repository:h({owner:r().describe(`Repository owner`),name:r().describe(`Repository name`)}).describe(`Repository configuration`),featureBranch:r().optional().default(`develop`).describe(`Default feature branch`),pullRequest:h({autoCreate:S().optional().default(!0).describe(`Automatically create PRs`),autoMerge:S().optional().default(!1).describe(`Automatically merge PRs when checks pass`),requireReviews:S().optional().default(!0).describe(`Require reviews before merge`),deleteBranchOnMerge:S().optional().default(!0).describe(`Delete feature branch after merge`)}).optional().describe(`Pull request settings`)}),XW=h({connector:r().describe(`Vercel connector name`),project:r().describe(`Vercel project name`),environments:h({production:r().optional().default(`main`).describe(`Production branch`),preview:C(r()).optional().default([`develop`,`feature/*`]).describe(`Preview branches`)}).optional().describe(`Environment mapping`),deployment:h({autoDeployProduction:S().optional().default(!1).describe(`Auto-deploy to production`),autoDeployPreview:S().optional().default(!0).describe(`Auto-deploy preview environments`),requireApproval:S().optional().default(!0).describe(`Require approval for production deployments`)}).optional().describe(`Deployment settings`)}),ZW=h({github:YW.describe(`GitHub integration configuration`),vercel:XW.describe(`Vercel integration configuration`),additional:d(r(),u()).optional().describe(`Additional integration configurations`)}),uwe=mW.extend({developmentConfig:JW.describe(`Development configuration`),pipelines:C(WW).optional().describe(`CI/CD pipelines`),versionManagement:GW.optional().describe(`Version management configuration`),deploymentStrategy:KW.optional().describe(`Deployment strategy`),monitoring:qW.optional().describe(`Monitoring configuration`),integrations:ZW.describe(`Integration configurations`),selfIteration:h({enabled:S().optional().default(!0).describe(`Enable self-iteration`),iterationFrequency:r().optional().describe(`Iteration frequency (cron expression)`),optimizationGoals:C(E([`performance`,`security`,`code_quality`,`test_coverage`,`documentation`])).optional().describe(`Optimization goals`),learningMode:E([`conservative`,`balanced`,`aggressive`]).optional().default(`balanced`).describe(`Learning mode`)}).optional().describe(`Self-iteration configuration`)}),dwe=lW.extend({type:E([`action`,`flow`,`query`,`vector_search`,`git_operation`,`code_generation`,`test_execution`,`deployment`,`monitoring`])}),fwe={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. + +Your responsibilities: +1. Generate code based on ObjectStack specifications +2. Write comprehensive tests for all generated code +3. Ensure code quality through linting and formatting +4. Manage Git workflow (commits, branches, PRs) +5. Deploy applications to Vercel +6. Monitor deployments and handle rollbacks +7. Continuously optimize and iterate on the codebase + +Guidelines: +- Follow ObjectStack naming conventions (camelCase for props, snake_case for names) +- Write clean, maintainable, well-documented code +- Ensure 80%+ test coverage +- Use conventional commit messages +- Create detailed PR descriptions +- Deploy only after all checks pass +- Monitor production deployments closely +- Learn from failures and optimize continuously + +Always prioritize code quality, security, and maintainability.`,model:{provider:`openai`,model:`gpt-4-turbo-preview`,temperature:.3,maxTokens:8192},tools:[{type:`action`,name:`generate_from_spec`,description:`Generate code from ObjectStack specification`},{type:`action`,name:`run_tests`,description:`Execute test suites`},{type:`action`,name:`commit_and_push`,description:`Commit changes and push to GitHub`},{type:`action`,name:`create_pull_request`,description:`Create pull request on GitHub`},{type:`action`,name:`deploy_to_vercel`,description:`Deploy application to Vercel`},{type:`action`,name:`check_deployment_health`,description:`Check deployment health status`},{type:`action`,name:`rollback_deployment`,description:`Rollback to previous deployment`}],knowledge:{topics:[`objectstack_protocol`,`typescript_best_practices`,`testing_strategies`,`ci_cd_patterns`,`deployment_strategies`],indexes:[`devops_knowledge_base`]},developmentConfig:{specificationSource:`packages/spec`,codeGeneration:{enabled:!0,targets:[`frontend`,`backend`,`api`,`tests`,`documentation`],styleGuide:`objectstack`,includeTests:!0,includeDocumentation:!0,validationMode:`strict`},testing:{enabled:!0,testTypes:[`unit`,`integration`,`e2e`],coverageThreshold:80,framework:`vitest`,preCommitTests:!0,autoFix:!1},linting:{enabled:!0,autoFix:!0},formatting:{enabled:!0,autoFormat:!0}},pipelines:[{name:`CI Pipeline`,trigger:`pull_request`,branches:[`main`,`develop`],stages:[{name:`Install Dependencies`,type:`build`,order:1,commands:[`pnpm install`],timeout:300,parallel:!1,retryOnFailure:!1,maxRetries:0},{name:`Lint`,type:`lint`,order:2,parallel:!0,commands:[`pnpm run lint`],timeout:180,retryOnFailure:!1,maxRetries:0},{name:`Type Check`,type:`lint`,order:2,parallel:!0,commands:[`pnpm run type-check`],timeout:180,retryOnFailure:!1,maxRetries:0},{name:`Test`,type:`test`,order:3,commands:[`pnpm run test:ci`],timeout:600,parallel:!1,retryOnFailure:!1,maxRetries:0},{name:`Build`,type:`build`,order:4,commands:[`pnpm run build`],timeout:600,parallel:!1,retryOnFailure:!1,maxRetries:0},{name:`Security Scan`,type:`security_scan`,order:5,commands:[`pnpm audit`,`pnpm run security-scan`],timeout:300,parallel:!1,retryOnFailure:!1,maxRetries:0}]},{name:`CD Pipeline`,trigger:`push`,branches:[`main`],stages:[{name:`Deploy to Production`,type:`deploy`,order:1,commands:[`vercel deploy --prod`],timeout:600,parallel:!1,retryOnFailure:!1,maxRetries:0},{name:`Smoke Tests`,type:`smoke_test`,order:2,commands:[`pnpm run test:smoke`],timeout:300,parallel:!1,retryOnFailure:!0,maxRetries:2}],notifications:{onSuccess:!0,onFailure:!0,channels:[`slack`,`email`]}}],versionManagement:{scheme:`semver`,autoIncrement:`patch`,prefix:`v`,generateChangelog:!0,changelogFormat:`conventional`,tagReleases:!0},deploymentStrategy:{type:`rolling`,healthCheckUrl:`/api/health`,healthCheckTimeout:60,autoRollback:!0,smokeTests:[`pnpm run test:smoke`],canaryPercentage:10},monitoring:{enabled:!0,metrics:[`performance`,`errors`,`availability`],alerts:[{name:`High Error Rate`,metric:`error_rate`,threshold:.05,severity:`critical`},{name:`Slow Response Time`,metric:`response_time`,threshold:1e3,severity:`warning`}],integrations:[`vercel`,`datadog`]},integrations:{github:{connector:`github_production`,repository:{owner:`objectstack-ai`,name:`app`},featureBranch:`develop`,pullRequest:{autoCreate:!0,autoMerge:!1,requireReviews:!0,deleteBranchOnMerge:!0}},vercel:{connector:`vercel_production`,project:`objectstack-app`,environments:{production:`main`,preview:[`develop`,`feature/*`]},deployment:{autoDeployProduction:!1,autoDeployPreview:!0,requireApproval:!0}}},selfIteration:{enabled:!0,iterationFrequency:`0 0 * * 0`,optimizationGoals:[`code_quality`,`test_coverage`,`performance`],learningMode:`balanced`},active:!0},pwe=h({description:r().describe(`What the plugin should do`),pluginType:E([`driver`,`app`,`widget`,`integration`,`automation`,`analytics`,`ai-agent`,`custom`]),outputFormat:E([`source-code`,`low-code-schema`,`dsl`]).default(`source-code`).describe(`Format of the generated output`),language:E([`typescript`,`javascript`,`python`]).default(`typescript`),framework:h({runtime:E([`node`,`browser`,`edge`,`universal`]).optional(),uiFramework:E([`react`,`vue`,`svelte`,`none`]).optional(),testing:E([`vitest`,`jest`,`mocha`,`none`]).optional()}).optional(),capabilities:C(r()).optional().describe(`Protocol IDs to implement`),dependencies:C(r()).optional().describe(`Required plugin IDs`),examples:C(h({input:r(),expectedOutput:r(),description:r().optional()})).optional(),style:h({indentation:E([`tab`,`2spaces`,`4spaces`]).default(`2spaces`),quotes:E([`single`,`double`]).default(`single`),semicolons:S().default(!0),trailingComma:S().default(!0)}).optional(),schemaOptions:h({format:E([`json`,`yaml`,`typescript`]).default(`typescript`).describe(`Output schema format`),includeExamples:S().default(!0),strictValidation:S().default(!0),generateUI:S().default(!0).describe(`Generate view, dashboard, and page definitions`),generateDataModels:S().default(!0).describe(`Generate object and field definitions`)}).optional(),context:h({existingCode:r().optional(),documentationUrls:C(r()).optional(),referencePlugins:C(r()).optional()}).optional(),options:h({generateTests:S().default(!0),generateDocs:S().default(!0),generateExamples:S().default(!0),targetCoverage:P().min(0).max(100).default(80),optimizationLevel:E([`none`,`basic`,`aggressive`]).default(`basic`)}).optional()}),mwe=h({outputFormat:E([`source-code`,`low-code-schema`,`dsl`]),code:r().optional(),language:r().optional(),schemas:C(h({type:E([`object`,`view`,`dashboard`,`app`,`workflow`,`api`,`page`]),path:r().describe(`File path for the schema`),content:r().describe(`Schema content (JSON/YAML/TypeScript)`),description:r().optional()})).optional().describe(`Generated low-code schema files`),files:C(h({path:r(),content:r(),description:r().optional()})),tests:C(h({path:r(),content:r(),coverage:P().min(0).max(100).optional()})).optional(),documentation:h({readme:r().optional(),api:r().optional(),usage:r().optional()}).optional(),package:h({name:r(),version:r(),dependencies:d(r(),r()).optional(),devDependencies:d(r(),r()).optional()}).optional(),quality:h({complexity:P().optional().describe(`Cyclomatic complexity`),maintainability:P().min(0).max(100).optional(),testCoverage:P().min(0).max(100).optional(),lintScore:P().min(0).max(100).optional()}).optional(),confidence:P().min(0).max(100).describe(`AI confidence in generated code`),suggestions:C(r()).optional(),warnings:C(r()).optional()}),hwe=h({id:r(),name:r(),description:r(),pluginType:r(),structure:C(h({type:E([`file`,`directory`]),path:r(),template:r().optional().describe(`Template content with variables`),optional:S().default(!1)})),variables:C(h({name:r(),description:r(),type:E([`string`,`number`,`boolean`,`array`,`object`]),required:S().default(!0),default:u().optional(),validation:r().optional().describe(`Validation regex or rule`)})),scripts:C(h({name:r(),command:r(),description:r().optional(),optional:S().default(!1)})).optional()}),gwe=h({assessment:E([`excellent`,`good`,`acceptable`,`needs-improvement`,`poor`]),score:P().min(0).max(100),issues:C(h({severity:E([`critical`,`error`,`warning`,`info`,`style`]),category:E([`bug`,`security`,`performance`,`maintainability`,`style`,`documentation`,`testing`,`type-safety`,`best-practice`]),file:r(),line:P().int().optional(),column:P().int().optional(),message:r(),suggestion:r().optional(),autoFixable:S().default(!1),autoFix:r().optional().describe(`Automated fix code`)})),highlights:C(h({category:r(),description:r(),file:r().optional()})).optional(),metrics:h({complexity:P().optional(),maintainability:P().min(0).max(100).optional(),testCoverage:P().min(0).max(100).optional(),duplicateCode:P().min(0).max(100).optional(),technicalDebt:r().optional().describe(`Estimated technical debt`)}).optional(),recommendations:C(h({priority:E([`high`,`medium`,`low`]),title:r(),description:r(),effort:E([`trivial`,`small`,`medium`,`large`]).optional()})),security:h({vulnerabilities:C(h({severity:E([`critical`,`high`,`medium`,`low`]),type:r(),description:r(),remediation:r().optional()})).optional(),score:P().min(0).max(100).optional()}).optional()}),_we=h({goal:r().describe(`What should the composed plugins achieve`),availablePlugins:C(h({pluginId:r(),version:r(),capabilities:C(r()).optional(),description:r().optional()})),constraints:h({maxPlugins:P().int().min(1).optional(),requiredPlugins:C(r()).optional(),excludedPlugins:C(r()).optional(),performance:h({maxLatency:P().optional().describe(`Maximum latency in ms`),maxMemory:P().optional().describe(`Maximum memory in bytes`)}).optional()}).optional(),optimize:E([`performance`,`reliability`,`simplicity`,`cost`,`security`]).optional()}),vwe=h({plugins:C(h({pluginId:r(),version:r(),role:r().describe(`Role in the composition`),configuration:d(r(),u()).optional()})),integration:h({code:r(),config:d(r(),u()).optional(),initOrder:C(r())}),dataFlow:C(h({from:r(),to:r(),data:r().describe(`Data type or description`)})),performance:h({estimatedLatency:P().optional().describe(`Estimated latency in ms`),estimatedMemory:P().optional().describe(`Estimated memory in bytes`)}).optional(),confidence:P().min(0).max(100),alternatives:C(h({description:r(),plugins:C(r()),tradeoffs:r()})).optional(),warnings:C(r()).optional()}),ywe=h({context:h({installedPlugins:C(r()).optional(),industry:r().optional(),useCases:C(r()).optional(),teamSize:P().int().optional(),budget:E([`free`,`low`,`medium`,`high`,`unlimited`]).optional()}),criteria:h({prioritize:E([`popularity`,`rating`,`compatibility`,`features`,`cost`,`support`]).optional(),certifiedOnly:S().default(!1),minRating:P().min(0).max(5).optional(),maxResults:P().int().min(1).max(50).default(10)}).optional()}),bwe=h({recommendations:C(h({pluginId:r(),name:r(),description:r(),score:P().min(0).max(100).describe(`Relevance score`),reasons:C(r()).describe(`Why this plugin is recommended`),benefits:C(r()),considerations:C(r()).optional(),alternatives:C(r()).optional(),estimatedValue:r().optional().describe(`Expected value/ROI`)})),combinations:C(h({plugins:C(r()),description:r(),synergies:C(r()).describe(`How these plugins work well together`),totalScore:P().min(0).max(100)})).optional(),learningPath:C(h({step:P().int(),plugin:r(),reason:r(),resources:C(r()).optional()})).optional()}),QW=h({enabled:S().default(!0),metrics:C(E([`cpu-usage`,`memory-usage`,`response-time`,`error-rate`,`throughput`,`latency`,`connection-count`,`queue-depth`])),algorithm:E([`statistical`,`machine-learning`,`heuristic`,`hybrid`]).default(`hybrid`),sensitivity:E([`low`,`medium`,`high`]).default(`medium`).describe(`How aggressively to detect anomalies`),timeWindow:P().int().min(60).default(300).describe(`Historical data window for anomaly detection`),confidenceThreshold:P().min(0).max(100).default(80).describe(`Minimum confidence to flag as anomaly`),alertOnDetection:S().default(!0)}),$W=h({id:r(),type:E([`restart`,`scale`,`rollback`,`clear-cache`,`adjust-config`,`execute-script`,`notify`]),trigger:h({healthStatus:C(xH).optional(),anomalyTypes:C(r()).optional(),errorPatterns:C(r()).optional(),customCondition:r().optional().describe(`Custom trigger condition (e.g., "errorRate > 0.1")`)}),parameters:d(r(),u()).optional(),maxAttempts:P().int().min(1).default(3),cooldown:P().int().min(0).default(60),timeout:P().int().min(1).default(300),requireApproval:S().default(!1),priority:P().int().min(1).default(5).describe(`Action priority (lower number = higher priority)`)}),eG=h({enabled:S().default(!0),strategy:E([`conservative`,`moderate`,`aggressive`]).default(`moderate`),actions:C($W),anomalyDetection:QW.optional(),maxConcurrentHealing:P().int().min(1).default(1).describe(`Maximum number of simultaneous healing attempts`),learning:h({enabled:S().default(!0).describe(`Learn from successful/failed healing attempts`),feedbackLoop:S().default(!0).describe(`Adjust strategy based on outcomes`)}).optional()}),tG=h({enabled:S().default(!1),metric:E([`cpu-usage`,`memory-usage`,`request-rate`,`response-time`,`queue-depth`,`custom`]),customMetric:r().optional(),targetValue:P().describe(`Desired metric value (e.g., 70 for 70% CPU)`),bounds:h({minInstances:P().int().min(1).default(1),maxInstances:P().int().min(1).default(10),minResources:h({cpu:r().optional().describe(`CPU limit (e.g., "0.5", "1")`),memory:r().optional().describe(`Memory limit (e.g., "512Mi", "1Gi")`)}).optional(),maxResources:h({cpu:r().optional(),memory:r().optional()}).optional()}),scaleUp:h({threshold:P().describe(`Metric value that triggers scale up`),stabilizationWindow:P().int().min(0).default(60).describe(`How long metric must exceed threshold`),cooldown:P().int().min(0).default(300).describe(`Minimum time between scale-up operations`),stepSize:P().int().min(1).default(1).describe(`Number of instances to add`)}),scaleDown:h({threshold:P().describe(`Metric value that triggers scale down`),stabilizationWindow:P().int().min(0).default(300).describe(`How long metric must be below threshold`),cooldown:P().int().min(0).default(600).describe(`Minimum time between scale-down operations`),stepSize:P().int().min(1).default(1).describe(`Number of instances to remove`)}),predictive:h({enabled:S().default(!1).describe(`Use ML to predict future load`),lookAhead:P().int().min(60).default(300).describe(`How far ahead to predict (seconds)`),confidence:P().min(0).max(100).default(80).describe(`Minimum confidence for prediction-based scaling`)}).optional()}),xwe=h({incidentId:r(),pluginId:r(),symptoms:C(h({type:r().describe(`Symptom type`),description:r(),severity:E([`low`,`medium`,`high`,`critical`]),timestamp:r().datetime()})),timeRange:h({start:r().datetime(),end:r().datetime()}),analyzeLogs:S().default(!0),analyzeMetrics:S().default(!0),analyzeDependencies:S().default(!0),context:d(r(),u()).optional()}),Swe=h({analysisId:r(),incidentId:r(),rootCauses:C(h({id:r(),description:r(),confidence:P().min(0).max(100),category:E([`code-defect`,`configuration`,`resource-exhaustion`,`dependency-failure`,`network-issue`,`data-corruption`,`security-breach`,`other`]),evidence:C(h({type:E([`log`,`metric`,`trace`,`event`]),content:r(),timestamp:r().datetime().optional()})),impact:E([`low`,`medium`,`high`,`critical`]),recommendations:C(r())})),contributingFactors:C(h({description:r(),confidence:P().min(0).max(100)})).optional(),timeline:C(h({timestamp:r().datetime(),event:r(),significance:E([`low`,`medium`,`high`])})).optional(),remediation:h({immediate:C(r()),shortTerm:C(r()),longTerm:C(r())}).optional(),overallConfidence:P().min(0).max(100),timestamp:r().datetime()}),Cwe=h({id:r(),pluginId:r(),type:E([`caching`,`query-optimization`,`resource-allocation`,`code-refactoring`,`architecture-change`,`configuration-tuning`]),description:r(),expectedImpact:h({performanceGain:P().min(0).max(100).describe(`Expected performance improvement (%)`),resourceSavings:h({cpu:P().optional().describe(`CPU reduction (%)`),memory:P().optional().describe(`Memory reduction (%)`),network:P().optional().describe(`Network reduction (%)`)}).optional(),costReduction:P().optional().describe(`Estimated cost reduction (%)`)}),difficulty:E([`trivial`,`easy`,`moderate`,`complex`,`very-complex`]),steps:C(r()),risks:C(r()).optional(),confidence:P().min(0).max(100),priority:E([`low`,`medium`,`high`,`critical`])}),wwe=h({agentId:r(),pluginId:r(),selfHealing:eG.optional(),autoScaling:C(tG).optional(),monitoring:h({enabled:S().default(!0),interval:P().int().min(1e3).default(6e4).describe(`Monitoring interval in milliseconds`),metrics:C(r()).optional()}).optional(),optimization:h({enabled:S().default(!0),scanInterval:P().int().min(3600).default(86400).describe(`How often to scan for optimization opportunities`),autoApply:S().default(!1).describe(`Automatically apply low-risk optimizations`)}).optional(),incidentResponse:h({enabled:S().default(!0),autoRCA:S().default(!0),notifications:C(h({channel:E([`email`,`slack`,`webhook`,`sms`]),config:d(r(),u())})).optional()}).optional()}),nG=E([`openai`,`azure_openai`,`anthropic`,`google`,`cohere`,`huggingface`,`local`,`custom`]),rG=h({textGeneration:S().optional().default(!0).describe(`Supports text generation`),textEmbedding:S().optional().default(!1).describe(`Supports text embedding`),imageGeneration:S().optional().default(!1).describe(`Supports image generation`),imageUnderstanding:S().optional().default(!1).describe(`Supports image understanding`),functionCalling:S().optional().default(!1).describe(`Supports function calling`),codeGeneration:S().optional().default(!1).describe(`Supports code generation`),reasoning:S().optional().default(!1).describe(`Supports advanced reasoning`)}),iG=h({maxTokens:P().int().positive().describe(`Maximum tokens per request`),contextWindow:P().int().positive().describe(`Context window size`),maxOutputTokens:P().int().positive().optional().describe(`Maximum output tokens`),rateLimit:h({requestsPerMinute:P().int().positive().optional(),tokensPerMinute:P().int().positive().optional()}).optional()}),aG=h({currency:r().optional().default(`USD`),inputCostPer1kTokens:P().optional().describe(`Cost per 1K input tokens`),outputCostPer1kTokens:P().optional().describe(`Cost per 1K output tokens`),embeddingCostPer1kTokens:P().optional().describe(`Cost per 1K embedding tokens`)}),oG=h({id:r().describe(`Unique model identifier`),name:r().describe(`Model display name`),version:r().describe(`Model version (e.g., "gpt-4-turbo-2024-04-09")`),provider:nG,capabilities:rG,limits:iG,pricing:aG.optional(),endpoint:r().url().optional().describe(`Custom API endpoint`),apiKey:r().optional().describe(`API key (Warning: Prefer secretRef)`),secretRef:r().optional().describe(`Reference to stored secret (e.g. system:openai_api_key)`),region:r().optional().describe(`Deployment region (e.g., "us-east-1")`),description:r().optional(),tags:C(r()).optional().describe(`Tags for categorization`),deprecated:S().optional().default(!1),recommendedFor:C(r()).optional().describe(`Use case recommendations`)}),sG=h({name:r().describe(`Variable name (e.g., "user_name", "context")`),type:E([`string`,`number`,`boolean`,`object`,`array`]).default(`string`),required:S().default(!1),defaultValue:u().optional(),description:r().optional(),validation:h({minLength:P().optional(),maxLength:P().optional(),pattern:r().optional(),enum:C(u()).optional()}).optional()}),cG=h({id:r().describe(`Unique template identifier`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template name (snake_case)`),label:r().describe(`Display name`),system:r().optional().describe(`System prompt`),user:r().describe(`User prompt template with variables`),assistant:r().optional().describe(`Assistant message prefix`),variables:C(sG).optional().describe(`Template variables`),modelId:r().optional().describe(`Recommended model ID`),temperature:P().min(0).max(2).optional(),maxTokens:P().optional(),topP:P().optional(),frequencyPenalty:P().optional(),presencePenalty:P().optional(),stopSequences:C(r()).optional(),version:r().optional().default(`1.0.0`),description:r().optional(),category:r().optional().describe(`Template category (e.g., "code_generation", "support")`),tags:C(r()).optional(),examples:C(h({input:d(r(),u()).describe(`Example variable values`),output:r().describe(`Expected output`)})).optional()}),lG=h({model:oG,status:E([`active`,`deprecated`,`experimental`,`disabled`]).default(`active`),priority:P().int().default(0).describe(`Priority for model selection`),fallbackModels:C(r()).optional().describe(`Fallback model IDs`),healthCheck:h({enabled:S().default(!0),intervalSeconds:P().int().default(300),lastChecked:r().optional().describe(`ISO timestamp`),status:E([`healthy`,`unhealthy`,`unknown`]).default(`unknown`)}).optional()}),Twe=h({name:r().describe(`Registry name`),models:d(r(),lG).describe(`Model entries by ID`),promptTemplates:d(r(),cG).optional().describe(`Prompt templates by name`),defaultModel:r().optional().describe(`Default model ID`),enableAutoFallback:S().default(!0).describe(`Auto-fallback on errors`)}),Ewe=h({capabilities:C(r()).optional().describe(`Required capabilities`),maxCostPer1kTokens:P().optional().describe(`Maximum acceptable cost`),minContextWindow:P().optional().describe(`Minimum context window size`),provider:nG.optional(),tags:C(r()).optional(),excludeDeprecated:S().default(!0)}),uG=E([`stdio`,`http`,`websocket`,`grpc`]),dG=h({type:uG,url:r().url().optional().describe(`Server URL (for HTTP/WebSocket/gRPC)`),headers:d(r(),r()).optional().describe(`Custom headers for requests`),auth:h({type:E([`none`,`bearer`,`api_key`,`oauth2`,`custom`]).default(`none`),token:r().optional().describe(`Bearer token or API key`),secretRef:r().optional().describe(`Reference to stored secret`),headerName:r().optional().describe(`Custom auth header name`)}).optional(),timeout:P().int().positive().optional().default(3e4).describe(`Request timeout in milliseconds`),retryAttempts:P().int().min(0).max(5).optional().default(3),retryDelay:P().int().positive().optional().default(1e3).describe(`Delay between retries in milliseconds`),command:r().optional().describe(`Command to execute (for stdio transport)`),args:C(r()).optional().describe(`Command arguments`),env:d(r(),r()).optional().describe(`Environment variables`),workingDirectory:r().optional().describe(`Working directory for the process`)}),fG=E([`text`,`json`,`binary`,`stream`]),pG=h({uri:r().describe(`Unique resource identifier (e.g., "objectstack://objects/account/ABC123")`),name:r().describe(`Human-readable resource name`),description:r().optional().describe(`Resource description for AI consumption`),mimeType:r().optional().describe(`MIME type (e.g., "application/json", "text/plain")`),resourceType:fG.default(`json`),content:u().optional().describe(`Resource content (for static resources)`),contentUrl:r().url().optional().describe(`URL to fetch content dynamically`),size:P().int().nonnegative().optional().describe(`Resource size in bytes`),lastModified:r().datetime().optional().describe(`Last modification timestamp (ISO 8601)`),tags:C(r()).optional().describe(`Tags for resource categorization`),permissions:h({read:S().default(!0),write:S().default(!1),delete:S().default(!1)}).optional(),cacheable:S().default(!0).describe(`Whether this resource can be cached`),cacheMaxAge:P().int().nonnegative().optional().describe(`Cache max age in seconds`)}),mG=h({uriPattern:r().describe(`URI pattern with variables (e.g., "objectstack://objects/{objectName}/{recordId}")`),name:r().describe(`Template name`),description:r().optional(),parameters:C(h({name:r().describe(`Parameter name`),type:E([`string`,`number`,`boolean`]).default(`string`),required:S().default(!0),description:r().optional(),pattern:r().optional().describe(`Regex validation pattern`),default:u().optional()})).describe(`URI parameters`),handler:r().optional().describe(`Handler function name for dynamic generation`),mimeType:r().optional(),resourceType:fG.default(`json`)}),hG=h({name:r().describe(`Parameter name`),type:E([`string`,`number`,`boolean`,`object`,`array`]),description:r().describe(`Parameter description for AI consumption`),required:S().default(!1),default:u().optional(),enum:C(u()).optional().describe(`Allowed values`),pattern:r().optional().describe(`Regex validation pattern (for strings)`),minimum:P().optional().describe(`Minimum value (for numbers)`),maximum:P().optional().describe(`Maximum value (for numbers)`),minLength:P().int().nonnegative().optional().describe(`Minimum length (for strings/arrays)`),maxLength:P().int().nonnegative().optional().describe(`Maximum length (for strings/arrays)`),properties:d(r(),F(()=>hG)).optional().describe(`Properties for object types`),items:F(()=>hG).optional().describe(`Item schema for array types`)}),gG=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool function name (snake_case)`),description:r().describe(`Tool description for AI consumption (be detailed and specific)`),parameters:C(hG).describe(`Tool parameters`),returns:h({type:E([`string`,`number`,`boolean`,`object`,`array`,`void`]),description:r().optional(),schema:hG.optional().describe(`Return value schema`)}).optional(),handler:r().describe(`Handler function or endpoint reference`),async:S().default(!0).describe(`Whether the tool executes asynchronously`),timeout:P().int().positive().optional().describe(`Execution timeout in milliseconds`),sideEffects:E([`none`,`read`,`write`,`delete`]).default(`read`).describe(`Tool side effects`),requiresConfirmation:S().default(!1).describe(`Require user confirmation before execution`),confirmationMessage:r().optional(),examples:C(h({description:r(),parameters:d(r(),u()),result:u().optional()})).optional().describe(`Usage examples for AI learning`),category:r().optional().describe(`Tool category (e.g., "data", "workflow", "analytics")`),tags:C(r()).optional(),deprecated:S().default(!1),version:r().optional().default(`1.0.0`)}),_G=h({name:r().describe(`Argument name`),description:r().optional(),type:E([`string`,`number`,`boolean`]).default(`string`),required:S().default(!1),default:u().optional()}),vG=h({role:E([`system`,`user`,`assistant`]).describe(`Message role`),content:r().describe(`Message content (can include {{variable}} placeholders)`)}),yG=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Prompt template name (snake_case)`),description:r().optional().describe(`Prompt description`),messages:C(vG).describe(`Prompt message sequence`),arguments:C(_G).optional().describe(`Dynamic arguments for the prompt`),category:r().optional(),tags:C(r()).optional(),version:r().optional().default(`1.0.0`)}),bG=h({enabled:S().describe(`Enable streaming for MCP communication`),chunkSize:P().int().positive().optional().describe(`Size of each streamed chunk in bytes`),heartbeatIntervalMs:P().int().positive().optional().default(3e4).describe(`Heartbeat interval in milliseconds`),backpressure:E([`drop`,`buffer`,`block`]).optional().describe(`Backpressure handling strategy`)}).describe(`Streaming configuration for MCP communication`),xG=h({requireApproval:S().default(!1).describe(`Require approval before tool execution`),approvalStrategy:E([`human_in_loop`,`auto_approve`,`policy_based`]).describe(`Approval strategy for tool execution`),dangerousToolPatterns:C(r()).optional().describe(`Regex patterns for tools needing approval`),autoApproveTimeout:P().int().positive().optional().describe(`Auto-approve timeout in seconds`)}).describe(`Tool approval configuration for MCP`),SG=h({enabled:S().describe(`Enable LLM sampling`),maxTokens:P().int().positive().describe(`Maximum tokens to generate`),temperature:P().min(0).max(2).optional().describe(`Sampling temperature`),stopSequences:C(r()).optional().describe(`Stop sequences to end generation`),modelPreferences:C(r()).optional().describe(`Preferred model IDs in priority order`),systemPrompt:r().optional().describe(`System prompt for sampling context`)}).describe(`Sampling configuration for MCP`),CG=h({uri:r().describe(`Root URI (e.g., file:///path/to/project)`),name:r().optional().describe(`Human-readable root name`),readOnly:S().optional().describe(`Whether the root is read-only`)}).describe(`A single root directory or resource`),wG=h({roots:C(CG).describe(`Root directories or resources available to the client`),watchForChanges:S().default(!1).describe(`Watch root directories for filesystem changes`),notifyOnChange:S().default(!0).describe(`Notify server when root contents change`)}).describe(`Roots configuration for MCP client`),TG=h({resources:S().default(!1).describe(`Supports resource listing and retrieval`),resourceTemplates:S().default(!1).describe(`Supports dynamic resource templates`),tools:S().default(!1).describe(`Supports tool/function calling`),prompts:S().default(!1).describe(`Supports prompt templates`),sampling:S().default(!1).describe(`Supports sampling from LLMs`),logging:S().default(!1).describe(`Supports logging and debugging`)}),EG=h({name:r().describe(`Server name`),version:r().describe(`Server version (semver)`),description:r().optional(),capabilities:TG,protocolVersion:r().default(`2024-11-05`).describe(`MCP protocol version`),vendor:r().optional().describe(`Server vendor/provider`),homepage:r().url().optional().describe(`Server homepage URL`),documentation:r().url().optional().describe(`Documentation URL`)}),DG=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Server unique identifier (snake_case)`),label:r().describe(`Display name`),description:r().optional(),serverInfo:EG,transport:dG,resources:C(pG).optional().describe(`Static resources`),resourceTemplates:C(mG).optional().describe(`Dynamic resource templates`),tools:C(gG).optional().describe(`Available tools`),prompts:C(yG).optional().describe(`Prompt templates`),autoStart:S().default(!1).describe(`Auto-start server on system boot`),restartOnFailure:S().default(!0).describe(`Auto-restart on failure`),healthCheck:h({enabled:S().default(!0),interval:P().int().positive().default(6e4).describe(`Health check interval in milliseconds`),timeout:P().int().positive().default(5e3).describe(`Health check timeout in milliseconds`),endpoint:r().optional().describe(`Health check endpoint (for HTTP servers)`)}).optional(),permissions:h({allowedAgents:C(r()).optional().describe(`Agent names allowed to use this server`),allowedUsers:C(r()).optional().describe(`User IDs allowed to use this server`),requireAuth:S().default(!0)}).optional(),rateLimit:h({enabled:S().default(!1),requestsPerMinute:P().int().positive().optional(),requestsPerHour:P().int().positive().optional(),burstSize:P().int().positive().optional()}).optional(),tags:C(r()).optional(),status:E([`active`,`inactive`,`maintenance`,`deprecated`]).default(`active`),version:r().optional().default(`1.0.0`),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional(),streaming:bG.optional().describe(`Streaming configuration`),toolApproval:xG.optional().describe(`Tool approval configuration`),sampling:SG.optional().describe(`LLM sampling configuration`)}),Dwe=h({uri:r().describe(`Resource URI to fetch`),parameters:d(r(),u()).optional().describe(`URI template parameters`)}),Owe=h({resource:pG,content:u().describe(`Resource content`)}),kwe=h({toolName:r().describe(`Tool to invoke`),parameters:d(r(),u()).describe(`Tool parameters`),timeout:P().int().positive().optional(),confirmationProvided:S().optional().describe(`User confirmation for tools that require it`),context:h({userId:r().optional(),sessionId:r().optional(),agentName:r().optional(),metadata:d(r(),u()).optional()}).optional()}),Awe=h({toolName:r(),status:E([`success`,`error`,`timeout`,`cancelled`]),result:u().optional().describe(`Tool execution result`),error:h({code:r(),message:r(),details:u().optional()}).optional(),executionTime:P().nonnegative().optional().describe(`Execution time in milliseconds`),timestamp:r().datetime().optional()}),jwe=h({promptName:r().describe(`Prompt template to use`),arguments:d(r(),u()).optional().describe(`Prompt arguments`)}),Mwe=h({promptName:r(),messages:C(vG).describe(`Rendered prompt messages`)}),Nwe=h({servers:C(DG).describe(`MCP servers to connect to`),defaultTimeout:P().int().positive().default(3e4).describe(`Default timeout for requests`),enableCaching:S().default(!0).describe(`Enable client-side caching`),cacheMaxAge:P().int().nonnegative().default(300).describe(`Cache max age in seconds`),retryAttempts:P().int().min(0).max(5).default(3),retryDelay:P().int().positive().default(1e3),enableLogging:S().default(!0),logLevel:E([`debug`,`info`,`warn`,`error`]).default(`info`),roots:wG.optional().describe(`Root directories/resources configuration`)}),OG=h({prompt:P().int().nonnegative().describe(`Input tokens`),completion:P().int().nonnegative().describe(`Output tokens`),total:P().int().nonnegative().describe(`Total tokens`)}),Pwe=h({operationId:r(),operationType:E([`conversation`,`orchestration`,`prediction`,`rag`,`nlq`]),agentName:r().optional().describe(`Agent that performed the operation`),modelId:r(),tokens:OG,cost:P().nonnegative().describe(`Cost in USD`),timestamp:r().datetime(),metadata:d(r(),u()).optional()}),Fwe=E([`token`,`request`,`character`,`second`,`image`,`embedding`]),kG=E([`hourly`,`daily`,`weekly`,`monthly`,`quarterly`,`yearly`,`custom`]),Iwe=h({id:r().describe(`Unique cost entry ID`),timestamp:r().datetime().describe(`ISO 8601 timestamp`),modelId:r().describe(`AI model used`),provider:r().describe(`AI provider (e.g., "openai", "anthropic")`),operation:r().describe(`Operation type (e.g., "chat_completion", "embedding")`),tokens:OG.optional().describe(`Standardized token usage`),requestCount:P().int().positive().default(1),promptCost:P().nonnegative().optional().describe(`Cost of prompt tokens`),completionCost:P().nonnegative().optional().describe(`Cost of completion tokens`),totalCost:P().nonnegative().describe(`Total cost in base currency`),currency:r().default(`USD`),sessionId:r().optional().describe(`Conversation session ID`),userId:r().optional().describe(`User who triggered the request`),agentId:r().optional().describe(`AI agent ID`),object:r().optional().describe(`Related object (e.g., "case", "project")`),recordId:r().optional().describe(`Related record ID`),tags:C(r()).optional(),metadata:d(r(),u()).optional()}),AG=E([`global`,`user`,`agent`,`object`,`project`,`department`]),Lwe=h({type:AG,scope:r().optional().describe(`Scope identifier (userId, agentId, etc.)`),maxCost:P().nonnegative().describe(`Maximum cost limit`),currency:r().default(`USD`),period:kG,customPeriodDays:P().int().positive().optional().describe(`Custom period in days`),softLimit:P().nonnegative().optional().describe(`Soft limit for warnings`),warnThresholds:C(P().min(0).max(1)).optional().describe(`Warning thresholds (e.g., [0.5, 0.8, 0.95])`),enforced:S().default(!0).describe(`Block requests when exceeded`),gracePeriodSeconds:P().int().nonnegative().default(0).describe(`Grace period after limit exceeded`),allowRollover:S().default(!1).describe(`Allow unused budget to rollover`),maxRolloverPercentage:P().min(0).max(1).optional().describe(`Max rollover as % of limit`),name:r().optional().describe(`Budget name`),description:r().optional(),active:S().default(!0),tags:C(r()).optional()}),jG=h({budgetId:r(),type:AG,scope:r().optional(),periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),currentCost:P().nonnegative().default(0),maxCost:P().nonnegative(),currency:r().default(`USD`),percentageUsed:P().nonnegative().describe(`Usage as percentage (can exceed 1.0 if over budget)`),remainingCost:P().describe(`Remaining budget (can be negative if exceeded)`),isExceeded:S().default(!1),isWarning:S().default(!1),projectedCost:P().nonnegative().optional().describe(`Projected cost for period`),projectedOverage:P().nonnegative().optional().describe(`Projected overage`),lastUpdated:r().datetime().describe(`ISO 8601 timestamp`)}),MG=E([`threshold_warning`,`threshold_critical`,`limit_exceeded`,`anomaly_detected`,`projection_exceeded`]),NG=h({id:r(),timestamp:r().datetime().describe(`ISO 8601 timestamp`),type:MG,severity:E([`info`,`warning`,`critical`]),budgetId:r().optional(),budgetType:AG.optional(),scope:r().optional(),message:r().describe(`Alert message`),currentCost:P().nonnegative(),maxCost:P().nonnegative().optional(),threshold:P().min(0).max(1).optional(),currency:r().default(`USD`),recommendations:C(r()).optional(),acknowledged:S().default(!1),acknowledgedBy:r().optional(),acknowledgedAt:r().datetime().optional(),resolved:S().default(!1),metadata:d(r(),u()).optional()}),PG=E([`model`,`provider`,`user`,`agent`,`object`,`operation`,`date`,`hour`,`tag`]),FG=h({dimension:PG,value:r().describe(`Dimension value (e.g., model ID, user ID)`),totalCost:P().nonnegative(),requestCount:P().int().nonnegative(),totalTokens:P().int().nonnegative().optional(),percentageOfTotal:P().min(0).max(1),periodStart:r().datetime().optional(),periodEnd:r().datetime().optional()}),IG=h({periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),totalCost:P().nonnegative(),totalRequests:P().int().nonnegative(),totalTokens:P().int().nonnegative().optional(),currency:r().default(`USD`),averageCostPerRequest:P().nonnegative(),averageCostPerToken:P().nonnegative().optional(),averageRequestsPerDay:P().nonnegative(),costTrend:E([`increasing`,`decreasing`,`stable`]).optional(),trendPercentage:P().optional().describe(`% change vs previous period`),byModel:C(FG).optional(),byProvider:C(FG).optional(),byUser:C(FG).optional(),byAgent:C(FG).optional(),byOperation:C(FG).optional(),byDate:C(FG).optional(),topModels:C(FG).optional(),topUsers:C(FG).optional(),topAgents:C(FG).optional(),tokensPerDollar:P().nonnegative().optional(),requestsPerDollar:P().nonnegative().optional()}),LG=h({id:r(),type:E([`switch_model`,`reduce_tokens`,`batch_requests`,`cache_results`,`adjust_parameters`,`limit_usage`]),title:r(),description:r(),estimatedSavings:P().nonnegative().optional(),savingsPercentage:P().min(0).max(1).optional(),priority:E([`low`,`medium`,`high`]),effort:E([`low`,`medium`,`high`]),actionable:S().default(!0),actionSteps:C(r()).optional(),targetModel:r().optional(),alternativeModel:r().optional(),affectedUsers:C(r()).optional(),status:E([`pending`,`accepted`,`rejected`,`implemented`]).default(`pending`),implementedAt:r().datetime().optional()}),Rwe=h({id:r(),name:r(),generatedAt:r().datetime().describe(`ISO 8601 timestamp`),periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),period:kG,analytics:IG,budgets:C(jG).optional(),alerts:C(NG).optional(),activeAlertCount:P().int().nonnegative().default(0),recommendations:C(LG).optional(),previousPeriodCost:P().nonnegative().optional(),costChange:P().optional().describe(`Change vs previous period`),costChangePercentage:P().optional(),forecastedCost:P().nonnegative().optional(),forecastedBudgetStatus:E([`under`,`at`,`over`]).optional(),format:E([`summary`,`detailed`,`executive`]).default(`summary`),currency:r().default(`USD`)}),zwe=h({startDate:r().datetime().optional().describe(`ISO 8601 timestamp`),endDate:r().datetime().optional().describe(`ISO 8601 timestamp`),modelIds:C(r()).optional(),providers:C(r()).optional(),userIds:C(r()).optional(),agentIds:C(r()).optional(),operations:C(r()).optional(),sessionIds:C(r()).optional(),minCost:P().nonnegative().optional(),maxCost:P().nonnegative().optional(),tags:C(r()).optional(),groupBy:C(PG).optional(),orderBy:E([`timestamp`,`cost`,`tokens`]).optional().default(`timestamp`),orderDirection:E([`asc`,`desc`]).optional().default(`desc`),limit:P().int().positive().optional(),offset:P().int().nonnegative().optional()}),RG=E([`pinecone`,`weaviate`,`qdrant`,`milvus`,`chroma`,`pgvector`,`redis`,`opensearch`,`elasticsearch`,`custom`]),zG=h({provider:E([`openai`,`cohere`,`huggingface`,`azure_openai`,`local`,`custom`]),model:r().describe(`Model name (e.g., "text-embedding-3-large")`),dimensions:P().int().positive().describe(`Embedding vector dimensions`),maxTokens:P().int().positive().optional().describe(`Maximum tokens per embedding`),batchSize:P().int().positive().optional().default(100).describe(`Batch size for embedding`),endpoint:r().url().optional().describe(`Custom endpoint URL`),apiKey:r().optional().describe(`API key`),secretRef:r().optional().describe(`Reference to stored secret`)}),BG=I(`type`,[h({type:m(`fixed`),chunkSize:P().int().positive().describe(`Fixed chunk size in tokens/chars`),chunkOverlap:P().int().min(0).default(0).describe(`Overlap between chunks`),unit:E([`tokens`,`characters`]).default(`tokens`)}),h({type:m(`semantic`),model:r().optional().describe(`Model for semantic chunking`),minChunkSize:P().int().positive().default(100),maxChunkSize:P().int().positive().default(1e3)}),h({type:m(`recursive`),separators:C(r()).default([` + +`,` +`,` `,``]),chunkSize:P().int().positive(),chunkOverlap:P().int().min(0).default(0)}),h({type:m(`markdown`),maxChunkSize:P().int().positive().default(1e3),respectHeaders:S().default(!0).describe(`Keep headers with content`),respectCodeBlocks:S().default(!0).describe(`Keep code blocks intact`)})]),VG=h({source:r().describe(`Document source (file path, URL, etc.)`),sourceType:E([`file`,`url`,`api`,`database`,`custom`]).optional(),title:r().optional(),author:r().optional().describe(`Document author`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`),tags:C(r()).optional(),category:r().optional(),language:r().optional().describe(`Document language (ISO 639-1 code)`),custom:d(r(),u()).optional().describe(`Custom metadata fields`)}),Bwe=h({id:r().describe(`Unique chunk identifier`),content:r().describe(`Chunk text content`),embedding:C(P()).optional().describe(`Embedding vector`),metadata:VG,chunkIndex:P().int().min(0).describe(`Chunk position in document`),tokens:P().int().optional().describe(`Token count`)}),HG=I(`type`,[h({type:m(`similarity`),topK:P().int().positive().default(5).describe(`Number of results to retrieve`),scoreThreshold:P().min(0).max(1).optional().describe(`Minimum similarity score`)}),h({type:m(`mmr`),topK:P().int().positive().default(5),fetchK:P().int().positive().default(20).describe(`Initial fetch size`),lambda:P().min(0).max(1).default(.5).describe(`Diversity vs relevance (0=diverse, 1=relevant)`)}),h({type:m(`hybrid`),topK:P().int().positive().default(5),vectorWeight:P().min(0).max(1).default(.7).describe(`Weight for vector search`),keywordWeight:P().min(0).max(1).default(.3).describe(`Weight for keyword search`)}),h({type:m(`parent_document`),topK:P().int().positive().default(5),retrieveParent:S().default(!0).describe(`Retrieve full parent document`)})]),UG=h({enabled:S().default(!1),model:r().optional().describe(`Reranking model name`),provider:E([`cohere`,`huggingface`,`custom`]).optional(),topK:P().int().positive().default(3).describe(`Final number of results after reranking`)}),WG=h({provider:RG,indexName:r().describe(`Index/collection name`),namespace:r().optional().describe(`Namespace for multi-tenancy`),host:r().optional().describe(`Vector store host`),port:P().int().optional().describe(`Vector store port`),secretRef:r().optional().describe(`Reference to stored secret`),apiKey:r().optional().describe(`API key or reference to secret`),dimensions:P().int().positive().describe(`Vector dimensions`),metric:E([`cosine`,`euclidean`,`dotproduct`]).optional().default(`cosine`),batchSize:P().int().positive().optional().default(100),connectionPoolSize:P().int().positive().optional().default(10),timeout:P().int().positive().optional().default(3e4).describe(`Timeout in milliseconds`)}),GG=h({type:E([`file`,`directory`,`url`,`api`,`database`,`custom`]),source:r().describe(`Source path, URL, or identifier`),fileTypes:C(r()).optional().describe(`Accepted file extensions (e.g., [".pdf", ".md"])`),recursive:S().optional().default(!1).describe(`Process directories recursively`),maxFileSize:P().int().optional().describe(`Maximum file size in bytes`),excludePatterns:C(r()).optional().describe(`Patterns to exclude`),extractImages:S().optional().default(!1).describe(`Extract text from images (OCR)`),extractTables:S().optional().default(!1).describe(`Extract and format tables`),loaderConfig:d(r(),u()).optional().describe(`Custom loader-specific config`)}),KG=h({field:r().describe(`Metadata field to filter`),operator:E([`eq`,`neq`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`,`contains`]).default(`eq`),value:l([r(),P(),S(),C(l([r(),P()]))]).describe(`Filter value`)}),qG=h({logic:E([`and`,`or`]).default(`and`),filters:C(l([KG,F(()=>qG)]))}),JG=l([KG,qG,d(r(),l([r(),P(),S(),C(l([r(),P()]))]))]),YG=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Pipeline name (snake_case)`),label:r().describe(`Display name`),description:r().optional(),embedding:zG,vectorStore:WG,chunking:BG,retrieval:HG,reranking:UG.optional(),loaders:C(GG).optional().describe(`Document loaders`),maxContextTokens:P().int().positive().default(4e3).describe(`Maximum tokens in context`),contextWindow:P().int().positive().optional().describe(`LLM context window size`),metadataFilters:JG.optional().describe(`Global filters for retrieval`),enableCache:S().default(!0),cacheTTL:P().int().positive().default(3600).describe(`Cache TTL in seconds`),cacheInvalidationStrategy:E([`time_based`,`manual`,`on_update`]).default(`time_based`).optional()}),Vwe=h({query:r().describe(`User query`),pipelineName:r().describe(`Pipeline to use`),topK:P().int().positive().optional(),metadataFilters:d(r(),u()).optional(),conversationHistory:C(h({role:E([`user`,`assistant`,`system`]),content:r()})).optional(),includeMetadata:S().default(!0),includeSources:S().default(!0)}),Hwe=h({query:r(),results:C(h({content:r(),score:P(),metadata:VG.optional(),chunkId:r().optional()})),context:r().describe(`Assembled context for LLM`),tokens:OG.optional().describe(`Token usage for this query`),cost:P().nonnegative().optional().describe(`Cost for this query in USD`),retrievalTime:P().optional().describe(`Retrieval time in milliseconds`)}),Uwe=h({name:r(),status:E([`active`,`indexing`,`error`,`disabled`]),documentsIndexed:P().int().min(0),lastIndexed:r().datetime().optional().describe(`ISO timestamp`),errorMessage:r().optional(),health:h({vectorStore:E([`healthy`,`unhealthy`,`unknown`]),embeddingService:E([`healthy`,`unhealthy`,`unknown`])}).optional()}),XG=E([`select`,`aggregate`,`filter`,`sort`,`compare`,`trend`,`insight`,`create`,`update`,`delete`]),ZG=h({type:E([`object`,`field`,`value`,`operator`,`function`,`timeframe`]),text:r().describe(`Original text from query`),value:u().describe(`Normalized value`),confidence:P().min(0).max(1).describe(`Confidence score`),span:w([P(),P()]).optional().describe(`Character span in query`)}),QG=h({type:E([`absolute`,`relative`]),start:r().optional().describe(`Start date (ISO format)`),end:r().optional().describe(`End date (ISO format)`),relative:h({unit:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]),value:P().int(),direction:E([`past`,`future`,`current`]).default(`past`)}).optional(),text:r().describe(`Original timeframe text`)}),$G=h({naturalLanguage:r().describe(`NL field name (e.g., "customer name")`),objectField:r().describe(`Actual field name (e.g., "account.name")`),object:r().describe(`Object name`),field:r().describe(`Field name`),confidence:P().min(0).max(1)}),eK=h({userId:r().optional(),userRole:r().optional(),currentObject:r().optional().describe(`Current object being viewed`),currentRecordId:r().optional().describe(`Current record ID`),conversationHistory:C(h({query:r(),timestamp:r(),intent:XG.optional()})).optional(),defaultLimit:P().int().default(100),timezone:r().default(`UTC`),locale:r().default(`en-US`)}),tK=h({originalQuery:r(),intent:XG,intentConfidence:P().min(0).max(1),entities:C(ZG),targetObject:r().optional().describe(`Primary object to query`),fields:C($G).optional(),timeframe:QG.optional(),ast:d(r(),u()).describe(`Generated ObjectQL AST`),confidence:P().min(0).max(1).describe(`Overall confidence`),ambiguities:C(h({type:r(),description:r(),suggestions:C(r()).optional()})).optional().describe(`Detected ambiguities requiring clarification`),alternatives:C(h({interpretation:r(),confidence:P(),ast:u()})).optional()}),Wwe=h({query:r().describe(`Natural language query`),context:eK.optional(),includeAlternatives:S().default(!1).describe(`Include alternative interpretations`),maxAlternatives:P().int().default(3),minConfidence:P().min(0).max(1).default(.5).describe(`Minimum confidence threshold`),executeQuery:S().default(!1).describe(`Execute query and return results`),maxResults:P().int().optional().describe(`Maximum results to return`)}),Gwe=h({parseResult:tK,results:C(d(r(),u())).optional().describe(`Query results`),totalCount:P().int().optional(),executionTime:P().optional().describe(`Execution time in milliseconds`),needsClarification:S().describe(`Whether query needs clarification`),tokens:OG.optional().describe(`Token usage for this query`),cost:P().nonnegative().optional().describe(`Cost for this query in USD`),suggestions:C(r()).optional().describe(`Query refinement suggestions`)}),Kwe=h({query:r().describe(`Natural language query`),context:eK.optional(),expectedIntent:XG,expectedObject:r().optional(),expectedAST:d(r(),u()).describe(`Expected ObjectQL AST`),category:r().optional().describe(`Example category`),tags:C(r()).optional(),notes:r().optional()}),qwe=h({modelId:r().describe(`Model from registry`),systemPrompt:r().optional().describe(`System prompt override`),includeSchema:S().default(!0).describe(`Include object schema in prompt`),includeExamples:S().default(!0).describe(`Include examples in prompt`),enableIntentDetection:S().default(!0),intentThreshold:P().min(0).max(1).default(.7),enableEntityRecognition:S().default(!0),entityRecognitionModel:r().optional(),enableFuzzyMatching:S().default(!0).describe(`Fuzzy match field names`),fuzzyMatchThreshold:P().min(0).max(1).default(.8),enableTimeframeDetection:S().default(!0),defaultTimeframe:r().optional().describe(`Default timeframe if not specified`),enableCaching:S().default(!0),cacheTTL:P().int().default(3600).describe(`Cache TTL in seconds`)}),Jwe=h({totalQueries:P().int(),successfulQueries:P().int(),failedQueries:P().int(),averageConfidence:P().min(0).max(1),intentDistribution:d(r(),P().int()).describe(`Count by intent type`),topQueries:C(h({query:r(),count:P().int(),averageConfidence:P()})),averageParseTime:P().describe(`Average parse time in milliseconds`),averageExecutionTime:P().optional(),lowConfidenceQueries:C(h({query:r(),confidence:P(),timestamp:r().datetime()})),startDate:r().datetime().describe(`ISO timestamp`),endDate:r().datetime().describe(`ISO timestamp`)}),Ywe=h({object:r().describe(`Object name`),field:r().describe(`Field name`),synonyms:C(r()).describe(`Natural language synonyms`),examples:C(r()).optional().describe(`Example queries using synonyms`)}),Xwe=h({id:r(),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template name (snake_case)`),label:r(),pattern:r().describe(`Query pattern with placeholders`),variables:C(h({name:r(),type:E([`object`,`field`,`value`,`timeframe`]),required:S().default(!1)})),astTemplate:d(r(),u()).describe(`AST template with variable placeholders`),category:r().optional(),examples:C(r()).optional(),tags:C(r()).optional()}),nK=E([`record_created`,`record_updated`,`field_changed`,`scheduled`,`manual`,`webhook`,`batch`]),rK=E([`classify`,`extract`,`summarize`,`generate`,`predict`,`translate`,`sentiment`,`entity_recognition`,`anomaly_detection`,`recommendation`]),iK=h({id:r().optional().describe(`Optional task ID for referencing`),name:r().describe(`Human-readable task name`),type:rK,model:r().optional().describe(`Model ID from registry (uses default if not specified)`),promptTemplate:r().optional().describe(`Prompt template ID for this task`),inputFields:C(r()).describe(`Source fields to process (e.g., ["description", "comments"])`),inputSchema:d(r(),u()).optional().describe(`Validation schema for inputs`),inputContext:d(r(),u()).optional().describe(`Additional context for the AI model`),outputField:r().describe(`Target field to store the result`),outputSchema:d(r(),u()).optional().describe(`Validation schema for output`),outputFormat:E([`text`,`json`,`number`,`boolean`,`array`]).optional().default(`text`),classes:C(r()).optional().describe(`Valid classes for classification tasks`),multiClass:S().optional().default(!1).describe(`Allow multiple classes to be selected`),extractionSchema:d(r(),u()).optional().describe(`JSON schema for structured extraction`),maxLength:P().optional().describe(`Maximum length for generated content`),temperature:P().min(0).max(2).optional().describe(`Model temperature override`),fallbackValue:u().optional().describe(`Fallback value if AI task fails`),retryAttempts:P().int().min(0).max(5).optional().default(1),condition:r().optional().describe(`Formula condition - task only runs if TRUE`),description:r().optional(),active:S().optional().default(!0)}),aK=h({field:r().describe(`Field name to monitor`),operator:E([`changed`,`changed_to`,`changed_from`,`is`,`is_not`]).optional().default(`changed`),value:u().optional().describe(`Value to compare against (for changed_to/changed_from/is/is_not)`)}),oK=h({type:E([`cron`,`interval`,`daily`,`weekly`,`monthly`]).default(`cron`),cron:r().optional().describe(`Cron expression (required if type is "cron")`),interval:P().optional().describe(`Interval in minutes (required if type is "interval")`),time:r().optional().describe(`Time of day for daily schedules (HH:MM format)`),dayOfWeek:P().int().min(0).max(6).optional().describe(`Day of week for weekly (0=Sunday)`),dayOfMonth:P().int().min(1).max(31).optional().describe(`Day of month for monthly`),timezone:r().optional().default(`UTC`)}),sK=h({type:E([`field_update`,`send_email`,`create_record`,`update_related`,`trigger_flow`,`webhook`]),name:r().describe(`Action name`),config:d(r(),u()).describe(`Action-specific configuration`),condition:r().optional().describe(`Execute only if condition is TRUE`)}),Zwe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Orchestration unique identifier (snake_case)`),label:r().describe(`Display name`),description:r().optional(),objectName:r().describe(`Target object for this orchestration`),trigger:nK,fieldConditions:C(aK).optional().describe(`Fields to monitor (for field_changed trigger)`),schedule:oK.optional().describe(`Schedule configuration (for scheduled trigger)`),webhookConfig:h({secret:r().optional().describe(`Webhook verification secret`),headers:d(r(),r()).optional().describe(`Expected headers`)}).optional().describe(`Webhook configuration (for webhook trigger)`),entryCriteria:r().optional().describe(`Formula condition - workflow only runs if TRUE`),aiTasks:C(iK).describe(`AI tasks to execute in sequence`),postActions:C(sK).optional().describe(`Actions after AI tasks complete`),executionMode:E([`sequential`,`parallel`]).optional().default(`sequential`).describe(`How to execute multiple AI tasks`),stopOnError:S().optional().default(!1).describe(`Stop workflow if any task fails`),timeout:P().optional().describe(`Maximum execution time in seconds`),priority:E([`low`,`normal`,`high`,`critical`]).optional().default(`normal`),enableLogging:S().optional().default(!0),enableMetrics:S().optional().default(!0),notifyOnFailure:C(r()).optional().describe(`User IDs to notify on failure`),active:S().optional().default(!0),version:r().optional().default(`1.0.0`),tags:C(r()).optional(),category:r().optional().describe(`Workflow category (e.g., "support", "sales", "hr")`),owner:r().optional().describe(`User ID of workflow owner`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`)}),Qwe=h({workflowName:r().describe(`Orchestration to execute`),recordIds:C(r()).describe(`Records to process`),batchSize:P().int().min(1).max(1e3).optional().default(10),parallelism:P().int().min(1).max(10).optional().default(3),priority:E([`low`,`normal`,`high`]).optional().default(`normal`)}),$we=h({workflowName:r(),recordId:r(),status:E([`success`,`partial_success`,`failed`,`skipped`]),executionTime:P().describe(`Execution time in milliseconds`),tasksExecuted:P().int().describe(`Number of tasks executed`),tasksSucceeded:P().int().describe(`Number of tasks succeeded`),tasksFailed:P().int().describe(`Number of tasks failed`),taskResults:C(h({taskId:r().optional(),taskName:r(),status:E([`success`,`failed`,`skipped`]),output:u().optional(),error:r().optional(),executionTime:P().optional().describe(`Task execution time in milliseconds`),modelUsed:r().optional(),tokensUsed:P().optional()})).optional(),tokens:OG.optional().describe(`Total token usage for this execution`),cost:P().nonnegative().optional().describe(`Total cost for this execution in USD`),error:r().optional(),startedAt:r().datetime().describe(`ISO timestamp`),completedAt:r().datetime().optional().describe(`ISO timestamp`)}),cK=E([`message_passing`,`shared_memory`,`blackboard`]),lK=E([`coordinator`,`specialist`,`critic`,`executor`]),uK=h({agentId:r().describe(`Agent identifier (reference to AgentSchema.name)`),role:lK.describe(`Agent role within the group`),capabilities:C(r()).optional().describe(`List of capabilities this agent contributes`),dependencies:C(r()).optional().describe(`Agent IDs this agent depends on for input`),priority:P().int().min(0).optional().describe(`Execution priority (0 = highest)`)}),eTe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Group unique identifier (snake_case)`),label:r().describe(`Group display name`),description:r().optional(),strategy:E([`sequential`,`parallel`,`debate`,`hierarchical`,`swarm`]).describe(`Multi-agent orchestration strategy`),agents:C(uK).min(2).describe(`Agent members (minimum 2)`),communication:h({protocol:cK.describe(`Inter-agent communication protocol`),messageQueue:r().optional().describe(`Message queue identifier for async communication`),maxRounds:P().int().min(1).optional().describe(`Maximum communication rounds before forced termination`)}).describe(`Communication configuration`),conflictResolution:E([`voting`,`priorityBased`,`consensusBased`,`coordinatorDecides`]).optional().describe(`How conflicts between agents are resolved`),timeout:P().int().min(1).optional().describe(`Maximum execution time in seconds for the group`),active:S().default(!0).describe(`Whether this agent group is active`)}),dK=E([`classification`,`regression`,`clustering`,`forecasting`,`anomaly_detection`,`recommendation`,`ranking`]),fK=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Feature name (snake_case)`),label:r().optional().describe(`Human-readable label`),field:r().describe(`Source field name`),object:r().optional().describe(`Source object (if different from target)`),dataType:E([`numeric`,`categorical`,`text`,`datetime`,`boolean`]).describe(`Feature data type`),transformation:E([`none`,`normalize`,`standardize`,`one_hot_encode`,`label_encode`,`log_transform`,`binning`,`embedding`]).optional().default(`none`),required:S().optional().default(!0),defaultValue:u().optional(),description:r().optional(),importance:P().optional().describe(`Feature importance score (0-1)`)}),pK=h({learningRate:P().optional().describe(`Learning rate for training`),epochs:P().int().optional().describe(`Number of training epochs`),batchSize:P().int().optional().describe(`Training batch size`),maxDepth:P().int().optional().describe(`Maximum tree depth`),numTrees:P().int().optional().describe(`Number of trees in ensemble`),minSamplesSplit:P().int().optional().describe(`Minimum samples to split node`),minSamplesLeaf:P().int().optional().describe(`Minimum samples in leaf node`),hiddenLayers:C(P().int()).optional().describe(`Hidden layer sizes`),activation:r().optional().describe(`Activation function`),dropout:P().optional().describe(`Dropout rate`),l1Regularization:P().optional().describe(`L1 regularization strength`),l2Regularization:P().optional().describe(`L2 regularization strength`),numClusters:P().int().optional().describe(`Number of clusters (k-means, etc.)`),seasonalPeriod:P().int().optional().describe(`Seasonal period for time series`),forecastHorizon:P().int().optional().describe(`Number of periods to forecast`),custom:d(r(),u()).optional().describe(`Algorithm-specific parameters`)}),mK=h({trainingDataRatio:P().min(0).max(1).optional().default(.8).describe(`Proportion of data for training`),validationDataRatio:P().min(0).max(1).optional().default(.1).describe(`Proportion for validation`),testDataRatio:P().min(0).max(1).optional().default(.1).describe(`Proportion for testing`),dataFilter:r().optional().describe(`Formula to filter training data`),minRecords:P().int().optional().default(100).describe(`Minimum records required`),maxRecords:P().int().optional().describe(`Maximum records to use`),strategy:E([`full`,`incremental`,`online`,`transfer_learning`]).optional().default(`full`),crossValidation:S().optional().default(!0),folds:P().int().min(2).max(10).optional().default(5).describe(`Cross-validation folds`),earlyStoppingEnabled:S().optional().default(!0),earlyStoppingPatience:P().int().optional().default(10).describe(`Epochs without improvement before stopping`),maxTrainingTime:P().optional().describe(`Maximum training time in seconds`),gpuEnabled:S().optional().default(!1),randomSeed:P().int().optional().describe(`Random seed for reproducibility`)}).superRefine((e,t)=>{if(e.trainingDataRatio&&e.validationDataRatio&&e.testDataRatio){let n=e.trainingDataRatio+e.validationDataRatio+e.testDataRatio;Math.abs(n-1)>.01&&t.addIssue({code:de.custom,message:`Data split ratios must sum to 1. Current sum: ${n}`,path:[`trainingDataRatio`]})}}),hK=h({accuracy:P().optional(),precision:P().optional(),recall:P().optional(),f1Score:P().optional(),auc:P().optional().describe(`Area Under ROC Curve`),mse:P().optional().describe(`Mean Squared Error`),rmse:P().optional().describe(`Root Mean Squared Error`),mae:P().optional().describe(`Mean Absolute Error`),r2Score:P().optional().describe(`R-squared score`),silhouetteScore:P().optional(),daviesBouldinIndex:P().optional(),mape:P().optional().describe(`Mean Absolute Percentage Error`),smape:P().optional().describe(`Symmetric MAPE`),custom:d(r(),P()).optional()}),tTe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Model unique identifier (snake_case)`),label:r().describe(`Model display name`),description:r().optional(),type:dK,algorithm:r().optional().describe(`Specific algorithm (e.g., "random_forest", "xgboost", "lstm")`),objectName:r().describe(`Target object for predictions`),target:r().describe(`Target field to predict`),targetType:E([`numeric`,`categorical`,`binary`]).optional().describe(`Target field type`),features:C(fK).describe(`Input features for the model`),hyperparameters:pK.optional(),training:mK.optional(),metrics:hK.optional().describe(`Evaluation metrics from last training`),deploymentStatus:E([`draft`,`training`,`trained`,`deployed`,`deprecated`]).optional().default(`draft`),version:r().optional().default(`1.0.0`),predictionField:r().optional().describe(`Field to store predictions`),confidenceField:r().optional().describe(`Field to store confidence scores`),updateTrigger:E([`on_create`,`on_update`,`manual`,`scheduled`]).optional().default(`on_create`),autoRetrain:S().optional().default(!1),retrainSchedule:r().optional().describe(`Cron expression for auto-retraining`),retrainThreshold:P().optional().describe(`Performance threshold to trigger retraining`),enableExplainability:S().optional().default(!1).describe(`Generate feature importance & explanations`),enableMonitoring:S().optional().default(!0),alertOnDrift:S().optional().default(!0).describe(`Alert when model drift is detected`),active:S().optional().default(!0),owner:r().optional().describe(`User ID of model owner`),permissions:C(r()).optional().describe(`User/group IDs with access`),tags:C(r()).optional(),category:r().optional().describe(`Model category (e.g., "sales", "marketing", "operations")`),lastTrainedAt:r().datetime().optional().describe(`ISO timestamp`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`)}),nTe=h({modelName:r().describe(`Model to use for prediction`),recordIds:C(r()).optional().describe(`Specific records to predict (if not provided, uses all)`),inputData:d(r(),u()).optional().describe(`Direct input data (alternative to recordIds)`),returnConfidence:S().optional().default(!0),returnExplanation:S().optional().default(!1)}),rTe=h({modelName:r(),modelVersion:r(),recordId:r().optional(),prediction:u().describe(`The predicted value`),confidence:P().optional().describe(`Confidence score (0-1)`),probabilities:d(r(),P()).optional().describe(`Class probabilities (for classification)`),explanation:h({topFeatures:C(h({feature:r(),importance:P(),value:u()})).optional(),reasoning:r().optional()}).optional(),tokens:OG.optional().describe(`Token usage for this prediction (if AI-powered)`),cost:P().nonnegative().optional().describe(`Cost for this prediction in USD`),metadata:h({executionTime:P().optional().describe(`Execution time in milliseconds`),timestamp:r().datetime().optional().describe(`ISO timestamp`)}).optional()}),iTe=h({modelName:r(),driftType:E([`feature_drift`,`prediction_drift`,`performance_drift`]),severity:E([`low`,`medium`,`high`,`critical`]),detectedAt:r().datetime().describe(`ISO timestamp`),metrics:h({driftScore:P().describe(`Drift magnitude (0-1)`),affectedFeatures:C(r()).optional(),performanceChange:P().optional().describe(`Change in performance metric`)}),recommendation:r().optional(),autoRetrainTriggered:S().optional().default(!1)}),gK=E([`system`,`user`,`assistant`,`function`,`tool`]),aTe=E([`text`,`image`,`file`,`code`,`structured`]),_K=h({type:m(`text`),text:r().describe(`Text content`),metadata:d(r(),u()).optional()}),vK=h({type:m(`image`),imageUrl:r().url().describe(`Image URL`),detail:E([`low`,`high`,`auto`]).optional().default(`auto`),metadata:d(r(),u()).optional()}),yK=h({type:m(`file`),fileUrl:r().url().describe(`File attachment URL`),mimeType:r().describe(`MIME type`),fileName:r().optional(),metadata:d(r(),u()).optional()}),bK=h({type:m(`code`),text:r().describe(`Code snippet`),language:r().optional().default(`text`),metadata:d(r(),u()).optional()}),xK=l([_K,vK,yK,bK]),SK=h({name:r().describe(`Function name`),arguments:r().describe(`JSON string of function arguments`),result:r().optional().describe(`Function execution result`)}),CK=h({id:r().describe(`Tool call ID`),type:E([`function`]).default(`function`),function:SK}),wK=h({id:r().describe(`Unique message ID`),timestamp:r().datetime().describe(`ISO 8601 timestamp`),role:gK,content:C(xK).describe(`Message content (multimodal array)`),functionCall:SK.optional().describe(`Legacy function call`),toolCalls:C(CK).optional().describe(`Tool calls`),toolCallId:r().optional().describe(`Tool call ID this message responds to`),name:r().optional().describe(`Name of the function/user`),tokens:OG.optional().describe(`Token usage for this message`),cost:P().nonnegative().optional().describe(`Cost for this message in USD`),pinned:S().optional().default(!1).describe(`Prevent removal during pruning`),importance:P().min(0).max(1).optional().describe(`Importance score for pruning`),embedding:C(P()).optional().describe(`Vector embedding for semantic search`),metadata:d(r(),u()).optional()}),TK=E([`fifo`,`importance`,`semantic`,`sliding_window`,`summary`]),EK=h({maxTokens:P().int().positive().describe(`Maximum total tokens`),maxPromptTokens:P().int().positive().optional().describe(`Max tokens for prompt`),maxCompletionTokens:P().int().positive().optional().describe(`Max tokens for completion`),reserveTokens:P().int().nonnegative().default(500).describe(`Reserve tokens for system messages`),bufferPercentage:P().min(0).max(1).default(.1).describe(`Buffer percentage (0.1 = 10%)`),strategy:TK.default(`sliding_window`),slidingWindowSize:P().int().positive().optional().describe(`Number of recent messages to keep`),minImportanceScore:P().min(0).max(1).optional().describe(`Minimum importance to keep`),semanticThreshold:P().min(0).max(1).optional().describe(`Semantic similarity threshold`),enableSummarization:S().default(!1).describe(`Enable context summarization`),summarizationThreshold:P().int().positive().optional().describe(`Trigger summarization at N tokens`),summaryModel:r().optional().describe(`Model ID for summarization`),warnThreshold:P().min(0).max(1).default(.8).describe(`Warn at % of budget (0.8 = 80%)`)}),DK=h({promptTokens:P().int().nonnegative().default(0),completionTokens:P().int().nonnegative().default(0),totalTokens:P().int().nonnegative().default(0),budgetLimit:P().int().positive(),budgetUsed:P().int().nonnegative().default(0),budgetRemaining:P().int().nonnegative(),budgetPercentage:P().min(0).max(1).describe(`Usage as percentage of budget`),messageCount:P().int().nonnegative().default(0),prunedMessageCount:P().int().nonnegative().default(0),summarizedMessageCount:P().int().nonnegative().default(0)}),OK=h({sessionId:r().describe(`Conversation session ID`),userId:r().optional().describe(`User identifier`),agentId:r().optional().describe(`AI agent identifier`),object:r().optional().describe(`Related object (e.g., "case", "project")`),recordId:r().optional().describe(`Related record ID`),scope:d(r(),u()).optional().describe(`Additional context scope`),systemMessage:r().optional().describe(`System prompt/instructions`),metadata:d(r(),u()).optional()}),oTe=h({id:r().describe(`Unique session ID`),name:r().optional().describe(`Session name/title`),context:OK,modelId:r().optional().describe(`AI model ID`),tokenBudget:EK,messages:C(wK).default([]),tokens:DK.optional(),totalTokens:OG.optional().describe(`Total tokens across all messages`),totalCost:P().nonnegative().optional().describe(`Total cost for this session in USD`),status:E([`active`,`paused`,`completed`,`archived`]).default(`active`),createdAt:r().datetime().describe(`ISO 8601 timestamp`),updatedAt:r().datetime().describe(`ISO 8601 timestamp`),expiresAt:r().datetime().optional().describe(`ISO 8601 timestamp`),metadata:d(r(),u()).optional()}),sTe=h({summary:r().describe(`Conversation summary`),keyPoints:C(r()).optional().describe(`Key discussion points`),originalTokens:P().int().nonnegative().describe(`Original token count`),summaryTokens:P().int().nonnegative().describe(`Summary token count`),tokensSaved:P().int().nonnegative().describe(`Tokens saved`),messageRange:h({startIndex:P().int().nonnegative(),endIndex:P().int().nonnegative()}).describe(`Range of messages summarized`),generatedAt:r().datetime().describe(`ISO 8601 timestamp`),modelId:r().optional().describe(`Model used for summarization`)}),cTe=h({timestamp:r().datetime().describe(`Event timestamp`),prunedMessages:C(h({messageId:r(),role:gK,tokens:P().int().nonnegative(),importance:P().min(0).max(1).optional()})),tokensFreed:P().int().nonnegative(),messagesRemoved:P().int().nonnegative(),remainingTokens:P().int().nonnegative(),remainingMessages:P().int().nonnegative()}),lTe=h({sessionId:r(),totalMessages:P().int().nonnegative(),userMessages:P().int().nonnegative(),assistantMessages:P().int().nonnegative(),systemMessages:P().int().nonnegative(),totalTokens:P().int().nonnegative(),averageTokensPerMessage:P().nonnegative(),peakTokenUsage:P().int().nonnegative(),pruningEvents:P().int().nonnegative().default(0),summarizationEvents:P().int().nonnegative().default(0),tokensSavedByPruning:P().int().nonnegative().default(0),tokensSavedBySummarization:P().int().nonnegative().default(0),duration:P().nonnegative().optional().describe(`Session duration in seconds`),firstMessageAt:r().datetime().optional().describe(`ISO 8601 timestamp`),lastMessageAt:r().datetime().optional().describe(`ISO 8601 timestamp`)}),kK=h({file:r().optional(),line:P().optional(),column:P().optional(),package:r().optional(),object:r().optional(),field:r().optional(),component:r().optional()}),AK=h({id:r(),severity:E([`critical`,`error`,`warning`,`info`]),message:r(),stackTrace:r().optional(),timestamp:r().datetime(),userId:r().optional(),context:d(r(),u()).optional(),source:kK.optional()}),jK=h({issueId:r(),reasoning:r().describe(`Explanation of why this fix is needed`),confidence:P().min(0).max(1),fix:I(`type`,[h({type:m(`metadata_change`),changeSet:UR}),h({type:m(`manual_intervention`),instructions:r()})])}),uTe=h({issue:AK,analysis:r().optional().describe(`AI analysis of the root cause`),resolutions:C(jK).optional(),status:E([`open`,`analyzing`,`resolved`,`ignored`]).default(`open`)});DA({},{AckMessageSchema:()=>Dq,AddReactionRequestSchema:()=>yX,AddReactionResponseSchema:()=>bX,AiInsightsRequestSchema:()=>kDe,AiInsightsResponseSchema:()=>ADe,AiNlqRequestSchema:()=>TDe,AiNlqResponseSchema:()=>EDe,AiSuggestRequestSchema:()=>DDe,AiSuggestResponseSchema:()=>ODe,AnalyticsEndpoint:()=>ZDe,AnalyticsMetadataResponseSchema:()=>tOe,AnalyticsQueryRequestSchema:()=>QDe,AnalyticsResultResponseSchema:()=>$De,AnalyticsSqlResponseSchema:()=>nOe,ApiChangelogEntrySchema:()=>uY,ApiDiscoveryQuerySchema:()=>nY,ApiDiscoveryResponseSchema:()=>UDe,ApiDocumentationConfig:()=>JDe,ApiDocumentationConfigSchema:()=>fY,ApiEndpoint:()=>mTe,ApiEndpointRegistration:()=>WDe,ApiEndpointRegistrationSchema:()=>ZJ,ApiEndpointSchema:()=>KK,ApiErrorSchema:()=>MK,ApiMappingSchema:()=>GK,ApiMetadataSchema:()=>QJ,ApiParameterSchema:()=>YJ,ApiProtocolType:()=>KJ,ApiRegistry:()=>KDe,ApiRegistryEntry:()=>GDe,ApiRegistryEntrySchema:()=>$J,ApiRegistrySchema:()=>tY,ApiResponseSchema:()=>XJ,ApiRoutesSchema:()=>YK,ApiTestCollection:()=>YDe,ApiTestCollectionSchema:()=>lY,ApiTestRequestSchema:()=>cY,ApiTestingUiConfigSchema:()=>sY,ApiTestingUiType:()=>oY,AppDefinitionResponseSchema:()=>bOe,AuthEndpointAliases:()=>pOe,AuthEndpointPaths:()=>yY,AuthEndpointSchema:()=>fOe,AuthFeaturesConfigSchema:()=>SY,AuthProvider:()=>oOe,AuthProviderInfoSchema:()=>bY,AutomationApiContracts:()=>_ke,AutomationApiErrorCode:()=>gke,AutomationFlowPathParamsSchema:()=>uZ,AutomationRunPathParamsSchema:()=>dZ,AutomationTriggerRequestSchema:()=>KTe,AutomationTriggerResponseSchema:()=>qTe,BasePresenceSchema:()=>nq,BaseResponseSchema:()=>J,BatchApiContracts:()=>VTe,BatchConfigSchema:()=>HTe,BatchDataRequestSchema:()=>yEe,BatchDataResponseSchema:()=>bEe,BatchEndpointsConfigSchema:()=>zJ,BatchLoadingStrategySchema:()=>WK,BatchOperationResultSchema:()=>iJ,BatchOperationType:()=>$q,BatchOptionsSchema:()=>tJ,BatchRecordSchema:()=>eJ,BatchUpdateRequestSchema:()=>nJ,BatchUpdateResponseSchema:()=>aJ,BulkRequestSchema:()=>IK,BulkResponseSchema:()=>VK,CacheControlSchema:()=>cJ,CacheDirective:()=>sJ,CacheInvalidationRequestSchema:()=>pJ,CacheInvalidationResponseSchema:()=>mJ,CacheInvalidationTarget:()=>fJ,CallbackSchema:()=>HJ,ChangelogEntrySchema:()=>PX,CheckPermissionRequestSchema:()=>LEe,CheckPermissionResponseSchema:()=>REe,CodeGenerationTemplateSchema:()=>dY,CompleteChunkedUploadRequestSchema:()=>jY,CompleteChunkedUploadResponseSchema:()=>MY,CompleteUploadRequestSchema:()=>wY,ConceptListResponseSchema:()=>xOe,ConflictResolutionStrategy:()=>eY,CreateDataRequestSchema:()=>pEe,CreateDataResponseSchema:()=>mEe,CreateExportJobRequestSchema:()=>HX,CreateExportJobResponseSchema:()=>UX,CreateFeedItemRequestSchema:()=>pX,CreateFeedItemResponseSchema:()=>mX,CreateFlowRequestSchema:()=>_Z,CreateFlowResponseSchema:()=>vZ,CreateManyDataRequestSchema:()=>xEe,CreateManyDataResponseSchema:()=>SEe,CreateRequestSchema:()=>PK,CreateViewRequestSchema:()=>jEe,CreateViewResponseSchema:()=>MEe,CrudEndpointPatternSchema:()=>IJ,CrudEndpointsConfigSchema:()=>LJ,CrudOperation:()=>FJ,CursorMessageSchema:()=>Tq,CursorPositionSchema:()=>_q,DEFAULT_AI_ROUTES:()=>$Y,DEFAULT_ANALYTICS_ROUTES:()=>tX,DEFAULT_AUTOMATION_ROUTES:()=>nX,DEFAULT_BATCH_ROUTES:()=>qY,DEFAULT_DATA_CRUD_ROUTES:()=>KY,DEFAULT_DISCOVERY_ROUTES:()=>XOe,DEFAULT_DISPATCHER_ROUTES:()=>qOe,DEFAULT_I18N_ROUTES:()=>eX,DEFAULT_METADATA_ROUTES:()=>GY,DEFAULT_NOTIFICATION_ROUTES:()=>QY,DEFAULT_PERMISSION_ROUTES:()=>JY,DEFAULT_REALTIME_ROUTES:()=>ZY,DEFAULT_VERSIONING_CONFIG:()=>aOe,DEFAULT_VIEW_ROUTES:()=>YY,DEFAULT_WORKFLOW_ROUTES:()=>XY,DataEventSchema:()=>vTe,DataEventType:()=>$K,DataLoaderConfigSchema:()=>UK,DeduplicationStrategy:()=>KX,DeleteDataRequestSchema:()=>_Ee,DeleteDataResponseSchema:()=>vEe,DeleteFeedItemRequestSchema:()=>_X,DeleteFeedItemResponseSchema:()=>vX,DeleteFlowRequestSchema:()=>xZ,DeleteFlowResponseSchema:()=>SZ,DeleteManyDataRequestSchema:()=>TEe,DeleteManyDataResponseSchema:()=>EEe,DeleteManyRequestSchema:()=>oJ,DeleteResponseSchema:()=>HK,DeleteViewRequestSchema:()=>FEe,DeleteViewResponseSchema:()=>IEe,DisablePackageRequestSchema:()=>mH,DisablePackageResponseSchema:()=>hH,DiscoverySchema:()=>XK,DispatcherConfigSchema:()=>KOe,DispatcherErrorCode:()=>JOe,DispatcherErrorResponseSchema:()=>YOe,DispatcherRouteSchema:()=>PY,DocumentStateSchema:()=>STe,ETagSchema:()=>lJ,EditMessageSchema:()=>Eq,EditOperationSchema:()=>yq,EditOperationType:()=>vq,EmailPasswordConfigPublicSchema:()=>xY,EnablePackageRequestSchema:()=>fH,EnablePackageResponseSchema:()=>pH,EndpointMapping:()=>hOe,EndpointRegistrySchema:()=>zDe,EnhancedApiErrorSchema:()=>yJ,ErrorCategory:()=>hJ,ErrorHandlingConfigSchema:()=>HY,ErrorHttpStatusMap:()=>WTe,ErrorMessageSchema:()=>Oq,ErrorResponseSchema:()=>GTe,EventFilterCondition:()=>uq,EventFilterSchema:()=>dq,EventMessageSchema:()=>Cq,EventPatternSchema:()=>fq,EventSubscriptionSchema:()=>pq,ExportApiContracts:()=>lke,ExportFormat:()=>BX,ExportImportTemplateSchema:()=>ske,ExportJobProgressSchema:()=>WX,ExportJobStatus:()=>VX,ExportJobSummarySchema:()=>ZX,ExportRequestSchema:()=>dTe,FederationEntityKeySchema:()=>Gq,FederationEntitySchema:()=>Yq,FederationExternalFieldSchema:()=>Kq,FederationGatewaySchema:()=>Zq,FederationProvidesSchema:()=>Jq,FederationRequiresSchema:()=>qq,FeedApiContracts:()=>ike,FeedApiErrorCode:()=>rke,FeedItemPathParamsSchema:()=>lX,FeedListFilterType:()=>uX,FeedPathParamsSchema:()=>cX,FeedUnsubscribeRequestSchema:()=>RX,FieldErrorSchema:()=>vJ,FieldMappingEntrySchema:()=>qX,FileTypeValidationSchema:()=>_Oe,FileUploadResponseSchema:()=>EY,FilterOperator:()=>lq,FindDataRequestSchema:()=>cEe,FindDataResponseSchema:()=>lEe,FlowSummarySchema:()=>pZ,GeneratedApiDocumentationSchema:()=>qDe,GeneratedEndpointSchema:()=>GJ,GetAnalyticsMetaRequestSchema:()=>eOe,GetAuthConfigResponseSchema:()=>gOe,GetChangelogRequestSchema:()=>NX,GetChangelogResponseSchema:()=>FX,GetDataRequestSchema:()=>dEe,GetDataResponseSchema:()=>fEe,GetDiscoveryRequestSchema:()=>JTe,GetDiscoveryResponseSchema:()=>YTe,GetEffectivePermissionsRequestSchema:()=>VEe,GetEffectivePermissionsResponseSchema:()=>HEe,GetExportJobDownloadRequestSchema:()=>JX,GetExportJobDownloadResponseSchema:()=>YX,GetFeedRequestSchema:()=>dX,GetFeedResponseSchema:()=>fX,GetFieldLabelsRequestSchema:()=>FDe,GetFieldLabelsResponseSchema:()=>IDe,GetFlowRequestSchema:()=>hZ,GetFlowResponseSchema:()=>gZ,GetInstalledPackageRequestSchema:()=>PZ,GetInstalledPackageResponseSchema:()=>FZ,GetLocalesRequestSchema:()=>jDe,GetLocalesResponseSchema:()=>MDe,GetMetaItemCachedRequestSchema:()=>iEe,GetMetaItemCachedResponseSchema:()=>aEe,GetMetaItemRequestSchema:()=>eEe,GetMetaItemResponseSchema:()=>tEe,GetMetaItemsRequestSchema:()=>QTe,GetMetaItemsResponseSchema:()=>$Te,GetMetaTypesRequestSchema:()=>XTe,GetMetaTypesResponseSchema:()=>ZTe,GetNotificationPreferencesRequestSchema:()=>hDe,GetNotificationPreferencesResponseSchema:()=>gDe,GetObjectPermissionsRequestSchema:()=>zEe,GetObjectPermissionsResponseSchema:()=>BEe,GetPackageRequestSchema:()=>oH,GetPackageResponseSchema:()=>sH,GetPresenceRequestSchema:()=>lDe,GetPresenceResponseSchema:()=>uDe,GetPresignedUrlRequestSchema:()=>CY,GetRunRequestSchema:()=>kZ,GetRunResponseSchema:()=>AZ,GetTranslationsRequestSchema:()=>NDe,GetTranslationsResponseSchema:()=>PDe,GetUiViewRequestSchema:()=>oEe,GetUiViewResponseSchema:()=>sEe,GetViewRequestSchema:()=>kEe,GetViewResponseSchema:()=>AEe,GetWorkflowConfigRequestSchema:()=>UEe,GetWorkflowConfigResponseSchema:()=>WEe,GetWorkflowStateRequestSchema:()=>GEe,GetWorkflowStateResponseSchema:()=>KEe,GraphQLConfig:()=>zTe,GraphQLConfigSchema:()=>Qq,GraphQLDataLoaderConfigSchema:()=>Rq,GraphQLDirectiveConfigSchema:()=>Bq,GraphQLDirectiveLocation:()=>zq,GraphQLMutationConfigSchema:()=>Fq,GraphQLPersistedQuerySchema:()=>Wq,GraphQLQueryAdapterSchema:()=>oX,GraphQLQueryComplexitySchema:()=>Hq,GraphQLQueryConfigSchema:()=>Pq,GraphQLQueryDepthLimitSchema:()=>Vq,GraphQLRateLimitSchema:()=>Uq,GraphQLResolverConfigSchema:()=>Lq,GraphQLScalarType:()=>RTe,GraphQLSubscriptionConfigSchema:()=>Iq,GraphQLTypeConfigSchema:()=>Nq,HandlerStatusSchema:()=>IY,HttpFindQueryParamsSchema:()=>uEe,HttpMethod:()=>NA,HttpStatusCode:()=>qJ,IdRequestSchema:()=>zK,ImportValidationConfigSchema:()=>ake,ImportValidationMode:()=>GX,ImportValidationResultSchema:()=>oke,InitiateChunkedUploadRequestSchema:()=>DY,InitiateChunkedUploadResponseSchema:()=>OY,InstallPackageRequestSchema:()=>cH,InstallPackageResponseSchema:()=>lH,ListExportJobsRequestSchema:()=>XX,ListExportJobsResponseSchema:()=>QX,ListFlowsRequestSchema:()=>fZ,ListFlowsResponseSchema:()=>mZ,ListInstalledPackagesRequestSchema:()=>MZ,ListInstalledPackagesResponseSchema:()=>NZ,ListNotificationsRequestSchema:()=>yDe,ListNotificationsResponseSchema:()=>bDe,ListPackagesRequestSchema:()=>iH,ListPackagesResponseSchema:()=>aH,ListRecordResponseSchema:()=>RK,ListRunsRequestSchema:()=>DZ,ListRunsResponseSchema:()=>OZ,ListViewsRequestSchema:()=>DEe,ListViewsResponseSchema:()=>OEe,LoginRequestSchema:()=>sOe,LoginType:()=>vY,MarkAllNotificationsReadRequestSchema:()=>CDe,MarkAllNotificationsReadResponseSchema:()=>wDe,MarkNotificationsReadRequestSchema:()=>xDe,MarkNotificationsReadResponseSchema:()=>SDe,MetadataBulkRegisterRequestSchema:()=>AOe,MetadataBulkResponseSchema:()=>MOe,MetadataBulkUnregisterRequestSchema:()=>jOe,MetadataCacheApi:()=>UTe,MetadataCacheRequestSchema:()=>uJ,MetadataCacheResponseSchema:()=>dJ,MetadataDeleteResponseSchema:()=>DOe,MetadataDependenciesResponseSchema:()=>WOe,MetadataDependentsResponseSchema:()=>GOe,MetadataEffectiveResponseSchema:()=>FOe,MetadataEndpointsConfigSchema:()=>RJ,MetadataEventSchema:()=>_Te,MetadataEventType:()=>QK,MetadataExistsResponseSchema:()=>EOe,MetadataExportRequestSchema:()=>IOe,MetadataExportResponseSchema:()=>LOe,MetadataImportRequestSchema:()=>ROe,MetadataImportResponseSchema:()=>zOe,MetadataItemResponseSchema:()=>COe,MetadataListResponseSchema:()=>wOe,MetadataNamesResponseSchema:()=>TOe,MetadataOverlayResponseSchema:()=>NOe,MetadataOverlaySaveRequestSchema:()=>POe,MetadataQueryRequestSchema:()=>OOe,MetadataQueryResponseSchema:()=>kOe,MetadataRegisterRequestSchema:()=>SOe,MetadataTypeInfoResponseSchema:()=>UOe,MetadataTypesResponseSchema:()=>HOe,MetadataValidateRequestSchema:()=>BOe,MetadataValidateResponseSchema:()=>VOe,ModificationResultSchema:()=>BK,NotificationPreferencesSchema:()=>MJ,NotificationSchema:()=>NJ,OData:()=>ITe,ODataConfigSchema:()=>LTe,ODataErrorSchema:()=>FTe,ODataFilterFunctionSchema:()=>NTe,ODataFilterOperatorSchema:()=>MTe,ODataMetadataSchema:()=>Mq,ODataQueryAdapterSchema:()=>sX,ODataQuerySchema:()=>jTe,ODataResponseSchema:()=>PTe,ObjectDefinitionResponseSchema:()=>yOe,ObjectQLReferenceSchema:()=>JJ,ObjectStackProtocolSchema:()=>LDe,OpenApi31ExtensionsSchema:()=>UJ,OpenApiGenerationConfigSchema:()=>UY,OpenApiSecuritySchemeSchema:()=>iY,OpenApiServerSchema:()=>rY,OpenApiSpec:()=>XDe,OpenApiSpecSchema:()=>aY,OperatorMappingSchema:()=>iX,PackageApiContracts:()=>yke,PackageApiErrorCode:()=>vke,PackageInstallRequestSchema:()=>IZ,PackageInstallResponseSchema:()=>LZ,PackagePathParamsSchema:()=>jZ,PackageRollbackRequestSchema:()=>WZ,PackageRollbackResponseSchema:()=>GZ,PackageUpgradeRequestSchema:()=>RZ,PackageUpgradeResponseSchema:()=>zZ,PinFeedItemRequestSchema:()=>CX,PinFeedItemResponseSchema:()=>wX,PingMessageSchema:()=>kq,PongMessageSchema:()=>Aq,PresenceMessageSchema:()=>wq,PresenceStateSchema:()=>gq,PresenceStatus:()=>eq,PresenceUpdateSchema:()=>xTe,PresignedUrlResponseSchema:()=>TY,QueryAdapterConfigSchema:()=>nke,QueryAdapterTargetSchema:()=>tke,QueryOptimizationConfigSchema:()=>pTe,RealtimeConfigSchema:()=>bTe,RealtimeConnectRequestSchema:()=>$Ee,RealtimeConnectResponseSchema:()=>eDe,RealtimeDisconnectRequestSchema:()=>tDe,RealtimeDisconnectResponseSchema:()=>nDe,RealtimeEventSchema:()=>yTe,RealtimeEventType:()=>iq,RealtimePresenceSchema:()=>sq,RealtimeRecordAction:()=>tq,RealtimeSubscribeRequestSchema:()=>rDe,RealtimeSubscribeResponseSchema:()=>iDe,RealtimeUnsubscribeRequestSchema:()=>aDe,RealtimeUnsubscribeResponseSchema:()=>oDe,RecordDataSchema:()=>NK,RefreshTokenRequestSchema:()=>lOe,RegisterDeviceRequestSchema:()=>dDe,RegisterDeviceResponseSchema:()=>fDe,RegisterRequestSchema:()=>cOe,RemoveReactionRequestSchema:()=>xX,RemoveReactionResponseSchema:()=>SX,RequestValidationConfigSchema:()=>BY,ResolveDependenciesRequestSchema:()=>BZ,ResolveDependenciesResponseSchema:()=>VZ,ResponseEnvelopeConfigSchema:()=>VY,RestApiConfig:()=>BDe,RestApiConfigSchema:()=>PJ,RestApiEndpointSchema:()=>LY,RestApiPluginConfig:()=>ZOe,RestApiPluginConfigSchema:()=>WY,RestApiRouteCategory:()=>FY,RestApiRouteRegistration:()=>QOe,RestApiRouteRegistrationSchema:()=>RY,RestQueryAdapterSchema:()=>aX,RestServerConfig:()=>VDe,RestServerConfigSchema:()=>WJ,RetryStrategy:()=>_J,RouteCategory:()=>jq,RouteCoverageEntrySchema:()=>rX,RouteCoverageReportSchema:()=>eke,RouteDefinitionSchema:()=>kTe,RouteGenerationConfigSchema:()=>BJ,RouteHealthEntrySchema:()=>ZK,RouteHealthReportSchema:()=>gTe,RouterConfigSchema:()=>ATe,SaveMetaItemRequestSchema:()=>nEe,SaveMetaItemResponseSchema:()=>rEe,ScheduleExportRequestSchema:()=>$X,ScheduleExportResponseSchema:()=>eZ,ScheduledExportSchema:()=>cke,SchemaDefinition:()=>HDe,SearchFeedRequestSchema:()=>jX,SearchFeedResponseSchema:()=>MX,ServiceInfoSchema:()=>JK,ServiceStatus:()=>qK,SessionResponseSchema:()=>uOe,SessionSchema:()=>_Y,SessionUserSchema:()=>gY,SetPresenceRequestSchema:()=>sDe,SetPresenceResponseSchema:()=>cDe,SimpleCursorPositionSchema:()=>DTe,SimplePresenceStateSchema:()=>ETe,SingleRecordResponseSchema:()=>LK,StandardApiContracts:()=>fTe,StandardErrorCode:()=>gJ,StarFeedItemRequestSchema:()=>DX,StarFeedItemResponseSchema:()=>OX,StorageApiContracts:()=>vOe,SubgraphConfigSchema:()=>Xq,SubscribeMessageSchema:()=>xq,SubscribeRequestSchema:()=>IX,SubscribeResponseSchema:()=>LX,SubscriptionEventSchema:()=>aq,SubscriptionSchema:()=>oq,ToggleFlowRequestSchema:()=>TZ,ToggleFlowResponseSchema:()=>EZ,TransportProtocol:()=>rq,TriggerFlowRequestSchema:()=>CZ,TriggerFlowResponseSchema:()=>wZ,UninstallPackageApiRequestSchema:()=>KZ,UninstallPackageApiResponseSchema:()=>qZ,UninstallPackageRequestSchema:()=>uH,UninstallPackageResponseSchema:()=>dH,UnpinFeedItemRequestSchema:()=>TX,UnpinFeedItemResponseSchema:()=>EX,UnregisterDeviceRequestSchema:()=>pDe,UnregisterDeviceResponseSchema:()=>mDe,UnstarFeedItemRequestSchema:()=>kX,UnstarFeedItemResponseSchema:()=>AX,UnsubscribeMessageSchema:()=>Sq,UnsubscribeRequestSchema:()=>mq,UnsubscribeResponseSchema:()=>zX,UpdateDataRequestSchema:()=>hEe,UpdateDataResponseSchema:()=>gEe,UpdateFeedItemRequestSchema:()=>hX,UpdateFeedItemResponseSchema:()=>gX,UpdateFlowRequestSchema:()=>yZ,UpdateFlowResponseSchema:()=>bZ,UpdateManyDataRequestSchema:()=>CEe,UpdateManyDataResponseSchema:()=>wEe,UpdateManyRequestSchema:()=>rJ,UpdateNotificationPreferencesRequestSchema:()=>_De,UpdateNotificationPreferencesResponseSchema:()=>vDe,UpdateRequestSchema:()=>FK,UpdateViewRequestSchema:()=>NEe,UpdateViewResponseSchema:()=>PEe,UploadArtifactRequestSchema:()=>HZ,UploadArtifactResponseSchema:()=>UZ,UploadChunkRequestSchema:()=>kY,UploadChunkResponseSchema:()=>AY,UploadProgressSchema:()=>NY,UserProfileResponseSchema:()=>dOe,ValidationMode:()=>zY,VersionDefinitionSchema:()=>hY,VersionNegotiationResponseSchema:()=>iOe,VersionStatus:()=>mY,VersioningConfigSchema:()=>rOe,VersioningStrategy:()=>pY,WebSocketConfigSchema:()=>wTe,WebSocketEventSchema:()=>TTe,WebSocketMessageSchema:()=>CTe,WebSocketMessageType:()=>cq,WebSocketPresenceStatus:()=>hq,WebSocketServerConfigSchema:()=>OTe,WebhookConfigSchema:()=>RDe,WebhookEventSchema:()=>VJ,WellKnownCapabilitiesSchema:()=>hTe,WorkflowApproveRequestSchema:()=>YEe,WorkflowApproveResponseSchema:()=>XEe,WorkflowRejectRequestSchema:()=>ZEe,WorkflowRejectResponseSchema:()=>QEe,WorkflowStateSchema:()=>jJ,WorkflowTransitionRequestSchema:()=>qEe,WorkflowTransitionResponseSchema:()=>JEe,getAuthEndpointUrl:()=>mOe,getDefaultRouteRegistrations:()=>$Oe,mapFieldTypeToGraphQL:()=>BTe});var MK=h({code:r().describe(`Error code (e.g. validation_error)`),message:r().describe(`Readable error message`),category:r().optional().describe(`Error category (e.g. validation, authorization)`),details:u().optional().describe(`Additional error context (e.g. field validation errors)`),requestId:r().optional().describe(`Request ID for tracking`)}),J=h({success:S().describe(`Operation success status`),error:MK.optional().describe(`Error details if success is false`),meta:h({timestamp:r(),duration:P().optional(),requestId:r().optional(),traceId:r().optional()}).optional().describe(`Response metadata`)}),NK=d(r(),u()).describe(`Key-value map of record data`),PK=h({data:NK.describe(`Record data to insert`)}),FK=h({data:NK.describe(`Partial record data to update`)}),IK=h({records:C(NK).describe(`Array of records to process`),allOrNone:S().default(!0).describe(`If true, rollback entire transaction on any failure`)}),dTe=v(Lj,h({format:E([`csv`,`json`,`xlsx`]).default(`csv`)})),LK=J.extend({data:NK.describe(`The requested or modified record`)}),RK=J.extend({data:C(NK).describe(`Array of matching records`),pagination:h({total:P().optional().describe(`Total matching records count`),limit:P().optional().describe(`Page size`),offset:P().optional().describe(`Page offset`),cursor:r().optional().describe(`Cursor for next page`),nextCursor:r().optional().describe(`Next cursor for pagination`),hasMore:S().describe(`Are there more pages?`)}).describe(`Pagination info`)}),zK=h({id:r().describe(`Record ID`)}),BK=h({id:r().optional().describe(`Record ID if processed`),success:S(),errors:C(MK).optional(),index:P().optional().describe(`Index in original request`),data:u().optional().describe(`Result data (e.g. created record)`)}),VK=J.extend({data:C(BK).describe(`Results for each item in the batch`)}),HK=J.extend({id:r().describe(`ID of the deleted record`)}),fTe={create:{input:PK,output:LK},delete:{input:zK,output:HK},get:{input:zK,output:LK},update:{input:FK,output:LK},list:{input:Lj,output:RK},bulkCreate:{input:IK,output:VK},bulkUpdate:{input:IK,output:VK},bulkUpsert:{input:IK,output:VK},bulkDelete:{input:h({ids:C(r())}),output:VK}},UK=h({maxBatchSize:P().int().default(100).describe(`Maximum number of keys per batch load`),batchScheduleFn:E([`microtask`,`timeout`,`manual`]).default(`microtask`).describe(`Scheduling strategy for collecting batch keys`),cacheEnabled:S().default(!0).describe(`Enable per-request result caching`),cacheKeyFn:r().optional().describe(`Name or identifier of the cache key function`),cacheTtl:P().min(0).optional().describe(`Cache time-to-live in seconds (0 = no expiration)`),coalesceRequests:S().default(!0).describe(`Deduplicate identical requests within a batch window`),maxConcurrency:P().int().optional().describe(`Maximum parallel batch requests`)}),WK=h({strategy:E([`dataloader`,`windowed`,`prefetch`]).describe(`Batch loading strategy type`),windowMs:P().optional().describe(`Collection window duration in milliseconds (for windowed strategy)`),prefetchDepth:P().int().optional().describe(`Depth of relation prefetching (for prefetch strategy)`),associationLoading:E([`lazy`,`eager`,`batch`]).default(`batch`).describe(`How to load related associations`)}),pTe=h({preventNPlusOne:S().describe(`Enable N+1 query detection and prevention`),dataLoader:UK.optional().describe(`DataLoader batch loading configuration`),batchStrategy:WK.optional().describe(`Batch loading strategy configuration`),maxQueryDepth:P().int().describe(`Maximum depth for nested relation queries`),queryComplexityLimit:P().optional().describe(`Maximum allowed query complexity score`),enableQueryPlan:S().default(!1).describe(`Log query execution plans for debugging`)}),GK=h({source:r().describe(`Source field/path`),target:r().describe(`Target field/path`),transform:r().optional().describe(`Transformation function name`)}),KK=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique endpoint ID`),path:r().regex(/^\//).describe(`URL Path (e.g. /api/v1/customers)`),method:NA.describe(`HTTP Method`),summary:r().optional(),description:r().optional(),type:E([`flow`,`script`,`object_operation`,`proxy`]).describe(`Implementation type`),target:r().describe(`Target Flow ID, Script Name, or Proxy URL`),objectParams:h({object:r().optional(),operation:E([`find`,`get`,`create`,`update`,`delete`]).optional()}).optional().describe(`For object_operation type`),inputMapping:C(GK).optional().describe(`Map Request Body to Internal Params`),outputMapping:C(GK).optional().describe(`Map Internal Result to Response Body`),authRequired:S().default(!0).describe(`Require authentication`),rateLimit:LA.optional().describe(`Rate limiting policy`),cacheTtl:P().optional().describe(`Response cache TTL in seconds`)}),mTe=Object.assign(KK,{create:e=>e}),qK=E([`available`,`registered`,`unavailable`,`degraded`,`stub`]).describe(`available = fully operational, registered = route declared but handler unverified, unavailable = not installed, degraded = partial, stub = placeholder that returns 501`),JK=h({enabled:S(),status:qK,handlerReady:S().optional().describe(`Whether the HTTP handler is confirmed to be mounted. Omitted = readiness unknown/unverified; true = handler mounted; false = handler missing or stub (likely 501).`),route:r().optional().describe(`e.g. /api/v1/analytics`),provider:r().optional().describe(`e.g. "objectql", "plugin-redis", "driver-memory"`),version:r().optional().describe(`Semantic version of the service implementation (e.g. "3.0.6")`),message:r().optional().describe(`e.g. "Install plugin-workflow to enable"`),rateLimit:h({requestsPerMinute:P().int().optional().describe(`Maximum requests per minute`),requestsPerHour:P().int().optional().describe(`Maximum requests per hour`),burstLimit:P().int().optional().describe(`Maximum burst request count`),retryAfterMs:P().int().optional().describe(`Suggested retry-after delay in milliseconds when rate-limited`)}).optional().describe(`Rate limit and quota info for this service`)}),YK=h({data:r().describe(`e.g. /api/v1/data`),metadata:r().describe(`e.g. /api/v1/meta`),discovery:r().optional().describe(`e.g. /api/v1/discovery`),ui:r().optional().describe(`e.g. /api/v1/ui`),auth:r().optional().describe(`e.g. /api/v1/auth`),automation:r().optional().describe(`e.g. /api/v1/automation`),storage:r().optional().describe(`e.g. /api/v1/storage`),analytics:r().optional().describe(`e.g. /api/v1/analytics`),graphql:r().optional().describe(`e.g. /graphql`),packages:r().optional().describe(`e.g. /api/v1/packages`),workflow:r().optional().describe(`e.g. /api/v1/workflow`),realtime:r().optional().describe(`e.g. /api/v1/realtime`),notifications:r().optional().describe(`e.g. /api/v1/notifications`),ai:r().optional().describe(`e.g. /api/v1/ai`),i18n:r().optional().describe(`e.g. /api/v1/i18n`),feed:r().optional().describe(`e.g. /api/v1/feed`)}),XK=h({name:r(),version:r(),environment:E([`production`,`sandbox`,`development`]),routes:YK,locale:h({default:r(),supported:C(r()),timezone:r()}),services:d(r(),JK).describe(`Per-service availability map keyed by CoreServiceName`),capabilities:d(r(),h({enabled:S().describe(`Whether this capability is available`),features:d(r(),S()).optional().describe(`Sub-feature flags within this capability`),description:r().optional().describe(`Human-readable capability description`)})).optional().describe(`Hierarchical capability descriptors for frontend intelligent adaptation`),schemaDiscovery:h({openapi:r().optional().describe(`URL to OpenAPI (Swagger) specification (e.g., "/api/v1/openapi.json")`),graphql:r().optional().describe(`URL to GraphQL schema endpoint (e.g., "/graphql")`),jsonSchema:r().optional().describe(`URL to JSON Schema definitions`)}).optional().describe(`Schema discovery endpoints for API toolchain integration`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs for extensibility`)}),hTe=h({feed:S().describe(`Whether the backend supports Feed / Chatter API`),comments:S().describe(`Whether the backend supports comments (a subset of Feed)`),automation:S().describe(`Whether the backend supports Automation CRUD (flows, triggers)`),cron:S().describe(`Whether the backend supports cron scheduling`),search:S().describe(`Whether the backend supports full-text search`),export:S().describe(`Whether the backend supports async export`),chunkedUpload:S().describe(`Whether the backend supports chunked (multipart) uploads`)}).describe(`Well-known capability flags for frontend intelligent adaptation`),ZK=h({route:r().describe(`Route path pattern`),method:NA.describe(`HTTP method (GET, POST, etc.)`),service:r().describe(`Target service name`),declared:S().describe(`Whether the route is declared in discovery/metadata`),handlerRegistered:S().describe(`Whether the HTTP handler is registered`),healthStatus:E([`pass`,`fail`,`missing`,`skip`]).describe(`pass = handler responds, fail = 501/503, missing = no handler (404), skip = not checked`),message:r().optional().describe(`Diagnostic message`)}),gTe=h({timestamp:r().describe(`ISO 8601 timestamp of report generation`),adapter:r().describe(`Adapter or runtime that produced this report`),totalDeclared:P().int().describe(`Total routes declared in discovery`),totalRegistered:P().int().describe(`Routes with confirmed handler`),totalMissing:P().int().describe(`Routes missing a handler`),routes:C(ZK).describe(`Per-route health entries`)}),QK=E(`metadata.object.created,metadata.object.updated,metadata.object.deleted,metadata.field.created,metadata.field.updated,metadata.field.deleted,metadata.view.created,metadata.view.updated,metadata.view.deleted,metadata.app.created,metadata.app.updated,metadata.app.deleted,metadata.agent.created,metadata.agent.updated,metadata.agent.deleted,metadata.tool.created,metadata.tool.updated,metadata.tool.deleted,metadata.flow.created,metadata.flow.updated,metadata.flow.deleted,metadata.action.created,metadata.action.updated,metadata.action.deleted,metadata.workflow.created,metadata.workflow.updated,metadata.workflow.deleted,metadata.dashboard.created,metadata.dashboard.updated,metadata.dashboard.deleted,metadata.report.created,metadata.report.updated,metadata.report.deleted,metadata.role.created,metadata.role.updated,metadata.role.deleted,metadata.permission.created,metadata.permission.updated,metadata.permission.deleted`.split(`,`)),$K=E([`data.record.created`,`data.record.updated`,`data.record.deleted`,`data.field.changed`]),_Te=h({id:r().uuid().describe(`Unique event identifier`),type:QK.describe(`Event type`),metadataType:r().describe(`Metadata type (object, view, agent, etc.)`),name:r().describe(`Metadata item name`),packageId:r().optional().describe(`Package ID`),definition:u().optional().describe(`Full definition (create/update only)`),userId:r().optional().describe(`User who triggered the event`),timestamp:r().datetime().describe(`Event timestamp`)}),vTe=h({id:r().uuid().describe(`Unique event identifier`),type:$K.describe(`Event type`),object:r().describe(`Object name`),recordId:r().describe(`Record ID`),changes:d(r(),u()).optional().describe(`Changed fields`),before:d(r(),u()).optional().describe(`Before state`),after:d(r(),u()).optional().describe(`After state`),userId:r().optional().describe(`User who triggered the event`),timestamp:r().datetime().describe(`Event timestamp`)}),eq=E([`online`,`away`,`busy`,`offline`]),tq=E([`created`,`updated`,`deleted`]),nq=h({userId:r().describe(`User identifier`),status:eq.describe(`Current presence status`),lastSeen:r().datetime().describe(`ISO 8601 datetime of last activity`),metadata:d(r(),u()).optional().describe(`Custom presence data (e.g., current page, custom status)`)}),rq=E([`websocket`,`sse`,`polling`]),iq=E([`record.created`,`record.updated`,`record.deleted`,`field.changed`]),aq=h({type:iq.describe(`Type of event to subscribe to`),object:r().optional().describe(`Object name to subscribe to`),filters:u().optional().describe(`Filter conditions`)}),oq=h({id:r().uuid().describe(`Unique subscription identifier`),events:C(aq).describe(`Array of events to subscribe to`),transport:rq.describe(`Transport protocol to use`),channel:r().optional().describe(`Optional channel name for grouping subscriptions`)}),sq=nq,yTe=h({id:r().uuid().describe(`Unique event identifier`),type:r().describe(`Event type (e.g., record.created, record.updated)`),object:r().optional().describe(`Object name the event relates to`),action:tq.optional().describe(`Action performed`),payload:d(r(),u()).describe(`Event payload data`),timestamp:r().datetime().describe(`ISO 8601 datetime when event occurred`),userId:r().optional().describe(`User who triggered the event`),sessionId:r().optional().describe(`Session identifier`)}),bTe=h({enabled:S().default(!0).describe(`Enable realtime synchronization`),transport:rq.default(`websocket`).describe(`Transport protocol`),subscriptions:C(oq).optional().describe(`Default subscriptions`)}).passthrough(),cq=E([`subscribe`,`unsubscribe`,`event`,`ping`,`pong`,`ack`,`error`,`presence`,`cursor`,`edit`]),lq=E([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`,`contains`,`startsWith`,`endsWith`,`exists`,`regex`]),uq=h({field:r().describe(`Field path to filter on (supports dot notation, e.g., "user.email")`),operator:lq.describe(`Comparison operator`),value:u().optional().describe(`Value to compare against (not needed for "exists" operator)`)}),dq=h({conditions:C(uq).optional().describe(`Array of filter conditions`),and:F(()=>C(dq)).optional().describe(`AND logical combination of filters`),or:F(()=>C(dq)).optional().describe(`OR logical combination of filters`),not:F(()=>dq).optional().describe(`NOT logical negation of filter`)}),fq=r().min(1).regex(/^[a-z*][a-z0-9_.*]*$/,{message:`Event pattern must be lowercase and may contain letters, numbers, underscores, dots, or wildcards (e.g., "record.*", "*.created", "user.login")`}).describe(`Event pattern (supports wildcards like "record.*" or "*.created")`),pq=h({subscriptionId:r().uuid().describe(`Unique subscription identifier`),events:C(fq).describe(`Event patterns to subscribe to (supports wildcards, e.g., "record.*", "user.created")`),objects:C(r()).optional().describe(`Object names to filter events by (e.g., ["account", "contact"])`),filters:dq.optional().describe(`Advanced filter conditions for event payloads`),channels:C(r()).optional().describe(`Channel names for scoped subscriptions`)}),mq=h({subscriptionId:r().uuid().describe(`Subscription ID to unsubscribe from`)}),hq=eq,gq=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Unique session identifier`),status:hq.describe(`Current presence status`),lastSeen:r().datetime().describe(`ISO 8601 datetime of last activity`),currentLocation:r().optional().describe(`Current page/route user is viewing`),device:E([`desktop`,`mobile`,`tablet`,`other`]).optional().describe(`Device type`),customStatus:r().optional().describe(`Custom user status message`),metadata:d(r(),u()).optional().describe(`Additional custom presence data`)}),xTe=h({status:hq.optional().describe(`Updated presence status`),currentLocation:r().optional().describe(`Updated current location`),customStatus:r().optional().describe(`Updated custom status message`),metadata:d(r(),u()).optional().describe(`Updated metadata`)}),_q=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier being edited`),position:h({line:P().int().nonnegative().describe(`Line number (0-indexed)`),column:P().int().nonnegative().describe(`Column number (0-indexed)`)}).optional().describe(`Cursor position in document`),selection:h({start:h({line:P().int().nonnegative(),column:P().int().nonnegative()}),end:h({line:P().int().nonnegative(),column:P().int().nonnegative()})}).optional().describe(`Selection range (if text is selected)`),color:r().optional().describe(`Cursor color for visual representation`),userName:r().optional().describe(`Display name of user`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last cursor update`)}),vq=E([`insert`,`delete`,`replace`]),yq=h({operationId:r().uuid().describe(`Unique operation identifier`),documentId:r().describe(`Document identifier`),userId:r().describe(`User who performed the edit`),sessionId:r().uuid().describe(`Session identifier`),type:vq.describe(`Type of edit operation`),position:h({line:P().int().nonnegative().describe(`Line number (0-indexed)`),column:P().int().nonnegative().describe(`Column number (0-indexed)`)}).describe(`Starting position of the operation`),endPosition:h({line:P().int().nonnegative(),column:P().int().nonnegative()}).optional().describe(`Ending position (for delete/replace operations)`),content:r().optional().describe(`Content to insert/replace`),version:P().int().nonnegative().describe(`Document version before this operation`),timestamp:r().datetime().describe(`ISO 8601 datetime when operation was created`),baseOperationId:r().uuid().optional().describe(`Previous operation ID this builds upon (for OT)`)}),STe=h({documentId:r().describe(`Document identifier`),version:P().int().nonnegative().describe(`Current document version`),content:r().describe(`Current document content`),lastModified:r().datetime().describe(`ISO 8601 datetime of last modification`),activeSessions:C(r().uuid()).describe(`Active editing session IDs`),checksum:r().optional().describe(`Content checksum for integrity verification`)}),bq=h({messageId:r().uuid().describe(`Unique message identifier`),type:cq.describe(`Message type`),timestamp:r().datetime().describe(`ISO 8601 datetime when message was sent`)}),xq=bq.extend({type:m(`subscribe`),subscription:pq.describe(`Subscription configuration`)}),Sq=bq.extend({type:m(`unsubscribe`),request:mq.describe(`Unsubscribe request`)}),Cq=bq.extend({type:m(`event`),subscriptionId:r().uuid().describe(`Subscription ID this event belongs to`),eventName:AA.describe(`Event name`),object:r().optional().describe(`Object name the event relates to`),payload:u().describe(`Event payload data`),userId:r().optional().describe(`User who triggered the event`)}),wq=bq.extend({type:m(`presence`),presence:gq.describe(`Presence state`)}),Tq=bq.extend({type:m(`cursor`),cursor:_q.describe(`Cursor position`)}),Eq=bq.extend({type:m(`edit`),operation:yq.describe(`Edit operation`)}),Dq=bq.extend({type:m(`ack`),ackMessageId:r().uuid().describe(`ID of the message being acknowledged`),success:S().describe(`Whether the operation was successful`),error:r().optional().describe(`Error message if operation failed`)}),Oq=bq.extend({type:m(`error`),code:r().describe(`Error code`),message:r().describe(`Error message`),details:u().optional().describe(`Additional error details`)}),kq=bq.extend({type:m(`ping`)}),Aq=bq.extend({type:m(`pong`),pingMessageId:r().uuid().optional().describe(`ID of ping message being responded to`)}),CTe=I(`type`,[xq,Sq,Cq,wq,Tq,Eq,Dq,Oq,kq,Aq]),wTe=h({url:r().url().describe(`WebSocket server URL`),protocols:C(r()).optional().describe(`WebSocket sub-protocols`),reconnect:S().optional().default(!0).describe(`Enable automatic reconnection`),reconnectInterval:P().int().positive().optional().default(1e3).describe(`Reconnection interval in milliseconds`),maxReconnectAttempts:P().int().positive().optional().default(5).describe(`Maximum reconnection attempts`),pingInterval:P().int().positive().optional().default(3e4).describe(`Ping interval in milliseconds`),timeout:P().int().positive().optional().default(5e3).describe(`Message timeout in milliseconds`),headers:d(r(),r()).optional().describe(`Custom headers for WebSocket handshake`)}),TTe=h({type:E([`subscribe`,`unsubscribe`,`data-change`,`presence-update`,`cursor-update`,`error`]).describe(`Event type`),channel:r().describe(`Channel identifier (e.g., "record.account.123", "user.456")`),payload:u().describe(`Event payload data`),timestamp:P().describe(`Unix timestamp in milliseconds`)}),ETe=h({userId:r().describe(`User identifier`),userName:r().describe(`User display name`),status:E([`online`,`away`,`offline`]).describe(`User presence status`),lastSeen:P().describe(`Unix timestamp of last activity in milliseconds`),metadata:d(r(),u()).optional().describe(`Additional presence metadata (e.g., current page, custom status)`)}),DTe=h({userId:r().describe(`User identifier`),recordId:r().describe(`Record identifier being edited`),fieldName:r().describe(`Field name being edited`),position:P().describe(`Cursor position (character offset from start)`),selection:h({start:P().describe(`Selection start position`),end:P().describe(`Selection end position`)}).optional().describe(`Text selection range (if text is selected)`)}),OTe=h({enabled:S().default(!1).describe(`Enable WebSocket server`),path:r().default(`/ws`).describe(`WebSocket endpoint path`),heartbeatInterval:P().default(3e4).describe(`Heartbeat interval in milliseconds`),reconnectAttempts:P().default(5).describe(`Maximum reconnection attempts for clients`),presence:S().default(!1).describe(`Enable presence tracking`),cursorSharing:S().default(!1).describe(`Enable collaborative cursor sharing`)}),jq=E([`system`,`api`,`auth`,`static`,`webhook`,`plugin`]),kTe=h({method:NA,path:r().describe(`URL Path pattern`),category:jq.default(`api`),handler:r().describe(`Unique handler identifier`),summary:r().optional().describe(`OpenAPI summary`),description:r().optional().describe(`OpenAPI description`),public:S().default(!1).describe(`Is publicly accessible`),permissions:C(r()).optional().describe(`Required permissions`),timeout:P().int().optional().describe(`Execution timeout in ms`),rateLimit:r().optional().describe(`Rate limit policy name`)}),ATe=h({basePath:r().default(`/api`).describe(`Global API prefix`),mounts:h({data:r().default(`/data`).describe(`Data Protocol (CRUD)`),metadata:r().default(`/meta`).describe(`Metadata Protocol (Schemas)`),auth:r().default(`/auth`).describe(`Auth Protocol`),automation:r().default(`/automation`).describe(`Automation Protocol`),storage:r().default(`/storage`).describe(`Storage Protocol`),analytics:r().default(`/analytics`).describe(`Analytics Protocol`),graphql:r().default(`/graphql`).describe(`GraphQL Endpoint`),ui:r().default(`/ui`).describe(`UI Metadata Protocol (Views, Layouts)`),workflow:r().default(`/workflow`).describe(`Workflow Engine Protocol`),realtime:r().default(`/realtime`).describe(`Realtime/WebSocket Protocol`),notifications:r().default(`/notifications`).describe(`Notification Protocol`),ai:r().default(`/ai`).describe(`AI Engine Protocol (NLQ, Chat, Suggest)`),i18n:r().default(`/i18n`).describe(`Internationalization Protocol`),packages:r().default(`/packages`).describe(`Package Management Protocol`)}).default({data:`/data`,metadata:`/meta`,auth:`/auth`,automation:`/automation`,storage:`/storage`,analytics:`/analytics`,graphql:`/graphql`,ui:`/ui`,workflow:`/workflow`,realtime:`/realtime`,notifications:`/notifications`,ai:`/ai`,i18n:`/i18n`,packages:`/packages`}),cors:IA.optional(),staticMounts:C(RA).optional()}),jTe=h({$select:l([r(),C(r())]).optional().describe(`Fields to select`),$filter:r().optional().describe(`Filter expression (OData filter syntax)`),$orderby:l([r(),C(r())]).optional().describe(`Sort order`),$top:P().int().min(0).optional().describe(`Max results to return`),$skip:P().int().min(0).optional().describe(`Results to skip`),$expand:l([r(),C(r())]).optional().describe(`Navigation properties to expand (lookup/master_detail fields)`),$count:S().optional().describe(`Include total count`),$search:r().optional().describe(`Search expression`),$format:E([`json`,`xml`,`atom`]).optional().describe(`Response format`),$apply:r().optional().describe(`Aggregation expression`)}),MTe=E([`eq`,`ne`,`lt`,`le`,`gt`,`ge`,`and`,`or`,`not`,`(`,`)`,`in`,`has`]),NTe=E(`contains.startswith.endswith.length.indexof.substring.tolower.toupper.trim.concat.year.month.day.hour.minute.second.date.time.now.maxdatetime.mindatetime.round.floor.ceiling.cast.isof.any.all`.split(`.`)),PTe=h({"@odata.context":r().url().optional().describe(`Metadata context URL`),"@odata.count":P().int().optional().describe(`Total results count`),"@odata.nextLink":r().url().optional().describe(`Next page URL`),value:C(d(r(),u())).describe(`Results array`)}),FTe=h({error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),target:r().optional().describe(`Error target`),details:C(h({code:r(),message:r(),target:r().optional()})).optional().describe(`Error details`),innererror:d(r(),u()).optional().describe(`Inner error details`)})}),Mq=h({namespace:r().describe(`Service namespace`),entityTypes:C(h({name:r().describe(`Entity type name`),key:C(r()).describe(`Key fields`),properties:C(h({name:r(),type:r().describe(`OData type (Edm.String, Edm.Int32, etc.)`),nullable:S().default(!0)})),navigationProperties:C(h({name:r(),type:r(),partner:r().optional()})).optional()})).describe(`Entity types`),entitySets:C(h({name:r().describe(`Entity set name`),entityType:r().describe(`Entity type`)})).describe(`Entity sets`)}),ITe={buildUrl:(e,t)=>{let n=new URLSearchParams;t.$select&&n.append(`$select`,Array.isArray(t.$select)?t.$select.join(`,`):t.$select),t.$filter&&n.append(`$filter`,t.$filter),t.$orderby&&n.append(`$orderby`,Array.isArray(t.$orderby)?t.$orderby.join(`,`):t.$orderby),t.$top!==void 0&&n.append(`$top`,t.$top.toString()),t.$skip!==void 0&&n.append(`$skip`,t.$skip.toString()),t.$expand&&n.append(`$expand`,Array.isArray(t.$expand)?t.$expand.join(`,`):t.$expand),t.$count!==void 0&&n.append(`$count`,t.$count.toString()),t.$search&&n.append(`$search`,t.$search),t.$format&&n.append(`$format`,t.$format),t.$apply&&n.append(`$apply`,t.$apply);let r=n.toString();return r?`${e}?${r}`:e},filter:{eq:(e,t)=>`${e} eq ${typeof t==`string`?`'${t}'`:t}`,ne:(e,t)=>`${e} ne ${typeof t==`string`?`'${t}'`:t}`,gt:(e,t)=>`${e} gt ${t}`,lt:(e,t)=>`${e} lt ${t}`,contains:(e,t)=>`contains(${e}, '${t}')`,and:(...e)=>e.join(` and `),or:(...e)=>e.join(` or `)}},LTe=h({enabled:S().default(!0).describe(`Enable OData API`),path:r().default(`/odata`).describe(`OData endpoint path`),metadata:Mq.optional().describe(`OData metadata configuration`)}).passthrough(),RTe=E([`ID`,`String`,`Int`,`Float`,`Boolean`,`DateTime`,`Date`,`Time`,`JSON`,`JSONObject`,`Upload`,`URL`,`Email`,`PhoneNumber`,`Currency`,`Decimal`,`BigInt`,`Long`,`UUID`,`Base64`,`Void`]),Nq=h({name:r().describe(`GraphQL type name (PascalCase recommended)`),object:r().describe(`Source ObjectQL object name`),description:r().optional().describe(`Type description`),fields:h({include:C(r()).optional().describe(`Fields to include`),exclude:C(r()).optional().describe(`Fields to exclude (e.g., sensitive fields)`),mappings:d(r(),h({graphqlName:r().optional().describe(`Custom GraphQL field name`),graphqlType:r().optional().describe(`Override GraphQL type`),description:r().optional().describe(`Field description`),deprecationReason:r().optional().describe(`Why field is deprecated`),nullable:S().optional().describe(`Override nullable`)})).optional().describe(`Field-level customizations`)}).optional().describe(`Field configuration`),interfaces:C(r()).optional().describe(`GraphQL interface names`),isInterface:S().optional().default(!1).describe(`Define as GraphQL interface`),directives:C(h({name:r().describe(`Directive name`),args:d(r(),u()).optional().describe(`Directive arguments`)})).optional().describe(`GraphQL directives`)}),Pq=h({name:r().describe(`Query field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),type:E([`get`,`list`,`search`]).describe(`Query type`),description:r().optional().describe(`Query description`),args:d(r(),h({type:r().describe(`GraphQL type (e.g., "ID!", "String", "Int")`),description:r().optional().describe(`Argument description`),defaultValue:u().optional().describe(`Default value`)})).optional().describe(`Query arguments`),filtering:h({enabled:S().default(!0).describe(`Allow filtering`),fields:C(r()).optional().describe(`Filterable fields`),operators:C(E([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`notIn`,`contains`,`startsWith`,`endsWith`,`isNull`,`isNotNull`])).optional().describe(`Allowed filter operators`)}).optional().describe(`Filtering capabilities`),sorting:h({enabled:S().default(!0).describe(`Allow sorting`),fields:C(r()).optional().describe(`Sortable fields`),defaultSort:h({field:r(),direction:E([`ASC`,`DESC`])}).optional().describe(`Default sort order`)}).optional().describe(`Sorting capabilities`),pagination:h({enabled:S().default(!0).describe(`Enable pagination`),type:E([`offset`,`cursor`,`relay`]).default(`offset`).describe(`Pagination style`),defaultLimit:P().int().min(1).default(20).describe(`Default page size`),maxLimit:P().int().min(1).default(100).describe(`Maximum page size`),cursors:h({field:r().default(`id`).describe(`Field to use for cursor pagination`)}).optional()}).optional().describe(`Pagination configuration`),fields:h({required:C(r()).optional().describe(`Required fields (always returned)`),selectable:C(r()).optional().describe(`Selectable fields`)}).optional().describe(`Field selection configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),cache:h({enabled:S().default(!1).describe(`Enable caching`),ttl:P().int().min(0).optional().describe(`Cache TTL in seconds`),key:r().optional().describe(`Cache key template`)}).optional().describe(`Query caching`)}),Fq=h({name:r().describe(`Mutation field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),type:E([`create`,`update`,`delete`,`upsert`,`custom`]).describe(`Mutation type`),description:r().optional().describe(`Mutation description`),input:h({typeName:r().optional().describe(`Custom input type name`),fields:h({include:C(r()).optional().describe(`Fields to include`),exclude:C(r()).optional().describe(`Fields to exclude`),required:C(r()).optional().describe(`Required input fields`)}).optional().describe(`Input field configuration`),validation:h({enabled:S().default(!0).describe(`Enable input validation`),rules:C(r()).optional().describe(`Custom validation rules`)}).optional().describe(`Input validation`)}).optional().describe(`Input configuration`),output:h({type:E([`object`,`payload`,`boolean`,`custom`]).default(`object`).describe(`Output type`),includeEnvelope:S().optional().default(!1).describe(`Wrap in success/error payload`),customType:r().optional().describe(`Custom output type name`)}).optional().describe(`Output configuration`),transaction:h({enabled:S().default(!0).describe(`Use database transaction`),isolationLevel:E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`]).optional().describe(`Transaction isolation level`)}).optional().describe(`Transaction configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),hooks:h({before:C(r()).optional().describe(`Pre-mutation hooks`),after:C(r()).optional().describe(`Post-mutation hooks`)}).optional().describe(`Lifecycle hooks`)}),Iq=h({name:r().describe(`Subscription field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),events:C(E([`created`,`updated`,`deleted`,`custom`])).describe(`Events to subscribe to`),description:r().optional().describe(`Subscription description`),filter:h({enabled:S().default(!0).describe(`Allow filtering subscriptions`),fields:C(r()).optional().describe(`Filterable fields`)}).optional().describe(`Subscription filtering`),payload:h({includeEntity:S().default(!0).describe(`Include entity in payload`),includePreviousValues:S().optional().default(!1).describe(`Include previous field values`),includeMeta:S().optional().default(!0).describe(`Include metadata (timestamp, user, etc.)`)}).optional().describe(`Payload configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:h({enabled:S().default(!0).describe(`Enable rate limiting`),maxSubscriptionsPerUser:P().int().min(1).default(10).describe(`Max concurrent subscriptions per user`),throttleMs:P().int().min(0).optional().describe(`Throttle interval in milliseconds`)}).optional().describe(`Subscription rate limiting`)}),Lq=h({path:r().describe(`Resolver path (Type.field)`),type:E([`datasource`,`computed`,`script`,`proxy`]).describe(`Resolver implementation type`),implementation:h({datasource:r().optional().describe(`Datasource ID`),query:r().optional().describe(`Query/SQL to execute`),expression:r().optional().describe(`Computation expression`),dependencies:C(r()).optional().describe(`Dependent fields`),script:r().optional().describe(`Script ID or inline code`),url:r().optional().describe(`Proxy URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`]).optional().describe(`HTTP method`)}).optional().describe(`Implementation configuration`),cache:h({enabled:S().default(!1).describe(`Enable resolver caching`),ttl:P().int().min(0).optional().describe(`Cache TTL in seconds`),keyArgs:C(r()).optional().describe(`Arguments to include in cache key`)}).optional().describe(`Resolver caching`)}),Rq=h({name:r().describe(`DataLoader name`),source:r().describe(`Source object or datasource`),batchFunction:h({type:E([`findByIds`,`query`,`script`,`custom`]).describe(`Batch function type`),keyField:r().optional().describe(`Field to batch on (e.g., "id")`),query:r().optional().describe(`Query template`),script:r().optional().describe(`Script ID`),maxBatchSize:P().int().min(1).optional().default(100).describe(`Maximum batch size`)}).describe(`Batch function configuration`),cache:h({enabled:S().default(!0).describe(`Enable per-request caching`),keyFn:r().optional().describe(`Custom cache key function`)}).optional().describe(`DataLoader caching`),options:h({batch:S().default(!0).describe(`Enable batching`),cache:S().default(!0).describe(`Enable caching`),maxCacheSize:P().int().min(0).optional().describe(`Max cache entries`)}).optional().describe(`DataLoader options`)}),zq=E([`QUERY`,`MUTATION`,`SUBSCRIPTION`,`FIELD`,`FRAGMENT_DEFINITION`,`FRAGMENT_SPREAD`,`INLINE_FRAGMENT`,`VARIABLE_DEFINITION`,`SCHEMA`,`SCALAR`,`OBJECT`,`FIELD_DEFINITION`,`ARGUMENT_DEFINITION`,`INTERFACE`,`UNION`,`ENUM`,`ENUM_VALUE`,`INPUT_OBJECT`,`INPUT_FIELD_DEFINITION`]),Bq=h({name:r().regex(/^[a-z][a-zA-Z0-9]*$/).describe(`Directive name (camelCase)`),description:r().optional().describe(`Directive description`),locations:C(zq).describe(`Directive locations`),args:d(r(),h({type:r().describe(`Argument type`),description:r().optional().describe(`Argument description`),defaultValue:u().optional().describe(`Default value`)})).optional().describe(`Directive arguments`),repeatable:S().optional().default(!1).describe(`Can be applied multiple times`),implementation:h({type:E([`auth`,`validation`,`transform`,`cache`,`deprecation`,`custom`]).describe(`Directive type`),handler:r().optional().describe(`Handler function name or script`)}).optional().describe(`Directive implementation`)}),Vq=h({enabled:S().default(!0).describe(`Enable query depth limiting`),maxDepth:P().int().min(1).default(10).describe(`Maximum query depth`),ignoreFields:C(r()).optional().describe(`Fields excluded from depth calculation`),onDepthExceeded:E([`reject`,`log`,`warn`]).default(`reject`).describe(`Action when depth exceeded`),errorMessage:r().optional().describe(`Custom error message for depth violations`)}),Hq=h({enabled:S().default(!0).describe(`Enable query complexity limiting`),maxComplexity:P().int().min(1).default(1e3).describe(`Maximum query complexity`),defaultFieldComplexity:P().int().min(0).default(1).describe(`Default complexity per field`),fieldComplexity:d(r(),l([P().int().min(0),h({base:P().int().min(0).describe(`Base complexity`),multiplier:r().optional().describe(`Argument multiplier (e.g., "limit")`),calculator:r().optional().describe(`Custom calculator function`)})])).optional().describe(`Per-field complexity configuration`),listMultiplier:P().min(0).default(10).describe(`Multiplier for list fields`),onComplexityExceeded:E([`reject`,`log`,`warn`]).default(`reject`).describe(`Action when complexity exceeded`),errorMessage:r().optional().describe(`Custom error message for complexity violations`)}),Uq=h({enabled:S().default(!0).describe(`Enable rate limiting`),strategy:E([`token_bucket`,`fixed_window`,`sliding_window`,`cost_based`]).default(`token_bucket`).describe(`Rate limiting strategy`),global:h({maxRequests:P().int().min(1).default(1e3).describe(`Maximum requests per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`)}).optional().describe(`Global rate limits`),perUser:h({maxRequests:P().int().min(1).default(100).describe(`Maximum requests per user per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`)}).optional().describe(`Per-user rate limits`),costBased:h({enabled:S().default(!1).describe(`Enable cost-based rate limiting`),maxCost:P().int().min(1).default(1e4).describe(`Maximum cost per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`),useComplexityAsCost:S().default(!0).describe(`Use query complexity as cost`)}).optional().describe(`Cost-based rate limiting`),operations:d(r(),h({maxRequests:P().int().min(1).describe(`Max requests for this operation`),windowMs:P().int().min(1e3).describe(`Time window`)})).optional().describe(`Per-operation rate limits`),onLimitExceeded:E([`reject`,`queue`,`log`]).default(`reject`).describe(`Action when rate limit exceeded`),errorMessage:r().optional().describe(`Custom error message for rate limit violations`),includeHeaders:S().default(!0).describe(`Include rate limit headers in response`)}),Wq=h({enabled:S().default(!1).describe(`Enable persisted queries`),mode:E([`optional`,`required`]).default(`optional`).describe(`Persisted query mode (optional: allow both, required: only persisted)`),store:h({type:E([`memory`,`redis`,`database`,`file`]).default(`memory`).describe(`Query store type`),connection:r().optional().describe(`Store connection string or path`),ttl:P().int().min(0).optional().describe(`TTL in seconds for stored queries`)}).optional().describe(`Query store configuration`),apq:h({enabled:S().default(!0).describe(`Enable Automatic Persisted Queries`),hashAlgorithm:E([`sha256`,`sha1`,`md5`]).default(`sha256`).describe(`Hash algorithm for query IDs`),cache:h({ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(1).optional().describe(`Maximum number of cached queries`)}).optional().describe(`APQ cache configuration`)}).optional().describe(`Automatic Persisted Queries configuration`),allowlist:h({enabled:S().default(!1).describe(`Enable query allow list (reject queries not in list)`),queries:C(h({id:r().describe(`Query ID or hash`),operation:r().optional().describe(`Operation name`),query:r().optional().describe(`Query string`)})).optional().describe(`Allowed queries`),source:r().optional().describe(`External allow list source (file path or URL)`)}).optional().describe(`Query allow list configuration`),security:h({maxQuerySize:P().int().min(1).optional().describe(`Maximum query string size in bytes`),rejectIntrospection:S().default(!1).describe(`Reject introspection queries`)}).optional().describe(`Security configuration`)}),Gq=h({fields:r().describe(`Selection set of fields composing the entity key`),resolvable:S().optional().default(!0).describe(`Whether entities can be resolved from this subgraph`)}),Kq=h({field:r().describe(`Field name marked as external`),ownerSubgraph:r().optional().describe(`Subgraph that owns this field`)}),qq=h({field:r().describe(`Field with the requirement`),fields:r().describe(`Selection set of required fields (e.g., "price weight")`)}),Jq=h({field:r().describe(`Field that provides additional entity fields`),fields:r().describe(`Selection set of provided fields (e.g., "name price")`)}),Yq=h({typeName:r().describe(`GraphQL type name for this entity`),keys:C(Gq).min(1).describe(`Entity key definitions`),externalFields:C(Kq).optional().describe(`Fields owned by other subgraphs`),requires:C(qq).optional().describe(`Required external fields for computed fields`),provides:C(Jq).optional().describe(`Fields provided during resolution`),owner:S().optional().default(!1).describe(`Whether this subgraph is the owner of this entity`)}),Xq=h({name:r().describe(`Unique subgraph identifier`),url:r().describe(`Subgraph endpoint URL`),schemaSource:E([`introspection`,`file`,`registry`]).default(`introspection`).describe(`How to obtain the subgraph schema`),schemaPath:r().optional().describe(`Path to schema file (SDL format)`),entities:C(Yq).optional().describe(`Entity definitions for this subgraph`),healthCheck:h({enabled:S().default(!0).describe(`Enable health checking`),path:r().default(`/health`).describe(`Health check endpoint path`),intervalMs:P().int().min(1e3).default(3e4).describe(`Health check interval in milliseconds`)}).optional().describe(`Subgraph health check configuration`),forwardHeaders:C(r()).optional().describe(`HTTP headers to forward to this subgraph`)}),Zq=h({enabled:S().default(!1).describe(`Enable GraphQL Federation gateway mode`),version:E([`v1`,`v2`]).default(`v2`).describe(`Federation specification version`),subgraphs:C(Xq).describe(`Subgraph configurations`),serviceDiscovery:h({type:E([`static`,`dns`,`consul`,`kubernetes`]).default(`static`).describe(`Service discovery method`),pollIntervalMs:P().int().min(1e3).optional().describe(`Discovery poll interval in milliseconds`),namespace:r().optional().describe(`Kubernetes namespace for subgraph discovery`)}).optional().describe(`Service discovery configuration`),queryPlanning:h({strategy:E([`parallel`,`sequential`,`adaptive`]).default(`parallel`).describe(`Query execution strategy across subgraphs`),maxDepth:P().int().min(1).optional().describe(`Max query depth in federated execution`),dryRun:S().optional().default(!1).describe(`Log query plans without executing`)}).optional().describe(`Query planning configuration`),composition:h({conflictResolution:E([`error`,`first_wins`,`last_wins`]).default(`error`).describe(`Strategy for resolving schema conflicts`),validate:S().default(!0).describe(`Validate composed supergraph schema`)}).optional().describe(`Schema composition configuration`),errorHandling:h({includeSubgraphName:S().default(!1).describe(`Include subgraph name in error responses`),partialErrors:E([`propagate`,`nullify`,`reject`]).default(`propagate`).describe(`Behavior when a subgraph returns partial errors`)}).optional().describe(`Error handling configuration`)}),Qq=h({enabled:S().default(!0).describe(`Enable GraphQL API`),path:r().default(`/graphql`).describe(`GraphQL endpoint path`),playground:h({enabled:S().default(!0).describe(`Enable GraphQL Playground`),path:r().default(`/playground`).describe(`Playground path`)}).optional().describe(`GraphQL Playground configuration`),schema:h({autoGenerateTypes:S().default(!0).describe(`Auto-generate types from Objects`),types:C(Nq).optional().describe(`Type configurations`),queries:C(Pq).optional().describe(`Query configurations`),mutations:C(Fq).optional().describe(`Mutation configurations`),subscriptions:C(Iq).optional().describe(`Subscription configurations`),resolvers:C(Lq).optional().describe(`Custom resolver configurations`),directives:C(Bq).optional().describe(`Custom directive configurations`)}).optional().describe(`Schema generation configuration`),dataLoaders:C(Rq).optional().describe(`DataLoader configurations`),security:h({depthLimit:Vq.optional().describe(`Query depth limiting`),complexity:Hq.optional().describe(`Query complexity calculation`),rateLimit:Uq.optional().describe(`Rate limiting`),persistedQueries:Wq.optional().describe(`Persisted queries`)}).optional().describe(`Security configuration`),federation:Zq.optional().describe(`GraphQL Federation gateway configuration`)}),zTe=Object.assign(Qq,{create:e=>e}),BTe=e=>({text:`String`,textarea:`String`,email:`Email`,url:`URL`,phone:`PhoneNumber`,password:`String`,markdown:`String`,html:`String`,richtext:`String`,number:`Float`,currency:`Currency`,percent:`Float`,date:`Date`,datetime:`DateTime`,time:`Time`,boolean:`Boolean`,toggle:`Boolean`,select:`String`,multiselect:`[String]`,radio:`String`,checkboxes:`[String]`,lookup:`ID`,master_detail:`ID`,tree:`ID`,image:`URL`,file:`URL`,avatar:`URL`,video:`URL`,audio:`URL`,formula:`String`,summary:`Float`,autonumber:`String`,location:`JSONObject`,address:`JSONObject`,code:`String`,json:`JSON`,color:`String`,rating:`Float`,slider:`Float`,signature:`String`,qrcode:`String`,progress:`Float`,tags:`[String]`,vector:`[Float]`})[e]||`String`,$q=E([`create`,`update`,`upsert`,`delete`]),eJ=h({id:r().optional().describe(`Record ID (required for update/delete)`),data:NK.optional().describe(`Record data (required for create/update/upsert)`),externalId:r().optional().describe(`External ID for upsert matching`)}),tJ=h({atomic:S().optional().default(!0).describe(`If true, rollback entire batch on any failure (transaction mode)`),returnRecords:S().optional().default(!1).describe(`If true, return full record data in response`),continueOnError:S().optional().default(!1).describe(`If true (and atomic=false), continue processing remaining records after errors`),validateOnly:S().optional().default(!1).describe(`If true, validate records without persisting changes (dry-run mode)`)}),nJ=h({operation:$q.describe(`Type of batch operation`),records:C(eJ).min(1).max(200).describe(`Array of records to process (max 200 per batch)`),options:tJ.optional().describe(`Batch operation options`)}),rJ=h({records:C(eJ).min(1).max(200).describe(`Array of records to update (max 200 per batch)`),options:tJ.optional().describe(`Update options`)}),iJ=h({id:r().optional().describe(`Record ID if operation succeeded`),success:S().describe(`Whether this record was processed successfully`),errors:C(MK).optional().describe(`Array of errors if operation failed`),data:NK.optional().describe(`Full record data (if returnRecords=true)`),index:P().optional().describe(`Index of the record in the request array`)}),aJ=J.extend({operation:$q.optional().describe(`Operation type that was performed`),total:P().describe(`Total number of records in the batch`),succeeded:P().describe(`Number of records that succeeded`),failed:P().describe(`Number of records that failed`),results:C(iJ).describe(`Detailed results for each record`)}),oJ=h({ids:C(r()).min(1).max(200).describe(`Array of record IDs to delete (max 200)`),options:tJ.optional().describe(`Delete options`)}),VTe={batchOperation:{input:nJ,output:aJ},updateMany:{input:rJ,output:aJ},deleteMany:{input:oJ,output:aJ}},HTe=h({enabled:S().default(!0).describe(`Enable batch operations`),maxRecordsPerBatch:P().int().min(1).max(1e3).default(200).describe(`Maximum records per batch`),defaultOptions:tJ.optional().describe(`Default batch options`)}).passthrough(),sJ=E([`public`,`private`,`no-cache`,`no-store`,`must-revalidate`,`max-age`]),cJ=h({directives:C(sJ).describe(`Cache control directives`),maxAge:P().optional().describe(`Maximum cache age in seconds`),staleWhileRevalidate:P().optional().describe(`Allow serving stale content while revalidating (seconds)`),staleIfError:P().optional().describe(`Allow serving stale content on error (seconds)`)}),lJ=h({value:r().describe(`ETag value (hash or version identifier)`),weak:S().optional().default(!1).describe(`Whether this is a weak ETag`)}),uJ=h({ifNoneMatch:r().optional().describe(`ETag value for conditional request (If-None-Match header)`),ifModifiedSince:r().datetime().optional().describe(`Timestamp for conditional request (If-Modified-Since header)`),cacheControl:cJ.optional().describe(`Client cache control preferences`)}),dJ=h({data:u().optional().describe(`Metadata payload (omitted for 304 Not Modified)`),etag:lJ.optional().describe(`ETag for this resource version`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),cacheControl:cJ.optional().describe(`Cache control directives`),notModified:S().optional().default(!1).describe(`True if resource has not been modified (304 response)`),version:r().optional().describe(`Metadata version identifier`)}),fJ=E([`all`,`object`,`field`,`permission`,`layout`,`custom`]),pJ=h({target:fJ.describe(`What to invalidate`),identifiers:C(r()).optional().describe(`Specific resources to invalidate (e.g., object names)`),cascade:S().optional().default(!1).describe(`If true, invalidate dependent resources`),pattern:r().optional().describe(`Pattern for custom invalidation (supports wildcards)`)}),mJ=h({success:S().describe(`Whether invalidation succeeded`),invalidated:P().describe(`Number of cache entries invalidated`),targets:C(r()).optional().describe(`List of invalidated resources`)}),UTe={getCached:{input:uJ,output:dJ},invalidate:{input:pJ,output:mJ}},hJ=E([`validation`,`authentication`,`authorization`,`not_found`,`conflict`,`rate_limit`,`server`,`external`,`maintenance`]),gJ=E(`validation_error.invalid_field.missing_required_field.invalid_format.value_too_long.value_too_short.value_out_of_range.invalid_reference.duplicate_value.invalid_query.invalid_filter.invalid_sort.max_records_exceeded.unauthenticated.invalid_credentials.expired_token.invalid_token.session_expired.mfa_required.email_not_verified.permission_denied.insufficient_privileges.field_not_accessible.record_not_accessible.license_required.ip_restricted.time_restricted.resource_not_found.object_not_found.record_not_found.field_not_found.endpoint_not_found.resource_conflict.concurrent_modification.delete_restricted.duplicate_record.lock_conflict.rate_limit_exceeded.quota_exceeded.concurrent_limit_exceeded.internal_error.database_error.timeout.service_unavailable.not_implemented.external_service_error.integration_error.webhook_delivery_failed.batch_partial_failure.batch_complete_failure.transaction_failed`.split(`.`)),WTe={validation:400,authentication:401,authorization:403,not_found:404,conflict:409,rate_limit:429,server:500,external:502,maintenance:503},_J=E([`no_retry`,`retry_immediate`,`retry_backoff`,`retry_after`]),vJ=h({field:r().describe(`Field path (supports dot notation)`),code:gJ.describe(`Error code for this field`),message:r().describe(`Human-readable error message`),value:u().optional().describe(`The invalid value that was provided`),constraint:u().optional().describe(`The constraint that was violated (e.g., max length)`)}),yJ=h({code:gJ.describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),category:hJ.optional().describe(`Error category`),httpStatus:P().optional().describe(`HTTP status code`),retryable:S().default(!1).describe(`Whether the request can be retried`),retryStrategy:_J.optional().describe(`Recommended retry strategy`),retryAfter:P().optional().describe(`Seconds to wait before retrying`),details:u().optional().describe(`Additional error context`),fieldErrors:C(vJ).optional().describe(`Field-specific validation errors`),timestamp:r().datetime().optional().describe(`When the error occurred`),requestId:r().optional().describe(`Request ID for tracking`),traceId:r().optional().describe(`Distributed trace ID`),documentation:r().url().optional().describe(`URL to error documentation`),helpText:r().optional().describe(`Suggested actions to resolve the error`)}),GTe=h({success:m(!1).describe(`Always false for error responses`),error:yJ.describe(`Error details`),meta:h({timestamp:r().datetime().optional(),requestId:r().optional(),traceId:r().optional()}).optional().describe(`Response metadata`)}),bJ=E([`on_create`,`on_update`,`on_create_or_update`,`on_delete`,`schedule`]),xJ=h({name:r().describe(`Action name`),type:m(`field_update`),field:r().describe(`Field to update`),value:u().describe(`Value or Formula to set`)}),SJ=h({name:r().describe(`Action name`),type:m(`email_alert`),template:r().describe(`Email template ID/DevName`),recipients:C(r()).describe(`List of recipient emails or user IDs`)}),CJ=h({name:r().describe(`Action name`),type:m(`connector_action`),connectorId:r().describe(`Target Connector ID (e.g. slack, twilio)`),actionId:r().describe(`Target Action ID (e.g. send_message)`),input:d(r(),u()).describe(`Input parameters matching the action schema`)}),wJ=h({name:r().describe(`Action name`),type:m(`http_call`),url:r().describe(`Target URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`]).default(`POST`).describe(`HTTP Method`),headers:d(r(),r()).optional().describe(`HTTP Headers`),body:r().optional().describe(`Request body (JSON or text)`)}),TJ=h({name:r().describe(`Action name`),type:m(`task_creation`),taskObject:r().describe(`Task object name (e.g., "task", "project_task")`),subject:r().describe(`Task subject/title`),description:r().optional().describe(`Task description`),assignedTo:r().optional().describe(`User ID or field reference for assignee`),dueDate:r().optional().describe(`Due date (ISO string or formula)`),priority:r().optional().describe(`Task priority`),relatedTo:r().optional().describe(`Related record ID or field reference`),additionalFields:d(r(),u()).optional().describe(`Additional custom fields`)}),EJ=h({name:r().describe(`Action name`),type:m(`push_notification`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),recipients:C(r()).describe(`User IDs or device tokens`),data:d(r(),u()).optional().describe(`Additional data payload`),badge:P().optional().describe(`Badge count (iOS)`),sound:r().optional().describe(`Notification sound`),clickAction:r().optional().describe(`Action/URL when notification is clicked`)}),DJ=h({name:r().describe(`Action name`),type:m(`custom_script`),language:E([`javascript`,`typescript`,`python`]).default(`javascript`).describe(`Script language`),code:r().describe(`Script code to execute`),timeout:P().default(3e4).describe(`Execution timeout in milliseconds`),context:d(r(),u()).optional().describe(`Additional context variables`)}),OJ=I(`type`,[xJ,SJ,wJ,CJ,TJ,EJ,DJ]),kJ=h({id:r().optional().describe(`Unique identifier`),timeLength:P().int().describe(`Duration amount (e.g. 1, 30)`),timeUnit:E([`minutes`,`hours`,`days`]).describe(`Unit of time`),offsetDirection:E([`before`,`after`]).describe(`Before or After the reference date`),offsetFrom:E([`trigger_date`,`date_field`]).describe(`Basis for calculation`),dateField:r().optional().describe(`Date field to calculate from (required if offsetFrom is date_field)`),actions:C(OJ).describe(`Actions to execute at the scheduled time`)}),AJ=h({name:kA.describe(`Unique workflow name (lowercase snake_case)`),objectName:r().describe(`Target Object`),triggerType:bJ.describe(`When to evaluate`),criteria:r().optional().describe(`Formula condition. If TRUE, actions execute.`),actions:C(OJ).optional().describe(`Immediate actions`),timeTriggers:C(kJ).optional().describe(`Scheduled actions relative to trigger or date field`),active:S().default(!0).describe(`Whether this workflow is active`),executionOrder:P().int().min(0).default(100).describe(`Deterministic execution order when multiple workflows match (lower runs first)`),reevaluateOnChange:S().default(!1).describe(`Re-evaluate rule if field updates change the record validity`)}),KTe=h({trigger:r(),payload:d(r(),u())}),qTe=h({success:S(),jobId:r().optional(),result:u().optional()}),JTe=h({}),YTe=XK.partial().required({version:!0}).extend({apiName:r().optional().describe(`API name (deprecated — use name)`)}),XTe=h({}),ZTe=h({types:C(r()).describe(`Available metadata type names (e.g., "object", "plugin", "view")`)}),QTe=h({type:r().describe(`Metadata type name (e.g., "object", "plugin")`),packageId:r().optional().describe(`Optional package ID to filter items by`)}),$Te=h({type:r().describe(`Metadata type name`),items:C(u()).describe(`Array of metadata items`)}),eEe=h({type:r().describe(`Metadata type name`),name:r().describe(`Item name (snake_case identifier)`),packageId:r().optional().describe(`Optional package ID to filter items by`)}),tEe=h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),item:u().describe(`Metadata item definition`)}),nEe=h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),item:u().describe(`Metadata item definition`)}),rEe=h({success:S(),message:r().optional()}),iEe=h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),cacheRequest:uJ.optional().describe(`Cache validation parameters`)}),aEe=dJ,oEe=h({object:r().describe(`Object name (snake_case)`),type:E([`list`,`form`]).describe(`View type`)}),sEe=sF,cEe=h({object:r().describe(`The unique machine name of the object to query (e.g. "account").`),query:Lj.optional().describe(`Structured query definition (filter, sort, select, pagination).`)}),lEe=h({object:r().describe(`The object name for the returned records.`),records:C(d(r(),u())).describe(`The list of matching records.`),total:P().optional().describe(`Total number of records matching the filter (if requested).`),nextCursor:r().optional().describe(`Cursor for the next page of results (cursor-based pagination).`),hasMore:S().optional().describe(`True if there are more records available (pagination).`)}),uEe=h({filter:r().optional().describe(`JSON-encoded filter expression (canonical, singular).`),filters:r().optional().describe(`JSON-encoded filter expression (deprecated plural alias).`),select:r().optional().describe(`Comma-separated list of fields to retrieve.`),sort:r().optional().describe(`Sort expression (e.g. "name asc,created_at desc" or "-created_at").`),orderBy:r().optional().describe(`Alias for sort (OData compatibility).`),top:pe().optional().describe(`Max records to return (limit).`),skip:pe().optional().describe(`Records to skip (offset).`),expand:r().optional().describe(`Comma-separated list of lookup/master_detail field names to expand. Resolved to populate array and passed to the engine for batch $in expansion.`),search:r().optional().describe(`Full-text search query.`),distinct:me().optional().describe(`SELECT DISTINCT flag.`),count:me().optional().describe(`Include total count in response.`)}),dEe=h({object:r().describe(`The object name.`),id:r().describe(`The unique record identifier (primary key).`),select:C(r()).optional().describe(`Fields to include in the response (allowlisted query param).`),expand:C(r()).optional().describe(`Lookup/master_detail field names to expand. The engine resolves these via batch $in queries, replacing foreign key IDs with full objects.`)}),fEe=h({object:r().describe(`The object name.`),id:r().describe(`The record ID.`),record:d(r(),u()).describe(`The complete record data.`)}),pEe=h({object:r().describe(`The object name.`),data:d(r(),u()).describe(`The dictionary of field values to insert.`)}),mEe=h({object:r().describe(`The object name.`),id:r().describe(`The ID of the newly created record.`),record:d(r(),u()).describe(`The created record, including server-generated fields (created_at, owner).`)}),hEe=h({object:r().describe(`The object name.`),id:r().describe(`The ID of the record to update.`),data:d(r(),u()).describe(`The fields to update (partial update).`)}),gEe=h({object:r().describe(`Object name`),id:r().describe(`Updated record ID`),record:d(r(),u()).describe(`Updated record`)}),_Ee=h({object:r().describe(`Object name`),id:r().describe(`Record ID to delete`)}),vEe=h({object:r().describe(`Object name`),id:r().describe(`Deleted record ID`),success:S().describe(`Whether deletion succeeded`)}),yEe=h({object:r().describe(`Object name`),request:nJ.describe(`Batch operation request`)}),bEe=aJ,xEe=h({object:r().describe(`Object name`),records:C(d(r(),u())).describe(`Array of records to create`)}),SEe=h({object:r().describe(`Object name`),records:C(d(r(),u())).describe(`Created records`),count:P().describe(`Number of records created`)}),CEe=h({object:r().describe(`Object name`),records:C(h({id:r().describe(`Record ID`),data:d(r(),u()).describe(`Fields to update`)})).describe(`Array of updates`),options:tJ.optional().describe(`Update options`)}),wEe=aJ,TEe=h({object:r().describe(`Object name`),ids:C(r()).describe(`Array of record IDs to delete`),options:tJ.optional().describe(`Delete options`)}),EEe=aJ,DEe=h({object:r().describe(`Object name (snake_case)`),type:E([`list`,`form`]).optional().describe(`Filter by view type`)}),OEe=h({object:r().describe(`Object name`),views:C(sF).describe(`Array of view definitions`)}),kEe=h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier`)}),AEe=h({object:r().describe(`Object name`),view:sF.describe(`View definition`)}),jEe=h({object:r().describe(`Object name (snake_case)`),data:sF.describe(`View definition to create`)}),MEe=h({object:r().describe(`Object name`),viewId:r().describe(`Created view identifier`),view:sF.describe(`Created view definition`)}),NEe=h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier`),data:sF.partial().describe(`Partial view data to update`)}),PEe=h({object:r().describe(`Object name`),viewId:r().describe(`Updated view identifier`),view:sF.describe(`Updated view definition`)}),FEe=h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier to delete`)}),IEe=h({object:r().describe(`Object name`),viewId:r().describe(`Deleted view identifier`),success:S().describe(`Whether deletion succeeded`)}),LEe=h({object:r().describe(`Object name to check permissions for`),action:E([`create`,`read`,`edit`,`delete`,`transfer`,`restore`,`purge`]).describe(`Action to check`),recordId:r().optional().describe(`Specific record ID (for record-level checks)`),field:r().optional().describe(`Specific field name (for field-level checks)`)}),REe=h({allowed:S().describe(`Whether the action is permitted`),reason:r().optional().describe(`Reason if denied`)}),zEe=h({object:r().describe(`Object name to get permissions for`)}),BEe=h({object:r().describe(`Object name`),permissions:JN.describe(`Object-level permissions`),fieldPermissions:d(r(),YN).optional().describe(`Field-level permissions keyed by field name`)}),VEe=h({}),HEe=h({objects:d(r(),JN).describe(`Effective object permissions keyed by object name`),systemPermissions:C(r()).describe(`Effective system-level permissions`)}),UEe=h({object:r().describe(`Object name to get workflow config for`)}),WEe=h({object:r().describe(`Object name`),workflows:C(AJ).describe(`Active workflow rules for this object`)}),jJ=h({currentState:r().describe(`Current workflow state name`),availableTransitions:C(h({name:r().describe(`Transition name`),targetState:r().describe(`Target state after transition`),label:r().optional().describe(`Display label`),requiresApproval:S().default(!1).describe(`Whether transition requires approval`)})).describe(`Available transitions from current state`),history:C(h({fromState:r().describe(`Previous state`),toState:r().describe(`New state`),action:r().describe(`Action that triggered the transition`),userId:r().describe(`User who performed the action`),timestamp:r().datetime().describe(`When the transition occurred`),comment:r().optional().describe(`Optional comment`)})).optional().describe(`State transition history`)}),GEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID to get workflow state for`)}),KEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),state:jJ.describe(`Current workflow state and available transitions`)}),qEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),transition:r().describe(`Transition name to execute`),comment:r().optional().describe(`Optional comment for the transition`),data:d(r(),u()).optional().describe(`Additional data for the transition`)}),JEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the transition succeeded`),state:jJ.describe(`New workflow state after transition`)}),YEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),comment:r().optional().describe(`Approval comment`),data:d(r(),u()).optional().describe(`Additional data`)}),XEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the approval succeeded`),state:jJ.describe(`New workflow state after approval`)}),ZEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),reason:r().describe(`Rejection reason`),comment:r().optional().describe(`Additional comment`)}),QEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the rejection succeeded`),state:jJ.describe(`New workflow state after rejection`)}),$Ee=h({transport:rq.optional().describe(`Preferred transport protocol`),channels:C(r()).optional().describe(`Channels to subscribe to on connect`),token:r().optional().describe(`Authentication token`)}),eDe=h({connectionId:r().describe(`Unique connection identifier`),transport:rq.describe(`Negotiated transport protocol`),url:r().optional().describe(`WebSocket/SSE endpoint URL`)}),tDe=h({connectionId:r().optional().describe(`Connection ID to disconnect`)}),nDe=h({success:S().describe(`Whether disconnection succeeded`)}),rDe=h({channel:r().describe(`Channel name to subscribe to`),events:C(r()).optional().describe(`Specific event types to listen for`),filter:d(r(),u()).optional().describe(`Event filter criteria`)}),iDe=h({subscriptionId:r().describe(`Unique subscription identifier`),channel:r().describe(`Subscribed channel name`)}),aDe=h({subscriptionId:r().describe(`Subscription ID to cancel`)}),oDe=h({success:S().describe(`Whether unsubscription succeeded`)}),sDe=h({channel:r().describe(`Channel to set presence in`),state:sq.describe(`Presence state to set`)}),cDe=h({success:S().describe(`Whether presence was set`)}),lDe=h({channel:r().describe(`Channel to get presence for`)}),uDe=h({channel:r().describe(`Channel name`),members:C(sq).describe(`Active members and their presence state`)}),dDe=h({token:r().describe(`Device push notification token`),platform:E([`ios`,`android`,`web`]).describe(`Device platform`),deviceId:r().optional().describe(`Unique device identifier`),name:r().optional().describe(`Device friendly name`)}),fDe=h({deviceId:r().describe(`Registered device ID`),success:S().describe(`Whether registration succeeded`)}),pDe=h({deviceId:r().describe(`Device ID to unregister`)}),mDe=h({success:S().describe(`Whether unregistration succeeded`)}),MJ=h({email:S().default(!0).describe(`Receive email notifications`),push:S().default(!0).describe(`Receive push notifications`),inApp:S().default(!0).describe(`Receive in-app notifications`),digest:E([`none`,`daily`,`weekly`]).default(`none`).describe(`Email digest frequency`),channels:d(r(),h({enabled:S().default(!0).describe(`Whether this channel is enabled`),email:S().optional().describe(`Override email setting`),push:S().optional().describe(`Override push setting`)})).optional().describe(`Per-channel notification preferences`)}),hDe=h({}),gDe=h({preferences:MJ.describe(`Current notification preferences`)}),_De=h({preferences:MJ.partial().describe(`Preferences to update`)}),vDe=h({preferences:MJ.describe(`Updated notification preferences`)}),NJ=h({id:r().describe(`Notification ID`),type:r().describe(`Notification type`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),read:S().default(!1).describe(`Whether notification has been read`),data:d(r(),u()).optional().describe(`Additional notification data`),actionUrl:r().optional().describe(`URL to navigate to when clicked`),createdAt:r().datetime().describe(`When notification was created`)}),yDe=h({read:S().optional().describe(`Filter by read status`),type:r().optional().describe(`Filter by notification type`),limit:P().default(20).describe(`Maximum number of notifications to return`),cursor:r().optional().describe(`Pagination cursor`)}),bDe=h({notifications:C(NJ).describe(`List of notifications`),unreadCount:P().describe(`Total number of unread notifications`),cursor:r().optional().describe(`Next page cursor`)}),xDe=h({ids:C(r()).describe(`Notification IDs to mark as read`)}),SDe=h({success:S().describe(`Whether the operation succeeded`),readCount:P().describe(`Number of notifications marked as read`)}),CDe=h({}),wDe=h({success:S().describe(`Whether the operation succeeded`),readCount:P().describe(`Number of notifications marked as read`)}),TDe=h({query:r().describe(`Natural language query string`),object:r().optional().describe(`Target object context`),conversationId:r().optional().describe(`Conversation ID for multi-turn queries`)}),EDe=h({query:u().describe(`Generated structured query (AST)`),explanation:r().optional().describe(`Human-readable explanation of the query`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),suggestions:C(r()).optional().describe(`Suggested follow-up queries`)}),DDe=h({object:r().describe(`Object name for context`),field:r().optional().describe(`Field to suggest values for`),recordId:r().optional().describe(`Record ID for context`),partial:r().optional().describe(`Partial input for completion`)}),ODe=h({suggestions:C(h({value:u().describe(`Suggested value`),label:r().describe(`Display label`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),reason:r().optional().describe(`Reason for this suggestion`)})).describe(`Suggested values`)}),kDe=h({object:r().describe(`Object name to analyze`),recordId:r().optional().describe(`Specific record to analyze`),type:E([`summary`,`trends`,`anomalies`,`recommendations`]).optional().describe(`Type of insight`)}),ADe=h({insights:C(h({type:r().describe(`Insight type`),title:r().describe(`Insight title`),description:r().describe(`Detailed description`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),data:d(r(),u()).optional().describe(`Supporting data`)})).describe(`Generated insights`)}),jDe=h({}),MDe=h({locales:C(h({code:r().describe(`BCP-47 locale code (e.g., en-US, zh-CN)`),label:r().describe(`Display name of the locale`),isDefault:S().default(!1).describe(`Whether this is the default locale`)})).describe(`Available locales`)}),NDe=h({locale:r().describe(`BCP-47 locale code`),namespace:r().optional().describe(`Translation namespace (e.g., objects, apps, messages)`),keys:C(r()).optional().describe(`Specific translation keys to fetch`)}),PDe=h({locale:r().describe(`Locale code`),translations:Rz.describe(`Translation data`)}),FDe=h({object:r().describe(`Object name`),locale:r().describe(`BCP-47 locale code`)}),IDe=h({object:r().describe(`Object name`),locale:r().describe(`Locale code`),labels:d(r(),h({label:r().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),options:d(r(),r()).optional().describe(`Translated option labels`)})).describe(`Field labels keyed by field name`)}),LDe=h({getDiscovery:M().describe(`Get API discovery information`),getMetaTypes:M().describe(`Get available metadata types`),getMetaItems:M().describe(`Get all items of a metadata type`),getMetaItem:M().describe(`Get a specific metadata item`),saveMetaItem:M().describe(`Save metadata item`),getMetaItemCached:M().describe(`Get a metadata item with cache validation`),getUiView:M().describe(`Get UI view definition`),analyticsQuery:M().describe(`Execute analytics query`),getAnalyticsMeta:M().describe(`Get analytics metadata (cubes)`),triggerAutomation:M().describe(`Trigger an automation flow or script`),listPackages:M().describe(`List installed packages with optional filters`),getPackage:M().describe(`Get a specific installed package by ID`),installPackage:M().describe(`Install a new package from manifest`),uninstallPackage:M().describe(`Uninstall a package by ID`),enablePackage:M().describe(`Enable a disabled package`),disablePackage:M().describe(`Disable an installed package`),findData:M().describe(`Find data records`),getData:M().describe(`Get single data record`),createData:M().describe(`Create a data record`),updateData:M().describe(`Update a data record`),deleteData:M().describe(`Delete a data record`),batchData:M().describe(`Perform batch operations`),createManyData:M().describe(`Create multiple records`),updateManyData:M().describe(`Update multiple records`),deleteManyData:M().describe(`Delete multiple records`),listViews:M().describe(`List views for an object`),getView:M().describe(`Get a specific view`),createView:M().describe(`Create a new view`),updateView:M().describe(`Update an existing view`),deleteView:M().describe(`Delete a view`),checkPermission:M().describe(`Check if an action is permitted`),getObjectPermissions:M().describe(`Get permissions for an object`),getEffectivePermissions:M().describe(`Get effective permissions for current user`),getWorkflowConfig:M().describe(`Get workflow configuration for an object`),getWorkflowState:M().describe(`Get workflow state for a record`),workflowTransition:M().describe(`Execute a workflow state transition`),workflowApprove:M().describe(`Approve a workflow step`),workflowReject:M().describe(`Reject a workflow step`),realtimeConnect:M().describe(`Establish realtime connection`),realtimeDisconnect:M().describe(`Close realtime connection`),realtimeSubscribe:M().describe(`Subscribe to a realtime channel`),realtimeUnsubscribe:M().describe(`Unsubscribe from a realtime channel`),setPresence:M().describe(`Set user presence state`),getPresence:M().describe(`Get channel presence information`),registerDevice:M().describe(`Register a device for push notifications`),unregisterDevice:M().describe(`Unregister a device`),getNotificationPreferences:M().describe(`Get notification preferences`),updateNotificationPreferences:M().describe(`Update notification preferences`),listNotifications:M().describe(`List notifications`),markNotificationsRead:M().describe(`Mark specific notifications as read`),markAllNotificationsRead:M().describe(`Mark all notifications as read`),aiNlq:M().describe(`Natural language query`),aiChat:M().describe(`AI chat interaction`),aiSuggest:M().describe(`Get AI-powered suggestions`),aiInsights:M().describe(`Get AI-generated insights`),getLocales:M().describe(`Get available locales`),getTranslations:M().describe(`Get translations for a locale`),getFieldLabels:M().describe(`Get translated field labels for an object`),listFeed:M().describe(`List feed items for a record`),createFeedItem:M().describe(`Create a new feed item`),updateFeedItem:M().describe(`Update an existing feed item`),deleteFeedItem:M().describe(`Delete a feed item`),addReaction:M().describe(`Add an emoji reaction to a feed item`),removeReaction:M().describe(`Remove an emoji reaction from a feed item`),pinFeedItem:M().describe(`Pin a feed item`),unpinFeedItem:M().describe(`Unpin a feed item`),starFeedItem:M().describe(`Star a feed item`),unstarFeedItem:M().describe(`Unstar a feed item`),searchFeed:M().describe(`Search feed items`),getChangelog:M().describe(`Get field-level changelog for a record`),feedSubscribe:M().describe(`Subscribe to record notifications`),feedUnsubscribe:M().describe(`Unsubscribe from record notifications`)}),PJ=h({version:r().regex(/^[a-zA-Z0-9_\-\.]+$/).default(`v1`).describe(`API version (e.g., v1, v2, 2024-01)`),basePath:r().default(`/api`).describe(`Base URL path for API`),apiPath:r().optional().describe(`Full API path (defaults to {basePath}/{version})`),enableCrud:S().default(!0).describe(`Enable automatic CRUD endpoint generation`),enableMetadata:S().default(!0).describe(`Enable metadata API endpoints`),enableUi:S().default(!0).describe(`Enable UI API endpoints (Views, Menus, Layouts)`),enableBatch:S().default(!0).describe(`Enable batch operation endpoints`),enableDiscovery:S().default(!0).describe(`Enable API discovery endpoint`),documentation:h({enabled:S().default(!0).describe(`Enable API documentation`),title:r().default(`ObjectStack API`).describe(`API documentation title`),description:r().optional().describe(`API description`),version:r().optional().describe(`Documentation version`),termsOfService:r().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().optional(),email:r().optional()}).optional(),license:h({name:r(),url:r().optional()}).optional()}).optional().describe(`OpenAPI/Swagger documentation config`),responseFormat:h({envelope:S().default(!0).describe(`Wrap responses in standard envelope`),includeMetadata:S().default(!0).describe(`Include response metadata (timestamp, requestId)`),includePagination:S().default(!0).describe(`Include pagination info in list responses`)}).optional().describe(`Response format options`)}),FJ=E([`create`,`read`,`update`,`delete`,`list`]),IJ=h({method:NA.describe(`HTTP method`),path:r().describe(`URL path pattern`),summary:r().optional().describe(`Operation summary`),description:r().optional().describe(`Operation description`)}),LJ=h({operations:h({create:S().default(!0).describe(`Enable create operation`),read:S().default(!0).describe(`Enable read operation`),update:S().default(!0).describe(`Enable update operation`),delete:S().default(!0).describe(`Enable delete operation`),list:S().default(!0).describe(`Enable list operation`)}).optional().describe(`Enable/disable operations`),patterns:d(FJ,IJ.optional()).optional().describe(`Custom URL patterns for operations`),dataPrefix:r().default(`/data`).describe(`URL prefix for data endpoints`),objectParamStyle:E([`path`,`query`]).default(`path`).describe(`How object name is passed (path param or query param)`)}),RJ=h({prefix:r().default(`/meta`).describe(`URL prefix for metadata endpoints`),enableCache:S().default(!0).describe(`Enable HTTP cache headers (ETag, Last-Modified)`),cacheTtl:P().int().default(3600).describe(`Cache TTL in seconds`),endpoints:h({types:S().default(!0).describe(`GET /meta - List all metadata types`),items:S().default(!0).describe(`GET /meta/:type - List items of type`),item:S().default(!0).describe(`GET /meta/:type/:name - Get specific item`),schema:S().default(!0).describe(`GET /meta/:type/:name/schema - Get JSON schema`)}).optional().describe(`Enable/disable specific endpoints`)}),zJ=h({maxBatchSize:P().int().min(1).max(1e3).default(200).describe(`Maximum records per batch operation`),enableBatchEndpoint:S().default(!0).describe(`Enable POST /data/:object/batch endpoint`),operations:h({createMany:S().default(!0).describe(`Enable POST /data/:object/createMany`),updateMany:S().default(!0).describe(`Enable POST /data/:object/updateMany`),deleteMany:S().default(!0).describe(`Enable POST /data/:object/deleteMany`),upsertMany:S().default(!0).describe(`Enable POST /data/:object/upsertMany`)}).optional().describe(`Enable/disable specific batch operations`),defaultAtomic:S().default(!0).describe(`Default atomic/transaction mode for batch operations`)}),BJ=h({includeObjects:C(r()).optional().describe(`Specific objects to generate routes for (empty = all)`),excludeObjects:C(r()).optional().describe(`Objects to exclude from route generation`),nameTransform:E([`none`,`plural`,`kebab-case`,`camelCase`]).default(`none`).describe(`Transform object names in URLs`),overrides:d(r(),h({enabled:S().optional().describe(`Enable/disable routes for this object`),basePath:r().optional().describe(`Custom base path`),operations:d(FJ,S()).optional().describe(`Enable/disable specific operations`)})).optional().describe(`Per-object route customization`)}),VJ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Webhook event identifier (snake_case)`),description:r().describe(`Human-readable event description`),method:NA.default(`POST`).describe(`HTTP method for webhook delivery`),payloadSchema:r().describe(`JSON Schema $ref for the webhook payload`),headers:d(r(),r()).optional().describe(`Custom headers to include in webhook delivery`),security:C(E([`hmac_sha256`,`basic`,`bearer`,`api_key`])).describe(`Supported authentication methods for webhook verification`)}),RDe=h({enabled:S().default(!1).describe(`Enable webhook support`),events:C(VJ).describe(`Registered webhook events`),deliveryConfig:h({maxRetries:P().int().default(3).describe(`Maximum delivery retry attempts`),retryIntervalMs:P().int().default(5e3).describe(`Milliseconds between retry attempts`),timeoutMs:P().int().default(3e4).describe(`Delivery request timeout in milliseconds`),signatureHeader:r().default(`X-Signature-256`).describe(`Header name for webhook signature`)}).describe(`Webhook delivery configuration`),registrationEndpoint:r().default(`/webhooks`).describe(`URL path for webhook registration`)}),HJ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Callback identifier (snake_case)`),expression:r().describe(`Runtime expression (e.g., {$request.body#/callbackUrl})`),method:NA.describe(`HTTP method for callback request`),url:r().describe(`Callback URL template with runtime expressions`)}),UJ=h({webhooks:d(r(),VJ).optional().describe(`OpenAPI 3.1 webhooks (top-level webhook definitions)`),callbacks:d(r(),C(HJ)).optional().describe(`OpenAPI 3.1 callbacks (async response definitions)`),jsonSchemaDialect:r().default(`https://json-schema.org/draft/2020-12/schema`).describe(`JSON Schema dialect for schema definitions`),pathItemReferences:S().default(!1).describe(`Allow $ref in path items (OpenAPI 3.1 feature)`)}),WJ=h({api:PJ.optional().describe(`REST API configuration`),crud:LJ.optional().describe(`CRUD endpoints configuration`),metadata:RJ.optional().describe(`Metadata endpoints configuration`),batch:zJ.optional().describe(`Batch endpoints configuration`),routes:BJ.optional().describe(`Route generation configuration`),openApi31:UJ.optional().describe(`OpenAPI 3.1 extensions configuration`)}),GJ=h({id:r().describe(`Unique endpoint identifier`),method:NA.describe(`HTTP method`),path:r().describe(`Full URL path`),object:r().describe(`Object name (snake_case)`),operation:l([FJ,r()]).describe(`Operation type`),handler:r().describe(`Handler function identifier`),metadata:h({summary:r().optional(),description:r().optional(),tags:C(r()).optional(),deprecated:S().optional()}).optional()}),zDe=h({endpoints:C(GJ).describe(`All generated endpoints`),total:P().int().describe(`Total number of endpoints`),byObject:d(r(),C(GJ)).optional().describe(`Endpoints grouped by object`),byOperation:d(r(),C(GJ)).optional().describe(`Endpoints grouped by operation`)}),BDe=Object.assign(PJ,{create:e=>e}),VDe=Object.assign(WJ,{create:e=>e}),KJ=E([`rest`,`graphql`,`odata`,`websocket`,`file`,`auth`,`metadata`,`plugin`,`webhook`,`rpc`]),qJ=l([P().int().min(100).max(599),E([`2xx`,`3xx`,`4xx`,`5xx`])]),JJ=h({objectId:kA.describe(`Object name to reference`),includeFields:C(r()).optional().describe(`Include only these fields in the schema`),excludeFields:C(r()).optional().describe(`Exclude these fields from the schema`),includeRelated:C(r()).optional().describe(`Include related objects via lookup fields`)}),HDe=l([u().describe(`Static JSON Schema definition`),h({$ref:JJ.describe(`Dynamic reference to ObjectQL object`)}).describe(`Dynamic ObjectQL reference`)]),YJ=h({name:r().describe(`Parameter name`),in:E([`path`,`query`,`header`,`body`,`cookie`]).describe(`Parameter location`),description:r().optional().describe(`Parameter description`),required:S().default(!1).describe(`Whether parameter is required`),schema:l([h({type:E([`string`,`number`,`integer`,`boolean`,`array`,`object`]).describe(`Parameter type`),format:r().optional().describe(`Format (e.g., date-time, email, uuid)`),enum:C(u()).optional().describe(`Allowed values`),default:u().optional().describe(`Default value`),items:u().optional().describe(`Array item schema`),properties:d(r(),u()).optional().describe(`Object properties`)}).describe(`Static JSON Schema`),h({$ref:JJ}).describe(`Dynamic ObjectQL reference`)]).describe(`Parameter schema definition`),example:u().optional().describe(`Example value`)}),XJ=h({statusCode:qJ.describe(`HTTP status code`),description:r().describe(`Response description`),contentType:r().default(`application/json`).describe(`Response content type`),schema:l([u().describe(`Static JSON Schema`),h({$ref:JJ}).describe(`Dynamic ObjectQL reference`)]).optional().describe(`Response body schema`),headers:d(r(),h({description:r().optional(),schema:u()})).optional().describe(`Response headers`),example:u().optional().describe(`Example response`)}),ZJ=h({id:r().describe(`Unique endpoint identifier`),method:NA.optional().describe(`HTTP method`),path:r().describe(`URL path pattern`),summary:r().optional().describe(`Short endpoint summary`),description:r().optional().describe(`Detailed endpoint description`),operationId:r().optional().describe(`Unique operation identifier`),tags:C(r()).optional().default([]).describe(`Tags for categorization`),parameters:C(YJ).optional().default([]).describe(`Endpoint parameters`),requestBody:h({description:r().optional(),required:S().default(!1),contentType:r().default(`application/json`),schema:u().optional(),example:u().optional()}).optional().describe(`Request body specification`),responses:C(XJ).optional().default([]).describe(`Possible responses`),rateLimit:LA.optional().describe(`Endpoint specific rate limiting`),security:C(d(r(),C(r()))).optional().describe(`Security requirements (e.g. [{"bearerAuth": []}])`),requiredPermissions:C(r()).optional().default([]).describe(`Required RBAC permissions (e.g., "customer.read", "manage_users")`),priority:P().int().min(0).max(1e3).optional().default(100).describe(`Route priority for conflict resolution (0-1000, higher = more important)`),protocolConfig:d(r(),u()).optional().describe(`Protocol-specific configuration for custom protocols (gRPC, tRPC, etc.)`),deprecated:S().default(!1).describe(`Whether endpoint is deprecated`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation link`)}),QJ=h({owner:r().optional().describe(`Owner team or person`),status:E([`active`,`deprecated`,`experimental`,`beta`]).default(`active`).describe(`API lifecycle status`),tags:C(r()).optional().default([]).describe(`Classification tags`),pluginSource:r().optional().describe(`Source plugin name`),custom:d(r(),u()).optional().describe(`Custom metadata fields`)}),$J=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique API identifier (snake_case)`),name:r().describe(`API display name`),type:KJ.describe(`API protocol type`),version:r().describe(`API version (e.g., v1, 2024-01)`),basePath:r().describe(`Base URL path for this API`),description:r().optional().describe(`API description`),endpoints:C(ZJ).describe(`Registered endpoints`),config:d(r(),u()).optional().describe(`Protocol-specific configuration`),metadata:QJ.optional().describe(`Additional metadata`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`Contact information`),license:h({name:r(),url:r().url().optional()}).optional().describe(`License information`)}),eY=E([`error`,`priority`,`first-wins`,`last-wins`]),tY=h({version:r().describe(`Registry version`),conflictResolution:eY.optional().default(`error`).describe(`Strategy for handling route conflicts`),apis:C($J).describe(`All registered APIs`),totalApis:P().int().describe(`Total number of registered APIs`),totalEndpoints:P().int().describe(`Total number of endpoints`),byType:d(KJ,C($J)).optional().describe(`APIs grouped by protocol type`),byStatus:d(r(),C($J)).optional().describe(`APIs grouped by status`),updatedAt:r().datetime().optional().describe(`Last registry update time`)}),nY=h({type:KJ.optional().describe(`Filter by API protocol type`),tags:C(r()).optional().describe(`Filter by tags (ANY match)`),status:E([`active`,`deprecated`,`experimental`,`beta`]).optional().describe(`Filter by lifecycle status`),pluginSource:r().optional().describe(`Filter by plugin name`),search:r().optional().describe(`Full-text search in name/description`),version:r().optional().describe(`Filter by specific version`)}),UDe=h({apis:C($J).describe(`Matching API entries`),total:P().int().describe(`Total matching APIs`),filters:nY.optional().describe(`Applied query filters`)}),WDe=Object.assign(ZJ,{create:e=>e}),GDe=Object.assign($J,{create:e=>e}),KDe=Object.assign(tY,{create:e=>e}),rY=h({url:r().url().describe(`Server base URL`),description:r().optional().describe(`Server description`),variables:d(r(),h({default:r(),description:r().optional(),enum:C(r()).optional()})).optional().describe(`URL template variables`)}),iY=h({type:E([`apiKey`,`http`,`oauth2`,`openIdConnect`]).describe(`Security type`),scheme:r().optional().describe(`HTTP auth scheme (bearer, basic, etc.)`),bearerFormat:r().optional().describe(`Bearer token format (e.g., JWT)`),name:r().optional().describe(`API key parameter name`),in:E([`header`,`query`,`cookie`]).optional().describe(`API key location`),flows:h({implicit:u().optional(),password:u().optional(),clientCredentials:u().optional(),authorizationCode:u().optional()}).optional().describe(`OAuth2 flows`),openIdConnectUrl:r().url().optional().describe(`OpenID Connect discovery URL`),description:r().optional().describe(`Security scheme description`)}),aY=h({openapi:r().default(`3.0.0`).describe(`OpenAPI specification version`),info:h({title:r().describe(`API title`),version:r().describe(`API version`),description:r().optional().describe(`API description`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional(),license:h({name:r(),url:r().url().optional()}).optional()}).describe(`API metadata`),servers:C(rY).optional().default([]).describe(`API servers`),paths:d(r(),u()).describe(`API paths and operations`),components:h({schemas:d(r(),u()).optional(),responses:d(r(),u()).optional(),parameters:d(r(),u()).optional(),examples:d(r(),u()).optional(),requestBodies:d(r(),u()).optional(),headers:d(r(),u()).optional(),securitySchemes:d(r(),iY).optional(),links:d(r(),u()).optional(),callbacks:d(r(),u()).optional()}).optional().describe(`Reusable components`),security:C(d(r(),C(r()))).optional().describe(`Global security requirements`),tags:C(h({name:r(),description:r().optional(),externalDocs:h({description:r().optional(),url:r().url()}).optional()})).optional().describe(`Tag definitions`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation`)}),oY=E([`swagger-ui`,`redoc`,`rapidoc`,`stoplight`,`scalar`,`graphql-playground`,`graphiql`,`postman`,`custom`]),sY=h({type:oY.describe(`Testing UI implementation`),path:r().default(`/api-docs`).describe(`URL path for documentation UI`),theme:E([`light`,`dark`,`auto`]).default(`light`).describe(`UI color theme`),enableTryItOut:S().default(!0).describe(`Enable interactive API testing`),enableFilter:S().default(!0).describe(`Enable endpoint filtering`),enableCors:S().default(!0).describe(`Enable CORS for browser testing`),defaultModelsExpandDepth:P().int().min(-1).default(1).describe(`Default expand depth for schemas (-1 = fully expand)`),displayRequestDuration:S().default(!0).describe(`Show request duration`),syntaxHighlighting:S().default(!0).describe(`Enable syntax highlighting`),customCssUrl:r().url().optional().describe(`Custom CSS stylesheet URL`),customJsUrl:r().url().optional().describe(`Custom JavaScript URL`),layout:h({showExtensions:S().default(!1).describe(`Show vendor extensions`),showCommonExtensions:S().default(!1).describe(`Show common extensions`),deepLinking:S().default(!0).describe(`Enable deep linking`),displayOperationId:S().default(!1).describe(`Display operation IDs`),defaultModelRendering:E([`example`,`model`]).default(`example`).describe(`Default model rendering mode`),defaultModelsExpandDepth:P().int().default(1).describe(`Models expand depth`),defaultModelExpandDepth:P().int().default(1).describe(`Single model expand depth`),docExpansion:E([`list`,`full`,`none`]).default(`list`).describe(`Documentation expansion mode`)}).optional().describe(`Layout configuration`)}),cY=h({name:r().describe(`Test request name`),description:r().optional().describe(`Request description`),method:E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`HEAD`,`OPTIONS`]).describe(`HTTP method`),url:r().describe(`Request URL (can include variables)`),headers:d(r(),r()).optional().default({}).describe(`Request headers`),queryParams:d(r(),l([r(),P(),S()])).optional().default({}).describe(`Query parameters`),body:u().optional().describe(`Request body`),variables:d(r(),u()).optional().default({}).describe(`Template variables`),expectedResponse:h({statusCode:P().int(),body:u().optional()}).optional().describe(`Expected response for validation`)}),lY=h({name:r().describe(`Collection name`),description:r().optional().describe(`Collection description`),variables:d(r(),u()).optional().default({}).describe(`Shared variables`),requests:C(cY).describe(`Test requests in this collection`),folders:C(h({name:r(),description:r().optional(),requests:C(cY)})).optional().describe(`Request folders for organization`)}),uY=h({version:r().describe(`API version`),date:r().date().describe(`Release date`),changes:h({added:C(r()).optional().default([]).describe(`New features`),changed:C(r()).optional().default([]).describe(`Changes`),deprecated:C(r()).optional().default([]).describe(`Deprecations`),removed:C(r()).optional().default([]).describe(`Removed features`),fixed:C(r()).optional().default([]).describe(`Bug fixes`),security:C(r()).optional().default([]).describe(`Security fixes`)}).describe(`Version changes`),migrationGuide:r().optional().describe(`Migration guide URL or text`)}),dY=h({language:r().describe(`Target language/framework (e.g., typescript, python, curl)`),name:r().describe(`Template name`),template:r().describe(`Code template with placeholders`),variables:C(r()).optional().describe(`Required template variables`)}),fY=h({enabled:S().default(!0).describe(`Enable API documentation`),title:r().default(`API Documentation`).describe(`Documentation title`),version:r().describe(`API version`),description:r().optional().describe(`API description`),servers:C(rY).optional().default([]).describe(`API server URLs`),ui:sY.optional().describe(`Testing UI configuration`),generateOpenApi:S().default(!0).describe(`Generate OpenAPI 3.0 specification`),generateTestCollections:S().default(!0).describe(`Generate API test collections`),testCollections:C(lY).optional().default([]).describe(`Predefined test collections`),changelog:C(uY).optional().default([]).describe(`API version changelog`),codeTemplates:C(dY).optional().default([]).describe(`Code generation templates`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`Contact information`),license:h({name:r(),url:r().url().optional()}).optional().describe(`API license`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation link`),securitySchemes:d(r(),iY).optional().describe(`Security scheme definitions`),tags:C(h({name:r(),description:r().optional(),externalDocs:h({description:r().optional(),url:r().url()}).optional()})).optional().describe(`Global tag definitions`)}),qDe=h({openApiSpec:aY.optional().describe(`Generated OpenAPI specification`),testCollections:C(lY).optional().describe(`Generated test collections`),markdown:r().optional().describe(`Generated markdown documentation`),html:r().optional().describe(`Generated HTML documentation`),generatedAt:r().datetime().describe(`Generation timestamp`),sourceApis:C(r()).describe(`Source API IDs used for generation`)}),JDe=Object.assign(fY,{create:e=>e}),YDe=Object.assign(lY,{create:e=>e}),XDe=Object.assign(aY,{create:e=>e}),ZDe=E([`/api/v1/analytics/query`,`/api/v1/analytics/meta`,`/api/v1/analytics/sql`]),QDe=h({query:AN.describe(`The analytic query definition`),cube:r().describe(`Target cube name`),format:E([`json`,`csv`,`xlsx`]).default(`json`).describe(`Response format`)}),$De=J.extend({data:h({rows:C(d(r(),u())).describe(`Result rows`),fields:C(h({name:r(),type:r()})).describe(`Column metadata`),sql:r().optional().describe(`Executed SQL (if debug enabled)`)})}),eOe=h({cube:r().optional().describe(`Optional cube name to filter`)}),tOe=J.extend({data:h({cubes:C(kN).describe(`Available cubes`)})}),nOe=J.extend({data:h({sql:r(),params:C(u())})}),pY=E([`urlPath`,`header`,`queryParam`,`dateBased`]),mY=E([`preview`,`current`,`supported`,`deprecated`,`retired`]),hY=h({version:r().describe(`Version identifier (e.g., "v1", "v2beta1", "2025-01-01")`),status:mY.describe(`Lifecycle status of this version`),releasedAt:r().describe(`Release date (ISO 8601, e.g., "2025-01-15")`),deprecatedAt:r().optional().describe(`Deprecation date (ISO 8601). Only set for deprecated/retired versions`),sunsetAt:r().optional().describe(`Sunset date (ISO 8601). After this date, the version returns 410 Gone`),migrationGuide:r().url().optional().describe(`URL to migration guide for upgrading from this version`),description:r().optional().describe(`Human-readable description or release notes summary`),breakingChanges:C(r()).optional().describe(`List of breaking changes (for preview/new versions)`)}),rOe=h({strategy:pY.default(`urlPath`).describe(`How the API version is specified by clients`),current:r().describe(`The current/recommended API version identifier`),default:r().describe(`Fallback version when client does not specify one`),versions:C(hY).min(1).describe(`All available API versions with lifecycle metadata`),headerName:r().default(`ObjectStack-Version`).describe(`HTTP header name for version negotiation (header/dateBased strategies)`),queryParamName:r().default(`version`).describe(`Query parameter name for version specification (queryParam strategy)`),urlPrefix:r().default(`/api`).describe(`URL prefix before version segment (urlPath strategy)`),deprecation:h({warnHeader:S().default(!0).describe(`Include Deprecation header (RFC 8594) in responses`),sunsetHeader:S().default(!0).describe(`Include Sunset header (RFC 8594) with retirement date`),linkHeader:S().default(!0).describe(`Include Link header pointing to migration guide URL`),rejectRetired:S().default(!0).describe(`Return 410 Gone for retired API versions`),warningMessage:r().optional().describe(`Custom warning message for deprecated version responses`)}).optional().describe(`Deprecation lifecycle behavior`),includeInDiscovery:S().default(!0).describe(`Include version information in the API discovery endpoint`)}),iOe=h({current:r().describe(`Current recommended API version`),requested:r().optional().describe(`Version requested by the client`),resolved:r().describe(`Resolved API version for this request`),supported:C(r()).describe(`All supported version identifiers`),deprecated:C(r()).optional().describe(`Deprecated version identifiers`),versions:C(hY).optional().describe(`Full version definitions with lifecycle metadata`)}),aOe={strategy:`urlPath`,current:`v1`,default:`v1`,versions:[{version:`v1`,status:`current`,releasedAt:`2025-01-15`,description:`ObjectStack API v1 — Initial stable release`}],deprecation:{warnHeader:!0,sunsetHeader:!0,linkHeader:!0,rejectRetired:!0},includeInDiscovery:!0},oOe=E([`local`,`google`,`github`,`microsoft`,`ldap`,`saml`]),gY=h({id:r().describe(`User ID`),email:r().email().describe(`Email address`),emailVerified:S().default(!1).describe(`Is email verified?`),name:r().describe(`Display name`),image:r().optional().describe(`Avatar URL`),username:r().optional().describe(`Username (optional)`),roles:C(r()).optional().default([]).describe(`Assigned role IDs`),tenantId:r().optional().describe(`Current tenant ID`),language:r().default(`en`).describe(`Preferred language`),timezone:r().optional().describe(`Preferred timezone`),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional()}),_Y=h({id:r(),expiresAt:r().datetime(),token:r().optional(),ipAddress:r().optional(),userAgent:r().optional(),userId:r()}),vY=E([`email`,`username`,`phone`,`magic-link`,`social`]),sOe=h({type:vY.default(`email`).describe(`Login method`),email:r().email().optional().describe(`Required for email/magic-link`),username:r().optional().describe(`Required for username login`),password:r().optional().describe(`Required for password login`),provider:r().optional().describe(`Required for social (google, github)`),redirectTo:r().optional().describe(`Redirect URL after successful login`)}),cOe=h({email:r().email(),password:r(),name:r(),image:r().optional()}),lOe=h({refreshToken:r().describe(`Refresh token`)}),uOe=J.extend({data:h({session:_Y.describe(`Active Session Info`),user:gY.describe(`Current User Details`),token:r().optional().describe(`Bearer token if not using cookies`)})}),dOe=J.extend({data:gY}),yY={signInEmail:`/sign-in/email`,signUpEmail:`/sign-up/email`,signOut:`/sign-out`,getSession:`/get-session`,forgetPassword:`/forget-password`,resetPassword:`/reset-password`,sendVerificationEmail:`/send-verification-email`,verifyEmail:`/verify-email`,twoFactorEnable:`/two-factor/enable`,twoFactorVerify:`/two-factor/verify`,passkeyRegister:`/passkey/register`,passkeyAuthenticate:`/passkey/authenticate`,magicLinkSend:`/magic-link/send`,magicLinkVerify:`/magic-link/verify`},fOe=h({signInEmail:h({method:m(`POST`),path:m(yY.signInEmail),description:m(`Sign in with email and password`)}),signUpEmail:h({method:m(`POST`),path:m(yY.signUpEmail),description:m(`Register new user with email and password`)}),signOut:h({method:m(`POST`),path:m(yY.signOut),description:m(`Sign out current user`)}),getSession:h({method:m(`GET`),path:m(yY.getSession),description:m(`Get current user session`)}),forgetPassword:h({method:m(`POST`),path:m(yY.forgetPassword),description:m(`Request password reset email`)}),resetPassword:h({method:m(`POST`),path:m(yY.resetPassword),description:m(`Reset password with token`)}),sendVerificationEmail:h({method:m(`POST`),path:m(yY.sendVerificationEmail),description:m(`Send email verification link`)}),verifyEmail:h({method:m(`GET`),path:m(yY.verifyEmail),description:m(`Verify email with token`)})}),pOe={login:yY.signInEmail,register:yY.signUpEmail,logout:yY.signOut,me:yY.getSession};function mOe(e,t){return`${e.replace(/\/$/,``)}${yY[t]}`}var hOe={"/login":yY.signInEmail,"/register":yY.signUpEmail,"/logout":yY.signOut,"/me":yY.getSession,"/refresh":yY.getSession},bY=h({id:r().describe(`Provider ID (e.g., google, github, microsoft)`),name:r().describe(`Display name (e.g., Google, GitHub)`),enabled:S().describe(`Whether this provider is enabled`)}),xY=h({enabled:S().describe(`Whether email/password auth is enabled`),disableSignUp:S().optional().describe(`Whether new user registration is disabled`),requireEmailVerification:S().optional().describe(`Whether email verification is required`)}),SY=h({twoFactor:S().default(!1).describe(`Two-factor authentication enabled`),passkeys:S().default(!1).describe(`Passkey/WebAuthn support enabled`),magicLink:S().default(!1).describe(`Magic link login enabled`),organization:S().default(!1).describe(`Multi-tenant organization support enabled`)}),gOe=h({emailPassword:xY.describe(`Email/password authentication config`),socialProviders:C(bY).describe(`Available social/OAuth providers`),features:SY.describe(`Enabled authentication features`)}),CY=h({filename:r().describe(`Original filename`),mimeType:r().describe(`File MIME type`),size:P().describe(`File size in bytes`),scope:r().default(`user`).describe(`Target storage scope (e.g. user, private, public)`),bucket:r().optional().describe(`Specific bucket override (admin only)`)}),wY=h({fileId:r().describe(`File ID returned from presigned request`),eTag:r().optional().describe(`S3 ETag verification`)}),TY=J.extend({data:h({uploadUrl:r().describe(`PUT/POST URL for direct upload`),downloadUrl:r().optional().describe(`Public/Private preview URL`),fileId:r().describe(`Temporary File ID`),method:E([`PUT`,`POST`]).describe(`HTTP Method to use`),headers:d(r(),r()).optional().describe(`Required headers for upload`),expiresIn:P().describe(`URL expiry in seconds`)})}),EY=J.extend({data:uL.describe(`Uploaded file metadata`)}),_Oe=h({mode:E([`whitelist`,`blacklist`]).describe(`whitelist = only allow listed types, blacklist = block listed types`),mimeTypes:C(r()).min(1).describe(`List of MIME types to allow or block (e.g., "image/jpeg", "application/pdf")`),extensions:C(r()).optional().describe(`List of file extensions to allow or block (e.g., ".jpg", ".pdf")`),maxFileSize:P().int().min(1).optional().describe(`Maximum file size in bytes`),minFileSize:P().int().min(0).optional().describe(`Minimum file size in bytes (e.g., reject empty files)`)}),DY=h({filename:r().describe(`Original filename`),mimeType:r().describe(`File MIME type`),totalSize:P().int().min(1).describe(`Total file size in bytes`),chunkSize:P().int().min(5242880).default(5242880).describe(`Size of each chunk in bytes (minimum 5MB per S3 spec)`),scope:r().default(`user`).describe(`Target storage scope`),bucket:r().optional().describe(`Specific bucket override (admin only)`),metadata:d(r(),r()).optional().describe(`Custom metadata key-value pairs`)}),OY=J.extend({data:h({uploadId:r().describe(`Multipart upload session ID`),resumeToken:r().describe(`Opaque token for resuming interrupted uploads`),fileId:r().describe(`Assigned file ID`),totalChunks:P().int().min(1).describe(`Expected number of chunks`),chunkSize:P().int().describe(`Chunk size in bytes`),expiresAt:r().datetime().describe(`Upload session expiration timestamp`)})}),kY=h({uploadId:r().describe(`Multipart upload session ID`),chunkIndex:P().int().min(0).describe(`Zero-based chunk index`),resumeToken:r().describe(`Resume token from initiate response`)}),AY=J.extend({data:h({chunkIndex:P().int().describe(`Chunk index that was uploaded`),eTag:r().describe(`Chunk ETag for multipart completion`),bytesReceived:P().int().describe(`Bytes received for this chunk`)})}),jY=h({uploadId:r().describe(`Multipart upload session ID`),parts:C(h({chunkIndex:P().int().describe(`Chunk index`),eTag:r().describe(`ETag returned from chunk upload`)})).min(1).describe(`Ordered list of uploaded parts for assembly`)}),MY=J.extend({data:h({fileId:r().describe(`Final file ID`),key:r().describe(`Storage key/path of the assembled file`),size:P().int().describe(`Total file size in bytes`),mimeType:r().describe(`File MIME type`),eTag:r().optional().describe(`Final ETag of the assembled file`),url:r().optional().describe(`Download URL for the assembled file`)})}),NY=J.extend({data:h({uploadId:r().describe(`Multipart upload session ID`),fileId:r().describe(`Assigned file ID`),filename:r().describe(`Original filename`),totalSize:P().int().describe(`Total file size in bytes`),uploadedSize:P().int().describe(`Bytes uploaded so far`),totalChunks:P().int().describe(`Total expected chunks`),uploadedChunks:P().int().describe(`Number of chunks uploaded`),percentComplete:P().min(0).max(100).describe(`Upload progress percentage`),status:E([`in_progress`,`completing`,`completed`,`failed`,`expired`]).describe(`Current upload session status`),startedAt:r().datetime().describe(`Upload session start timestamp`),expiresAt:r().datetime().describe(`Session expiration timestamp`)})}),vOe={getPresignedUrl:{method:`POST`,path:`/api/v1/storage/upload/presigned`,input:CY,output:TY},completeUpload:{method:`POST`,path:`/api/v1/storage/upload/complete`,input:wY,output:EY},initiateChunkedUpload:{method:`POST`,path:`/api/v1/storage/upload/chunked`,input:DY,output:OY},uploadChunk:{method:`PUT`,path:`/api/v1/storage/upload/chunked/:uploadId/chunk/:chunkIndex`,input:kY,output:AY},completeChunkedUpload:{method:`POST`,path:`/api/v1/storage/upload/chunked/:uploadId/complete`,input:jY,output:MY},getUploadProgress:{method:`GET`,path:`/api/v1/storage/upload/chunked/:uploadId/progress`,output:NY}},yOe=J.extend({data:gM.describe(`Full Object Schema`)}),bOe=J.extend({data:NP.describe(`Full App Configuration`)}),xOe=J.extend({data:C(h({name:r(),label:r(),icon:r().optional(),description:r().optional()})).describe(`List of available concepts (Objects, Apps, Flows)`)}),SOe=h({type:JV.describe(`Metadata type`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Item name (snake_case)`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Optional namespace`)}),COe=J.extend({data:h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),definition:d(r(),u()).describe(`Metadata definition payload`)}).describe(`Metadata item`)}),wOe=J.extend({data:C(d(r(),u())).describe(`Array of metadata definitions`)}),TOe=J.extend({data:C(r()).describe(`Array of metadata item names`)}),EOe=J.extend({data:h({exists:S().describe(`Whether the item exists`)})}),DOe=J.extend({data:h({type:r().describe(`Metadata type`),name:r().describe(`Deleted item name`)})}),OOe=XV.describe(`Metadata query with filtering, sorting, and pagination`),kOe=J.extend({data:ZV.describe(`Paginated query result`)}),AOe=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue on individual failure`),validate:S().default(!0).describe(`Validate before registering`)}),jOe=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`)})).min(1).describe(`Items to unregister`)}),MOe=J.extend({data:eH.describe(`Bulk operation result`)}),NOe=J.extend({data:BV.optional().describe(`Overlay definition, undefined if none`)}),POe=BV.describe(`Overlay to save`),FOe=J.extend({data:d(r(),u()).optional().describe(`Effective metadata with all overlays applied`)}),IOe=h({types:C(r()).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),format:E([`json`,`yaml`]).default(`json`).describe(`Export format`)}),LOe=J.extend({data:u().describe(`Exported metadata bundle`)}),ROe=h({data:u().describe(`Metadata bundle to import`),conflictResolution:E([`skip`,`overwrite`,`merge`]).default(`skip`).describe(`Conflict resolution strategy`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Dry run (no save)`)}),zOe=J.extend({data:h({total:P().int().min(0),imported:P().int().min(0),skipped:P().int().min(0),failed:P().int().min(0),errors:C(h({type:r(),name:r(),error:r()})).optional()}).describe(`Import result`)}),BOe=h({type:r().describe(`Metadata type to validate against`),data:u().describe(`Metadata payload to validate`)}),VOe=J.extend({data:QV.describe(`Validation result`)}),HOe=J.extend({data:C(r()).describe(`Registered metadata type identifiers`)}),UOe=J.extend({data:h({type:r().describe(`Metadata type identifier`),label:r().describe(`Display label`),description:r().optional().describe(`Description`),filePatterns:C(r()).describe(`File glob patterns`),supportsOverlay:S().describe(`Overlay support`),domain:r().describe(`Protocol domain`)}).optional().describe(`Type info`)}),WOe=J.extend({data:C(tH).describe(`Items this item depends on`)}),GOe=J.extend({data:C(tH).describe(`Items that depend on this item`)}),PY=h({prefix:r().regex(/^\//).describe(`URL path prefix for routing (e.g. /api/v1/data)`),service:yB.describe(`Target core service name`),authRequired:S().default(!0).describe(`Whether authentication is required`),criticality:bB.default(`optional`).describe(`Service criticality level for unavailability handling`),permissions:C(r()).optional().describe(`Required permissions for this route namespace`)}),KOe=h({routes:C(PY).describe(`Route-to-service mappings`),fallback:E([`404`,`proxy`,`custom`]).default(`404`).describe(`Behavior when no route matches`),proxyTarget:r().url().optional().describe(`Proxy target URL when fallback is "proxy"`)}),qOe=[{prefix:`/api/v1/discovery`,service:`metadata`,authRequired:!1,criticality:`required`},{prefix:`/api/v1/health`,service:`metadata`,authRequired:!1,criticality:`required`},{prefix:`/api/v1/meta`,service:`metadata`,criticality:`required`},{prefix:`/api/v1/data`,service:`data`,criticality:`required`},{prefix:`/api/v1/auth`,service:`auth`,criticality:`required`},{prefix:`/api/v1/packages`,service:`metadata`},{prefix:`/api/v1/ui`,service:`ui`},{prefix:`/api/v1/workflow`,service:`workflow`},{prefix:`/api/v1/analytics`,service:`analytics`},{prefix:`/api/v1/automation`,service:`automation`},{prefix:`/api/v1/storage`,service:`file-storage`},{prefix:`/api/v1/feed`,service:`data`},{prefix:`/api/v1/i18n`,service:`i18n`},{prefix:`/api/v1/notifications`,service:`notification`},{prefix:`/api/v1/realtime`,service:`realtime`},{prefix:`/api/v1/ai`,service:`ai`}],JOe=E([`404`,`405`,`501`,`503`]).describe(`404 = route not found, 405 = method not allowed, 501 = not implemented (stub), 503 = service unavailable`),YOe=h({success:m(!1),error:h({code:P().int().describe(`HTTP status code (404, 405, 501, 503, …)`),message:r().describe(`Human-readable error message`),type:E([`ROUTE_NOT_FOUND`,`METHOD_NOT_ALLOWED`,`NOT_IMPLEMENTED`,`SERVICE_UNAVAILABLE`]).optional().describe(`Machine-readable error type`),route:r().optional().describe(`Requested route path`),service:r().optional().describe(`Target service name, if resolvable`),hint:r().optional().describe(`Actionable hint for the developer (e.g., "Install plugin-workflow")`)})}),FY=E([`discovery`,`metadata`,`data`,`batch`,`permission`,`analytics`,`automation`,`workflow`,`ui`,`realtime`,`notification`,`ai`,`i18n`]),IY=E([`implemented`,`stub`,`planned`]),LY=h({method:NA.describe(`HTTP method for this endpoint`),path:r().describe(`URL path pattern (e.g., /api/v1/data/:object/:id)`),handler:r().describe(`Protocol method name or handler identifier`),category:FY.describe(`Route category`),public:S().default(!1).describe(`Is publicly accessible without authentication`),permissions:C(r()).optional().describe(`Required permissions (e.g., ["data.read", "object.account.read"])`),summary:r().optional().describe(`Short description for OpenAPI`),description:r().optional().describe(`Detailed description for OpenAPI`),tags:C(r()).optional().describe(`OpenAPI tags for grouping`),requestSchema:r().optional().describe(`Request schema name (for validation)`),responseSchema:r().optional().describe(`Response schema name (for documentation)`),timeout:P().int().optional().describe(`Request timeout in milliseconds`),rateLimit:r().optional().describe(`Rate limit policy name`),cacheable:S().default(!1).describe(`Whether response can be cached`),cacheTtl:P().int().optional().describe(`Cache TTL in seconds`),handlerStatus:IY.optional().describe(`Handler implementation status: implemented (default if omitted), stub, or planned`)}),RY=h({prefix:r().regex(/^\//).describe(`URL path prefix for this route group`),service:r().describe(`Core service name (metadata, data, auth, etc.)`),category:FY.describe(`Primary category for this route group`),methods:C(r()).optional().describe(`Protocol method names implemented`),endpoints:C(LY).optional().describe(`Endpoint definitions`),middleware:C(OL).optional().describe(`Middleware stack for this route group`),authRequired:S().default(!0).describe(`Whether authentication is required by default`),documentation:h({title:r().optional().describe(`Route group title`),description:r().optional().describe(`Route group description`),tags:C(r()).optional().describe(`OpenAPI tags`)}).optional().describe(`Documentation metadata for this route group`)}),zY=E([`strict`,`permissive`,`strip`]),BY=h({enabled:S().default(!0).describe(`Enable automatic request validation`),mode:zY.default(`strict`).describe(`How to handle validation errors`),validateBody:S().default(!0).describe(`Validate request body against schema`),validateQuery:S().default(!0).describe(`Validate query string parameters`),validateParams:S().default(!0).describe(`Validate URL path parameters`),validateHeaders:S().default(!1).describe(`Validate request headers`),includeFieldErrors:S().default(!0).describe(`Include field-level error details in response`),errorPrefix:r().optional().describe(`Custom prefix for validation error messages`),schemaRegistry:r().optional().describe(`Schema registry name to use for validation`)}),VY=h({enabled:S().default(!0).describe(`Enable automatic response envelope wrapping`),includeMetadata:S().default(!0).describe(`Include meta object in responses`),includeTimestamp:S().default(!0).describe(`Include timestamp in response metadata`),includeRequestId:S().default(!0).describe(`Include requestId in response metadata`),includeDuration:S().default(!1).describe(`Include request duration in ms`),includeTraceId:S().default(!1).describe(`Include distributed traceId`),customMetadata:d(r(),u()).optional().describe(`Additional metadata fields to include`),skipIfWrapped:S().default(!0).describe(`Skip wrapping if response already has success field`)}),HY=h({enabled:S().default(!0).describe(`Enable standardized error handling`),includeStackTrace:S().default(!1).describe(`Include stack traces in error responses`),logErrors:S().default(!0).describe(`Log errors to system logger`),exposeInternalErrors:S().default(!1).describe(`Expose internal error details in responses`),includeRequestId:S().default(!0).describe(`Include requestId in error responses`),includeTimestamp:S().default(!0).describe(`Include timestamp in error responses`),includeDocumentation:S().default(!0).describe(`Include documentation URLs for errors`),documentationBaseUrl:r().url().optional().describe(`Base URL for error documentation`),customErrorMessages:d(r(),r()).optional().describe(`Custom error messages by error code`),redactFields:C(r()).optional().describe(`Field names to redact from error details`)}),UY=h({enabled:S().default(!0).describe(`Enable automatic OpenAPI documentation generation`),version:E([`3.0.0`,`3.0.1`,`3.0.2`,`3.0.3`,`3.1.0`]).default(`3.0.3`).describe(`OpenAPI specification version`),title:r().default(`ObjectStack API`).describe(`API title`),description:r().optional().describe(`API description`),apiVersion:r().default(`1.0.0`).describe(`API version`),outputPath:r().default(`/api/docs/openapi.json`).describe(`URL path to serve OpenAPI JSON`),uiPath:r().default(`/api/docs`).describe(`URL path to serve documentation UI`),uiFramework:E([`swagger-ui`,`redoc`,`rapidoc`,`elements`]).default(`swagger-ui`).describe(`Documentation UI framework`),includeInternal:S().default(!1).describe(`Include internal endpoints in documentation`),generateSchemas:S().default(!0).describe(`Auto-generate schemas from Zod definitions`),includeExamples:S().default(!0).describe(`Include request/response examples`),servers:C(h({url:r().describe(`Server URL`),description:r().optional().describe(`Server description`)})).optional().describe(`Server URLs for API`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`API contact information`),license:h({name:r().describe(`License name`),url:r().url().optional().describe(`License URL`)}).optional().describe(`API license information`),securitySchemes:d(r(),h({type:E([`apiKey`,`http`,`oauth2`,`openIdConnect`]),scheme:r().optional(),bearerFormat:r().optional()})).optional().describe(`Security scheme definitions`)}),WY=h({enabled:S().default(!0).describe(`Enable REST API plugin`),basePath:r().default(`/api`).describe(`Base path for all API routes`),version:r().default(`v1`).describe(`API version identifier`),routes:C(RY).describe(`Route registrations`),validation:BY.optional().describe(`Request validation configuration`),responseEnvelope:VY.optional().describe(`Response envelope configuration`),errorHandling:HY.optional().describe(`Error handling configuration`),openApi:UY.optional().describe(`OpenAPI documentation configuration`),globalMiddleware:C(OL).optional().describe(`Global middleware stack`),cors:h({enabled:S().default(!0),origins:C(r()).optional(),methods:C(NA).optional(),credentials:S().default(!0)}).optional().describe(`CORS configuration`),performance:h({enableCompression:S().default(!0).describe(`Enable response compression`),enableETag:S().default(!0).describe(`Enable ETag generation`),enableCaching:S().default(!0).describe(`Enable HTTP caching`),defaultCacheTtl:P().int().default(300).describe(`Default cache TTL in seconds`)}).optional().describe(`Performance optimization settings`)}),XOe={prefix:`/api/v1/discovery`,service:`metadata`,category:`discovery`,methods:[`getDiscovery`],authRequired:!1,endpoints:[{method:`GET`,path:``,handler:`getDiscovery`,category:`discovery`,public:!0,summary:`Get API discovery information`,description:`Returns API version, capabilities, and available routes`,tags:[`Discovery`],responseSchema:`GetDiscoveryResponseSchema`,cacheable:!0,cacheTtl:3600}],middleware:[{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},GY={prefix:`/api/v1/meta`,service:`metadata`,category:`metadata`,methods:[`getMetaTypes`,`getMetaItems`,`getMetaItem`,`saveMetaItem`],authRequired:!0,endpoints:[{method:`GET`,path:``,handler:`getMetaTypes`,category:`metadata`,public:!1,summary:`List all metadata types`,description:`Returns available metadata types (object, field, view, etc.)`,tags:[`Metadata`],responseSchema:`GetMetaTypesResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`GET`,path:`/:type`,handler:`getMetaItems`,category:`metadata`,public:!1,summary:`List metadata items of a type`,description:`Returns all items of the specified metadata type`,tags:[`Metadata`],responseSchema:`GetMetaItemsResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`GET`,path:`/:type/:name`,handler:`getMetaItem`,category:`metadata`,public:!1,summary:`Get specific metadata item`,description:`Returns a specific metadata item by type and name`,tags:[`Metadata`],requestSchema:`GetMetaItemRequestSchema`,responseSchema:`GetMetaItemResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`PUT`,path:`/:type/:name`,handler:`saveMetaItem`,category:`metadata`,public:!1,summary:`Create or update metadata item`,description:`Creates or updates a metadata item`,tags:[`Metadata`],requestSchema:`SaveMetaItemRequestSchema`,responseSchema:`SaveMetaItemResponseSchema`,permissions:[`metadata.write`],cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},KY={prefix:`/api/v1/data`,service:`data`,category:`data`,methods:[`findData`,`getData`,`createData`,`updateData`,`deleteData`],authRequired:!0,endpoints:[{method:`GET`,path:`/:object`,handler:`findData`,category:`data`,public:!1,summary:`Query records`,description:`Query records with filtering, sorting, and pagination`,tags:[`Data`],requestSchema:`FindDataRequestSchema`,responseSchema:`ListRecordResponseSchema`,permissions:[`data.read`],cacheable:!1},{method:`GET`,path:`/:object/:id`,handler:`getData`,category:`data`,public:!1,summary:`Get record by ID`,description:`Retrieve a single record by its ID`,tags:[`Data`],requestSchema:`IdRequestSchema`,responseSchema:`SingleRecordResponseSchema`,permissions:[`data.read`],cacheable:!1},{method:`POST`,path:`/:object`,handler:`createData`,category:`data`,public:!1,summary:`Create record`,description:`Create a new record`,tags:[`Data`],requestSchema:`CreateRequestSchema`,responseSchema:`SingleRecordResponseSchema`,permissions:[`data.create`],cacheable:!1},{method:`PATCH`,path:`/:object/:id`,handler:`updateData`,category:`data`,public:!1,summary:`Update record`,description:`Update an existing record`,tags:[`Data`],requestSchema:`UpdateRequestSchema`,responseSchema:`SingleRecordResponseSchema`,permissions:[`data.update`],cacheable:!1},{method:`DELETE`,path:`/:object/:id`,handler:`deleteData`,category:`data`,public:!1,summary:`Delete record`,description:`Delete a record by ID`,tags:[`Data`],requestSchema:`IdRequestSchema`,responseSchema:`DeleteResponseSchema`,permissions:[`data.delete`],cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},qY={prefix:`/api/v1/data/:object`,service:`data`,category:`batch`,methods:[`batchData`,`createManyData`,`updateManyData`,`deleteManyData`],authRequired:!0,endpoints:[{method:`POST`,path:`/batch`,handler:`batchData`,category:`batch`,public:!1,summary:`Batch operation`,description:`Execute a batch operation (create, update, upsert, delete)`,tags:[`Batch`],requestSchema:`BatchUpdateRequestSchema`,responseSchema:`BatchUpdateResponseSchema`,permissions:[`data.batch`],timeout:6e4,cacheable:!1},{method:`POST`,path:`/createMany`,handler:`createManyData`,category:`batch`,public:!1,summary:`Batch create`,description:`Create multiple records in a single operation`,tags:[`Batch`],requestSchema:`CreateManyRequestSchema`,responseSchema:`BatchUpdateResponseSchema`,permissions:[`data.create`,`data.batch`],timeout:6e4,cacheable:!1},{method:`POST`,path:`/updateMany`,handler:`updateManyData`,category:`batch`,public:!1,summary:`Batch update`,description:`Update multiple records in a single operation`,tags:[`Batch`],requestSchema:`UpdateManyRequestSchema`,responseSchema:`BatchUpdateResponseSchema`,permissions:[`data.update`,`data.batch`],timeout:6e4,cacheable:!1},{method:`POST`,path:`/deleteMany`,handler:`deleteManyData`,category:`batch`,public:!1,summary:`Batch delete`,description:`Delete multiple records in a single operation`,tags:[`Batch`],requestSchema:`DeleteManyRequestSchema`,responseSchema:`BatchUpdateResponseSchema`,permissions:[`data.delete`,`data.batch`],timeout:6e4,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},JY={prefix:`/api/v1/auth`,service:`auth`,category:`permission`,methods:[`checkPermission`,`getObjectPermissions`,`getEffectivePermissions`],authRequired:!0,endpoints:[{method:`POST`,path:`/check`,handler:`checkPermission`,category:`permission`,public:!1,summary:`Check permission`,description:`Check if current user has a specific permission`,tags:[`Permission`],requestSchema:`CheckPermissionRequestSchema`,responseSchema:`CheckPermissionResponseSchema`,cacheable:!1},{method:`GET`,path:`/permissions/:object`,handler:`getObjectPermissions`,category:`permission`,public:!1,summary:`Get object permissions`,description:`Get all permissions for a specific object`,tags:[`Permission`],responseSchema:`ObjectPermissionsResponseSchema`,cacheable:!0,cacheTtl:300},{method:`GET`,path:`/permissions/effective`,handler:`getEffectivePermissions`,category:`permission`,public:!1,summary:`Get effective permissions`,description:`Get all effective permissions for current user`,tags:[`Permission`],responseSchema:`EffectivePermissionsResponseSchema`,cacheable:!0,cacheTtl:300}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},YY={prefix:`/api/v1/ui`,service:`ui`,category:`ui`,methods:[`listViews`,`getView`,`createView`,`updateView`,`deleteView`],authRequired:!0,endpoints:[{method:`GET`,path:`/views/:object`,handler:`listViews`,category:`ui`,public:!1,summary:`List views for an object`,description:`Returns all views (list, form) for the specified object`,tags:[`Views`,`UI`],responseSchema:`ListViewsResponseSchema`,cacheable:!0,cacheTtl:1800},{method:`GET`,path:`/views/:object/:viewId`,handler:`getView`,category:`ui`,public:!1,summary:`Get a specific view`,description:`Returns a specific view definition by object and view ID`,tags:[`Views`,`UI`],responseSchema:`GetViewResponseSchema`,cacheable:!0,cacheTtl:1800},{method:`POST`,path:`/views/:object`,handler:`createView`,category:`ui`,public:!1,summary:`Create a new view`,description:`Creates a new view definition for the specified object`,tags:[`Views`,`UI`],requestSchema:`CreateViewRequestSchema`,responseSchema:`CreateViewResponseSchema`,permissions:[`ui.view.create`],cacheable:!1},{method:`PATCH`,path:`/views/:object/:viewId`,handler:`updateView`,category:`ui`,public:!1,summary:`Update a view`,description:`Updates an existing view definition`,tags:[`Views`,`UI`],requestSchema:`UpdateViewRequestSchema`,responseSchema:`UpdateViewResponseSchema`,permissions:[`ui.view.update`],cacheable:!1},{method:`DELETE`,path:`/views/:object/:viewId`,handler:`deleteView`,category:`ui`,public:!1,summary:`Delete a view`,description:`Deletes a view definition`,tags:[`Views`,`UI`],responseSchema:`DeleteViewResponseSchema`,permissions:[`ui.view.delete`],cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},XY={prefix:`/api/v1/workflow`,service:`workflow`,category:`workflow`,methods:[`getWorkflowConfig`,`getWorkflowState`,`workflowTransition`,`workflowApprove`,`workflowReject`],authRequired:!0,endpoints:[{method:`GET`,path:`/:object/config`,handler:`getWorkflowConfig`,category:`workflow`,public:!1,summary:`Get workflow configuration`,description:`Returns workflow rules and state machine configuration for an object`,tags:[`Workflow`],responseSchema:`GetWorkflowConfigResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`GET`,path:`/:object/:recordId/state`,handler:`getWorkflowState`,category:`workflow`,public:!1,summary:`Get workflow state`,description:`Returns current workflow state and available transitions for a record`,tags:[`Workflow`],responseSchema:`GetWorkflowStateResponseSchema`,cacheable:!1},{method:`POST`,path:`/:object/:recordId/transition`,handler:`workflowTransition`,category:`workflow`,public:!1,summary:`Execute workflow transition`,description:`Transitions a record to a new workflow state`,tags:[`Workflow`],requestSchema:`WorkflowTransitionRequestSchema`,responseSchema:`WorkflowTransitionResponseSchema`,permissions:[`workflow.transition`],cacheable:!1},{method:`POST`,path:`/:object/:recordId/approve`,handler:`workflowApprove`,category:`workflow`,public:!1,summary:`Approve workflow step`,description:`Approves a pending workflow approval step`,tags:[`Workflow`],requestSchema:`WorkflowApproveRequestSchema`,responseSchema:`WorkflowApproveResponseSchema`,permissions:[`workflow.approve`],cacheable:!1},{method:`POST`,path:`/:object/:recordId/reject`,handler:`workflowReject`,category:`workflow`,public:!1,summary:`Reject workflow step`,description:`Rejects a pending workflow approval step`,tags:[`Workflow`],requestSchema:`WorkflowRejectRequestSchema`,responseSchema:`WorkflowRejectResponseSchema`,permissions:[`workflow.reject`],cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},ZY={prefix:`/api/v1/realtime`,service:`realtime`,category:`realtime`,methods:[`realtimeConnect`,`realtimeDisconnect`,`realtimeSubscribe`,`realtimeUnsubscribe`,`setPresence`,`getPresence`],authRequired:!0,endpoints:[{method:`POST`,path:`/connect`,handler:`realtimeConnect`,category:`realtime`,public:!1,summary:`Establish realtime connection`,description:`Negotiates a realtime connection (WebSocket/SSE) and returns connection details`,tags:[`Realtime`],requestSchema:`RealtimeConnectRequestSchema`,responseSchema:`RealtimeConnectResponseSchema`,cacheable:!1},{method:`POST`,path:`/disconnect`,handler:`realtimeDisconnect`,category:`realtime`,public:!1,summary:`Close realtime connection`,description:`Closes an active realtime connection`,tags:[`Realtime`],requestSchema:`RealtimeDisconnectRequestSchema`,responseSchema:`RealtimeDisconnectResponseSchema`,cacheable:!1},{method:`POST`,path:`/subscribe`,handler:`realtimeSubscribe`,category:`realtime`,public:!1,summary:`Subscribe to channel`,description:`Subscribes to a realtime channel for receiving events`,tags:[`Realtime`],requestSchema:`RealtimeSubscribeRequestSchema`,responseSchema:`RealtimeSubscribeResponseSchema`,cacheable:!1},{method:`POST`,path:`/unsubscribe`,handler:`realtimeUnsubscribe`,category:`realtime`,public:!1,summary:`Unsubscribe from channel`,description:`Unsubscribes from a realtime channel`,tags:[`Realtime`],requestSchema:`RealtimeUnsubscribeRequestSchema`,responseSchema:`RealtimeUnsubscribeResponseSchema`,cacheable:!1},{method:`PUT`,path:`/presence/:channel`,handler:`setPresence`,category:`realtime`,public:!1,summary:`Set presence state`,description:`Sets the current user's presence state in a channel`,tags:[`Realtime`],requestSchema:`SetPresenceRequestSchema`,responseSchema:`SetPresenceResponseSchema`,cacheable:!1},{method:`GET`,path:`/presence/:channel`,handler:`getPresence`,category:`realtime`,public:!1,summary:`Get channel presence`,description:`Returns all active members and their presence state in a channel`,tags:[`Realtime`],responseSchema:`GetPresenceResponseSchema`,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},QY={prefix:`/api/v1/notifications`,service:`notification`,category:`notification`,methods:[`registerDevice`,`unregisterDevice`,`getNotificationPreferences`,`updateNotificationPreferences`,`listNotifications`,`markNotificationsRead`,`markAllNotificationsRead`],authRequired:!0,endpoints:[{method:`POST`,path:`/devices`,handler:`registerDevice`,category:`notification`,public:!1,summary:`Register device for push notifications`,description:`Registers a device token for receiving push notifications`,tags:[`Notifications`],requestSchema:`RegisterDeviceRequestSchema`,responseSchema:`RegisterDeviceResponseSchema`,cacheable:!1},{method:`DELETE`,path:`/devices/:deviceId`,handler:`unregisterDevice`,category:`notification`,public:!1,summary:`Unregister device`,description:`Removes a device from push notification registration`,tags:[`Notifications`],responseSchema:`UnregisterDeviceResponseSchema`,cacheable:!1},{method:`GET`,path:`/preferences`,handler:`getNotificationPreferences`,category:`notification`,public:!1,summary:`Get notification preferences`,description:`Returns current user notification preferences`,tags:[`Notifications`],responseSchema:`GetNotificationPreferencesResponseSchema`,cacheable:!1},{method:`PATCH`,path:`/preferences`,handler:`updateNotificationPreferences`,category:`notification`,public:!1,summary:`Update notification preferences`,description:`Updates user notification preferences`,tags:[`Notifications`],requestSchema:`UpdateNotificationPreferencesRequestSchema`,responseSchema:`UpdateNotificationPreferencesResponseSchema`,cacheable:!1},{method:`GET`,path:``,handler:`listNotifications`,category:`notification`,public:!1,summary:`List notifications`,description:`Returns paginated list of notifications for the current user`,tags:[`Notifications`],responseSchema:`ListNotificationsResponseSchema`,cacheable:!1},{method:`POST`,path:`/read`,handler:`markNotificationsRead`,category:`notification`,public:!1,summary:`Mark notifications as read`,description:`Marks specific notifications as read by their IDs`,tags:[`Notifications`],requestSchema:`MarkNotificationsReadRequestSchema`,responseSchema:`MarkNotificationsReadResponseSchema`,cacheable:!1},{method:`POST`,path:`/read/all`,handler:`markAllNotificationsRead`,category:`notification`,public:!1,summary:`Mark all notifications as read`,description:`Marks all notifications as read for the current user`,tags:[`Notifications`],responseSchema:`MarkAllNotificationsReadResponseSchema`,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},$Y={prefix:`/api/v1/ai`,service:`ai`,category:`ai`,methods:[`aiNlq`,`aiSuggest`,`aiInsights`],authRequired:!0,endpoints:[{method:`POST`,path:`/nlq`,handler:`aiNlq`,category:`ai`,public:!1,summary:`Natural language query`,description:`Converts a natural language query to a structured query AST`,tags:[`AI`],requestSchema:`AiNlqRequestSchema`,responseSchema:`AiNlqResponseSchema`,timeout:3e4,cacheable:!1},{method:`POST`,path:`/suggest`,handler:`aiSuggest`,category:`ai`,public:!1,summary:`Get AI-powered suggestions`,description:`Returns AI-generated field value suggestions based on context`,tags:[`AI`],requestSchema:`AiSuggestRequestSchema`,responseSchema:`AiSuggestResponseSchema`,timeout:15e3,cacheable:!1},{method:`POST`,path:`/insights`,handler:`aiInsights`,category:`ai`,public:!1,summary:`Get AI-generated insights`,description:`Returns AI-generated insights (summaries, trends, anomalies, recommendations)`,tags:[`AI`],requestSchema:`AiInsightsRequestSchema`,responseSchema:`AiInsightsResponseSchema`,timeout:6e4,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},eX={prefix:`/api/v1/i18n`,service:`i18n`,category:`i18n`,methods:[`getLocales`,`getTranslations`,`getFieldLabels`],authRequired:!0,endpoints:[{method:`GET`,path:`/locales`,handler:`getLocales`,category:`i18n`,public:!1,summary:`Get available locales`,description:`Returns all available locales with their metadata`,tags:[`i18n`],responseSchema:`GetLocalesResponseSchema`,cacheable:!0,cacheTtl:86400},{method:`GET`,path:`/translations/:locale`,handler:`getTranslations`,category:`i18n`,public:!1,summary:`Get translations for a locale`,description:`Returns translation strings for the specified locale and optional namespace`,tags:[`i18n`],responseSchema:`GetTranslationsResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`GET`,path:`/labels/:object/:locale`,handler:`getFieldLabels`,category:`i18n`,public:!1,summary:`Get translated field labels`,description:`Returns translated field labels, help text, and option labels for an object`,tags:[`i18n`],responseSchema:`GetFieldLabelsResponseSchema`,cacheable:!0,cacheTtl:3600}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},tX={prefix:`/api/v1/analytics`,service:`analytics`,category:`analytics`,methods:[`analyticsQuery`,`getAnalyticsMeta`],authRequired:!0,endpoints:[{method:`POST`,path:`/query`,handler:`analyticsQuery`,category:`analytics`,public:!1,summary:`Execute analytics query`,description:`Executes a structured analytics query against the semantic layer`,tags:[`Analytics`],requestSchema:`AnalyticsQueryRequestSchema`,responseSchema:`AnalyticsResultResponseSchema`,permissions:[`analytics.query`],timeout:12e4,cacheable:!1},{method:`GET`,path:`/meta`,handler:`getAnalyticsMeta`,category:`analytics`,public:!1,summary:`Get analytics metadata`,description:`Returns available cubes, dimensions, measures, and segments`,tags:[`Analytics`],responseSchema:`AnalyticsMetadataResponseSchema`,cacheable:!0,cacheTtl:3600}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},nX={prefix:`/api/v1/automation`,service:`automation`,category:`automation`,methods:[`triggerAutomation`],authRequired:!0,endpoints:[{method:`POST`,path:`/trigger`,handler:`triggerAutomation`,category:`automation`,public:!1,summary:`Trigger automation`,description:`Triggers an automation flow or script by name`,tags:[`Automation`],requestSchema:`AutomationTriggerRequestSchema`,responseSchema:`AutomationTriggerResponseSchema`,permissions:[`automation.trigger`],timeout:12e4,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},ZOe=Object.assign(WY,{create:e=>e}),QOe=Object.assign(RY,{create:e=>e});function $Oe(){return[XOe,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX]}var rX=h({path:r().describe(`Full URL path (e.g. /api/v1/analytics/query)`),method:NA.describe(`HTTP method (GET, POST, etc.)`),category:FY.describe(`Route category`),handlerStatus:IY.describe(`Handler status`),service:r().describe(`Target service name`),healthCheckPassed:S().optional().describe(`Whether the health check probe succeeded`)}),eke=h({timestamp:r().describe(`ISO 8601 timestamp`),adapter:r().describe(`Adapter name (e.g. "hono", "express", "nextjs")`),summary:h({total:P().int().describe(`Total declared endpoints`),implemented:P().int().describe(`Endpoints with real handlers`),stub:P().int().describe(`Endpoints with stub handlers (501)`),planned:P().int().describe(`Endpoints not yet implemented`)}),entries:C(rX).describe(`Per-endpoint coverage entries`)}),tke=E([`rest`,`graphql`,`odata`]),iX=h({operator:r().describe(`Unified DSL operator`),rest:r().optional().describe(`REST query parameter template`),graphql:r().optional().describe(`GraphQL where clause template`),odata:r().optional().describe(`OData $filter expression template`)}),aX=h({filterStyle:E([`bracket`,`dot`,`flat`,`rsql`]).default(`bracket`).describe(`REST filter parameter encoding style`),pagination:h({limitParam:r().default(`limit`).describe(`Page size parameter name`),offsetParam:r().default(`offset`).describe(`Offset parameter name`),cursorParam:r().default(`cursor`).describe(`Cursor parameter name`),pageParam:r().default(`page`).describe(`Page number parameter name`)}).optional().describe(`Pagination parameter name mappings`),sorting:h({param:r().default(`sort`).describe(`Sort parameter name`),format:E([`comma`,`array`,`pipe`]).default(`comma`).describe(`Sort parameter encoding format`)}).optional().describe(`Sort parameter mapping`),fieldsParam:r().default(`fields`).describe(`Field selection parameter name`)}),oX=h({filterArgName:r().default(`where`).describe(`GraphQL filter argument name`),filterStyle:E([`nested`,`flat`,`array`]).default(`nested`).describe(`GraphQL filter nesting style`),pagination:h({limitArg:r().default(`limit`).describe(`Page size argument name`),offsetArg:r().default(`offset`).describe(`Offset argument name`),firstArg:r().default(`first`).describe(`Relay "first" argument name`),afterArg:r().default(`after`).describe(`Relay "after" cursor argument name`)}).optional().describe(`Pagination argument name mappings`),sorting:h({argName:r().default(`orderBy`).describe(`Sort argument name`),format:E([`enum`,`array`]).default(`enum`).describe(`Sort argument format`)}).optional().describe(`Sort argument mapping`)}),sX=h({version:E([`v2`,`v4`]).default(`v4`).describe(`OData version`),usePrefix:S().default(!0).describe(`Use $ prefix for system query options ($filter vs filter)`),stringFunctions:C(E([`contains`,`startswith`,`endswith`,`tolower`,`toupper`,`trim`,`concat`,`substring`,`length`])).optional().describe(`Supported OData string functions`),expand:h({enabled:S().default(!0).describe(`Enable $expand support`),maxDepth:P().int().min(1).default(3).describe(`Maximum expand depth`)}).optional().describe(`$expand configuration`)}),nke=h({operatorMappings:C(iX).optional().describe(`Custom operator mappings`),rest:aX.optional().describe(`REST query adapter configuration`),graphql:oX.optional().describe(`GraphQL query adapter configuration`),odata:sX.optional().describe(`OData query adapter configuration`)}),cX=h({object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID`)}),lX=cX.extend({feedId:r().describe(`Feed item ID`)}),uX=E([`all`,`comments_only`,`changes_only`,`tasks_only`]),dX=cX.extend({type:uX.default(`all`).describe(`Filter by feed item category`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of items to return`),cursor:r().optional().describe(`Cursor for pagination (opaque string from previous response)`)}),fX=J.extend({data:h({items:C(LN).describe(`Feed items in reverse chronological order`),total:P().int().optional().describe(`Total feed items matching filter`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more items are available`)})}),pX=cX.extend({type:jN.describe(`Type of feed item to create`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(MN).optional().describe(`Mentioned users, teams, or records`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),visibility:IN.default(`public`).describe(`Visibility: public, internal, or private`)}),mX=J.extend({data:LN.describe(`The created feed item`)}),hX=lX.extend({body:r().optional().describe(`Updated rich text body`),mentions:C(MN).optional().describe(`Updated mentions`),visibility:IN.optional().describe(`Updated visibility`)}),gX=J.extend({data:LN.describe(`The updated feed item`)}),_X=lX,vX=J.extend({data:h({feedId:r().describe(`ID of the deleted feed item`)})}),yX=lX.extend({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`)}),bX=J.extend({data:h({reactions:C(PN).describe(`Updated reaction list for the feed item`)})}),xX=lX.extend({emoji:r().describe(`Emoji character or shortcode to remove`)}),SX=J.extend({data:h({reactions:C(PN).describe(`Updated reaction list for the feed item`)})}),CX=lX,wX=J.extend({data:h({feedId:r().describe(`ID of the pinned feed item`),pinned:S().describe(`Whether the item is now pinned`),pinnedAt:r().datetime().describe(`Timestamp when pinned`)})}),TX=lX,EX=J.extend({data:h({feedId:r().describe(`ID of the unpinned feed item`),pinned:S().describe(`Whether the item is now pinned (should be false)`)})}),DX=lX,OX=J.extend({data:h({feedId:r().describe(`ID of the starred feed item`),starred:S().describe(`Whether the item is now starred`),starredAt:r().datetime().describe(`Timestamp when starred`)})}),kX=lX,AX=J.extend({data:h({feedId:r().describe(`ID of the unstarred feed item`),starred:S().describe(`Whether the item is now starred (should be false)`)})}),jX=cX.extend({query:r().min(1).describe(`Full-text search query against feed body content`),type:uX.optional().describe(`Filter by feed item category`),actorId:r().optional().describe(`Filter by actor user ID`),dateFrom:r().datetime().optional().describe(`Filter feed items created after this timestamp`),dateTo:r().datetime().optional().describe(`Filter feed items created before this timestamp`),hasAttachments:S().optional().describe(`Filter for items with file attachments`),pinnedOnly:S().optional().describe(`Return only pinned items`),starredOnly:S().optional().describe(`Return only starred items`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of items to return`),cursor:r().optional().describe(`Cursor for pagination`)}),MX=J.extend({data:h({items:C(LN).describe(`Matching feed items sorted by relevance`),total:P().int().optional().describe(`Total matching items`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more items are available`)})}),NX=cX.extend({field:r().optional().describe(`Filter changelog to a specific field name`),actorId:r().optional().describe(`Filter changelog by actor user ID`),dateFrom:r().datetime().optional().describe(`Filter changes after this timestamp`),dateTo:r().datetime().optional().describe(`Filter changes before this timestamp`),limit:P().int().min(1).max(200).default(50).describe(`Maximum number of changelog entries to return`),cursor:r().optional().describe(`Cursor for pagination`)}),PX=h({id:r().describe(`Changelog entry ID`),object:r().describe(`Object name`),recordId:r().describe(`Record ID`),actor:h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`)}).describe(`Who made the change`),changes:C(NN).min(1).describe(`Field-level changes`),timestamp:r().datetime().describe(`When the change occurred`),source:r().optional().describe(`Change source (e.g., "API", "UI", "automation")`)}),FX=J.extend({data:h({entries:C(PX).describe(`Changelog entries in reverse chronological order`),total:P().int().optional().describe(`Total changelog entries matching filter`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more entries are available`)})}),IX=cX.extend({events:C(zN).default([`all`]).describe(`Event types to subscribe to`),channels:C(BN).default([`in_app`]).describe(`Notification delivery channels`)}),LX=J.extend({data:VN.describe(`The created or updated subscription`)}),RX=cX,zX=J.extend({data:h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),unsubscribed:S().describe(`Whether the user was unsubscribed`)})}),rke=E([`feed_item_not_found`,`feed_permission_denied`,`feed_item_not_editable`,`feed_invalid_parent`,`reaction_already_exists`,`reaction_not_found`,`subscription_already_exists`,`subscription_not_found`,`invalid_feed_type`,`feed_already_pinned`,`feed_not_pinned`,`feed_already_starred`,`feed_not_starred`,`feed_search_query_too_short`]),ike={listFeed:{method:`GET`,path:`/api/data/:object/:recordId/feed`,input:dX,output:fX},createFeedItem:{method:`POST`,path:`/api/data/:object/:recordId/feed`,input:pX,output:mX},updateFeedItem:{method:`PUT`,path:`/api/data/:object/:recordId/feed/:feedId`,input:hX,output:gX},deleteFeedItem:{method:`DELETE`,path:`/api/data/:object/:recordId/feed/:feedId`,input:_X,output:vX},addReaction:{method:`POST`,path:`/api/data/:object/:recordId/feed/:feedId/reactions`,input:yX,output:bX},removeReaction:{method:`DELETE`,path:`/api/data/:object/:recordId/feed/:feedId/reactions/:emoji`,input:xX,output:SX},pinFeedItem:{method:`POST`,path:`/api/data/:object/:recordId/feed/:feedId/pin`,input:CX,output:wX},unpinFeedItem:{method:`DELETE`,path:`/api/data/:object/:recordId/feed/:feedId/pin`,input:TX,output:EX},starFeedItem:{method:`POST`,path:`/api/data/:object/:recordId/feed/:feedId/star`,input:DX,output:OX},unstarFeedItem:{method:`DELETE`,path:`/api/data/:object/:recordId/feed/:feedId/star`,input:kX,output:AX},searchFeed:{method:`GET`,path:`/api/data/:object/:recordId/feed/search`,input:jX,output:MX},getChangelog:{method:`GET`,path:`/api/data/:object/:recordId/changelog`,input:NX,output:FX},subscribe:{method:`POST`,path:`/api/data/:object/:recordId/subscribe`,input:IX,output:LX},unsubscribe:{method:`DELETE`,path:`/api/data/:object/:recordId/subscribe`,input:RX,output:zX}},BX=E([`csv`,`json`,`jsonl`,`xlsx`,`parquet`]),VX=E([`pending`,`processing`,`completed`,`failed`,`cancelled`,`expired`]),HX=h({object:r().describe(`Object name to export`),format:BX.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Specific fields to include (omit for all fields)`),filter:d(r(),u()).optional().describe(`Filter criteria for records to export`),sort:C(h({field:r().describe(`Field name to sort by`),direction:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`)})).optional().describe(`Sort order for exported records`),limit:P().int().min(1).optional().describe(`Maximum number of records to export`),includeHeaders:S().default(!0).describe(`Include header row (CSV/XLSX)`),encoding:r().default(`utf-8`).describe(`Character encoding for the export file`),templateId:r().optional().describe(`Export template ID for predefined field mappings`)}),UX=J.extend({data:h({jobId:r().describe(`Export job ID`),status:VX.describe(`Initial job status`),estimatedRecords:P().int().optional().describe(`Estimated total records`),createdAt:r().datetime().describe(`Job creation timestamp`)})}),WX=J.extend({data:h({jobId:r().describe(`Export job ID`),status:VX.describe(`Current job status`),format:BX.describe(`Export format`),totalRecords:P().int().optional().describe(`Total records to export`),processedRecords:P().int().describe(`Records processed so far`),percentComplete:P().min(0).max(100).describe(`Export progress percentage`),fileSize:P().int().optional().describe(`Current file size in bytes`),downloadUrl:r().optional().describe(`Presigned download URL (available when status is "completed")`),downloadExpiresAt:r().datetime().optional().describe(`Download URL expiration timestamp`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`)}).optional().describe(`Error details if job failed`),startedAt:r().datetime().optional().describe(`Processing start timestamp`),completedAt:r().datetime().optional().describe(`Completion timestamp`)})}),GX=E([`strict`,`lenient`,`dry_run`]),KX=E([`skip`,`update`,`create_new`,`fail`]),ake=h({mode:GX.default(`strict`).describe(`Validation mode for the import`),deduplication:h({strategy:KX.default(`skip`).describe(`How to handle duplicate records`),matchFields:C(r()).min(1).describe(`Fields used to identify duplicates (e.g., "email", "external_id")`)}).optional().describe(`Deduplication configuration`),maxErrors:P().int().min(1).default(100).describe(`Maximum validation errors before aborting`),trimWhitespace:S().default(!0).describe(`Trim leading/trailing whitespace from string fields`),dateFormat:r().optional().describe(`Expected date format in import data (e.g., "YYYY-MM-DD")`),nullValues:C(r()).optional().describe(`Strings to treat as null (e.g., ["", "N/A", "null"])`)}),oke=J.extend({data:h({totalRecords:P().int().describe(`Total records in import file`),validRecords:P().int().describe(`Records that passed validation`),invalidRecords:P().int().describe(`Records that failed validation`),duplicateRecords:P().int().describe(`Duplicate records detected`),errors:C(h({row:P().int().describe(`Row number in the import file`),field:r().optional().describe(`Field that failed validation`),code:r().describe(`Validation error code`),message:r().describe(`Validation error message`)})).describe(`List of validation errors`),preview:C(d(r(),u())).optional().describe(`Preview of first N valid records (for dry_run mode)`)})}),qX=h({sourceField:r().describe(`Field name in the source data (import) or object (export)`),targetField:r().describe(`Field name in the target object (import) or file column (export)`),targetLabel:r().optional().describe(`Display label for the target column (export)`),transform:E([`none`,`uppercase`,`lowercase`,`trim`,`date_format`,`lookup`]).default(`none`).describe(`Transformation to apply during mapping`),defaultValue:u().optional().describe(`Default value if source field is null/empty`),required:S().default(!1).describe(`Whether this field is required (import validation)`)}),ske=h({id:r().optional().describe(`Template ID (generated on save)`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template machine name (snake_case)`),label:r().describe(`Human-readable template label`),description:r().optional().describe(`Template description`),object:r().describe(`Target object name`),direction:E([`import`,`export`,`bidirectional`]).describe(`Template direction`),format:BX.optional().describe(`Default file format for this template`),mappings:C(qX).min(1).describe(`Field mapping entries`),createdAt:r().datetime().optional().describe(`Template creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the template`)}),cke=h({id:r().optional().describe(`Scheduled export ID`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Schedule name (snake_case)`),label:r().optional().describe(`Human-readable label`),object:r().describe(`Object name to export`),format:BX.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Fields to include`),filter:d(r(),u()).optional().describe(`Record filter criteria`),templateId:r().optional().describe(`Export template ID for field mappings`),schedule:h({cronExpression:r().describe(`Cron expression for schedule`),timezone:r().default(`UTC`).describe(`IANA timezone`)}).describe(`Schedule timing configuration`),delivery:h({method:E([`email`,`storage`,`webhook`]).describe(`How to deliver the export file`),recipients:C(r()).optional().describe(`Email recipients (for email delivery)`),storagePath:r().optional().describe(`Storage path (for storage delivery)`),webhookUrl:r().optional().describe(`Webhook URL (for webhook delivery)`)}).describe(`Export delivery configuration`),enabled:S().default(!0).describe(`Whether the scheduled export is active`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution`),createdAt:r().datetime().optional().describe(`Creation timestamp`),createdBy:r().optional().describe(`User who created the schedule`)}),JX=h({jobId:r().describe(`Export job ID`)}),YX=J.extend({data:h({jobId:r().describe(`Export job ID`),downloadUrl:r().describe(`Presigned download URL`),fileName:r().describe(`Suggested file name`),fileSize:P().int().describe(`File size in bytes`),format:BX.describe(`Export file format`),expiresAt:r().datetime().describe(`Download URL expiration timestamp`),checksum:r().optional().describe(`File checksum (SHA-256)`)})}),XX=h({object:r().optional().describe(`Filter by object name`),status:VX.optional().describe(`Filter by job status`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of jobs to return`),cursor:r().optional().describe(`Pagination cursor from a previous response`)}),ZX=h({jobId:r().describe(`Export job ID`),object:r().describe(`Object name that was exported`),status:VX.describe(`Current job status`),format:BX.describe(`Export file format`),totalRecords:P().int().optional().describe(`Total records exported`),fileSize:P().int().optional().describe(`File size in bytes`),createdAt:r().datetime().describe(`Job creation timestamp`),completedAt:r().datetime().optional().describe(`Completion timestamp`),createdBy:r().optional().describe(`User who initiated the export`)}),QX=J.extend({data:h({jobs:C(ZX).describe(`List of export jobs`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more jobs are available`)})}),$X=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Schedule name (snake_case)`),label:r().optional().describe(`Human-readable label`),object:r().describe(`Object name to export`),format:BX.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Fields to include`),filter:d(r(),u()).optional().describe(`Record filter criteria`),templateId:r().optional().describe(`Export template ID for field mappings`),schedule:h({cronExpression:r().describe(`Cron expression for schedule`),timezone:r().default(`UTC`).describe(`IANA timezone`)}).describe(`Schedule timing configuration`),delivery:h({method:E([`email`,`storage`,`webhook`]).describe(`How to deliver the export file`),recipients:C(r()).optional().describe(`Email recipients (for email delivery)`),storagePath:r().optional().describe(`Storage path (for storage delivery)`),webhookUrl:r().optional().describe(`Webhook URL (for webhook delivery)`)}).describe(`Export delivery configuration`)}),eZ=J.extend({data:h({id:r().describe(`Scheduled export ID`),name:r().describe(`Schedule name`),enabled:S().describe(`Whether the schedule is active`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution`),createdAt:r().datetime().describe(`Creation timestamp`)})}),lke={createExportJob:{method:`POST`,path:`/api/v1/data/:object/export`,input:HX,output:UX},getExportJobProgress:{method:`GET`,path:`/api/v1/data/export/:jobId`,input:h({jobId:r()}),output:WX},getExportJobDownload:{method:`GET`,path:`/api/v1/data/export/:jobId/download`,input:JX,output:YX},listExportJobs:{method:`GET`,path:`/api/v1/data/export`,input:XX,output:QX},scheduleExport:{method:`POST`,path:`/api/v1/data/export/schedules`,input:$X,output:eZ},cancelExportJob:{method:`POST`,path:`/api/v1/data/export/:jobId/cancel`,input:h({jobId:r()}),output:J}},tZ=E([`start`,`end`,`decision`,`assignment`,`loop`,`create_record`,`update_record`,`delete_record`,`get_record`,`http_request`,`script`,`screen`,`wait`,`subflow`,`connector_action`,`parallel_gateway`,`join_gateway`,`boundary_event`]),nZ=h({name:r().describe(`Variable name`),type:r().describe(`Data type (text, number, boolean, object, list)`),isInput:S().default(!1).describe(`Is input parameter`),isOutput:S().default(!1).describe(`Is output parameter`)}),rZ=h({id:r().describe(`Node unique ID`),type:tZ.describe(`Action type`),label:r().describe(`Node label`),config:d(r(),u()).optional().describe(`Node configuration`),connectorConfig:h({connectorId:r(),actionId:r(),input:d(r(),u()).describe(`Mapped inputs for the action`)}).optional(),position:h({x:P(),y:P()}).optional(),timeoutMs:P().int().min(0).optional().describe(`Maximum execution time for this node in milliseconds`),inputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Parameter type`),required:S().default(!1).describe(`Whether the parameter is required`),description:r().optional().describe(`Parameter description`)})).optional().describe(`Input parameter schema for this node`),outputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Output type`),description:r().optional().describe(`Output description`)})).optional().describe(`Output schema declaration for this node`),waitEventConfig:h({eventType:E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`What kind of event resumes the execution`),timerDuration:r().optional().describe(`ISO 8601 duration (e.g., "PT1H") or wait time for timer events`),signalName:r().optional().describe(`Named signal or webhook event to wait for`),timeoutMs:P().int().min(0).optional().describe(`Maximum wait time before timeout (ms)`),onTimeout:E([`fail`,`continue`]).default(`fail`).describe(`Behavior when the wait times out`)}).optional().describe(`Configuration for wait node event resumption`),boundaryConfig:h({attachedToNodeId:r().describe(`Host node ID this boundary event monitors`),eventType:E([`error`,`timer`,`signal`,`cancel`]).describe(`Boundary event trigger type`),interrupting:S().default(!0).describe(`If true, the host activity is cancelled when this event fires`),errorCode:r().optional().describe(`Specific error code to catch (empty = catch all errors)`),timerDuration:r().optional().describe(`ISO 8601 duration for timer boundary events`),signalName:r().optional().describe(`Named signal to catch`)}).optional().describe(`Configuration for boundary events attached to host nodes`)}),iZ=h({id:r().describe(`Edge unique ID`),source:r().describe(`Source Node ID`),target:r().describe(`Target Node ID`),condition:r().optional().describe(`Expression returning boolean used for branching`),type:E([`default`,`fault`,`conditional`]).default(`default`).describe(`Connection type: default (normal flow), fault (error path), or conditional (expression-guarded)`),label:r().optional().describe(`Label on the connector`),isDefault:S().default(!1).describe(`Marks this edge as the default path when no other conditions match`)}),aZ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name`),label:r().describe(`Flow label`),description:r().optional(),version:P().int().default(1).describe(`Version number`),status:E([`draft`,`active`,`obsolete`,`invalid`]).default(`draft`).describe(`Deployment status`),template:S().default(!1).describe(`Is logic template (Subflow)`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).describe(`Flow type`),variables:C(nZ).optional().describe(`Flow variables`),nodes:C(rZ).describe(`Flow nodes`),edges:C(iZ).describe(`Flow connections`),active:S().default(!1).describe(`Is active (Deprecated: use status)`),runAs:E([`system`,`user`]).default(`user`).describe(`Execution context`),errorHandling:h({strategy:E([`fail`,`retry`,`continue`]).default(`fail`).describe(`How to handle node execution errors`),maxRetries:P().int().min(0).max(10).default(0).describe(`Number of retry attempts (only for retry strategy)`),retryDelayMs:P().int().min(0).default(1e3).describe(`Delay between retries in milliseconds`),backoffMultiplier:P().min(1).default(1).describe(`Multiplier for exponential backoff between retries`),maxRetryDelayMs:P().int().min(0).default(3e4).describe(`Maximum delay between retries in milliseconds`),jitter:S().default(!1).describe(`Add random jitter to retry delay to avoid thundering herd`),fallbackNodeId:r().optional().describe(`Node ID to jump to on unrecoverable error`)}).optional().describe(`Flow-level error handling configuration`)});function uke(e){return aZ.parse(e)}var dke=h({flowName:r().describe(`Flow machine name`),version:P().int().min(1).describe(`Version number`),definition:aZ.describe(`Complete flow definition snapshot`),createdAt:r().datetime().describe(`When this version was created`),createdBy:r().optional().describe(`User who created this version`),changeNote:r().optional().describe(`Description of what changed in this version`)}),oZ=E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]),sZ=h({nodeId:r().describe(`Node ID that was executed`),nodeType:r().describe(`Node action type (e.g., "decision", "http_request")`),nodeLabel:r().optional().describe(`Human-readable node label`),status:E([`success`,`failure`,`skipped`]).describe(`Step execution result`),startedAt:r().datetime().describe(`When the step started`),completedAt:r().datetime().optional().describe(`When the step completed`),durationMs:P().int().min(0).optional().describe(`Step execution duration in milliseconds`),input:d(r(),u()).optional().describe(`Input data passed to the node`),output:d(r(),u()).optional().describe(`Output data produced by the node`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`)}).optional().describe(`Error details if step failed`),retryAttempt:P().int().min(0).optional().describe(`Retry attempt number (0 = first try)`)}),cZ=h({id:r().describe(`Execution instance ID`),flowName:r().describe(`Machine name of the executed flow`),flowVersion:P().int().optional().describe(`Version of the flow that was executed`),status:oZ.describe(`Current execution status`),trigger:h({type:r().describe(`Trigger type (e.g., "record_change", "schedule", "api", "manual")`),recordId:r().optional().describe(`Triggering record ID`),object:r().optional().describe(`Triggering object name`),userId:r().optional().describe(`User who triggered the execution`),metadata:d(r(),u()).optional().describe(`Additional trigger context`)}).describe(`What triggered this execution`),steps:C(sZ).describe(`Ordered list of executed steps`),variables:d(r(),u()).optional().describe(`Final state of flow variables`),startedAt:r().datetime().describe(`Execution start timestamp`),completedAt:r().datetime().optional().describe(`Execution completion timestamp`),durationMs:P().int().min(0).optional().describe(`Total execution duration in milliseconds`),runAs:E([`system`,`user`]).optional().describe(`Execution context identity`),tenantId:r().optional().describe(`Tenant ID for multi-tenant isolation`)}),lZ=E([`warning`,`error`,`critical`]),fke=h({id:r().describe(`Error record ID`),executionId:r().describe(`Parent execution ID`),nodeId:r().optional().describe(`Node where the error occurred`),severity:lZ.describe(`Error severity level`),code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),stack:r().optional().describe(`Stack trace for debugging`),context:d(r(),u()).optional().describe(`Additional diagnostic context (input data, config snapshot)`),timestamp:r().datetime().describe(`When the error occurred`),retryable:S().default(!1).describe(`Whether this error can be retried`),resolvedAt:r().datetime().optional().describe(`When the error was resolved (e.g., after successful retry)`)}),pke=h({id:r().describe(`Checkpoint ID`),executionId:r().describe(`Parent execution ID`),flowName:r().describe(`Flow machine name`),currentNodeId:r().describe(`Node ID where execution is paused`),variables:d(r(),u()).describe(`Flow variable state at checkpoint`),completedNodeIds:C(r()).describe(`List of node IDs already executed`),createdAt:r().datetime().describe(`Checkpoint creation timestamp`),expiresAt:r().datetime().optional().describe(`Checkpoint expiration (auto-cleanup)`),reason:E([`wait`,`screen_input`,`approval`,`error`,`manual_pause`,`parallel_join`,`boundary_event`]).describe(`Why the execution was checkpointed`)}),mke=h({maxConcurrent:P().int().min(1).default(1).describe(`Maximum number of concurrent executions allowed`),onConflict:E([`queue`,`reject`,`cancel_existing`]).default(`queue`).describe(`queue = enqueue for later, reject = fail immediately, cancel_existing = stop running instance`),lockScope:E([`global`,`per_record`,`per_user`]).default(`global`).describe(`Scope of the concurrency lock`),queueTimeoutMs:P().int().min(0).optional().describe(`Maximum time to wait in queue before timing out (ms)`)}),hke=h({id:r().describe(`Schedule instance ID`),flowName:r().describe(`Flow machine name`),cronExpression:r().describe(`Cron expression (e.g., "0 9 * * MON-FRI")`),timezone:r().default(`UTC`).describe(`IANA timezone for cron evaluation`),status:E([`active`,`paused`,`disabled`,`expired`]).default(`active`).describe(`Current schedule status`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution timestamp`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),lastExecutionId:r().optional().describe(`Execution ID of the last run`),lastRunStatus:oZ.optional().describe(`Status of the last run`),totalRuns:P().int().min(0).default(0).describe(`Total number of executions`),consecutiveFailures:P().int().min(0).default(0).describe(`Consecutive failed executions`),startDate:r().datetime().optional().describe(`Schedule effective start date`),endDate:r().datetime().optional().describe(`Schedule expiration date`),maxRuns:P().int().min(1).optional().describe(`Maximum total executions before auto-disable`),createdAt:r().datetime().describe(`Schedule creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the schedule`)}),uZ=h({name:r().describe(`Flow machine name (snake_case)`)}),dZ=uZ.extend({runId:r().describe(`Execution run ID`)}),fZ=h({status:E([`draft`,`active`,`obsolete`,`invalid`]).optional().describe(`Filter by flow status`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).optional().describe(`Filter by flow type`),limit:P().int().min(1).max(100).default(50).describe(`Maximum number of flows to return`),cursor:r().optional().describe(`Cursor for pagination`)}),pZ=h({name:r().describe(`Flow machine name`),label:r().describe(`Flow display label`),type:r().describe(`Flow type`),status:r().describe(`Flow deployment status`),version:P().int().describe(`Flow version number`),enabled:S().describe(`Whether the flow is enabled for execution`),nodeCount:P().int().optional().describe(`Number of nodes in the flow`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`)}),mZ=J.extend({data:h({flows:C(pZ).describe(`Flow summaries`),total:P().int().optional().describe(`Total matching flows`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more flows are available`)})}),hZ=uZ,gZ=J.extend({data:aZ.describe(`Full flow definition`)}),_Z=aZ,vZ=J.extend({data:aZ.describe(`The created flow definition`)}),yZ=uZ.extend({definition:aZ.partial().describe(`Partial flow definition to update`)}),bZ=J.extend({data:aZ.describe(`The updated flow definition`)}),xZ=uZ,SZ=J.extend({data:h({name:r().describe(`Name of the deleted flow`),deleted:S().describe(`Whether the flow was deleted`)})}),CZ=uZ.extend({record:d(r(),u()).optional().describe(`Record that triggered the automation`),object:r().optional().describe(`Object name the record belongs to`),event:r().optional().describe(`Trigger event type`),userId:r().optional().describe(`User who triggered the automation`),params:d(r(),u()).optional().describe(`Additional contextual data`)}),wZ=J.extend({data:h({success:S().describe(`Whether the automation completed successfully`),output:u().optional().describe(`Output data from the automation`),error:r().optional().describe(`Error message if execution failed`),durationMs:P().optional().describe(`Execution duration in milliseconds`)})}),TZ=uZ.extend({enabled:S().describe(`Whether to enable (true) or disable (false) the flow`)}),EZ=J.extend({data:h({name:r().describe(`Flow name`),enabled:S().describe(`New enabled state`)})}),DZ=uZ.extend({status:E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]).optional().describe(`Filter by execution status`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of runs to return`),cursor:r().optional().describe(`Cursor for pagination`)}),OZ=J.extend({data:h({runs:C(cZ).describe(`Execution run logs`),total:P().int().optional().describe(`Total matching runs`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more runs are available`)})}),kZ=dZ,AZ=J.extend({data:cZ.describe(`Full execution log with step details`)}),gke=E([`flow_not_found`,`flow_already_exists`,`flow_validation_failed`,`flow_disabled`,`execution_not_found`,`execution_failed`,`execution_timeout`,`node_executor_not_found`,`concurrent_execution_limit`]),_ke={listFlows:{method:`GET`,path:`/api/automation`,input:fZ,output:mZ},getFlow:{method:`GET`,path:`/api/automation/:name`,input:hZ,output:gZ},createFlow:{method:`POST`,path:`/api/automation`,input:_Z,output:vZ},updateFlow:{method:`PUT`,path:`/api/automation/:name`,input:yZ,output:bZ},deleteFlow:{method:`DELETE`,path:`/api/automation/:name`,input:xZ,output:SZ},triggerFlow:{method:`POST`,path:`/api/automation/:name/trigger`,input:CZ,output:wZ},toggleFlow:{method:`POST`,path:`/api/automation/:name/toggle`,input:TZ,output:EZ},listRuns:{method:`GET`,path:`/api/automation/:name/runs`,input:DZ,output:OZ},getRun:{method:`GET`,path:`/api/automation/:name/runs/:runId`,input:kZ,output:AZ}},jZ=h({packageId:r().describe(`Package identifier`)}),MZ=h({status:E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).optional().describe(`Filter by package status`),enabled:S().optional().describe(`Filter by enabled state`),limit:P().int().min(1).max(100).default(50).describe(`Maximum number of packages to return`),cursor:r().optional().describe(`Cursor for pagination`)}).describe(`List installed packages request`),NZ=J.extend({data:h({packages:C(rH).describe(`Installed packages`),total:P().int().optional().describe(`Total matching packages`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more packages are available`)})}).describe(`List installed packages response`),PZ=jZ,FZ=J.extend({data:rH.describe(`Installed package details`)}).describe(`Get installed package response`),IZ=h({manifest:RV.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`),artifactRef:SU.optional().describe(`Artifact reference for marketplace installation`)}).describe(`Install package request`),LZ=J.extend({data:h({package:rH.describe(`Installed package details`),dependencyResolution:QB.optional().describe(`Dependency resolution result`),namespaceConflicts:C(h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package name`),suggestion:r().optional().describe(`Suggested alternative`)})).optional().describe(`Namespace conflicts detected`),message:r().optional().describe(`Installation status message`)})}).describe(`Install package response`),RZ=h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:RV.optional().describe(`New manifest for the target version`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`),zZ=J.extend({data:h({success:S().describe(`Whether the upgrade succeeded`),phase:r().describe(`Current upgrade phase`),plan:yH.optional().describe(`Upgrade plan that was executed`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r().describe(`Conflict path`),baseValue:u().describe(`Base value`),incomingValue:u().describe(`Incoming value`),customValue:u().describe(`Custom value`)})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if failed`),message:r().optional().describe(`Human-readable status message`)})}).describe(`Upgrade package response`),BZ=h({manifest:RV.describe(`Package manifest to resolve dependencies for`),platformVersion:r().optional().describe(`Current platform version for compatibility filtering`)}).describe(`Resolve dependencies request`),VZ=J.extend({data:QB.describe(`Dependency resolution result with topological sort`)}).describe(`Resolve dependencies response`),HZ=h({artifact:UB.describe(`Package artifact metadata`),sha256:r().regex(/^[a-f0-9]{64}$/).optional().describe(`SHA256 checksum of the uploaded file`),token:r().optional().describe(`Publisher authentication token`),releaseNotes:r().optional().describe(`Release notes for this version`)}).describe(`Upload artifact request`),UZ=J.extend({data:h({success:S().describe(`Whether the upload succeeded`),artifactRef:SU.optional().describe(`Artifact reference in the registry`),submissionId:r().optional().describe(`Marketplace submission ID for review tracking`),message:r().optional().describe(`Upload status message`)})}).describe(`Upload artifact response`),WZ=jZ.extend({snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),GZ=J.extend({data:h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Restored version`),message:r().optional().describe(`Rollback status message`)})}).describe(`Rollback package response`),KZ=jZ,qZ=J.extend({data:h({packageId:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)})}).describe(`Uninstall package response`),vke=E([`package_not_found`,`package_already_installed`,`version_not_found`,`dependency_conflict`,`namespace_conflict`,`platform_incompatible`,`artifact_invalid`,`checksum_mismatch`,`signature_invalid`,`upgrade_failed`,`rollback_failed`,`snapshot_not_found`,`upload_failed`]),yke={listPackages:{method:`GET`,path:`/api/v1/packages`,input:MZ,output:NZ},getPackage:{method:`GET`,path:`/api/v1/packages/:packageId`,input:PZ,output:FZ},installPackage:{method:`POST`,path:`/api/v1/packages/install`,input:IZ,output:LZ},upgradePackage:{method:`POST`,path:`/api/v1/packages/upgrade`,input:RZ,output:zZ},resolveDependencies:{method:`POST`,path:`/api/v1/packages/resolve-dependencies`,input:BZ,output:VZ},uploadArtifact:{method:`POST`,path:`/api/v1/packages/upload`,input:HZ,output:UZ},rollbackPackage:{method:`POST`,path:`/api/v1/packages/:packageId/rollback`,input:WZ,output:GZ},uninstallPackage:{method:`DELETE`,path:`/api/v1/packages/:packageId`,input:KZ,output:qZ}};DA({},{ActionRefSchema:()=>Yj,ApprovalActionSchema:()=>QZ,ApprovalActionType:()=>ZZ,ApprovalProcess:()=>xke,ApprovalProcessSchema:()=>eQ,ApprovalStepSchema:()=>$Z,ApproverType:()=>XZ,AuthFieldSchema:()=>uQ,AuthenticationSchema:()=>fQ,AuthenticationTypeSchema:()=>lQ,BUILT_IN_BPMN_MAPPINGS:()=>Rke,BpmnDiagnosticSchema:()=>OQ,BpmnElementMappingSchema:()=>TQ,BpmnExportOptionsSchema:()=>Ike,BpmnImportOptionsSchema:()=>Fke,BpmnInteropResultSchema:()=>Lke,BpmnUnmappedStrategySchema:()=>EQ,BpmnVersionSchema:()=>DQ,CheckpointSchema:()=>pke,ConcurrencyPolicySchema:()=>mke,ConflictResolutionSchema:()=>yQ,Connector:()=>Dke,ConnectorActionRefSchema:()=>CJ,ConnectorCategorySchema:()=>cQ,ConnectorInstanceSchema:()=>Eke,ConnectorOperationSchema:()=>hQ,ConnectorSchema:()=>Tke,ConnectorTriggerSchema:()=>gQ,CustomScriptActionSchema:()=>DJ,DataDestinationConfigSchema:()=>xQ,DataSourceConfigSchema:()=>bQ,DataSyncConfigSchema:()=>Oke,ETL:()=>wke,ETLDestinationSchema:()=>rQ,ETLEndpointTypeSchema:()=>tQ,ETLPipelineRunSchema:()=>Cke,ETLPipelineSchema:()=>Ske,ETLRunStatusSchema:()=>sQ,ETLSourceSchema:()=>nQ,ETLSyncModeSchema:()=>oQ,ETLTransformationSchema:()=>aQ,ETLTransformationTypeSchema:()=>iQ,EmailAlertActionSchema:()=>SJ,EventSchema:()=>Pve,ExecutionErrorSchema:()=>fke,ExecutionErrorSeverity:()=>lZ,ExecutionLogSchema:()=>cZ,ExecutionStatus:()=>oZ,ExecutionStepLogSchema:()=>sZ,FieldUpdateActionSchema:()=>xJ,FlowEdgeSchema:()=>iZ,FlowNodeAction:()=>tZ,FlowNodeSchema:()=>rZ,FlowSchema:()=>aZ,FlowVariableSchema:()=>nZ,FlowVersionHistorySchema:()=>dke,GuardRefSchema:()=>Xj,HttpCallActionSchema:()=>wJ,NodeExecutorDescriptorSchema:()=>Nke,OAuth2ConfigSchema:()=>dQ,OperationParameterSchema:()=>mQ,OperationTypeSchema:()=>pQ,PushNotificationActionSchema:()=>EJ,ScheduleStateSchema:()=>hke,StateMachineSchema:()=>$j,StateNodeSchema:()=>Qj,Sync:()=>Ake,SyncDirectionSchema:()=>_Q,SyncExecutionResultSchema:()=>kke,SyncExecutionStatusSchema:()=>SQ,SyncModeSchema:()=>vQ,TaskCreationActionSchema:()=>TJ,TimeTriggerSchema:()=>kJ,TransitionSchema:()=>Zj,WAIT_EXECUTOR_DESCRIPTOR:()=>Pke,WaitEventTypeSchema:()=>CQ,WaitExecutorConfigSchema:()=>Mke,WaitResumePayloadSchema:()=>jke,WaitTimeoutBehaviorSchema:()=>wQ,WebhookReceiverSchema:()=>bke,WebhookSchema:()=>YZ,WebhookTriggerType:()=>JZ,WorkflowActionSchema:()=>OJ,WorkflowRuleSchema:()=>AJ,WorkflowTriggerType:()=>bJ,defineFlow:()=>uke});var JZ=E([`create`,`update`,`delete`,`undelete`,`api`]),YZ=h({name:kA.describe(`Webhook unique name (lowercase snake_case)`),label:r().optional().describe(`Human-readable webhook label`),object:r().optional().describe(`Object to listen to (optional for manual webhooks)`),triggers:C(JZ).optional().describe(`Events that trigger execution`),url:r().url().describe(`External webhook endpoint URL`),method:E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]).default(`POST`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),body:u().optional().describe(`Request body payload (if not using default record data)`),payloadFields:C(r()).optional().describe(`Fields to include. Empty = All`),includeSession:S().default(!1).describe(`Include user session info`),authentication:h({type:E([`none`,`bearer`,`basic`,`api-key`]).describe(`Authentication type`),credentials:d(r(),r()).optional().describe(`Authentication credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:h({maxRetries:P().int().min(0).max(10).default(3).describe(`Maximum retry attempts`),backoffStrategy:E([`exponential`,`linear`,`fixed`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:P().int().min(100).default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().int().min(1e3).default(6e4).describe(`Maximum retry delay in milliseconds`)}).optional().describe(`Retry policy configuration`),timeoutMs:P().int().min(1e3).max(3e5).default(3e4).describe(`Request timeout in milliseconds`),secret:r().optional().describe(`Signing secret for HMAC signature verification`),isActive:S().default(!0).describe(`Whether webhook is active`),description:r().optional().describe(`Webhook description`),tags:C(r()).optional().describe(`Tags for organization`)}),bke=h({name:kA.describe(`Webhook receiver unique name (lowercase snake_case)`),path:r().describe(`URL Path (e.g. /webhooks/stripe)`),verificationType:E([`none`,`header_token`,`hmac`,`ip_whitelist`]).default(`none`),verificationParams:h({header:r().optional(),secret:r().optional(),ips:C(r()).optional()}).optional(),action:E([`trigger_flow`,`script`,`upsert_record`]).default(`trigger_flow`),target:r().describe(`Flow ID or Script name`)}),XZ=E([`user`,`role`,`manager`,`field`,`queue`]),ZZ=E([`field_update`,`email_alert`,`webhook`,`script`,`connector_action`]),QZ=h({type:ZZ,name:r().describe(`Action name`),config:d(r(),u()).describe(`Action configuration`),connectorId:r().optional(),actionId:r().optional()}),$Z=h({name:kA.describe(`Step machine name`),label:r().describe(`Step display label`),description:r().optional(),entryCriteria:r().optional().describe(`Formula expression to enter this step`),approvers:C(h({type:XZ,value:r().describe(`User ID, Role Name, or Field Name`)})).min(1).describe(`List of allowed approvers`),behavior:E([`first_response`,`unanimous`]).default(`first_response`).describe(`How to handle multiple approvers`),rejectionBehavior:E([`reject_process`,`back_to_previous`]).default(`reject_process`).describe(`What happens if rejected`),onApprove:C(QZ).optional().describe(`Actions on step approval`),onReject:C(QZ).optional().describe(`Actions on step rejection`)}),eQ=h({name:kA.describe(`Unique process name`),label:r().describe(`Human readable label`),object:r().describe(`Target Object Name`),active:S().default(!1),description:r().optional(),entryCriteria:r().optional().describe(`Formula to allow submission`),lockRecord:S().default(!0).describe(`Lock record from editing during approval`),steps:C($Z).min(1).describe(`Sequence of approval steps`),escalation:h({enabled:S().default(!1).describe(`Enable SLA-based escalation`),timeoutHours:P().min(1).describe(`Hours before escalation triggers`),action:E([`reassign`,`auto_approve`,`auto_reject`,`notify`]).default(`notify`).describe(`Action to take on escalation timeout`),escalateTo:r().optional().describe(`User ID, role, or manager level to escalate to`),notifySubmitter:S().default(!0).describe(`Notify the original submitter on escalation`)}).optional().describe(`SLA escalation configuration for pending approval steps`),onSubmit:C(QZ).optional().describe(`Actions on initial submission`),onFinalApprove:C(QZ).optional().describe(`Actions on final approval`),onFinalReject:C(QZ).optional().describe(`Actions on final rejection`),onRecall:C(QZ).optional().describe(`Actions on recall`)}),xke=Object.assign(eQ,{create:e=>e}),tQ=E([`database`,`api`,`file`,`stream`,`object`,`warehouse`,`storage`,`spreadsheet`]),nQ=h({type:tQ.describe(`Source type`),connector:r().optional().describe(`Connector ID`),config:d(r(),u()).describe(`Source configuration`),incremental:h({enabled:S().default(!1),cursorField:r().describe(`Field to track progress (e.g., updated_at)`),cursorValue:u().optional().describe(`Last processed value`)}).optional().describe(`Incremental extraction config`)}),rQ=h({type:tQ.describe(`Destination type`),connector:r().optional().describe(`Connector ID`),config:d(r(),u()).describe(`Destination configuration`),writeMode:E([`append`,`overwrite`,`upsert`,`merge`]).default(`append`).describe(`How to write data`),primaryKey:C(r()).optional().describe(`Primary key fields`)}),iQ=E([`map`,`filter`,`aggregate`,`join`,`script`,`lookup`,`split`,`merge`,`normalize`,`deduplicate`]),aQ=h({name:r().optional().describe(`Transformation name`),type:iQ.describe(`Transformation type`),config:d(r(),u()).describe(`Transformation config`),continueOnError:S().default(!1).describe(`Continue on error`)}),oQ=E([`full`,`incremental`,`cdc`]),Ske=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Pipeline identifier (snake_case)`),label:r().optional().describe(`Pipeline display name`),description:r().optional().describe(`Pipeline description`),source:nQ.describe(`Data source`),destination:rQ.describe(`Data destination`),transformations:C(aQ).optional().describe(`Transformation pipeline`),syncMode:oQ.default(`full`).describe(`Sync mode`),schedule:r().optional().describe(`Cron schedule expression`),enabled:S().default(!0).describe(`Pipeline enabled status`),retry:h({maxAttempts:P().int().min(0).default(3).describe(`Max retry attempts`),backoffMs:P().int().min(0).default(6e4).describe(`Backoff in milliseconds`)}).optional().describe(`Retry configuration`),notifications:h({onSuccess:C(r()).optional().describe(`Email addresses for success notifications`),onFailure:C(r()).optional().describe(`Email addresses for failure notifications`)}).optional().describe(`Notification settings`),tags:C(r()).optional().describe(`Pipeline tags`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),sQ=E([`pending`,`running`,`succeeded`,`failed`,`cancelled`,`timeout`]),Cke=h({id:r().describe(`Run identifier`),pipelineName:r().describe(`Pipeline name`),status:sQ.describe(`Run status`),startedAt:r().datetime().describe(`Start time`),completedAt:r().datetime().optional().describe(`Completion time`),durationMs:P().optional().describe(`Duration in ms`),stats:h({recordsRead:P().int().default(0).describe(`Records extracted`),recordsWritten:P().int().default(0).describe(`Records loaded`),recordsErrored:P().int().default(0).describe(`Records with errors`),bytesProcessed:P().int().default(0).describe(`Bytes processed`)}).optional().describe(`Run statistics`),error:h({message:r().describe(`Error message`),code:r().optional().describe(`Error code`),details:u().optional().describe(`Error details`)}).optional().describe(`Error information`),logs:C(r()).optional().describe(`Execution logs`)}),wke={databaseSync:e=>({name:e.name,source:{type:`database`,config:{table:e.sourceTable}},destination:{type:`database`,config:{table:e.destTable},writeMode:`upsert`},syncMode:`incremental`,schedule:e.schedule,enabled:!0}),apiToDatabase:e=>({name:e.name,source:{type:`api`,connector:e.apiConnector,config:{}},destination:{type:`database`,config:{table:e.destTable},writeMode:`append`},syncMode:`full`,schedule:e.schedule,enabled:!0})},cQ=E([`crm`,`payment`,`communication`,`storage`,`analytics`,`database`,`marketing`,`accounting`,`hr`,`productivity`,`ecommerce`,`support`,`devtools`,`social`,`other`]),lQ=E([`none`,`apiKey`,`basic`,`bearer`,`oauth1`,`oauth2`,`custom`]),uQ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Field name (snake_case)`),label:r().describe(`Field label`),type:E([`text`,`password`,`url`,`select`]).default(`text`).describe(`Field type`),description:r().optional().describe(`Field description`),required:S().default(!0).describe(`Required field`),default:r().optional().describe(`Default value`),options:C(h({label:r(),value:r()})).optional().describe(`Select field options`),placeholder:r().optional().describe(`Placeholder text`)}),dQ=h({authorizationUrl:r().url().describe(`Authorization endpoint URL`),tokenUrl:r().url().describe(`Token endpoint URL`),scopes:C(r()).optional().describe(`OAuth scopes`),clientIdField:r().default(`client_id`).describe(`Client ID field name`),clientSecretField:r().default(`client_secret`).describe(`Client secret field name`)}),fQ=h({type:lQ.describe(`Authentication type`),fields:C(uQ).optional().describe(`Authentication fields`),oauth2:dQ.optional().describe(`OAuth 2.0 configuration`),test:h({url:r().optional().describe(`Test endpoint URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`]).default(`GET`).describe(`HTTP method`)}).optional().describe(`Authentication test configuration`)}),pQ=E([`read`,`write`,`delete`,`search`,`trigger`,`action`]),mQ=h({name:r().describe(`Parameter name`),label:r().describe(`Parameter label`),description:r().optional().describe(`Parameter description`),type:E([`string`,`number`,`boolean`,`array`,`object`,`date`,`file`]).describe(`Parameter type`),required:S().default(!1).describe(`Required parameter`),default:u().optional().describe(`Default value`),validation:d(r(),u()).optional().describe(`Validation rules`),dynamicOptions:r().optional().describe(`Function to load dynamic options`)}),hQ=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Operation ID (snake_case)`),name:r().describe(`Operation name`),description:r().optional().describe(`Operation description`),type:pQ.describe(`Operation type`),inputSchema:C(mQ).optional().describe(`Input parameters`),outputSchema:d(r(),u()).optional().describe(`Output schema`),sampleOutput:u().optional().describe(`Sample output`),supportsPagination:S().default(!1).describe(`Supports pagination`),supportsFiltering:S().default(!1).describe(`Supports filtering`)}),gQ=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Trigger ID (snake_case)`),name:r().describe(`Trigger name`),description:r().optional().describe(`Trigger description`),type:E([`webhook`,`polling`,`stream`]).describe(`Trigger mechanism`),config:d(r(),u()).optional().describe(`Trigger configuration`),outputSchema:d(r(),u()).optional().describe(`Event payload schema`),pollingIntervalMs:P().int().min(1e3).optional().describe(`Polling interval in ms`)}),Tke=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Connector ID (snake_case)`),name:r().describe(`Connector name`),description:r().optional().describe(`Connector description`),version:r().optional().describe(`Connector version`),icon:r().optional().describe(`Connector icon`),category:cQ.describe(`Connector category`),baseUrl:r().url().optional().describe(`API base URL`),authentication:fQ.describe(`Authentication config`),operations:C(hQ).optional().describe(`Connector operations`),triggers:C(gQ).optional().describe(`Connector triggers`),rateLimit:h({requestsPerSecond:P().optional().describe(`Max requests per second`),requestsPerMinute:P().optional().describe(`Max requests per minute`),requestsPerHour:P().optional().describe(`Max requests per hour`)}).optional().describe(`Rate limiting`),author:r().optional().describe(`Connector author`),documentation:r().url().optional().describe(`Documentation URL`),homepage:r().url().optional().describe(`Homepage URL`),license:r().optional().describe(`License (SPDX identifier)`),tags:C(r()).optional().describe(`Connector tags`),verified:S().default(!1).describe(`Verified connector`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),Eke=h({id:r().describe(`Instance ID`),connectorId:r().describe(`Connector ID`),name:r().describe(`Instance name`),description:r().optional().describe(`Instance description`),credentials:d(r(),u()).describe(`Encrypted credentials`),config:d(r(),u()).optional().describe(`Additional config`),active:S().default(!0).describe(`Instance active status`),createdAt:r().datetime().optional().describe(`Creation time`),lastTestedAt:r().datetime().optional().describe(`Last test time`),testStatus:E([`unknown`,`success`,`failed`]).default(`unknown`).describe(`Connection test status`)}),Dke={apiKey:e=>({id:e.id,name:e.name,category:e.category,baseUrl:e.baseUrl,authentication:{type:`apiKey`,fields:[{name:`api_key`,label:`API Key`,type:`password`,required:!0}]},verified:!1}),oauth2:e=>({id:e.id,name:e.name,category:e.category,baseUrl:e.baseUrl,authentication:{type:`oauth2`,oauth2:{authorizationUrl:e.authUrl,tokenUrl:e.tokenUrl,clientIdField:`client_id`,clientSecretField:`client_secret`,scopes:e.scopes}},verified:!1})},_Q=E([`push`,`pull`,`bidirectional`]),vQ=E([`full`,`incremental`,`realtime`]),yQ=E([`source_wins`,`destination_wins`,`latest_wins`,`manual`,`merge`]),bQ=h({object:r().optional().describe(`ObjectStack object name`),filters:u().optional().describe(`Filter conditions`),fields:C(r()).optional().describe(`Fields to sync`),connectorInstanceId:r().optional().describe(`Connector instance ID`),externalResource:r().optional().describe(`External resource ID`)}),xQ=h({object:r().optional().describe(`ObjectStack object name`),connectorInstanceId:r().optional().describe(`Connector instance ID`),operation:E([`insert`,`update`,`upsert`,`delete`,`sync`]).describe(`Sync operation`),mapping:l([d(r(),r()),C(MA)]).optional().describe(`Field mappings`),externalResource:r().optional().describe(`External resource ID`),matchKey:C(r()).optional().describe(`Match key fields`)}),Oke=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Sync configuration name (snake_case)`),label:r().optional().describe(`Sync display name`),description:r().optional().describe(`Sync description`),source:bQ.describe(`Data source`),destination:xQ.describe(`Data destination`),direction:_Q.default(`push`).describe(`Sync direction`),syncMode:vQ.default(`incremental`).describe(`Sync mode`),conflictResolution:yQ.default(`latest_wins`).describe(`Conflict resolution`),schedule:r().optional().describe(`Cron schedule`),enabled:S().default(!0).describe(`Sync enabled`),changeTrackingField:r().optional().describe(`Field for change tracking`),batchSize:P().int().min(1).max(1e4).default(100).describe(`Batch size for processing`),retry:h({maxAttempts:P().int().min(0).default(3).describe(`Max retries`),backoffMs:P().int().min(0).default(3e4).describe(`Backoff duration`)}).optional().describe(`Retry configuration`),validation:h({required:C(r()).optional().describe(`Required fields`),unique:C(r()).optional().describe(`Unique constraint fields`),custom:C(h({name:r(),condition:r().describe(`Validation condition`),message:r().describe(`Error message`)})).optional().describe(`Custom validation rules`)}).optional().describe(`Validation rules`),errorHandling:h({onValidationError:E([`skip`,`fail`,`log`]).default(`skip`),onSyncError:E([`skip`,`fail`,`retry`]).default(`retry`),notifyOnError:C(r()).optional().describe(`Email notifications`)}).optional().describe(`Error handling`),optimization:h({parallelBatches:S().default(!1).describe(`Process batches in parallel`),cacheEnabled:S().default(!0).describe(`Enable caching`),compressionEnabled:S().default(!1).describe(`Enable compression`)}).optional().describe(`Performance optimization`),audit:h({logLevel:E([`none`,`error`,`warn`,`info`,`debug`]).default(`info`),retainLogsForDays:P().int().min(1).default(30),trackChanges:S().default(!0).describe(`Track all changes`)}).optional().describe(`Audit configuration`),tags:C(r()).optional().describe(`Sync tags`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),SQ=E([`pending`,`running`,`completed`,`partial`,`failed`,`cancelled`]),kke=h({id:r().describe(`Execution ID`),syncName:r().describe(`Sync name`),status:SQ.describe(`Execution status`),startedAt:r().datetime().describe(`Start time`),completedAt:r().datetime().optional().describe(`Completion time`),durationMs:P().optional().describe(`Duration in ms`),stats:h({recordsProcessed:P().int().default(0).describe(`Total records processed`),recordsInserted:P().int().default(0).describe(`Records inserted`),recordsUpdated:P().int().default(0).describe(`Records updated`),recordsDeleted:P().int().default(0).describe(`Records deleted`),recordsSkipped:P().int().default(0).describe(`Records skipped`),recordsErrored:P().int().default(0).describe(`Records with errors`),conflictsDetected:P().int().default(0).describe(`Conflicts detected`),conflictsResolved:P().int().default(0).describe(`Conflicts resolved`)}).optional().describe(`Execution statistics`),errors:C(h({recordId:r().optional().describe(`Record ID`),field:r().optional().describe(`Field name`),message:r().describe(`Error message`),code:r().optional().describe(`Error code`)})).optional().describe(`Errors`),logs:C(r()).optional().describe(`Execution logs`)}),Ake={objectSync:e=>({name:e.name,source:{object:e.sourceObject},destination:{object:e.destObject,operation:`upsert`,mapping:e.mapping},direction:`push`,syncMode:`incremental`,conflictResolution:`latest_wins`,batchSize:100,schedule:e.schedule,enabled:!0}),connectorSync:e=>({name:e.name,source:{object:e.sourceObject},destination:{connectorInstanceId:e.connectorInstanceId,externalResource:e.externalResource,operation:`upsert`,mapping:e.mapping},direction:`push`,syncMode:`incremental`,conflictResolution:`latest_wins`,batchSize:100,schedule:e.schedule,enabled:!0}),bidirectionalSync:e=>({name:e.name,source:{object:e.object},destination:{connectorInstanceId:e.connectorInstanceId,externalResource:e.externalResource,operation:`sync`,mapping:e.mapping},direction:`bidirectional`,syncMode:`incremental`,conflictResolution:`latest_wins`,batchSize:100,schedule:e.schedule,enabled:!0})},CQ=E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`Wait event type determining how a paused flow is resumed`),jke=h({executionId:r().describe(`Execution ID of the paused flow`),checkpointId:r().describe(`Checkpoint ID to resume from`),nodeId:r().describe(`Wait node ID being resumed`),eventType:CQ.describe(`Event type that triggered resume`),signalName:r().optional().describe(`Signal name (when eventType is signal)`),webhookPayload:d(r(),u()).optional().describe(`Webhook request payload (when eventType is webhook)`),resumedBy:r().optional().describe(`User ID or system identifier that triggered resume`),resumedAt:r().datetime().describe(`ISO 8601 timestamp of the resume event`),variables:d(r(),u()).optional().describe(`Variables to merge into flow context upon resume`)}).describe(`Payload for resuming a paused wait node`),wQ=E([`fail`,`continue`,`fallback`]).describe(`Behavior when a wait node exceeds its timeout`),Mke=h({defaultTimeoutMs:P().int().min(0).default(864e5).describe(`Default timeout in ms (default: 24 hours)`),defaultTimeoutBehavior:wQ.default(`fail`).describe(`Default behavior when wait timeout is exceeded`),conditionPollIntervalMs:P().int().min(1e3).default(3e4).describe(`Polling interval for condition waits in ms (default: 30s)`),conditionMaxPolls:P().int().min(0).default(0).describe(`Max polling attempts for condition waits (0 = unlimited)`),webhookUrlPattern:r().default(`/api/v1/automation/resume/{executionId}/{nodeId}`).describe(`URL pattern for webhook resume endpoints`),persistCheckpoints:S().default(!0).describe(`Persist wait checkpoints to durable storage`),maxPausedExecutions:P().int().min(0).default(0).describe(`Max concurrent paused executions (0 = unlimited)`)}).describe(`Wait node executor plugin configuration`),Nke=h({id:r().describe(`Unique executor plugin identifier`),name:r().describe(`Display name`),nodeTypes:C(r()).min(1).describe(`FlowNodeAction types this executor handles`),version:r().describe(`Plugin version (semver)`),description:r().optional().describe(`Executor description`),supportsPause:S().default(!1).describe(`Whether the executor supports async pause/resume`),supportsCancellation:S().default(!1).describe(`Whether the executor supports mid-execution cancellation`),supportsRetry:S().default(!0).describe(`Whether the executor supports retry on failure`),configSchemaRef:r().optional().describe(`JSON Schema $ref for executor-specific config`)}).describe(`Node executor plugin descriptor`),Pke={id:`objectstack:wait-executor`,name:`Wait Node Executor`,nodeTypes:[`wait`],version:`1.0.0`,description:`Pauses flow execution and resumes on timer, signal, webhook, manual action, or condition events.`,supportsPause:!0,supportsCancellation:!0,supportsRetry:!0},TQ=h({bpmnType:r().describe(`BPMN XML element type (e.g., "bpmn:parallelGateway")`),flowNodeAction:r().describe(`ObjectStack FlowNodeAction value`),bidirectional:S().default(!0).describe(`Whether the mapping supports both import and export`),notes:r().optional().describe(`Notes about mapping limitations`)}).describe(`Mapping between BPMN XML element and ObjectStack FlowNodeAction`),EQ=E([`skip`,`warn`,`error`,`comment`]).describe(`Strategy for unmapped BPMN elements during import`),Fke=h({unmappedStrategy:EQ.default(`warn`).describe(`How to handle unmapped BPMN elements`),customMappings:C(TQ).optional().describe(`Custom element mappings to override or extend defaults`),importLayout:S().default(!0).describe(`Import BPMN DI layout positions into canvas node coordinates`),importDocumentation:S().default(!0).describe(`Import BPMN documentation elements as node descriptions`),flowName:r().optional().describe(`Override flow name (defaults to BPMN process name)`),validateAfterImport:S().default(!0).describe(`Validate imported flow against FlowSchema after import`)}).describe(`Options for importing BPMN 2.0 XML into an ObjectStack flow`),DQ=E([`2.0`,`2.0.2`]).describe(`BPMN specification version for export`),Ike=h({version:DQ.default(`2.0`).describe(`Target BPMN specification version`),includeLayout:S().default(!0).describe(`Include BPMN DI layout data from canvas positions`),includeExtensions:S().default(!1).describe(`Include ObjectStack extensions in BPMN extensionElements`),customMappings:C(TQ).optional().describe(`Custom element mappings for export`),prettyPrint:S().default(!0).describe(`Pretty-print XML output with indentation`),namespacePrefix:r().default(`bpmn`).describe(`XML namespace prefix for BPMN elements`)}).describe(`Options for exporting an ObjectStack flow as BPMN 2.0 XML`),OQ=h({severity:E([`info`,`warning`,`error`]).describe(`Diagnostic severity`),message:r().describe(`Diagnostic message`),bpmnElementId:r().optional().describe(`BPMN element ID related to this diagnostic`),nodeId:r().optional().describe(`ObjectStack node ID related to this diagnostic`)}).describe(`Diagnostic message from BPMN import/export`),Lke=h({success:S().describe(`Whether the operation completed successfully`),diagnostics:C(OQ).default([]).describe(`Diagnostic messages from the operation`),mappedCount:P().int().min(0).default(0).describe(`Number of elements successfully mapped`),unmappedCount:P().int().min(0).default(0).describe(`Number of elements that could not be mapped`)}).describe(`Result of a BPMN import/export operation`),Rke=[{bpmnType:`bpmn:startEvent`,flowNodeAction:`start`,bidirectional:!0},{bpmnType:`bpmn:endEvent`,flowNodeAction:`end`,bidirectional:!0},{bpmnType:`bpmn:exclusiveGateway`,flowNodeAction:`decision`,bidirectional:!0},{bpmnType:`bpmn:parallelGateway`,flowNodeAction:`parallel_gateway`,bidirectional:!0},{bpmnType:`bpmn:serviceTask`,flowNodeAction:`http_request`,bidirectional:!0,notes:`Maps HTTP/connector tasks`},{bpmnType:`bpmn:scriptTask`,flowNodeAction:`script`,bidirectional:!0},{bpmnType:`bpmn:userTask`,flowNodeAction:`screen`,bidirectional:!0},{bpmnType:`bpmn:callActivity`,flowNodeAction:`subflow`,bidirectional:!0},{bpmnType:`bpmn:intermediateCatchEvent`,flowNodeAction:`wait`,bidirectional:!0,notes:`Timer/signal/message catch events`},{bpmnType:`bpmn:boundaryEvent`,flowNodeAction:`boundary_event`,bidirectional:!0},{bpmnType:`bpmn:task`,flowNodeAction:`assignment`,bidirectional:!0,notes:`Generic BPMN task maps to assignment`}];DA({},{AckModeSchema:()=>m$,ApiVersionConfigSchema:()=>QQ,BuildConfigSchema:()=>A$,CdcConfigSchema:()=>r$,CircuitBreakerConfigSchema:()=>WQ,ConflictResolutionSchema:()=>jQ,ConnectorActionSchema:()=>JQ,ConnectorHealthSchema:()=>GQ,ConnectorSchema:()=>XQ,ConnectorStatusSchema:()=>qQ,ConnectorTriggerSchema:()=>YQ,ConnectorTypeSchema:()=>KQ,ConsumerConfigSchema:()=>g$,DataSyncConfigSchema:()=>MQ,DatabaseConnectorSchema:()=>Uke,DatabasePoolConfigSchema:()=>t$,DatabaseProviderSchema:()=>e$,DatabaseTableSchema:()=>i$,DeliveryGuaranteeSchema:()=>h$,DeploymentConfigSchema:()=>j$,DlqConfigSchema:()=>v$,DomainConfigSchema:()=>M$,EdgeFunctionConfigSchema:()=>P$,EnvironmentVariablesSchema:()=>N$,ErrorCategorySchema:()=>BQ,ErrorMappingConfigSchema:()=>HQ,ErrorMappingRuleSchema:()=>VQ,FieldMappingSchema:()=>kQ,FileAccessPatternSchema:()=>o$,FileFilterConfigSchema:()=>u$,FileMetadataConfigSchema:()=>s$,FileStorageConnectorSchema:()=>qke,FileStorageProviderSchema:()=>a$,FileVersioningConfigSchema:()=>l$,GitHubActionsWorkflowSchema:()=>w$,GitHubCommitConfigSchema:()=>S$,GitHubConnectorSchema:()=>nAe,GitHubIssueTrackingSchema:()=>E$,GitHubProviderSchema:()=>b$,GitHubPullRequestConfigSchema:()=>C$,GitHubReleaseConfigSchema:()=>T$,GitHubRepositorySchema:()=>x$,GitRepositoryConfigSchema:()=>k$,HealthCheckConfigSchema:()=>UQ,MessageFormatSchema:()=>p$,MessageQueueConnectorSchema:()=>Zke,MessageQueueProviderSchema:()=>f$,MultipartUploadConfigSchema:()=>c$,ProducerConfigSchema:()=>_$,RateLimitConfigSchema:()=>LQ,RateLimitStrategySchema:()=>IQ,RetryConfigSchema:()=>zQ,RetryStrategySchema:()=>RQ,SaasConnectorSchema:()=>Bke,SaasObjectTypeSchema:()=>$Q,SaasProviderSchema:()=>ZQ,SslConfigSchema:()=>n$,StorageBucketSchema:()=>d$,SyncStrategySchema:()=>AQ,TopicQueueSchema:()=>y$,VercelConnectorSchema:()=>aAe,VercelFrameworkSchema:()=>O$,VercelMonitoringSchema:()=>I$,VercelProjectSchema:()=>F$,VercelProviderSchema:()=>D$,VercelTeamSchema:()=>L$,WebhookConfigSchema:()=>FQ,WebhookEventSchema:()=>NQ,WebhookSignatureAlgorithmSchema:()=>PQ,azureBlobConnectorExample:()=>Xke,githubEnterpriseConnectorExample:()=>iAe,githubPublicConnectorExample:()=>rAe,googleDriveConnectorExample:()=>Yke,hubspotConnectorExample:()=>Hke,kafkaConnectorExample:()=>Qke,mongoConnectorExample:()=>Gke,postgresConnectorExample:()=>Wke,pubsubConnectorExample:()=>tAe,rabbitmqConnectorExample:()=>$ke,s3ConnectorExample:()=>Jke,salesforceConnectorExample:()=>Vke,snowflakeConnectorExample:()=>Kke,sqsConnectorExample:()=>eAe,vercelNextJsConnectorExample:()=>oAe,vercelStaticSiteConnectorExample:()=>sAe});var zke=I(`type`,[h({type:m(`oauth2`),authorizationUrl:r().url().describe(`OAuth2 authorization endpoint`),tokenUrl:r().url().describe(`OAuth2 token endpoint`),clientId:r().describe(`OAuth2 client ID`),clientSecret:r().describe(`OAuth2 client secret (typically from ENV)`),scopes:C(r()).optional().describe(`Requested OAuth2 scopes`),redirectUri:r().url().optional().describe(`OAuth2 redirect URI`),refreshToken:r().optional().describe(`Refresh token for token renewal`),tokenExpiry:P().optional().describe(`Token expiry timestamp`)}),h({type:m(`api-key`),key:r().describe(`API key value`),headerName:r().default(`X-API-Key`).describe(`HTTP header name for API key`),paramName:r().optional().describe(`Query parameter name (alternative to header)`)}),h({type:m(`basic`),username:r().describe(`Username`),password:r().describe(`Password`)}),h({type:m(`bearer`),token:r().describe(`Bearer token`)}),h({type:m(`none`)})]),kQ=MA.extend({dataType:E([`string`,`number`,`boolean`,`date`,`datetime`,`json`,`array`]).optional().describe(`Target data type`),required:S().default(!1).describe(`Field is required`),syncMode:E([`read_only`,`write_only`,`bidirectional`]).default(`bidirectional`).describe(`Sync mode`)}),AQ=E([`full`,`incremental`,`upsert`,`append_only`]).describe(`Synchronization strategy`),jQ=E([`source_wins`,`target_wins`,`latest_wins`,`manual`]).describe(`Conflict resolution strategy`),MQ=h({strategy:AQ.optional().default(`incremental`),direction:E([`import`,`export`,`bidirectional`]).optional().default(`import`).describe(`Sync direction`),schedule:r().optional().describe(`Cron expression for scheduled sync`),realtimeSync:S().optional().default(!1).describe(`Enable real-time sync`),timestampField:r().optional().describe(`Field to track last modification time`),conflictResolution:jQ.optional().default(`latest_wins`),batchSize:P().min(1).max(1e4).optional().default(1e3).describe(`Records per batch`),deleteMode:E([`hard_delete`,`soft_delete`,`ignore`]).optional().default(`soft_delete`).describe(`Delete handling mode`),filters:d(r(),u()).optional().describe(`Filter criteria for selective sync`)}),NQ=E([`record.created`,`record.updated`,`record.deleted`,`sync.started`,`sync.completed`,`sync.failed`,`auth.expired`,`rate_limit.exceeded`]).describe(`Webhook event type`),PQ=E([`hmac_sha256`,`hmac_sha512`,`none`]).describe(`Webhook signature algorithm`),FQ=YZ.extend({events:C(NQ).optional().describe(`Connector events to subscribe to`),signatureAlgorithm:PQ.optional().default(`hmac_sha256`)}),IQ=E([`fixed_window`,`sliding_window`,`token_bucket`,`leaky_bucket`]).describe(`Rate limiting strategy`),LQ=h({strategy:IQ.optional().default(`token_bucket`),maxRequests:P().min(1).describe(`Maximum requests per window`),windowSeconds:P().min(1).describe(`Time window in seconds`),burstCapacity:P().min(1).optional().describe(`Burst capacity`),respectUpstreamLimits:S().optional().default(!0).describe(`Respect external rate limit headers`),rateLimitHeaders:h({remaining:r().optional().default(`X-RateLimit-Remaining`).describe(`Header for remaining requests`),limit:r().optional().default(`X-RateLimit-Limit`).describe(`Header for rate limit`),reset:r().optional().default(`X-RateLimit-Reset`).describe(`Header for reset time`)}).optional().describe(`Custom rate limit headers`)}),RQ=E([`exponential_backoff`,`linear_backoff`,`fixed_delay`,`no_retry`]).describe(`Retry strategy`),zQ=h({strategy:RQ.optional().default(`exponential_backoff`),maxAttempts:P().min(0).max(10).optional().default(3).describe(`Maximum retry attempts`),initialDelayMs:P().min(100).optional().default(1e3).describe(`Initial retry delay in ms`),maxDelayMs:P().min(1e3).optional().default(6e4).describe(`Maximum retry delay in ms`),backoffMultiplier:P().min(1).optional().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:C(P()).optional().default([408,429,500,502,503,504]).describe(`HTTP status codes to retry`),retryOnNetworkError:S().optional().default(!0).describe(`Retry on network errors`),jitter:S().optional().default(!0).describe(`Add jitter to retry delays`)}),BQ=E([`validation`,`authorization`,`not_found`,`conflict`,`rate_limit`,`timeout`,`server_error`,`integration_error`]).describe(`Standard error category`),VQ=h({sourceCode:l([r(),P()]).describe(`External system error code`),sourceMessage:r().optional().describe(`Pattern to match against error message`),targetCode:r().describe(`ObjectStack standard error code`),targetCategory:BQ.describe(`Error category`),severity:E([`low`,`medium`,`high`,`critical`]).describe(`Error severity level`),retryable:S().describe(`Whether the error is retryable`),userMessage:r().optional().describe(`Human-readable message to show users`)}).describe(`Error mapping rule`),HQ=h({rules:C(VQ).describe(`Error mapping rules`),defaultCategory:BQ.optional().default(`integration_error`).describe(`Default category for unmapped errors`),unmappedBehavior:E([`passthrough`,`generic_error`,`throw`]).describe(`What to do with unmapped errors`),logUnmapped:S().optional().default(!0).describe(`Log unmapped errors`)}).describe(`Error mapping configuration`),UQ=h({enabled:S().describe(`Enable health checks`),intervalMs:P().optional().default(6e4).describe(`Health check interval in milliseconds`),timeoutMs:P().optional().default(5e3).describe(`Health check timeout in milliseconds`),endpoint:r().optional().describe(`Health check endpoint path`),method:E([`GET`,`HEAD`,`OPTIONS`]).optional().describe(`HTTP method for health check`),expectedStatus:P().optional().default(200).describe(`Expected HTTP status code`),unhealthyThreshold:P().optional().default(3).describe(`Consecutive failures before marking unhealthy`),healthyThreshold:P().optional().default(1).describe(`Consecutive successes before marking healthy`)}).describe(`Health check configuration`),WQ=h({enabled:S().describe(`Enable circuit breaker`),failureThreshold:P().optional().default(5).describe(`Failures before opening circuit`),resetTimeoutMs:P().optional().default(3e4).describe(`Time in open state before half-open`),halfOpenMaxRequests:P().optional().default(1).describe(`Requests allowed in half-open state`),monitoringWindow:P().optional().default(6e4).describe(`Rolling window for failure count in ms`),fallbackStrategy:E([`cache`,`default_value`,`error`,`queue`]).optional().describe(`Fallback strategy when circuit is open`)}).describe(`Circuit breaker configuration`),GQ=h({healthCheck:UQ.optional().describe(`Health check configuration`),circuitBreaker:WQ.optional().describe(`Circuit breaker configuration`)}).describe(`Connector health configuration`),KQ=E([`saas`,`database`,`file_storage`,`message_queue`,`api`,`custom`]).describe(`Connector type`),qQ=E([`active`,`inactive`,`error`,`configuring`]).describe(`Connector status`),JQ=h({key:r().describe(`Action key (machine name)`),label:r().describe(`Human readable label`),description:r().optional(),inputSchema:d(r(),u()).optional().describe(`Input parameters schema (JSON Schema)`),outputSchema:d(r(),u()).optional().describe(`Output schema (JSON Schema)`)}),YQ=h({key:r().describe(`Trigger key`),label:r().describe(`Trigger label`),description:r().optional(),type:E([`polling`,`webhook`]).describe(`Trigger type`),interval:P().optional().describe(`Polling interval in seconds`)}),XQ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique connector identifier`),label:r().describe(`Display label`),type:KQ.describe(`Connector type`),description:r().optional().describe(`Connector description`),icon:r().optional().describe(`Icon identifier`),authentication:zke.describe(`Authentication configuration`),actions:C(JQ).optional(),triggers:C(YQ).optional(),syncConfig:MQ.optional().describe(`Data sync configuration`),fieldMappings:C(kQ).optional().describe(`Field mapping rules`),webhooks:C(FQ).optional().describe(`Webhook configurations`),rateLimitConfig:LQ.optional().describe(`Rate limiting configuration`),retryConfig:zQ.optional().describe(`Retry configuration`),connectionTimeoutMs:P().min(1e3).max(3e5).optional().default(3e4).describe(`Connection timeout in ms`),requestTimeoutMs:P().min(1e3).max(3e5).optional().default(3e4).describe(`Request timeout in ms`),status:qQ.optional().default(`inactive`).describe(`Connector status`),enabled:S().optional().default(!0).describe(`Enable connector`),errorMapping:HQ.optional().describe(`Error mapping configuration`),health:GQ.optional().describe(`Health and resilience configuration`),metadata:d(r(),u()).optional().describe(`Custom connector metadata`)}),ZQ=E([`salesforce`,`hubspot`,`stripe`,`shopify`,`zendesk`,`intercom`,`mailchimp`,`slack`,`microsoft_dynamics`,`servicenow`,`netsuite`,`custom`]).describe(`SaaS provider type`),QQ=h({version:r().describe(`API version (e.g., "v2", "2023-10-01")`),isDefault:S().default(!1).describe(`Is this the default version`),deprecationDate:r().optional().describe(`API version deprecation date (ISO 8601)`),sunsetDate:r().optional().describe(`API version sunset date (ISO 8601)`)}),$Q=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object type name (snake_case)`),label:r().describe(`Display label`),apiName:r().describe(`API name in external system`),enabled:S().default(!0).describe(`Enable sync for this object`),supportsCreate:S().default(!0).describe(`Supports record creation`),supportsUpdate:S().default(!0).describe(`Supports record updates`),supportsDelete:S().default(!0).describe(`Supports record deletion`),fieldMappings:C(kQ).optional().describe(`Object-specific field mappings`)}),Bke=XQ.extend({type:m(`saas`),provider:ZQ.describe(`SaaS provider type`),baseUrl:r().url().describe(`API base URL`),apiVersion:QQ.optional().describe(`API version configuration`),objectTypes:C($Q).describe(`Syncable object types`),oauthSettings:h({scopes:C(r()).describe(`Required OAuth scopes`),refreshTokenUrl:r().url().optional().describe(`Token refresh endpoint`),revokeTokenUrl:r().url().optional().describe(`Token revocation endpoint`),autoRefresh:S().default(!0).describe(`Automatically refresh expired tokens`)}).optional().describe(`OAuth-specific configuration`),paginationConfig:h({type:E([`cursor`,`offset`,`page`]).default(`cursor`).describe(`Pagination type`),defaultPageSize:P().min(1).max(1e3).default(100).describe(`Default page size`),maxPageSize:P().min(1).max(1e4).default(1e3).describe(`Maximum page size`)}).optional().describe(`Pagination configuration`),sandboxConfig:h({enabled:S().default(!1).describe(`Use sandbox environment`),baseUrl:r().url().optional().describe(`Sandbox API base URL`)}).optional().describe(`Sandbox environment configuration`),customHeaders:d(r(),r()).optional().describe(`Custom HTTP headers for all requests`)}),Vke={name:`salesforce_production`,label:`Salesforce Production`,type:`saas`,provider:`salesforce`,baseUrl:`https://example.my.salesforce.com`,apiVersion:{version:`v59.0`,isDefault:!0},authentication:{type:`oauth2`,clientId:"${SALESFORCE_CLIENT_ID}",clientSecret:"${SALESFORCE_CLIENT_SECRET}",authorizationUrl:`https://login.salesforce.com/services/oauth2/authorize`,tokenUrl:`https://login.salesforce.com/services/oauth2/token`,grantType:`authorization_code`,scopes:[`api`,`refresh_token`,`offline_access`]},objectTypes:[{name:`account`,label:`Account`,apiName:`Account`,enabled:!0,supportsCreate:!0,supportsUpdate:!0,supportsDelete:!0},{name:`contact`,label:`Contact`,apiName:`Contact`,enabled:!0,supportsCreate:!0,supportsUpdate:!0,supportsDelete:!0}],syncConfig:{strategy:`incremental`,direction:`bidirectional`,schedule:`0 */6 * * *`,realtimeSync:!0,conflictResolution:`latest_wins`,batchSize:200,deleteMode:`soft_delete`},rateLimitConfig:{strategy:`token_bucket`,maxRequests:100,windowSeconds:20,respectUpstreamLimits:!0},retryConfig:{strategy:`exponential_backoff`,maxAttempts:3,initialDelayMs:1e3,maxDelayMs:3e4,backoffMultiplier:2,retryableStatusCodes:[408,429,500,502,503,504],retryOnNetworkError:!0,jitter:!0},status:`active`,enabled:!0},Hke={name:`hubspot_crm`,label:`HubSpot CRM`,type:`saas`,provider:`hubspot`,baseUrl:`https://api.hubapi.com`,authentication:{type:`api_key`,apiKey:"${HUBSPOT_API_KEY}",headerName:`Authorization`},objectTypes:[{name:`company`,label:`Company`,apiName:`companies`,enabled:!0,supportsCreate:!0,supportsUpdate:!0,supportsDelete:!0},{name:`deal`,label:`Deal`,apiName:`deals`,enabled:!0,supportsCreate:!0,supportsUpdate:!0,supportsDelete:!0}],syncConfig:{strategy:`incremental`,direction:`import`,schedule:`0 */4 * * *`,conflictResolution:`source_wins`,batchSize:100},rateLimitConfig:{strategy:`token_bucket`,maxRequests:100,windowSeconds:10},status:`active`,enabled:!0},e$=E([`postgresql`,`mysql`,`mariadb`,`mssql`,`oracle`,`mongodb`,`redis`,`cassandra`,`snowflake`,`bigquery`,`redshift`,`custom`]).describe(`Database provider type`),t$=h({min:P().min(0).default(2).describe(`Minimum connections in pool`),max:P().min(1).default(10).describe(`Maximum connections in pool`),idleTimeoutMs:P().min(1e3).default(3e4).describe(`Idle connection timeout in ms`),connectionTimeoutMs:P().min(1e3).default(1e4).describe(`Connection establishment timeout in ms`),acquireTimeoutMs:P().min(1e3).default(3e4).describe(`Connection acquisition timeout in ms`),evictionRunIntervalMs:P().min(1e3).default(3e4).describe(`Connection eviction check interval in ms`),testOnBorrow:S().default(!0).describe(`Test connection before use`)}),n$=h({enabled:S().default(!1).describe(`Enable SSL/TLS`),rejectUnauthorized:S().default(!0).describe(`Reject unauthorized certificates`),ca:r().optional().describe(`Certificate Authority certificate`),cert:r().optional().describe(`Client certificate`),key:r().optional().describe(`Client private key`)}),r$=h({enabled:S().default(!1).describe(`Enable CDC`),method:E([`log_based`,`trigger_based`,`query_based`,`custom`]).describe(`CDC method`),slotName:r().optional().describe(`Replication slot name (for log-based CDC)`),publicationName:r().optional().describe(`Publication name (for PostgreSQL)`),startPosition:r().optional().describe(`Starting position/LSN for CDC stream`),batchSize:P().min(1).max(1e4).default(1e3).describe(`CDC batch size`),pollIntervalMs:P().min(100).default(1e3).describe(`CDC polling interval in ms`)}),i$=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Table name in ObjectStack (snake_case)`),label:r().describe(`Display label`),schema:r().optional().describe(`Database schema name`),tableName:r().describe(`Actual table name in database`),primaryKey:r().describe(`Primary key column`),enabled:S().default(!0).describe(`Enable sync for this table`),fieldMappings:C(kQ).optional().describe(`Table-specific field mappings`),whereClause:r().optional().describe(`SQL WHERE clause for filtering`)}),Uke=XQ.extend({type:m(`database`),provider:e$.describe(`Database provider type`),connectionConfig:h({host:r().describe(`Database host`),port:P().min(1).max(65535).describe(`Database port`),database:r().describe(`Database name`),username:r().describe(`Database username`),password:r().describe(`Database password (typically from ENV)`),options:d(r(),u()).optional().describe(`Driver-specific connection options`)}).describe(`Database connection configuration`),poolConfig:t$.optional().describe(`Connection pool configuration`),sslConfig:n$.optional().describe(`SSL/TLS configuration`),tables:C(i$).describe(`Tables to sync`),cdcConfig:r$.optional().describe(`CDC configuration`),readReplicaConfig:h({enabled:S().default(!1).describe(`Use read replicas`),hosts:C(h({host:r().describe(`Replica host`),port:P().min(1).max(65535).describe(`Replica port`),weight:P().min(0).max(1).default(1).describe(`Load balancing weight`)})).describe(`Read replica hosts`)}).optional().describe(`Read replica configuration`),queryTimeoutMs:P().min(1e3).max(3e5).optional().default(3e4).describe(`Query timeout in ms`),enableQueryLogging:S().optional().default(!1).describe(`Enable SQL query logging`)}),Wke={name:`postgres_production`,label:`Production PostgreSQL`,type:`database`,provider:`postgresql`,authentication:{type:`basic`,username:"${DB_USERNAME}",password:"${DB_PASSWORD}"},connectionConfig:{host:`db.example.com`,port:5432,database:`production`,username:"${DB_USERNAME}",password:"${DB_PASSWORD}"},poolConfig:{min:2,max:20,idleTimeoutMs:3e4,connectionTimeoutMs:1e4,acquireTimeoutMs:3e4,evictionRunIntervalMs:3e4,testOnBorrow:!0},sslConfig:{enabled:!0,rejectUnauthorized:!0},tables:[{name:`customer`,label:`Customer`,schema:`public`,tableName:`customers`,primaryKey:`id`,enabled:!0},{name:`order`,label:`Order`,schema:`public`,tableName:`orders`,primaryKey:`id`,enabled:!0,whereClause:`status != 'archived'`}],cdcConfig:{enabled:!0,method:`log_based`,slotName:`objectstack_replication_slot`,publicationName:`objectstack_publication`,batchSize:1e3,pollIntervalMs:1e3},syncConfig:{strategy:`incremental`,direction:`bidirectional`,realtimeSync:!0,conflictResolution:`latest_wins`,batchSize:1e3,deleteMode:`soft_delete`},status:`active`,enabled:!0},Gke={name:`mongodb_analytics`,label:`MongoDB Analytics`,type:`database`,provider:`mongodb`,authentication:{type:`basic`,username:"${MONGO_USERNAME}",password:"${MONGO_PASSWORD}"},connectionConfig:{host:`mongodb.example.com`,port:27017,database:`analytics`,username:"${MONGO_USERNAME}",password:"${MONGO_PASSWORD}",options:{authSource:`admin`,replicaSet:`rs0`}},tables:[{name:`event`,label:`Event`,tableName:`events`,primaryKey:`id`,enabled:!0}],cdcConfig:{enabled:!0,method:`log_based`,batchSize:1e3,pollIntervalMs:500},syncConfig:{strategy:`incremental`,direction:`import`,batchSize:1e3},status:`active`,enabled:!0},Kke={name:`snowflake_warehouse`,label:`Snowflake Data Warehouse`,type:`database`,provider:`snowflake`,authentication:{type:`basic`,username:"${SNOWFLAKE_USERNAME}",password:"${SNOWFLAKE_PASSWORD}"},connectionConfig:{host:`account.snowflakecomputing.com`,port:443,database:`ANALYTICS_DB`,username:"${SNOWFLAKE_USERNAME}",password:"${SNOWFLAKE_PASSWORD}",options:{warehouse:`COMPUTE_WH`,schema:`PUBLIC`,role:`ANALYST`}},tables:[{name:`sales_summary`,label:`Sales Summary`,schema:`PUBLIC`,tableName:`SALES_SUMMARY`,primaryKey:`ID`,enabled:!0}],syncConfig:{strategy:`full`,direction:`import`,schedule:`0 2 * * *`,batchSize:5e3},queryTimeoutMs:6e4,status:`active`,enabled:!0},a$=E([`s3`,`azure_blob`,`gcs`,`dropbox`,`box`,`onedrive`,`google_drive`,`sharepoint`,`ftp`,`local`,`custom`]).describe(`File storage provider type`),o$=E([`public_read`,`private`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full`]).describe(`File access pattern`),s$=h({extractMetadata:S().default(!0).describe(`Extract file metadata`),metadataFields:C(E([`content_type`,`file_size`,`last_modified`,`etag`,`checksum`,`creator`,`created_at`,`custom`])).optional().describe(`Metadata fields to extract`),customMetadata:d(r(),r()).optional().describe(`Custom metadata key-value pairs`)}),c$=h({enabled:S().default(!0).describe(`Enable multipart uploads`),partSize:P().min(5*1024*1024).default(5*1024*1024).describe(`Part size in bytes (min 5MB)`),maxConcurrentParts:P().min(1).max(10).default(5).describe(`Maximum concurrent part uploads`),threshold:P().min(5*1024*1024).default(100*1024*1024).describe(`File size threshold for multipart upload in bytes`)}),l$=h({enabled:S().default(!1).describe(`Enable file versioning`),maxVersions:P().min(1).max(100).optional().describe(`Maximum versions to retain`),retentionDays:P().min(1).optional().describe(`Version retention period in days`)}),u$=h({includePatterns:C(r()).optional().describe(`File patterns to include (glob)`),excludePatterns:C(r()).optional().describe(`File patterns to exclude (glob)`),minFileSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxFileSize:P().min(1).optional().describe(`Maximum file size in bytes`),allowedExtensions:C(r()).optional().describe(`Allowed file extensions`),blockedExtensions:C(r()).optional().describe(`Blocked file extensions`)}),d$=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Bucket identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),bucketName:r().describe(`Actual bucket/container name in storage system`),region:r().optional().describe(`Storage region`),enabled:S().default(!0).describe(`Enable sync for this bucket`),prefix:r().optional().describe(`Prefix/path within bucket`),accessPattern:o$.optional().describe(`Access pattern`),fileFilters:u$.optional().describe(`File filter configuration`)}),qke=XQ.extend({type:m(`file_storage`),provider:a$.describe(`File storage provider type`),storageConfig:h({endpoint:r().url().optional().describe(`Custom endpoint URL`),region:r().optional().describe(`Default region`),pathStyle:S().optional().default(!1).describe(`Use path-style URLs (for S3-compatible)`)}).optional().describe(`Storage configuration`),buckets:C(d$).describe(`Buckets/containers to sync`),metadataConfig:s$.optional().describe(`Metadata extraction configuration`),multipartConfig:c$.optional().describe(`Multipart upload configuration`),versioningConfig:l$.optional().describe(`File versioning configuration`),encryption:h({enabled:S().default(!1).describe(`Enable server-side encryption`),algorithm:E([`AES256`,`aws:kms`,`custom`]).optional().describe(`Encryption algorithm`),kmsKeyId:r().optional().describe(`KMS key ID (for aws:kms)`)}).optional().describe(`Encryption configuration`),lifecyclePolicy:h({enabled:S().default(!1).describe(`Enable lifecycle policy`),deleteAfterDays:P().min(1).optional().describe(`Delete files after N days`),archiveAfterDays:P().min(1).optional().describe(`Archive files after N days`)}).optional().describe(`Lifecycle policy`),contentProcessing:h({extractText:S().default(!1).describe(`Extract text from documents`),generateThumbnails:S().default(!1).describe(`Generate image thumbnails`),thumbnailSizes:C(h({width:P().min(1),height:P().min(1)})).optional().describe(`Thumbnail sizes`),virusScan:S().default(!1).describe(`Scan for viruses`)}).optional().describe(`Content processing configuration`),bufferSize:P().min(1024).default(64*1024).describe(`Buffer size in bytes`),transferAcceleration:S().default(!1).describe(`Enable transfer acceleration`)}),Jke={name:`s3_production_assets`,label:`Production S3 Assets`,type:`file_storage`,provider:`s3`,authentication:{type:`api_key`,apiKey:"${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}",headerName:`Authorization`},storageConfig:{region:`us-east-1`,pathStyle:!1},buckets:[{name:`product_images`,label:`Product Images`,bucketName:`my-company-product-images`,region:`us-east-1`,enabled:!0,prefix:`products/`,accessPattern:`public_read`,fileFilters:{allowedExtensions:[`.jpg`,`.jpeg`,`.png`,`.webp`],maxFileSize:10*1024*1024}},{name:`customer_documents`,label:`Customer Documents`,bucketName:`my-company-customer-docs`,region:`us-east-1`,enabled:!0,accessPattern:`private`,fileFilters:{allowedExtensions:[`.pdf`,`.docx`,`.xlsx`],maxFileSize:50*1024*1024}}],metadataConfig:{extractMetadata:!0,metadataFields:[`content_type`,`file_size`,`last_modified`,`etag`]},multipartConfig:{enabled:!0,partSize:5*1024*1024,maxConcurrentParts:5,threshold:100*1024*1024},versioningConfig:{enabled:!0,maxVersions:10},encryption:{enabled:!0,algorithm:`aws:kms`,kmsKeyId:"${AWS_KMS_KEY_ID}"},contentProcessing:{extractText:!0,generateThumbnails:!0,thumbnailSizes:[{width:150,height:150},{width:300,height:300},{width:600,height:600}],virusScan:!0},syncConfig:{strategy:`incremental`,direction:`bidirectional`,realtimeSync:!0,conflictResolution:`latest_wins`,batchSize:100},transferAcceleration:!0,status:`active`,enabled:!0},Yke={name:`google_drive_team`,label:`Google Drive Team Folder`,type:`file_storage`,provider:`google_drive`,authentication:{type:`oauth2`,clientId:"${GOOGLE_CLIENT_ID}",clientSecret:"${GOOGLE_CLIENT_SECRET}",authorizationUrl:`https://accounts.google.com/o/oauth2/v2/auth`,tokenUrl:`https://oauth2.googleapis.com/token`,grantType:`authorization_code`,scopes:[`https://www.googleapis.com/auth/drive.file`]},buckets:[{name:`team_drive`,label:`Team Drive`,bucketName:`shared-team-drive`,enabled:!0,fileFilters:{excludePatterns:[`*.tmp`,`~$*`]}}],metadataConfig:{extractMetadata:!0,metadataFields:[`content_type`,`file_size`,`last_modified`,`creator`,`created_at`]},versioningConfig:{enabled:!0,maxVersions:5},syncConfig:{strategy:`incremental`,direction:`bidirectional`,realtimeSync:!0,conflictResolution:`latest_wins`,batchSize:50},status:`active`,enabled:!0},Xke={name:`azure_blob_storage`,label:`Azure Blob Storage`,type:`file_storage`,provider:`azure_blob`,authentication:{type:`api_key`,apiKey:"${AZURE_STORAGE_ACCOUNT_KEY}",headerName:`x-ms-blob-type`},storageConfig:{endpoint:`https://myaccount.blob.core.windows.net`},buckets:[{name:`archive_container`,label:`Archive Container`,bucketName:`archive`,enabled:!0,accessPattern:`private`}],metadataConfig:{extractMetadata:!0,metadataFields:[`content_type`,`file_size`,`last_modified`,`etag`]},encryption:{enabled:!0,algorithm:`AES256`},lifecyclePolicy:{enabled:!0,archiveAfterDays:90,deleteAfterDays:365},syncConfig:{strategy:`incremental`,direction:`import`,schedule:`0 1 * * *`,batchSize:200},status:`active`,enabled:!0},f$=E([`rabbitmq`,`kafka`,`redis_pubsub`,`redis_streams`,`aws_sqs`,`aws_sns`,`google_pubsub`,`azure_service_bus`,`azure_event_hubs`,`nats`,`pulsar`,`activemq`,`custom`]).describe(`Message queue provider type`),p$=E([`json`,`xml`,`protobuf`,`avro`,`text`,`binary`]).describe(`Message format/serialization`),m$=E([`auto`,`manual`,`client`]).describe(`Message acknowledgment mode`),h$=E([`at_most_once`,`at_least_once`,`exactly_once`]).describe(`Message delivery guarantee`),g$=h({enabled:S().optional().default(!0).describe(`Enable consumer`),consumerGroup:r().optional().describe(`Consumer group ID`),concurrency:P().min(1).max(100).optional().default(1).describe(`Number of concurrent consumers`),prefetchCount:P().min(1).max(1e3).optional().default(10).describe(`Prefetch count`),ackMode:m$.optional().default(`manual`),autoCommit:S().optional().default(!1).describe(`Auto-commit offsets`),autoCommitIntervalMs:P().min(100).optional().default(5e3).describe(`Auto-commit interval in ms`),sessionTimeoutMs:P().min(1e3).optional().default(3e4).describe(`Session timeout in ms`),rebalanceTimeoutMs:P().min(1e3).optional().describe(`Rebalance timeout in ms`)}),_$=h({enabled:S().optional().default(!0).describe(`Enable producer`),acks:E([`0`,`1`,`all`]).optional().default(`all`).describe(`Acknowledgment level`),compressionType:E([`none`,`gzip`,`snappy`,`lz4`,`zstd`]).optional().default(`none`).describe(`Compression type`),batchSize:P().min(1).optional().default(16384).describe(`Batch size in bytes`),lingerMs:P().min(0).optional().default(0).describe(`Linger time in ms`),maxInFlightRequests:P().min(1).optional().default(5).describe(`Max in-flight requests`),idempotence:S().optional().default(!0).describe(`Enable idempotent producer`),transactional:S().optional().default(!1).describe(`Enable transactional producer`),transactionTimeoutMs:P().min(1e3).optional().describe(`Transaction timeout in ms`)}),v$=h({enabled:S().optional().default(!1).describe(`Enable DLQ`),queueName:r().describe(`Dead letter queue/topic name`),maxRetries:P().min(0).max(100).optional().default(3).describe(`Max retries before DLQ`),retryDelayMs:P().min(0).optional().default(6e4).describe(`Retry delay in ms`)}),y$=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Topic/queue identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),topicName:r().describe(`Actual topic/queue name in message queue system`),enabled:S().optional().default(!0).describe(`Enable sync for this topic/queue`),mode:E([`consumer`,`producer`,`both`]).optional().default(`both`).describe(`Consumer, producer, or both`),messageFormat:p$.optional().default(`json`),partitions:P().min(1).optional().describe(`Number of partitions (for Kafka)`),replicationFactor:P().min(1).optional().describe(`Replication factor (for Kafka)`),consumerConfig:g$.optional().describe(`Consumer-specific configuration`),producerConfig:_$.optional().describe(`Producer-specific configuration`),dlqConfig:v$.optional().describe(`Dead letter queue configuration`),routingKey:r().optional().describe(`Routing key pattern`),messageFilter:h({headers:d(r(),r()).optional().describe(`Filter by message headers`),attributes:d(r(),u()).optional().describe(`Filter by message attributes`)}).optional().describe(`Message filter criteria`)}),Zke=XQ.extend({type:m(`message_queue`),provider:f$.describe(`Message queue provider type`),brokerConfig:h({brokers:C(r()).describe(`Broker addresses (host:port)`),clientId:r().optional().describe(`Client ID`),connectionTimeoutMs:P().min(1e3).optional().default(3e4).describe(`Connection timeout in ms`),requestTimeoutMs:P().min(1e3).optional().default(3e4).describe(`Request timeout in ms`)}).describe(`Broker connection configuration`),topics:C(y$).describe(`Topics/queues to sync`),deliveryGuarantee:h$.optional().default(`at_least_once`),sslConfig:h({enabled:S().optional().default(!1).describe(`Enable SSL/TLS`),rejectUnauthorized:S().optional().default(!0).describe(`Reject unauthorized certificates`),ca:r().optional().describe(`CA certificate`),cert:r().optional().describe(`Client certificate`),key:r().optional().describe(`Client private key`)}).optional().describe(`SSL/TLS configuration`),saslConfig:h({mechanism:E([`plain`,`scram-sha-256`,`scram-sha-512`,`aws`]).describe(`SASL mechanism`),username:r().optional().describe(`SASL username`),password:r().optional().describe(`SASL password`)}).optional().describe(`SASL authentication configuration`),schemaRegistry:h({url:r().url().describe(`Schema registry URL`),auth:h({username:r().optional(),password:r().optional()}).optional()}).optional().describe(`Schema registry configuration`),preserveOrder:S().optional().default(!0).describe(`Preserve message ordering`),enableMetrics:S().optional().default(!0).describe(`Enable message queue metrics`),enableTracing:S().optional().default(!1).describe(`Enable distributed tracing`)}),Qke={name:`kafka_production`,label:`Production Kafka Cluster`,type:`message_queue`,provider:`kafka`,authentication:{type:`none`},brokerConfig:{brokers:[`kafka-1.example.com:9092`,`kafka-2.example.com:9092`,`kafka-3.example.com:9092`],clientId:`objectstack-client`,connectionTimeoutMs:3e4,requestTimeoutMs:3e4},topics:[{name:`order_events`,label:`Order Events`,topicName:`orders`,enabled:!0,mode:`consumer`,messageFormat:`json`,partitions:10,replicationFactor:3,consumerConfig:{enabled:!0,consumerGroup:`objectstack-consumer-group`,concurrency:5,prefetchCount:100,ackMode:`manual`,autoCommit:!1,sessionTimeoutMs:3e4},dlqConfig:{enabled:!0,queueName:`orders-dlq`,maxRetries:3,retryDelayMs:6e4}},{name:`user_activity`,label:`User Activity`,topicName:`user-activity`,enabled:!0,mode:`producer`,messageFormat:`json`,partitions:5,replicationFactor:3,producerConfig:{enabled:!0,acks:`all`,compressionType:`snappy`,batchSize:16384,lingerMs:10,maxInFlightRequests:5,idempotence:!0}}],deliveryGuarantee:`at_least_once`,saslConfig:{mechanism:`scram-sha-256`,username:"${KAFKA_USERNAME}",password:"${KAFKA_PASSWORD}"},sslConfig:{enabled:!0,rejectUnauthorized:!0},preserveOrder:!0,enableMetrics:!0,enableTracing:!0,status:`active`,enabled:!0},$ke={name:`rabbitmq_events`,label:`RabbitMQ Event Bus`,type:`message_queue`,provider:`rabbitmq`,authentication:{type:`basic`,username:"${RABBITMQ_USERNAME}",password:"${RABBITMQ_PASSWORD}"},brokerConfig:{brokers:[`amqp://rabbitmq.example.com:5672`],clientId:`objectstack-rabbitmq-client`},topics:[{name:`notifications`,label:`Notifications`,topicName:`notifications`,enabled:!0,mode:`both`,messageFormat:`json`,routingKey:`notification.*`,consumerConfig:{enabled:!0,prefetchCount:10,ackMode:`manual`},producerConfig:{enabled:!0},dlqConfig:{enabled:!0,queueName:`notifications-dlq`,maxRetries:3,retryDelayMs:3e4}}],deliveryGuarantee:`at_least_once`,status:`active`,enabled:!0},eAe={name:`aws_sqs_queue`,label:`AWS SQS Queue`,type:`message_queue`,provider:`aws_sqs`,authentication:{type:`api_key`,apiKey:"${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}",headerName:`Authorization`},brokerConfig:{brokers:[`https://sqs.us-east-1.amazonaws.com`]},topics:[{name:`task_queue`,label:`Task Queue`,topicName:`task-queue`,enabled:!0,mode:`consumer`,messageFormat:`json`,consumerConfig:{enabled:!0,concurrency:10,prefetchCount:10,ackMode:`manual`},dlqConfig:{enabled:!0,queueName:`task-queue-dlq`,maxRetries:3,retryDelayMs:12e4}}],deliveryGuarantee:`at_least_once`,retryConfig:{strategy:`exponential_backoff`,maxAttempts:3,initialDelayMs:1e3,maxDelayMs:6e4,backoffMultiplier:2},status:`active`,enabled:!0},tAe={name:`gcp_pubsub`,label:`Google Cloud Pub/Sub`,type:`message_queue`,provider:`google_pubsub`,authentication:{type:`oauth2`,clientId:"${GCP_CLIENT_ID}",clientSecret:"${GCP_CLIENT_SECRET}",authorizationUrl:`https://accounts.google.com/o/oauth2/v2/auth`,tokenUrl:`https://oauth2.googleapis.com/token`,grantType:`client_credentials`,scopes:[`https://www.googleapis.com/auth/pubsub`]},brokerConfig:{brokers:[`pubsub.googleapis.com`]},topics:[{name:`analytics_events`,label:`Analytics Events`,topicName:`projects/my-project/topics/analytics-events`,enabled:!0,mode:`both`,messageFormat:`json`,consumerConfig:{enabled:!0,consumerGroup:`objectstack-subscription`,concurrency:5,prefetchCount:100,ackMode:`manual`}}],deliveryGuarantee:`at_least_once`,enableMetrics:!0,status:`active`,enabled:!0},b$=E([`github`,`github_enterprise`]).describe(`GitHub provider type`),x$=h({owner:r().describe(`Repository owner (organization or username)`),name:r().describe(`Repository name`),defaultBranch:r().optional().default(`main`).describe(`Default branch name`),autoMerge:S().optional().default(!1).describe(`Enable auto-merge for pull requests`),branchProtection:h({requiredReviewers:P().int().min(0).optional().default(1).describe(`Required number of reviewers`),requireStatusChecks:S().optional().default(!0).describe(`Require status checks to pass`),enforceAdmins:S().optional().default(!1).describe(`Enforce protections for admins`),allowForcePushes:S().optional().default(!1).describe(`Allow force pushes`),allowDeletions:S().optional().default(!1).describe(`Allow branch deletions`)}).optional().describe(`Branch protection configuration`),topics:C(r()).optional().describe(`Repository topics`)}),S$=h({authorName:r().optional().describe(`Commit author name`),authorEmail:r().email().optional().describe(`Commit author email`),signCommits:S().optional().default(!1).describe(`Sign commits with GPG`),messageTemplate:r().optional().describe(`Commit message template`),useConventionalCommits:S().optional().default(!0).describe(`Use conventional commits format`)}),C$=h({titleTemplate:r().optional().describe(`PR title template`),bodyTemplate:r().optional().describe(`PR body template`),defaultReviewers:C(r()).optional().describe(`Default reviewers (usernames)`),defaultAssignees:C(r()).optional().describe(`Default assignees (usernames)`),defaultLabels:C(r()).optional().describe(`Default labels`),draftByDefault:S().optional().default(!1).describe(`Create draft PRs by default`),deleteHeadBranch:S().optional().default(!0).describe(`Delete head branch after merge`)}),w$=h({name:r().describe(`Workflow name`),path:r().describe(`Workflow file path (e.g., .github/workflows/ci.yml)`),enabled:S().optional().default(!0).describe(`Enable workflow`),triggers:C(E([`push`,`pull_request`,`release`,`schedule`,`workflow_dispatch`,`repository_dispatch`])).optional().describe(`Workflow triggers`),env:d(r(),r()).optional().describe(`Environment variables`),secrets:C(r()).optional().describe(`Required secrets`)}),T$=h({tagPattern:r().optional().default(`v*`).describe(`Tag name pattern (e.g., v*, release/*)`),semanticVersioning:S().optional().default(!0).describe(`Use semantic versioning`),autoReleaseNotes:S().optional().default(!0).describe(`Generate release notes automatically`),releaseNameTemplate:r().optional().describe(`Release name template`),preReleasePattern:r().optional().describe(`Pre-release pattern (e.g., *-alpha, *-beta)`),draftByDefault:S().optional().default(!1).describe(`Create draft releases by default`)}),E$=h({enabled:S().optional().default(!0).describe(`Enable issue tracking`),defaultLabels:C(r()).optional().describe(`Default issue labels`),templatePaths:C(r()).optional().describe(`Issue template paths`),autoAssign:S().optional().default(!1).describe(`Auto-assign issues`),autoCloseStale:h({enabled:S().default(!1),daysBeforeStale:P().int().min(1).optional().default(60),daysBeforeClose:P().int().min(1).optional().default(7),staleLabel:r().optional().default(`stale`)}).optional().describe(`Auto-close stale issues configuration`)}),nAe=XQ.extend({type:m(`saas`),provider:b$.describe(`GitHub provider`),baseUrl:r().url().optional().default(`https://api.github.com`).describe(`GitHub API base URL`),repositories:C(x$).describe(`Repositories to manage`),commitConfig:S$.optional().describe(`Commit configuration`),pullRequestConfig:C$.optional().describe(`Pull request configuration`),workflows:C(w$).optional().describe(`GitHub Actions workflows`),releaseConfig:T$.optional().describe(`Release configuration`),issueTracking:E$.optional().describe(`Issue tracking configuration`),enableWebhooks:S().optional().default(!0).describe(`Enable GitHub webhooks`),webhookEvents:C(E([`push`,`pull_request`,`issues`,`issue_comment`,`release`,`workflow_run`,`deployment`,`deployment_status`,`check_run`,`check_suite`,`status`])).optional().describe(`Webhook events to subscribe to`)}),rAe={name:`github_public`,label:`GitHub.com`,type:`saas`,provider:`github`,baseUrl:`https://api.github.com`,authentication:{type:`oauth2`,clientId:"${GITHUB_CLIENT_ID}",clientSecret:"${GITHUB_CLIENT_SECRET}",authorizationUrl:`https://github.com/login/oauth/authorize`,tokenUrl:`https://github.com/login/oauth/access_token`,scopes:[`repo`,`workflow`,`write:packages`]},repositories:[{owner:`objectstack-ai`,name:`spec`,defaultBranch:`main`,autoMerge:!1,branchProtection:{requiredReviewers:1,requireStatusChecks:!0,enforceAdmins:!1,allowForcePushes:!1,allowDeletions:!1},topics:[`objectstack`,`low-code`,`metadata-driven`]}],commitConfig:{authorName:`ObjectStack Bot`,authorEmail:`bot@objectstack.ai`,signCommits:!1,useConventionalCommits:!0},pullRequestConfig:{titleTemplate:`{{type}}: {{description}}`,defaultReviewers:[`team-lead`],defaultLabels:[`automated`,`ai-generated`],draftByDefault:!1,deleteHeadBranch:!0},workflows:[{name:`CI`,path:`.github/workflows/ci.yml`,enabled:!0,triggers:[`push`,`pull_request`]},{name:`Release`,path:`.github/workflows/release.yml`,enabled:!0,triggers:[`release`]}],releaseConfig:{tagPattern:`v*`,semanticVersioning:!0,autoReleaseNotes:!0,releaseNameTemplate:`Release {{version}}`,draftByDefault:!1},issueTracking:{enabled:!0,defaultLabels:[`needs-triage`],autoAssign:!1,autoCloseStale:{enabled:!0,daysBeforeStale:60,daysBeforeClose:7,staleLabel:`stale`}},enableWebhooks:!0,webhookEvents:[`push`,`pull_request`,`release`,`workflow_run`],status:`active`,enabled:!0},iAe={name:`github_enterprise`,label:`GitHub Enterprise`,type:`saas`,provider:`github_enterprise`,baseUrl:`https://github.enterprise.com/api/v3`,authentication:{type:`oauth2`,clientId:"${GITHUB_ENTERPRISE_CLIENT_ID}",clientSecret:"${GITHUB_ENTERPRISE_CLIENT_SECRET}",authorizationUrl:`https://github.enterprise.com/login/oauth/authorize`,tokenUrl:`https://github.enterprise.com/login/oauth/access_token`,scopes:[`repo`,`admin:org`,`workflow`]},repositories:[{owner:`enterprise-org`,name:`internal-app`,defaultBranch:`develop`,autoMerge:!0,branchProtection:{requiredReviewers:2,requireStatusChecks:!0,enforceAdmins:!0,allowForcePushes:!1,allowDeletions:!1}}],commitConfig:{authorName:`CI Bot`,authorEmail:`ci-bot@enterprise.com`,signCommits:!0,useConventionalCommits:!0},pullRequestConfig:{titleTemplate:`[{{branch}}] {{description}}`,bodyTemplate:`## Changes + +{{changes}} + +## Testing + +{{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},D$=E([`vercel`]).describe(`Vercel provider type`),O$=E([`nextjs`,`react`,`vue`,`nuxtjs`,`gatsby`,`remix`,`astro`,`sveltekit`,`solid`,`angular`,`static`,`other`]).describe(`Frontend framework`),k$=h({type:E([`github`,`gitlab`,`bitbucket`]).describe(`Git provider`),repo:r().describe(`Repository identifier (e.g., owner/repo)`),productionBranch:r().optional().default(`main`).describe(`Production branch name`),autoDeployProduction:S().optional().default(!0).describe(`Auto-deploy production branch`),autoDeployPreview:S().optional().default(!0).describe(`Auto-deploy preview branches`)}),A$=h({buildCommand:r().optional().describe(`Build command (e.g., npm run build)`),outputDirectory:r().optional().describe(`Output directory (e.g., .next, dist)`),installCommand:r().optional().describe(`Install command (e.g., npm install, pnpm install)`),devCommand:r().optional().describe(`Development command (e.g., npm run dev)`),nodeVersion:r().optional().describe(`Node.js version (e.g., 18.x, 20.x)`),env:d(r(),r()).optional().describe(`Build environment variables`)}),j$=h({autoDeployment:S().optional().default(!0).describe(`Enable automatic deployments`),regions:C(E([`iad1`,`sfo1`,`gru1`,`lhr1`,`fra1`,`sin1`,`syd1`,`hnd1`,`icn1`])).optional().describe(`Deployment regions`),enablePreview:S().optional().default(!0).describe(`Enable preview deployments`),previewComments:S().optional().default(!0).describe(`Post preview URLs in PR comments`),productionProtection:S().optional().default(!0).describe(`Require approval for production deployments`),deployHooks:C(h({name:r().describe(`Hook name`),url:r().url().describe(`Deploy hook URL`),branch:r().optional().describe(`Target branch`)})).optional().describe(`Deploy hooks`)}),M$=h({domain:r().describe(`Domain name (e.g., app.example.com)`),httpsRedirect:S().optional().default(!0).describe(`Redirect HTTP to HTTPS`),customCertificate:h({cert:r().describe(`SSL certificate`),key:r().describe(`Private key`),ca:r().optional().describe(`Certificate authority`)}).optional().describe(`Custom SSL certificate`),gitBranch:r().optional().describe(`Git branch to deploy to this domain`)}),N$=h({key:r().describe(`Environment variable name`),value:r().describe(`Environment variable value`),target:C(E([`production`,`preview`,`development`])).describe(`Target environments`),isSecret:S().optional().default(!1).describe(`Encrypt this variable`),gitBranch:r().optional().describe(`Specific git branch`)}),P$=h({name:r().describe(`Edge function name`),path:r().describe(`Function path (e.g., /api/*)`),regions:C(r()).optional().describe(`Specific regions for this function`),memoryLimit:P().int().min(128).max(3008).optional().default(1024).describe(`Memory limit in MB`),timeout:P().int().min(1).max(300).optional().default(10).describe(`Timeout in seconds`)}),F$=h({name:r().describe(`Vercel project name`),framework:O$.optional().describe(`Frontend framework`),gitRepository:k$.optional().describe(`Git repository configuration`),buildConfig:A$.optional().describe(`Build configuration`),deploymentConfig:j$.optional().describe(`Deployment configuration`),domains:C(M$).optional().describe(`Custom domains`),environmentVariables:C(N$).optional().describe(`Environment variables`),edgeFunctions:C(P$).optional().describe(`Edge functions`),rootDirectory:r().optional().describe(`Root directory (for monorepos)`)}),I$=h({enableWebAnalytics:S().optional().default(!1).describe(`Enable Vercel Web Analytics`),enableSpeedInsights:S().optional().default(!1).describe(`Enable Vercel Speed Insights`),logDrains:C(h({name:r().describe(`Log drain name`),url:r().url().describe(`Log drain URL`),headers:d(r(),r()).optional().describe(`Custom headers`),sources:C(E([`static`,`lambda`,`edge`])).optional().describe(`Log sources`)})).optional().describe(`Log drains configuration`)}),L$=h({teamId:r().optional().describe(`Team ID or slug`),teamName:r().optional().describe(`Team name`)}),aAe=XQ.extend({type:m(`saas`),provider:D$.describe(`Vercel provider`),baseUrl:r().url().optional().default(`https://api.vercel.com`).describe(`Vercel API base URL`),team:L$.optional().describe(`Vercel team configuration`),projects:C(F$).describe(`Vercel projects`),monitoring:I$.optional().describe(`Monitoring configuration`),enableWebhooks:S().optional().default(!0).describe(`Enable Vercel webhooks`),webhookEvents:C(E([`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`)}),oAe={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},sAe={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};DA({},{ActionContributionSchema:()=>H$,ActionLocationSchema:()=>V$,ActivationEventSchema:()=>J$,BUILT_IN_NODE_DESCRIPTORS:()=>pAe,CanvasSnapSettingsSchema:()=>f1,CanvasZoomSettingsSchema:()=>p1,CommandContributionSchema:()=>K$,ERDiagramConfigSchema:()=>r1,ERLayoutAlgorithmSchema:()=>t1,ERNodeDisplaySchema:()=>n1,ElementPaletteItemSchema:()=>m1,FieldEditorConfigSchema:()=>Q$,FieldGroupSchema:()=>Z$,FieldPropertySectionSchema:()=>X$,FlowBuilderConfigSchema:()=>x1,FlowCanvasEdgeSchema:()=>fAe,FlowCanvasEdgeStyleSchema:()=>v1,FlowCanvasNodeSchema:()=>dAe,FlowLayoutAlgorithmSchema:()=>y1,FlowLayoutDirectionSchema:()=>b1,FlowNodeRenderDescriptorSchema:()=>_1,FlowNodeShapeSchema:()=>g1,InterfaceBuilderConfigSchema:()=>uAe,MetadataIconContributionSchema:()=>U$,MetadataViewerContributionSchema:()=>z$,ObjectDesignerConfigSchema:()=>d1,ObjectDesignerDefaultViewSchema:()=>u1,ObjectFilterSchema:()=>o1,ObjectListDisplayModeSchema:()=>i1,ObjectManagerConfigSchema:()=>s1,ObjectPreviewConfigSchema:()=>l1,ObjectPreviewTabSchema:()=>c1,ObjectSortFieldSchema:()=>a1,PageBuilderConfigSchema:()=>h1,PanelContributionSchema:()=>G$,PanelLocationSchema:()=>W$,RelationshipDisplaySchema:()=>$$,RelationshipMapperConfigSchema:()=>e1,SidebarGroupContributionSchema:()=>B$,StudioPluginContributionsSchema:()=>q$,StudioPluginManifestSchema:()=>Y$,ViewModeSchema:()=>R$,defineFlowBuilderConfig:()=>mAe,defineObjectDesignerConfig:()=>lAe,defineStudioPlugin:()=>cAe});var R$=E([`preview`,`design`,`code`,`data`]),z$=h({id:r().describe(`Unique viewer identifier`),metadataTypes:C(r()).min(1).describe(`Metadata types this viewer can handle`),label:r().describe(`Viewer display label`),priority:P().default(0).describe(`Viewer priority (higher wins)`),modes:C(R$).default([`preview`]).describe(`Supported view modes`)}),B$=h({key:r().describe(`Unique group key`),label:r().describe(`Group display label`),icon:r().optional().describe(`Lucide icon name`),metadataTypes:C(r()).describe(`Metadata types in this group`),order:P().default(100).describe(`Sort order (lower = higher)`)}),V$=E([`toolbar`,`contextMenu`,`commandPalette`]),H$=h({id:r().describe(`Unique action identifier`),label:r().describe(`Action display label`),icon:r().optional().describe(`Lucide icon name`),location:V$.describe(`UI location`),metadataTypes:C(r()).default([]).describe(`Applicable metadata types`)}),U$=h({metadataType:r().describe(`Metadata type`),label:r().describe(`Display label`),icon:r().describe(`Lucide icon name`)}),W$=E([`bottom`,`right`,`modal`]),G$=h({id:r().describe(`Unique panel identifier`),label:r().describe(`Panel display label`),icon:r().optional().describe(`Lucide icon name`),location:W$.default(`bottom`).describe(`Panel location`)}),K$=h({id:r().describe(`Unique command identifier`),label:r().describe(`Command display label`),shortcut:r().optional().describe(`Keyboard shortcut`),icon:r().optional().describe(`Lucide icon name`)}),q$=h({metadataViewers:C(z$).default([]),sidebarGroups:C(B$).default([]),actions:C(H$).default([]),metadataIcons:C(U$).default([]),panels:C(G$).default([]),commands:C(K$).default([])}),J$=r().describe(`Activation event pattern`),Y$=h({id:r().regex(/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/).describe(`Plugin ID (dot-separated lowercase)`),name:r().describe(`Plugin display name`),version:r().default(`0.0.1`).describe(`Plugin version`),description:r().optional().describe(`Plugin description`),author:r().optional().describe(`Author`),contributes:q$.default({metadataViewers:[],sidebarGroups:[],actions:[],metadataIcons:[],panels:[],commands:[]}),activationEvents:C(J$).default([`*`])});function cAe(e){return Y$.parse(e)}var X$=h({key:r().describe(`Section key (e.g., "basics", "constraints", "security")`),label:r().describe(`Section display label`),icon:r().optional().describe(`Lucide icon name`),defaultExpanded:S().default(!0).describe(`Whether section is expanded by default`),order:P().default(0).describe(`Sort order (lower = higher)`)}),Z$=h({key:r().describe(`Group key matching field.group values`),label:r().describe(`Group display label`),icon:r().optional().describe(`Lucide icon name`),defaultExpanded:S().default(!0).describe(`Whether group is expanded by default`),order:P().default(0).describe(`Sort order (lower = higher)`)}),Q$=h({inlineEditing:S().default(!0).describe(`Enable inline editing of field properties`),dragReorder:S().default(!0).describe(`Enable drag-and-drop field reordering`),showFieldGroups:S().default(!0).describe(`Show field group headers`),showPropertyPanel:S().default(!0).describe(`Show the right-side property panel`),propertySections:C(X$).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:C(Z$).default([]).describe(`Field group definitions`),paginationThreshold:P().default(50).describe(`Number of fields before pagination is enabled`),batchOperations:S().default(!0).describe(`Enable batch add/remove field operations`),showUsageStats:S().default(!1).describe(`Show field usage statistics`)}),$$=h({type:E([`lookup`,`master_detail`,`tree`]).describe(`Relationship type`),lineStyle:E([`solid`,`dashed`,`dotted`]).default(`solid`).describe(`Line style in diagrams`),color:r().default(`#94a3b8`).describe(`Line color (CSS value)`),highlightColor:r().default(`#0891b2`).describe(`Highlighted color on hover/select`),cardinalityLabel:r().default(`1:N`).describe(`Cardinality label (e.g., "1:N", "1:1", "N:M")`)}),e1=h({visualCreation:S().default(!0).describe(`Enable drag-to-create relationships`),showReverseRelationships:S().default(!0).describe(`Show reverse/child-to-parent relationships`),showCascadeWarnings:S().default(!0).describe(`Show cascade delete behavior warnings`),displayConfig:C($$).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`)}),t1=E([`force`,`hierarchy`,`grid`,`circular`]).describe(`ER diagram layout algorithm`),n1=h({showFields:S().default(!0).describe(`Show field list inside entity nodes`),maxFieldsVisible:P().default(8).describe(`Max fields visible before "N more..." collapse`),showFieldTypes:S().default(!0).describe(`Show field type badges`),showRequiredIndicator:S().default(!0).describe(`Show required field indicators`),showRecordCount:S().default(!1).describe(`Show live record count on nodes`),showIcon:S().default(!0).describe(`Show object icon on node header`),showDescription:S().default(!0).describe(`Show description tooltip on hover`)}),r1=h({enabled:S().default(!0).describe(`Enable ER diagram panel`),layout:t1.default(`force`).describe(`Default layout algorithm`),nodeDisplay:n1.default({showFields:!0,maxFieldsVisible:8,showFieldTypes:!0,showRequiredIndicator:!0,showRecordCount:!1,showIcon:!0,showDescription:!0}).describe(`Node display configuration`),showMinimap:S().default(!0).describe(`Show minimap for large diagrams`),zoomControls:S().default(!0).describe(`Show zoom in/out/fit controls`),minZoom:P().default(.1).describe(`Minimum zoom level`),maxZoom:P().default(3).describe(`Maximum zoom level`),showEdgeLabels:S().default(!0).describe(`Show cardinality labels on relationship edges`),highlightOnHover:S().default(!0).describe(`Highlight connected entities on node hover`),clickToNavigate:S().default(!0).describe(`Click node to navigate to object detail`),dragToConnect:S().default(!0).describe(`Drag between nodes to create relationships`),hideOrphans:S().default(!1).describe(`Hide objects with no relationships`),autoFit:S().default(!0).describe(`Auto-fit diagram to viewport on load`),exportFormats:C(E([`png`,`svg`,`json`])).default([`png`,`svg`]).describe(`Available export formats for diagram`)}),i1=E([`table`,`cards`,`tree`]).describe(`Object list display mode`),a1=E([`name`,`label`,`fieldCount`,`updatedAt`]).describe(`Object list sort field`),o1=h({package:r().optional().describe(`Filter by owning package`),tags:C(r()).optional().describe(`Filter by object tags`),includeSystem:S().default(!0).describe(`Include system-level objects`),includeAbstract:S().default(!1).describe(`Include abstract base objects`),hasFieldType:r().optional().describe(`Filter to objects containing a specific field type`),hasRelationships:S().optional().describe(`Filter to objects with lookup/master_detail fields`),searchQuery:r().optional().describe(`Free-text search across name, label, and description`)}),s1=h({defaultDisplayMode:i1.default(`table`).describe(`Default list display mode`),defaultSortField:a1.default(`label`).describe(`Default sort field`),defaultSortDirection:E([`asc`,`desc`]).default(`asc`).describe(`Default sort direction`),defaultFilter:o1.default({includeSystem:!0,includeAbstract:!1}).describe(`Default filter configuration`),showFieldCount:S().default(!0).describe(`Show field count badge`),showRelationshipCount:S().default(!0).describe(`Show relationship count badge`),showQuickPreview:S().default(!0).describe(`Show quick field preview tooltip on hover`),enableComparison:S().default(!1).describe(`Enable side-by-side object comparison`),showERDiagramToggle:S().default(!0).describe(`Show ER diagram toggle in toolbar`),showCreateAction:S().default(!0).describe(`Show create object action`),showStatsSummary:S().default(!0).describe(`Show statistics summary bar`)}),c1=h({key:r().describe(`Tab key`),label:r().describe(`Tab display label`),icon:r().optional().describe(`Lucide icon name`),enabled:S().default(!0).describe(`Whether this tab is available`),order:P().default(0).describe(`Sort order (lower = higher)`)}),l1=h({tabs:C(c1).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:r().default(`fields`).describe(`Default active tab key`),showHeader:S().default(!0).describe(`Show object summary header`),showBreadcrumbs:S().default(!0).describe(`Show navigation breadcrumbs`)}),u1=E([`field-editor`,`relationship-mapper`,`er-diagram`,`object-manager`]).describe(`Default view when entering the Object Designer`),d1=h({defaultView:u1.default(`field-editor`).describe(`Default view`),fieldEditor:Q$.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:e1.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:r1.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:s1.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:l1.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 lAe(e){return d1.parse(e)}var f1=h({enabled:S().default(!0).describe(`Enable snap-to-grid`),gridSize:P().int().min(1).default(8).describe(`Snap grid size in pixels`),showGrid:S().default(!0).describe(`Show grid overlay on canvas`),showGuides:S().default(!0).describe(`Show alignment guides when dragging`)}),p1=h({min:P().min(.1).default(.25).describe(`Minimum zoom level`),max:P().max(10).default(3).describe(`Maximum zoom level`),default:P().default(1).describe(`Default zoom level`),step:P().default(.1).describe(`Zoom step increment`)}),m1=h({type:r().describe(`Component type (e.g. "element:button", "element:text")`),label:r().describe(`Display label in palette`),icon:r().optional().describe(`Icon name for palette display`),category:E([`content`,`interactive`,`data`,`layout`]).describe(`Palette category grouping`),defaultWidth:P().int().min(1).default(4).describe(`Default width in grid columns`),defaultHeight:P().int().min(1).default(2).describe(`Default height in grid rows`)}),h1=h({snap:f1.optional().describe(`Canvas snap settings`),zoom:p1.optional().describe(`Canvas zoom settings`),palette:C(m1).optional().describe(`Custom element palette (defaults to all registered elements)`),showLayerPanel:S().default(!0).describe(`Show layer ordering panel`),showPropertyPanel:S().default(!0).describe(`Show property inspector panel`),undoLimit:P().int().min(1).default(50).describe(`Maximum undo history steps`)}),uAe=h1,g1=E([`rounded_rect`,`circle`,`diamond`,`parallelogram`,`hexagon`,`diamond_thick`,`attached_circle`,`screen_rect`]).describe(`Visual shape for rendering a flow node on the canvas`),_1=h({action:r().describe(`FlowNodeAction value (e.g., "parallel_gateway")`),shape:g1.describe(`Shape to render`),icon:r().describe(`Lucide icon name`),defaultLabel:r().describe(`Default display label`),defaultWidth:P().int().min(20).default(120).describe(`Default width in pixels`),defaultHeight:P().int().min(20).default(60).describe(`Default height in pixels`),fillColor:r().default(`#ffffff`).describe(`Node fill color (CSS value)`),borderColor:r().default(`#94a3b8`).describe(`Node border color (CSS value)`),allowBoundaryEvents:S().default(!1).describe(`Whether boundary events can be attached to this node type`),paletteCategory:E([`event`,`gateway`,`activity`,`data`,`subflow`]).describe(`Palette category for grouping`)}).describe(`Visual render descriptor for a flow node type`),dAe=h({nodeId:r().describe(`Corresponding FlowNode.id`),x:P().describe(`X position on canvas`),y:P().describe(`Y position on canvas`),width:P().int().min(20).optional().describe(`Width override in pixels`),height:P().int().min(20).optional().describe(`Height override in pixels`),collapsed:S().default(!1).describe(`Whether the node is collapsed`),fillColor:r().optional().describe(`Fill color override`),borderColor:r().optional().describe(`Border color override`),annotation:r().optional().describe(`User annotation displayed near the node`)}).describe(`Canvas layout data for a flow node`),v1=E([`solid`,`dashed`,`dotted`,`bold`]).describe(`Edge line style`),fAe=h({edgeId:r().describe(`Corresponding FlowEdge.id`),style:v1.default(`solid`).describe(`Line style`),color:r().default(`#94a3b8`).describe(`Edge line color`),labelPosition:P().min(0).max(1).default(.5).describe(`Position of the condition label along the edge`),waypoints:C(h({x:P().describe(`Waypoint X`),y:P().describe(`Waypoint Y`)})).optional().describe(`Manual waypoints for edge routing`),animated:S().default(!1).describe(`Show animated flow indicator`)}).describe(`Canvas layout and visual data for a flow edge`),y1=E([`dagre`,`elk`,`force`,`manual`]).describe(`Auto-layout algorithm for the flow canvas`),b1=E([`TB`,`BT`,`LR`,`RL`]).describe(`Auto-layout direction`),x1=h({snap:h({enabled:S().default(!0).describe(`Enable snap-to-grid`),gridSize:P().int().min(1).default(16).describe(`Snap grid size in pixels`),showGrid:S().default(!0).describe(`Show grid overlay`)}).default({enabled:!0,gridSize:16,showGrid:!0}).describe(`Canvas snap-to-grid settings`),zoom:h({min:P().min(.1).default(.25).describe(`Minimum zoom level`),max:P().max(10).default(3).describe(`Maximum zoom level`),default:P().default(1).describe(`Default zoom level`),step:P().default(.1).describe(`Zoom step`)}).default({min:.25,max:3,default:1,step:.1}).describe(`Canvas zoom settings`),layoutAlgorithm:y1.default(`dagre`).describe(`Default auto-layout algorithm`),layoutDirection:b1.default(`TB`).describe(`Default auto-layout direction`),nodeDescriptors:C(_1).optional().describe(`Custom node render descriptors (merged with built-in defaults)`),showMinimap:S().default(!0).describe(`Show minimap panel`),showPropertyPanel:S().default(!0).describe(`Show property panel`),showPalette:S().default(!0).describe(`Show node palette sidebar`),undoLimit:P().int().min(1).default(50).describe(`Maximum undo history steps`),animateExecution:S().default(!0).describe(`Animate edges during execution preview`),connectionValidation:S().default(!0).describe(`Validate connections before creating edges`)}).describe(`Studio Flow Builder configuration`),pAe=[{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 mAe(e){return x1.parse(e)}var hAe=h({namespace:r().optional().describe(`Match objects by namespace`),package:r().optional().describe(`Match objects by package ID`),objectPattern:r().optional().describe(`Match objects by name pattern (glob-style)`),default:S().optional().describe(`Default fallback rule`),datasource:r().describe(`Target datasource name`),priority:P().optional().describe(`Rule priority (lower = higher priority)`)}).describe(`Datasource routing rule`),gAe=h({manifest:RV.optional().describe(`Project Package Configuration`),datasources:C(SN).optional().describe(`External Data Connections`),datasourceMapping:C(hAe).optional().describe(`Centralized datasource routing rules for packages/namespaces/objects`),translations:C(zz).optional().describe(`I18n Translation Bundles`),i18n:Hz.optional().describe(`Internationalization configuration`),objects:C(gM).optional().describe(`Business Objects definition (owned by this package)`),objectExtensions:C(_M).optional().describe(`Extensions to objects owned by other packages`),apps:C(NP).optional().describe(`Applications`),views:C(sF).optional().describe(`List Views`),pages:C(MF).optional().describe(`Custom Pages`),dashboards:C(gF).optional().describe(`Dashboards`),reports:C(xF).optional().describe(`Analytics Reports`),actions:C(aM).optional().describe(`Global and Object Actions`),themes:C(CI).optional().describe(`UI Themes`),workflows:C(AJ).optional().describe(`Event-driven workflows`),approvals:C(eQ).optional().describe(`Approval processes`),flows:C(aZ).optional().describe(`Screen Flows`),roles:C(KU).optional().describe(`User Roles hierarchy`),permissions:C(XN).optional().describe(`Permission Sets and Profiles`),sharingRules:C(nP).optional().describe(`Record Sharing Rules`),policies:C(cP).optional().describe(`Security & Compliance Policies`),apis:C(KK).optional().describe(`API Endpoints`),webhooks:C(YZ).optional().describe(`Outbound Webhooks`),agents:C(mW).optional().describe(`AI Agents and Assistants`),ragPipelines:C(YG).optional().describe(`RAG Pipelines`),hooks:C(yM).optional().describe(`Object Lifecycle Hooks`),mappings:C(SM).optional().describe(`Data Import/Export Mappings`),analyticsCubes:C(kN).optional().describe(`Analytics Semantic Layer Cubes`),connectors:C(XQ).optional().describe(`External System Connectors`),data:C(cN).optional().describe(`Seed Data / Fixtures for bootstrapping`),plugins:C(u()).optional().describe(`Plugins to load`),devPlugins:C(l([RV,r()])).optional().describe(`Plugins to load only in development (CLI dev command)`)});function _Ae(e){let t=new Set;if(e.objects)for(let n of e.objects)t.add(n.name);return t}function vAe(e){let t=[],n=_Ae(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 S1(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 yAe(e,t){let n=t?.strict!==!1,r=mj(e);if(!n)return S1(r);let i=gAe.safeParse(r,{error:sj});if(!i.success)throw Error(lj(i.error,`defineStack validation failed`));let a=vAe(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} + +${t.join(` +`)}`)}return S1(i.data)}h({objectConflict:E([`error`,`override`,`merge`]).default(`error`),manifest:l([E([`first`,`last`]),P().int().min(0)]).default(`last`),namespace:r().optional()});var bAe=h({queryFilters:S().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:S().default(!0).describe(`Supports GROUP BY and aggregation functions`),querySorting:S().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:S().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:S().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:S().default(!1).describe(`Supports subqueries`),queryDistinct:S().default(!0).describe(`Supports SELECT DISTINCT`),queryHaving:S().default(!1).describe(`Supports HAVING clause for aggregations`),queryJoins:S().default(!1).describe(`Supports SQL-style joins`),fullTextSearch:S().default(!1).describe(`Supports full-text search`),vectorSearch:S().default(!1).describe(`Supports vector embeddings and similarity search for AI/RAG`),geoSpatial:S().default(!1).describe(`Supports geospatial queries and location fields`),jsonFields:S().default(!0).describe(`Supports JSON field types`),arrayFields:S().default(!1).describe(`Supports array field types`),validationRules:S().default(!0).describe(`Supports validation rules`),workflows:S().default(!0).describe(`Supports workflow automation`),triggers:S().default(!0).describe(`Supports database triggers`),formulas:S().default(!0).describe(`Supports formula fields`),transactions:S().default(!0).describe(`Supports database transactions`),bulkOperations:S().default(!0).describe(`Supports bulk create/update/delete`),supportedDrivers:C(r()).optional().describe(`Available database drivers (e.g., postgresql, mongodb, excel)`)}),xAe=h({listView:S().default(!0).describe(`Supports list/grid views`),formView:S().default(!0).describe(`Supports form views`),kanbanView:S().default(!1).describe(`Supports kanban board views`),calendarView:S().default(!1).describe(`Supports calendar views`),ganttView:S().default(!1).describe(`Supports Gantt chart views`),dashboards:S().default(!0).describe(`Supports dashboard creation`),reports:S().default(!0).describe(`Supports report generation`),charts:S().default(!0).describe(`Supports chart widgets`),customPages:S().default(!0).describe(`Supports custom page creation`),customThemes:S().default(!1).describe(`Supports custom theme creation`),customComponents:S().default(!1).describe(`Supports custom UI components/widgets`),customActions:S().default(!0).describe(`Supports custom button actions`),screenFlows:S().default(!1).describe(`Supports interactive screen flows`),mobileOptimized:S().default(!1).describe(`UI optimized for mobile devices`),accessibility:S().default(!1).describe(`WCAG accessibility support`)}),SAe=h({version:r().describe(`ObjectOS Kernel Version`),environment:E([`development`,`test`,`staging`,`production`]),restApi:S().default(!0).describe(`REST API available`),graphqlApi:S().default(!1).describe(`GraphQL API available`),odataApi:S().default(!1).describe(`OData API available`),websockets:S().default(!1).describe(`WebSocket support for real-time updates`),serverSentEvents:S().default(!1).describe(`Server-Sent Events support`),eventBus:S().default(!1).describe(`Internal event bus for pub/sub`),webhooks:S().default(!0).describe(`Outbound webhook support`),apiContracts:S().default(!1).describe(`API contract definitions`),authentication:S().default(!0).describe(`Authentication system`),rbac:S().default(!0).describe(`Role-Based Access Control`),fieldLevelSecurity:S().default(!1).describe(`Field-level permissions`),rowLevelSecurity:S().default(!1).describe(`Row-level security/sharing rules`),multiTenant:S().default(!1).describe(`Multi-tenant architecture support`),backgroundJobs:S().default(!1).describe(`Background job scheduling`),auditLogging:S().default(!1).describe(`Audit trail logging`),fileStorage:S().default(!0).describe(`File upload and storage`),i18n:S().default(!0).describe(`Internationalization support`),pluginSystem:S().default(!1).describe(`Plugin/extension system`),features:C(hV).optional().describe(`Active Feature Flags`),apis:C(KK).optional().describe(`Available System & Business APIs`),network:h({graphql:S().default(!1),search:S().default(!1),websockets:S().default(!1),files:S().default(!0),analytics:S().default(!1).describe(`Is the Analytics/BI engine enabled?`),ai:S().default(!1).describe(`Is the AI engine enabled?`),workflow:S().default(!1).describe(`Is the Workflow engine enabled?`),notifications:S().default(!1).describe(`Is the Notification service enabled?`),i18n:S().default(!1).describe(`Is the i18n service enabled?`)}).optional().describe(`Network Capabilities (GraphQL, WS, etc.)`),systemObjects:C(r()).optional().describe(`List of globally available System Objects`),limits:h({maxObjects:P().optional(),maxFieldsPerObject:P().optional(),maxRecordsPerQuery:P().optional(),apiRateLimit:P().optional(),fileUploadSizeLimit:P().optional().describe(`Max file size in bytes`)}).optional()});h({data:bAe.describe(`Data Layer capabilities`),ui:xAe.describe(`UI Layer capabilities`),system:SAe.describe(`System/Runtime Layer capabilities`)});var CAe=yAe({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`}]}]}),C1=r().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)`),w1=r().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)`);r().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 wAe=I(`type`,[h({type:m(`constant`),value:u().describe(`Constant value to use`)}).describe(`Set a constant value`),h({type:m(`cast`),targetType:E([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),h({type:m(`lookup`),table:r().describe(`Lookup table name`),keyField:r().describe(`Field to match on`),valueField:r().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),h({type:m(`javascript`),expression:r().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),h({type:m(`map`),mappings:d(r(),u()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]);h({source:r().describe(`Source field name`),target:r().describe(`Target field name`),transform:wAe.optional().describe(`Transformation to apply`),defaultValue:u().optional().describe(`Default if source is null/undefined`)});var TAe=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),EAe=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]);h({url:r().describe(`API endpoint URL`),method:EAe.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)}),h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(TAe).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)}),E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var DAe=E([`asc`,`desc`]).describe(`Sort order direction`);h({field:r().describe(`Field name to sort by`),order:DAe.describe(`Sort direction`)}).describe(`Sort field and direction pair`),E([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),E([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var OAe=E([`yaml`,`json`,`typescript`,`javascript`]).describe(`Metadata file format`);h({id:r().describe(`Unique metadata record identifier`),type:r().describe(`Metadata type (e.g. "object", "view", "flow")`),name:w1.describe(`Machine name (snake_case)`),format:OAe.optional().describe(`Source file format`)}).describe(`Base metadata record fields shared across kernel and system`),w1.brand().describe(`Branded object name (snake_case, no dots)`),w1.brand().describe(`Branded field name (snake_case, no dots)`),C1.brand().describe(`Branded view name (system identifier)`),C1.brand().describe(`Branded app name (system identifier)`),C1.brand().describe(`Branded flow name (system identifier)`),C1.brand().describe(`Branded role name (system identifier)`);var kAe=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),AAe=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),jAe=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),T1=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:kAe.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:AAe.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:jAe.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:T1.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var MAe=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),E1=h({field:r().describe(`Field name to apply masking to`),strategy:MAe.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(E1).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var NAe=E(`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(`.`)),PAe=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:C1.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var FAe=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var IAe=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),LAe=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),RAe=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),zAe=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:NAe.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(PAe).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:FAe.optional().describe(`Configuration for currency field type`),vectorConfig:IAe.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:LAe.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:T1.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:E1.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:zAe.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:RAe.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)});var D1={objects:`object`,apps:`app`,pages:`page`,dashboards:`dashboard`,reports:`report`,actions:`action`,themes:`theme`,workflows:`workflow`,approvals:`approval`,flows:`flow`,roles:`role`,permissions:`permission`,profiles:`profile`,sharingRules:`sharingRule`,policies:`policy`,apis:`api`,webhooks:`webhook`,agents:`agent`,ragPipelines:`ragPipeline`,hooks:`hook`,mappings:`mapping`,analyticsCubes:`analyticsCube`,connectors:`connector`,datasources:`datasource`,views:`view`},O1=Object.fromEntries(Object.entries(D1).map(([e,t])=>[t,e]));function k1(e){return D1[e]??e}var BAe=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`}`}},VAe=`name`,HAe=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:VAe,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=k.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;n0)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}}},A1=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=this.bundle.manifest?{...this.bundle.manifest,...this.bundle}:this.bundle;e.getService(`manifest`).register(r)},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}),this.bundle.datasourceMapping&&Array.isArray(this.bundle.datasourceMapping)&&(e.logger.info(`Configuring datasource mapping rules`,{appId:n,ruleCount:this.bundle.datasourceMapping.length}),r.setDatasourceMapping(this.bundle.datasourceMapping));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 HAe(r,n,e.logger),{SeedLoaderRequestSchema:a}=await Gf(async()=>{let{SeedLoaderRequestSchema:e}=await import(`./data-CGvg7kH3.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 j1(){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 UAe=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}}}}routeNotFound(e){return{status:404,body:{success:!1,error:{code:404,message:`Route Not Found: ${e}`,type:`ROUTE_NOT_FOUND`,route:e,hint:`No route is registered for this path. Check the API discovery endpoint for available routes.`}}}}async callData(e,t){let n=await this.resolveService(`protocol`),r=await this.getObjectQLService()??await this.resolveService(`objectql`);if(e===`create`){if(r){let e=await r.insert(t.object,t.data),n={...t.data,...e};return{object:t.object,id:n.id,record:n}}throw{statusCode:503,message:`Data service not available`}}if(e===`get`){if(n&&typeof n.getData==`function`)return await n.getData({object:t.object,id:t.id,expand:t.expand,select:t.select});if(r){let e=await r.find(t.object);e||=[];let n=e.find(e=>e.id===t.id);return n?{object:t.object,id:t.id,record:n}:null}throw{statusCode:503,message:`Data service not available`}}if(e===`update`){if(r&&t.id){let e=await r.find(t.object);e&&e.value&&(e=e.value),e||=[];let n=e.find(e=>e.id===t.id);if(!n)throw Error(`[ObjectStack] Not Found`);return await r.update(t.object,t.data,{where:{id:t.id}}),{object:t.object,id:t.id,record:{...n,...t.data}}}throw{statusCode:503,message:`Data service not available`}}if(e===`delete`){if(r)return await r.delete(t.object,{where:{id:t.id}}),{object:t.object,id:t.id,deleted:!0};throw{statusCode:503,message:`Data service not available`}}if(e===`query`||e===`find`){if(n&&typeof n.findData==`function`){let e=t.query||(()=>{let{object:e,...n}=t;return n})();return await n.findData({object:t.object,query:e})}if(r){let e=await r.find(t.object);return!Array.isArray(e)&&e&&e.value&&(e=e.value),e||=[],{object:t.object,records:e,total:e.length}}throw{statusCode:503,message:`Data service not available`}}if(e===`batch`)return{object:t.object,results:[]};throw{statusCode:400,message:`Unknown data action: ${e}`}}async getDiscoveryInfo(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=await Promise.all([this.resolveService(fi.enum.auth),this.resolveService(fi.enum.graphql),this.resolveService(fi.enum.search),this.resolveService(fi.enum.realtime),this.resolveService(fi.enum[`file-storage`]),this.resolveService(fi.enum.analytics),this.resolveService(fi.enum.workflow),this.resolveService(fi.enum.ai),this.resolveService(fi.enum.notification),this.resolveService(fi.enum.i18n),this.resolveService(fi.enum.ui),this.resolveService(fi.enum.automation),this.resolveService(fi.enum.cache),this.resolveService(fi.enum.queue),this.resolveService(fi.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,D=!!f,O=!!p,ee=!!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:D?`${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`,handlerReady:!0,route:e,provider:t}),j=e=>({enabled:!1,status:`unavailable`,handlerReady:!1,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:Yf(`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`,handlerReady:!0,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:D?A(k.automation):j(`automation`),analytics:x?A(k.analytics):j(`analytics`),cache:O?A():j(`cache`),queue:ee?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(fi.enum.auth);if(i&&typeof i.handler==`function`)return{handled:!0,result:await i.handler(r.request,r.response)};let a=e.replace(/^\/+/,``);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_${j1()}`;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_${j1()}`;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=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(a[0]===`types`){let e=await this.resolveService(`metadata`);if(e&&typeof e.getRegisteredTypes==`function`)try{let t=await e.getRegisteredTypes();return{handled:!0,response:this.success({types:t})}}catch(e){console.warn(`[HttpDispatcher] MetadataService.getRegisteredTypes() failed:`,e.message)}let t=await this.resolveService(`protocol`);if(t&&typeof t.getMetaTypes==`function`){let e=await t.getMetaTypes({});return{handled:!0,response:this.success(e)}}return{handled:!0,response:this.success({types:[`object`,`app`,`plugin`]})}}if(a.length===3&&a[2]===`published`&&(!n||n===`GET`)){let[e,t]=a,n=await this.getService(fi.enum.metadata);if(n&&typeof n.getPublished==`function`){let r=await n.getPublished(e,t);return r===void 0?{handled:!0,response:this.error(`Not found`,404)}:{handled:!0,response:this.success(r)}}let r=await this.resolveService(`metadata`);if(r&&typeof r.getPublished==`function`)try{let n=await r.getPublished(e,t);if(n!==void 0)return{handled:!0,response:this.success(n)}}catch{}return{handled:!0,response:this.error(`Not found`,404)}}if(a.length===2){let[e,t]=a,o=i?.package||void 0;if(n===`PUT`&&r){let n=await this.resolveService(`protocol`);if(n&&typeof n.saveMetaItem==`function`)try{let i=await n.saveMetaItem({type:e,name:t,item:r});return{handled:!0,response:this.success(i)}}catch(e){return{handled:!0,response:this.error(e.message,400)}}let i=await this.resolveService(`metadata`);if(i&&typeof i.saveItem==`function`)try{let n=await i.saveItem(e,t,r);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`){let e=await this.getObjectQLService();if(e?.registry){let n=e.registry.getObject(t);if(n)return{handled:!0,response:this.success(n)}}return{handled:!0,response:this.error(`Not found`,404)}}let n=k1(e),r=await this.resolveService(`protocol`);if(r&&typeof r.getMetaItem==`function`)try{let e=await r.getMetaItem({type:n,name:t,packageId:o});return{handled:!0,response:this.success(e)}}catch{}let i=await this.resolveService(`metadata`);if(i&&typeof i.getItem==`function`)try{let e=await i.getItem(n,t);if(e)return{handled:!0,response:this.success(e)}}catch{}return{handled:!0,response:this.error(`Not found`,404)}}catch(e){return{handled:!0,response:this.error(e.message,404)}}}if(a.length===1){let e=a[0],t=i?.package||void 0,n=await this.resolveService(`protocol`);if(n&&typeof n.getMetaItems==`function`)try{let r=await n.getMetaItems({type:e,packageId:t});if(r&&(r.items!==void 0||Array.isArray(r)))return{handled:!0,response:this.success(r)}}catch{}let r=await this.getService(fi.enum.metadata);if(r&&typeof r.list==`function`)try{let t=await r.list(e);if(t&&t.length>0)return{handled:!0,response:this.success({type:e,items:t})}}catch(t){let n=String(e).replace(/[\r\n\t]/g,``);console.debug(`[HttpDispatcher] MetadataService.list() failed for type:`,n,`error:`,t.message)}let o=await this.getObjectQLService();if(o?.registry){if(e===`objects`){let e=o.registry.getAllObjects(t);return{handled:!0,response:this.success({type:`object`,items:e})}}let n=o.registry.listItems?.(e,t);if(n&&n.length>0)return{handled:!0,response:this.success({type:e,items:n})};let r=o.registry.getObject(e);if(r)return{handled:!0,response:this.success(r)}}return{handled:!0,response:this.error(`Not found`,404)}}if(a.length===0){let e=await this.resolveService(`metadata`);if(e&&typeof e.getRegisteredTypes==`function`)try{let t=await e.getRegisteredTypes();return{handled:!0,response:this.success({types:t})}}catch{}let t=await this.resolveService(`protocol`);if(t&&typeof t.getMetaTypes==`function`){let e=await t.getMetaTypes({});return{handled:!0,response:this.success(e)}}return{handled:!0,response:this.success({types:[`object`,`app`,`plugin`]})}}return{handled:!1}}async handleData(e,t,n,r,i){let a=e.replace(/^\/+/,``).split(`/`),o=a[0];if(!o)return{handled:!0,response:this.error(`Object name required`,400)};let s=t.toUpperCase();if(a.length>1){let e=a[1];if(e===`query`&&s===`POST`){let e=await this.callData(`query`,{object:o,...n});return{handled:!0,response:this.success(e)}}if(e===`batch`&&s===`POST`){let e=await this.callData(`batch`,{object:o,...n});return{handled:!0,response:this.success(e)}}if(a.length===2&&s===`GET`){let e=a[1],{select:t,expand:n}=r||{},i={};t!=null&&(i.select=t),n!=null&&(i.expand=n);let s=await this.callData(`get`,{object:o,id:e,...i});return{handled:!0,response:this.success(s)}}if(a.length===2&&s===`PATCH`){let e=a[1],t=await this.callData(`update`,{object:o,id:e,data:n});return{handled:!0,response:this.success(t)}}if(a.length===2&&s===`DELETE`){let e=a[1],t=await this.callData(`delete`,{object:o,id:e});return{handled:!0,response:this.success(t)}}}else{if(s===`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 this.callData(`query`,{object:o,query:e});return{handled:!0,response:this.success(t)}}if(s===`POST`){let e=await this.callData(`create`,{object:o,data:n}),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(fi.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(fi.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=ap(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=ap(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{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(fi.enum.metadata);if(t&&typeof t.publishPackage==`function`){let r=await t.publishPackage(e,n||{});return{handled:!0,response:this.success(r)}}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(fi.enum.metadata);return t&&typeof t.revertPackage==`function`?(await t.revertPackage(e),{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 handleStorage(e,t,n,r){let i=await this.getService(fi.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(fi.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}async handleAI(e,t,n,r,i){let a;try{a=await this.resolveService(`ai`)}catch{}if(!a)return{handled:!0,response:{status:404,body:{success:!1,error:{message:`AI service is not configured`,code:404}}}};let o=`/api/v1${e}`,s=(e,t)=>{let n=e.split(`/`),r=t.split(`/`);if(n.length!==r.length)return null;let i={};for(let e=0;ee});var _je=E([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),z1=h({major:P().int().min(0),minor:P().int().min(0),patch:P().int().min(0)}).describe(`Semantic version of the protocol`),vje=h({id:r().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:r(),version:z1,specification:r().optional().describe(`URL or path to protocol specification`),description:r().optional()}),yje=h({name:r().describe(`Feature identifier within the protocol`),enabled:S().default(!0),description:r().optional(),sinceVersion:r().optional().describe(`Version when this feature was added`),deprecatedSince:r().optional().describe(`Version when deprecated`)}),bje=h({protocol:vje,conformance:_je.default(`full`),implementedFeatures:C(r()).optional().describe(`List of implemented feature names`),features:C(yje).optional(),metadata:d(r(),u()).optional(),certified:S().default(!1).describe(`Has passed official conformance tests`),certificationDate:r().datetime().optional()}),xje=h({id:r().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:r(),description:r().optional(),version:z1,methods:C(h({name:r().describe(`Method name`),description:r().optional(),parameters:C(h({name:r(),type:r().describe(`Type notation (e.g., string, number, User)`),required:S().default(!0),description:r().optional()})).optional(),returnType:r().optional().describe(`Return value type`),async:S().default(!1).describe(`Whether method returns a Promise`)})),events:C(h({name:r().describe(`Event name`),description:r().optional(),payload:r().optional().describe(`Event payload type`)})).optional(),stability:E([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),Sje=h({pluginId:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:r().describe(`Semantic version constraint`),optional:S().default(!1),reason:r().optional(),requiredCapabilities:C(r()).optional().describe(`Protocol IDs the dependency must support`)}),Cje=h({id:r().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:r(),description:r().optional(),type:E([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:h({input:r().optional().describe(`Input type/schema`),output:r().optional().describe(`Output type/schema`),signature:r().optional().describe(`Function signature if applicable`)}).optional(),cardinality:E([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),B1=h({implements:C(bje).optional().describe(`List of protocols this plugin conforms to`),provides:C(xje).optional().describe(`Services/APIs this plugin offers to others`),requires:C(Sje).optional().describe(`Required plugins and their capabilities`),extensionPoints:C(Cje).optional().describe(`Points where other plugins can extend this plugin`),extensions:C(h({targetPluginId:r().describe(`Plugin ID being extended`),extensionPointId:r().describe(`Extension point identifier`),implementation:r().describe(`Path to implementation module`),priority:P().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),wje=E([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),Tje=h({enabled:S().default(!1),priority:P().int().min(0).default(100),resources:C(E([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:h({routes:C(r()).optional(),roles:C(r()).optional(),deviceType:C(E([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:E([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),Eje=h({enabled:S().default(!0),strategy:E([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:E([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:P().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:h({enabled:S().default(!0),minChunks:P().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),Dje=h({enabled:S().default(!0),mode:E([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:S().default(!1).describe(`Prefetch module in idle time`),preload:S().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:r().optional().describe(`Custom chunk name for webpack`),timeout:P().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:h({enabled:S().default(!0),maxAttempts:P().int().min(1).max(10).default(3),backoffMs:P().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),Oje=h({mode:E([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:P().int().min(100).default(3e4),priority:P().int().min(0).default(100),critical:S().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:h({enabled:S().default(!1),maxAttempts:P().int().min(1).max(5).default(3),backoffMs:P().int().min(0).default(1e3)}).optional(),healthCheckInterval:P().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),kje=h({strategy:E([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:h({resolve:S().default(!0),onMissing:E([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:E([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:h({load:S().default(!0),onFailure:E([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:E([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:E([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),Aje=h({enabled:S().default(!1),environment:E([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:E([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:C(r()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:C(r()).optional().describe(`Glob patterns for files to ignore`),debounceMs:P().int().min(0).default(300),preserveState:S().default(!1),stateSerialization:h({enabled:S().default(!1),handler:r().optional()}).optional(),hooks:h({beforeReload:r().optional().describe(`Function to call before reload`),afterReload:r().optional().describe(`Function to call after reload`),onError:r().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:h({healthValidation:S().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:S().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:P().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:S().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:P().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:P().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:P().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),jje=h({enabled:S().default(!0),storage:E([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:E([`version`,`hash`,`timestamp`]).default(`version`),ttl:P().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:P().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:C(E([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:h({enabled:S().default(!1),algorithm:E([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),Mje=h({enabled:S().default(!1),scope:E([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:E([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:C(r()).optional().describe(`List of allowed capability IDs`),resourceQuotas:h({maxMemoryMB:P().int().min(1).optional(),maxCpuTimeMs:P().int().min(100).optional(),maxFileDescriptors:P().int().min(1).optional(),maxNetworkKBps:P().int().min(1).optional()}).optional(),permissions:h({allowedAPIs:C(r()).optional(),allowedPaths:C(r()).optional(),allowedEndpoints:C(r()).optional(),allowedEnvVars:C(r()).optional()}).optional(),ipc:h({enabled:S().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:E([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:P().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:P().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:C(r()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),Nje=h({enabled:S().default(!1),metrics:C(E([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:P().min(0).max(1).default(1),reportingInterval:P().int().min(1).default(60),budgets:h({maxLoadTimeMs:P().int().min(0).optional(),maxInitTimeMs:P().int().min(0).optional(),maxMemoryMB:P().int().min(0).optional()}).optional(),onBudgetViolation:E([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),Pje=h({strategy:wje.default(`lazy`),preload:Tje.optional(),codeSplitting:Eje.optional(),dynamicImport:Dje.optional(),initialization:Oje.optional(),dependencyResolution:kje.optional(),hotReload:Aje.optional(),caching:jje.optional(),sandboxing:Mje.optional(),monitoring:Nje.optional()}).describe(`Complete plugin loading configuration`);h({type:E([`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:r(),timestamp:P().int().min(0),durationMs:P().int().min(0).optional(),metadata:d(r(),u()).optional(),error:h({message:r(),code:r().optional(),stack:r().optional()}).optional()}).describe(`Plugin loading lifecycle event`),h({pluginId:r(),state:E([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:P().min(0).max(100).default(0),startedAt:P().int().min(0).optional(),completedAt:P().int().min(0).optional(),lastError:r().optional(),retryCount:P().int().min(0).default(0)}).describe(`Plugin loading state`),h({ql:h({object:M().describe(`Get object handle for method chaining`),query:M().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:h({getCurrentUser:M().describe(`Get the current authenticated user`),getConfig:M().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:h({debug:M().describe(`Log debug message`),info:M().describe(`Log info message`),warn:M().describe(`Log warning message`),error:M().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:h({get:M().describe(`Get a value from storage`),set:M().describe(`Set a value in storage`),delete:M().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:h({t:M().describe(`Translate a key`),getLocale:M().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:d(r(),u()),events:d(r(),u()),app:h({router:h({get:M().describe(`Register GET route handler`),post:M().describe(`Register POST route handler`),use:M().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:h({register:M().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),h({previousVersion:r().describe(`Version before upgrade`),newVersion:r().describe(`Version after upgrade`),isMajorUpgrade:S().describe(`Whether this is a major version bump`),previousMetadata:d(r(),u()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`);var Fje=h({onInstall:M().optional().describe(`Called when plugin is installed`),onEnable:M().optional().describe(`Called when plugin is enabled`),onDisable:M().optional().describe(`Called when plugin is disabled`),onUninstall:M().optional().describe(`Called when plugin is uninstalled`),onUpgrade:M().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),V1=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`];Fje.extend({id:r().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:E([`standard`,...V1]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:r().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:r().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:S().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:r().optional(),author:r().optional(),homepage:r().url().optional()});var Ije=E([`insert`,`update`,`upsert`,`replace`,`ignore`]),Lje=h({object:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:r().default(`name`).describe(`Field match for uniqueness check`),mode:Ije.default(`upsert`).describe(`Conflict resolution strategy`),env:C(E([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:C(d(r(),u())).describe(`Data records`)}),H1=h({id:r().describe(`Unique package identifier (reverse domain style)`),namespace:r().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")`),defaultDatasource:r().optional().default(`default`).describe(`Default datasource for all objects in this package`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:E([`plugin`,...V1,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:r().describe(`Human-readable package name`),description:r().optional().describe(`Package description`),permissions:C(r()).optional().describe(`Array of required permission strings`),objects:C(r()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:C(r()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:d(r(),r()).optional().describe(`Package dependencies`),configuration:h({title:r().optional(),properties:d(r(),h({type:E([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:u().optional().describe(`Default value`),description:r().optional().describe(`Tooltip description`),required:S().optional().describe(`Is this setting required?`),secret:S().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:C(r()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:h({kinds:C(h({id:r().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:C(r()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:r().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:C(r()).optional().describe(`Events this plugin listens to`),menus:d(r(),C(h({id:r(),label:r(),command:r().optional()}))).optional().describe(`UI Menu contributions`),themes:C(h({id:r(),label:r(),path:r()})).optional().describe(`Theme contributions`),translations:C(h({locale:r(),path:r()})).optional().describe(`Translation resources`),actions:C(h({name:r().describe(`Unique action name`),label:r().optional(),description:r().optional(),input:u().optional().describe(`Input validation schema`),output:u().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:C(h({id:r().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:r().describe(`Human readable name`),description:r().optional()})).optional().describe(`Driver contributions`),fieldTypes:C(h({name:r().describe(`Unique field type name (e.g. "vector")`),label:r().describe(`Display label`),description:r().optional()})).optional().describe(`Field Type contributions`),functions:C(h({name:r().describe(`Function name (e.g. "distance")`),description:r().optional(),args:C(r()).optional().describe(`Argument types`),returnType:r().optional()})).optional().describe(`Query Function contributions`),routes:C(h({prefix:r().regex(/^\//).describe(`API path prefix`),service:r().describe(`Service name this plugin provides`),methods:C(r()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:C(h({name:r().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:r().optional().describe(`Command description for help text`),module:r().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:C(Lje).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:B1.optional().describe(`Plugin capability declarations for interoperability`),extensions:d(r(),u()).optional().describe(`Extension points and contributions`),loading:Pje.optional().describe(`Plugin loading and runtime behavior configuration`),engine:h({objectstack:r().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)});E([`package`,`admin`,`user`,`migration`,`api`]);var Rje=h({path:r().describe(`JSON path to the changed field`),originalValue:u().optional().describe(`Original value from the package`),currentValue:u().describe(`Current customized value`),changedBy:r().optional().describe(`User or admin who made this change`),changedAt:r().datetime().optional().describe(`Timestamp of the change`)});h({id:r().describe(`Overlay record ID (UUID)`),baseType:r().describe(`Metadata type being customized`),baseName:r().describe(`Metadata name being customized`),packageId:r().optional().describe(`Package ID that delivered the base metadata`),packageVersion:r().optional().describe(`Package version when overlay was created`),scope:E([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:r().optional().describe(`Tenant identifier`),owner:r().optional().describe(`Owner user ID for user-scope overlays`),patch:d(r(),u()).describe(`JSON Merge Patch payload (changed fields only)`),changes:C(Rje).optional().describe(`Field-level change tracking for conflict detection`),active:S().default(!0).describe(`Whether this overlay is active`),createdAt:r().datetime().optional(),createdBy:r().optional(),updatedAt:r().datetime().optional(),updatedBy:r().optional()});var zje=h({path:r().describe(`JSON path to the conflicting field`),baseValue:u().describe(`Value in the old package version`),incomingValue:u().describe(`Value in the new package version`),customValue:u().describe(`Customer customized value`),suggestedResolution:E([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:r().optional().describe(`Explanation for the suggested resolution`)}),Bje=h({defaultStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:C(r()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:C(r()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:S().default(!0).describe(`Auto-resolve changes that do not conflict`)});h({success:S().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:d(r(),u()).optional().describe(`Merged metadata result`),updatedOverlay:d(r(),u()).optional().describe(`Updated overlay after merge`),conflicts:C(zje).optional().describe(`Unresolved merge conflicts`),autoResolved:C(h({path:r(),resolution:r(),description:r().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:h({totalFields:P().int().min(0).describe(`Total fields evaluated`),unchanged:P().int().min(0).describe(`Fields with no changes`),autoResolved:P().int().min(0).describe(`Fields auto-resolved`),conflicts:P().int().min(0).describe(`Fields with conflicts`)}).optional()});var Vje=h({metadataType:r().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:S().default(!0),lockedFields:C(r()).optional().describe(`Field paths that cannot be customized`),customizableFields:C(r()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:S().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:S().default(!1).describe(`Whether admins can delete package-delivered fields`)}),U1=E([`json`,`yaml`,`typescript`,`javascript`]),Hje=h({size:P().int().min(0).describe(`File size in bytes`),modifiedAt:r().datetime().describe(`Last modified date`),etag:r().describe(`Entity tag for cache validation`),format:U1.describe(`Serialization format`),path:r().optional().describe(`File system path`),metadata:d(r(),u()).optional().describe(`Provider-specific metadata`)});h({patterns:C(r()).optional().describe(`File glob patterns`),ifNoneMatch:r().optional().describe(`ETag for conditional request`),ifModifiedSince:r().datetime().optional().describe(`Only load if modified after this date`),validate:S().default(!0).describe(`Validate against schema`),useCache:S().default(!0).describe(`Enable caching`),filter:r().optional().describe(`Filter predicate as string`),limit:P().int().min(1).optional().describe(`Maximum items to load`),recursive:S().default(!0).describe(`Search subdirectories`)}),h({format:U1.default(`typescript`).describe(`Output format`),prettify:S().default(!0).describe(`Format with indentation`),indent:P().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:S().default(!1).describe(`Sort object keys`),includeDefaults:S().default(!1).describe(`Include default values`),backup:S().default(!1).describe(`Create backup file`),overwrite:S().default(!0).describe(`Overwrite existing file`),atomic:S().default(!0).describe(`Use atomic write operation`),path:r().optional().describe(`Custom output path`)}),h({output:r().describe(`Output file path`),format:U1.default(`json`).describe(`Export format`),filter:r().optional().describe(`Filter items to export`),includeStats:S().default(!1).describe(`Include metadata statistics`),compress:S().default(!1).describe(`Compress output (gzip)`),prettify:S().default(!0).describe(`Pretty print output`)}),h({conflictResolution:E([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Simulate import without saving`),continueOnError:S().default(!1).describe(`Continue if validation fails`),transform:r().optional().describe(`Transform items before import`)}),h({data:u().nullable().describe(`Loaded metadata`),fromCache:S().default(!1).describe(`Loaded from cache`),notModified:S().default(!1).describe(`Not modified since last request`),etag:r().optional().describe(`Entity tag`),stats:Hje.optional().describe(`Metadata statistics`),loadTime:P().min(0).optional().describe(`Load duration in ms`)}),h({success:S().describe(`Save successful`),path:r().describe(`Output path`),etag:r().optional().describe(`Generated entity tag`),size:P().int().min(0).optional().describe(`File size`),saveTime:P().min(0).optional().describe(`Save duration in ms`),backupPath:r().optional().describe(`Backup file path`)}),h({type:E([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:r().describe(`Type of metadata`),name:r().describe(`Item identifier`),path:r().describe(`File path`),data:u().optional().describe(`Item data`),timestamp:r().datetime().describe(`Event timestamp`)}),h({type:r().describe(`Collection type`),count:P().int().min(0).describe(`Number of items`),formats:C(U1).describe(`Formats in collection`),totalSize:P().int().min(0).optional().describe(`Total size in bytes`),lastModified:r().datetime().optional().describe(`Last modification date`),location:r().optional().describe(`Collection location`)}),h({name:r().describe(`Loader identifier`),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)}).describe(`Loader capabilities`),supportedFormats:C(U1).describe(`Supported formats`),supportsWatch:S().default(!1).describe(`Supports file watching`),supportsWrite:S().default(!0).describe(`Supports write operations`),supportsCache:S().default(!0).describe(`Supports caching`)});var Uje=E([`filesystem`,`memory`,`none`]),Wje=h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:Uje.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory path`),formats:C(U1).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:h({enabled:S().default(!0).describe(`Enable caching`),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:S().default(!1).describe(`Enable file watching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`),ignoreInitial:S().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:h({strict:S().default(!0).describe(`Strict validation`),throwOnError:S().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:d(r(),u()).optional().describe(`Loader-specific configuration`)}),W1=E([`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`]),Gje=h({type:W1.describe(`Metadata type identifier`),label:r().describe(`Display label for the metadata type`),description:r().optional().describe(`Description of the metadata type`),filePatterns:C(r()).describe(`Glob patterns to discover files of this type`),supportsOverlay:S().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:S().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:S().default(!1).describe(`Whether version history is tracked`),loadOrder:P().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:E([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)});h({types:C(W1).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),packageId:r().optional().describe(`Filter by owning package`),search:r().optional().describe(`Full-text search query`),scope:E([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:E([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:C(r()).optional().describe(`Filter by tags`),sortBy:E([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(500).default(50).describe(`Items per page`)}),h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),namespace:r().optional().describe(`Namespace`),label:r().optional().describe(`Display label`),scope:E([`system`,`platform`,`user`]).optional(),state:E([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:r().optional(),updatedAt:r().datetime().optional()})).describe(`Matched metadata items`),total:P().int().min(0).describe(`Total matching items`),page:P().int().min(1).describe(`Current page`),pageSize:P().int().min(1).describe(`Page size`)}),h({event:E([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:W1.describe(`Metadata type`),name:r().describe(`Metadata item name`),namespace:r().optional().describe(`Namespace`),packageId:r().optional().describe(`Owning package ID`),timestamp:r().datetime().describe(`Event timestamp`),actor:r().optional().describe(`User or system that triggered the event`),payload:d(r(),u()).optional().describe(`Event-specific payload`)}),h({valid:S().describe(`Whether the metadata is valid`),errors:C(h({path:r().describe(`JSON path to the invalid field`),message:r().describe(`Error description`),code:r().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:C(h({path:r().describe(`JSON path to the field`),message:r().describe(`Warning description`)})).optional().describe(`Validation warnings`)});var Kje=h({storage:Wje.describe(`Storage backend configuration`),customizationPolicies:C(Vje).optional().describe(`Default customization policies per type`),mergeStrategy:Bje.optional().describe(`Merge strategy for package upgrades`),additionalTypes:C(Gje.omit({type:!0}).extend({type:r().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:S().default(!0).describe(`Emit metadata change events`),validateOnWrite:S().default(!0).describe(`Validate metadata on write`),enableVersioning:S().default(!1).describe(`Track metadata version history`),cacheMaxItems:P().int().min(0).default(1e4).describe(`Max items in memory cache`)});h({id:m(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:m(`ObjectStack Metadata Service`).describe(`Plugin name`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:m(`standard`).describe(`Plugin type`),description:r().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:h({crud:S().default(!0).describe(`Supports metadata CRUD`),query:S().default(!0).describe(`Supports metadata query`),overlay:S().default(!0).describe(`Supports customization overlays`),watch:S().default(!1).describe(`Supports file watching`),importExport:S().default(!0).describe(`Supports import/export`),validation:S().default(!0).describe(`Supports schema validation`),versioning:S().default(!1).describe(`Supports version history`),events:S().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:Kje.optional().describe(`Plugin configuration`)});var G1=[{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`}];h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue if individual item fails`),validate:S().default(!0).describe(`Validate before register`)}),h({total:P().int().min(0).describe(`Total items processed`),succeeded:P().int().min(0).describe(`Successfully processed`),failed:P().int().min(0).describe(`Failed items`),errors:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),error:r().describe(`Error message`)})).optional().describe(`Per-item errors`)}),h({sourceType:r().describe(`Dependent metadata type`),sourceName:r().describe(`Dependent metadata name`),targetType:r().describe(`Referenced metadata type`),targetName:r().describe(`Referenced metadata name`),kind:E([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)});var K1=E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),q1=h({manifest:H1.describe(`Full package manifest`),status:K1.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:S().default(!0).describe(`Whether the package is currently enabled`),installedAt:r().datetime().optional().describe(`Installation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),installedVersion:r().optional().describe(`Currently installed version for quick access`),previousVersion:r().optional().describe(`Version before the last upgrade`),statusChangedAt:r().datetime().optional().describe(`Status change timestamp`),errorMessage:r().optional().describe(`Error message when status is error`),settings:d(r(),u()).optional().describe(`User-provided configuration settings`),upgradeHistory:C(h({fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Version after upgrade`),upgradedAt:r().datetime().describe(`Upgrade timestamp`),status:E([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:C(r()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:C(r()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`);h({namespace:r().describe(`Namespace prefix`),packageId:r().describe(`Owning package ID`),registeredAt:r().datetime().describe(`Registration timestamp`),status:E([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package display name`),suggestion:r().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),h({status:K1.optional().describe(`Filter by package status`),type:H1.shape.type.optional().describe(`Filter by package type`),enabled:S().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),h({packages:C(q1).describe(`List of installed packages`),total:P().describe(`Total package count`)}).describe(`List packages response`),h({id:r().describe(`Package identifier`)}).describe(`Get package request`),h({package:q1.describe(`Package details`)}).describe(`Get package response`),h({manifest:H1.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),h({package:q1.describe(`Installed package details`),message:r().optional().describe(`Installation status message`),dependencyResolution:eje.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),h({id:r().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),h({id:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),h({id:r().describe(`Package ID to enable`)}).describe(`Enable package request`),h({package:q1.describe(`Enabled package details`),message:r().optional().describe(`Enable status message`)}).describe(`Enable package response`),h({id:r().describe(`Package ID to disable`)}).describe(`Disable package request`),h({package:q1.describe(`Disabled package details`),message:r().optional().describe(`Disable status message`)}).describe(`Disable package response`);var qje=E([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),Jje=h({type:r().describe(`Metadata type`),name:r().describe(`Metadata name`),changeType:qje.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:S().default(!1).describe(`Whether this change may conflict with customizations`),summary:r().optional().describe(`Human-readable change summary`),previousName:r().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),Yje=E([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),Xje=h({packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Currently installed version`),toVersion:r().describe(`Target upgrade version`),impactLevel:Yje.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:C(Jje).describe(`All metadata changes`),affectedCustomizations:P().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:S().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:C(r()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:C(h({packageId:r(),fromVersion:r(),toVersion:r()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:P().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:r().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`);h({id:r().describe(`Snapshot identifier`),packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Target upgrade version`),tenantId:r().optional().describe(`Tenant identifier`),previousManifest:H1.describe(`Complete manifest of the previous package version`),metadataSnapshot:C(h({type:r(),name:r(),metadata:d(r(),u())})).describe(`Snapshot of all package metadata`),customizationSnapshot:C(d(r(),u())).optional().describe(`Snapshot of customer customizations`),createdAt:r().datetime().describe(`Snapshot creation timestamp`),expiresAt:r().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:H1.optional().describe(`New manifest (if installing from local)`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`);var Zje=E([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`);h({success:S().describe(`Whether the upgrade succeeded`),phase:Zje.describe(`Current upgrade phase`),plan:Xje.optional().describe(`Upgrade plan`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r(),baseValue:u(),incomingValue:u(),customValue:u()})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if upgrade failed`),message:r().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),h({packageId:r().describe(`Package ID to rollback`),snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Version restored to`),message:r().optional().describe(`Rollback status message`)}).describe(`Rollback package response`);var J1=E([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),Qje=h({interval:P().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:P().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:P().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:P().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:r().optional().describe(`Method name to call for health check`),autoRestart:S().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:P().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)});h({status:J1,timestamp:r().datetime(),message:r().optional(),metrics:h({uptime:P().describe(`Plugin uptime in milliseconds`),memoryUsage:P().optional().describe(`Memory usage in bytes`),cpuUsage:P().optional().describe(`CPU usage percentage`),activeConnections:P().optional().describe(`Number of active connections`),errorRate:P().optional().describe(`Error rate (errors per minute)`),responseTime:P().optional().describe(`Average response time in ms`)}).partial().optional(),checks:C(h({name:r().describe(`Check name`),status:E([`passed`,`failed`,`warning`]),message:r().optional(),data:d(r(),u()).optional()})).optional(),dependencies:C(h({pluginId:r(),status:J1,message:r().optional()})).optional()});var $je=h({provider:E([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:C(r()).optional().describe(`Backend connection endpoints`),keyPrefix:r().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:P().int().min(0).optional().describe(`State expiration time in seconds`),auth:h({username:r().optional(),password:r().optional(),token:r().optional(),certificate:r().optional()}).optional(),replication:h({enabled:S().default(!0),minReplicas:P().int().min(1).default(1)}).optional(),customConfig:d(r(),u()).optional().describe(`Provider-specific configuration`)}),eMe=h({enabled:S().default(!1),watchPatterns:C(r()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:P().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:S().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:E([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:$je.optional().describe(`Configuration for distributed state management`),shutdownTimeout:P().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:C(r()).optional().describe(`Hook names to call before reload`),afterReload:C(r()).optional().describe(`Hook names to call after reload`)}),tMe=h({enabled:S().default(!0),fallbackMode:E([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:C(r()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:C(r()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:C(h({feature:r().describe(`Feature name`),enabled:S().describe(`Whether feature is available in degraded mode`),reason:r().optional()})).optional(),autoRecovery:h({enabled:S().default(!0),retryInterval:P().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:P().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),nMe=h({mode:E([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:h({major:S().default(!1).describe(`Allow major version updates`),minor:S().default(!0).describe(`Allow minor version updates`),patch:S().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:h({cron:r().optional(),timezone:r().default(`UTC`),maintenanceWindow:P().int().min(1).default(60)}).optional(),rollback:h({enabled:S().default(!0),automatic:S().default(!0),keepVersions:P().int().min(1).default(3),timeout:P().int().min(1e3).default(3e4)}).optional(),validation:h({checkCompatibility:S().default(!0),runTests:S().default(!1),testSuite:r().optional()}).optional()});h({pluginId:r(),version:r(),timestamp:r().datetime(),state:d(r(),u()),metadata:h({checksum:r().optional().describe(`State checksum for verification`),compressed:S().default(!1),encryption:r().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),h({health:Qje.optional(),hotReload:eMe.optional(),degradation:tMe.optional(),updates:nMe.optional(),resources:h({maxMemory:P().int().optional().describe(`Maximum memory in bytes`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:P().int().optional().describe(`Maximum concurrent connections`),timeout:P().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:h({enableMetrics:S().default(!0),enableTracing:S().default(!0),enableProfiling:S().default(!1),metricsInterval:P().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()});var Y1=E([`init`,`start`,`destroy`]).describe(`Plugin lifecycle phase`),X1=h({pluginName:r().describe(`Name of the plugin`),timestamp:P().int().describe(`Unix timestamp in milliseconds when event occurred`)});X1.extend({version:r().optional().describe(`Plugin version`)}),X1.extend({duration:P().min(0).optional().describe(`Duration of the lifecycle phase in milliseconds`),phase:Y1.optional().describe(`Lifecycle phase`)}),X1.extend({error:h({name:r().describe(`Error class name`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`),code:r().optional().describe(`Error code`)}).describe(`Serializable error representation`),phase:Y1.describe(`Lifecycle phase where error occurred`),errorMessage:r().optional().describe(`Error message`),errorStack:r().optional().describe(`Error stack trace`)}),h({serviceName:r().describe(`Name of the registered service`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),serviceType:r().optional().describe(`Type or interface name of the service`)}),h({serviceName:r().describe(`Name of the unregistered service`),timestamp:P().int().describe(`Unix timestamp in milliseconds`)}),h({hookName:r().describe(`Name of the hook`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),handlerCount:P().int().min(0).describe(`Number of handlers registered for this hook`)}),h({hookName:r().describe(`Name of the hook`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),args:C(u()).describe(`Arguments passed to the hook handlers`),handlerCount:P().int().min(0).optional().describe(`Number of handlers that will handle this event`)});var Z1=h({timestamp:P().int().describe(`Unix timestamp in milliseconds`)});Z1.extend({duration:P().min(0).optional().describe(`Total initialization duration in milliseconds`),pluginCount:P().int().min(0).optional().describe(`Number of plugins initialized`)}),Z1.extend({reason:r().optional().describe(`Reason for kernel shutdown`)}),E([`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 rMe=E([`load`,`unload`,`reload`,`enable`,`disable`]).describe(`Runtime plugin operation type`),iMe=h({type:E([`npm`,`local`,`url`,`registry`,`git`]).describe(`Plugin source type`),location:r().describe(`Package name, file path, URL, or git repository`),version:r().optional().describe(`Semver version range (e.g., "^1.0.0")`),integrity:r().optional().describe(`Subresource Integrity hash (e.g., "sha384-...")`)}).describe(`Plugin source location for dynamic resolution`),aMe=h({type:E([`onCommand`,`onRoute`,`onObject`,`onEvent`,`onService`,`onSchedule`,`onStartup`]).describe(`Trigger type for lazy activation`),pattern:r().describe(`Match pattern for the activation trigger`)}).describe(`Lazy activation trigger for a dynamic plugin`);h({pluginId:r().describe(`Unique plugin identifier`),source:iMe,activationEvents:C(aMe).optional().describe(`Lazy activation triggers; if omitted plugin starts immediately`),config:d(r(),u()).optional().describe(`Runtime configuration overrides`),priority:P().int().min(0).default(100).describe(`Loading priority (lower is higher)`),sandbox:S().default(!1).describe(`Run in an isolated sandbox`),timeout:P().int().min(1e3).default(6e4).describe(`Maximum time to complete loading in ms`)}).describe(`Request to dynamically load a plugin at runtime`),h({pluginId:r().describe(`Plugin to unload`),strategy:E([`graceful`,`forceful`,`drain`]).default(`graceful`).describe(`How to handle in-flight work during unload`),timeout:P().int().min(1e3).default(3e4).describe(`Maximum time to complete unloading in ms`),cleanupCache:S().default(!1).describe(`Remove cached code and assets after unload`),dependentAction:E([`cascade`,`warn`,`block`]).default(`block`).describe(`How to handle plugins that depend on this one`)}).describe(`Request to dynamically unload a plugin at runtime`),h({success:S(),operation:rMe,pluginId:r(),durationMs:P().int().min(0).optional(),version:r().optional(),error:h({code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),details:d(r(),u()).optional()}).optional(),warnings:C(r()).optional()}).describe(`Result of a dynamic plugin operation`);var oMe=h({type:E([`registry`,`npm`,`directory`,`url`]).describe(`Discovery source type`),endpoint:r().describe(`Registry URL, directory path, or manifest URL`),pollInterval:P().int().min(0).default(0).describe(`How often to re-scan for new plugins (0 = manual)`),filter:h({tags:C(r()).optional(),vendors:C(r()).optional(),minTrustLevel:E([`verified`,`trusted`,`community`,`untrusted`]).optional()}).optional()}).describe(`Source for runtime plugin discovery`),sMe=h({enabled:S().default(!1),sources:C(oMe).default([]),autoLoad:S().default(!1).describe(`Automatically load newly discovered plugins`),requireApproval:S().default(!0).describe(`Require admin approval before loading discovered plugins`)}).describe(`Runtime plugin discovery configuration`);h({enabled:S().default(!1).describe(`Enable runtime load/unload of plugins`),maxDynamicPlugins:P().int().min(1).default(50).describe(`Upper limit on runtime-loaded plugins`),discovery:sMe.optional(),defaultSandbox:S().default(!0).describe(`Sandbox dynamically loaded plugins by default`),allowedSources:C(E([`npm`,`local`,`url`,`registry`,`git`])).optional().describe(`Restrict which source types are permitted`),requireIntegrity:S().default(!0).describe(`Require integrity hash verification for remote sources`),operationTimeout:P().int().min(1e3).default(6e4).describe(`Default timeout for load/unload operations in ms`)}).describe(`Dynamic plugin loading subsystem configuration`);var cMe=E([`global`,`tenant`,`user`,`resource`,`plugin`]).describe(`Scope of permission application`),lMe=E([`create`,`read`,`update`,`delete`,`execute`,`manage`,`configure`,`share`,`export`,`import`,`admin`]).describe(`Type of action being permitted`),uMe=E([`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`),dMe=h({permissions:C(h({id:r().describe(`Unique permission identifier`),resource:uMe,actions:C(lMe),scope:cMe.default(`plugin`),filter:h({resourceIds:C(r()).optional(),condition:r().optional().describe(`Filter expression (e.g., owner = currentUser)`),fields:C(r()).optional().describe(`Allowed fields for data resources`)}).optional(),description:r(),required:S().default(!0),justification:r().optional().describe(`Why this permission is needed`)})),groups:C(h({name:r().describe(`Group name`),description:r(),permissions:C(r()).describe(`Permission IDs in this group`)})).optional(),defaultGrant:E([`prompt`,`allow`,`deny`,`inherit`]).default(`prompt`)}),fMe=h({engine:E([`v8-isolate`,`wasm`,`container`,`process`]).default(`v8-isolate`).describe(`Execution environment engine`),engineConfig:h({wasm:h({maxMemoryPages:P().int().min(1).max(65536).optional().describe(`Maximum WASM memory pages (64KB each)`),instructionLimit:P().int().min(1).optional().describe(`Maximum instructions before timeout`),enableSimd:S().default(!1).describe(`Enable WebAssembly SIMD support`),enableThreads:S().default(!1).describe(`Enable WebAssembly threads`),enableBulkMemory:S().default(!0).describe(`Enable bulk memory operations`)}).optional(),container:h({image:r().optional().describe(`Container image to use`),runtime:E([`docker`,`podman`,`containerd`]).default(`docker`),resources:h({cpuLimit:r().optional().describe(`CPU limit (e.g., "0.5", "2")`),memoryLimit:r().optional().describe(`Memory limit (e.g., "512m", "1g")`)}).optional(),networkMode:E([`none`,`bridge`,`host`]).default(`bridge`)}).optional(),v8Isolate:h({heapSizeMb:P().int().min(1).optional(),enableSnapshot:S().default(!0)}).optional()}).optional(),resourceLimits:h({maxMemory:P().int().optional().describe(`Maximum memory allocation`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU usage percentage`),timeout:P().int().min(0).optional().describe(`Maximum execution time`)}).optional()}),pMe=h({enabled:S().default(!0),level:E([`none`,`minimal`,`standard`,`strict`,`paranoid`]).default(`standard`),runtime:fMe.optional().describe(`Execution environment and isolation settings`),filesystem:h({mode:E([`none`,`readonly`,`restricted`,`full`]).default(`restricted`),allowedPaths:C(r()).optional().describe(`Whitelisted paths`),deniedPaths:C(r()).optional().describe(`Blacklisted paths`),maxFileSize:P().int().optional().describe(`Maximum file size in bytes`)}).optional(),network:h({mode:E([`none`,`local`,`restricted`,`full`]).default(`restricted`),allowedHosts:C(r()).optional().describe(`Whitelisted hosts`),deniedHosts:C(r()).optional().describe(`Blacklisted hosts`),allowedPorts:C(P()).optional().describe(`Allowed port numbers`),maxConnections:P().int().optional()}).optional(),process:h({allowSpawn:S().default(!1).describe(`Allow spawning child processes`),allowedCommands:C(r()).optional().describe(`Whitelisted commands`),timeout:P().int().optional().describe(`Process timeout in ms`)}).optional(),memory:h({maxHeap:P().int().optional().describe(`Maximum heap size in bytes`),maxStack:P().int().optional().describe(`Maximum stack size in bytes`)}).optional(),cpu:h({maxCpuPercent:P().min(0).max(100).optional(),maxThreads:P().int().optional()}).optional(),environment:h({mode:E([`none`,`readonly`,`restricted`,`full`]).default(`readonly`),allowedVars:C(r()).optional(),deniedVars:C(r()).optional()}).optional()}),Q1=h({cve:r().optional(),id:r(),severity:E([`critical`,`high`,`medium`,`low`,`info`]),category:r().optional(),title:r(),location:r().optional(),remediation:r().optional(),description:r(),affectedVersions:C(r()),fixedIn:C(r()).optional(),cvssScore:P().min(0).max(10).optional(),exploitAvailable:S().default(!1),patchAvailable:S().default(!1),workaround:r().optional(),references:C(r()).optional(),discoveredDate:r().datetime().optional(),publishedDate:r().datetime().optional()}),mMe=h({timestamp:r().datetime(),scanner:h({name:r(),version:r()}),status:E([`passed`,`failed`,`warning`]),vulnerabilities:C(Q1).optional(),codeIssues:C(h({severity:E([`error`,`warning`,`info`]),type:r().describe(`Issue type (e.g., sql-injection, xss)`),file:r(),line:P().int().optional(),message:r(),suggestion:r().optional()})).optional(),dependencyVulnerabilities:C(h({package:r(),version:r(),vulnerability:Q1})).optional(),licenseCompliance:h({status:E([`compliant`,`non-compliant`,`unknown`]),issues:C(h({package:r(),license:r(),reason:r()})).optional()}).optional(),summary:h({totalVulnerabilities:P().int(),criticalCount:P().int(),highCount:P().int(),mediumCount:P().int(),lowCount:P().int(),infoCount:P().int()})}),hMe=h({csp:h({directives:d(r(),C(r())).optional(),reportOnly:S().default(!1)}).optional(),cors:h({allowedOrigins:C(r()),allowedMethods:C(r()),allowedHeaders:C(r()),allowCredentials:S().default(!1),maxAge:P().int().optional()}).optional(),rateLimit:h({enabled:S().default(!0),maxRequests:P().int(),windowMs:P().int().describe(`Time window in milliseconds`),strategy:E([`fixed`,`sliding`,`token-bucket`]).default(`sliding`)}).optional(),authentication:h({required:S().default(!0),methods:C(E([`jwt`,`oauth2`,`api-key`,`session`,`certificate`])),tokenExpiration:P().int().optional().describe(`Token expiration in seconds`)}).optional(),encryption:h({dataAtRest:S().default(!1).describe(`Encrypt data at rest`),dataInTransit:S().default(!0).describe(`Enforce HTTPS/TLS`),algorithm:r().optional().describe(`Encryption algorithm`),minKeyLength:P().int().optional().describe(`Minimum key length in bits`)}).optional(),auditLog:h({enabled:S().default(!0),events:C(r()).optional().describe(`Events to log`),retention:P().int().optional().describe(`Log retention in days`)}).optional()}),gMe=E([`verified`,`trusted`,`community`,`untrusted`,`blocked`]).describe(`Trust level of the plugin`);h({pluginId:r(),trustLevel:gMe,permissions:dMe,sandbox:pMe,policy:hMe.optional(),scanResults:C(mMe).optional(),vulnerabilities:C(Q1).optional(),codeSigning:h({signed:S(),signature:r().optional(),certificate:r().optional(),algorithm:r().optional(),timestamp:r().datetime().optional()}).optional(),certifications:C(h({name:r().describe(`Certification name (e.g., SOC 2, ISO 27001)`),issuer:r(),issuedDate:r().datetime(),expiryDate:r().datetime().optional(),certificateUrl:r().url().optional()})).optional(),securityContact:h({email:r().email().optional(),url:r().url().optional(),pgpKey:r().optional()}).optional(),vulnerabilityDisclosure:h({policyUrl:r().url().optional(),responseTime:P().int().optional().describe(`Expected response time in hours`),bugBounty:S().default(!1)}).optional()});var $1=/^[a-z][a-z0-9_]*$/,_Me=r().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];$1.test(e)||t.addIssue({code:de.custom,message:`Domain directory '${e}' must be lowercase snake_case`})}let r=n[n.length-1];r===`index.ts`||r===`main.ts`||$1.test(r.split(`.`)[0])||t.addIssue({code:de.custom,message:`Filename '${r}' base name must be lowercase snake_case`})});h({name:r().regex($1).describe(`Module name (snake_case)`),files:C(r()).describe(`List of files in this module`),metadata:d(r(),u()).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:de.custom,message:`Module '${e.name}' is missing an 'index.ts' entry point.`})}),h({root:r().describe(`Root directory path of the plugin project`),files:C(r()).describe(`List of all file paths relative to root`),metadata:d(r(),u()).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:de.custom,message:`Missing 'objectstack.config.ts' configuration file.`}),e.files.filter(e=>e.startsWith(`src/`)).forEach(e=>{let n=_Me.safeParse(e);n.success||n.error.issues.forEach(n=>{t.addIssue({...n,path:[e]})})})});var vMe=h({field:r().describe(`Field name that failed validation`),message:r().describe(`Human-readable error message`),code:r().optional().describe(`Machine-readable error code`)}),yMe=h({field:r().describe(`Field name with warning`),message:r().describe(`Human-readable warning message`),code:r().optional().describe(`Machine-readable warning code`)});h({valid:S().describe(`Whether the plugin passed validation`),errors:C(vMe).optional().describe(`Validation errors`),warnings:C(yMe).optional().describe(`Validation warnings`)}),h({name:r().min(1).describe(`Unique plugin identifier`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic version (e.g., 1.0.0)`),dependencies:C(r()).optional().describe(`Array of plugin names this plugin depends on`),signature:r().optional().describe(`Cryptographic signature for plugin verification`)}).passthrough().describe(`Plugin metadata for validation`);var bMe=h({major:P().int().min(0).describe(`Major version (breaking changes)`),minor:P().int().min(0).describe(`Minor version (backward compatible features)`),patch:P().int().min(0).describe(`Patch version (backward compatible fixes)`),preRelease:r().optional().describe(`Pre-release identifier (alpha, beta, rc.1)`),build:r().optional().describe(`Build metadata`)}).describe(`Semantic version number`);l([r().regex(/^[\d.]+$/).describe("Exact version: `1.2.3`"),r().regex(/^\^[\d.]+$/).describe("Compatible with: `^1.2.3` (`>=1.2.3 <2.0.0`)"),r().regex(/^~[\d.]+$/).describe("Approximately: `~1.2.3` (`>=1.2.3 <1.3.0`)"),r().regex(/^>=[\d.]+$/).describe("Greater than or equal: `>=1.2.3`"),r().regex(/^>[\d.]+$/).describe("Greater than: `>1.2.3`"),r().regex(/^<=[\d.]+$/).describe("Less than or equal: `<=1.2.3`"),r().regex(/^<[\d.]+$/).describe("Less than: `<1.2.3`"),r().regex(/^[\d.]+ - [\d.]+$/).describe("Range: `1.2.3 - 2.3.4`"),m(`*`).describe(`Any version`),m(`latest`).describe(`Latest stable version`)]);var xMe=E([`fully-compatible`,`backward-compatible`,`deprecated-compatible`,`breaking-changes`,`incompatible`]).describe(`Compatibility level between versions`),e0=h({introducedIn:r().describe(`Version that introduced this breaking change`),type:E([`api-removed`,`api-renamed`,`api-signature-changed`,`behavior-changed`,`dependency-changed`,`configuration-changed`,`protocol-changed`]),description:r(),migrationGuide:r().optional().describe(`How to migrate from old to new`),deprecatedIn:r().optional().describe(`Version where old API was deprecated`),removedIn:r().optional().describe(`Version where old API will be removed`),automatedMigration:S().default(!1).describe(`Whether automated migration tool is available`),severity:E([`critical`,`major`,`minor`]).describe(`Impact severity`)}),SMe=h({feature:r().describe(`Deprecated feature identifier`),deprecatedIn:r(),removeIn:r().optional(),reason:r(),alternative:r().optional().describe(`What to use instead`),migrationPath:r().optional().describe(`How to migrate to alternative`)}),t0=h({from:r().describe(`Version being upgraded from`),to:r().describe(`Version being upgraded to`),compatibility:xMe,breakingChanges:C(e0).optional(),migrationRequired:S().default(!1),migrationComplexity:E([`trivial`,`simple`,`moderate`,`complex`,`major`]).optional(),estimatedMigrationTime:P().optional(),migrationScript:r().optional().describe(`Path to migration script`),testCoverage:P().min(0).max(100).optional().describe(`Percentage of migration covered by tests`)});h({pluginId:r(),currentVersion:r(),compatibilityMatrix:C(t0),supportedVersions:C(h({version:r(),supported:S(),endOfLife:r().datetime().optional().describe(`End of support date`),securitySupport:S().default(!1).describe(`Still receives security updates`)})),minimumCompatibleVersion:r().optional().describe(`Oldest version that can be directly upgraded`)});var CMe=h({type:E([`version-mismatch`,`missing-dependency`,`circular-dependency`,`incompatible-versions`,`conflicting-interfaces`]),plugins:C(h({pluginId:r(),version:r(),requirement:r().optional().describe(`What this plugin requires`)})),description:r(),resolutions:C(h({strategy:E([`upgrade`,`downgrade`,`replace`,`disable`,`manual`]),description:r(),automaticResolution:S().default(!1),riskLevel:E([`low`,`medium`,`high`])})).optional(),severity:E([`critical`,`error`,`warning`,`info`])});h({success:S(),resolved:C(h({pluginId:r(),version:r(),resolvedVersion:r()})).optional(),conflicts:C(CMe).optional(),warnings:C(r()).optional(),installationOrder:C(r()).optional().describe(`Plugin IDs in order they should be installed`),dependencyGraph:d(r(),C(r())).optional().describe(`Map of plugin ID to its dependencies`)}),h({enabled:S().default(!1),maxConcurrentVersions:P().int().min(1).default(2).describe(`How many versions can run at the same time`),selectionStrategy:E([`latest`,`stable`,`compatible`,`pinned`,`canary`,`custom`]).default(`latest`),routing:C(h({condition:r().describe(`Routing condition (e.g., tenant, user, feature flag)`),version:r().describe(`Version to use when condition matches`),priority:P().int().default(100).describe(`Rule priority`)})).optional(),rollout:h({enabled:S().default(!1),strategy:E([`percentage`,`blue-green`,`canary`]),percentage:P().min(0).max(100).optional().describe(`Percentage of traffic to new version`),duration:P().int().optional().describe(`Rollout duration in milliseconds`)}).optional()}),h({pluginId:r(),version:bMe,versionString:r().describe(`Full version string (e.g., 1.2.3-beta.1+build.123)`),releaseDate:r().datetime(),releaseNotes:r().optional(),breakingChanges:C(e0).optional(),deprecations:C(SMe).optional(),compatibilityMatrix:C(t0).optional(),securityFixes:C(h({cve:r().optional().describe(`CVE identifier`),severity:E([`critical`,`high`,`medium`,`low`]),description:r(),fixedIn:r().describe(`Version where vulnerability was fixed`)})).optional(),statistics:h({downloads:P().int().min(0).optional(),installations:P().int().min(0).optional(),ratings:P().min(0).max(5).optional()}).optional(),support:h({status:E([`active`,`maintenance`,`deprecated`,`eol`]),endOfLife:r().datetime().optional(),securitySupport:S().default(!0)})});var n0=E([`singleton`,`transient`,`scoped`]).describe(`Service scope type`);h({name:r().min(1).describe(`Unique service name identifier`),scope:n0.optional().default(`singleton`).describe(`Service scope type`),type:r().optional().describe(`Service type or interface name`),registeredAt:P().int().optional().describe(`Unix timestamp in milliseconds when service was registered`),metadata:d(r(),u()).optional().describe(`Additional service-specific metadata`)}),h({strictMode:S().optional().default(!0).describe(`Throw errors on invalid operations (duplicate registration, service not found, etc.)`),allowOverwrite:S().optional().default(!1).describe(`Allow overwriting existing service registrations`),enableLogging:S().optional().default(!1).describe(`Enable logging for service registration and retrieval`),scopeTypes:C(r()).optional().describe(`Supported scope types`),maxServices:P().int().min(1).optional().describe(`Maximum number of services that can be registered`)}),h({name:r().min(1).describe(`Unique service name identifier`),scope:n0.optional().default(`singleton`).describe(`Service scope type`),factoryType:E([`sync`,`async`]).optional().default(`sync`).describe(`Whether factory is synchronous or asynchronous`),singleton:S().optional().default(!0).describe(`Whether to cache the factory result (singleton pattern)`)}),h({scopeType:r().describe(`Type of scope`),scopeId:r().optional().describe(`Unique scope identifier`),metadata:d(r(),u()).optional().describe(`Scope-specific context metadata`)}),h({scopeId:r().describe(`Unique scope identifier`),scopeType:r().describe(`Type of scope`),createdAt:P().int().describe(`Unix timestamp in milliseconds when scope was created`),serviceCount:P().int().min(0).optional().describe(`Number of services registered in this scope`),metadata:d(r(),u()).optional().describe(`Scope-specific context metadata`)}),h({timeout:P().int().min(0).optional().default(3e4).describe(`Maximum time in milliseconds to wait for each plugin to start`),rollbackOnFailure:S().optional().default(!0).describe(`Whether to rollback already-started plugins if any plugin fails`),healthCheck:S().optional().default(!1).describe(`Whether to run health checks after plugin startup`),parallel:S().optional().default(!1).describe(`Whether to start plugins in parallel when dependencies allow`),context:u().optional().describe(`Custom context object to pass to plugin lifecycle methods`)});var wMe=h({healthy:S().describe(`Whether the plugin is healthy`),timestamp:P().int().describe(`Unix timestamp in milliseconds when health check was performed`),details:d(r(),u()).optional().describe(`Optional plugin-specific health details`),message:r().optional().describe(`Error message if plugin is unhealthy`)});h({results:C(h({plugin:h({name:r(),version:r().optional()}).passthrough().describe(`Plugin metadata`),success:S().describe(`Whether the plugin started successfully`),duration:P().min(0).describe(`Time taken to start the plugin in milliseconds`),error:h({name:r().describe(`Error class name`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`),code:r().optional().describe(`Error code`)}).optional().describe(`Serializable error representation if startup failed`),health:wMe.optional().describe(`Health status after startup if health check was enabled`)})).describe(`Startup results for each plugin`),totalDuration:P().min(0).describe(`Total time taken for all plugins in milliseconds`),allSuccessful:S().describe(`Whether all plugins started successfully`),rolledBack:C(r()).optional().describe(`Names of plugins that were rolled back`)});var TMe=h({id:r().regex(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+$/).describe(`Vendor identifier (reverse domain)`),name:r(),website:r().url().optional(),email:r().email().optional(),verified:S().default(!1).describe(`Whether vendor is verified by ObjectStack`),trustLevel:E([`official`,`verified`,`community`,`unverified`]).default(`unverified`)}),EMe=h({testCoverage:P().min(0).max(100).optional(),documentationScore:P().min(0).max(100).optional(),codeQuality:P().min(0).max(100).optional(),securityScan:h({lastScanDate:r().datetime().optional(),vulnerabilities:h({critical:P().int().min(0).default(0),high:P().int().min(0).default(0),medium:P().int().min(0).default(0),low:P().int().min(0).default(0)}).optional(),passed:S().default(!1)}).optional(),conformanceTests:C(h({protocolId:r().describe(`Protocol being tested`),passed:S(),totalTests:P().int().min(0),passedTests:P().int().min(0),lastRunDate:r().datetime().optional()})).optional()}),DMe=h({downloads:P().int().min(0).default(0),downloadsLastMonth:P().int().min(0).default(0),activeInstallations:P().int().min(0).default(0),ratings:h({average:P().min(0).max(5).default(0),count:P().int().min(0).default(0),distribution:h({5:P().int().min(0).default(0),4:P().int().min(0).default(0),3:P().int().min(0).default(0),2:P().int().min(0).default(0),1:P().int().min(0).default(0)}).optional()}).optional(),stars:P().int().min(0).optional(),dependents:P().int().min(0).default(0)});h({id:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Plugin identifier (reverse domain notation)`),version:r().regex(/^\d+\.\d+\.\d+$/),name:r(),description:r().optional(),readme:r().optional(),category:E([`data`,`integration`,`ui`,`analytics`,`security`,`automation`,`ai`,`utility`,`driver`,`gateway`,`adapter`]).optional(),tags:C(r()).optional(),vendor:TMe,capabilities:B1.optional(),compatibility:h({minObjectStackVersion:r().optional(),maxObjectStackVersion:r().optional(),nodeVersion:r().optional(),platforms:C(E([`linux`,`darwin`,`win32`,`browser`])).optional()}).optional(),links:h({homepage:r().url().optional(),repository:r().url().optional(),documentation:r().url().optional(),bugs:r().url().optional(),changelog:r().url().optional()}).optional(),media:h({icon:r().url().optional(),logo:r().url().optional(),screenshots:C(r().url()).optional(),video:r().url().optional()}).optional(),quality:EMe.optional(),statistics:DMe.optional(),license:r().optional().describe(`SPDX license identifier`),pricing:h({model:E([`free`,`freemium`,`paid`,`enterprise`]),price:P().min(0).optional(),currency:r().default(`USD`).optional(),billingPeriod:E([`one-time`,`monthly`,`yearly`]).optional()}).optional(),publishedAt:r().datetime().optional(),updatedAt:r().datetime().optional(),deprecated:S().default(!1),deprecationMessage:r().optional(),replacedBy:r().optional().describe(`Plugin ID that replaces this one`),flags:h({experimental:S().default(!1),beta:S().default(!1),featured:S().default(!1),verified:S().default(!1)}).optional()}),h({query:r().optional(),category:C(r()).optional(),tags:C(r()).optional(),trustLevel:C(E([`official`,`verified`,`community`,`unverified`])).optional(),implementsProtocols:C(r()).optional(),pricingModel:C(E([`free`,`freemium`,`paid`,`enterprise`])).optional(),minRating:P().min(0).max(5).optional(),sortBy:E([`relevance`,`downloads`,`rating`,`updated`,`name`]).optional(),sortOrder:E([`asc`,`desc`]).default(`desc`).optional(),page:P().int().min(1).default(1).optional(),limit:P().int().min(1).max(100).default(20).optional()}),h({pluginId:r(),version:r().optional().describe(`Defaults to latest`),config:d(r(),u()).optional(),autoUpdate:S().default(!1).optional(),options:h({skipDependencies:S().default(!1).optional(),force:S().default(!1).optional(),target:E([`system`,`space`,`user`]).default(`space`).optional()}).optional()});var OMe=E([`critical`,`high`,`medium`,`low`,`info`]).describe(`Severity level of a security vulnerability`),kMe=h({cve:r().regex(/^CVE-\d{4}-\d+$/).optional().describe(`CVE identifier`),id:r().describe(`Vulnerability ID`),title:r().describe(`Short title summarizing the vulnerability`),description:r().describe(`Detailed description of the vulnerability`),severity:OMe.describe(`Severity level of this vulnerability`),cvss:P().min(0).max(10).optional().describe(`CVSS score ranging from 0 to 10`),package:h({name:r().describe(`Name of the affected package`),version:r().describe(`Version of the affected package`),ecosystem:r().optional().describe(`Package ecosystem (e.g., npm, pip, maven)`)}).describe(`Affected package information`),vulnerableVersions:r().describe(`Semver range of vulnerable versions`),patchedVersions:r().optional().describe(`Semver range of patched versions`),references:C(h({type:E([`advisory`,`article`,`report`,`web`]).describe(`Type of reference source`),url:r().url().describe(`URL of the reference`)})).default([]).describe(`External references related to the vulnerability`),cwe:C(r()).default([]).describe(`CWE identifiers associated with this vulnerability`),publishedAt:r().datetime().optional().describe(`ISO 8601 date when the vulnerability was published`),mitigation:r().optional().describe(`Recommended steps to mitigate the vulnerability`)}).describe(`A known security vulnerability in a package dependency`);h({scanId:r().uuid().describe(`Unique identifier for this security scan`),plugin:h({id:r().describe(`Plugin identifier`),version:r().describe(`Plugin version that was scanned`)}).describe(`Plugin that was scanned`),scannedAt:r().datetime().describe(`ISO 8601 timestamp when the scan was performed`),scanner:h({name:r().describe(`Scanner name (e.g., snyk, osv, trivy)`),version:r().describe(`Version of the scanner tool`)}).describe(`Information about the scanner tool used`),status:E([`passed`,`failed`,`warning`]).describe(`Overall result status of the security scan`),vulnerabilities:C(kMe).describe(`List of vulnerabilities discovered during the scan`),summary:h({critical:P().int().min(0).default(0).describe(`Count of critical severity vulnerabilities`),high:P().int().min(0).default(0).describe(`Count of high severity vulnerabilities`),medium:P().int().min(0).default(0).describe(`Count of medium severity vulnerabilities`),low:P().int().min(0).default(0).describe(`Count of low severity vulnerabilities`),info:P().int().min(0).default(0).describe(`Count of informational severity vulnerabilities`),total:P().int().min(0).default(0).describe(`Total count of all vulnerabilities`)}).describe(`Summary counts of vulnerabilities by severity`),licenseIssues:C(h({package:r().describe(`Name of the package with a license issue`),license:r().describe(`License identifier of the package`),reason:r().describe(`Reason the license is flagged`),severity:E([`error`,`warning`,`info`]).describe(`Severity of the license compliance issue`)})).default([]).describe(`License compliance issues found during the scan`),codeQuality:h({score:P().min(0).max(100).optional().describe(`Overall code quality score from 0 to 100`),issues:C(h({type:E([`security`,`quality`,`style`]).describe(`Category of the code quality issue`),severity:E([`error`,`warning`,`info`]).describe(`Severity of the code quality issue`),message:r().describe(`Description of the code quality issue`),file:r().optional().describe(`File path where the issue was found`),line:P().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:r().datetime().optional().describe(`ISO 8601 timestamp for the next scheduled scan`)}).describe(`Result of a security scan performed on a plugin`),h({id:r().describe(`Unique identifier for the security policy`),name:r().describe(`Human-readable name of the security policy`),autoScan:h({enabled:S().default(!0).describe(`Whether automatic scanning is enabled`),frequency:E([`on-publish`,`daily`,`weekly`,`monthly`]).default(`daily`).describe(`How often automatic scans are performed`)}).describe(`Automatic security scanning configuration`),thresholds:h({maxCritical:P().int().min(0).default(0).describe(`Maximum allowed critical vulnerabilities before blocking`),maxHigh:P().int().min(0).default(0).describe(`Maximum allowed high vulnerabilities before blocking`),maxMedium:P().int().min(0).default(5).describe(`Maximum allowed medium vulnerabilities before warning`)}).describe(`Vulnerability count thresholds for policy enforcement`),allowedLicenses:C(r()).default([`MIT`,`Apache-2.0`,`BSD-3-Clause`,`BSD-2-Clause`,`ISC`]).describe(`List of SPDX license identifiers that are permitted`),prohibitedLicenses:C(r()).default([`GPL-3.0`,`AGPL-3.0`]).describe(`List of SPDX license identifiers that are prohibited`),codeSigning:h({required:S().default(!1).describe(`Whether code signing is required for plugins`),allowedSigners:C(r()).default([]).describe(`List of trusted signer identities`)}).optional().describe(`Code signing requirements for plugin artifacts`),sandbox:h({networkAccess:E([`none`,`localhost`,`allowlist`,`all`]).default(`all`).describe(`Level of network access granted to the plugin`),allowedDestinations:C(r()).default([]).describe(`Permitted network destinations when using allowlist mode`),filesystemAccess:E([`none`,`read-only`,`temp-only`,`full`]).default(`full`).describe(`Level of file system access granted to the plugin`),maxMemoryMB:P().int().positive().optional().describe(`Maximum memory allocation in megabytes`),maxCPUSeconds:P().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 AMe=h({name:r().describe(`Package name or identifier`),versionConstraint:r().describe("Semver range (e.g., `^1.0.0`, `>=2.0.0 <3.0.0`)"),type:E([`required`,`optional`,`peer`,`dev`]).default(`required`).describe(`Category of the dependency relationship`),resolvedVersion:r().optional().describe(`Concrete version resolved during dependency resolution`)}).describe(`A package dependency with its version constraint`),jMe=h({id:r().describe(`Unique identifier of the package`),version:r().describe(`Resolved version of the package`),dependencies:C(AMe).default([]).describe(`Dependencies required by this package`),depth:P().int().min(0).describe(`Depth level in the dependency tree (0 = root)`),isDirect:S().describe(`Whether this is a direct (top-level) dependency`),metadata:h({name:r().describe(`Display name of the package`),description:r().optional().describe(`Short description of the package`),license:r().optional().describe(`SPDX license identifier of the package`),homepage:r().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`),MMe=h({root:h({id:r().describe(`Identifier of the root package`),version:r().describe(`Version of the root package`)}).describe(`Root package of the dependency graph`),nodes:C(jMe).describe(`All resolved package nodes in the dependency graph`),edges:C(h({from:r().describe(`Package ID`),to:r().describe(`Package ID`),constraint:r().describe(`Version constraint`)})).describe(`Directed edges representing dependency relationships`),stats:h({totalDependencies:P().int().min(0).describe(`Total number of resolved dependencies`),directDependencies:P().int().min(0).describe(`Number of direct (top-level) dependencies`),maxDepth:P().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`),NMe=h({package:r().describe(`Name of the package with conflicting version requirements`),conflicts:C(h({version:r().describe(`Conflicting version of the package`),requestedBy:C(r()).describe(`Packages that require this version`),constraint:r().describe(`Semver constraint that produced this version requirement`)})).describe(`List of conflicting version requirements`),resolution:h({strategy:E([`pick-highest`,`pick-lowest`,`manual`]).describe(`Strategy used to resolve the conflict`),version:r().optional().describe(`Resolved version selected by the strategy`),reason:r().optional().describe(`Explanation of why this resolution was chosen`)}).optional().describe(`Suggested resolution for the conflict`),severity:E([`error`,`warning`,`info`]).describe(`Severity level of the dependency conflict`)}).describe(`A detected conflict between dependency version requirements`);h({status:E([`success`,`conflict`,`error`]).describe(`Overall status of the dependency resolution`),graph:MMe.optional().describe(`Resolved dependency graph if resolution succeeded`),conflicts:C(NMe).default([]).describe(`List of dependency conflicts detected during resolution`),errors:C(h({package:r().describe(`Name of the package that caused the error`),error:r().describe(`Error message describing what went wrong`)})).default([]).describe(`Errors encountered during dependency resolution`),installOrder:C(r()).default([]).describe(`Topologically sorted list of package IDs for installation`),resolvedIn:P().int().min(0).optional().describe(`Time taken to resolve dependencies in milliseconds`)}).describe(`Result of a dependency resolution process`);var PMe=h({name:r().describe(`Name of the software component`),version:r().describe(`Version of the software component`),purl:r().optional().describe(`Package URL identifier`),license:r().optional().describe(`SPDX license identifier of the component`),hashes:h({sha256:r().optional().describe(`SHA-256 hash of the component artifact`),sha512:r().optional().describe(`SHA-512 hash of the component artifact`)}).optional().describe(`Cryptographic hashes for integrity verification`),supplier:h({name:r().describe(`Name of the component supplier`),url:r().url().optional().describe(`URL of the component supplier`)}).optional().describe(`Supplier information for the component`),externalRefs:C(h({type:E([`website`,`repository`,`documentation`,`issue-tracker`]).describe(`Type of external reference`),url:r().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`);h({format:E([`spdx`,`cyclonedx`]).default(`cyclonedx`).describe(`SBOM standard format used`),version:r().describe(`Version of the SBOM specification`),plugin:h({id:r().describe(`Plugin identifier`),version:r().describe(`Plugin version`),name:r().describe(`Human-readable plugin name`)}).describe(`Metadata about the plugin this SBOM describes`),components:C(PMe).describe(`List of software components included in the plugin`),generatedAt:r().datetime().describe(`ISO 8601 timestamp when the SBOM was generated`),generator:h({name:r().describe(`Name of the SBOM generator tool`),version:r().describe(`Version of the SBOM generator tool`)}).optional().describe(`Tool used to generate this SBOM`)}).describe(`Software Bill of Materials for a plugin`),h({pluginId:r().describe(`Unique identifier of the plugin`),version:r().describe(`Version of the plugin artifact`),build:h({timestamp:r().datetime().describe(`ISO 8601 timestamp when the build was produced`),environment:h({os:r().describe(`Operating system used for the build`),arch:r().describe(`CPU architecture used for the build`),nodeVersion:r().describe(`Node.js version used for the build`)}).optional().describe(`Environment details where the build was executed`),source:h({repository:r().url().describe(`URL of the source repository`),commit:r().regex(/^[a-f0-9]{40}$/).describe(`Full SHA-1 commit hash of the source`),branch:r().optional().describe(`Branch name the build was produced from`),tag:r().optional().describe(`Git tag associated with the build`)}).optional().describe(`Source repository information for the build`),builder:h({name:r().describe(`Name of the person or system that produced the build`),email:r().email().optional().describe(`Email address of the builder`)}).optional().describe(`Identity of the builder who produced the artifact`)}).describe(`Build provenance information`),artifacts:C(h({filename:r().describe(`Name of the artifact file`),sha256:r().describe(`SHA-256 hash of the artifact`),size:P().int().positive().describe(`Size of the artifact in bytes`)})).describe(`List of build artifacts with integrity hashes`),signatures:C(h({algorithm:E([`rsa`,`ecdsa`,`ed25519`]).describe(`Cryptographic algorithm used for signing`),publicKey:r().describe(`Public key used to verify the signature`),signature:r().describe(`Digital signature value`),signedBy:r().describe(`Identity of the signer`),timestamp:r().datetime().describe(`ISO 8601 timestamp when the signature was created`)})).default([]).describe(`Cryptographic signatures for the plugin artifact`),attestations:C(h({type:E([`code-review`,`security-scan`,`test-results`,`ci-build`]).describe(`Type of attestation`),status:E([`passed`,`failed`]).describe(`Result status of the attestation`),url:r().url().optional().describe(`URL with details about the attestation`),timestamp:r().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`),h({pluginId:r().describe(`Unique identifier of the plugin`),score:P().min(0).max(100).describe(`Overall trust score from 0 to 100`),components:h({vendorReputation:P().min(0).max(100).describe(`Vendor reputation score from 0 to 100`),securityScore:P().min(0).max(100).describe(`Security scan results score from 0 to 100`),codeQuality:P().min(0).max(100).describe(`Code quality score from 0 to 100`),communityScore:P().min(0).max(100).describe(`Community engagement score from 0 to 100`),maintenanceScore:P().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:E([`verified`,`trusted`,`neutral`,`untrusted`,`blocked`]).describe(`Computed trust level based on the overall score`),badges:C(E([`official`,`verified-vendor`,`security-scanned`,`code-signed`,`open-source`,`popular`])).default([]).describe(`Verification badges earned by the plugin`),updatedAt:r().datetime().describe(`ISO 8601 timestamp when the trust score was last updated`)}).describe(`Trust score and verification status for a plugin`);var FMe=h({userId:r().optional(),tenantId:r().optional(),roles:C(r()).default([]),permissions:C(r()).default([]),isSystem:S().default(!1),accessToken:r().optional(),transaction:u().optional(),traceId:r().optional()});h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var Y=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),r0=h({ariaLabel:Y.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var IMe=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),LMe=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:IMe.optional().describe(`Default number formatting rules`),dateFormat:LMe.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var i0=E(`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(`.`)),a0=h({field:r().describe(`Data field key`),title:Y.optional().describe(`Axis display title`),format:r().optional().describe(`Value format string (e.g., "$0,0.00")`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),stepSize:P().optional().describe(`Step size for ticks`),showGridLines:S().default(!0),position:E([`left`,`right`,`top`,`bottom`]).optional().describe(`Axis position`),logarithmic:S().default(!1)}),RMe=h({name:r().describe(`Field name or series identifier`),label:Y.optional().describe(`Series display label`),type:i0.optional().describe(`Override chart type for this series`),color:r().optional().describe(`Series color (hex/rgb/token)`),stack:r().optional().describe(`Stack identifier to group series`),yAxis:E([`left`,`right`]).default(`left`).describe(`Bind to specific Y-Axis`)}),zMe=h({type:E([`line`,`region`]).default(`line`),axis:E([`x`,`y`]).default(`y`),value:l([P(),r()]).describe(`Start value`),endValue:l([P(),r()]).optional().describe(`End value for regions`),color:r().optional(),label:Y.optional(),style:E([`solid`,`dashed`,`dotted`]).default(`dashed`)}),BMe=h({tooltips:S().default(!0),zoom:S().default(!1),brush:S().default(!1),clickAction:r().optional().describe(`Action ID to trigger on click`)}),o0=h({type:i0,title:Y.optional().describe(`Chart title`),subtitle:Y.optional().describe(`Chart subtitle`),description:Y.optional().describe(`Accessibility description`),xAxis:a0.optional().describe(`X-Axis configuration`),yAxis:C(a0).optional().describe(`Y-Axis configuration (support dual axis)`),series:C(RMe).optional().describe(`Defined series configuration`),colors:C(r()).optional().describe(`Color palette`),height:P().optional().describe(`Fixed height in pixels`),showLegend:S().default(!0).describe(`Display legend`),showDataLabels:S().default(!1).describe(`Display data labels`),annotations:C(zMe).optional(),interaction:BMe.optional(),aria:r0.optional().describe(`ARIA accessibility attributes`)}),s0=E([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),VMe=h({xs:P().min(1).max(12).optional(),sm:P().min(1).max(12).optional(),md:P().min(1).max(12).optional(),lg:P().min(1).max(12).optional(),xl:P().min(1).max(12).optional(),"2xl":P().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),HMe=h({xs:P().optional(),sm:P().optional(),md:P().optional(),lg:P().optional(),xl:P().optional(),"2xl":P().optional()}).describe(`Display order per breakpoint`),c0=h({breakpoint:s0.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:C(s0).optional().describe(`Hide on these breakpoints`),columns:VMe.optional().describe(`Grid columns per breakpoint`),order:HMe.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),l0=h({lazyLoad:S().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:h({enabled:S().default(!1).describe(`Enable virtual scrolling`),itemHeight:P().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:P().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:E([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:S().optional().describe(`Prefetch data before component is visible`),pageSize:P().optional().describe(`Number of items per page for pagination`),debounceMs:P().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),UMe=r().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)`),u0=r().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)`);r().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 d0=h({enabled:S().default(!1).describe(`Enable public sharing`),publicLink:r().optional().describe(`Generated public share URL`),password:r().optional().describe(`Password required to access shared link`),allowedDomains:C(r()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:r().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:S().optional().default(!1).describe(`Allow access without authentication`)}),WMe=h({enabled:S().default(!1).describe(`Enable iframe embedding`),allowedOrigins:C(r()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:r().optional().default(`100%`).describe(`Embed width (CSS value)`),height:r().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:S().optional().default(!0).describe(`Show interface header in embed`),showNavigation:S().optional().default(!1).describe(`Show navigation in embed`),responsive:S().optional().default(!0).describe(`Enable responsive resizing`)}),f0=h({id:u0.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:Y.describe(`Display proper label`),icon:r().optional().describe(`Icon name`),order:P().optional().describe(`Sort order within the same level (lower = first)`),badge:l([r(),P()]).optional().describe(`Badge text or count displayed on the item`),visible:r().optional().describe(`Visibility formula condition`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this item`)}),GMe=f0.extend({type:m(`object`),objectName:r().describe(`Target object name`),viewName:r().optional().describe(`Default list view to open. Defaults to "all"`)}),KMe=f0.extend({type:m(`dashboard`),dashboardName:r().describe(`Target dashboard name`)}),qMe=f0.extend({type:m(`page`),pageName:r().describe(`Target custom page component name`),params:d(r(),u()).optional().describe(`Parameters passed to the page context`)}),JMe=f0.extend({type:m(`url`),url:r().describe(`Target external URL`),target:E([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),YMe=f0.extend({type:m(`report`),reportName:r().describe(`Target report name`)}),XMe=f0.extend({type:m(`action`),actionDef:h({actionName:r().describe(`Action machine name to execute`),params:d(r(),u()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),ZMe=f0.extend({type:m(`group`),expanded:S().default(!1).describe(`Default expansion state in sidebar`)}),p0=F(()=>l([GMe.extend({children:C(p0).optional().describe(`Child navigation items (e.g. specific views)`)}),KMe,qMe,JMe,YMe,XMe,ZMe.extend({children:C(p0).describe(`Child navigation items`)})])),QMe=h({primaryColor:r().optional().describe(`Primary theme color hex code`),logo:r().optional().describe(`Custom logo URL for this app`),favicon:r().optional().describe(`Custom favicon URL for this app`)}),$Me=h({id:u0.describe(`Unique area identifier (lowercase snake_case)`),label:Y.describe(`Area display label`),icon:r().optional().describe(`Area icon name`),order:P().optional().describe(`Sort order among areas (lower = first)`),description:Y.optional().describe(`Area description`),visible:r().optional().describe(`Visibility formula condition for this area`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this area`),navigation:C(p0).describe(`Navigation items within this area`)}),eNe=h({name:u0.describe(`App unique machine name (lowercase snake_case)`),label:Y.describe(`App display label`),version:r().optional().describe(`App version`),description:Y.optional().describe(`App description`),icon:r().optional().describe(`App icon used in the App Launcher`),branding:QMe.optional().describe(`App-specific branding`),active:S().optional().default(!0).describe(`Whether the app is enabled`),isDefault:S().optional().default(!1).describe(`Is default app`),navigation:C(p0).optional().describe(`Full navigation tree for the app sidebar`),areas:C($Me).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:r().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this app`),objects:C(u()).optional().describe(`Objects belonging to this app`),apis:C(u()).optional().describe(`Custom APIs belonging to this app`),sharing:d0.optional().describe(`Public sharing configuration`),embed:WMe.optional().describe(`Iframe embedding configuration`),mobileNavigation:h({mode:E([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:C(r()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:r0.optional().describe(`ARIA accessibility attributes for the application`)}),tNe=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),nNe=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),m0=h({url:r().describe(`API endpoint URL`),method:nNe.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)});h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(tNe).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)});var h0=I(`provider`,[h({provider:m(`object`),object:r().describe(`Target object name`)}),h({provider:m(`api`),read:m0.optional().describe(`Configuration for fetching data`),write:m0.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),h({provider:m(`value`),items:C(u()).describe(`Static data array`)})]),g0=h({field:r().describe(`Field name to filter on`),operator:r().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),rNe=E([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),iNe=h({field:r().describe(`Field name (snake_case)`),label:Y.optional().describe(`Display label override`),width:P().positive().optional().describe(`Column width in pixels`),align:E([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:S().optional().describe(`Hide column by default`),sortable:S().optional().describe(`Allow sorting by this column`),resizable:S().optional().describe(`Allow resizing this column`),wrap:S().optional().describe(`Allow text wrapping`),type:r().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:E([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:rNe.optional().describe(`Footer aggregation function for this column`),link:S().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:r().optional().describe(`Registered Action ID to execute when clicked`)}),aNe=h({type:E([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),oNe=h({pageSize:P().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:C(P().int().positive()).optional().describe(`Available page size options`)}),sNe=E([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),cNe=h({fields:C(h({field:r().describe(`Field name to group by`),order:E([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:S().default(!1).describe(`Collapse groups by default`)})).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),lNe=h({coverField:r().optional().describe(`Attachment/image field to display as card cover`),coverFit:E([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:E([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:r().optional().describe(`Field to display as card title`),visibleFields:C(r()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),uNe=h({startDateField:r().describe(`Field for timeline item start date`),endDateField:r().optional().describe(`Field for timeline item end date`),titleField:r().describe(`Field to display as timeline item title`),groupByField:r().optional().describe(`Field to group timeline rows`),colorField:r().optional().describe(`Field to determine item color`),scale:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),dNe=h({type:E([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:r().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),fNe=h({field:r().describe(`Field to derive color from (typically a select/status field)`),colors:d(r(),r()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),pNe=E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),_0=h({sort:S().default(!0).describe(`Allow users to sort records`),search:S().default(!0).describe(`Allow users to search records`),filter:S().default(!0).describe(`Allow users to filter records`),rowHeight:S().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:S().default(!1).describe(`Add records through a form instead of inline`),buttons:C(r()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),v0=h({showDescription:S().default(!0).describe(`Show the view description text`),allowedVisualizations:C(pNe).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),y0=h({name:u0.describe(`Tab identifier (snake_case)`),label:Y.optional().describe(`Display label`),icon:r().optional().describe(`Tab icon name`),view:r().optional().describe(`Referenced list view name from listViews`),filter:C(g0).optional().describe(`Tab-specific filter criteria`),order:P().int().min(0).optional().describe(`Tab display order`),pinned:S().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:S().default(!1).describe(`Set as the default active tab`),visible:S().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),b0=h({enabled:S().default(!0).describe(`Show the add record entry point`),position:E([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:E([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:r().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),mNe=h({groupByField:r().describe(`Field to group columns by (usually status/select)`),summarizeField:r().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:C(r()).describe(`Fields to show on cards`)}),hNe=h({startDateField:r(),endDateField:r().optional(),titleField:r(),colorField:r().optional()}),gNe=h({startDateField:r(),endDateField:r(),titleField:r(),progressField:r().optional(),dependenciesField:r().optional()}),_Ne=h({mode:E([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]).default(`page`),view:r().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:S().default(!1).describe(`Disable standard navigation entirely`),openNewTab:S().default(!1).describe(`Force open in new tab (applies to page mode)`),width:l([r(),P()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),x0=h({name:u0.optional().describe(`Internal view name (lowercase snake_case)`),label:Y.optional(),type:E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:h0.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:l([C(r()),C(iNe)]).describe(`Fields to display as columns`),filter:C(g0).optional().describe(`Filter criteria (JSON Rules)`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional(),searchableFields:C(r()).optional().describe(`Fields enabled for search`),filterableFields:C(r()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:C(h({field:r().describe(`Field name to filter by`),label:r().optional().describe(`Display label for the chip`),operator:E([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:S().optional().describe(`Enable column resizing`),striped:S().optional().describe(`Striped row styling`),bordered:S().optional().describe(`Show borders`),selection:aNe.optional().describe(`Row selection configuration`),navigation:_Ne.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:oNe.optional().describe(`Pagination configuration`),kanban:mNe.optional(),calendar:hNe.optional(),gantt:gNe.optional(),gallery:lNe.optional(),timeline:uNe.optional(),description:Y.optional().describe(`View description for documentation/tooltips`),sharing:dNe.optional().describe(`View sharing and access configuration`),rowHeight:sNe.optional().describe(`Row height / density setting`),grouping:cNe.optional().describe(`Group records by one or more fields`),rowColor:fNe.optional().describe(`Color rows based on field value`),hiddenFields:C(r()).optional().describe(`Fields to hide in this specific view`),fieldOrder:C(r()).optional().describe(`Explicit field display order for this view`),rowActions:C(r()).optional().describe(`Actions available for individual row items`),bulkActions:C(r()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:S().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:C(h({condition:r().describe(`Condition expression to evaluate`),style:d(r(),r()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:S().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:C(E([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:_0.optional().describe(`User action toggles for the view toolbar`),appearance:v0.optional().describe(`Appearance and visualization configuration`),tabs:C(y0).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:b0.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at the bottom of the list`),allowPrinting:S().optional().describe(`Allow users to print the view`),emptyState:h({title:Y.optional(),message:Y.optional(),icon:r().optional()}).optional().describe(`Empty state configuration when no records found`),aria:r0.optional().describe(`ARIA accessibility attributes for the list view`),responsive:c0.optional().describe(`Responsive layout configuration`),performance:l0.optional().describe(`Performance optimization settings`)}),vNe=h({field:r().describe(`Field name (snake_case)`),label:Y.optional().describe(`Display label override`),placeholder:Y.optional().describe(`Placeholder text`),helpText:Y.optional().describe(`Help/hint text`),readonly:S().optional().describe(`Read-only override`),required:S().optional().describe(`Required override`),hidden:S().optional().describe(`Hidden override`),colSpan:P().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:r().optional().describe(`Custom widget/component name`),dependsOn:r().optional().describe(`Parent field name for cascading`),visibleOn:r().optional().describe(`Visibility condition expression`)}),S0=h({label:Y.optional(),collapsible:S().default(!1),collapsed:S().default(!1),columns:E([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:C(l([r(),vNe]))}),C0=h({type:E([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:h0.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:C(S0).optional(),groups:C(S0).optional(),defaultSort:C(h({field:r().describe(`Field name to sort by`),order:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:d0.optional().describe(`Public sharing configuration for this form`),aria:r0.optional().describe(`ARIA accessibility attributes for the form view`)});h({list:x0.optional(),form:C0.optional(),listViews:d(r(),x0).optional().describe(`Additional named list views`),formViews:d(r(),C0).optional().describe(`Additional named form views`)});var w0=h({$field:r().describe(`Field Reference/Column Name`)});h({$eq:D().optional(),$ne:D().optional()}),h({$gt:l([P(),N(),w0]).optional(),$gte:l([P(),N(),w0]).optional(),$lt:l([P(),N(),w0]).optional(),$lte:l([P(),N(),w0]).optional()}),h({$in:C(D()).optional(),$nin:C(D()).optional()}),h({$between:w([l([P(),N(),w0]),l([P(),N(),w0])]).optional()}),h({$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional()}),h({$null:S().optional(),$exists:S().optional()});var T0=h({$eq:D().optional(),$ne:D().optional(),$gt:l([P(),N(),w0]).optional(),$gte:l([P(),N(),w0]).optional(),$lt:l([P(),N(),w0]).optional(),$lte:l([P(),N(),w0]).optional(),$in:C(D()).optional(),$nin:C(D()).optional(),$between:w([l([P(),N(),w0]),l([P(),N(),w0])]).optional(),$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional(),$null:S().optional(),$exists:S().optional()}),E0=F(()=>d(r(),u()).and(h({$and:C(E0).optional(),$or:C(E0).optional(),$not:E0.optional()})));h({where:E0.optional()});var D0=F(()=>h({$and:C(l([d(r(),T0),D0])).optional(),$or:C(l([d(r(),T0),D0])).optional(),$not:l([d(r(),T0),D0]).optional()})),yNe=E([`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`]).describe(`Widget color variant`),O0=E([`script`,`url`,`modal`,`flow`,`api`]).describe(`Widget action type`),bNe=h({label:Y.describe(`Action button label`),actionUrl:r().describe(`URL or target for the action`),actionType:O0.optional().describe(`Type of action`),icon:r().optional().describe(`Icon identifier for the action button`)}).describe(`Dashboard header action`),xNe=h({showTitle:S().default(!0).describe(`Show dashboard title in header`),showDescription:S().default(!0).describe(`Show dashboard description in header`),actions:C(bNe).optional().describe(`Header action buttons`)}).describe(`Dashboard header configuration`),SNe=h({valueField:r().describe(`Field to aggregate`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).default(`count`).describe(`Aggregate function`),label:Y.optional().describe(`Measure display label`),format:r().optional().describe(`Number format string`)}).describe(`Widget measure definition`),CNe=h({id:u0.describe(`Unique widget identifier (snake_case)`),title:Y.optional().describe(`Widget title`),description:Y.optional().describe(`Widget description text below the header`),type:i0.default(`metric`).describe(`Visualization type`),chartConfig:o0.optional().describe(`Chart visualization configuration`),colorVariant:yNe.optional().describe(`Widget color variant for theming`),actionUrl:r().optional().describe(`URL or target for the widget action button`),actionType:O0.optional().describe(`Type of action for the widget action button`),actionIcon:r().optional().describe(`Icon identifier for the widget action button`),object:r().optional().describe(`Data source object name`),filter:E0.optional().describe(`Data filter criteria`),categoryField:r().optional().describe(`Field for grouping (X-Axis)`),valueField:r().optional().describe(`Field for values (Y-Axis)`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).optional().default(`count`).describe(`Aggregate function`),measures:C(SNe).optional().describe(`Multiple measures for pivot/matrix analysis`),layout:h({x:P(),y:P(),w:P(),h:P()}).describe(`Grid layout position`),options:u().optional().describe(`Widget specific configuration`),responsive:c0.optional().describe(`Responsive layout configuration`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),wNe=h({object:r().describe(`Source object name`),valueField:r().describe(`Field to use as option value`),labelField:r().describe(`Field to use as option label`),filter:E0.optional().describe(`Filter to apply to source object`)}).describe(`Dynamic filter options from object`),TNe=h({field:r().describe(`Field name to filter on`),label:Y.optional().describe(`Display label for the filter`),type:E([`text`,`select`,`date`,`number`,`lookup`]).optional().describe(`Filter input type`),options:C(h({value:l([r(),P(),S()]).describe(`Option value`),label:Y})).optional().describe(`Static filter options`),optionsFrom:wNe.optional().describe(`Dynamic filter options from object`),defaultValue:l([r(),P(),S()]).optional().describe(`Default filter value`),scope:E([`dashboard`,`widget`]).default(`dashboard`).describe(`Filter application scope`),targetWidgets:C(r()).optional().describe(`Widget IDs to apply this filter to`)});h({name:u0.describe(`Dashboard unique name`),label:Y.describe(`Dashboard label`),description:Y.optional().describe(`Dashboard description`),header:xNe.optional().describe(`Dashboard header configuration`),widgets:C(CNe).describe(`Widgets to display`),refreshInterval:P().optional().describe(`Auto-refresh interval in seconds`),dateRange:h({field:r().optional().describe(`Default date field name for time-based filtering`),defaultRange:E([`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:S().default(!0).describe(`Allow users to pick a custom date range`)}).optional().describe(`Global dashboard date range filter configuration`),globalFilters:C(TNe).optional().describe(`Global filters that apply to all widgets in the dashboard`),aria:r0.optional().describe(`ARIA accessibility attributes`),performance:l0.optional().describe(`Performance optimization settings`)});var ENe=E([`tabular`,`summary`,`matrix`,`joined`]),DNe=h({field:r().describe(`Field name`),label:Y.optional().describe(`Override label`),aggregate:E([`sum`,`avg`,`max`,`min`,`count`,`unique`]).optional().describe(`Aggregation function`),responsive:c0.optional().describe(`Responsive visibility for this column`)}),k0=h({field:r().describe(`Field to group by`),sortOrder:E([`asc`,`desc`]).default(`asc`),dateGranularity:E([`day`,`week`,`month`,`quarter`,`year`]).optional().describe(`For date fields`)}),ONe=o0.extend({xAxis:r().describe(`Grouping field for X-Axis`),yAxis:r().describe(`Summary field for Y-Axis`),groupBy:r().optional().describe(`Additional grouping field`)});h({name:u0.describe(`Report unique name`),label:Y.describe(`Report label`),description:Y.optional(),objectName:r().describe(`Primary object`),type:ENe.default(`tabular`).describe(`Report format type`),columns:C(DNe).describe(`Columns to display`),groupingsDown:C(k0).optional().describe(`Row groupings`),groupingsAcross:C(k0).optional().describe(`Column groupings (Matrix only)`),filter:E0.optional().describe(`Filter criteria`),chart:ONe.optional().describe(`Embedded chart configuration`),aria:r0.optional().describe(`ARIA accessibility attributes`),performance:l0.optional().describe(`Performance optimization settings`)});var kNe=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),ANe=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),jNe=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),A0=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:kNe.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:ANe.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:jNe.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:A0.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var MNe=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),j0=h({field:r().describe(`Field name to apply masking to`),strategy:MNe.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(j0).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var M0=E(`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(`.`)),NNe=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:UMe.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var PNe=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var FNe=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),INe=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),LNe=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),RNe=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),zNe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:M0.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(NNe).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:PNe.optional().describe(`Configuration for currency field type`),vectorConfig:FNe.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:INe.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:A0.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:j0.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:RNe.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:LNe.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),BNe=h({name:r(),label:Y,type:M0,required:S().default(!1),options:C(h({label:Y,value:r()})).optional()}),N0=E([`script`,`url`,`modal`,`flow`,`api`]),VNe=new Set(N0.options.filter(e=>e!==`script`));h({name:u0.describe(`Machine name (lowercase snake_case)`),label:Y.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:N0.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(BNe).optional().describe(`Input parameters required from user`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:Y.optional().describe(`Confirmation message before execution`),successMessage:Y.optional().describe(`Success message to show after execution`),refreshAfter:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:r0.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(VNe.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var HNe=E([`asc`,`desc`]).describe(`Sort order direction`),P0=h({field:r().describe(`Field name to sort by`),order:HNe.describe(`Sort direction`)}).describe(`Sort field and direction pair`);E([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),E([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var UNe=h({name:r().describe(`Region name (e.g. "sidebar", "main", "header")`),width:E([`small`,`medium`,`large`,`full`]).optional(),components:C(F(()=>KNe)).describe(`Components in this region`)}),WNe=E(`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(`.`)),GNe=h({object:r().describe(`Object to query`),view:r().optional().describe(`Named view to apply`),filter:E0.optional().describe(`Additional filter criteria`),sort:C(P0).optional().describe(`Sort order`),limit:P().int().positive().optional().describe(`Max records to display`)}),KNe=h({type:l([WNe,r()]).describe(`Component Type (Standard enum or custom string)`),id:r().optional().describe(`Unique instance ID`),label:Y.optional(),properties:d(r(),u()).describe(`Component props passed to the widget. See component.zod.ts for schemas.`),events:d(r(),r()).optional().describe(`Event handlers map`),style:d(r(),r()).optional().describe(`Inline styles or utility classes`),className:r().optional().describe(`CSS class names`),visibility:r().optional().describe(`Visibility filter/formula`),dataSource:GNe.optional().describe(`Per-element data binding for multi-object pages`),responsive:c0.optional().describe(`Responsive layout configuration`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),qNe=h({name:r().describe(`Variable name`),type:E([`string`,`number`,`boolean`,`object`,`array`,`record_id`]).default(`string`),defaultValue:u().optional(),source:r().optional().describe(`Component ID that writes to this variable`)}),JNe=h({componentId:r().describe(`Reference to a PageComponent.id in the page`),x:P().int().min(0).describe(`Grid column position (0-based)`),y:P().int().min(0).describe(`Grid row position (0-based)`),width:P().int().min(1).describe(`Width in grid columns`),height:P().int().min(1).describe(`Height in grid rows`)}),YNe=h({columns:P().int().min(1).default(12).describe(`Number of grid columns`),rowHeight:P().int().min(1).default(40).describe(`Height of each grid row in pixels`),gap:P().int().min(0).default(8).describe(`Gap between grid items in pixels`),items:C(JNe).describe(`Positioned components on the canvas`)}),XNe=E([`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`),ZNe=h({object:r().describe(`Target object for review`),filter:E0.optional().describe(`Filter criteria for review queue`),sort:C(P0).optional().describe(`Sort order for review queue`),displayFields:C(r()).optional().describe(`Fields to display on the review page`),actions:C(h({label:r().describe(`Action button label`),type:E([`approve`,`reject`,`skip`,`custom`]).describe(`Action type`),field:r().optional().describe(`Field to update on action`),value:l([r(),P(),S()]).optional().describe(`Value to set on action`),nextRecord:S().optional().default(!0).describe(`Auto-advance to next record after action`)})).describe(`Review actions`),navigation:E([`sequential`,`random`,`filtered`]).optional().default(`sequential`).describe(`Record navigation mode`),showProgress:S().optional().default(!0).describe(`Show review progress indicator`)}),QNe=h({source:r().optional().describe(`Source object name for the page`),levels:P().int().min(1).optional().describe(`Number of hierarchy levels to display`),filterBy:C(g0).optional().describe(`Page-level filter criteria`),appearance:v0.optional().describe(`Appearance and visualization configuration`),userFilters:h({elements:C(E([`grid`,`gallery`,`kanban`])).optional().describe(`Visualization element types available in user filter bar`),tabs:C(y0).optional().describe(`User-configurable tabs`)}).optional().describe(`User filter configuration`),userActions:_0.optional().describe(`User action toggles`),addRecord:b0.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at page bottom`),allowPrinting:S().optional().describe(`Allow users to print the page`)}).describe(`Interface-level page configuration (Airtable parity)`);h({name:u0.describe(`Page unique name (lowercase snake_case)`),label:Y,description:Y.optional(),icon:r().optional().describe(`Page icon name`),type:XNe.default(`record`).describe(`Page type`),variables:C(qNe).optional().describe(`Local page state variables`),object:r().optional().describe(`Bound object (for Record pages)`),recordReview:ZNe.optional().describe(`Record review configuration (required when type is "record_review")`),blankLayout:YNe.optional().describe(`Free-form grid layout for blank pages (used when type is "blank")`),template:r().default(`default`).describe(`Layout template name (e.g. "header-sidebar-main")`),regions:C(UNe).describe(`Defined regions with components`),isDefault:S().default(!1),assignedProfiles:C(r()).optional(),interfaceConfig:QNe.optional().describe(`Interface-level page configuration (for Airtable-style interface pages)`),aria:r0.optional().describe(`ARIA accessibility attributes`)}).superRefine((e,t)=>{e.type===`record_review`&&!e.recordReview&&t.addIssue({code:de.custom,path:[`recordReview`],message:`recordReview is required when type is "record_review"`}),e.type===`blank`&&!e.blankLayout&&t.addIssue({code:de.custom,path:[`blankLayout`],message:`blankLayout is required when type is "blank"`})});var $Ne=h({onMount:r().optional().describe(`Initialization code when widget mounts`),onUpdate:r().optional().describe(`Code to run when props change`),onUnmount:r().optional().describe(`Cleanup code when widget unmounts`),onValidate:r().optional().describe(`Custom validation logic`),onFocus:r().optional().describe(`Code to run on focus`),onBlur:r().optional().describe(`Code to run on blur`),onError:r().optional().describe(`Error handling code`)}),ePe=h({name:r().describe(`Event name`),label:Y.optional().describe(`Human-readable event label`),description:Y.optional().describe(`Event description and usage`),bubbles:S().default(!1).describe(`Whether event bubbles`),cancelable:S().default(!1).describe(`Whether event is cancelable`),payload:d(r(),u()).optional().describe(`Event payload schema`)}),tPe=h({name:r().describe(`Property name (camelCase)`),label:Y.optional().describe(`Human-readable label`),type:E([`string`,`number`,`boolean`,`array`,`object`,`function`,`any`]).describe(`TypeScript type`),required:S().default(!1).describe(`Whether property is required`),default:u().optional().describe(`Default value`),description:Y.optional().describe(`Property description`),validation:d(r(),u()).optional().describe(`Validation rules`),category:r().optional().describe(`Property category`)}),nPe=I(`type`,[h({type:m(`npm`),packageName:r().describe(`NPM package name`),version:r().default(`latest`),exportName:r().optional().describe(`Named export (default: default)`)}),h({type:m(`remote`),url:r().url().describe(`Remote entry URL (.js)`),moduleName:r().describe(`Exposed module name`),scope:r().describe(`Remote scope name`)}),h({type:m(`inline`),code:r().describe(`JavaScript code body`)})]);h({name:u0.describe(`Widget identifier (snake_case)`),label:Y.describe(`Widget display name`),description:Y.optional().describe(`Widget description`),version:r().optional().describe(`Widget version (semver)`),author:r().optional().describe(`Widget author`),icon:r().optional().describe(`Widget icon`),fieldTypes:C(r()).optional().describe(`Supported field types`),category:E([`input`,`display`,`picker`,`editor`,`custom`]).default(`custom`).describe(`Widget category`),lifecycle:$Ne.optional().describe(`Lifecycle hooks`),events:C(ePe).optional().describe(`Custom events`),properties:C(tPe).optional().describe(`Configuration properties`),implementation:nPe.optional().describe(`Widget implementation source`),dependencies:C(h({name:r(),version:r().optional(),url:r().url().optional()})).optional().describe(`Widget dependencies`),screenshots:C(r().url()).optional().describe(`Screenshot URLs`),documentation:r().url().optional().describe(`Documentation URL`),license:r().optional().describe(`License (SPDX identifier)`),tags:C(r()).optional().describe(`Tags for categorization`),aria:r0.optional().describe(`ARIA accessibility attributes`),performance:l0.optional().describe(`Performance optimization settings`)}),h({value:u().describe(`Current field value`),onChange:M().input(w([u()])).output(te()).describe(`Callback to update field value`),readonly:S().default(!1).describe(`Read-only mode flag`),required:S().default(!1).describe(`Required field flag`),error:r().optional().describe(`Validation error message`),field:zNe.describe(`Field schema definition`),record:d(r(),u()).optional().describe(`Complete record data`),options:d(r(),u()).optional().describe(`Custom widget options`)});var F0=E([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),rPe=h({type:E([`user`,`team`,`record`]).describe(`Mention target type`),id:r().describe(`Target ID`),name:r().describe(`Display name for rendering`),offset:P().int().min(0).describe(`Character offset in body text`),length:P().int().min(1).describe(`Length of mention token in body text`)}),iPe=h({field:r().describe(`Field machine name`),fieldLabel:r().optional().describe(`Field display label`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`),oldDisplayValue:r().optional().describe(`Human-readable old value`),newDisplayValue:r().optional().describe(`Human-readable new value`)}),aPe=h({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:C(r()).describe(`Users who reacted`),count:P().int().min(1).describe(`Total reaction count`)}),oPe=h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`),avatarUrl:r().url().optional().describe(`Actor avatar URL`),source:r().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),sPe=E([`public`,`internal`,`private`]);h({id:r().describe(`Feed item ID`),type:F0.describe(`Activity type`),object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID this feed item belongs to`),actor:oPe.describe(`Who performed this action`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(rPe).optional().describe(`Mentioned users/teams/records`),changes:C(iPe).optional().describe(`Field-level changes`),reactions:C(aPe).optional().describe(`Emoji reactions on this item`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),replyCount:P().int().min(0).default(0).describe(`Number of replies`),pinned:S().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:r().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:r().optional().describe(`User ID who pinned the item`),starred:S().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:r().datetime().optional().describe(`Timestamp when the item was starred`),visibility:sPe.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:r().datetime().describe(`Creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),editedAt:r().datetime().optional().describe(`When comment was last edited`),isEdited:S().default(!1).describe(`Whether comment has been edited`)});var cPe=E([`all`,`comments_only`,`changes_only`,`tasks_only`]);h({}),h({title:Y.describe(`Page title`),subtitle:Y.optional().describe(`Page subtitle`),icon:r().optional().describe(`Icon name`),breadcrumb:S().default(!0).describe(`Show breadcrumb`),actions:C(r()).optional().describe(`Action IDs to show in header`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({type:E([`line`,`card`,`pill`]).default(`line`),position:E([`top`,`left`]).default(`top`),items:C(h({label:Y,icon:r().optional(),children:C(u()).describe(`Child components`)})),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({title:Y.optional(),bordered:S().default(!0),actions:C(r()).optional(),body:C(u()).optional().describe(`Card content components (slot)`),footer:C(u()).optional().describe(`Card footer components (slot)`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({columns:E([`1`,`2`,`3`,`4`]).default(`2`).describe(`Number of columns for field layout (1-4)`),layout:E([`auto`,`custom`]).default(`auto`).describe(`Layout mode: auto uses object compactLayout, custom uses explicit sections`),sections:C(r()).optional().describe(`Section IDs to show (required when layout is "custom")`),fields:C(r()).optional().describe(`Explicit field list to display (optional, overrides compactLayout)`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({objectName:r().describe(`Related object name (e.g., "task", "opportunity")`),relationshipField:r().describe(`Field on related object that points to this record (e.g., "account_id")`),columns:C(r()).describe(`Fields to display in the related list`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional().describe(`Sort order for related records`),limit:P().int().positive().default(5).describe(`Number of records to display initially`),filter:C(g0).optional().describe(`Additional filter criteria for related records`),title:Y.optional().describe(`Custom title for the related list`),showViewAll:S().default(!0).describe(`Show "View All" link to see all related records`),actions:C(r()).optional().describe(`Action IDs available for related records`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({fields:C(r()).min(1).max(7).describe(`Key fields to highlight (1-7 fields max, typically displayed as prominent cards)`),layout:E([`horizontal`,`vertical`]).default(`horizontal`).describe(`Layout orientation for highlight fields`),aria:r0.optional().describe(`ARIA accessibility attributes`)});var lPe=h({types:C(F0).optional().describe(`Feed item types to show (default: all)`),filterMode:cPe.default(`all`).describe(`Default activity filter`),showFilterToggle:S().default(!0).describe(`Show filter dropdown in panel header`),limit:P().int().positive().default(20).describe(`Number of items to load per page`),showCompleted:S().default(!1).describe(`Include completed activities`),unifiedTimeline:S().default(!0).describe(`Mix field changes and comments in one timeline (Airtable style)`),showCommentInput:S().default(!0).describe(`Show "Leave a comment" input at the bottom`),enableMentions:S().default(!0).describe(`Enable @mentions in comments`),enableReactions:S().default(!1).describe(`Enable emoji reactions on feed items`),enableThreading:S().default(!1).describe(`Enable threaded replies on comments`),showSubscriptionToggle:S().default(!0).describe(`Show bell icon for record-level notification subscription`),aria:r0.optional().describe(`ARIA accessibility attributes`)});h({position:E([`sidebar`,`inline`,`drawer`]).default(`sidebar`).describe(`Where to render the chatter panel`),width:l([r(),P()]).optional().describe(`Panel width (e.g., "350px", "30%")`),collapsible:S().default(!0).describe(`Whether the panel can be collapsed`),defaultCollapsed:S().default(!1).describe(`Whether the panel starts collapsed`),feed:lPe.optional().describe(`Embedded activity feed configuration`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({statusField:r().describe(`Field name representing the current status/stage`),stages:C(h({value:r(),label:Y})).optional().describe(`Explicit stage definitions (if not using field metadata)`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({items:C(h({label:Y,icon:r().optional(),collapsed:S().default(!1),children:C(u()).describe(`Child components`)})),allowMultiple:S().default(!1).describe(`Allow multiple panels to be expanded simultaneously`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({mode:E([`float`,`sidebar`,`inline`]).default(`float`).describe(`Display mode for the chat window`),agentId:r().optional().describe(`Specific AI agent to use`),context:d(r(),u()).optional().describe(`Contextual data to pass to the AI`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({content:r().describe(`Text or Markdown content`),variant:E([`heading`,`subheading`,`body`,`caption`]).optional().default(`body`).describe(`Text style variant`),align:E([`left`,`center`,`right`]).optional().default(`left`).describe(`Text alignment`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({object:r().describe(`Source object`),field:r().optional().describe(`Field to aggregate`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function`),filter:E0.optional().describe(`Filter criteria`),format:E([`number`,`currency`,`percent`]).optional().describe(`Number display format`),prefix:r().optional().describe(`Prefix text (e.g. "$")`),suffix:r().optional().describe(`Suffix text (e.g. "%")`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({src:r().describe(`Image URL or attachment field`),alt:r().optional().describe(`Alt text for accessibility`),fit:E([`cover`,`contain`,`fill`]).optional().default(`cover`).describe(`Image object-fit mode`),height:P().optional().describe(`Fixed height in pixels`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({label:Y.describe(`Button display label`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().default(`primary`).describe(`Button visual variant`),size:E([`small`,`medium`,`large`]).optional().default(`medium`).describe(`Button size`),icon:r().optional().describe(`Icon name (Lucide icon)`),iconPosition:E([`left`,`right`]).optional().default(`left`).describe(`Icon position relative to label`),disabled:S().optional().default(!1).describe(`Disable the button`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({object:r().describe(`Object to filter`),fields:C(r()).describe(`Filterable field names`),targetVariable:r().optional().describe(`Page variable to store filter state`),layout:E([`inline`,`dropdown`,`sidebar`]).optional().default(`inline`).describe(`Filter display layout`),showSearch:S().optional().default(!0).describe(`Show search input`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({object:r().describe(`Object for the form`),fields:C(r()).optional().describe(`Fields to display (defaults to all editable fields)`),mode:E([`create`,`edit`]).optional().default(`create`).describe(`Form mode`),submitLabel:Y.optional().describe(`Submit button label`),onSubmit:r().optional().describe(`Action expression on form submit`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({object:r().describe(`Object to pick records from`),displayField:r().describe(`Field to display as the record label`),searchFields:C(r()).optional().describe(`Fields to search against`),filter:E0.optional().describe(`Filter criteria for available records`),multiple:S().optional().default(!1).describe(`Allow multiple record selection`),targetVariable:r().optional().describe(`Page variable to bind selected record ID(s)`),placeholder:Y.optional().describe(`Placeholder text`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({context:r().optional()});var I0=h({minWidth:P().default(44).describe(`Minimum touch target width in pixels (WCAG 2.5.5: 44px)`),minHeight:P().default(44).describe(`Minimum touch target height in pixels (WCAG 2.5.5: 44px)`),padding:P().optional().describe(`Additional padding around touch target in pixels`),hitSlop:h({top:P().optional().describe(`Extra hit area above the element`),right:P().optional().describe(`Extra hit area to the right of the element`),bottom:P().optional().describe(`Extra hit area below the element`),left:P().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)`),uPe=E([`swipe`,`pinch`,`long_press`,`double_tap`,`drag`,`rotate`,`pan`]).describe(`Touch gesture type`),dPe=h({direction:C(E([`up`,`down`,`left`,`right`])).describe(`Allowed swipe directions`),threshold:P().optional().describe(`Minimum distance in pixels to recognize swipe`),velocity:P().optional().describe(`Minimum velocity (px/ms) to trigger swipe`)}).describe(`Swipe gesture recognition settings`),fPe=h({minScale:P().optional().describe(`Minimum scale factor (e.g., 0.5 for 50%)`),maxScale:P().optional().describe(`Maximum scale factor (e.g., 3.0 for 300%)`)}).describe(`Pinch/zoom gesture recognition settings`),pPe=h({duration:P().default(500).describe(`Hold duration in milliseconds to trigger long press`),moveTolerance:P().optional().describe(`Max movement in pixels allowed during press`)}).describe(`Long press gesture recognition settings`);h({gestures:C(h({type:uPe.describe(`Gesture type to configure`),label:Y.optional().describe(`Descriptive label for the gesture action`),enabled:S().default(!0).describe(`Whether this gesture is active`),swipe:dPe.optional().describe(`Swipe gesture settings (when type is swipe)`),pinch:fPe.optional().describe(`Pinch gesture settings (when type is pinch)`),longPress:pPe.optional().describe(`Long press settings (when type is long_press)`)}).describe(`Per-gesture configuration`)).optional().describe(`Configured gesture recognizers`),touchTarget:I0.optional().describe(`Touch target sizing and hit area`),hapticFeedback:S().optional().describe(`Enable haptic feedback on touch interactions`)}).merge(r0.partial()).describe(`Touch and gesture interaction configuration`);var mPe=h({enabled:S().default(!1).describe(`Enable focus trapping within this container`),initialFocus:r().optional().describe(`CSS selector for the element to focus on activation`),returnFocus:S().default(!0).describe(`Return focus to trigger element on deactivation`),escapeDeactivates:S().default(!0).describe(`Allow Escape key to deactivate the focus trap`)}).describe(`Focus trap configuration for modal-like containers`),hPe=h({key:r().describe(`Key combination (e.g., "Ctrl+S", "Alt+N", "Escape")`),action:r().describe(`Action identifier to invoke when shortcut is triggered`),description:Y.optional().describe(`Human-readable description of what the shortcut does`),scope:E([`global`,`view`,`form`,`modal`,`list`]).default(`global`).describe(`Scope in which this shortcut is active`)}).describe(`Keyboard shortcut binding`),L0=h({tabOrder:E([`auto`,`manual`]).default(`auto`).describe(`Tab order strategy: auto (DOM order) or manual (explicit tabIndex)`),skipLinks:S().default(!1).describe(`Provide skip-to-content navigation links`),focusVisible:S().default(!0).describe(`Show visible focus indicators for keyboard users`),focusTrap:mPe.optional().describe(`Focus trap settings`),arrowNavigation:S().default(!1).describe(`Enable arrow key navigation between focusable items`)}).describe(`Focus and tab navigation management`);h({shortcuts:C(hPe).optional().describe(`Registered keyboard shortcuts`),focusManagement:L0.optional().describe(`Focus and tab order management`),rovingTabindex:S().default(!1).describe(`Enable roving tabindex pattern for composite widgets`)}).merge(r0.partial()).describe(`Keyboard navigation and shortcut configuration`);var gPe=h({primary:r().describe(`Primary brand color (hex, rgb, or hsl)`),secondary:r().optional().describe(`Secondary brand color`),accent:r().optional().describe(`Accent color for highlights`),success:r().optional().describe(`Success state color (default: green)`),warning:r().optional().describe(`Warning state color (default: yellow)`),error:r().optional().describe(`Error state color (default: red)`),info:r().optional().describe(`Info state color (default: blue)`),background:r().optional().describe(`Background color`),surface:r().optional().describe(`Surface/card background color`),text:r().optional().describe(`Primary text color`),textSecondary:r().optional().describe(`Secondary text color`),border:r().optional().describe(`Border color`),disabled:r().optional().describe(`Disabled state color`),primaryLight:r().optional().describe(`Lighter shade of primary`),primaryDark:r().optional().describe(`Darker shade of primary`),secondaryLight:r().optional().describe(`Lighter shade of secondary`),secondaryDark:r().optional().describe(`Darker shade of secondary`)}),_Pe=h({fontFamily:h({base:r().optional().describe(`Base font family (default: system fonts)`),heading:r().optional().describe(`Heading font family`),mono:r().optional().describe(`Monospace font family for code`)}).optional(),fontSize:h({xs:r().optional().describe(`Extra small font size (e.g., 0.75rem)`),sm:r().optional().describe(`Small font size (e.g., 0.875rem)`),base:r().optional().describe(`Base font size (e.g., 1rem)`),lg:r().optional().describe(`Large font size (e.g., 1.125rem)`),xl:r().optional().describe(`Extra large font size (e.g., 1.25rem)`),"2xl":r().optional().describe(`2X large font size (e.g., 1.5rem)`),"3xl":r().optional().describe(`3X large font size (e.g., 1.875rem)`),"4xl":r().optional().describe(`4X large font size (e.g., 2.25rem)`)}).optional(),fontWeight:h({light:P().optional().describe(`Light weight (default: 300)`),normal:P().optional().describe(`Normal weight (default: 400)`),medium:P().optional().describe(`Medium weight (default: 500)`),semibold:P().optional().describe(`Semibold weight (default: 600)`),bold:P().optional().describe(`Bold weight (default: 700)`)}).optional(),lineHeight:h({tight:r().optional().describe(`Tight line height (e.g., 1.25)`),normal:r().optional().describe(`Normal line height (e.g., 1.5)`),relaxed:r().optional().describe(`Relaxed line height (e.g., 1.75)`),loose:r().optional().describe(`Loose line height (e.g., 2)`)}).optional(),letterSpacing:h({tighter:r().optional().describe(`Tighter letter spacing (e.g., -0.05em)`),tight:r().optional().describe(`Tight letter spacing (e.g., -0.025em)`),normal:r().optional().describe(`Normal letter spacing (e.g., 0)`),wide:r().optional().describe(`Wide letter spacing (e.g., 0.025em)`),wider:r().optional().describe(`Wider letter spacing (e.g., 0.05em)`)}).optional()}),vPe=h({0:r().optional().describe(`0 spacing (0)`),1:r().optional().describe(`Spacing unit 1 (e.g., 0.25rem)`),2:r().optional().describe(`Spacing unit 2 (e.g., 0.5rem)`),3:r().optional().describe(`Spacing unit 3 (e.g., 0.75rem)`),4:r().optional().describe(`Spacing unit 4 (e.g., 1rem)`),5:r().optional().describe(`Spacing unit 5 (e.g., 1.25rem)`),6:r().optional().describe(`Spacing unit 6 (e.g., 1.5rem)`),8:r().optional().describe(`Spacing unit 8 (e.g., 2rem)`),10:r().optional().describe(`Spacing unit 10 (e.g., 2.5rem)`),12:r().optional().describe(`Spacing unit 12 (e.g., 3rem)`),16:r().optional().describe(`Spacing unit 16 (e.g., 4rem)`),20:r().optional().describe(`Spacing unit 20 (e.g., 5rem)`),24:r().optional().describe(`Spacing unit 24 (e.g., 6rem)`)}),yPe=h({none:r().optional().describe(`No border radius (0)`),sm:r().optional().describe(`Small border radius (e.g., 0.125rem)`),base:r().optional().describe(`Base border radius (e.g., 0.25rem)`),md:r().optional().describe(`Medium border radius (e.g., 0.375rem)`),lg:r().optional().describe(`Large border radius (e.g., 0.5rem)`),xl:r().optional().describe(`Extra large border radius (e.g., 0.75rem)`),"2xl":r().optional().describe(`2X large border radius (e.g., 1rem)`),full:r().optional().describe(`Full border radius (50%)`)}),bPe=h({none:r().optional().describe(`No shadow`),sm:r().optional().describe(`Small shadow`),base:r().optional().describe(`Base shadow`),md:r().optional().describe(`Medium shadow`),lg:r().optional().describe(`Large shadow`),xl:r().optional().describe(`Extra large shadow`),"2xl":r().optional().describe(`2X large shadow`),inner:r().optional().describe(`Inner shadow (inset)`)}),xPe=h({xs:r().optional().describe(`Extra small breakpoint (e.g., 480px)`),sm:r().optional().describe(`Small breakpoint (e.g., 640px)`),md:r().optional().describe(`Medium breakpoint (e.g., 768px)`),lg:r().optional().describe(`Large breakpoint (e.g., 1024px)`),xl:r().optional().describe(`Extra large breakpoint (e.g., 1280px)`),"2xl":r().optional().describe(`2X large breakpoint (e.g., 1536px)`)}),SPe=h({duration:h({fast:r().optional().describe(`Fast animation (e.g., 150ms)`),base:r().optional().describe(`Base animation (e.g., 300ms)`),slow:r().optional().describe(`Slow animation (e.g., 500ms)`)}).optional(),timing:h({linear:r().optional().describe(`Linear timing function`),ease:r().optional().describe(`Ease timing function`),ease_in:r().optional().describe(`Ease-in timing function`),ease_out:r().optional().describe(`Ease-out timing function`),ease_in_out:r().optional().describe(`Ease-in-out timing function`)}).optional()}),CPe=h({base:P().optional().describe(`Base z-index (e.g., 0)`),dropdown:P().optional().describe(`Dropdown z-index (e.g., 1000)`),sticky:P().optional().describe(`Sticky z-index (e.g., 1020)`),fixed:P().optional().describe(`Fixed z-index (e.g., 1030)`),modalBackdrop:P().optional().describe(`Modal backdrop z-index (e.g., 1040)`),modal:P().optional().describe(`Modal z-index (e.g., 1050)`),popover:P().optional().describe(`Popover z-index (e.g., 1060)`),tooltip:P().optional().describe(`Tooltip z-index (e.g., 1070)`)}),wPe=E([`light`,`dark`,`auto`]),TPe=E([`compact`,`regular`,`spacious`]),EPe=E([`AA`,`AAA`]);h({name:u0.describe(`Unique theme identifier (snake_case)`),label:r().describe(`Human-readable theme name`),description:r().optional().describe(`Theme description`),mode:wPe.default(`light`).describe(`Theme mode (light, dark, or auto)`),colors:gPe.describe(`Color palette configuration`),typography:_Pe.optional().describe(`Typography settings`),spacing:vPe.optional().describe(`Spacing scale`),borderRadius:yPe.optional().describe(`Border radius scale`),shadows:bPe.optional().describe(`Box shadow effects`),breakpoints:xPe.optional().describe(`Responsive breakpoints`),animation:SPe.optional().describe(`Animation settings`),zIndex:CPe.optional().describe(`Z-index scale for layering`),customVars:d(r(),r()).optional().describe(`Custom CSS variables (key-value pairs)`),logo:h({light:r().optional().describe(`Logo URL for light mode`),dark:r().optional().describe(`Logo URL for dark mode`),favicon:r().optional().describe(`Favicon URL`)}).optional().describe(`Logo assets`),extends:r().optional().describe(`Base theme to extend from`),density:TPe.optional().describe(`Display density: compact, regular, or spacious`),wcagContrast:EPe.optional().describe(`WCAG color contrast level (AA or AAA)`),rtl:S().optional().describe(`Enable right-to-left layout direction`),touchTarget:I0.optional().describe(`Touch target sizing defaults`),keyboardNavigation:L0.optional().describe(`Keyboard focus management settings`)});var R0=E([`cache_first`,`network_first`,`stale_while_revalidate`,`network_only`,`cache_only`]).describe(`Data fetching strategy for offline/online transitions`),DPe=E([`client_wins`,`server_wins`,`manual`,`last_write_wins`]).describe(`How to resolve conflicts when syncing offline changes`),OPe=h({strategy:R0.default(`network_first`).describe(`Sync fetch strategy`),conflictResolution:DPe.default(`last_write_wins`).describe(`Conflict resolution policy`),retryInterval:P().optional().describe(`Retry interval in milliseconds between sync attempts`),maxRetries:P().optional().describe(`Maximum number of sync retry attempts`),batchSize:P().optional().describe(`Number of mutations to sync per batch`)}).describe(`Offline-to-online synchronization configuration`),kPe=E([`indexeddb`,`localstorage`,`sqlite`]).describe(`Client-side storage backend for offline cache`),APe=E([`lru`,`lfu`,`fifo`]).describe(`Cache eviction policy`),jPe=h({maxSize:P().optional().describe(`Maximum cache size in bytes`),ttl:P().optional().describe(`Time-to-live for cached entries in milliseconds`),persistStorage:kPe.default(`indexeddb`).describe(`Storage backend`),evictionPolicy:APe.default(`lru`).describe(`Cache eviction policy when full`)}).describe(`Client-side offline cache configuration`);h({enabled:S().default(!1).describe(`Enable offline support`),strategy:R0.default(`network_first`).describe(`Default offline fetch strategy`),cache:jPe.optional().describe(`Cache settings for offline data`),sync:OPe.optional().describe(`Sync settings for offline mutations`),offlineIndicator:S().default(!0).describe(`Show a visual indicator when offline`),offlineMessage:Y.optional().describe(`Customizable offline status message shown to users`),queueMaxSize:P().optional().describe(`Maximum number of queued offline mutations`)}).describe(`Offline support configuration`);var z0=E([`fade`,`slide_up`,`slide_down`,`slide_left`,`slide_right`,`scale`,`rotate`,`flip`,`none`]).describe(`Transition preset type`),B0=E([`linear`,`ease`,`ease_in`,`ease_out`,`ease_in_out`,`spring`]).describe(`Animation easing function`),V0=h({preset:z0.optional().describe(`Transition preset to apply`),duration:P().optional().describe(`Transition duration in milliseconds`),easing:B0.optional().describe(`Easing function for the transition`),delay:P().optional().describe(`Delay before transition starts in milliseconds`),customKeyframes:r().optional().describe(`CSS @keyframes name for custom animations`),themeToken:r().optional().describe(`Reference to a theme animation token (e.g. "animation.duration.fast")`)}).describe(`Animation transition configuration`),MPe=E([`on_mount`,`on_unmount`,`on_hover`,`on_focus`,`on_click`,`on_scroll`,`on_visible`]).describe(`Event that triggers the animation`),NPe=h({label:Y.optional().describe(`Descriptive label for this animation configuration`),enter:V0.optional().describe(`Enter/mount animation`),exit:V0.optional().describe(`Exit/unmount animation`),hover:V0.optional().describe(`Hover state animation`),trigger:MPe.optional().describe(`When to trigger the animation`),reducedMotion:E([`respect`,`disable`,`alternative`]).default(`respect`).describe(`Accessibility: how to handle prefers-reduced-motion`)}).merge(r0.partial()).describe(`Component-level animation configuration`),PPe=h({type:z0.default(`fade`).describe(`Page transition type`),duration:P().default(300).describe(`Transition duration in milliseconds`),easing:B0.default(`ease_in_out`).describe(`Easing function for the transition`),crossFade:S().default(!1).describe(`Whether to cross-fade between pages`)}).describe(`Page-level transition configuration`);h({label:Y.optional().describe(`Descriptive label for the motion configuration`),defaultTransition:V0.optional().describe(`Default transition applied to all animations`),pageTransitions:PPe.optional().describe(`Page navigation transition settings`),componentAnimations:d(r(),NPe).optional().describe(`Component name to animation configuration mapping`),reducedMotion:S().default(!1).describe(`When true, respect prefers-reduced-motion and suppress animations globally`),enabled:S().default(!0).describe(`Enable or disable all animations globally`)}).describe(`Top-level motion and animation design configuration`);var FPe=E([`toast`,`snackbar`,`banner`,`alert`,`inline`]).describe(`Notification presentation style`),IPe=E([`info`,`success`,`warning`,`error`]).describe(`Notification severity level`),H0=E([`top_left`,`top_center`,`top_right`,`bottom_left`,`bottom_center`,`bottom_right`]).describe(`Screen position for notification placement`),LPe=h({label:Y.describe(`Action button label`),action:r().describe(`Action identifier to execute`),variant:E([`primary`,`secondary`,`link`]).default(`primary`).describe(`Button variant style`)}).describe(`Notification action button`);h({type:FPe.default(`toast`).describe(`Notification presentation style`),severity:IPe.default(`info`).describe(`Notification severity level`),title:Y.optional().describe(`Notification title`),message:Y.describe(`Notification message body`),icon:r().optional().describe(`Icon name override`),duration:P().optional().describe(`Auto-dismiss duration in ms, omit for persistent`),dismissible:S().default(!0).describe(`Allow user to dismiss the notification`),actions:C(LPe).optional().describe(`Action buttons`),position:H0.optional().describe(`Override default position`)}).merge(r0.partial()).describe(`Notification instance definition`),h({defaultPosition:H0.default(`top_right`).describe(`Default screen position for notifications`),defaultDuration:P().default(5e3).describe(`Default auto-dismiss duration in ms`),maxVisible:P().default(5).describe(`Maximum number of notifications visible at once`),stackDirection:E([`up`,`down`]).default(`down`).describe(`Stack direction for multiple notifications`),pauseOnHover:S().default(!0).describe(`Pause auto-dismiss timer on hover`)}).describe(`Global notification system configuration`);var RPe=E([`element`,`handle`,`grip_icon`]).describe(`Drag initiation method`),zPe=E([`move`,`copy`,`link`,`none`]).describe(`Drop operation effect`),BPe=h({axis:E([`x`,`y`,`both`]).default(`both`).describe(`Constrain drag axis`),bounds:E([`parent`,`viewport`,`none`]).default(`none`).describe(`Constrain within bounds`),grid:w([P(),P()]).optional().describe(`Snap to grid [x, y] in pixels`)}).describe(`Drag movement constraints`),VPe=h({label:Y.optional().describe(`Accessible label for the drop zone`),accept:C(r()).describe(`Accepted drag item types`),maxItems:P().optional().describe(`Maximum items allowed in drop zone`),highlightOnDragOver:S().default(!0).describe(`Highlight drop zone when dragging over`),dropEffect:zPe.default(`move`).describe(`Visual effect on drop`)}).merge(r0.partial()).describe(`Drop zone configuration`),HPe=h({type:r().describe(`Drag item type identifier for matching with drop zones`),label:Y.optional().describe(`Accessible label describing the draggable item`),handle:RPe.default(`element`).describe(`How to initiate drag`),constraint:BPe.optional().describe(`Drag movement constraints`),preview:E([`element`,`custom`,`none`]).default(`element`).describe(`Drag preview type`),disabled:S().default(!1).describe(`Disable dragging`)}).merge(r0.partial()).describe(`Draggable item configuration`);h({enabled:S().default(!1).describe(`Enable drag and drop`),dragItem:HPe.optional().describe(`Configuration for draggable item`),dropZone:VPe.optional().describe(`Configuration for drop target`),sortable:S().default(!1).describe(`Enable sortable list behavior`),autoScroll:S().default(!0).describe(`Auto-scroll during drag near edges`),touchDelay:P().default(200).describe(`Delay in ms before drag starts on touch devices`)}).describe(`Drag and drop interaction configuration`);var UPe=e({DEFAULT_EXTENDER_PRIORITY:()=>200,DEFAULT_OWNER_PRIORITY:()=>100,ObjectQL:()=>X0,ObjectQLPlugin:()=>$0,ObjectRepository:()=>Z0,ObjectStackProtocolImplementation:()=>J0,RESERVED_NAMESPACES:()=>U0,SchemaRegistry:()=>K0,ScopedContext:()=>Q0,computeFQN:()=>W0,parseFQN:()=>G0}),U0=new Set([`base`,`system`]);function W0(e,t){return!e||U0.has(e)?t:`${e}__${t}`}function G0(e){let t=e.indexOf(`__`);return t===-1?{namespace:void 0,shortName:e}:{namespace:e.slice(0,t),shortName:e.slice(t+2)}}function WPe(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 K0=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);n||(n=new Set,this.namespaceRegistry.set(e,n)),n.add(t),this.log(`[Registry] Registered namespace: ${e} \u2192 ${t}`)}static unregisterNamespace(e,t){let n=this.namespaceRegistry.get(e);n&&(n.delete(t),n.size===0&&this.namespaceRegistry.delete(e),this.log(`[Registry] Unregistered namespace: ${e} \u2190 ${t}`))}static getNamespaceOwner(e){let t=this.namespaceRegistry.get(e);if(!(!t||t.size===0))return t.values().next().value}static getNamespaceOwners(e){let t=this.namespaceRegistry.get(e);return t?Array.from(t):[]}static registerObject(e,t,n,r=`own`,i=r===`own`?100:200){let a=e.name,o=W0(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=WPe(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}=G0(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`?O.parse(t):e===`app`?eNe.parse(t):e===`package`?q1.parse(t):e===`plugin`?H1.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(`app`,e,`name`,t)}static getApp(e){return this.getItem(`app`,e)}static getAllApps(){return this.listItems(`app`)}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`)}};K0._logLevel=`info`,K0.objectContributors=new Map,K0.mergedObjectCache=new Map,K0.namespaceRegistry=new Map,K0.metadata=new Map;function GPe(e){let t=0;for(let n=0;n0)n=i.map(t=>{let n=typeof t.metadata==`string`?JSON.parse(t.metadata):t.metadata;return K0.registerItem(e.type,n,`name`),n});else{let t=D1[e.type]??O1[e.type];if(t){let r=await this.engine.find(`sys_metadata`,{where:{type:t,state:`active`}});r&&r.length>0&&(n=r.map(t=>{let n=typeof t.metadata==`string`?JSON.parse(t.metadata):t.metadata;return K0.registerItem(e.type,n,`name`),n}))}}}catch{}try{let t=(this.getServicesRegistry?.())?.get(`metadata`);if(t&&typeof t.list==`function`){let r=await t.list(e.type);if(r&&r.length>0){let e=new Map;for(let t of n){let n=t;n&&typeof n==`object`&&`name`in n&&e.set(n.name,n)}for(let t of r){let n=t;n&&typeof n==`object`&&`name`in n&&e.set(n.name,n)}n=Array.from(e.values())}}}catch{}return{type:e.type,items:n}}async getMetaItem(e){let t=K0.getItem(e.type,e.name);if(t===void 0){let n=D1[e.type]??O1[e.type];n&&(t=K0.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,K0.registerItem(e.type,t,`name`);else{let n=D1[e.type]??O1[e.type];if(n){let 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,K0.registerItem(e.type,t,`name`))}}}catch{}if(t===void 0)try{let n=(this.getServicesRegistry?.())?.get(`metadata`);n&&typeof n.get==`function`&&(t=await n.get(e.type,e.name))}catch{}return{type:e.type,name:e.name,item:t}}async getUiView(e){let t=K0.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{}_(e)&&(e=ee(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,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=K0.getItem(e.type,e.name);if(!t){let n=D1[e.type]??O1[e.type];n&&(t=K0.getItem(n,e.name))}if(!t)try{let n=(this.getServicesRegistry?.())?.get(`metadata`);n&&typeof n.get==`function`&&(t=await n.get(e.type,e.name))}catch{}if(!t)throw Error(`Metadata item ${e.type}/${e.name} not found`);let n=GPe(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=K0.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`);K0.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,n=D1[r.type]??r.type;n===`object`?K0.registerObject(t,r.packageId||`sys_metadata`):K0.registerItem(n,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}}}},Y0=class e{constructor(e={}){this.drivers=new Map,this.defaultDriver=null,this.datasourceMapping=[],this.manifests=new Map,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||$f({level:`info`,format:`pretty`}),this.logger.info(`ObjectQL Engine Instance Created`)}getStatus(){return{name:fi.enum.data,status:`running`,version:`0.9.0`,features:[`crud`,`query`,`aggregate`,`transactions`,`metadata`]}}get registry(){return K0}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()=>{r0){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};K0.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&&(K0.registerApp(n,t),this.logger.debug(`Registered App`,{app:e,from:t}))}}e.name&&e.navigation&&!e.apps?.length&&(K0.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)&&K0.registerItem(k1(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&&K0.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)K0.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=K0.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=K0.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{K0.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)&&K0.registerItem(k1(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}))}setRealtimeService(e){this.realtimeService=e,this.logger.info(`RealtimeService configured for data events`)}getSchema(e){return K0.getObject(e)}resolveObjectName(e){let t=K0.getObject(e);return t?t.tableName||t.name:e}getDriver(e){let t=K0.getObject(e);if(t?.datasource&&t.datasource!==`default`){if(this.drivers.has(t.datasource))return this.drivers.get(t.datasource);throw Error(`[ObjectQL] Datasource '${t.datasource}' configured for object '${e}' is not registered.`)}let n=this.resolveDatasourceFromMapping(e,t);if(n&&this.drivers.has(n))return this.logger.debug(`Resolved datasource from mapping`,{object:e,datasource:n}),this.drivers.get(n);let r=t?.name||e,i=K0.getObjectOwner(r);if(i?.packageId){let t=this.manifests.get(i.packageId);if(t?.defaultDatasource&&t.defaultDatasource!==`default`&&this.drivers.has(t.defaultDatasource))return this.logger.debug(`Resolved datasource from package manifest`,{object:e,package:i.packageId,datasource:t.defaultDatasource}),this.drivers.get(t.defaultDatasource)}if(this.defaultDriver&&this.drivers.has(this.defaultDriver))return this.drivers.get(this.defaultDriver);throw Error(`[ObjectQL] No driver available for object '${e}'`)}resolveDatasourceFromMapping(e,t){if(!this.datasourceMapping||this.datasourceMapping.length===0)return null;let n=[...this.datasourceMapping].sort((e,t)=>(e.priority??1e3)-(t.priority??1e3));for(let r of n)if(r.namespace&&t?.namespace===r.namespace||r.package&&t?.packageId===r.package||r.objectPattern&&this.matchPattern(e,r.objectPattern)||r.default)return r.datasource;return null}matchPattern(e,t){let n=t.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`).replace(/\?/g,`.`);return RegExp(`^${n}$`).test(e)}setDatasourceMapping(e){this.datasourceMapping=e,this.logger.info(`Datasource mapping rules configured`,{ruleCount:e.length})}async init(){this.logger.info(`Initializing ObjectQL engine`,{driverCount:this.drivers.size,drivers:Array.from(this.drivers.keys())});let e=[];for(let[t,n]of this.drivers)try{await n.connect(),this.logger.info(`Driver connected successfully`,{driverName:t})}catch(n){e.push(t),this.logger.error(`Failed to connect driver`,n,{driverName:t})}e.length>0&&this.logger.warn(`${e.length} of ${this.drivers.size} driver(s) failed initial connect. Operations may recover via lazy reconnection or fail at query time.`,{failedDrivers: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=K0.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;if(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),this.realtimeService)try{if(Array.isArray(n)){for(let t of n){let n={type:`data.record.created`,object:e,payload:{recordId:t.id,after:t},timestamp:new Date().toISOString()};await this.realtimeService.publish(n)}this.logger.debug(`Published ${n.length} data.record.created events`,{object:e})}else{let t={type:`data.record.created`,object:e,payload:{recordId:n.id,after:n},timestamp:new Date().toISOString()};await this.realtimeService.publish(t),this.logger.debug(`Published data.record.created event`,{object:e,recordId:n.id})}}catch(t){this.logger.warn(`Failed to publish data event`,{object:e,error:t})}return 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`);if(t.event=`afterUpdate`,t.result=i,await this.triggerHooks(`afterUpdate`,t),this.realtimeService)try{let n=typeof i==`object`&&i&&`id`in i?i.id:void 0,r=String(t.input.id||n||``),a={type:`data.record.updated`,object:e,payload:{recordId:r,changes:t.input.data,after:i},timestamp:new Date().toISOString()};await this.realtimeService.publish(a),this.logger.debug(`Published data.record.updated event`,{object:e,recordId:r})}catch(t){this.logger.warn(`Failed to publish data event`,{object:e,error:t})}return 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`);if(a.event=`afterDelete`,a.result=r,await this.triggerHooks(`afterDelete`,a),this.realtimeService)try{let t=typeof r==`object`&&r&&`id`in r?r.id:void 0,n=String(a.input.id||t||``),i={type:`data.record.deleted`,object:e,payload:{recordId:n},timestamp:new Date().toISOString()};await this.realtimeService.publish(i),this.logger.debug(`Published data.record.deleted event`,{object:e,recordId:n})}catch(t){this.logger.warn(`Failed to publish data event`,{object:e,error:t})}return 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 K0.registerObject(e,t,n)}unregisterObject(e,t){t?K0.unregisterObjectsByPackage(t):K0.unregisterItem(`object`,e)}getObject(e){return this.getSchema(e)}getConfigs(){let e={},t=K0.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),K0.unregisterObjectsByPackage(e,!0)}async close(){return this.destroy()}createContext(e){return new Q0(FMe.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}};Y0.MAX_EXPAND_DEPTH=3;var X0=Y0,Z0=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`)}},Q0=class e{constructor(e,t){this.executionContext=e,this.engine=t}object(e){return new Z0(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}};function KPe(e){return typeof e==`object`&&!!e&&typeof e.loadMetaFromDb==`function`}var $0=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 X0({...this.hostContext,logger:e.logger}),e.registerService(`objectql`,this.ql),e.registerService(`data`,this.ql);let t=this.ql;e.registerService(`manifest`,{register:n=>{t.registerApp(n),e.logger.debug(`Manifest registered via manifest service`,{id:n.id||n.name})}}),e.logger.info(`ObjectQL engine registered`,{services:[`objectql`,`data`,`manifest`]});let n=new J0(this.ql,()=>e.getServices?e.getServices():new Map);e.registerService(`protocol`,n),e.logger.info(`Protocol service registered`)},this.start=async e=>{e.logger.info(`ObjectQL engine starting...`);try{let t=e.getService(`metadata`);t&&typeof t.loadMany==`function`&&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.`)&&(e.logger.warn(`[DEPRECATED] Service "${n}" uses legacy app.* convention. Migrate to ctx.getService('manifest').register(data).`),this.ql.registerApp(r),e.logger.debug(`Discovered and registered app service (legacy)`,{serviceName:n}));try{let t=e.getService(`realtime`);t&&typeof t==`object`&&`publish`in t&&(e.logger.info(`[ObjectQLPlugin] Bridging realtime service to ObjectQL for event publishing`),this.ql.setRealtimeService(t))}catch(t){e.logger.debug(`[ObjectQLPlugin] No realtime service found — data events will not be published`,{error:t.message})}}await this.ql?.init(),await this.restoreMetadataFromDb(e),await this.syncRegisteredSchemas(e),await this.bridgeObjectsToMetadataService(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 restoreMetadataFromDb(e){let t;try{let n=e.getService(`protocol`);if(!n||!KPe(n)){e.logger.debug(`Protocol service does not support loadMetaFromDb, skipping DB restore`);return}t=n}catch(t){e.logger.debug(`Protocol service unavailable, skipping DB restore`,{error:t instanceof Error?t.message:String(t)});return}try{let{loaded:n,errors:r}=await t.loadMetaFromDb();n>0||r>0?e.logger.info(`Metadata restored from database to SchemaRegistry`,{loaded:n,errors:r}):e.logger.debug(`No persisted metadata found in database`)}catch(t){e.logger.debug(`DB metadata restore failed (non-fatal)`,{error:t instanceof Error?t.message:String(t)})}}async bridgeObjectsToMetadataService(e){try{let t=e.getService(`metadata`);if(!t||typeof t.register!=`function`){e.logger.debug(`Metadata service unavailable for bridging, skipping`);return}if(!this.ql?.registry){e.logger.debug(`SchemaRegistry unavailable for bridging, skipping`);return}let n=this.ql.registry.getAllObjects(),r=0;for(let i of n)try{await t.getObject(i.name)||(await t.register(`object`,i.name,i),r++)}catch(t){e.logger.debug(`Failed to bridge object to metadata service`,{object:i.name,error:t instanceof Error?t.message:String(t)})}r>0?e.logger.info(`Bridged objects from SchemaRegistry to metadata service`,{count:r,total:n.length}):e.logger.debug(`No objects needed bridging (all already in metadata service)`)}catch(t){e.logger.debug(`Failed to bridge objects to metadata service`,{error:t instanceof Error?t.message:String(t)})}}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`)}},qPe=16777619;function e2(e,t){return e*qPe^t>>>0}function t2(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=e2(r,e|0)}return r>>>0}function n2(e){let t=0;for(let n=0;n>>0}function JPe(e){let t=0,n=e<0n,r=n?-e:e;if(r===0n)t=e2(t,0);else for(;r>0n;){let e=Number(r&255n);t=e2(t,e),r>>=8n}return e2(t,+n)>>>0}function YPe(e){let t=n2((e.name||``)+e.toString());return t=e2(t,e.length),t>>>0}function XPe(e){let t=0;for(let n=0;n>>0}function ZPe(e){let t=n2(e.constructor.name),n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return t=e2(t,XPe(n)),t>>>0}function QPe(e,t){if(t.has(e))return 13;t.add(e);let n=1;for(let r=0;r>>0}function $Pe(e,t){if(t.has(e))return 13;t.add(e);let n=Object.keys(e).sort(),r=n2(e?.constructor?.name);for(let i of n)r=e2(r,n2(i)),r=e2(r,r2(e[i],t));return t.delete(e),r>>>0}var eFe=[3735928559,305441741].map(e=>e2(3,e)),tFe=e2(1,0),nFe=e2(2,0);function r2(e,t){if(e===null)return tFe;switch(typeof e){case`undefined`:return nFe;case`boolean`:return eFe[+e];case`number`:return e2(4,t2(e));case`string`:return e2(5,n2(e));case`bigint`:return e2(6,JPe(e));case`function`:return e2(7,YPe(e));default:return ArrayBuffer.isView(e)&&!(e instanceof DataView)?e2(12,ZPe(e)):e instanceof Date?e2(10,t2(e.getTime())):e instanceof RegExp?e2(11,e2(n2(e.source),n2(e.flags))):Array.isArray(e)?e2(8,QPe(e,t)):e2(9,$Pe(e,t))}}function i2(e){return r2(e,new WeakSet)>>>0}var a2=class extends Error{},o2=Symbol(`missing`),rFe=`mingo: cycle detected while processing object/array`,s2=e=>typeof e!=`object`&&typeof e!=`function`||e===null,c2=e=>s2(e)||C2(e)||w2(e),l2={undefined:1,null:2,number:3,string:4,symbol:5,object:6,array:7,arraybuffer:8,boolean:9,date:10,regexp:11,function:12},u2=(e,t)=>et),iFe=(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;e0)return a;return a}}let o=l2[r]??Number.MAX_VALUE,s=l2[i]??Number.MAX_VALUE;return o===s?u2(r,i):u2(o,s)}var f2=(e,t)=>d2(e,t,!0),p2=e=>e!=null&&e.toString!==Object.prototype.toString;function m2(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(C2(e))return C2(t)&&+e==+t;if(w2(e))return w2(t)&&e.source===t.source&&e.flags===t.flags;if(Z(e)&&Z(t))return e.length===t.length&&e.every((e,n)=>m2(e,t[n]));if(e?.constructor!==Object&&p2(e))return e?.toString()===t?.toString();let n=e,r=t,i=Object.keys(n),a=Object.keys(r);return i.length===a.length?i.every(e=>O2(r,e)&&m2(n[e],r[e])):!1}var h2=class e extends Map{#e=new Map;#t=e=>{let t=i2(e);return[(this.#e.get(t)??[]).find(t=>m2(t,e)),t]};constructor(){super()}static init(){return new e}clear(){super.clear(),this.#e.clear()}delete(e){if(s2(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=>!m2(e,t))),!0):!1}get(e){if(s2(e))return super.get(e);let[t,n]=this.#t(e);return super.get(t)}has(e){if(s2(e))return super.has(e);let[t,n]=this.#t(e);return super.has(t)}set(e,t){if(s2(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 X(e,t){if(!e)throw new a2(t)}function g2(e){let t=typeof e;switch(t){case`number`:case`string`:case`boolean`:case`undefined`:case`function`:case`symbol`:return t}return e===null?`null`:Z(e)?`array`:C2(e)?`date`:w2(e)?`regexp`:k2(e)?`arraybuffer`:e?.constructor===Object?`object`:e?.constructor?.name?.toLowerCase()??`object`}var _2=e=>typeof e==`boolean`,v2=e=>typeof e==`string`,y2=e=>!Number.isNaN(e)&&typeof e==`number`,b2=Number.isInteger,Z=Array.isArray,x2=e=>g2(e)===`object`,S2=e=>!s2(e),C2=e=>e instanceof Date,w2=e=>e instanceof RegExp,aFe=e=>typeof e==`function`,Q=e=>e==null,T2=(e,t=!0)=>!!e||t&&e===``,E2=e=>Q(e)||v2(e)&&!e||Z(e)&&e.length===0||x2(e)&&Object.keys(e).length===0,D2=e=>Z(e)?e:[e],O2=(e,...t)=>!!e&&t.every(t=>Object.prototype.hasOwnProperty.call(e,t)),k2=e=>typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e),A2=(e,t)=>{if(Q(e)||_2(e)||y2(e)||v2(e))return e;if(C2(e))return new Date(e);if(w2(e))return new RegExp(e);if(k2(e)){let t=e.constructor;return new t(e)}if(t instanceof WeakSet||(t=new WeakSet),t.has(e))throw Error(rFe);t.add(e);try{if(Z(e)){let n=Array(e.length);for(let r=0;r=0;r--){for(let i=0;i0||t<0)?r(e[i],Math.max(-1,t-1)):n.push(e[i])}return r(e,t),n}function N2(e){let t=h2.init();for(let n of e)t.set(n,!0);return Array.from(t.keys())}function P2(e,t){if(e.length<1)return new Map;let n=h2.init();for(let r=0;r0)break;i+=1;let r=t.slice(e);n=n.reduce((e,t)=>{let n=a(t,r);return n!==void 0&&e.push(n),e},[]);break}else n=F2(n,r);if(n===void 0)break}return n}let o=a(e,r);return Z(o)&&n?.unwrapArray?oFe(o,i):o}function L2(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=F2(e,t);o&&(r=L2(r,a,n)),n?.preserveIndex?s[t]=r:s.push(r)}else for(let r of e){let e=L2(r,t,n);n?.preserveMissing?s.push(e??o2):(e!=null||n?.preserveIndex)&&s.push(e)}return s}let s=n?.preserveKeys?{...e}:{},c=F2(e,i);if(o&&(c=L2(c,a,n)),c!==void 0)return s[i]=c,s}function R2(e){if(Z(e))for(let t=e.length-1;t>=0;t--)e[t]===o2?e.splice(t,1):R2(e[t]);else if(x2(e))for(let t of Object.keys(e))O2(e,t)&&R2(e[t])}var z2=/^\d+$/;function B2(e,t,n,r){let i=t.split(`.`),a=i[0],o=i.slice(1).join(`.`);if(i.length===1)(x2(e)||Z(e)&&z2.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&&z2.test(i[1]));Z(t)&&r?.descendArray&&!s?t.forEach((e=>B2(e,o,n,r))):B2(t,o,n,r)}}function V2(e,t,n){B2(e,t,(e,t)=>e[t]=n,{buildGraph:!0})}function H2(e,t,n){B2(e,t,((e,t)=>{Z(e)?e.splice(parseInt(t),1):x2(e)&&delete e[t]}),n)}var U2=e=>!!e&&e[0]===`$`&&/^\$[a-zA-Z0-9_]+$/.test(e);function W2(e){if(c2(e))return w2(e)?{$regex:e}:{$eq:e};if(S2(e)){if(!Object.keys(e).some(U2))return{$eq:e};if(x2(e)&&O2(e,`$regex`)){let t={...e};return t.$regex=new RegExp(e.$regex,e.$options),delete t.$options,t}}return e}function G2(e,t,n=f2){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 sFe=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}},K2=(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))(K2||{}),q2=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?Y2.from(t?.context):Y2.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(){let e=this.#e.timestamp??0;return e||(e=Date.now(),Object.assign(this.#e,{timestamp:e})),new Date(e)}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}},J2=(e=>(e.ACCUMULATOR=`accumulator`,e.EXPRESSION=`expression`,e.PIPELINE=`pipeline`,e.PROJECTION=`projection`,e.QUERY=`query`,e.WINDOW=`window`,e))(J2||{}),Y2=class e{#e;constructor(){this.#e={accumulator:{},expression:{},pipeline:{},projection:{},query:{},window:{}}}static init(t={}){let n=new e;for(let e of Object.keys(t))n.#e[e]={...t[e]};return n}static from(...t){if(t.length===1)return e.init(t[0].#e);let n=new e;for(let e of t)for(let t of Object.values(J2))n.addOps(t,e.#e[t]);return n}addOps(e,t){return this.#e[e]=Object.assign({},t,this.#e[e]),this}getOperator(e,t){return this.#e[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){return X2(e,t,!(n instanceof q2)||Q(n.local.root)?q2.init(n).update({root:e}):n)}var cFe=new Set([`$$ROOT`,`$$CURRENT`,`$$REMOVE`,`$$NOW`]);function X2(e,t,n){if(v2(t)&&t.length>0&&t[0]===`$`){if(t===`$$KEEP`||t===`$$PRUNE`||t===`$$DESCEND`)return t;let r=n.local.root,i=t.split(`.`),a=t.indexOf(`.`),o=a===-1?t:t.substring(0,a);if(cFe.has(i[0])){switch(o){case`$$ROOT`:break;case`$$CURRENT`:r=e;break;case`$$REMOVE`:r=void 0;break;case`$$NOW`:r=new Date(n.now);break}t=a===-1?``:t.substring(a+1)}else if(o.length>=2&&o[1]===`$`){r=Object.assign({},n.variables,{this:e},n?.local?.variables);let i=o.substring(2);X(O2(r,i),`Use of undefined variable: ${i}`),t=t.substring(2)}else t=t.substring(1);return t===``?r:I2(r,t)}if(Z(t))return t.map(t=>X2(e,t,n));if(x2(t)){let r=Object.keys(t);if(U2(r[0]))return X(r.length===1,`Expression must contain a single operator.`),lFe(e,t[r[0]],r[0],n);let i={};for(let a=0;a{for(;t{for(;;){let{value:e,done:r}=t.next();if(r)return{done:r};let i=!0;n++;for(let t=0;t=0,`value must be a non-negative integer`),this.filter(t=>e-- >0)}drop(e){return X(e>=0,`value must be a non-negative integer`),this.filter(t=>e--<=0)}transform(e){let t=this,n;return Z2(()=>(n||=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}},e4=class{#e;#t;constructor(e,t){this.#e=e,this.#t=q2.init(t)}stream(e,t){let n=Z2(e),r=t??this.#t,i=r.processingMode;return i&K2.CLONE_INPUT&&n.map(e=>A2(e)),n=this.#e.map((e,t)=>{let n=Object.keys(e);X(n.length===1,`aggregation stage must have single operator, got ${n.toString()}.`);let i=n[0];X(i!==`$documents`||t==0,`$documents must be first stage in pipeline.`);let a=r.context.getOperator(J2.PIPELINE,i);return X(!!a,`unregistered pipeline operator ${i}.`),[a,e[i]]}).reduce((e,[t,n])=>t(e,n,r),n),i&K2.CLONE_OUTPUT&&n.map(e=>A2(e)),n}run(e,t){return this.stream(e,t).collect()}},t4=(e,t,n)=>{if(Q(t))return e;let r=q2.init(n),i=Array(e.length);for(let n=0;n{X(n.scriptEnabled,`$accumulator requires 'scriptEnabled' option to be true`);let r=q2.init(n),i=t,a=$(r?.local?.groupId,i.initArgs||[],r.update({root:r?.local?.groupId})),o=t4(e,i.accumulateArgs,r);for(let e=0;eN2(t4(e,t,n)),mFe=(e,t,n)=>{let r=t4(e,t,n).filter(y2);return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length};function n4(e,t,n){X(x2(t)&&Object.keys(t).length>0,`$sort specification is invalid`);let r=f2,i=n.collation;return x2(i)&&v2(i.locale)&&(r=gFe(i)),e.transform(e=>{let n=Object.keys(t);for(let i of n.reverse()){let n=P2(e,e=>I2(e,i)),a=Array.from(n.keys()),o=!1;if(r===f2){let e=!0,t=!0;for(let n of a)if(e&&=v2(n),t&&=y2(n),!e&&!t)break;if(o=e||t,e)a.sort();else if(t){let e=new Float64Array(a).sort();for(let t=0;tv2(e)&&v2(t)?n.compare(e,t):f2(e,t)}var r4=(e,t,n)=>{let r=n,i=t,a=$(r?.local?.groupId,i.n,r),o=n4(Z2(e),i.sortBy,n).collect(),s=o.length;return t4(s<=a?o:o.slice(s-a),i.output,r)},_Fe=(e,t,n)=>r4(e,{...t,n:1},n),vFe=(e,t,n)=>e.length;function i4(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 a4(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 yFe=(e,t,n)=>a4(t4(e,t,n),!1),bFe=(e,t,n)=>a4(t4(e,t,n),!0),o4=(e,t,n)=>{let r=e[0];return $(r,t,q2.init(n).update({root:r}))??null},s4={int:{int:!0},pos:{min:1,int:!0},index:{min:0,int:!0},nzero:{min:0,max:0,int:!0}},xFe={int:{type:`integers`},obj:{type:`objects`}};function c4(e,t){return X(!e,t),null}function l4(e,t){let n=`${t} expression must resolve to object`;return X(!e,n),null}function u4(e,t){let n=`${t} expression must resolve to string`;return X(!e,n),null}function d4(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}`,X(!e,o),null}function f4(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 X(!e,i),null}var p4=(e,t,n)=>{let r=n.failOnError,i=n,a=e.length,o=$(i?.local?.groupId,t.n,i);return!b2(o)||o<1?d4(r,`$firstN 'n'`,s4.pos):t4(a<=o?e:e.slice(0,o),t.input,n)},m4=(e,t,n)=>{let r=e[e.length-1];return $(r,t,q2.init(n).update({root:r}))??null},h4=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,r),o=n.failOnError;return!b2(a)||a<1?d4(o,`$lastN 'n'`,s4.pos):t4(i<=a?e:e.slice(i-a),t.input,n)},SFe=(e,t,n)=>{let r=t4(e,t,n).filter(e=>!Q(e));return r.length?r.reduce((e,t)=>f2(e,t)>=0?e:t):null},g4=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,r);if(!b2(a)||a<1)return d4(n.failOnError,`$maxN 'n'`,s4.pos);let o=t4(e,t.input,n).filter(e=>!Q(e));return o.sort((e,t)=>-1*f2(e,t)),i<=a?o:o.slice(0,a)},_4=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`p`)&&Z(t.p),`$percentile expects object { input, p }`);let r=t4(e,t.input,n).filter(y2).sort(),i=t4(t.p,`$$CURRENT`,n),a=t.method||`approximate`;for(let e of i)if(!y2(e)||e<0||e>1)return c4(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]);switch(a){case`exact`:return i;case`approximate`:{let t=G2(r,i);return t/r.length>=e?r[Math.max(t-1,0)]:r[t]}}})},v4=(e,t,n)=>_4(e,{...t,p:[.5]},n)?.pop(),y4=(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},CFe=(e,t,n)=>{let r=t4(e,t,n).filter(e=>!Q(e));return r.length?r.reduce((e,t)=>f2(e,t)<=0?e:t):null},b4=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,r);if(!b2(a)||a<1)return d4(n.failOnError,`$minN 'n'`,s4.pos);let o=t4(e,t.input,n).filter(e=>!Q(e));return o.sort(f2),i<=a?o:o.slice(0,a)},wFe=(e,t,n)=>i4(t4(e,t,n).filter(y2),!1),TFe=(e,t,n)=>i4(t4(e,t,n).filter(y2),!0),EFe=(e,t,n)=>y2(t)?e.length*t:t4(e,t,n).filter(y2).reduce((e,t)=>e+t,0),x4=(e,t,n)=>{let r=n,{n:i,sortBy:a}=$(r?.local?.groupId,t,r);return t4(n4(Z2(e),a,n).take(i).collect(),t.output,r)},DFe=(e,t,n)=>x4(e,{...t,n:1},n),OFe=e({$accumulator:()=>fFe,$addToSet:()=>pFe,$avg:()=>mFe,$bottom:()=>_Fe,$bottomN:()=>r4,$count:()=>vFe,$covariancePop:()=>yFe,$covarianceSamp:()=>bFe,$first:()=>o4,$firstN:()=>p4,$last:()=>m4,$lastN:()=>h4,$max:()=>SFe,$maxN:()=>g4,$median:()=>v4,$mergeObjects:()=>y4,$min:()=>CFe,$minN:()=>b4,$percentile:()=>_4,$push:()=>t4,$stdDevPop:()=>wFe,$stdDevSamp:()=>TFe,$sum:()=>EFe,$top:()=>DFe,$topN:()=>x4}),kFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.abs(r):d4(n.failOnError,`$abs`)},S4=`$add expression must resolve to array of numbers.`,AFe=(e,t,n)=>{let r=$(e,t,n),i=n.failOnError,a=!1,o=0;if(!Z(r))return c4(i,S4);for(let e of r){if(Q(e))return null;if(typeof e==`number`)o+=e;else if(C2(e)){if(a)return c4(i,`$add must only have one date`);a=!0,o+=+e}else return c4(i,S4)}return a?new Date(o):o},jFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.ceil(r):d4(n.failOnError,`$ceil`)},MFe=(e,t,n)=>{X(Z(t),`$divide expects array(2)`);let r=$(e,t,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=y2(e)}return a?r[1]===0?c4(i,`$divide cannot divide by zero`):r[0]/r[1]:f4(i,`$divide`,{size:2,type:`number`})},NFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.exp(r):d4(n.failOnError,`$exp`)},PFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.floor(r):d4(n.failOnError,`$floor`)},FFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.log(r):d4(n.failOnError,`$ln`)},IFe=(e,t,n)=>{let r=$(e,t,n);if(Z(r)&&r.length==2){let e=!0;for(let t of r){if(Q(t))return null;e&&=typeof t==`number`}if(e)return Math.log10(r[0])/Math.log10(r[1])}return f4(n.failOnError,`$log`,{size:2,type:`number`})},LFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.log10(r):d4(n.failOnError,`$log10`)},RFe=(e,t,n)=>{let r=$(e,t,n),i=!Z(r)||r.length!=2;return i||=!r.every(e=>typeof e==`number`),i?f4(n.failOnError,`$mod`,{size:2,type:`number`}):r[0]%r[1]},zFe=(e,t,n)=>{X(Z(t),`$multiply expects array`);let r=$(e,t,n),i=n.failOnError;if(r.some(Q))return null;let a=1;for(let e of r){if(!y2(e))return f4(i,`$multiply`,{type:`number`});a*=e}return a},BFe=(e,t,n)=>{X(Z(t)&&t.length===2,`$pow expects array(2)`);let r=$(e,t,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=y2(e)}return a?(r[0]===0&&r[1]<0&&c4(i,`$pow cannot raise 0 to a negative exponent`),r[0]**+r[1]):f4(i,`$pow`,{size:2,type:`number`})};function C4(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(!y2(e))return d4(a,`${r} arg1 `);if(!b2(t)||t<-20||t>100)return d4(a,`${r} arg2 `,{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 VFe=(e,t,n)=>{X(Z(t),`$round expects array(2)`);let[r,i]=$(e,t,n);return C4(r,i??0,{name:`$round`,roundOff:!0,failOnError:n.failOnError})},w4=1e10,HFe=(e,t,n)=>{if(Q(t))return null;let r=$(e,t,n),{input:i,onNull:a}=x2(r)?r:{input:r};if(Q(i))return y2(a)?a:null;if(y2(i)){let e=1/(1+Math.exp(-i));return Math.round(e*w4)/w4}return d4(n.failOnError,`$sigmoid`)},UFe=(e,t,n)=>{let r=$(e,t,n),i=!n.failOnError;return Q(r)?null:typeof r!=`number`||r<0?(X(i,`$sqrt expression must resolve to non-negative number.`),null):Math.sqrt(r)},WFe=(e,t,n)=>{X(Z(t),`$subtract expects array(2)`);let r=$(e,t,n);if(r.some(Q))return null;let i=n.failOnError,[a,o]=r;return C2(a)&&y2(o)?new Date(+a-Math.round(o)):C2(a)&&C2(o)?a-+o:r.every(e=>typeof e==`number`)?a-o:y2(a)&&C2(o)?c4(i,`$subtract cannot subtract date from number`):f4(i,`$subtract`,{size:2,type:`number|date`})},GFe=(e,t,n)=>{X(Z(t),`$trunc expects array(2)`);let[r,i]=$(e,t,n);return C4(r,i??0,{name:`$trunc`,roundOff:!1,failOnError:n.failOnError})},T4=`$arrayElemAt`,KFe=(e,t,n)=>{X(Z(t)&&t.length===2,`${T4} expects array(2)`);let r=$(e,t,n);if(r.some(Q))return null;let i=n.failOnError,[a,o]=r;if(!Z(a))return f4(i,`${T4} arg1 `);if(!b2(o))return d4(i,`${T4} arg2 `,s4.int);if(o<0&&Math.abs(o)<=a.length)return a[(o+a.length)%a.length];if(o>=0&&o{let r=n.failOnError,i=$(e,t,n);if(Q(i))return null;if(!Z(i))return f4(r,`$arrayToObject`,E4.generic);let a=0,o={};for(let e of i)if(Z(e)){let t=M2(e);if(a||=1,a!==1)return f4(r,`$arrayToObject`,E4.object);let[n,i]=t;o[n]=i}else if(x2(e)&&O2(e,`k`,`v`)){if(a||=2,a!==2)return f4(r,`$arrayToObject`,E4.array);let{k:t,v:n}=e;o[t]=n}else return f4(r,`$arrayToObject`,E4.generic);return o},JFe=(e,t,n)=>{let r=$(e,t,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return f4(i,`$concatArrays`);let a=0;for(let e of r){if(Q(e))return null;if(!Z(e))return f4(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},YFe=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`cond`),`$filter expects object { input, as, cond, limit }`);let r=$(e,t.input,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return f4(i,`$filter 'input'`);let a=t.limit??Math.max(r.length,1);if(!b2(a)||a<1)return d4(i,`$filter 'limit'`,{min:1,int:!0});if(r.length===0)return[];let o=q2.init(n),s=t?.as||`this`,c={variables:{}},l=[];for(let i=0,u=0;i{if(Z(e))return o4(e,t,n);let r=$(e,t,n);return Q(r)?null:Z(r)?M2(r)[0]:f4(n.failOnError,`$first`)},ZFe=(e,t,n)=>{if(X(x2(t)&&O2(t,`input`,`n`),`$firstN expects object { input, n }`),Z(e))return p4(e,t,n);let{input:r,n:i}=$(e,t,n);return Q(r)?null:Z(r)?p4(r,{n:i,input:`$$this`},n):f4(n.failOnError,`$firstN 'input'`)},QFe=(e,t,n)=>{X(Z(t)&&t.length===2,`$in expects array(2)`);let[r,i]=$(e,t,n);if(!Z(i))return c4(n.failOnError,`$in arg2 `);for(let e of i)if(m2(e,r))return!0;return!1},D4=`$indexOfArray`,$Fe=(e,t,n)=>{X(Z(t)&&t.length>1&&t.length<5,`${D4} expects array(4)`);let r=$(e,t,n),i=n.failOnError,a=r[0];if(Q(a))return null;if(!Z(a))return f4(i,`${D4} arg1 `);let o=r[1],s=r[2]??0,c=r[3]??a.length;return!b2(s)||s<0?d4(i,`${D4} arg3 `,s4.pos):!b2(c)||c<0?d4(i,`${D4} arg4 `,s4.pos):s>c?-1:(s>0||cm2(e,o))+s},eIe=(e,t,n)=>{let r=t;return Z(t)&&(X(t.length===1,`$isArray expects array(1)`),r=t[0]),Z($(e,r,n))},tIe=(e,t,n)=>{if(Z(e))return m4(e,t,n);let r=$(e,t,n);return Q(r)?null:!Z(r)||r.length===0?f4(n.failOnError,`$last`,{size:0}):M2(r)[r.length-1]},nIe=(e,t,n)=>{if(X(x2(t)&&O2(t,`input`,`n`),`$lastN expects object { input, n }`),Z(e))return h4(e,t,n);let{input:r,n:i}=$(e,t,n);return Q(r)?null:Z(r)?h4(r,{n:i,input:`$$this`},n):f4(n.failOnError,`$lastN 'input'`)},rIe=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`in`),`$map expects object { input, as, in }`);let r=$(e,t.input,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return f4(i,`$map 'input'`);if(!Q(t.as)&&!v2(t.as))return u4(i,`$map 'as'`);let a=q2.init(n),o=t.as||`this`,s={variables:{}};return r.map(n=>(s.variables[o]=n,$(e,t.in,a.update(s))))},iIe=(e,t,n)=>{if(X(x2(t)&&O2(t,`input`,`n`),`$maxN expects object { input, n }`),Z(e))return g4(e,t,n);let{input:r,n:i}=$(e,t,n);return Q(r)?null:Z(r)?g4(r,{n:i,input:`$$this`},n):f4(n.failOnError,`$maxN 'input'`)},aIe=(e,t,n)=>{if(X(x2(t)&&O2(t,`input`,`n`),`$minN expects object { input, n }`),Z(e))return b4(e,t,n);let{input:r,n:i}=$(e,t,n);return Q(r)?null:Z(r)?b4(r,{n:i,input:`$$this`},n):f4(n.failOnError,`$minN 'input'`)},oIe=(e,t,n)=>{X(Z(t)&&t.length>1&&t.length<4,`$range expects array(3)`);let[r,i,a]=$(e,t,n),o=n.failOnError,s=a??1;if(!b2(r))return d4(o,`$range arg1 `,s4.int);if(!b2(i))return d4(o,`$range arg2 `,s4.int);if(!b2(s)||s===0)return d4(o,`$range arg3 `,s4.nzero);let c=[],l=r;for(;l0||l>i&&s<0;)c.push(l),l+=s;return c};function sIe(e,t,n){X(x2(t)&&O2(t,`input`,`initialValue`,`in`),`$reduce expects object { input, initialValue, in }`);let r=$(e,t.input,n),i=$(e,t.initialValue,n),a=t.in;if(Q(r))return null;if(!Z(r))return f4(n.failOnError,`$reduce 'input'`);let o=q2.init(n),s={variables:{value:null}},c=i;for(let e=0;e{let r=$(e,t,n);return Q(r)?null:Z(r)?r.slice().reverse():f4(n.failOnError,`$reverseArray`)},lIe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:Z(r)?r.length:d4(n.failOnError,`$size`)},O4=(e,t,n)=>{X(Z(t)&&t.length>1&&t.length<4,`$slice expects array(3)`);let r=n.failOnError,i=$(e,t,n),a=i[0],o=i[1],s=i[2];if(!Z(a))return f4(r,`$slice arg1 `);if(!b2(o))return d4(r,`$slice arg2 `,s4.int);if(!Q(s)&&!b2(s))return d4(r,`$slice arg3 `,s4.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 d4(r,`$slice arg3 `,s4.pos);s+=o}return a.slice(o,s)},uIe=(e,t,n)=>{X(x2(t)&&`input`in t&&`sortBy`in t,`$sortArray expects object { input, sortBy }`);let{input:r,sortBy:i}=$(e,t,n);if(Q(r))return null;if(!Z(r))return f4(n.failOnError,`$sortArray 'input'`);if(x2(i))return n4(Z2(r),i,n).collect();let a=r.slice().sort(f2);return i===-1&&a.reverse(),a},dIe=(e,t,n)=>{X(x2(t)&&O2(t,`inputs`),`$zip received invalid arguments`);let r=$(e,t.inputs,n),i=$(e,t.defaults,n)??[],a=t.useLongestLength??!1,o=n.failOnError;if(Q(r))return null;if(!Z(r))return f4(o,`$zip 'inputs'`);let s=0;for(let e of r){if(Q(e))return null;Z(e)||s++}if(s)return f4(o,`$zip elements of 'inputs'`);_2(a)||c4(o,`$zip 'useLongestLength' must be boolean`),Z(i)&&i.length>0&&X(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;eQ(t[e])?i[n]??null:t[e]);l.push(t)}return l};function k4(e,t,n,r,i){X(Z(t),`${r} expects array as argument`);let a=$(e,t,n),o=!0;for(let e of a){if(Q(e))return null;o&&=b2(e)}return o?i(a):c4(n.failOnError,`${r} array elements must resolve to integers`)}var fIe=(e,t,n)=>k4(e,t,n,`$bitAnd`,e=>e.reduce((e,t)=>e&t,-1)),pIe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:b2(r)?~r:d4(n.failOnError,`$bitNot`,s4.int)},mIe=(e,t,n)=>k4(e,t,n,`$bitOr`,e=>e.reduce((e,t)=>e|t,0)),hIe=(e,t,n)=>k4(e,t,n,`$bitXor`,e=>e.reduce((e,t)=>e^t,0)),gIe=(e,t,n)=>{X(Z(t),`$and expects array`);let r=n.useStrictMode;return t.every(t=>T2($(e,t,n),r))},_Ie=(e,t,n)=>{let r=D2(t);return r.length===0?!1:r.length>1?f4(n.failOnError,`$not`,{size:1}):!$(e,r[0],n)},vIe=(e,t,n)=>{X(Z(t),`$or expects array of expressions`);let r=n.useStrictMode;for(let i of t)if(T2($(e,i,n),r))return!0;return!1},yIe=(e,t,n)=>{X(Z(t)&&t.length===2,`$cmp expects array(2)`);let[r,i]=$(e,t,n);return f2(r,i)};function A4(e,t,n){return e.take(t)}function j4(e,t,n){let r=$(null,t,n);X(Z(r),`$documents expression must resolve to an array.`);let i=Z2(r);return n.processingMode&K2.CLONE_ALL?i.map(e=>A2(e)):i}var bIe=Z2([]);function M4(e,t){if(!e)return{};let n=e[0]?.$documents;return n?{documents:j4(bIe,n,t).collect(),pipeline:e.slice(1)}:{pipeline:e}}function N4(e,t,n=!0){let r={exclusions:[],inclusions:[],positional:0},i=Object.keys(e);X(i.length,`Invalid empty sub-projection`);let a=t?.idKey,o=!1;for(let s of i){if(s.startsWith(`$`))return X(!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||y2(c)&&c===0)s===a?o=!0:r.exclusions.push(s);else if(!x2(c))r.inclusions.push(s);else{let e=N4(c,t,!1);if(!e.inclusions.length&&!e.exclusions.length)r.inclusions.includes(s)||r.inclusions.push(s);else{for(let t of e.exclusions)r.exclusions.push(`${s}.${t}`);for(let t of e.inclusions)r.inclusions.push(`${s}.${t}`)}r.positional+=e.positional}X(!(r.exclusions.length&&r.inclusions.length),`Cannot do exclusion and inclusion in projection.`),X(r.positional<=1,`Cannot specify more than one positional projection.`)}if(o&&r.exclusions.push(a),n){let e=new sFe;for(let t of r.exclusions)X(e.add(t),`Path collision at ${t}.`);for(let t of r.inclusions)X(e.add(t),`Path collision at ${t}.`);r.exclusions.sort(),r.inclusions.sort()}return r}function P4(e,t,n){v2(t)&&X(n.collectionResolver,`${e} requires 'collectionResolver' option to resolve named collection`);let r=v2(t)?n.collectionResolver(t):t;return X(Z(r),`${e} could not resolve input collection`),r}var F4=`$project`;function I4(e,t,n){if(E2(t))return e;let r=N4(t,n),i=xIe(t,q2.init(n),r);return e.map(i)}function xIe(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)=>{H2(t,e,{descendArray:!0})};for(let n of a){let r=I2(e,n)??e[n];if(n.endsWith(`.$`)&&r===1){let e=t?.local?.condition??{};X(e,`${F4}: positional operator '.$' requires array condition.`);let r=n.slice(0,-2);o[r]=wIe(r,e,t);continue}if(Z(r))o[n]=(e,i)=>{t.update({root:i}),V2(e,n,r.map(e=>$(i,e,t)??null))};else if(y2(r)||r===!0)o[n]=(e,r)=>{t.update({root:r}),R4(e,L2(r,n,s))};else if(!x2(r))o[n]=(e,i)=>{t.update({root:i}),V2(e,n,$(i,r,t))};else{let e=Object.keys(r);X(e.length===1&&U2(e[0]),`Not a valid operator`);let i=e[0],a=r[i],s=t.context.getOperator(J2.PROJECTION,i);!s||i===`$slice`&&!D2(a).every(y2)?o[n]=(e,i)=>{t.update({root:i}),V2(e,n,$(i,r,t))}:o[n]=(e,r)=>{t.update({root:r}),V2(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||R2(t),l&&!O2(t,r)&&O2(e,r)&&(t[r]=I2(e,r)),t}}var L4=(e,t,n,r)=>{let i=I2(e,t);Z(i)||(i=I2(i,n)),X(Z(i),`${F4}: field '${t}' must resolve to array`);let a=[];for(let e=0;e(t=>!e(t)),CIe={$and:1,$or:1,$nor:1};function wIe(e,t,n){let r=Object.entries(t).slice(),i={$and:[],$or:[]};for(let t=0;t{let r=[];for(let[e,t,a]of i.$and)r.push(L4(n,e,a,t));if(i.$or.length){let e=[];for(let[t,r,a]of i.$or)e.push(...L4(n,t,a,r));r.push(N2(e))}let a=j2(r).sort()[0],c=I2(n,e)[a];o!=s&&!x2(c)&&(c={[s]:c}),V2(t,o,[c])}}function R4(e,t){if(e===o2||Q(e))return t;if(Q(t))return e;let n=e,r=t;for(let e of Object.keys(t))n[e]=R4(n[e],r[e]);return n}function z4(e,t,n){return X(t>=0,`$skip value must be a non-negative integer`),e.drop(t)}var B4={$sort:n4,$skip:z4,$limit:A4},TIe=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=Z2(this.#e).filter(this.#t);let e=this.#r.processingMode;e&K2.CLONE_INPUT&&this.#a.map(e=>A2(e));for(let e of Object.keys(B4))if(O2(this.#i,e)){let t=B4[e];this.#a=t(this.#a,this.#i[e],this.#r)}return Object.keys(this.#n).length&&(this.#a=I4(this.#a,this.#n,this.#r)),e&K2.CLONE_OUTPUT&&this.#a.map(e=>A2(e)),this.#a}fetchAll(){let e=Z2(Array.from(this.#o));return this.#o.length=0,Q2(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()}},EIe=new Set([`$and`,`$or`,`$nor`,`$expr`,`$jsonSchema`]),V4=class{#e;#t;#n;constructor(e,t){this.#t=A2(e),this.#n=q2.init(t).update({condition:e}),this.#e=[],this.compile()}compile(){X(x2(this.#t),`query criteria must be an object: ${JSON.stringify(this.#t)}`);let e={};for(let t of Object.keys(this.#t)){let n=this.#t[t];if(t===`$where`)X(this.#n.scriptEnabled,`$where operator requires 'scriptEnabled' option to be true.`),Object.assign(e,{field:t,expr:n});else if(EIe.has(t))this.processOperator(t,t,n);else{X(!U2(t),`unknown top level operator: ${t}`);let e=W2(n);for(let n of Object.keys(e))this.processOperator(t,n,e[n])}e.field&&this.processOperator(e.field,e.field,e.expr)}}processOperator(e,t,n){let r=this.#n.context.getOperator(J2.QUERY,t);X(!!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 TIe(e,e=>this.test(e),t||{},this.#n)}};function H4(e,t){let n=e=>e,r=!0;for(let t of Object.keys(e))if(r&&=U2(t)&&t!==`$and`&&t!==`$or`&&t!==`$nor`,!r)break;r&&(e={field:e},n=e=>({field:e}));let i=new V4(e,t);return e=>i.test(n(e))}function U4(e,t,n,r){let i=e.split(`.`),a=Math.max(1,i.length-1),o=q2.init(n).update({depth:a}),s={unwrapArray:!0,pathArray:i};return r===Q4&&(t=H4(t,n)),n=>r(I2(n,e,s),t,o)}function W4(e,t,n,r){X(Z(t)&&t.length===2,`${r.name} expects array(2)`);let[i,a]=$(e,t,n);return r(i,a,n)}function G4(e,t,n){if(m2(e,t)||Q(e)&&Q(t))return!0;if(Z(e)){let r=n?.local?.depth??1;return e.some(e=>m2(e,t))||M2(e,r).some(e=>m2(e,t))}return!1}function K4(e,t,n){return!G4(e,t,n)}function q4(e,t,n){return Q(e)?t.some(e=>e===null):j2([D2(e),t]).length>0}function DIe(e,t,n){return!q4(e,t,n)}function J4(e,t,n){return t3(e,t,(e,t)=>f2(e,t)<0)}function Y4(e,t,n){return t3(e,t,(e,t)=>f2(e,t)<=0)}function X4(e,t,n){return t3(e,t,(e,t)=>f2(e,t)>0)}function Z4(e,t,n){return t3(e,t,(e,t)=>f2(e,t)>=0)}function OIe(e,t,n){return D2(e).some((e=>t.length===2&&e%t[0]===t[1]))}function kIe(e,t,n){let r=D2(e),i=e=>v2(e)&&T2(t.exec(e),n?.useStrictMode);return r.some(i)||M2(r,1).some(i)}function AIe(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;if(x2(i)&&Object.keys(i)[0]===`$elemMatch`){let t=i.$elemMatch;r=Q4(e,H4(t,n),n)}else r=w2(i)?e.some(e=>v2(e)&&i.test(e)):e.some(e=>m2(i,e))}return r}function jIe(e,t,n){return Array.isArray(e)&&e.length===t}function Q4(e,t,n){if(Z(e)&&!E2(e)){for(let n=0,r=e.length;ne===null,MIe={array:Z,boolean:_2,bool:_2,date:C2,number:y2,int:y2,long:y2,double:y2,decimal:y2,null:$4,object:x2,regexp:w2,regex:w2,string:v2,undefined:Q,1:y2,2:v2,3:x2,4:Z,6:Q,8:_2,9:C2,10:$4,11:w2,16:y2,18:y2,19:y2};function e3(e,t,n){let r=MIe[t];return r?r(e):!1}function NIe(e,t,n){return Z(t)?t.findIndex(t=>e3(e,t,n))>=0:e3(e,t,n)}function t3(e,t,n){for(let r of D2(e))if(g2(r)===g2(t)&&n(r,t))return!0;return!1}var PIe=(e,t,n)=>W4(e,t,n,G4),FIe=(e,t,n)=>W4(e,t,n,X4),IIe=(e,t,n)=>W4(e,t,n,Z4),LIe=(e,t,n)=>W4(e,t,n,J4),RIe=(e,t,n)=>W4(e,t,n,Y4),zIe=(e,t,n)=>W4(e,t,n,K4),n3=`$cond expects array(3) or object with 'if-then-else' expressions`,BIe=(e,t,n)=>{let r,i,a;return Z(t)?(X(t.length===3,n3),r=t[0],i=t[1],a=t[2]):(X(x2(t),n3),r=t.if,i=t.then,a=t.else),$(e,T2($(e,r,n),n.useStrictMode)?i:a,n)},r3=(e,t,n)=>{X(Z(t),`$ifNull expects an array`);let r;for(let i of t)if(r=$(e,i,n),!Q(r))return r;return r},VIe=(e,t,n)=>{X(x2(t),`$switch received invalid arguments`);for(let{case:r,then:i}of t.branches)if(T2($(e,r,n),n.useStrictMode))return $(e,i,n);return $(e,t.default,n)},i3=(e,t,n)=>{X(n.scriptEnabled,`$function requires 'scriptEnabled' option to be true`);let r=$(e,t,n);return r.body.apply(null,r.args)},a3=[`year`,`quarter`,`month`,`week`,`day`,`hour`,`minute`,`second`,`millisecond`],HIe={mon:1,tue:2,wed:3,thu:4,fri:5,sat:6,sun:7},UIe=-1e9,o3=e=>(e&3)==0&&(e%100!=0||e%400==0),WIe=[365,366],GIe=[[0,31,59,90,120,151,181,212,243,273,304,334],[0,31,60,91,121,152,182,213,244,274,305,335]],s3=e=>GIe[+o3(e.getUTCFullYear())][e.getUTCMonth()]+e.getUTCDate(),c3=(e,t)=>((e.getUTCDay()||7)-HIe[t.toLowerCase().substring(0,3)]+7)%7,l3=e=>(e+Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400))%7,u3=e=>52+Number(l3(e)==4||l3(e-1)==3);function d3(e){let t=e.getUTCDay()||7,n=Math.floor((10+s3(e)-t)/7);return n<1?u3(e.getUTCFullYear()-1):n>u3(e.getUTCFullYear())?1:n}function f3(e){let t=d3(e);return e.getUTCDay()>0&&e.getUTCDate()==1&&e.getUTCMonth()==0?0:e.getUTCDay()==0?t+1:t}function p3(e){return e.getUTCFullYear()-Number(e.getUTCMonth()===0&&e.getUTCDate()==1&&e.getUTCDay()<1)}var m3={week:6048e5,day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},h3=[[`year`,0,9999],[`month`,1,12],[`day`,1,31],[`hour`,0,23],[`minute`,0,59],[`second`,0,59],[`millisecond`,0,999]],g3={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},_3={"%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:/%%/}},v3=/(%[bBYGmdjHMSLwuUVzZ%])/g,KIe=/%[bBYGmdjHMSLwuUVzZ%]/,qIe=/^[a-zA-Z_]+\/[a-zA-Z_]+$/;function y3(e,t){if(e===void 0)return 0;if(qIe.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=_3[`%z`].re.exec(e)??[];X(!!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 JIe(e){return(e<0?`-`:`+`)+S3(Math.abs(Math.floor(e/60)),2)+S3(Math.abs(e)%60,2)}function b3(e,t){e.setUTCMinutes(e.getUTCMinutes()+t)}function x3(e,t,n){if(C2(e))return e;let r=$(e,t,n);if(C2(r))return new Date(r);if(y2(r))return new Date(r*1e3);X(!!r?.date,`cannot convert ${JSON.stringify(t)} to date`);let i=C2(r.date)?new Date(r.date):new Date(r.date*1e3);return r.timezone&&b3(i,y3(r.timezone,i)),i}function S3(e,t){return Array(Math.max(t-String(e).length+1,0)).join(`0`)+e.toString()}var C3=e=>{let t=e-UIe;return Math.trunc(t/4)-Math.trunc(t/100)+Math.trunc(t/400)};function YIe(e,t){return Math.trunc(C3(t-1)-C3(e-1)+(t-e)*WIe[0])}var w3=(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),T3=(e,t)=>t.getUTCMonth()-e.getUTCMonth()+w3(e,t)*12,E3=(e,t)=>{let n=Math.trunc(e.getUTCMonth()/3);return Math.trunc(t.getUTCMonth()/3)-n+w3(e,t)*4},D3=(e,t)=>s3(t)-s3(e)+YIe(e.getUTCFullYear(),t.getUTCFullYear()),O3=(e,t,n)=>{let r=(n||`sun`).substring(0,3);return Math.trunc((D3(e,t)+c3(e,r)-c3(t,r))/7)},XIe=(e,t)=>t.getUTCHours()-e.getUTCHours()+D3(e,t)*24,k3=(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())},A3=(e,t,n,r)=>{let i=new Date(e);switch(t){case`year`:i.setUTCFullYear(i.getUTCFullYear()+n);break;case`quarter`:k3(i,3*n);break;case`month`:k3(i,n);break;default:i.setTime(i.getTime()+m3[t]*n)}return i},j3=(e,t,n)=>{let r=$(e,t,n);return A3(r.startDate,r.unit,r.amount,r.timezone)},ZIe=(e,t,n)=>{let{startDate:r,endDate:i,unit:a,timezone:o,startOfWeek:s}=$(e,t,n),c=new Date(r),l=new Date(i);switch(b3(c,y3(o,c)),b3(l,y3(o,l)),a){case`year`:return w3(c,l);case`quarter`:return E3(c,l);case`month`:return T3(c,l);case`week`:return O3(c,l,s);case`day`:return D3(c,l);case`hour`:return XIe(c,l);case`minute`:return c.setUTCSeconds(0),c.setUTCMilliseconds(0),l.setUTCSeconds(0),l.setUTCMilliseconds(0),Math.round((l.getTime()-c.getTime())/m3[a]);default:return Math.round((l.getTime()-c.getTime())/m3[a])}},QIe=[31,28,31,30,31,30,31,31,30,31,30,31],$Ie=e=>e.month==2&&o3(e.year)?29:QIe[e.month-1],eLe=(e,t,n)=>{let r=$(e,t,n),i=y3(r.timezone,new Date);for(let e=h3.length-1,t=0;e>=0;e--){let n=h3[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),cs&&(c+=o,t=Math.trunc(c/l),c%=l);r[a]=c}return r.day=Math.min(r.day,$Ie(r)),new Date(Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond))};function tLe(e){return e===`Z`?0:e>=`A`&&e<`N`?e.charCodeAt(0)-64:77-e.charCodeAt(0)}var nLe=e=>e.replace(/^\//,``).replace(/\/$/,``).replace(/\/i/,``),rLe=[`^`,`.`,`-`,`*`,`?`,`$`];function iLe(e){for(let t of rLe)e=e.replace(t,`\\${t}`);return e}function aLe(e,t,n){let r=$(e,t,n),i=r.format||`%Y-%m-%dT%H:%M:%S.%LZ`,a=r.onNull||null,o=r.dateString;if(Q(o))return a;let s=i.split(KIe);s.reverse();let c=i.match(v3),l={},u=``;for(let e=0,t=c.length;e{let r=$(e,t,n);return A3(r.startDate,r.unit,-r.amount,r.timezone)},sLe=(e,t,n)=>{let r=$(e,t,n),i=new Date(r.date);b3(i,y3(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:p3(i),isoWeek:d3(i),isoDayOfWeek:i.getUTCDay()||7}):Object.assign(a,{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate()})},cLe={"%Y":e=>e.getUTCFullYear(),"%G":e=>e.getUTCFullYear(),"%m":e=>e.getUTCMonth()+1,"%d":e=>e.getUTCDate(),"%H":e=>e.getUTCHours(),"%M":e=>e.getUTCMinutes(),"%S":e=>e.getUTCSeconds(),"%L":e=>e.getUTCMilliseconds(),"%u":e=>e.getUTCDay()||7,"%U":f3,"%V":d3,"%j":s3,"%w":e=>e.getUTCDay()},lLe=(e,t,n)=>{let r=$(e,t,n);if(Q(r.onNull)&&(r.onNull=null),Q(r.date))return r.onNull;let i=x3(e,r.date,n),a=r.format??`%Y-%m-%dT%H:%M:%S.%LZ`,o=y3(r.timezone,i),s=a.match(v3);if(!s)return a;b3(i,o);for(let e=0,t=s.length;e{let n=e%t;return n<0&&(n+=t),n},uLe={day:D3,month:T3,quarter:E3,year:w3},dLe=/(mon(day)?|tue(sday)?|wed(nesday)?|thu(rsday)?|fri(day)?|sat(urday)?|sun(day)?)/i,fLe=(e,t,n)=>{let{date:r,unit:i,binSize:a,timezone:o,startOfWeek:s}=$(e,t,n);if(Q(r)||Q(i))return null;let c=(s??`sun`).toLowerCase().substring(0,3);X(C2(r),`$dateTrunc: 'date' must resolve to a valid Date object.`),X(a3.includes(i),`$dateTrunc: unit is invalid.`),X(i!=`week`||dLe.test(c),`$dateTrunc: startOfWeek '${c}' is not a valid.`),X(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*m3[i],t=r.getTime()-M3;return new Date(r.getTime()-N3(t,e))}default:{X(l<=1e11,`dateTrunc unsupported binSize value`);let e=new Date(r),t=new Date(M3),n=0;if(i==`week`){let r=(7-c3(t,c))%7;t.setTime(t.getTime()+r*m3.day),n=O3(t,e,c)}else n=uLe[i](t,e);let a=A3(t,i,n-N3(n,l),o);return b3(a,-y3(o,a)),a}}},pLe=(e,t,n)=>x3(e,t,n).getUTCDate(),mLe=(e,t,n)=>x3(e,t,n).getUTCDay()+1,hLe=(e,t,n)=>s3(x3(e,t,n)),gLe=(e,t,n)=>x3(e,t,n).getUTCHours(),_Le=(e,t,n)=>x3(e,t,n).getUTCDay()||7,vLe=(e,t,n)=>d3(x3(e,t,n)),yLe=(e,t,n)=>p3(x3(e,t,n)),bLe=(e,t,n)=>x3(e,t,n).getUTCMilliseconds(),xLe=(e,t,n)=>x3(e,t,n).getUTCMinutes(),SLe=(e,t,n)=>x3(e,t,n).getUTCMonth()+1,CLe=(e,t,n)=>x3(e,t,n).getUTCSeconds(),wLe=(e,t,n)=>f3(x3(e,t,n)),TLe=(e,t,n)=>x3(e,t,n).getUTCFullYear(),ELe=(e,t,n)=>t,DLe=(e,t,n)=>v4($(e,t.input,n),{input:`$$CURRENT`,method:t.method},n),OLe=(e,t,n)=>{let r=$(e,t,n),{field:i,input:a}=v2(r)?{field:r,input:e}:{field:r.field,input:r.input??e};return a[i]},kLe=(e,t,n)=>Math.random(),ALe=(e,t,n)=>Math.random()<=$(e,t,n),P3=(e,t,n)=>{let r=$(e,t,n);return Q(r)?{}:Z(r)?y4(r,t,n):f4(n.failOnError,`$mergeObjects`,xFe.obj)},jLe=(e,t,n)=>{let r=$(e,t,n);if(Q(r))return null;if(!x2(r))return l4(n.failOnError,`$objectToArray`);let i=Object.keys(r),a=Array(i.length),o=0;for(let e of i)a[o++]={k:e,v:r[e]};return a},F3=`$setField`,I3=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`field`,`value`),`$setField expects object { input, field, value }`);let{input:r,field:i,value:a}=$(e,t,n);if(Q(r))return null;let o=n.failOnError;if(!x2(r))return l4(o,`${F3} 'input'`);if(!v2(i))return u4(o,`${F3} 'field'`);let s={...r};return t.value==`$$REMOVE`?delete s[i]:s[i]=a,s},MLe=(e,t,n)=>I3(e,{...t,value:`$$REMOVE`},n),NLe=(e,t,n)=>_4($(e,t.input,n),{...t,input:`$$CURRENT`},n),PLe=(e,t,n)=>{if(Z(t)){if(t.length===0)return!0;X(t.length===1,`$allElementsTrue expects array(1)`),t=t[0]}let r=n.failOnError,i=$(e,t,n);if(!Z(i))return f4(r,`$allElementsTrue argument`);for(let e of i)if(!T2(e,n.useStrictMode))return!1;return!0},FLe=(e,t,n)=>{if(Z(t)){if(t.length===0)return!1;X(t.length===1,`$anyElementTrue expects array(1)`),t=t[0]}let r=n.failOnError,i=$(e,t,n);if(!Z(i))return f4(r,`$anyElementTrue argument`);for(let e of i)if(T2(e,n.useStrictMode))return!0;return!1},L3=`$setDifference`,ILe=(e,t,n)=>{X(Z(t)&&t.length==2,`${L3} expects array(2)`);let r=$(e,t,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=Z(e)}if(!a)return f4(i,`${L3} arguments`);let o=h2.init();for(let e of r[0])o.set(e,!0);for(let e of r[1])o.delete(e);return Array.from(o.keys())},LLe=(e,t,n)=>{X(Z(t),`$setEquals expects array`);let r=$(e,t,n),i=n.failOnError;if(!r.every(Z))return f4(i,`$setEquals arguments`);let a=h2.init(),o=r[0];for(let e=0;e{X(Z(t),`${R3} expects array`);let r=$(e,t,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=Z(e)}return a?j2(r):f4(i,`${R3} arguments`)},z3=`$setIsSubset`,zLe=(e,t,n)=>{X(Z(t)&&t.length===2,`${z3} expects array(2)`);let r=$(e,t,n);if(!r.every(Z))return f4(n.failOnError,`${z3} arguments`);let[i,a]=r,o=h2.init();for(let e of a)o.set(e,0);for(let e of i)if(!o.has(e))return!1;return!0},BLe=(e,t,n)=>{let r=$(e,t,n),i=n.failOnError;return Q(r)?null:Z(r)?Z(t)?r.every(Z)?N2(M2(r)):f4(i,`$setUnion arguments`):N2(r):f4(i,`$setUnion`)},VLe=(e,t,n)=>{X(Z(t),`$concat expects array`);let r=n.failOnError,i=$(e,t,n),a=!0;for(let e of i){if(Q(e))return null;a&&=v2(e)}return a?i.join(``):f4(r,`$concat`,{type:`string`})},B3=`$indexOfBytes`,HLe=(e,t,n)=>{X(Z(t)&&t.length>1&&t.length<5,`${B3} expects array(4)`);let r=$(e,t,n),i=n.failOnError,a=r[0];if(Q(a))return null;if(!v2(a))return u4(i,`${B3} arg1 `);let o=r[1];if(!v2(o))return u4(i,`${B3} arg2 `);let s=r[2]??0,c=r[3]??a.length;if(!b2(s)||s<0)return d4(i,`${B3} arg3 `,s4.index);if(!b2(c)||c<0)return d4(i,`${B3} arg4 `,s4.index);if(s>c)return-1;let l=a.substring(s,c).indexOf(o);return l>-1?l+s:l},ULe=[0,32,9,10,11,12,13,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202];function V3(e,t,n,r){let i=$(e,t,n),a=i.input;if(Q(a))return null;let o=Q(i.chars)?ULe: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 H3(e,t,n,r){let i=$(e,t,n);if(!v2(i.input))return[];let a=i.options;a&&(X(a.indexOf(`x`)===-1,`extended capability option 'x' not supported`),X(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;tV3(e,t,n,{left:!0,right:!1}),GLe=(e,t,n)=>{let r=H3(e,t,n,{global:!1});return Z(r)&&r.length>0?r[0]:null},KLe=(e,t,n)=>H3(e,t,n,{global:!0}),qLe=(e,t,n)=>H3(e,t,n,{global:!1})?.length!=0,U3=`$replaceAll`,JLe=(e,t,n)=>{X(x2(t),`${U3} expects an object argument`);let r=n.failOnError,{input:i,find:a,replacement:o}=$(e,t,n);return Q(i)||Q(a)||Q(o)?null:v2(i)?v2(a)?v2(o)?i.replace(new RegExp(a,`g`),o):u4(r,`${U3} 'replacement'`):u4(r,`${U3} 'find'`):u4(r,`${U3} 'input'`)},W3=`$replaceOne`,YLe=(e,t,n)=>{let r=n.failOnError,i=$(e,t,n),{input:a,find:o,replacement:s}=i;return Q(a)||Q(o)||Q(s)?null:v2(a)?v2(o)?v2(s)?i.input.replace(i.find,i.replacement):u4(r,`${W3} 'replacement'`):u4(r,`${W3} 'find'`):u4(r,`${W3} 'input'`)},XLe=(e,t,n)=>V3(e,t,n,{left:!1,right:!0}),ZLe=(e,t,n)=>{X(Z(t)&&t.length===2,`$split expects array(2)`);let r=$(e,t,n),i=n.failOnError;return Q(r[0])?null:r.every(v2)?r[0].split(r[1]):f4(i,`$split `,{size:2,type:`string`})},QLe=(e,t,n)=>{X(Z(t)&&t.length===2,`$strcasecmp expects array(2)`);let r=$(e,t,n),i=n.failOnError,a=!0,o=!0;for(let e of r)a&&=Q(e),o&&=v2(e);return a?0:o?u2(r[0].toLowerCase(),r[1].toLowerCase()):f4(i,`$strcasecmp arguments`,{type:`string`})},$Le=(e,t,n)=>{let r=$(e,t,n);return v2(r)?~-encodeURI(r).split(/%..|./).length:u4(n.failOnError,`$strLenBytes`)},eRe=(e,t,n)=>{let r=$(e,t,n);return v2(r)?r.length:u4(n.failOnError,`$strLenCP`)},G3=`$substrBytes`,K3=(e,t,n)=>{X(Z(t)&&t.length===3,`${G3} expects array(3)`);let[r,i,a]=$(e,t,n),o=n.failOnError,s=Q(r);if(!s&&!v2(r))return u4(o,`${G3} arg1 `);if(!b2(i)||i<0)return d4(o,`${G3} arg2 `,s4.index);if(!b2(a)||a<0)return d4(o,`${G3} arg3 `,s4.index);if(s)return``;let c=0,l=null,u=null,d=`${G3} UTF-8 boundary falls inside a continuation byte`;for(let e=0;e65535?2:1;if(l===null){if(i>c&&ic&&f{X(Z(t)&&t.length===3,`${q3} expects array(3)`);let[r,i,a]=$(e,t,n),o=Q(r),s=n.failOnError;return!o&&!v2(r)?u4(s,`${q3} arg1 `):b2(i)?b2(a)?o||i<0?``:a<0?r.substring(i):r.substring(i,i+a):d4(s,`${q3} arg3 `):d4(s,`${q3} arg2 `)},J3=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:v2(r)?!0:!!r},Y3=(e,t,n)=>{let r=$(e,t,n);if(C2(r))return r;if(Q(r))return null;let i=new Date(r);return X(!isNaN(i.getTime()),`cannot convert '${r}' to date`),i},X3=(e,t,n)=>{let r=$(e,t,n);if(Q(r))return null;if(C2(r))return r.getTime();if(r===!0)return 1;if(r===!1)return 0;let i=Number(r);return X(y2(i),`cannot convert '${r}' to double/decimal`),i},rRe=2147483647,iRe=-2147483648,aRe=9007199254740991,oRe=-9007199254740991;function Z3(e,t,n,r,i){let a=$(e,t,n);if(a===!0)return 1;if(a===!1)return 0;if(Q(a))return null;if(C2(a))return a.getTime();let o=Number(a);return X(y2(o)&&o>=r&&o<=i&&(!v2(a)||o.toString().indexOf(`.`)===-1),`cannot convert '${a}' to ${i==2147483647?`int`:`long`}`),Math.trunc(o)}var Q3=(e,t,n)=>Z3(e,t,n,iRe,rRe),$3=(e,t,n)=>Z3(e,t,n,oRe,aRe),e6=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:C2(r)?r.toISOString():s2(r)||w2(r)?String(r):c4(n.failOnError,`$toString cannot convert from object to string`)},sRe=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`to`),`$convert expects object { input, to, onError, onNull }`);let r=$(e,t.input,n);if(Q(r))return $(e,t.onNull,n)??null;let i=$(e,t.to,n);try{switch(i){case 2:case`string`:return e6(e,r,n);case 8:case`boolean`:case`bool`:return J3(e,r,n);case 9:case`date`:return Y3(e,r,n);case 1:case 19:case`double`:case`decimal`:case`number`:return X3(e,r,n);case 16:case`int`:return Q3(e,r,n);case 18:case`long`:return $3(e,r,n)}}catch{}return t.onError===void 0?c4(n.failOnError,`$convert cannot convert from object to ${t.to} with no onError value`):$(e,t.onError,n)},cRe=(e,t,n)=>y2($(e,t,n)),lRe=X3,uRe=(e,t,n)=>{let r=$(e,t,n);if(n.useStrictMode){if(r===void 0)return`missing`;if(r===!0||r===!1)return`bool`;if(y2(r))return r%1==0?r>=-2147483648&&r<=2147483647?`int`:`long`:`double`;if(w2(r))return`regex`}return g2(r)},dRe=(e,t,n)=>{Z(t)&&t.length===1&&(t=t[0]);let r=e6(e,t,n);return r===null?r:r.toLowerCase()},fRe=(e,t,n)=>{Z(t)&&t.length===1&&(t=t[0]);let r=e6(e,t,n);return r===null?r:r.toUpperCase()},pRe=(e,t,n)=>V3(e,t,n,{left:!0,right:!0}),mRe=(e,t,n)=>i2($(e,t,n));function t6(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,n);if(c in a){let e=a[c];return e instanceof Error?d4(o,`$${s} invalid input '${c}'`):e}return y2(c)?r(c):d4(o,`$${s}`)}var hRe=(e,t,n)=>t6(e,t,n,Math.acos,{Infinity:1/0,0:Error()}),gRe=(e,t,n)=>t6(e,t,n,Math.acosh,{Infinity:1/0,0:Error()}),_Re=(e,t,n)=>t6(e,t,n,Math.asin),vRe=(e,t,n)=>t6(e,t,n,Math.asinh,{Infinity:1/0,"-Infinity":-1/0}),yRe=(e,t,n)=>t6(e,t,n,Math.atan),bRe=(e,t,n)=>{let[r,i]=$(e,t,n);return isNaN(r)||Q(r)?r:isNaN(i)||Q(i)?i:Math.atan2(r,i)},xRe=(e,t,n)=>t6(e,t,n,Math.atanh,{1:1/0,"-1":-1/0}),SRe=(e,t,n)=>t6(e,t,n,Math.cos),CRe=(e,t,n)=>t6(e,t,n,Math.cosh,{"-Infinity":1/0,Infinity:1/0}),wRe=e=>Math.PI/180*e,TRe=(e,t,n)=>t6(e,t,n,wRe,{Infinity:1/0,"-Infinity":1/0}),ERe=e=>180/Math.PI*e,DRe=(e,t,n)=>t6(e,t,n,ERe,{Infinity:1/0,"-Infinity":1/0}),ORe=(e,t,n)=>t6(e,t,n,Math.sin),kRe=(e,t,n)=>t6(e,t,n,Math.sinh,{"-Infinity":-1/0,Infinity:1/0}),ARe=(e,t,n)=>t6(e,t,n,Math.tan),jRe=(e,t,n)=>t6(e,t,n,Math.tanh,{Infinity:1,"-Infinity":-1}),MRe=(e,t,n)=>{let r={};for(let i of Object.keys(t.vars))r[i]=$(e,t.vars[i],n);return $(e,t.in,q2.init(n).update({variables:r}))},NRe=e({$abs:()=>kFe,$acos:()=>hRe,$acosh:()=>gRe,$add:()=>AFe,$allElementsTrue:()=>PLe,$and:()=>gIe,$anyElementTrue:()=>FLe,$arrayElemAt:()=>KFe,$arrayToObject:()=>qFe,$asin:()=>_Re,$asinh:()=>vRe,$atan:()=>yRe,$atan2:()=>bRe,$atanh:()=>xRe,$bitAnd:()=>fIe,$bitNot:()=>pIe,$bitOr:()=>mIe,$bitXor:()=>hIe,$ceil:()=>jFe,$cmp:()=>yIe,$concat:()=>VLe,$concatArrays:()=>JFe,$cond:()=>BIe,$convert:()=>sRe,$cos:()=>SRe,$cosh:()=>CRe,$dateAdd:()=>j3,$dateDiff:()=>ZIe,$dateFromParts:()=>eLe,$dateFromString:()=>aLe,$dateSubtract:()=>oLe,$dateToParts:()=>sLe,$dateToString:()=>lLe,$dateTrunc:()=>fLe,$dayOfMonth:()=>pLe,$dayOfWeek:()=>mLe,$dayOfYear:()=>hLe,$degreesToRadians:()=>TRe,$divide:()=>MFe,$eq:()=>PIe,$exp:()=>NFe,$filter:()=>YFe,$first:()=>XFe,$firstN:()=>ZFe,$floor:()=>PFe,$function:()=>i3,$getField:()=>OLe,$gt:()=>FIe,$gte:()=>IIe,$hour:()=>gLe,$ifNull:()=>r3,$in:()=>QFe,$indexOfArray:()=>$Fe,$indexOfBytes:()=>HLe,$isArray:()=>eIe,$isNumber:()=>cRe,$isoDayOfWeek:()=>_Le,$isoWeek:()=>vLe,$isoWeekYear:()=>yLe,$last:()=>tIe,$lastN:()=>nIe,$let:()=>MRe,$literal:()=>ELe,$ln:()=>FFe,$log:()=>IFe,$log10:()=>LFe,$lt:()=>LIe,$lte:()=>RIe,$ltrim:()=>WLe,$map:()=>rIe,$maxN:()=>iIe,$median:()=>DLe,$mergeObjects:()=>P3,$millisecond:()=>bLe,$minN:()=>aIe,$minute:()=>xLe,$mod:()=>RFe,$month:()=>SLe,$multiply:()=>zFe,$ne:()=>zIe,$not:()=>_Ie,$objectToArray:()=>jLe,$or:()=>vIe,$percentile:()=>NLe,$pow:()=>BFe,$radiansToDegrees:()=>DRe,$rand:()=>kLe,$range:()=>oIe,$reduce:()=>sIe,$regexFind:()=>GLe,$regexFindAll:()=>KLe,$regexMatch:()=>qLe,$replaceAll:()=>JLe,$replaceOne:()=>YLe,$reverseArray:()=>cIe,$round:()=>VFe,$rtrim:()=>XLe,$sampleRate:()=>ALe,$second:()=>CLe,$setDifference:()=>ILe,$setEquals:()=>LLe,$setField:()=>I3,$setIntersection:()=>RLe,$setIsSubset:()=>zLe,$setUnion:()=>BLe,$sigmoid:()=>HFe,$sin:()=>ORe,$sinh:()=>kRe,$size:()=>lIe,$slice:()=>O4,$sortArray:()=>uIe,$split:()=>ZLe,$sqrt:()=>UFe,$strLenBytes:()=>$Le,$strLenCP:()=>eRe,$strcasecmp:()=>QLe,$substr:()=>tRe,$substrBytes:()=>K3,$substrCP:()=>nRe,$subtract:()=>WFe,$switch:()=>VIe,$tan:()=>ARe,$tanh:()=>jRe,$toBool:()=>J3,$toDate:()=>Y3,$toDecimal:()=>lRe,$toDouble:()=>X3,$toHashedIndexKey:()=>mRe,$toInt:()=>Q3,$toLong:()=>$3,$toLower:()=>dRe,$toString:()=>e6,$toUpper:()=>fRe,$trim:()=>pRe,$trunc:()=>GFe,$type:()=>uRe,$unsetField:()=>MLe,$week:()=>wLe,$year:()=>TLe,$zip:()=>dIe});function n6(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],n);r===void 0?H2(i,a):V2(i,a,r)}return i})}function PRe(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}};X(r.length>1,`$bucket: must specify at least two boundaries.`),X(r.every((e,t)=>t===0||g2(e)===g2(r[t-1])&&f2(e,r[t-1])>0),`$bucket: bounds must be of same type and in ascending order`),X(Q(i)||g2(i)!==g2(a)||f2(i,o)>=0||f2(i,a)<0,`$bucket: 'default' expression must be out of boundaries range`);let c=()=>{let c=new Map;for(let e=0;e{let s=$(e,t.groupBy,n);if(Q(s)||f2(s,a)<0||f2(s,o)>=0)X(!Q(i),`$bucket require a default for out of range values`),c.get(i)?.push(e);else{X(f2(s,a)>=0&&f2(s,o)<0,`$bucket 'groupBy' expression must resolve to a value in range of boundaries`);let t=G2(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)),X(c.size===r.length,`bounds and groups must be of equal size.`),Z2(r).map(e=>({...$(c.get(e),s,n),_id:e}))},l;return Z2(()=>(l||=c(),l.next()))}function FRe(e,t,n){let{buckets:r,groupBy:i,output:a,granularity:o}=t,s=a??{count:{$sum:1}};X(r>0,`$bucketAuto: 'buckets' field must be greater than 0, but found: ${r}`),o&&X(/^(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,n)??null;return X(!o||y2(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:f2(e[0],t[0]));let d;d=o?o==`POWERSOF2`?LRe(u,r):zRe(u,r,o):IRe(u,r,c);let f=!1;return Z2(()=>{if(f)return{done:!0};let{min:e,max:t,bucket:r,done:i}=d();f=i;let a=$(r,s,n);for(let e of Object.keys(a)){let t=a[e];Z(t)&&(a[e]=t.filter(e=>!Q(e)))}return{done:!1,value:{...a,_id:{min:e,max:t}}}})}function IRe(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(;a0&&m2(e[a-1][0],e[a][0]));)c.push(e[a++][1]);let l=n.get(c[0]),u;return u=a=r}}}function LRe(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=n}}}var RRe={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]},r6=(e,t)=>{if(e==0)return 0;let n=RRe[t],r=n[0],i=n[n.length-1],a=1;for(;e>=i*a;)a*=10;let o=0;for(;e=i*a)return o;X(e>=r*a&&e(t*=a,et))),c=n[s]*a;return e==c?n[s+1]*a:c};function zRe(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}}}function BRe(e,t,n){X(v2(t)&&t.trim().length>0&&!t.includes(`.`)&&t[0]!==`$`,`$count expression must evaluate to valid field name`);let r=0;return Z2(()=>r++==0?{value:{[t]:e.size()},done:!1}:{done:!0})}var i6=`$densify`;function VRe(e,t,n){let{step:r,bounds:i,unit:a}=t.range;a?(X(a3.includes(a),`${i6} 'range.unit' value is not supported.`),X(b2(r)&&r>0,`${i6} 'range.step' must resolve to integer if 'range.unit' is specified.`)):X(y2(r),`${i6} 'range.step' must resolve to number.`),Z(i)&&(X(!!i&&i.length===2,`${i6} 'range.bounds' must have exactly two elements.`),X((i.every(y2)||i.every(C2))&&i[0]y2(e)?e+r:j3({},{startDate:e,unit:a,amount:r},n),c=!!a&&a3.includes(a),l=e=>{let n=I2(e,t.field);return X(Q(n)||C2(n)&&c||y2(n)&&!c,`${i6} Densify field type must be numeric with 'unit' unspecified, or a date with 'unit' specified.`),n},u=[],d=Z2(()=>{let t=e.next();return Q(l(t.value))?t:(u.push(t),{done:!0})}),f=h2.init(),[p,m]=Z(i)?i:[i,i],h,g=e=>{h=h===void 0||h{let n=u.pop()||e.next();if(n.done)return n;let r=_;Z(o)&&(r=o.map(e=>I2(n.value,e)),X(r.every(v2),`$densify: Partition fields must evaluate to string values.`)),X(x2(n.value),`$densify: collection must contain documents`);let i=l(n.value);f.has(r)||(p==`full`?(f.has(_)||f.set(_,i),f.set(r,f.get(_))):p==`partition`?f.set(r,i):f.set(r,p));let a=f.get(r);if(i<=a||m!=`full`&&m!=`partition`&&a>=m)return a<=i&&f.set(r,s(a)),g(i),n;f.set(r,s(a)),g(a);let c={[t.field]:a};if(r)for(let e=0;e{if(y===-1){let e=f.get(_);f.delete(_),b=Array.from(f.keys()),b.length===0&&(b.push(_),f.set(_,e)),y++}do{let e=b[y],n=f.get(e);if(n{let r={};for(let i of Object.keys(t))r[i]=new e4(t[i],n).run(e);return Z2([r])})}var a6=new WeakMap;function o6(e,t,n,r){a6.has(e)||a6.set(e,{});let i=a6.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&&a6.delete(e)):a6.delete(e)}}function URe(e,t,n,r,i){return o6(t,n,()=>{let e=t4(t,`$`+Object.keys(n.parentExpr.sortBy)[0],r),i=P2(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 WRe=(e,t,n,r,i)=>t+(i-e)*((r-t)/(n-e)),GRe=(e,t,n,r)=>o6(t,n,()=>{let e=t4(t,[`$`+Object.keys(n.parentExpr.sortBy)[0],n.inputExpr],r).filter((([e,t])=>y2(+e))),i=-1,a=0;for(;a=e.length)break;for(a++;i+1t)},e=>e[n.documentNumber-1]),KRe=(e,t,n,r)=>o6(t,n,()=>{let e=t4(t,n.inputExpr,r);for(let t=1;te[n.documentNumber-1]),s6=`_id`;function c6(e,t,n){X(O2(t,s6),`$group specification must include an '_id'`);let r=t[s6],i=q2.init(n),a=Object.keys(t).filter(e=>e!=s6);return e.transform(e=>{let o=P2(e,e=>$(e,r,n)),s=-1,c=Array.from(o.keys());return Z2(()=>{if(++s===o.size)return{done:!0};let e=c[s],n={};e!==void 0&&(n[s6]=e);for(let r of a)n[r]=$(o.get(e),t[r],i.update({root:null,groupId:e}));return{value:n,done:!1}})})}var qRe=[`$denseRank`,`$documentNumber`,`$first`,`$last`,`$linearFill`,`$rank`,`$shift`],JRe=[`$denseRank`,`$expMovingAvg`,`$linearFill`,`$locf`,`$rank`,`$shift`],YRe=e=>{let t=e?.documents||e?.range;return!t||t[0]===`unbounded`&&t[1]===`unbounded`},l6=`$setWindowFields`;function XRe(e,t,n){n=q2.init(n),n.context.addExpressionOps({$function:i3});let r={},i=Object.keys(t.output);for(let e of i){let i=t.output[e],a=Object.keys(i),o=a.find(U2),s=n.context;if(X(o&&(!!s.getOperator(J2.WINDOW,o)||!!s.getOperator(J2.ACCUMULATOR,o)),`${l6} '${o}' is not a valid window operator`),X(a.length>0&&a.length<=2&&(a.length==1||a.includes(`window`)),`${l6} 'output' option should have a single window operator.`),i?.window){let{documents:e,range:t}=i.window;X((!!e^+!!t)==1,`'window' option supports only one of 'documents' or 'range'.`)}r[e]=o}return t.sortBy&&(e=n4(e,t.sortBy,n)),e=c6(e,{_id:t.partitionBy,items:{$push:`$$CURRENT`}},n),e.transform(e=>{let a=[],o=[];for(let e of i){let i=t.output[e],a=r[e],s={operatorName:a,func:{left:n.context.getOperator(J2.ACCUMULATOR,a),right:n.context.getOperator(J2.WINDOW,a)},args:i[a],field:e,window:i.window},c=YRe(s.window);if(c==0||qRe.includes(a)){let e=c?`'${a}'`:`bounded window operations`;X(t.sortBy,`${l6} 'sortBy' is required for ${e}.`)}X(c||!JRe.includes(a),`${l6} cannot use bounded window for operator '${a}'.`),o.push(s)}for(let r of e){let e=r.items,i=Z2(e),s={};for(let r of o){let{func:a,args:o,field:c,window:l}=r,u=e=>{let r=-1;return i=>{if(++r,a.left)return a.left(e(i,r),o,n);if(a.right)return a.right(i,e(i,r),{parentExpr:t,inputExpr:o,documentNumber:r+1,field:c},n)}};if(l){let{documents:r,range:i,unit:a}=l,o=r||i;if(!YRe(l)){let[i,l]=o,d=e=>i==`current`?e:i==`unbounded`?0:Math.max(i+e,0),f=t=>l==`current`?t+1:l==`unbounded`?e.length:l+t+1;s[c]=u((s,c)=>{if(r||o?.every(v2))return e.slice(d(c),f(c));let u=Object.keys(t.sortBy)[0],p,m;if(a){let e=new Date(s[u]),t=t=>j3(s,{startDate:e,unit:a,amount:t},n).getTime();p=y2(i)?t(i):-1/0,m=y2(l)?t(l):1/0}else{let e=s[u];p=y2(i)?e+i:-1/0,m=y2(l)?e+l:1/0}let h=i==`current`?c:0,g=l==`current`?c+1:e.length,_=[];for(;h=p&&n<=m&&_.push(t)}return _})}}s[c]||(s[c]=u(t=>e)),i=n6(i,{[c]:{$function:{body:e=>s[c](e),args:[`$$CURRENT`]}}},n)}a.push(i)}return Q2(...a)})}var ZRe={locf:`$locf`,linear:`$linearFill`};function QRe(e,t,n){X(!t.sortBy||x2(t.sortBy),`sortBy must be an object.`),X(!!t.sortBy||Object.values(t.output).every(e=>O2(e,`value`)),`sortBy required if any output field specifies a 'method'.`),X(!(t.partitionBy&&t.partitionByFields),`specify either partitionBy or partitionByFields.`),X(!t.partitionByFields||t?.partitionByFields?.every(e=>e[0]!==`$`),`fields in partitionByFields cannot begin with '$'.`),n.context.addExpressionOps({$ifNull:r3}),n.context.addWindowOps({$locf:KRe,$linearFill:GRe});let r=t.partitionBy||t?.partitionByFields?.map(e=>`$`+e),i={},a={};for(let e of Object.keys(t.output)){let n=t.output[e];if(O2(n,`value`)){let t=n;i[e]={$ifNull:[`$$CURRENT.${e}`,t.value]}}else{let t=n,r=ZRe[t.method];X(!!r,`invalid fill method '${t.method}'.`),a[e]={[r]:`$`+e}}}return Object.keys(a).length>0&&(e=XRe(e,{sortBy:t.sortBy||{},partitionBy:r,output:a},n)),Object.keys(i).length>0&&(e=n6(e,i,n)),e}function $Re(e,t,n){let{let:r,foreignField:i,localField:a}=t,o=e=>[!0,[]],s=v2(t.from)?P4(`$lookup`,t.from,n):t.from,{documents:c,pipeline:l}=M4(t.pipeline??[],n);if(X(!s!=!c,"$lookup: must specify single join input with `expr.from` or `expr.pipeline`."),s??=c,X(Z(s),`$lookup: join collection must resolve to an array.`),i&&a){let n=h2.init();for(let e of s)for(let t of D2(I2(e,i)??null)){let r=n.get(t),i=r??[];i.push(e),i!==r&&n.set(t,i)}if(o=e=>{let t=I2(e,a)??null;if(Z(t)){if(l?.length)return[t.some(e=>n.has(e)),[]];let e=Array.from(new Set(M2(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]:o(e).pop()}))}let u=new e4(l??[],n),d=q2.init(n);return e.map(e=>{let i=$(e,r,n);d.update({root:null,variables:i});let[a,c]=o(e);return{...e,[t.as]:a?u.run(s,d):c}})}function eze(e,t,n){let r=P4(`$graphLookup`,t.from,n);X(Z(r),`$graphLookup: expression 'from' must resolve to array`);let{connectFromField:i,connectToField:a,as:o,maxDepth:s,depthField:c,restrictSearchWithMatch:l}=t,u=l?{pipeline:[{$match:l}]}:{};return e.map(e=>{let l={};V2(l,i,$(e,t.startWith,n));let d=[l],f=-1,p=h2.init();do{f++,d=M2($Re(Z2(d),{from:r,localField:i,foreignField:a,as:o,...u},n).map(e=>e[o]).collect());let e=p.size;for(let e of d)p.set(e,p.get(e)??f);if(e==p.size)break}while(Q(s)||fr.test(e))}function nze(e,t,n){let r=P4(`$merge`,t.into,n);X(Z(r),`$merge: expression 'into' must resolve to an array`);let i=t.on||n.idKey,a=v2(i)?e=>i2(I2(e,i)):e=>i2(i.map(t=>I2(e,t))),o=h2.init();for(let e=0;e{let n=a(e);if(o.has(n)){let[i,a]=o.get(n),c=$(i,t.let||{new:`$$ROOT`},s.update({root:e}));if(Z(t.whenMatched))r[a]=new e4(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 a2(`$merge: failed due to matching as specified by 'whenMatched' option.`);case`keepExisting`:break;default:r[a]=P3(i,[i,e],s.update({root:e,variables:c}));break}}else switch(t.whenNotMatched){case`discard`:break;case`fail`:throw new a2(`$merge: failed due to matching as specified by 'whenMatched' option.`);default:r.push(e);break}return e})}function rze(e,t,n){let r=P4(`$out`,t,n);return X(Z(r),`$out: expression must resolve to an array`),e.map(e=>(r.push(A2(e)),e))}function ize(e,t,n){let r=q2.init(n);return e.map(e=>u6(e,t,r.update({root:e})))}function u6(e,t,n){let r=$(e,t,n);switch(r){case`$$KEEP`:return e;case`$$PRUNE`:return;case`$$DESCEND`:{if(!O2(t,`$cond`))return e;let r={};for(let i of Object.keys(e)){let a=e[i];if(Z(a)){let e=[];for(let r of a)x2(r)&&(r=u6(r,t,n.update({root:r}))),Q(r)||e.push(r);r[i]=e}else if(x2(a)){let e=u6(a,t,n.update({root:a}));Q(e)||(r[i]=e)}else r[i]=a}return r}default:return r}}function aze(e,t,n){return e.map(e=>(e=$(e,t.newRoot,n),X(x2(e),`$replaceRoot expression must return an object`),e))}function oze(e,t,n){return e.map(e=>(e=$(e,t,n),X(x2(e),`$replaceWith expression must return an object`),e))}function sze(e,t,n){return e.transform(e=>{let n=e.length,r=-1;return Z2(()=>++r===t.size?{done:!0}:{value:e[Math.floor(Math.random()*n)],done:!1})})}var cze=n6;function lze(e,t,n){return n4(c6(e,{_id:t,count:{$sum:1}},n),{count:-1},n)}function uze(e,t,n){let{coll:r,pipeline:i}=v2(t)||Z(t)?{coll:t}:t,a=v2(r)?P4(`$unionWith`,r,n):r,{documents:o,pipeline:s}=M4(i,n);X(a||o,"$unionWith must specify single collection input with `expr.coll` or `expr.pipeline`.");let c=a??o;return Q2(e,s?new e4(s,n).stream(c):Z2(c))}function dze(e,t,n){t=D2(t);let r={};for(let e of t)r[e]=0;return I4(e,r,n)}function fze(e,t,n){v2(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 Z2(()=>{for(;;){if(s instanceof $2){let e=s.next();if(!e.done)return e}let t=e.next();if(t.done)return t;let n=t.value;if(s=I2(n,r),Z(s)){if(s.length===0&&a===!0)return s=null,H2(n,r),{value:o(n,null),done:!1};s=Z2(s).map(((e,t)=>{let i=L2(n,r,{preserveKeys:!0});return V2(i,r,e),o(i,t)}))}else if(!E2(s)||a===!0)return{value:o(n,null),done:!1}}})}var pze=e({$addFields:()=>n6,$bucket:()=>PRe,$bucketAuto:()=>FRe,$count:()=>BRe,$densify:()=>VRe,$documents:()=>j4,$facet:()=>HRe,$fill:()=>QRe,$graphLookup:()=>eze,$group:()=>c6,$limit:()=>A4,$lookup:()=>$Re,$match:()=>tze,$merge:()=>nze,$out:()=>rze,$project:()=>I4,$redact:()=>ize,$replaceRoot:()=>aze,$replaceWith:()=>oze,$sample:()=>sze,$set:()=>cze,$setWindowFields:()=>XRe,$skip:()=>z4,$sort:()=>n4,$sortByCount:()=>lze,$unionWith:()=>uze,$unset:()=>dze,$unwind:()=>fze}),mze=(e,t,n,r)=>{let i=I2(e,n),a=new V4(t,r);if(!Z(i))return;let o=[];for(let e=0;e0?o:void 0},hze=(e,t,n,r)=>{let i=I2(e,n);return Z(i)?O4(e,Z(t)?[i,...t]:[i,t],r):i},gze=e({$elemMatch:()=>mze,$slice:()=>hze}),_ze=(e,t,n)=>U4(e,t,n,AIe),vze=(e,t,n)=>U4(e,t,n,Q4),yze=(e,t,n)=>U4(e,t,n,jIe),d6=(e,t,n)=>U4(e,t,null,(e,t)=>{let r=0;if(Z(t))for(let e of t)r|=1<d6(e,t,(e,t)=>e==0),xze=(e,t,n)=>d6(e,t,(e,t)=>e==t),Sze=(e,t,n)=>d6(e,t,(e,t)=>ed6(e,t,(e,t)=>e>0),wze=(e,t,n)=>U4(e,t,n,G4),Tze=(e,t,n)=>U4(e,t,n,X4),Eze=(e,t,n)=>U4(e,t,n,Z4),Dze=(e,t,n)=>U4(e,t,n,q4),Oze=(e,t,n)=>U4(e,t,n,J4),kze=(e,t,n)=>U4(e,t,n,Y4),Aze=(e,t,n)=>U4(e,t,n,K4),jze=(e,t,n)=>U4(e,t,n,DIe),Mze=(e,t,n)=>{let r=e.includes(`.`),i=!!t;if(!r||e.match(/\.\d+$/)){let t={pathArray:e.split(`.`)};return n=>I2(n,e,t)!==void 0===i}let a=e.substring(0,e.lastIndexOf(`.`)),o={pathArray:a.split(`.`),preserveIndex:!0};return t=>{let n=I2(L2(t,e,o),a,o);return Z(n)?n.some(e=>e!==void 0)===i:n!==void 0===i}},Nze=(e,t,n)=>U4(e,t,n,NIe);function Pze(e,t,n){return e=>T2($(e,t,n),n.useStrictMode)}function Fze(e,t,n){X(!!n?.jsonSchemaValidator,`$jsonSchema requires 'jsonSchemaValidator' option to be defined.`);let r=n.jsonSchemaValidator(t);return e=>r(e)}var Ize=(e,t,n)=>U4(e,t,n,OIe),Lze=(e,t,n)=>U4(e,t,n,kIe);function Rze(e,t,n){X(n.scriptEnabled,`$where requires 'scriptEnabled' option to be true`);let r=t;return X(aFe(r),`$where only accepts a Function objects`),e=>T2(r.call(e),n?.useStrictMode)}var zze=(e,t,n)=>{X(Z(t),`$and expects value to be an Array.`);let r=t.map(e=>new V4(e,n));return e=>r.every(t=>t.test(e))};function Bze(e,t,n){X(Z(t),`Invalid expression. $or expects value to be an Array`);let r=t.map(e=>new V4(e,n));return e=>r.some(t=>t.test(e))}function Vze(e,t,n){X(Z(t),`Invalid expression. $nor expects value to be an array.`);let r=Bze(`$or`,t,n);return e=>!r(e)}function Hze(e,t,n){let r={};r[e]=W2(t);let i=new V4(r,n);return e=>!i.test(e)}var Uze=e({$all:()=>_ze,$and:()=>zze,$bitsAllClear:()=>bze,$bitsAllSet:()=>xze,$bitsAnyClear:()=>Sze,$bitsAnySet:()=>Cze,$elemMatch:()=>vze,$eq:()=>wze,$exists:()=>Mze,$expr:()=>Pze,$gt:()=>Tze,$gte:()=>Eze,$in:()=>Dze,$jsonSchema:()=>Fze,$lt:()=>Oze,$lte:()=>kze,$mod:()=>Ize,$ne:()=>Aze,$nin:()=>jze,$nor:()=>Vze,$not:()=>Hze,$or:()=>Bze,$regex:()=>Lze,$size:()=>yze,$type:()=>Nze,$where:()=>Rze}),Wze=(e,t,n,r)=>URe(e,t,n,r,!0),Gze=(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=t4([t[0],t[t.length-1]],[o,i],r).filter((([e,t])=>y2(+e)&&y2(+t)));X(s.length===2,`$derivative arguments must resolve to numeric`);let[[c,l],[u,d]]=s,f=(u-c)/m3[a??`millisecond`];return(d-l)/f},Kze=(e,t,n,r)=>n.documentNumber,qze=(e,t,n,r)=>{let{input:i,N:a,alpha:o}=n.inputExpr;return X(!(a&&o),`$expMovingAvg: must provide either 'N' or 'alpha' field.`),X(!a||y2(a)&&a>0,`$expMovingAvg: 'N' must be greater than zero. Got ${a}.`),X(!o||y2(o)&&o>0&&o<1,`$expMovingAvg: 'alpha' must be between 0 and 1 (exclusive), found alpha: ${o}`),o6(t,n,()=>{let e=a==null?o:2/(a+1),n=t4(t,i,r);for(let t=0;te[n.documentNumber-1])},Jze=(e,t,n,r)=>{let{input:i,unit:a}=n.inputExpr,o=t4(t,[`$`+Object.keys(n.parentExpr.sortBy)[0],i],r).filter((([e,t])=>y2(+e)&&y2(+t))),s=o.length;X(t.length===s,`$integral expects an array of numeric values`);let c=0;for(let e=1;eo6(t,n,()=>{let e=n.inputExpr,i=e.min||0,a=e.max||1,o=t4(t,e.input||n.inputExpr,r);X(Z(o)&&o.length>0&&o.every(y2),`$minMaxScaler: input must be a numeric array`);let s=o[0],c=o[0];for(let e of o)ec&&(c=e);let l=a-i,u=c-s;return X(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}),Xze=(e,t,n,r)=>URe(e,t,n,r,!1),Zze=(e,t,n,r)=>{let i=n.inputExpr,a=n.documentNumber-1+i.by;return a<0||a>t.length-1?$(e,i.default,r)??null:$(t[a],i.output,r)},Qze=e({$denseRank:()=>Wze,$derivative:()=>Gze,$documentNumber:()=>Kze,$expMovingAvg:()=>qze,$integral:()=>Jze,$linearFill:()=>GRe,$locf:()=>KRe,$minMaxScaler:()=>Yze,$rank:()=>Xze,$shift:()=>Zze}),$ze=Y2.init({accumulator:OFe,expression:NRe,pipeline:pze,projection:gze,query:Uze,window:Qze}),eBe=e=>Object.assign({...e,context:e?.context?Y2.from($ze,e?.context):$ze}),f6=class extends V4{constructor(e,t){super(e,eBe(t))}},tBe=class extends e4{constructor(e,t){super(e,eBe(t))}},nBe=Object.defineProperty,rBe=Object.getOwnPropertyNames,iBe=(e,t)=>function(){return e&&(t=(0,e[rBe(e)[0]])(e=0)),t},aBe=(e,t)=>{for(var n in t)nBe(e,n,{get:t[n],enumerable:!0})},p6={};aBe(p6,{LocalStoragePersistenceAdapter:()=>oBe});var m6,oBe,h6=iBe({"src/persistence/local-storage-adapter.ts"(){m6=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(){}},m6.SIZE_WARNING_BYTES=4.5*1024*1024,oBe=m6}}),g6={};aBe(g6,{FileSystemPersistenceAdapter:()=>sBe});var sBe,_6=iBe({"src/persistence/file-adapter.ts"(){sBe=class{constructor(e){this.dirty=!1,this.timer=null,this.currentDb=null,this.filePath=e?.path||$d(`.objectstack`,`data`,`memory-driver.json`),this.autoSaveInterval=e?.autoSaveInterval??2e3}async load(){try{if(!Qd(this.filePath))return null;let e=Yd(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,this.filePath+``,JSON.stringify(e,null,2),this.filePath}}}});function v6(e,t){return t.includes(`.`)?t.split(`.`).reduce((e,t)=>e?e[t]:void 0,e):e[t]}var cBe=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||$f({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 f6(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 f6(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 f6(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 f6(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 f6(e).find(r).all())}let i=new Set;for(let e of r){let n=v6(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 tBe(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=v6(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,v6(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=>v6(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)=>te!=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=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=v6(e,i),r=v6(t,i);return n==null&&r==null?0:n==null?1:r==null?-1:nr?a===`desc`?-1:1:0})}return n}projectFields(e,t){let n={};for(let r of t){let t=v6(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(()=>(h6(),p6));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(()=>(_6(),g6));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(()=>(_6(),g6));this.persistenceAdapter=new e}else if(t===`local`){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(h6(),p6));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(()=>(h6(),p6));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(()=>(_6(),g6));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(()=>(_6(),g6));this.persistenceAdapter=new e({path:t.path,autoSaveInterval:t.autoSaveInterval})}else if(t.type===`local`){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(h6(),p6));this.persistenceAdapter=new e({key:t.key})}}this.persistenceAdapter&&this.logger.debug(`Persistence adapter initialized`)}}};cBe.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 lBe=cBe;_6(),h6();var uBe=/(%?)(%([sdijo]))/g;function dBe(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 y6(e,...t){if(t.length===0)return e;let n=0,r=e.replace(uBe,(e,r,i,a)=>{let o=t[n],s=dBe(o,a);return r?e:(n++,s)});return n{if(!e)throw new mBe(t,...n)};b6.as=(e,t,n,...r)=>{if(!t){let t=r.length===0?n:y6(n,...r),i;try{i=Reflect.construct(e,[t])}catch{i=e(t)}throw i}};var hBe=`[MSW]`;function x6(e,...t){return`${hBe} ${y6(e,...t)}`}function gBe(e,...t){console.warn(x6(e,...t))}function _Be(e,...t){console.error(x6(e,...t))}var S6={formatMessage:x6,warn:gBe,error:_Be},C6=class extends Error{constructor(e){super(e),this.name=`InternalError`}},vBe=class{#e;#t;constructor(){this.#e=[],this.#t=new Map}get[Symbol.iterator](){return this.#e[Symbol.iterator].bind(this.#e)}entries(){return this.#t.entries()}get(e){return this.#t.get(e)||[]}getAll(){return this.#e.map(([,e])=>e)}append(e,t){this.#e.push([e,t]),this.#n(e,e=>e.push(t))}prepend(e,t){this.#e.unshift([e,t]),this.#n(e,e=>e.unshift(t))}delete(e,t){if(this.size===0)return;this.#e=this.#e.filter(e=>e[1]!==t);let n=this.#t.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}deleteAll(e){this.size!==0&&(this.#e=this.#e.filter(t=>t[0]!==e),this.#t.delete(e))}get size(){return this.#e.length}clear(){this.size!==0&&(this.#e.length=0,this.#t.clear())}#n(e,t){t(this.#t.get(e)||this.#t.set(e,[]).get(e))}},w6=Symbol(`kDefaultPrevented`),T6=Symbol(`kPropagationStopped`),E6=Symbol(`kImmediatePropagationStopped`),D6=class extends MessageEvent{[w6];[T6];[E6];constructor(...e){super(e[0],e[1]),this[w6]=!1}get defaultPrevented(){return this[w6]}preventDefault(){super.preventDefault(),this[w6]=!0}stopImmediatePropagation(){super.stopImmediatePropagation(),this[E6]=!0}},O6=class{#e;#t;#n;#r;#i;hooks;constructor(){this.#e=new vBe,this.#t=new WeakMap,this.#n=new WeakSet,this.#r=new vBe,this.#i=new WeakMap,this.hooks={on:(e,t,n)=>{if(n?.once){let n=t,r=((...t)=>(this.#r.delete(e,r),n(...t)));t=r}this.#r.append(e,t),n&&this.#i.set(t,n),n?.signal&&n.signal.addEventListener(`abort`,()=>{this.#r.delete(e,t)},{once:!0})},removeListener:(e,t)=>{this.#r.delete(e,t)}}}on(e,t,n){return this.#a(e,t,n),this}once(e,t,n){return this.on(e,t,{...n||{},once:!0})}earlyOn(e,t,n){return this.#a(e,t,n,`prepend`),this}earlyOnce(e,t,n){return this.earlyOn(e,t,{...n||{},once:!0})}emit(e){if(this.#e.size===0)return!1;let t=this.listenerCount(e.type)>0,n=this.#o(e);for(let t of this.#c(e.type)){if(n.event[T6]!=null&&n.event[T6]!==this)return n.revoke(),!1;if(n.event[E6])break;this.#s(n.event,t)}return n.revoke(),t}async emitAsPromise(e){if(this.#e.size===0)return[];let t=[],n=this.#o(e);for(let r of this.#c(e.type)){if(n.event[T6]!=null&&n.event[T6]!==this)return n.revoke(),[];if(n.event[E6])break;let e=await Promise.resolve(this.#s(n.event,r));this.#l(r)||t.push(e)}return n.revoke(),Promise.allSettled(t).then(e=>e.map(e=>e.status===`fulfilled`?e.value:e.reason))}*emitAsGenerator(e){if(this.#e.size===0)return;let t=this.#o(e);for(let n of this.#c(e.type)){if(t.event[T6]!=null&&t.event[T6]!==this){t.revoke();return}if(t.event[E6])break;let e=this.#s(t.event,n);this.#l(n)||(yield e)}t.revoke()}removeListener(e,t){let n=this.#t.get(t);this.#e.delete(e,t);for(let r of this.#r.get(`removeListener`))r(e,t,n)}removeAllListeners(e){if(e==null){this.#e.clear();for(let[e,t]of this.#r)this.#i.get(t)?.persist||this.#r.delete(e,t);return}this.#e.deleteAll(e)}listeners(e){return e==null?this.#e.getAll():this.#e.get(e)}listenerCount(e){return e==null?this.#e.size:this.listeners(e).length}#a(e,t,n,r=`append`){for(let r of this.#r.get(`newListener`))r(e,t,n);e===`*`&&this.#n.add(t),r===`prepend`?this.#e.prepend(e,t):this.#e.append(e,t),n&&(this.#t.set(t,n),n.signal&&n.signal.addEventListener(`abort`,()=>{this.removeListener(e,t)},{once:!0}))}#o(e){let{stopPropagation:t}=e;return e.stopPropagation=()=>{e[T6]=this,t.call(e)},{event:e,revoke(){e.stopPropagation=t}}}#s(e,t){for(let t of this.#r.get(`beforeEmit`))if(t(e)===!1)return;let n=t.call(this,e),r=this.#t.get(t);if(r?.once){let n=this.#l(t)?`*`:e.type;this.#e.delete(n,t);for(let e of this.#r.get(`removeListener`))e(n,t,r)}return n}*#c(e){for(let[t,n]of this.#e)(t===`*`||t===e)&&(yield n)}#l(e){return this.#n.has(e)}};function yBe(e){let t={};for(let n of e)(t[n.kind]||=[]).push(n);return t}var bBe=class{getInitialState(e){b6(this.#e(e),S6.formatMessage(`[MSW] Failed to apply given request handlers: invalid input. Did you forget to spread the request handlers Array?`));let t=yBe(e);return{initialHandlers:t,handlers:{...t}}}currentHandlers(){return Object.values(this.getState().handlers).flat().filter(e=>e!=null)}getHandlersByKind(e){return this.getState().handlers[e]||[]}use(e){if(b6(this.#e(e),S6.formatMessage(`[MSW] Failed to call "use()" with the given request handlers: invalid input. Did you forget to spread the array of request handlers?`)),e.length===0)return;let{handlers:t}=this.getState();for(let n=e.length-1;n>=0;n--){let r=e[n];t[r.kind]=t[r.kind]?[r,...t[r.kind]]:[r]}this.setState({handlers:t})}reset(e){b6(e.length>0?this.#e(e):!0,S6.formatMessage(`Failed to replace initial handlers during reset: invalid handlers. Did you forget to spread the handlers array?`));let{initialHandlers:t}=this.getState();if(e.length===0){this.setState({handlers:{...t}});return}let n=yBe(e);this.setState({initialHandlers:n,handlers:{...n}})}#e(e){return e.every(e=>!Array.isArray(e))}},xBe=class extends bBe{#e;#t;constructor(e){super();let t=this.getInitialState(e);this.#t=t.initialHandlers,this.#e=t.handlers}getState(){return{initialHandlers:this.#t,handlers:this.#e}}setState(e){e.initialHandlers&&(this.#t=e.initialHandlers),e.handlers&&(this.#e=e.handlers)}};function SBe(e){let t=[...e];return Object.freeze(t),t}var CBe=/[/\\]msw[/\\]src[/\\](.+)/,wBe=/(node_modules)?[/\\]lib[/\\](core|browser|node|native|iife)[/\\]|^[^/\\]*$/;function TBe(e){let t=e.stack;if(!t)return;let n=t.split(` +`).slice(1).find(e=>!(CBe.test(e)||wBe.test(e)));if(n)return n.replace(/\s*at [^()]*\(([^)]+)\)/,`$1`).replace(/^@/,``)}function EBe(e){return e?Reflect.has(e,Symbol.iterator)||Reflect.has(e,Symbol.asyncIterator):!1}var DBe=class e{static cache=new WeakMap;kind=`request`;resolver;resolverIterator;resolverIteratorResult;options;info;isUsed;constructor(e){this.resolver=e.resolver,this.options=e.options;let t=TBe(Error());this.info={...e.info,callFrame:t},this.isUsed=!1}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(!EBe(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 OBe(e,t){return e.toLowerCase()===t.toLowerCase()}function kBe(e){return e<300?`#69AB32`:e<400?`#F0BB4B`:`#E95F5D`}function ABe(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 jBe(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 MBe=Object.create,NBe=Object.defineProperty,PBe=Object.getOwnPropertyDescriptor,FBe=Object.getOwnPropertyNames,IBe=Object.getPrototypeOf,LBe=Object.prototype.hasOwnProperty,RBe=(e,t)=>function(){return t||(0,e[FBe(e)[0]])((t={exports:{}}).exports,t),t.exports},zBe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of FBe(t))!LBe.call(e,i)&&i!==n&&NBe(e,i,{get:()=>t[i],enumerable:!(r=PBe(t,i))||r.enumerable});return e},BBe=(e,t,n)=>(n=e==null?{}:MBe(IBe(e)),zBe(t||!e||!e.__esModule?NBe(n,`default`,{value:e,enumerable:!0}):n,e)),VBe=RBe({"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`}}}),HBe=BBe(RBe({"node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js"(e,t){var n=VBe();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),UBe=HBe.default||HBe;UBe.message;var WBe=UBe,{message:GBe}=WBe;async function KBe(e){let t=e.clone(),n=await t.text(),r=t.status||200;return{status:r,statusText:t.statusText||GBe[r]||`OK`,headers:Object.fromEntries(t.headers.entries()),body:n}}function qBe(e){for(var t=[],n=0;n=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-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)?`[^${k6(o)}]+?`:`(?:(?!${k6(n)})[^${k6(o)}])+?`};l)?(?!\?)/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 $Be(e,t,n){var r=e.map(function(e){return nVe(e,t,n).source});return RegExp(`(?:${r.join(`|`)})`,ZBe(n))}function eVe(e,t,n){return tVe(JBe(e,n),t,n)}function tVe(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=`[${k6(p===void 0?``:p)}]|\$`,h=`[${k6(f)}]`,g=o?`^`:``,_=0,v=e;_-1:C===void 0;i||(g+=`(?:${h}(?=${m}))?`),w||(g+=`(?=${h}|${m})`)}return new RegExp(g,ZBe(n))}function nVe(e,t,n){return e instanceof RegExp?QBe(e,t):Array.isArray(e)?$Be(e,t,n):eVe(e,t,n)}function rVe(){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 iVe=class extends Promise{#e;resolve;reject;constructor(e=null){let t=rVe();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}})}},A6=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 iVe}get#e(){return this.handled}async passthrough(){b6.as(A6,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){b6.as(A6,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){b6.as(A6,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 aVe(e){try{return new URL(e),!0}catch{return!1}}function oVe(e,t){let n=Object.getOwnPropertySymbols(t).find(t=>t.description===e);if(n)return Reflect.get(t,n)}var sVe=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:`||!aVe(e))return;let n=oVe(`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{for(var n in t)lVe(e,n,{get:t[n],enumerable:!0})},j6={};uVe(j6,{blue:()=>fVe,gray:()=>M6,green:()=>mVe,red:()=>pVe,yellow:()=>dVe});function dVe(e){return`\x1B[33m${e}\x1B[0m`}function fVe(e){return`\x1B[34m${e}\x1B[0m`}function M6(e){return`\x1B[90m${e}\x1B[0m`}function pVe(e){return`\x1B[31m${e}\x1B[0m`}function mVe(e){return`\x1B[32m${e}\x1B[0m`}var N6=cVe(),hVe=class{constructor(e){this.name=e,this.prefix=`[${this.name}]`;let t=bVe(`DEBUG`),n=bVe(`LOG_LEVEL`);t===`1`||t===`true`||t!==void 0&&this.name.startsWith(t)?(this.debug=F6(n,`debug`)?P6:this.debug,this.info=F6(n,`info`)?P6:this.info,this.success=F6(n,`success`)?P6:this.success,this.warning=F6(n,`warning`)?P6:this.warning,this.error=F6(n,`error`)?P6:this.error):(this.info=P6,this.success=P6,this.warning=P6,this.error=P6,this.only=P6)}prefix;extend(e){return new hVe(`${this.name}:${e}`)}debug(e,...t){this.logEntry({level:`debug`,message:M6(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 gVe;return(e,...t)=>{n.measure(),this.logEntry({level:`info`,message:`${e} ${M6(`${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:j6[s],prefix:j6[c]};this.getWriter(t)([l.timestamp(this.formatTimestamp(o.timestamp))].concat(r==null?[]:l.prefix(r),xVe(n)).join(` `),...a.map(xVe))}formatTimestamp(e){return`${e.toLocaleTimeString(`en-GB`)}:${e.getMilliseconds()}`}getWriter(e){switch(e){case`debug`:case`success`:case`info`:return _Ve;case`warning`:return vVe;case`error`:return yVe}}},gVe=class{startTime;endTime;deltaTime;constructor(){this.startTime=performance.now()}measure(){this.endTime=performance.now(),this.deltaTime=(this.endTime-this.startTime).toFixed(2)}},P6=()=>void 0;function _Ve(e,...t){if(N6){process.stdout.write(y6(e,...t)+` +`);return}console.log(e,...t)}function vVe(e,...t){if(N6){process.stderr.write(y6(e,...t)+` +`);return}console.warn(e,...t)}function yVe(e,...t){if(N6){process.stderr.write(y6(e,...t)+` +`);return}console.error(e,...t)}function bVe(e){return N6?{}[e]:globalThis[e]?.toString()}function F6(e,t){return e!==void 0&&e!==t}function xVe(e){return e===void 0?`undefined`:e===null?`null`:typeof e==`string`?e:typeof e==`object`?JSON.stringify(e):e.toString()}var SVe=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`}},CVe=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=CVe.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 SVe(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)}},wVe=CVe;wVe.defaultMaxListeners=10;function TVe(e){return globalThis[e]||void 0}function EVe(e,t){globalThis[e]=t}function DVe(e){delete globalThis[e]}var I6=function(e){return e.INACTIVE=`INACTIVE`,e.APPLYING=`APPLYING`,e.APPLIED=`APPLIED`,e.DISPOSING=`DISPOSING`,e.DISPOSED=`DISPOSED`,e}({}),OVe=class{constructor(e){this.symbol=e,this.readyState=I6.INACTIVE,this.emitter=new wVe,this.subscriptions=[],this.logger=new hVe(e.description),this.emitter.setMaxListeners(0),this.logger.info(`constructing the interceptor...`)}checkEnvironment(){return!0}apply(){let e=this.logger.extend(`apply`);if(e.info(`applying the interceptor...`),this.readyState===I6.APPLIED){e.info(`intercepted already applied!`);return}if(!this.checkEnvironment()){e.info(`the interceptor cannot be applied in this environment!`);return}this.readyState=I6.APPLYING;let t=this.getInstance();if(t){e.info(`found a running instance, reusing...`),this.on=(n,r)=>(e.info(`proxying the "%s" listener`,n),t.emitter.addListener(n,r),this.subscriptions.push(()=>{t.emitter.removeListener(n,r),e.info(`removed proxied "%s" listener!`,n)}),this),this.readyState=I6.APPLIED;return}e.info(`no running instance found, setting up a new instance...`),this.setup(),this.setInstance(),this.readyState=I6.APPLIED}setup(){}on(e,t){let n=this.logger.extend(`on`);return this.readyState===I6.DISPOSING||this.readyState===I6.DISPOSED?(n.info(`cannot listen to events, already disposed!`),this):(n.info(`adding "%s" event listener:`,e,t),this.emitter.on(e,t),this)}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}removeAllListeners(e){return this.emitter.removeAllListeners(e),this}dispose(){let e=this.logger.extend(`dispose`);if(this.readyState===I6.DISPOSED){e.info(`cannot dispose, already disposed!`);return}if(e.info(`disposing the interceptor...`),this.readyState=I6.DISPOSING,!this.getInstance()){e.info(`no interceptors running, skipping dispose...`);return}if(this.clearInstance(),e.info(`global symbol deleted:`,TVe(this.symbol)),this.subscriptions.length>0){e.info(`disposing of %d subscriptions...`,this.subscriptions.length);for(let e of this.subscriptions)e();this.subscriptions=[],e.info(`disposed of all subscriptions!`,this.subscriptions.length)}this.emitter.removeAllListeners(),e.info(`destroyed the listener!`),this.readyState=I6.DISPOSED}getInstance(){let e=TVe(this.symbol);return this.logger.info(`retrieved global instance:`,e?.constructor?.name),e}setInstance(){EVe(this.symbol,this),this.logger.info(`set global instance!`,this.symbol.description)}clearInstance(){DVe(this.symbol),this.logger.info(`cleared global instance!`,this.symbol.description)}};function kVe(){return Math.random().toString(16).slice(2)}new TextEncoder;var AVe=class e extends OVe{constructor(t){e.symbol=Symbol(t.name),super(e.symbol),this.interceptors=t.interceptors}setup(){let e=this.logger.extend(`setup`);e.info(`applying all %d interceptors...`,this.interceptors.length);for(let t of this.interceptors)e.info(`applying "%s" interceptor...`,t.constructor.name),t.apply(),e.info(`adding interceptor dispose subscription`),this.subscriptions.push(()=>t.dispose())}on(e,t){for(let n of this.interceptors)n.on(e,t);return this}once(e,t){for(let n of this.interceptors)n.once(e,t);return this}off(e,t){for(let n of this.interceptors)n.off(e,t);return this}removeAllListeners(e){for(let t of this.interceptors)t.removeAllListeners(e);return this}};function jVe(e,t=!0){return[t&&e.origin,e.pathname].filter(Boolean).join(``)}var MVe=/[?|#].*$/g;function NVe(e){return e.endsWith(`?`)?e:e.replace(MVe,``)}function PVe(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function FVe(e,t){if(PVe(e)||e.startsWith(`*`))return e;let n=t||typeof location<`u`&&location.href;return n?decodeURI(new URL(encodeURI(e),n).href):e}function IVe(e,t){return e instanceof RegExp?e:NVe(FVe(e,t))}function LVe(e){return e.replace(/([:a-zA-Z_-]*)(\*{1,2})+/g,(e,t,n)=>{let r=`(.*)`;return t?t.startsWith(`:`)?`${t}${n}`:`${t}${r}`:r}).replace(/([^/])(:)(?=(?:\d+|\(\.\*\))(?=\/|$))/,`$1\\$2`).replace(/^([^/]+)(:)(?=\/\/)/,`$1\\$2`)}function RVe(e,t,n){let r=IVe(t,n),i=typeof r==`string`?LVe(r):r,a=jVe(e),o=YBe(i,{decode:decodeURIComponent})(a),s=o&&o.params||{};return{matches:o!==!1,params:s}}function zVe(e){let t=e instanceof URL?e:new URL(e);return typeof location<`u`&&t.origin===location.origin?t.pathname:t.origin+t.pathname}var BVe=Object.create,VVe=Object.defineProperty,HVe=Object.getOwnPropertyDescriptor,UVe=Object.getOwnPropertyNames,WVe=Object.getPrototypeOf,GVe=Object.prototype.hasOwnProperty,KVe=(e,t)=>function(){return t||(0,e[UVe(e)[0]])((t={exports:{}}).exports,t),t.exports},qVe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of UVe(t))!GVe.call(e,i)&&i!==n&&VVe(e,i,{get:()=>t[i],enumerable:!(r=HVe(t,i))||r.enumerable});return e},JVe=((e,t,n)=>(n=e==null?{}:BVe(WVe(e)),qVe(t||!e||!e.__esModule?VVe(n,`default`,{value:e,enumerable:!0}):n,e)))(KVe({"node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(e){Object.defineProperty(e,`__esModule`,{value:!0}),e.parse=s,e.serialize=u;var t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,n=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,a=Object.prototype.toString,o=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function s(e,t){let n=new o,r=e.length;if(r<2)return n;let i=t?.decode||d,a=0;do{let t=e.indexOf(`=`,a);if(t===-1)break;let o=e.indexOf(`;`,a),s=o===-1?r:o;if(t>s){a=e.lastIndexOf(`;`,t-1)+1;continue}let u=c(e,a,t),d=l(e,t,u),f=e.slice(u,d);if(n[f]===void 0){let r=c(e,t+1,s),a=l(e,s,r);n[f]=i(e.slice(r,a))}a=s+1}while(an;){let n=e.charCodeAt(--t);if(n!==32&&n!==9)return t+1}return n}function u(e,a,o){let s=o?.encode||encodeURIComponent;if(!t.test(e))throw TypeError(`argument name is invalid: ${e}`);let c=s(a);if(!n.test(c))throw TypeError(`argument val is invalid: ${a}`);let l=e+`=`+c;if(!o)return l;if(o.maxAge!==void 0){if(!Number.isInteger(o.maxAge))throw TypeError(`option maxAge is invalid: ${o.maxAge}`);l+=`; Max-Age=`+o.maxAge}if(o.domain){if(!r.test(o.domain))throw TypeError(`option domain is invalid: ${o.domain}`);l+=`; Domain=`+o.domain}if(o.path){if(!i.test(o.path))throw TypeError(`option path is invalid: ${o.path}`);l+=`; Path=`+o.path}if(o.expires){if(!f(o.expires)||!Number.isFinite(o.expires.valueOf()))throw TypeError(`option expires is invalid: ${o.expires}`);l+=`; Expires=`+o.expires.toUTCString()}if(o.httpOnly&&(l+=`; HttpOnly`),o.secure&&(l+=`; Secure`),o.partitioned&&(l+=`; Partitioned`),o.priority)switch(typeof o.priority==`string`?o.priority.toLowerCase():void 0){case`low`:l+=`; Priority=Low`;break;case`medium`:l+=`; Priority=Medium`;break;case`high`:l+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid: ${o.priority}`)}if(o.sameSite)switch(typeof o.sameSite==`string`?o.sameSite.toLowerCase():o.sameSite){case!0:case`strict`:l+=`; SameSite=Strict`;break;case`lax`:l+=`; SameSite=Lax`;break;case`none`:l+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid: ${o.sameSite}`)}return l}function d(e){if(e.indexOf(`%`)===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function f(e){return a.call(e)===`[object Date]`}}})(),1),YVe=JVe.default||JVe,XVe=YVe.parse,ZVe=YVe.serialize;function QVe(e,t){return e.endsWith(t)?e.length===t.length||e[e.length-t.length-1]===`.`:!1}function $Ve(e,t){let n=e.length-t.length-2,r=e.lastIndexOf(`.`,n);return r===-1?e:e.slice(r+1)}function eHe(e,t,n){if(n.validHosts!==null){let e=n.validHosts;for(let n of e)if(QVe(t,n))return n}let r=0;if(t.startsWith(`.`))for(;rn+1&&e.charCodeAt(r-1)<=32;)--r;if(e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47)n+=2;else{let t=e.indexOf(`:/`,n);if(t!==-1){let r=t-n,i=e.charCodeAt(n),a=e.charCodeAt(n+1),o=e.charCodeAt(n+2),s=e.charCodeAt(n+3),c=e.charCodeAt(n+4);if(!(r===5&&i===104&&a===116&&o===116&&s===112&&c===115)&&!(r===4&&i===104&&a===116&&o===116&&s===112)&&!(r===3&&i===119&&a===115&&o===115)&&!(r===2&&i===119&&a===115))for(let r=n;r=97&&t<=122||t>=48&&t<=57||t===46||t===45||t===43))return null}for(n=t+2;e.charCodeAt(n)===47;)n+=1}}let t=-1,a=-1,o=-1;for(let s=n;s=65&&n<=90&&(i=!0)}if(t!==-1&&t>n&&tn&&on+1&&e.charCodeAt(r-1)===46;)--r;let a=n!==0||r!==e.length?e.slice(n,r):e;return i?a.toLowerCase():a}function rHe(e){if(e.length<7||e.length>15)return!1;let t=0;for(let n=0;n57)return!1}return t===3&&e.charCodeAt(0)!==46&&e.charCodeAt(e.length-1)!==46}function iHe(e){if(e.length<3)return!1;let t=+!!e.startsWith(`[`),n=e.length;if(e[n-1]===`]`&&--n,n-t>39)return!1;let r=!1;for(;t=48&&n<=57||n>=97&&n<=102||n>=65&&n<=90))return!1}return r}function aHe(e){return iHe(e)||rHe(e)}function oHe(e){return e>=97&&e<=122||e>=48&&e<=57||e>127}function sHe(e){if(e.length>255||e.length===0||!oHe(e.charCodeAt(0))&&e.charCodeAt(0)!==46&&e.charCodeAt(0)!==95)return!1;let t=-1,n=-1,r=e.length;for(let i=0;i64||n===46||n===45||n===95)return!1;t=i}else if(!(oHe(r)||r===45||r===95))return!1;n=r}return r-t-1<=63&&n!==45}function cHe({allowIcannDomains:e=!0,allowPrivateDomains:t=!1,detectIp:n=!0,extractHostname:r=!0,mixedInputs:i=!0,validHosts:a=null,validateHostname:o=!0}){return{allowIcannDomains:e,allowPrivateDomains:t,detectIp:n,extractHostname:r,mixedInputs:i,validHosts:a,validateHostname:o}}var lHe=cHe({});function uHe(e){return e===void 0?lHe:cHe(e)}function dHe(e,t){return t.length===e.length?``:e.slice(0,-t.length-1)}function fHe(){return{domain:null,domainWithoutSuffix:null,hostname:null,isIcann:null,isIp:null,isPrivate:null,publicSuffix:null,subdomain:null}}function pHe(e){e.domain=null,e.domainWithoutSuffix=null,e.hostname=null,e.isIcann=null,e.isIp=null,e.isPrivate=null,e.publicSuffix=null,e.subdomain=null}function mHe(e,t,n,r,i){let a=uHe(r);return typeof e!=`string`||(a.extractHostname?a.mixedInputs?i.hostname=nHe(e,sHe(e)):i.hostname=nHe(e,!1):i.hostname=e,a.detectIp&&i.hostname!==null&&(i.isIp=aHe(i.hostname),i.isIp))?i:a.validateHostname&&a.extractHostname&&i.hostname!==null&&!sHe(i.hostname)?(i.hostname=null,i):(t===0||i.hostname===null||(n(i.hostname,a,i),t===2||i.publicSuffix===null)||(i.domain=eHe(i.publicSuffix,i.hostname,a),t===3||i.domain===null)||(i.subdomain=dHe(i.hostname,i.domain),t===4)||(i.domainWithoutSuffix=tHe(i.domain,i.publicSuffix)),i)}function hHe(e,t,n){if(!t.allowPrivateDomains&&e.length>3){let t=e.length-1,r=e.charCodeAt(t),i=e.charCodeAt(t-1),a=e.charCodeAt(t-2),o=e.charCodeAt(t-3);if(r===109&&i===111&&a===99&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`com`,!0;if(r===103&&i===114&&a===111&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`org`,!0;if(r===117&&i===100&&a===101&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`edu`,!0;if(r===118&&i===111&&a===103&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`gov`,!0;if(r===116&&i===101&&a===110&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`net`,!0;if(r===101&&i===100&&a===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`de`,!0}return!1}var gHe=(function(){let e=[1,{}],t=[0,{city:e}];return[0,{ck:[0,{www:e}],jp:[0,{kawasaki:t,kitakyushu:t,kobe:t,nagoya:t,sapporo:t,sendai:t,yokohama:t}]}]})(),_He=(function(){let e=[1,{}],t=[2,{}],n=[1,{com:e,edu:e,gov:e,net:e,org:e}],r=[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e}],i=[0,{"*":t}],a=[2,{s:i}],o=[0,{relay:t}],s=[2,{id:t}],c=[1,{gov:e}],l=[0,{airflow:i,"lambda-url":t,"transfer-webapp":t}],u=[0,{airflow:i,"transfer-webapp":t}],d=[0,{"transfer-webapp":t}],f=[0,{"transfer-webapp":t,"transfer-webapp-fips":t}],p=[0,{notebook:t,studio:t}],m=[0,{labeling:t,notebook:t,studio:t}],h=[0,{notebook:t}],g=[0,{labeling:t,notebook:t,"notebook-fips":t,studio:t}],_=[0,{notebook:t,"notebook-fips":t,studio:t,"studio-fips":t}],v=[0,{shop:t}],y=[0,{"*":e}],b=[1,{co:t}],x=[0,{objects:t}],S=[2,{"eu-west-1":t,"us-east-1":t}],C=[2,{nodes:t}],w=[0,{my:t}],T=[0,{s3:t,"s3-accesspoint":t,"s3-website":t}],E=[0,{s3:t,"s3-accesspoint":t}],D=[0,{direct:t}],O=[0,{"webview-assets":t}],ee=[0,{vfs:t,"webview-assets":t}],te=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t,"aws-cloud9":O,cloud9:ee}],k=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:E,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t,"aws-cloud9":O,cloud9:ee}],A=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t,"analytics-gateway":t,"aws-cloud9":O,cloud9:ee}],j=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t}],M=[0,{s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-fips":t,"s3-website":t}],N=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:M,s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-fips":t,"s3-object-lambda":t,"s3-website":t,"aws-cloud9":O,cloud9:ee}],P=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:M,s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-fips":t,"s3-object-lambda":t,"s3-website":t}],F=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:M,s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-deprecated":t,"s3-fips":t,"s3-object-lambda":t,"s3-website":t,"analytics-gateway":t,"aws-cloud9":O,cloud9:ee}],I=[0,{auth:t}],ne=[0,{auth:t,"auth-fips":t}],re=[0,{"auth-fips":t}],ie=[0,{apps:t}],ae=[0,{paas:t}],oe=[2,{eu:t}],se=[0,{app:t}],ce=[0,{site:t}],le=[1,{com:e,edu:e,net:e,org:e}],L=[0,{j:t}],ue=[0,{dyn:t}],de=[2,{web:t}],fe=[1,{co:e,com:e,edu:e,gov:e,net:e,org:e}],pe=[0,{p:t}],me=[0,{user:t}],he=[1,{ms:t}],ge=[0,{cdn:t}],_e=[2,{raw:i}],ve=[0,{cust:t,reservd:t}],ye=[0,{cust:t}],be=[0,{s3:t}],xe=[1,{biz:e,com:e,edu:e,gov:e,info:e,net:e,org:e}],Se=[0,{ipfs:t}],Ce=[1,{framer:t}],we=[0,{forgot:t}],Te=[0,{core:[0,{blob:t,file:t,web:t}],servicebus:t}],Ee=[1,{gs:e}],De=[0,{nes:e}],Oe=[1,{k12:e,cc:e,lib:e}],ke=[1,{cc:e}],Ae=[1,{cc:e,lib:e}];return[0,{ac:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,drr:t,feedback:t,forms:t}],ad:e,ae:[1,{ac:e,co:e,gov:e,mil:e,net:e,org:e,sch:e}],aero:[1,{airline:e,airport:e,"accident-investigation":e,"accident-prevention":e,aerobatic:e,aeroclub:e,aerodrome:e,agents:e,"air-surveillance":e,"air-traffic-control":e,aircraft:e,airtraffic:e,ambulance:e,association:e,author:e,ballooning:e,broker:e,caa:e,cargo:e,catering:e,certification:e,championship:e,charter:e,civilaviation:e,club:e,conference:e,consultant:e,consulting:e,control:e,council:e,crew:e,design:e,dgca:e,educator:e,emergency:e,engine:e,engineer:e,entertainment:e,equipment:e,exchange:e,express:e,federation:e,flight:e,freight:e,fuel:e,gliding:e,government:e,groundhandling:e,group:e,hanggliding:e,homebuilt:e,insurance:e,journal:e,journalist:e,leasing:e,logistics:e,magazine:e,maintenance:e,marketplace:e,media:e,microlight:e,modelling:e,navigation:e,parachuting:e,paragliding:e,"passenger-association":e,pilot:e,press:e,production:e,recreation:e,repbody:e,res:e,research:e,rotorcraft:e,safety:e,scientist:e,services:e,show:e,skydiving:e,software:e,student:e,taxi:e,trader:e,trading:e,trainer:e,union:e,workinggroup:e,works:e}],af:n,ag:[1,{co:e,com:e,net:e,nom:e,org:e,obj:t}],ai:[1,{com:e,net:e,off:e,org:e,uwu:t,framer:t,kiloapps:t}],al:r,am:[1,{co:e,com:e,commune:e,net:e,org:e,radio:t}],ao:[1,{co:e,ed:e,edu:e,gov:e,gv:e,it:e,og:e,org:e,pb:e}],aq:e,ar:[1,{bet:e,com:e,coop:e,edu:e,gob:e,gov:e,int:e,mil:e,musica:e,mutual:e,net:e,org:e,seg:e,senasa:e,tur:e}],arpa:[1,{e164:e,home:e,"in-addr":e,ip6:e,iris:e,uri:e,urn:e}],as:c,asia:[1,{cloudns:t,daemon:t,dix:t}],at:[1,{4:t,ac:[1,{sth:e}],co:e,gv:e,or:e,funkfeuer:[0,{wien:t}],futurecms:[0,{"*":t,ex:i,in:i}],futurehosting:t,futuremailing:t,ortsinfo:[0,{ex:i,kunden:i}],biz:t,info:t,"123webseite":t,priv:t,my:t,myspreadshop:t,"12hp":t,"2ix":t,"4lima":t,"lima-city":t}],au:[1,{asn:e,com:[1,{cloudlets:[0,{mel:t}],myspreadshop:t}],edu:[1,{act:e,catholic:e,nsw:e,nt:e,qld:e,sa:e,tas:e,vic:e,wa:e}],gov:[1,{qld:e,sa:e,tas:e,vic:e,wa:e}],id:e,net:e,org:e,conf:e,oz:e,act:e,nsw:e,nt:e,qld:e,sa:e,tas:e,vic:e,wa:e,hrsn:[0,{vps:t}]}],aw:[1,{com:e}],ax:e,az:[1,{biz:e,co:e,com:e,edu:e,gov:e,info:e,int:e,mil:e,name:e,net:e,org:e,pp:e,pro:e}],ba:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,brendly:v,rs:t}],bb:[1,{biz:e,co:e,com:e,edu:e,gov:e,info:e,net:e,org:e,store:e,tv:e}],bd:[1,{ac:e,ai:e,co:e,com:e,edu:e,gov:e,id:e,info:e,it:e,mil:e,net:e,org:e,sch:e,tv:e}],be:[1,{ac:e,cloudns:t,webhosting:t,interhostsolutions:[0,{cloud:t}],kuleuven:[0,{ezproxy:t}],my:t,"123website":t,myspreadshop:t,transurl:i}],bf:c,bg:[1,{0:e,1:e,2:e,3:e,4:e,5:e,6:e,7:e,8:e,9:e,a:e,b:e,c:e,d:e,e,f:e,g:e,h:e,i:e,j:e,k:e,l:e,m:e,n:e,o:e,p:e,q:e,r:e,s:e,t:e,u:e,v:e,w:e,x:e,y:e,z:e,barsy:t}],bh:n,bi:[1,{co:e,com:e,edu:e,or:e,org:e}],biz:[1,{activetrail:t,"cloud-ip":t,cloudns:t,jozi:t,dyndns:t,"for-better":t,"for-more":t,"for-some":t,"for-the":t,selfip:t,webhop:t,orx:t,mmafan:t,myftp:t,"no-ip":t,dscloud:t}],bj:[1,{africa:e,agro:e,architectes:e,assur:e,avocats:e,co:e,com:e,eco:e,econo:e,edu:e,info:e,loisirs:e,money:e,net:e,org:e,ote:e,restaurant:e,resto:e,tourism:e,univ:e}],bm:n,bn:[1,{com:e,edu:e,gov:e,net:e,org:e,co:t}],bo:[1,{com:e,edu:e,gob:e,int:e,mil:e,net:e,org:e,tv:e,web:e,academia:e,agro:e,arte:e,blog:e,bolivia:e,ciencia:e,cooperativa:e,democracia:e,deporte:e,ecologia:e,economia:e,empresa:e,indigena:e,industria:e,info:e,medicina:e,movimiento:e,musica:e,natural:e,nombre:e,noticias:e,patria:e,plurinacional:e,politica:e,profesional:e,pueblo:e,revista:e,salud:e,tecnologia:e,tksat:e,transporte:e,wiki:e}],br:[1,{"9guacu":e,abc:e,adm:e,adv:e,agr:e,aju:e,am:e,anani:e,aparecida:e,api:e,app:e,arq:e,art:e,ato:e,b:e,barueri:e,belem:e,bet:e,bhz:e,bib:e,bio:e,blog:e,bmd:e,boavista:e,bsb:e,campinagrande:e,campinas:e,caxias:e,cim:e,cng:e,cnt:e,com:[1,{simplesite:t}],contagem:e,coop:e,coz:e,cri:e,cuiaba:e,curitiba:e,def:e,des:e,det:e,dev:e,ecn:e,eco:e,edu:e,emp:e,enf:e,eng:e,esp:e,etc:e,eti:e,far:e,feira:e,flog:e,floripa:e,fm:e,fnd:e,fortal:e,fot:e,foz:e,fst:e,g12:e,geo:e,ggf:e,goiania:e,gov:[1,{ac:e,al:e,am:e,ap:e,ba:e,ce:e,df:e,es:e,go:e,ma:e,mg:e,ms:e,mt:e,pa:e,pb:e,pe:e,pi:e,pr:e,rj:e,rn:e,ro:e,rr:e,rs:e,sc:e,se:e,sp:e,to:e}],gru:e,ia:e,imb:e,ind:e,inf:e,jab:e,jampa:e,jdf:e,joinville:e,jor:e,jus:e,leg:[1,{ac:t,al:t,am:t,ap:t,ba:t,ce:t,df:t,es:t,go:t,ma:t,mg:t,ms:t,mt:t,pa:t,pb:t,pe:t,pi:t,pr:t,rj:t,rn:t,ro:t,rr:t,rs:t,sc:t,se:t,sp:t,to:t}],leilao:e,lel:e,log:e,londrina:e,macapa:e,maceio:e,manaus:e,maringa:e,mat:e,med:e,mil:e,morena:e,mp:e,mus:e,natal:e,net:e,niteroi:e,nom:y,not:e,ntr:e,odo:e,ong:e,org:e,osasco:e,palmas:e,poa:e,ppg:e,pro:e,psc:e,psi:e,pvh:e,qsl:e,radio:e,rec:e,recife:e,rep:e,ribeirao:e,rio:e,riobranco:e,riopreto:e,salvador:e,sampa:e,santamaria:e,santoandre:e,saobernardo:e,saogonca:e,seg:e,sjc:e,slg:e,slz:e,social:e,sorocaba:e,srv:e,taxi:e,tc:e,tec:e,teo:e,the:e,tmp:e,trd:e,tur:e,tv:e,udi:e,vet:e,vix:e,vlog:e,wiki:e,xyz:e,zlg:e,tche:t}],bs:[1,{com:e,edu:e,gov:e,net:e,org:e,we:t}],bt:n,bv:e,bw:[1,{ac:e,co:e,gov:e,net:e,org:e}],by:[1,{gov:e,mil:e,com:e,of:e,mediatech:t}],bz:[1,{co:e,com:e,edu:e,gov:e,net:e,org:e,za:t,mydns:t,gsj:t}],ca:[1,{ab:e,bc:e,mb:e,nb:e,nf:e,nl:e,ns:e,nt:e,nu:e,on:e,pe:e,qc:e,sk:e,yk:e,gc:e,barsy:t,awdev:i,co:t,"no-ip":t,onid:t,myspreadshop:t,box:t}],cat:e,cc:[1,{cleverapps:t,"cloud-ip":t,cloudns:t,ccwu:t,ftpaccess:t,"game-server":t,myphotos:t,scrapping:t,twmail:t,csx:t,fantasyleague:t,spawn:[0,{instances:t}],ec:t,eu:t,gu:t,uk:t,us:t}],cd:[1,{gov:e,cc:t}],cf:e,cg:e,ch:[1,{square7:t,cloudns:t,cloudscale:[0,{cust:t,lpg:x,rma:x}],objectstorage:[0,{lpg:t,rma:t}],flow:[0,{ae:[0,{alp1:t}],appengine:t}],"linkyard-cloud":t,gotdns:t,dnsking:t,"123website":t,myspreadshop:t,firenet:[0,{"*":t,svc:i}],"12hp":t,"2ix":t,"4lima":t,"lima-city":t}],ci:[1,{ac:e,"xn--aroport-bya":e,aéroport:e,asso:e,co:e,com:e,ed:e,edu:e,go:e,gouv:e,int:e,net:e,or:e,org:e,us:t}],ck:y,cl:[1,{co:e,gob:e,gov:e,mil:e,cloudns:t}],cm:[1,{co:e,com:e,gov:e,net:e}],cn:[1,{ac:e,com:[1,{amazonaws:[0,{"cn-north-1":[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,rds:i,dualstack:T,s3:t,"s3-accesspoint":t,"s3-deprecated":t,"s3-object-lambda":t,"s3-website":t}],"cn-northwest-1":[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,rds:i,dualstack:E,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t}],compute:i,airflow:[0,{"cn-north-1":i,"cn-northwest-1":i}],eb:[0,{"cn-north-1":t,"cn-northwest-1":t}],elb:i}],amazonwebservices:[0,{on:[0,{"cn-north-1":u,"cn-northwest-1":u}]}],sagemaker:[0,{"cn-north-1":p,"cn-northwest-1":p}]}],edu:e,gov:e,mil:e,net:e,org:e,"xn--55qx5d":e,公司:e,"xn--od0alg":e,網絡:e,"xn--io0a7i":e,网络:e,ah:e,bj:e,cq:e,fj:e,gd:e,gs:e,gx:e,gz:e,ha:e,hb:e,he:e,hi:e,hk:e,hl:e,hn:e,jl:e,js:e,jx:e,ln:e,mo:e,nm:e,nx:e,qh:e,sc:e,sd:e,sh:[1,{as:t}],sn:e,sx:e,tj:e,tw:e,xj:e,xz:e,yn:e,zj:e,"canva-apps":t,canvasite:w,myqnapcloud:t,quickconnect:D}],co:[1,{com:e,edu:e,gov:e,mil:e,net:e,nom:e,org:e,carrd:t,crd:t,otap:i,hidns:t,leadpages:t,lpages:t,mypi:t,xmit:i,rdpa:[0,{clusters:i,srvrless:i}],firewalledreplit:s,repl:s,supabase:[2,{realtime:t,storage:t}],umso:t}],com:[1,{a2hosted:t,cpserver:t,adobeaemcloud:[2,{dev:i}],africa:t,auiusercontent:i,aivencloud:t,alibabacloudcs:t,kasserver:t,amazonaws:[0,{"af-south-1":te,"ap-east-1":k,"ap-northeast-1":A,"ap-northeast-2":A,"ap-northeast-3":te,"ap-south-1":A,"ap-south-2":j,"ap-southeast-1":A,"ap-southeast-2":A,"ap-southeast-3":j,"ap-southeast-4":j,"ap-southeast-5":[0,{"execute-api":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-deprecated":t,"s3-object-lambda":t,"s3-website":t}],"ca-central-1":N,"ca-west-1":P,"eu-central-1":A,"eu-central-2":j,"eu-north-1":k,"eu-south-1":te,"eu-south-2":j,"eu-west-1":[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-deprecated":t,"s3-object-lambda":t,"s3-website":t,"analytics-gateway":t,"aws-cloud9":O,cloud9:ee}],"eu-west-2":k,"eu-west-3":te,"il-central-1":[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t,"aws-cloud9":O,cloud9:[0,{vfs:t}]}],"me-central-1":j,"me-south-1":k,"sa-east-1":te,"us-east-1":[2,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:M,s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-deprecated":t,"s3-fips":t,"s3-object-lambda":t,"s3-website":t,"analytics-gateway":t,"aws-cloud9":O,cloud9:ee}],"us-east-2":F,"us-gov-east-1":P,"us-gov-west-1":P,"us-west-1":N,"us-west-2":F,compute:i,"compute-1":i,airflow:[0,{"af-south-1":i,"ap-east-1":i,"ap-northeast-1":i,"ap-northeast-2":i,"ap-northeast-3":i,"ap-south-1":i,"ap-south-2":i,"ap-southeast-1":i,"ap-southeast-2":i,"ap-southeast-3":i,"ap-southeast-4":i,"ap-southeast-5":i,"ap-southeast-7":i,"ca-central-1":i,"ca-west-1":i,"eu-central-1":i,"eu-central-2":i,"eu-north-1":i,"eu-south-1":i,"eu-south-2":i,"eu-west-1":i,"eu-west-2":i,"eu-west-3":i,"il-central-1":i,"me-central-1":i,"me-south-1":i,"sa-east-1":i,"us-east-1":i,"us-east-2":i,"us-west-1":i,"us-west-2":i}],rds:[0,{"af-south-1":i,"ap-east-1":i,"ap-east-2":i,"ap-northeast-1":i,"ap-northeast-2":i,"ap-northeast-3":i,"ap-south-1":i,"ap-south-2":i,"ap-southeast-1":i,"ap-southeast-2":i,"ap-southeast-3":i,"ap-southeast-4":i,"ap-southeast-5":i,"ap-southeast-6":i,"ap-southeast-7":i,"ca-central-1":i,"ca-west-1":i,"eu-central-1":i,"eu-central-2":i,"eu-west-1":i,"eu-west-2":i,"eu-west-3":i,"il-central-1":i,"me-central-1":i,"me-south-1":i,"mx-central-1":i,"sa-east-1":i,"us-east-1":i,"us-east-2":i,"us-gov-east-1":i,"us-gov-west-1":i,"us-northeast-1":i,"us-west-1":i,"us-west-2":i}],s3:t,"s3-1":t,"s3-ap-east-1":t,"s3-ap-northeast-1":t,"s3-ap-northeast-2":t,"s3-ap-northeast-3":t,"s3-ap-south-1":t,"s3-ap-southeast-1":t,"s3-ap-southeast-2":t,"s3-ca-central-1":t,"s3-eu-central-1":t,"s3-eu-north-1":t,"s3-eu-west-1":t,"s3-eu-west-2":t,"s3-eu-west-3":t,"s3-external-1":t,"s3-fips-us-gov-east-1":t,"s3-fips-us-gov-west-1":t,"s3-global":[0,{accesspoint:[0,{mrap:t}]}],"s3-me-south-1":t,"s3-sa-east-1":t,"s3-us-east-2":t,"s3-us-gov-east-1":t,"s3-us-gov-west-1":t,"s3-us-west-1":t,"s3-us-west-2":t,"s3-website-ap-northeast-1":t,"s3-website-ap-southeast-1":t,"s3-website-ap-southeast-2":t,"s3-website-eu-west-1":t,"s3-website-sa-east-1":t,"s3-website-us-east-1":t,"s3-website-us-gov-west-1":t,"s3-website-us-west-1":t,"s3-website-us-west-2":t,elb:i}],amazoncognito:[0,{"af-south-1":I,"ap-east-1":I,"ap-northeast-1":I,"ap-northeast-2":I,"ap-northeast-3":I,"ap-south-1":I,"ap-south-2":I,"ap-southeast-1":I,"ap-southeast-2":I,"ap-southeast-3":I,"ap-southeast-4":I,"ap-southeast-5":I,"ap-southeast-7":I,"ca-central-1":I,"ca-west-1":I,"eu-central-1":I,"eu-central-2":I,"eu-north-1":I,"eu-south-1":I,"eu-south-2":I,"eu-west-1":I,"eu-west-2":I,"eu-west-3":I,"il-central-1":I,"me-central-1":I,"me-south-1":I,"mx-central-1":I,"sa-east-1":I,"us-east-1":ne,"us-east-2":ne,"us-gov-east-1":re,"us-gov-west-1":re,"us-west-1":ne,"us-west-2":ne}],amplifyapp:t,awsapprunner:i,awsapps:t,elasticbeanstalk:[2,{"af-south-1":t,"ap-east-1":t,"ap-northeast-1":t,"ap-northeast-2":t,"ap-northeast-3":t,"ap-south-1":t,"ap-southeast-1":t,"ap-southeast-2":t,"ap-southeast-3":t,"ap-southeast-5":t,"ap-southeast-7":t,"ca-central-1":t,"eu-central-1":t,"eu-north-1":t,"eu-south-1":t,"eu-south-2":t,"eu-west-1":t,"eu-west-2":t,"eu-west-3":t,"il-central-1":t,"me-central-1":t,"me-south-1":t,"sa-east-1":t,"us-east-1":t,"us-east-2":t,"us-gov-east-1":t,"us-gov-west-1":t,"us-west-1":t,"us-west-2":t}],awsglobalaccelerator:t,siiites:t,appspacehosted:t,appspaceusercontent:t,"on-aptible":t,myasustor:t,"balena-devices":t,boutir:t,bplaced:t,cafjs:t,"canva-apps":t,"canva-hosted-embed":t,canvacode:t,"rice-labs":t,"cdn77-storage":t,br:t,cn:t,de:t,eu:t,jpn:t,mex:t,ru:t,sa:t,uk:t,us:t,za:t,"clever-cloud":[0,{services:i}],abrdns:t,dnsabr:t,"ip-ddns":t,jdevcloud:t,wpdevcloud:t,"cf-ipfs":t,"cloudflare-ipfs":t,trycloudflare:t,co:t,devinapps:i,builtwithdark:t,datadetect:[0,{demo:t,instance:t}],dattolocal:t,dattorelay:t,dattoweb:t,mydatto:t,digitaloceanspaces:i,discordsays:t,discordsez:t,drayddns:t,dreamhosters:t,durumis:t,blogdns:t,cechire:t,dnsalias:t,dnsdojo:t,doesntexist:t,dontexist:t,doomdns:t,"dyn-o-saur":t,dynalias:t,"dyndns-at-home":t,"dyndns-at-work":t,"dyndns-blog":t,"dyndns-free":t,"dyndns-home":t,"dyndns-ip":t,"dyndns-mail":t,"dyndns-office":t,"dyndns-pics":t,"dyndns-remote":t,"dyndns-server":t,"dyndns-web":t,"dyndns-wiki":t,"dyndns-work":t,"est-a-la-maison":t,"est-a-la-masion":t,"est-le-patron":t,"est-mon-blogueur":t,"from-ak":t,"from-al":t,"from-ar":t,"from-ca":t,"from-ct":t,"from-dc":t,"from-de":t,"from-fl":t,"from-ga":t,"from-hi":t,"from-ia":t,"from-id":t,"from-il":t,"from-in":t,"from-ks":t,"from-ky":t,"from-ma":t,"from-md":t,"from-mi":t,"from-mn":t,"from-mo":t,"from-ms":t,"from-mt":t,"from-nc":t,"from-nd":t,"from-ne":t,"from-nh":t,"from-nj":t,"from-nm":t,"from-nv":t,"from-oh":t,"from-ok":t,"from-or":t,"from-pa":t,"from-pr":t,"from-ri":t,"from-sc":t,"from-sd":t,"from-tn":t,"from-tx":t,"from-ut":t,"from-va":t,"from-vt":t,"from-wa":t,"from-wi":t,"from-wv":t,"from-wy":t,getmyip:t,gotdns:t,"hobby-site":t,homelinux:t,homeunix:t,iamallama:t,"is-a-anarchist":t,"is-a-blogger":t,"is-a-bookkeeper":t,"is-a-bulls-fan":t,"is-a-caterer":t,"is-a-chef":t,"is-a-conservative":t,"is-a-cpa":t,"is-a-cubicle-slave":t,"is-a-democrat":t,"is-a-designer":t,"is-a-doctor":t,"is-a-financialadvisor":t,"is-a-geek":t,"is-a-green":t,"is-a-guru":t,"is-a-hard-worker":t,"is-a-hunter":t,"is-a-landscaper":t,"is-a-lawyer":t,"is-a-liberal":t,"is-a-libertarian":t,"is-a-llama":t,"is-a-musician":t,"is-a-nascarfan":t,"is-a-nurse":t,"is-a-painter":t,"is-a-personaltrainer":t,"is-a-photographer":t,"is-a-player":t,"is-a-republican":t,"is-a-rockstar":t,"is-a-socialist":t,"is-a-student":t,"is-a-teacher":t,"is-a-techie":t,"is-a-therapist":t,"is-an-accountant":t,"is-an-actor":t,"is-an-actress":t,"is-an-anarchist":t,"is-an-artist":t,"is-an-engineer":t,"is-an-entertainer":t,"is-certified":t,"is-gone":t,"is-into-anime":t,"is-into-cars":t,"is-into-cartoons":t,"is-into-games":t,"is-leet":t,"is-not-certified":t,"is-slick":t,"is-uberleet":t,"is-with-theband":t,"isa-geek":t,"isa-hockeynut":t,issmarterthanyou:t,"likes-pie":t,likescandy:t,"neat-url":t,"saves-the-whales":t,selfip:t,"sells-for-less":t,"sells-for-u":t,servebbs:t,"simple-url":t,"space-to-rent":t,"teaches-yoga":t,writesthisblog:t,"1cooldns":t,bumbleshrimp:t,ddnsfree:t,ddnsgeek:t,ddnsguru:t,dynuddns:t,dynuhosting:t,giize:t,gleeze:t,kozow:t,loseyourip:t,ooguy:t,pivohosting:t,theworkpc:t,wiredbladehosting:t,emergentagent:[0,{preview:t}],mytuleap:t,"tuleap-partners":t,encoreapi:t,evennode:[0,{"eu-1":t,"eu-2":t,"eu-3":t,"eu-4":t,"us-1":t,"us-2":t,"us-3":t,"us-4":t}],onfabrica:t,"fastly-edge":t,"fastly-terrarium":t,"fastvps-server":t,mydobiss:t,firebaseapp:t,fldrv:t,framercanvas:t,"freebox-os":t,freeboxos:t,freemyip:t,aliases121:t,gentapps:t,gentlentapis:t,githubusercontent:t,"0emm":i,appspot:[2,{r:i}],blogspot:t,codespot:t,googleapis:t,googlecode:t,pagespeedmobilizer:t,withgoogle:t,withyoutube:t,grayjayleagues:t,hatenablog:t,hatenadiary:t,"hercules-app":t,"hercules-dev":t,herokuapp:t,gr:t,smushcdn:t,wphostedmail:t,wpmucdn:t,pixolino:t,"apps-1and1":t,"live-website":t,"webspace-host":t,dopaas:t,"hosted-by-previder":ae,hosteur:[0,{"rag-cloud":t,"rag-cloud-ch":t}],"ik-server":[0,{jcloud:t,"jcloud-ver-jpc":t}],jelastic:[0,{demo:t}],massivegrid:ae,wafaicloud:[0,{jed:t,ryd:t}],"eu1-plenit":t,"la1-plenit":t,"us1-plenit":t,webadorsite:t,"on-forge":t,"on-vapor":t,lpusercontent:t,linode:[0,{members:t,nodebalancer:i}],linodeobjects:i,linodeusercontent:[0,{ip:t}],localtonet:t,lovableproject:t,barsycenter:t,barsyonline:t,lutrausercontent:i,magicpatternsapp:t,modelscape:t,mwcloudnonprod:t,polyspace:t,miniserver:t,atmeta:t,fbsbx:ie,meteorapp:oe,routingthecloud:t,"same-app":t,"same-preview":t,mydbserver:t,mochausercontent:t,hostedpi:t,"mythic-beasts":[0,{caracal:t,customer:t,fentiger:t,lynx:t,ocelot:t,oncilla:t,onza:t,sphinx:t,vs:t,x:t,yali:t}],nospamproxy:[0,{cloud:[2,{o365:t}]}],"4u":t,nfshost:t,"3utilities":t,blogsyte:t,ciscofreak:t,damnserver:t,ddnsking:t,ditchyourip:t,dnsiskinky:t,dynns:t,geekgalaxy:t,"health-carereform":t,homesecuritymac:t,homesecuritypc:t,myactivedirectory:t,mysecuritycamera:t,myvnc:t,"net-freaks":t,onthewifi:t,point2this:t,quicksytes:t,securitytactics:t,servebeer:t,servecounterstrike:t,serveexchange:t,serveftp:t,servegame:t,servehalflife:t,servehttp:t,servehumour:t,serveirc:t,servemp3:t,servep2p:t,servepics:t,servequake:t,servesarcasm:t,stufftoread:t,unusualperson:t,workisboring:t,myiphost:t,observableusercontent:[0,{static:t}],simplesite:t,oaiusercontent:i,orsites:t,operaunite:t,"customer-oci":[0,{"*":t,oci:i,ocp:i,ocs:i}],oraclecloudapps:i,oraclegovcloudapps:i,"authgear-staging":t,authgearapps:t,outsystemscloud:t,ownprovider:t,pgfog:t,pagexl:t,gotpantheon:t,paywhirl:i,forgeblocks:t,upsunapp:t,"postman-echo":t,prgmr:[0,{xen:t}],"project-study":[0,{dev:t}],pythonanywhere:oe,qa2:t,"alpha-myqnapcloud":t,"dev-myqnapcloud":t,mycloudnas:t,mynascloud:t,myqnapcloud:t,qualifioapp:t,ladesk:t,qualyhqpartner:i,qualyhqportal:i,qbuser:t,quipelements:i,rackmaze:t,"readthedocs-hosted":t,rhcloud:t,onrender:t,render:se,"subsc-pay":t,"180r":t,dojin:t,sakuratan:t,sakuraweb:t,x0:t,code:[0,{builder:i,"dev-builder":i,"stg-builder":i}],salesforce:[0,{platform:[0,{"code-builder-stg":[0,{test:[0,{"001":i}]}]}]}],logoip:t,scrysec:t,"firewall-gateway":t,myshopblocks:t,myshopify:t,shopitsite:t,"1kapp":t,appchizi:t,applinzi:t,sinaapp:t,vipsinaapp:t,streamlitapp:t,"try-snowplow":t,"playstation-cloud":t,myspreadshop:t,"w-corp-staticblitz":t,"w-credentialless-staticblitz":t,"w-staticblitz":t,"stackhero-network":t,stdlib:[0,{api:t}],strapiapp:[2,{media:t}],"streak-link":t,streaklinks:t,streakusercontent:t,"temp-dns":t,dsmynas:t,familyds:t,mytabit:t,taveusercontent:t,"tb-hosting":ce,reservd:t,thingdustdata:t,"townnews-staging":t,typeform:[0,{pro:t}],hk:t,it:t,"deus-canvas":t,vultrobjects:i,wafflecell:t,hotelwithflight:t,"reserve-online":t,cprapid:t,pleskns:t,remotewd:t,wiardweb:[0,{pages:t}],"drive-platform":t,"base44-sandbox":t,wixsite:t,wixstudio:t,messwithdns:t,"woltlab-demo":t,wpenginepowered:[2,{js:t}],xnbay:[2,{u2:t,"u2-local":t}],xtooldevice:t,yolasite:t}],coop:e,cr:[1,{ac:e,co:e,ed:e,fi:e,go:e,or:e,sa:e}],cu:[1,{com:e,edu:e,gob:e,inf:e,nat:e,net:e,org:e}],cv:[1,{com:e,edu:e,id:e,int:e,net:e,nome:e,org:e,publ:e}],cw:le,cx:[1,{gov:e,cloudns:t,ath:t,info:t,assessments:t,calculators:t,funnels:t,paynow:t,quizzes:t,researched:t,tests:t}],cy:[1,{ac:e,biz:e,com:[1,{scaleforce:L}],ekloges:e,gov:e,ltd:e,mil:e,net:e,org:e,press:e,pro:e,tm:e}],cz:[1,{gov:e,contentproxy9:[0,{rsc:t}],realm:t,e4:t,co:t,metacentrum:[0,{cloud:i,custom:t}],muni:[0,{cloud:[0,{flt:t,usr:t}]}]}],de:[1,{bplaced:t,square7:t,"bwcloud-os-instance":i,com:t,cosidns:ue,dnsupdater:t,"dynamisches-dns":t,"internet-dns":t,"l-o-g-i-n":t,ddnss:[2,{dyn:t,dyndns:t}],"dyn-ip24":t,dyndns1:t,"home-webserver":[2,{dyn:t}],"myhome-server":t,dnshome:t,fuettertdasnetz:t,isteingeek:t,istmein:t,lebtimnetz:t,leitungsen:t,traeumtgerade:t,frusky:i,goip:t,"xn--gnstigbestellen-zvb":t,günstigbestellen:t,"xn--gnstigliefern-wob":t,günstigliefern:t,"hs-heilbronn":[0,{it:[0,{pages:t,"pages-research":t}]}],"dyn-berlin":t,"in-berlin":t,"in-brb":t,"in-butter":t,"in-dsl":t,"in-vpn":t,iservschule:t,"mein-iserv":t,schuldock:t,schulplattform:t,schulserver:t,"test-iserv":t,keymachine:t,co:t,"git-repos":t,"lcube-server":t,"svn-repos":t,barsy:t,webspaceconfig:t,"123webseite":t,rub:t,"ruhr-uni-bochum":[2,{noc:[0,{io:t}]}],logoip:t,"firewall-gateway":t,"my-gateway":t,"my-router":t,spdns:t,my:t,speedpartner:[0,{customer:t}],myspreadshop:t,"taifun-dns":t,"12hp":t,"2ix":t,"4lima":t,"lima-city":t,"virtual-user":t,virtualuser:t,"community-pro":t,diskussionsbereich:t,xenonconnect:i}],dj:e,dk:[1,{biz:t,co:t,firm:t,reg:t,store:t,"123hjemmeside":t,myspreadshop:t}],dm:fe,do:[1,{art:e,com:e,edu:e,gob:e,gov:e,mil:e,net:e,org:e,sld:e,web:e}],dz:[1,{art:e,asso:e,com:e,edu:e,gov:e,net:e,org:e,pol:e,soc:e,tm:e}],ec:[1,{abg:e,adm:e,agron:e,arqt:e,art:e,bar:e,chef:e,com:e,cont:e,cpa:e,cue:e,dent:e,dgn:e,disco:e,doc:e,edu:e,eng:e,esm:e,fin:e,fot:e,gal:e,gob:e,gov:e,gye:e,ibr:e,info:e,k12:e,lat:e,loj:e,med:e,mil:e,mktg:e,mon:e,net:e,ntr:e,odont:e,org:e,pro:e,prof:e,psic:e,psiq:e,pub:e,rio:e,rrpp:e,sal:e,tech:e,tul:e,tur:e,uio:e,vet:e,xxx:e,base:t,official:t}],edu:[1,{rit:[0,{"git-pages":t}]}],ee:[1,{aip:e,com:e,edu:e,fie:e,gov:e,lib:e,med:e,org:e,pri:e,riik:e}],eg:[1,{ac:e,com:e,edu:e,eun:e,gov:e,info:e,me:e,mil:e,name:e,net:e,org:e,sci:e,sport:e,tv:e}],er:y,es:[1,{com:e,edu:e,gob:e,nom:e,org:e,"123miweb":t,myspreadshop:t}],et:[1,{biz:e,com:e,edu:e,gov:e,info:e,name:e,net:e,org:e}],eu:[1,{amazonwebservices:[0,{on:[0,{"eusc-de-east-1":[0,{"cognito-idp":I}]}]}],cloudns:t,prvw:t,deuxfleurs:t,dogado:[0,{jelastic:t}],barsy:t,spdns:t,nxa:i,directwp:t,transurl:i}],fi:[1,{aland:e,dy:t,"xn--hkkinen-5wa":t,häkkinen:t,iki:t,cloudplatform:[0,{fi:t}],datacenter:[0,{demo:t,paas:t}],kapsi:t,"123kotisivu":t,myspreadshop:t}],fj:[1,{ac:e,biz:e,com:e,edu:e,gov:e,id:e,info:e,mil:e,name:e,net:e,org:e,pro:e}],fk:y,fm:[1,{com:e,edu:e,net:e,org:e,radio:t,user:i}],fo:e,fr:[1,{asso:e,com:e,gouv:e,nom:e,prd:e,tm:e,avoues:e,cci:e,greta:e,"huissier-justice":e,"fbx-os":t,fbxos:t,"freebox-os":t,freeboxos:t,goupile:t,kdns:t,"123siteweb":t,"on-web":t,"chirurgiens-dentistes-en-france":t,dedibox:t,aeroport:t,avocat:t,chambagri:t,"chirurgiens-dentistes":t,"experts-comptables":t,medecin:t,notaires:t,pharmacien:t,port:t,veterinaire:t,myspreadshop:t,ynh:t}],ga:e,gb:e,gd:[1,{edu:e,gov:e}],ge:[1,{com:e,edu:e,gov:e,net:e,org:e,pvt:e,school:e}],gf:e,gg:[1,{co:e,net:e,org:e,ply:[0,{at:i,d6:t}],botdash:t,kaas:t,stackit:t,panel:[2,{daemon:t}]}],gh:[1,{biz:e,com:e,edu:e,gov:e,mil:e,net:e,org:e}],gi:[1,{com:e,edu:e,gov:e,ltd:e,mod:e,org:e}],gl:[1,{co:e,com:e,edu:e,net:e,org:e}],gm:e,gn:[1,{ac:e,com:e,edu:e,gov:e,net:e,org:e}],gov:e,gp:[1,{asso:e,com:e,edu:e,mobi:e,net:e,org:e}],gq:e,gr:[1,{com:e,edu:e,gov:e,net:e,org:e,barsy:t,simplesite:t}],gs:e,gt:[1,{com:e,edu:e,gob:e,ind:e,mil:e,net:e,org:e}],gu:[1,{com:e,edu:e,gov:e,guam:e,info:e,net:e,org:e,web:e}],gw:[1,{nx:t}],gy:fe,hk:[1,{com:e,edu:e,gov:e,idv:e,net:e,org:e,"xn--ciqpn":e,个人:e,"xn--gmqw5a":e,個人:e,"xn--55qx5d":e,公司:e,"xn--mxtq1m":e,政府:e,"xn--lcvr32d":e,敎育:e,"xn--wcvs22d":e,教育:e,"xn--gmq050i":e,箇人:e,"xn--uc0atv":e,組織:e,"xn--uc0ay4a":e,組织:e,"xn--od0alg":e,網絡:e,"xn--zf0avx":e,網络:e,"xn--mk0axi":e,组織:e,"xn--tn0ag":e,组织:e,"xn--od0aq3b":e,网絡:e,"xn--io0a7i":e,网络:e,inc:t,ltd:t}],hm:e,hn:[1,{com:e,edu:e,gob:e,mil:e,net:e,org:e}],hr:[1,{com:e,from:e,iz:e,name:e,brendly:v}],ht:[1,{adult:e,art:e,asso:e,com:e,coop:e,edu:e,firm:e,gouv:e,info:e,med:e,net:e,org:e,perso:e,pol:e,pro:e,rel:e,shop:e,rt:t}],hu:[1,{2e3:e,agrar:e,bolt:e,casino:e,city:e,co:e,erotica:e,erotika:e,film:e,forum:e,games:e,hotel:e,info:e,ingatlan:e,jogasz:e,konyvelo:e,lakas:e,media:e,news:e,org:e,priv:e,reklam:e,sex:e,shop:e,sport:e,suli:e,szex:e,tm:e,tozsde:e,utazas:e,video:e}],id:[1,{ac:e,biz:e,co:e,desa:e,go:e,kop:e,mil:e,my:e,net:e,or:e,ponpes:e,sch:e,web:e,"xn--9tfky":e,ᬩᬮᬶ:e,e:t,zone:t}],ie:[1,{gov:e,myspreadshop:t}],il:[1,{ac:e,co:[1,{ravpage:t,mytabit:t,tabitorder:t}],gov:e,idf:e,k12:e,muni:e,net:e,org:e}],"xn--4dbrk0ce":[1,{"xn--4dbgdty6c":e,"xn--5dbhl8d":e,"xn--8dbq2a":e,"xn--hebda8b":e}],ישראל:[1,{אקדמיה:e,ישוב:e,צהל:e,ממשל:e}],im:[1,{ac:e,co:[1,{ltd:e,plc:e}],com:e,net:e,org:e,tt:e,tv:e}],in:[1,{"5g":e,"6g":e,ac:e,ai:e,am:e,bank:e,bihar:e,biz:e,business:e,ca:e,cn:e,co:e,com:e,coop:e,cs:e,delhi:e,dr:e,edu:e,er:e,fin:e,firm:e,gen:e,gov:e,gujarat:e,ind:e,info:e,int:e,internet:e,io:e,me:e,mil:e,net:e,nic:e,org:e,pg:e,post:e,pro:e,res:e,travel:e,tv:e,uk:e,up:e,us:e,cloudns:t,barsy:t,web:t,indevs:t,supabase:t}],info:[1,{cloudns:t,"dynamic-dns":t,"barrel-of-knowledge":t,"barrell-of-knowledge":t,dyndns:t,"for-our":t,"groks-the":t,"groks-this":t,"here-for-more":t,knowsitall:t,selfip:t,webhop:t,barsy:t,mayfirst:t,mittwald:t,mittwaldserver:t,typo3server:t,dvrcam:t,ilovecollege:t,"no-ip":t,forumz:t,nsupdate:t,dnsupdate:t,"v-info":t}],int:[1,{eu:e}],io:[1,{2038:t,co:e,com:e,edu:e,gov:e,mil:e,net:e,nom:e,org:e,"on-acorn":i,myaddr:t,apigee:t,"b-data":t,beagleboard:t,bitbucket:t,bluebite:t,boxfuse:t,brave:a,browsersafetymark:t,bubble:ge,bubbleapps:t,bigv:[0,{uk0:t}],cleverapps:t,cloudbeesusercontent:t,dappnode:[0,{dyndns:t}],darklang:t,definima:t,dedyn:t,icp0:_e,icp1:_e,qzz:t,"fh-muenster":t,gitbook:t,github:t,gitlab:t,lolipop:t,"hasura-app":t,hostyhosting:t,hypernode:t,moonscale:i,beebyte:ae,beebyteapp:[0,{sekd1:t}],jele:t,keenetic:t,kiloapps:t,webthings:t,loginline:t,barsy:t,azurecontainer:i,ngrok:[2,{ap:t,au:t,eu:t,in:t,jp:t,sa:t,us:t}],nodeart:[0,{stage:t}],pantheonsite:t,forgerock:[0,{id:t}],pstmn:[2,{mock:t}],protonet:t,qcx:[2,{sys:i}],qoto:t,vaporcloud:t,myrdbx:t,"rb-hosting":ce,"on-k3s":i,"on-rio":i,readthedocs:t,resindevice:t,resinstaging:[0,{devices:t}],hzc:t,sandcats:t,scrypted:[0,{client:t}],"mo-siemens":t,lair:ie,stolos:i,musician:t,utwente:t,edugit:t,telebit:t,thingdust:[0,{dev:ve,disrec:ve,prod:ye,testing:ve}],tickets:t,webflow:t,webflowtest:t,"drive-platform":t,editorx:t,wixstudio:t,basicserver:t,virtualserver:t}],iq:r,ir:[1,{ac:e,co:e,gov:e,id:e,net:e,org:e,sch:e,"xn--mgba3a4f16a":e,ایران:e,"xn--mgba3a4fra":e,ايران:e,arvanedge:t,vistablog:t}],is:e,it:[1,{edu:e,gov:e,abr:e,abruzzo:e,"aosta-valley":e,aostavalley:e,bas:e,basilicata:e,cal:e,calabria:e,cam:e,campania:e,"emilia-romagna":e,emiliaromagna:e,emr:e,"friuli-v-giulia":e,"friuli-ve-giulia":e,"friuli-vegiulia":e,"friuli-venezia-giulia":e,"friuli-veneziagiulia":e,"friuli-vgiulia":e,"friuliv-giulia":e,"friulive-giulia":e,friulivegiulia:e,"friulivenezia-giulia":e,friuliveneziagiulia:e,friulivgiulia:e,fvg:e,laz:e,lazio:e,lig:e,liguria:e,lom:e,lombardia:e,lombardy:e,lucania:e,mar:e,marche:e,mol:e,molise:e,piedmont:e,piemonte:e,pmn:e,pug:e,puglia:e,sar:e,sardegna:e,sardinia:e,sic:e,sicilia:e,sicily:e,taa:e,tos:e,toscana:e,"trentin-sud-tirol":e,"xn--trentin-sd-tirol-rzb":e,"trentin-süd-tirol":e,"trentin-sudtirol":e,"xn--trentin-sdtirol-7vb":e,"trentin-südtirol":e,"trentin-sued-tirol":e,"trentin-suedtirol":e,trentino:e,"trentino-a-adige":e,"trentino-aadige":e,"trentino-alto-adige":e,"trentino-altoadige":e,"trentino-s-tirol":e,"trentino-stirol":e,"trentino-sud-tirol":e,"xn--trentino-sd-tirol-c3b":e,"trentino-süd-tirol":e,"trentino-sudtirol":e,"xn--trentino-sdtirol-szb":e,"trentino-südtirol":e,"trentino-sued-tirol":e,"trentino-suedtirol":e,"trentinoa-adige":e,trentinoaadige:e,"trentinoalto-adige":e,trentinoaltoadige:e,"trentinos-tirol":e,trentinostirol:e,"trentinosud-tirol":e,"xn--trentinosd-tirol-rzb":e,"trentinosüd-tirol":e,trentinosudtirol:e,"xn--trentinosdtirol-7vb":e,trentinosüdtirol:e,"trentinosued-tirol":e,trentinosuedtirol:e,"trentinsud-tirol":e,"xn--trentinsd-tirol-6vb":e,"trentinsüd-tirol":e,trentinsudtirol:e,"xn--trentinsdtirol-nsb":e,trentinsüdtirol:e,"trentinsued-tirol":e,trentinsuedtirol:e,tuscany:e,umb:e,umbria:e,"val-d-aosta":e,"val-daosta":e,"vald-aosta":e,valdaosta:e,"valle-aosta":e,"valle-d-aosta":e,"valle-daosta":e,valleaosta:e,"valled-aosta":e,valledaosta:e,"vallee-aoste":e,"xn--valle-aoste-ebb":e,"vallée-aoste":e,"vallee-d-aoste":e,"xn--valle-d-aoste-ehb":e,"vallée-d-aoste":e,valleeaoste:e,"xn--valleaoste-e7a":e,valléeaoste:e,valleedaoste:e,"xn--valledaoste-ebb":e,valléedaoste:e,vao:e,vda:e,ven:e,veneto:e,ag:e,agrigento:e,al:e,alessandria:e,"alto-adige":e,altoadige:e,an:e,ancona:e,"andria-barletta-trani":e,"andria-trani-barletta":e,andriabarlettatrani:e,andriatranibarletta:e,ao:e,aosta:e,aoste:e,ap:e,aq:e,aquila:e,ar:e,arezzo:e,"ascoli-piceno":e,ascolipiceno:e,asti:e,at:e,av:e,avellino:e,ba:e,balsan:e,"balsan-sudtirol":e,"xn--balsan-sdtirol-nsb":e,"balsan-südtirol":e,"balsan-suedtirol":e,bari:e,"barletta-trani-andria":e,barlettatraniandria:e,belluno:e,benevento:e,bergamo:e,bg:e,bi:e,biella:e,bl:e,bn:e,bo:e,bologna:e,bolzano:e,"bolzano-altoadige":e,bozen:e,"bozen-sudtirol":e,"xn--bozen-sdtirol-2ob":e,"bozen-südtirol":e,"bozen-suedtirol":e,br:e,brescia:e,brindisi:e,bs:e,bt:e,bulsan:e,"bulsan-sudtirol":e,"xn--bulsan-sdtirol-nsb":e,"bulsan-südtirol":e,"bulsan-suedtirol":e,bz:e,ca:e,cagliari:e,caltanissetta:e,"campidano-medio":e,campidanomedio:e,campobasso:e,"carbonia-iglesias":e,carboniaiglesias:e,"carrara-massa":e,carraramassa:e,caserta:e,catania:e,catanzaro:e,cb:e,ce:e,"cesena-forli":e,"xn--cesena-forl-mcb":e,"cesena-forlì":e,cesenaforli:e,"xn--cesenaforl-i8a":e,cesenaforlì:e,ch:e,chieti:e,ci:e,cl:e,cn:e,co:e,como:e,cosenza:e,cr:e,cremona:e,crotone:e,cs:e,ct:e,cuneo:e,cz:e,"dell-ogliastra":e,dellogliastra:e,en:e,enna:e,fc:e,fe:e,fermo:e,ferrara:e,fg:e,fi:e,firenze:e,florence:e,fm:e,foggia:e,"forli-cesena":e,"xn--forl-cesena-fcb":e,"forlì-cesena":e,forlicesena:e,"xn--forlcesena-c8a":e,forlìcesena:e,fr:e,frosinone:e,ge:e,genoa:e,genova:e,go:e,gorizia:e,gr:e,grosseto:e,"iglesias-carbonia":e,iglesiascarbonia:e,im:e,imperia:e,is:e,isernia:e,kr:e,"la-spezia":e,laquila:e,laspezia:e,latina:e,lc:e,le:e,lecce:e,lecco:e,li:e,livorno:e,lo:e,lodi:e,lt:e,lu:e,lucca:e,macerata:e,mantova:e,"massa-carrara":e,massacarrara:e,matera:e,mb:e,mc:e,me:e,"medio-campidano":e,mediocampidano:e,messina:e,mi:e,milan:e,milano:e,mn:e,mo:e,modena:e,monza:e,"monza-brianza":e,"monza-e-della-brianza":e,monzabrianza:e,monzaebrianza:e,monzaedellabrianza:e,ms:e,mt:e,na:e,naples:e,napoli:e,no:e,novara:e,nu:e,nuoro:e,og:e,ogliastra:e,"olbia-tempio":e,olbiatempio:e,or:e,oristano:e,ot:e,pa:e,padova:e,padua:e,palermo:e,parma:e,pavia:e,pc:e,pd:e,pe:e,perugia:e,"pesaro-urbino":e,pesarourbino:e,pescara:e,pg:e,pi:e,piacenza:e,pisa:e,pistoia:e,pn:e,po:e,pordenone:e,potenza:e,pr:e,prato:e,pt:e,pu:e,pv:e,pz:e,ra:e,ragusa:e,ravenna:e,rc:e,re:e,"reggio-calabria":e,"reggio-emilia":e,reggiocalabria:e,reggioemilia:e,rg:e,ri:e,rieti:e,rimini:e,rm:e,rn:e,ro:e,roma:e,rome:e,rovigo:e,sa:e,salerno:e,sassari:e,savona:e,si:e,siena:e,siracusa:e,so:e,sondrio:e,sp:e,sr:e,ss:e,"xn--sdtirol-n2a":e,südtirol:e,suedtirol:e,sv:e,ta:e,taranto:e,te:e,"tempio-olbia":e,tempioolbia:e,teramo:e,terni:e,tn:e,to:e,torino:e,tp:e,tr:e,"trani-andria-barletta":e,"trani-barletta-andria":e,traniandriabarletta:e,tranibarlettaandria:e,trapani:e,trento:e,treviso:e,trieste:e,ts:e,turin:e,tv:e,ud:e,udine:e,"urbino-pesaro":e,urbinopesaro:e,va:e,varese:e,vb:e,vc:e,ve:e,venezia:e,venice:e,verbania:e,vercelli:e,verona:e,vi:e,"vibo-valentia":e,vibovalentia:e,vicenza:e,viterbo:e,vr:e,vs:e,vt:e,vv:e,ibxos:t,iliadboxos:t,neen:[0,{jc:t}],"123homepage":t,"16-b":t,"32-b":t,"64-b":t,myspreadshop:t,syncloud:t}],je:[1,{co:e,net:e,org:e,of:t}],jm:y,jo:[1,{agri:e,ai:e,com:e,edu:e,eng:e,fm:e,gov:e,mil:e,net:e,org:e,per:e,phd:e,sch:e,tv:e}],jobs:e,jp:[1,{ac:e,ad:e,co:e,ed:e,go:e,gr:e,lg:e,ne:[1,{aseinet:me,gehirn:t,ivory:t,"mail-box":t,mints:t,mokuren:t,opal:t,sakura:t,sumomo:t,topaz:t}],or:e,aichi:[1,{aisai:e,ama:e,anjo:e,asuke:e,chiryu:e,chita:e,fuso:e,gamagori:e,handa:e,hazu:e,hekinan:e,higashiura:e,ichinomiya:e,inazawa:e,inuyama:e,isshiki:e,iwakura:e,kanie:e,kariya:e,kasugai:e,kira:e,kiyosu:e,komaki:e,konan:e,kota:e,mihama:e,miyoshi:e,nishio:e,nisshin:e,obu:e,oguchi:e,oharu:e,okazaki:e,owariasahi:e,seto:e,shikatsu:e,shinshiro:e,shitara:e,tahara:e,takahama:e,tobishima:e,toei:e,togo:e,tokai:e,tokoname:e,toyoake:e,toyohashi:e,toyokawa:e,toyone:e,toyota:e,tsushima:e,yatomi:e}],akita:[1,{akita:e,daisen:e,fujisato:e,gojome:e,hachirogata:e,happou:e,higashinaruse:e,honjo:e,honjyo:e,ikawa:e,kamikoani:e,kamioka:e,katagami:e,kazuno:e,kitaakita:e,kosaka:e,kyowa:e,misato:e,mitane:e,moriyoshi:e,nikaho:e,noshiro:e,odate:e,oga:e,ogata:e,semboku:e,yokote:e,yurihonjo:e}],aomori:[1,{aomori:e,gonohe:e,hachinohe:e,hashikami:e,hiranai:e,hirosaki:e,itayanagi:e,kuroishi:e,misawa:e,mutsu:e,nakadomari:e,noheji:e,oirase:e,owani:e,rokunohe:e,sannohe:e,shichinohe:e,shingo:e,takko:e,towada:e,tsugaru:e,tsuruta:e}],chiba:[1,{abiko:e,asahi:e,chonan:e,chosei:e,choshi:e,chuo:e,funabashi:e,futtsu:e,hanamigawa:e,ichihara:e,ichikawa:e,ichinomiya:e,inzai:e,isumi:e,kamagaya:e,kamogawa:e,kashiwa:e,katori:e,katsuura:e,kimitsu:e,kisarazu:e,kozaki:e,kujukuri:e,kyonan:e,matsudo:e,midori:e,mihama:e,minamiboso:e,mobara:e,mutsuzawa:e,nagara:e,nagareyama:e,narashino:e,narita:e,noda:e,oamishirasato:e,omigawa:e,onjuku:e,otaki:e,sakae:e,sakura:e,shimofusa:e,shirako:e,shiroi:e,shisui:e,sodegaura:e,sosa:e,tako:e,tateyama:e,togane:e,tohnosho:e,tomisato:e,urayasu:e,yachimata:e,yachiyo:e,yokaichiba:e,yokoshibahikari:e,yotsukaido:e}],ehime:[1,{ainan:e,honai:e,ikata:e,imabari:e,iyo:e,kamijima:e,kihoku:e,kumakogen:e,masaki:e,matsuno:e,matsuyama:e,namikata:e,niihama:e,ozu:e,saijo:e,seiyo:e,shikokuchuo:e,tobe:e,toon:e,uchiko:e,uwajima:e,yawatahama:e}],fukui:[1,{echizen:e,eiheiji:e,fukui:e,ikeda:e,katsuyama:e,mihama:e,minamiechizen:e,obama:e,ohi:e,ono:e,sabae:e,sakai:e,takahama:e,tsuruga:e,wakasa:e}],fukuoka:[1,{ashiya:e,buzen:e,chikugo:e,chikuho:e,chikujo:e,chikushino:e,chikuzen:e,chuo:e,dazaifu:e,fukuchi:e,hakata:e,higashi:e,hirokawa:e,hisayama:e,iizuka:e,inatsuki:e,kaho:e,kasuga:e,kasuya:e,kawara:e,keisen:e,koga:e,kurate:e,kurogi:e,kurume:e,minami:e,miyako:e,miyama:e,miyawaka:e,mizumaki:e,munakata:e,nakagawa:e,nakama:e,nishi:e,nogata:e,ogori:e,okagaki:e,okawa:e,oki:e,omuta:e,onga:e,onojo:e,oto:e,saigawa:e,sasaguri:e,shingu:e,shinyoshitomi:e,shonai:e,soeda:e,sue:e,tachiarai:e,tagawa:e,takata:e,toho:e,toyotsu:e,tsuiki:e,ukiha:e,umi:e,usui:e,yamada:e,yame:e,yanagawa:e,yukuhashi:e}],fukushima:[1,{aizubange:e,aizumisato:e,aizuwakamatsu:e,asakawa:e,bandai:e,date:e,fukushima:e,furudono:e,futaba:e,hanawa:e,higashi:e,hirata:e,hirono:e,iitate:e,inawashiro:e,ishikawa:e,iwaki:e,izumizaki:e,kagamiishi:e,kaneyama:e,kawamata:e,kitakata:e,kitashiobara:e,koori:e,koriyama:e,kunimi:e,miharu:e,mishima:e,namie:e,nango:e,nishiaizu:e,nishigo:e,okuma:e,omotego:e,ono:e,otama:e,samegawa:e,shimogo:e,shirakawa:e,showa:e,soma:e,sukagawa:e,taishin:e,tamakawa:e,tanagura:e,tenei:e,yabuki:e,yamato:e,yamatsuri:e,yanaizu:e,yugawa:e}],gifu:[1,{anpachi:e,ena:e,gifu:e,ginan:e,godo:e,gujo:e,hashima:e,hichiso:e,hida:e,higashishirakawa:e,ibigawa:e,ikeda:e,kakamigahara:e,kani:e,kasahara:e,kasamatsu:e,kawaue:e,kitagata:e,mino:e,minokamo:e,mitake:e,mizunami:e,motosu:e,nakatsugawa:e,ogaki:e,sakahogi:e,seki:e,sekigahara:e,shirakawa:e,tajimi:e,takayama:e,tarui:e,toki:e,tomika:e,wanouchi:e,yamagata:e,yaotsu:e,yoro:e}],gunma:[1,{annaka:e,chiyoda:e,fujioka:e,higashiagatsuma:e,isesaki:e,itakura:e,kanna:e,kanra:e,katashina:e,kawaba:e,kiryu:e,kusatsu:e,maebashi:e,meiwa:e,midori:e,minakami:e,naganohara:e,nakanojo:e,nanmoku:e,numata:e,oizumi:e,ora:e,ota:e,shibukawa:e,shimonita:e,shinto:e,showa:e,takasaki:e,takayama:e,tamamura:e,tatebayashi:e,tomioka:e,tsukiyono:e,tsumagoi:e,ueno:e,yoshioka:e}],hiroshima:[1,{asaminami:e,daiwa:e,etajima:e,fuchu:e,fukuyama:e,hatsukaichi:e,higashihiroshima:e,hongo:e,jinsekikogen:e,kaita:e,kui:e,kumano:e,kure:e,mihara:e,miyoshi:e,naka:e,onomichi:e,osakikamijima:e,otake:e,saka:e,sera:e,seranishi:e,shinichi:e,shobara:e,takehara:e}],hokkaido:[1,{abashiri:e,abira:e,aibetsu:e,akabira:e,akkeshi:e,asahikawa:e,ashibetsu:e,ashoro:e,assabu:e,atsuma:e,bibai:e,biei:e,bifuka:e,bihoro:e,biratori:e,chippubetsu:e,chitose:e,date:e,ebetsu:e,embetsu:e,eniwa:e,erimo:e,esan:e,esashi:e,fukagawa:e,fukushima:e,furano:e,furubira:e,haboro:e,hakodate:e,hamatonbetsu:e,hidaka:e,higashikagura:e,higashikawa:e,hiroo:e,hokuryu:e,hokuto:e,honbetsu:e,horokanai:e,horonobe:e,ikeda:e,imakane:e,ishikari:e,iwamizawa:e,iwanai:e,kamifurano:e,kamikawa:e,kamishihoro:e,kamisunagawa:e,kamoenai:e,kayabe:e,kembuchi:e,kikonai:e,kimobetsu:e,kitahiroshima:e,kitami:e,kiyosato:e,koshimizu:e,kunneppu:e,kuriyama:e,kuromatsunai:e,kushiro:e,kutchan:e,kyowa:e,mashike:e,matsumae:e,mikasa:e,minamifurano:e,mombetsu:e,moseushi:e,mukawa:e,muroran:e,naie:e,nakagawa:e,nakasatsunai:e,nakatombetsu:e,nanae:e,nanporo:e,nayoro:e,nemuro:e,niikappu:e,niki:e,nishiokoppe:e,noboribetsu:e,numata:e,obihiro:e,obira:e,oketo:e,okoppe:e,otaru:e,otobe:e,otofuke:e,otoineppu:e,oumu:e,ozora:e,pippu:e,rankoshi:e,rebun:e,rikubetsu:e,rishiri:e,rishirifuji:e,saroma:e,sarufutsu:e,shakotan:e,shari:e,shibecha:e,shibetsu:e,shikabe:e,shikaoi:e,shimamaki:e,shimizu:e,shimokawa:e,shinshinotsu:e,shintoku:e,shiranuka:e,shiraoi:e,shiriuchi:e,sobetsu:e,sunagawa:e,taiki:e,takasu:e,takikawa:e,takinoue:e,teshikaga:e,tobetsu:e,tohma:e,tomakomai:e,tomari:e,toya:e,toyako:e,toyotomi:e,toyoura:e,tsubetsu:e,tsukigata:e,urakawa:e,urausu:e,uryu:e,utashinai:e,wakkanai:e,wassamu:e,yakumo:e,yoichi:e}],hyogo:[1,{aioi:e,akashi:e,ako:e,amagasaki:e,aogaki:e,asago:e,ashiya:e,awaji:e,fukusaki:e,goshiki:e,harima:e,himeji:e,ichikawa:e,inagawa:e,itami:e,kakogawa:e,kamigori:e,kamikawa:e,kasai:e,kasuga:e,kawanishi:e,miki:e,minamiawaji:e,nishinomiya:e,nishiwaki:e,ono:e,sanda:e,sannan:e,sasayama:e,sayo:e,shingu:e,shinonsen:e,shiso:e,sumoto:e,taishi:e,taka:e,takarazuka:e,takasago:e,takino:e,tamba:e,tatsuno:e,toyooka:e,yabu:e,yashiro:e,yoka:e,yokawa:e}],ibaraki:[1,{ami:e,asahi:e,bando:e,chikusei:e,daigo:e,fujishiro:e,hitachi:e,hitachinaka:e,hitachiomiya:e,hitachiota:e,ibaraki:e,ina:e,inashiki:e,itako:e,iwama:e,joso:e,kamisu:e,kasama:e,kashima:e,kasumigaura:e,koga:e,miho:e,mito:e,moriya:e,naka:e,namegata:e,oarai:e,ogawa:e,omitama:e,ryugasaki:e,sakai:e,sakuragawa:e,shimodate:e,shimotsuma:e,shirosato:e,sowa:e,suifu:e,takahagi:e,tamatsukuri:e,tokai:e,tomobe:e,tone:e,toride:e,tsuchiura:e,tsukuba:e,uchihara:e,ushiku:e,yachiyo:e,yamagata:e,yawara:e,yuki:e}],ishikawa:[1,{anamizu:e,hakui:e,hakusan:e,kaga:e,kahoku:e,kanazawa:e,kawakita:e,komatsu:e,nakanoto:e,nanao:e,nomi:e,nonoichi:e,noto:e,shika:e,suzu:e,tsubata:e,tsurugi:e,uchinada:e,wajima:e}],iwate:[1,{fudai:e,fujisawa:e,hanamaki:e,hiraizumi:e,hirono:e,ichinohe:e,ichinoseki:e,iwaizumi:e,iwate:e,joboji:e,kamaishi:e,kanegasaki:e,karumai:e,kawai:e,kitakami:e,kuji:e,kunohe:e,kuzumaki:e,miyako:e,mizusawa:e,morioka:e,ninohe:e,noda:e,ofunato:e,oshu:e,otsuchi:e,rikuzentakata:e,shiwa:e,shizukuishi:e,sumita:e,tanohata:e,tono:e,yahaba:e,yamada:e}],kagawa:[1,{ayagawa:e,higashikagawa:e,kanonji:e,kotohira:e,manno:e,marugame:e,mitoyo:e,naoshima:e,sanuki:e,tadotsu:e,takamatsu:e,tonosho:e,uchinomi:e,utazu:e,zentsuji:e}],kagoshima:[1,{akune:e,amami:e,hioki:e,isa:e,isen:e,izumi:e,kagoshima:e,kanoya:e,kawanabe:e,kinko:e,kouyama:e,makurazaki:e,matsumoto:e,minamitane:e,nakatane:e,nishinoomote:e,satsumasendai:e,soo:e,tarumizu:e,yusui:e}],kanagawa:[1,{aikawa:e,atsugi:e,ayase:e,chigasaki:e,ebina:e,fujisawa:e,hadano:e,hakone:e,hiratsuka:e,isehara:e,kaisei:e,kamakura:e,kiyokawa:e,matsuda:e,minamiashigara:e,miura:e,nakai:e,ninomiya:e,odawara:e,oi:e,oiso:e,sagamihara:e,samukawa:e,tsukui:e,yamakita:e,yamato:e,yokosuka:e,yugawara:e,zama:e,zushi:e}],kochi:[1,{aki:e,geisei:e,hidaka:e,higashitsuno:e,ino:e,kagami:e,kami:e,kitagawa:e,kochi:e,mihara:e,motoyama:e,muroto:e,nahari:e,nakamura:e,nankoku:e,nishitosa:e,niyodogawa:e,ochi:e,okawa:e,otoyo:e,otsuki:e,sakawa:e,sukumo:e,susaki:e,tosa:e,tosashimizu:e,toyo:e,tsuno:e,umaji:e,yasuda:e,yusuhara:e}],kumamoto:[1,{amakusa:e,arao:e,aso:e,choyo:e,gyokuto:e,kamiamakusa:e,kikuchi:e,kumamoto:e,mashiki:e,mifune:e,minamata:e,minamioguni:e,nagasu:e,nishihara:e,oguni:e,ozu:e,sumoto:e,takamori:e,uki:e,uto:e,yamaga:e,yamato:e,yatsushiro:e}],kyoto:[1,{ayabe:e,fukuchiyama:e,higashiyama:e,ide:e,ine:e,joyo:e,kameoka:e,kamo:e,kita:e,kizu:e,kumiyama:e,kyotamba:e,kyotanabe:e,kyotango:e,maizuru:e,minami:e,minamiyamashiro:e,miyazu:e,muko:e,nagaokakyo:e,nakagyo:e,nantan:e,oyamazaki:e,sakyo:e,seika:e,tanabe:e,uji:e,ujitawara:e,wazuka:e,yamashina:e,yawata:e}],mie:[1,{asahi:e,inabe:e,ise:e,kameyama:e,kawagoe:e,kiho:e,kisosaki:e,kiwa:e,komono:e,kumano:e,kuwana:e,matsusaka:e,meiwa:e,mihama:e,minamiise:e,misugi:e,miyama:e,nabari:e,shima:e,suzuka:e,tado:e,taiki:e,taki:e,tamaki:e,toba:e,tsu:e,udono:e,ureshino:e,watarai:e,yokkaichi:e}],miyagi:[1,{furukawa:e,higashimatsushima:e,ishinomaki:e,iwanuma:e,kakuda:e,kami:e,kawasaki:e,marumori:e,matsushima:e,minamisanriku:e,misato:e,murata:e,natori:e,ogawara:e,ohira:e,onagawa:e,osaki:e,rifu:e,semine:e,shibata:e,shichikashuku:e,shikama:e,shiogama:e,shiroishi:e,tagajo:e,taiwa:e,tome:e,tomiya:e,wakuya:e,watari:e,yamamoto:e,zao:e}],miyazaki:[1,{aya:e,ebino:e,gokase:e,hyuga:e,kadogawa:e,kawaminami:e,kijo:e,kitagawa:e,kitakata:e,kitaura:e,kobayashi:e,kunitomi:e,kushima:e,mimata:e,miyakonojo:e,miyazaki:e,morotsuka:e,nichinan:e,nishimera:e,nobeoka:e,saito:e,shiiba:e,shintomi:e,takaharu:e,takanabe:e,takazaki:e,tsuno:e}],nagano:[1,{achi:e,agematsu:e,anan:e,aoki:e,asahi:e,azumino:e,chikuhoku:e,chikuma:e,chino:e,fujimi:e,hakuba:e,hara:e,hiraya:e,iida:e,iijima:e,iiyama:e,iizuna:e,ikeda:e,ikusaka:e,ina:e,karuizawa:e,kawakami:e,kiso:e,kisofukushima:e,kitaaiki:e,komagane:e,komoro:e,matsukawa:e,matsumoto:e,miasa:e,minamiaiki:e,minamimaki:e,minamiminowa:e,minowa:e,miyada:e,miyota:e,mochizuki:e,nagano:e,nagawa:e,nagiso:e,nakagawa:e,nakano:e,nozawaonsen:e,obuse:e,ogawa:e,okaya:e,omachi:e,omi:e,ookuwa:e,ooshika:e,otaki:e,otari:e,sakae:e,sakaki:e,saku:e,sakuho:e,shimosuwa:e,shinanomachi:e,shiojiri:e,suwa:e,suzaka:e,takagi:e,takamori:e,takayama:e,tateshina:e,tatsuno:e,togakushi:e,togura:e,tomi:e,ueda:e,wada:e,yamagata:e,yamanouchi:e,yasaka:e,yasuoka:e}],nagasaki:[1,{chijiwa:e,futsu:e,goto:e,hasami:e,hirado:e,iki:e,isahaya:e,kawatana:e,kuchinotsu:e,matsuura:e,nagasaki:e,obama:e,omura:e,oseto:e,saikai:e,sasebo:e,seihi:e,shimabara:e,shinkamigoto:e,togitsu:e,tsushima:e,unzen:e}],nara:[1,{ando:e,gose:e,heguri:e,higashiyoshino:e,ikaruga:e,ikoma:e,kamikitayama:e,kanmaki:e,kashiba:e,kashihara:e,katsuragi:e,kawai:e,kawakami:e,kawanishi:e,koryo:e,kurotaki:e,mitsue:e,miyake:e,nara:e,nosegawa:e,oji:e,ouda:e,oyodo:e,sakurai:e,sango:e,shimoichi:e,shimokitayama:e,shinjo:e,soni:e,takatori:e,tawaramoto:e,tenkawa:e,tenri:e,uda:e,yamatokoriyama:e,yamatotakada:e,yamazoe:e,yoshino:e}],niigata:[1,{aga:e,agano:e,gosen:e,itoigawa:e,izumozaki:e,joetsu:e,kamo:e,kariwa:e,kashiwazaki:e,minamiuonuma:e,mitsuke:e,muika:e,murakami:e,myoko:e,nagaoka:e,niigata:e,ojiya:e,omi:e,sado:e,sanjo:e,seiro:e,seirou:e,sekikawa:e,shibata:e,tagami:e,tainai:e,tochio:e,tokamachi:e,tsubame:e,tsunan:e,uonuma:e,yahiko:e,yoita:e,yuzawa:e}],oita:[1,{beppu:e,bungoono:e,bungotakada:e,hasama:e,hiji:e,himeshima:e,hita:e,kamitsue:e,kokonoe:e,kuju:e,kunisaki:e,kusu:e,oita:e,saiki:e,taketa:e,tsukumi:e,usa:e,usuki:e,yufu:e}],okayama:[1,{akaiwa:e,asakuchi:e,bizen:e,hayashima:e,ibara:e,kagamino:e,kasaoka:e,kibichuo:e,kumenan:e,kurashiki:e,maniwa:e,misaki:e,nagi:e,niimi:e,nishiawakura:e,okayama:e,satosho:e,setouchi:e,shinjo:e,shoo:e,soja:e,takahashi:e,tamano:e,tsuyama:e,wake:e,yakage:e}],okinawa:[1,{aguni:e,ginowan:e,ginoza:e,gushikami:e,haebaru:e,higashi:e,hirara:e,iheya:e,ishigaki:e,ishikawa:e,itoman:e,izena:e,kadena:e,kin:e,kitadaito:e,kitanakagusuku:e,kumejima:e,kunigami:e,minamidaito:e,motobu:e,nago:e,naha:e,nakagusuku:e,nakijin:e,nanjo:e,nishihara:e,ogimi:e,okinawa:e,onna:e,shimoji:e,taketomi:e,tarama:e,tokashiki:e,tomigusuku:e,tonaki:e,urasoe:e,uruma:e,yaese:e,yomitan:e,yonabaru:e,yonaguni:e,zamami:e}],osaka:[1,{abeno:e,chihayaakasaka:e,chuo:e,daito:e,fujiidera:e,habikino:e,hannan:e,higashiosaka:e,higashisumiyoshi:e,higashiyodogawa:e,hirakata:e,ibaraki:e,ikeda:e,izumi:e,izumiotsu:e,izumisano:e,kadoma:e,kaizuka:e,kanan:e,kashiwara:e,katano:e,kawachinagano:e,kishiwada:e,kita:e,kumatori:e,matsubara:e,minato:e,minoh:e,misaki:e,moriguchi:e,neyagawa:e,nishi:e,nose:e,osakasayama:e,sakai:e,sayama:e,sennan:e,settsu:e,shijonawate:e,shimamoto:e,suita:e,tadaoka:e,taishi:e,tajiri:e,takaishi:e,takatsuki:e,tondabayashi:e,toyonaka:e,toyono:e,yao:e}],saga:[1,{ariake:e,arita:e,fukudomi:e,genkai:e,hamatama:e,hizen:e,imari:e,kamimine:e,kanzaki:e,karatsu:e,kashima:e,kitagata:e,kitahata:e,kiyama:e,kouhoku:e,kyuragi:e,nishiarita:e,ogi:e,omachi:e,ouchi:e,saga:e,shiroishi:e,taku:e,tara:e,tosu:e,yoshinogari:e}],saitama:[1,{arakawa:e,asaka:e,chichibu:e,fujimi:e,fujimino:e,fukaya:e,hanno:e,hanyu:e,hasuda:e,hatogaya:e,hatoyama:e,hidaka:e,higashichichibu:e,higashimatsuyama:e,honjo:e,ina:e,iruma:e,iwatsuki:e,kamiizumi:e,kamikawa:e,kamisato:e,kasukabe:e,kawagoe:e,kawaguchi:e,kawajima:e,kazo:e,kitamoto:e,koshigaya:e,kounosu:e,kuki:e,kumagaya:e,matsubushi:e,minano:e,misato:e,miyashiro:e,miyoshi:e,moroyama:e,nagatoro:e,namegawa:e,niiza:e,ogano:e,ogawa:e,ogose:e,okegawa:e,omiya:e,otaki:e,ranzan:e,ryokami:e,saitama:e,sakado:e,satte:e,sayama:e,shiki:e,shiraoka:e,soka:e,sugito:e,toda:e,tokigawa:e,tokorozawa:e,tsurugashima:e,urawa:e,warabi:e,yashio:e,yokoze:e,yono:e,yorii:e,yoshida:e,yoshikawa:e,yoshimi:e}],shiga:[1,{aisho:e,gamo:e,higashiomi:e,hikone:e,koka:e,konan:e,kosei:e,koto:e,kusatsu:e,maibara:e,moriyama:e,nagahama:e,nishiazai:e,notogawa:e,omihachiman:e,otsu:e,ritto:e,ryuoh:e,takashima:e,takatsuki:e,torahime:e,toyosato:e,yasu:e}],shimane:[1,{akagi:e,ama:e,gotsu:e,hamada:e,higashiizumo:e,hikawa:e,hikimi:e,izumo:e,kakinoki:e,masuda:e,matsue:e,misato:e,nishinoshima:e,ohda:e,okinoshima:e,okuizumo:e,shimane:e,tamayu:e,tsuwano:e,unnan:e,yakumo:e,yasugi:e,yatsuka:e}],shizuoka:[1,{arai:e,atami:e,fuji:e,fujieda:e,fujikawa:e,fujinomiya:e,fukuroi:e,gotemba:e,haibara:e,hamamatsu:e,higashiizu:e,ito:e,iwata:e,izu:e,izunokuni:e,kakegawa:e,kannami:e,kawanehon:e,kawazu:e,kikugawa:e,kosai:e,makinohara:e,matsuzaki:e,minamiizu:e,mishima:e,morimachi:e,nishiizu:e,numazu:e,omaezaki:e,shimada:e,shimizu:e,shimoda:e,shizuoka:e,susono:e,yaizu:e,yoshida:e}],tochigi:[1,{ashikaga:e,bato:e,haga:e,ichikai:e,iwafune:e,kaminokawa:e,kanuma:e,karasuyama:e,kuroiso:e,mashiko:e,mibu:e,moka:e,motegi:e,nasu:e,nasushiobara:e,nikko:e,nishikata:e,nogi:e,ohira:e,ohtawara:e,oyama:e,sakura:e,sano:e,shimotsuke:e,shioya:e,takanezawa:e,tochigi:e,tsuga:e,ujiie:e,utsunomiya:e,yaita:e}],tokushima:[1,{aizumi:e,anan:e,ichiba:e,itano:e,kainan:e,komatsushima:e,matsushige:e,mima:e,minami:e,miyoshi:e,mugi:e,nakagawa:e,naruto:e,sanagochi:e,shishikui:e,tokushima:e,wajiki:e}],tokyo:[1,{adachi:e,akiruno:e,akishima:e,aogashima:e,arakawa:e,bunkyo:e,chiyoda:e,chofu:e,chuo:e,edogawa:e,fuchu:e,fussa:e,hachijo:e,hachioji:e,hamura:e,higashikurume:e,higashimurayama:e,higashiyamato:e,hino:e,hinode:e,hinohara:e,inagi:e,itabashi:e,katsushika:e,kita:e,kiyose:e,kodaira:e,koganei:e,kokubunji:e,komae:e,koto:e,kouzushima:e,kunitachi:e,machida:e,meguro:e,minato:e,mitaka:e,mizuho:e,musashimurayama:e,musashino:e,nakano:e,nerima:e,ogasawara:e,okutama:e,ome:e,oshima:e,ota:e,setagaya:e,shibuya:e,shinagawa:e,shinjuku:e,suginami:e,sumida:e,tachikawa:e,taito:e,tama:e,toshima:e}],tottori:[1,{chizu:e,hino:e,kawahara:e,koge:e,kotoura:e,misasa:e,nanbu:e,nichinan:e,sakaiminato:e,tottori:e,wakasa:e,yazu:e,yonago:e}],toyama:[1,{asahi:e,fuchu:e,fukumitsu:e,funahashi:e,himi:e,imizu:e,inami:e,johana:e,kamiichi:e,kurobe:e,nakaniikawa:e,namerikawa:e,nanto:e,nyuzen:e,oyabe:e,taira:e,takaoka:e,tateyama:e,toga:e,tonami:e,toyama:e,unazuki:e,uozu:e,yamada:e}],wakayama:[1,{arida:e,aridagawa:e,gobo:e,hashimoto:e,hidaka:e,hirogawa:e,inami:e,iwade:e,kainan:e,kamitonda:e,katsuragi:e,kimino:e,kinokawa:e,kitayama:e,koya:e,koza:e,kozagawa:e,kudoyama:e,kushimoto:e,mihama:e,misato:e,nachikatsuura:e,shingu:e,shirahama:e,taiji:e,tanabe:e,wakayama:e,yuasa:e,yura:e}],yamagata:[1,{asahi:e,funagata:e,higashine:e,iide:e,kahoku:e,kaminoyama:e,kaneyama:e,kawanishi:e,mamurogawa:e,mikawa:e,murayama:e,nagai:e,nakayama:e,nanyo:e,nishikawa:e,obanazawa:e,oe:e,oguni:e,ohkura:e,oishida:e,sagae:e,sakata:e,sakegawa:e,shinjo:e,shirataka:e,shonai:e,takahata:e,tendo:e,tozawa:e,tsuruoka:e,yamagata:e,yamanobe:e,yonezawa:e,yuza:e}],yamaguchi:[1,{abu:e,hagi:e,hikari:e,hofu:e,iwakuni:e,kudamatsu:e,mitou:e,nagato:e,oshima:e,shimonoseki:e,shunan:e,tabuse:e,tokuyama:e,toyota:e,ube:e,yuu:e}],yamanashi:[1,{chuo:e,doshi:e,fuefuki:e,fujikawa:e,fujikawaguchiko:e,fujiyoshida:e,hayakawa:e,hokuto:e,ichikawamisato:e,kai:e,kofu:e,koshu:e,kosuge:e,"minami-alps":e,minobu:e,nakamichi:e,nanbu:e,narusawa:e,nirasaki:e,nishikatsura:e,oshino:e,otsuki:e,showa:e,tabayama:e,tsuru:e,uenohara:e,yamanakako:e,yamanashi:e}],"xn--ehqz56n":e,三重:e,"xn--1lqs03n":e,京都:e,"xn--qqqt11m":e,佐賀:e,"xn--f6qx53a":e,兵庫:e,"xn--djrs72d6uy":e,北海道:e,"xn--mkru45i":e,千葉:e,"xn--0trq7p7nn":e,和歌山:e,"xn--5js045d":e,埼玉:e,"xn--kbrq7o":e,大分:e,"xn--pssu33l":e,大阪:e,"xn--ntsq17g":e,奈良:e,"xn--uisz3g":e,宮城:e,"xn--6btw5a":e,宮崎:e,"xn--1ctwo":e,富山:e,"xn--6orx2r":e,山口:e,"xn--rht61e":e,山形:e,"xn--rht27z":e,山梨:e,"xn--nit225k":e,岐阜:e,"xn--rht3d":e,岡山:e,"xn--djty4k":e,岩手:e,"xn--klty5x":e,島根:e,"xn--kltx9a":e,広島:e,"xn--kltp7d":e,徳島:e,"xn--c3s14m":e,愛媛:e,"xn--vgu402c":e,愛知:e,"xn--efvn9s":e,新潟:e,"xn--1lqs71d":e,東京:e,"xn--4pvxs":e,栃木:e,"xn--uuwu58a":e,沖縄:e,"xn--zbx025d":e,滋賀:e,"xn--8pvr4u":e,熊本:e,"xn--5rtp49c":e,石川:e,"xn--ntso0iqx3a":e,神奈川:e,"xn--elqq16h":e,福井:e,"xn--4it168d":e,福岡:e,"xn--klt787d":e,福島:e,"xn--rny31h":e,秋田:e,"xn--7t0a264c":e,群馬:e,"xn--uist22h":e,茨城:e,"xn--8ltr62k":e,長崎:e,"xn--2m4a15e":e,長野:e,"xn--32vp30h":e,青森:e,"xn--4it797k":e,静岡:e,"xn--5rtq34k":e,香川:e,"xn--k7yn95e":e,高知:e,"xn--tor131o":e,鳥取:e,"xn--d5qv7z876c":e,鹿児島:e,kawasaki:y,kitakyushu:y,kobe:y,nagoya:y,sapporo:y,sendai:y,yokohama:y,buyshop:t,fashionstore:t,handcrafted:t,kawaiishop:t,supersale:t,theshop:t,"0am":t,"0g0":t,"0j0":t,"0t0":t,mydns:t,pgw:t,wjg:t,usercontent:t,angry:t,babyblue:t,babymilk:t,backdrop:t,bambina:t,bitter:t,blush:t,boo:t,boy:t,boyfriend:t,but:t,candypop:t,capoo:t,catfood:t,cheap:t,chicappa:t,chillout:t,chips:t,chowder:t,chu:t,ciao:t,cocotte:t,coolblog:t,cranky:t,cutegirl:t,daa:t,deca:t,deci:t,digick:t,egoism:t,fakefur:t,fem:t,flier:t,floppy:t,fool:t,frenchkiss:t,girlfriend:t,girly:t,gloomy:t,gonna:t,greater:t,hacca:t,heavy:t,her:t,hiho:t,hippy:t,holy:t,hungry:t,icurus:t,itigo:t,jellybean:t,kikirara:t,kill:t,kilo:t,kuron:t,littlestar:t,lolipopmc:t,lolitapunk:t,lomo:t,lovepop:t,lovesick:t,main:t,mods:t,mond:t,mongolian:t,moo:t,namaste:t,nikita:t,nobushi:t,noor:t,oops:t,parallel:t,parasite:t,pecori:t,peewee:t,penne:t,pepper:t,perma:t,pigboat:t,pinoko:t,punyu:t,pupu:t,pussycat:t,pya:t,raindrop:t,readymade:t,sadist:t,schoolbus:t,secret:t,staba:t,stripper:t,sub:t,sunnyday:t,thick:t,tonkotsu:t,under:t,upper:t,velvet:t,verse:t,versus:t,vivian:t,watson:t,weblike:t,whitesnow:t,zombie:t,hateblo:t,hatenablog:t,hatenadiary:t,"2-d":t,bona:t,crap:t,daynight:t,eek:t,flop:t,halfmoon:t,jeez:t,matrix:t,mimoza:t,netgamers:t,nyanta:t,o0o0:t,rdy:t,rgr:t,rulez:t,sakurastorage:[0,{isk01:be,isk02:be}],saloon:t,sblo:t,skr:t,tank:t,"uh-oh":t,undo:t,webaccel:[0,{rs:t,user:t}],websozai:t,xii:t}],ke:[1,{ac:e,co:e,go:e,info:e,me:e,mobi:e,ne:e,or:e,sc:e}],kg:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,us:t,xx:t,ae:t}],kh:n,ki:xe,km:[1,{ass:e,com:e,edu:e,gov:e,mil:e,nom:e,org:e,prd:e,tm:e,asso:e,coop:e,gouv:e,medecin:e,notaires:e,pharmaciens:e,presse:e,veterinaire:e}],kn:[1,{edu:e,gov:e,net:e,org:e}],kp:[1,{com:e,edu:e,gov:e,org:e,rep:e,tra:e}],kr:[1,{ac:e,ai:e,co:e,es:e,go:e,hs:e,io:e,it:e,kg:e,me:e,mil:e,ms:e,ne:e,or:e,pe:e,re:e,sc:e,busan:e,chungbuk:e,chungnam:e,daegu:e,daejeon:e,gangwon:e,gwangju:e,gyeongbuk:e,gyeonggi:e,gyeongnam:e,incheon:e,jeju:e,jeonbuk:e,jeonnam:e,seoul:e,ulsan:e,c01:t,"eliv-api":t,"eliv-cdn":t,"eliv-dns":t,mmv:t,vki:t}],kw:[1,{com:e,edu:e,emb:e,gov:e,ind:e,net:e,org:e}],ky:le,kz:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,jcloud:t}],la:[1,{com:e,edu:e,gov:e,info:e,int:e,net:e,org:e,per:e,bnr:t}],lb:n,lc:[1,{co:e,com:e,edu:e,gov:e,net:e,org:e,oy:t}],li:e,lk:[1,{ac:e,assn:e,com:e,edu:e,gov:e,grp:e,hotel:e,int:e,ltd:e,net:e,ngo:e,org:e,sch:e,soc:e,web:e}],lr:n,ls:[1,{ac:e,biz:e,co:e,edu:e,gov:e,info:e,net:e,org:e,sc:e}],lt:c,lu:[1,{"123website":t}],lv:[1,{asn:e,com:e,conf:e,edu:e,gov:e,id:e,mil:e,net:e,org:e}],ly:[1,{com:e,edu:e,gov:e,id:e,med:e,net:e,org:e,plc:e,sch:e}],ma:[1,{ac:e,co:e,gov:e,net:e,org:e,press:e}],mc:[1,{asso:e,tm:e}],md:[1,{ir:t}],me:[1,{ac:e,co:e,edu:e,gov:e,its:e,net:e,org:e,priv:e,c66:t,craft:t,edgestack:t,mybox:t,filegear:t,"filegear-sg":t,lohmus:t,barsy:t,mcdir:t,brasilia:t,ddns:t,dnsfor:t,hopto:t,loginto:t,noip:t,webhop:t,soundcast:t,tcp4:t,vp4:t,diskstation:t,dscloud:t,i234:t,myds:t,synology:t,transip:ce,nohost:t}],mg:[1,{co:e,com:e,edu:e,gov:e,mil:e,nom:e,org:e,prd:e}],mh:e,mil:e,mk:[1,{com:e,edu:e,gov:e,inf:e,name:e,net:e,org:e}],ml:[1,{ac:e,art:e,asso:e,com:e,edu:e,gouv:e,gov:e,info:e,inst:e,net:e,org:e,pr:e,presse:e}],mm:y,mn:[1,{edu:e,gov:e,org:e,nyc:t}],mo:n,mobi:[1,{barsy:t,dscloud:t}],mp:[1,{ju:t}],mq:e,mr:c,ms:[1,{com:e,edu:e,gov:e,net:e,org:e,minisite:t}],mt:le,mu:[1,{ac:e,co:e,com:e,gov:e,net:e,or:e,org:e}],museum:e,mv:[1,{aero:e,biz:e,com:e,coop:e,edu:e,gov:e,info:e,int:e,mil:e,museum:e,name:e,net:e,org:e,pro:e}],mw:[1,{ac:e,biz:e,co:e,com:e,coop:e,edu:e,gov:e,int:e,net:e,org:e}],mx:[1,{com:e,edu:e,gob:e,net:e,org:e}],my:[1,{biz:e,com:e,edu:e,gov:e,mil:e,name:e,net:e,org:e}],mz:[1,{ac:e,adv:e,co:e,edu:e,gov:e,mil:e,net:e,org:e}],na:[1,{alt:e,co:e,com:e,gov:e,net:e,org:e}],name:[1,{her:we,his:we,ispmanager:t,keenetic:t}],nc:[1,{asso:e,nom:e}],ne:e,net:[1,{adobeaemcloud:t,"adobeio-static":t,adobeioruntime:t,akadns:t,akamai:t,"akamai-staging":t,akamaiedge:t,"akamaiedge-staging":t,akamaihd:t,"akamaihd-staging":t,akamaiorigin:t,"akamaiorigin-staging":t,akamaized:t,"akamaized-staging":t,edgekey:t,"edgekey-staging":t,edgesuite:t,"edgesuite-staging":t,alwaysdata:t,myamaze:t,cloudfront:t,appudo:t,"atlassian-dev":[0,{prod:ge}],myfritz:t,shopselect:t,blackbaudcdn:t,boomla:t,bplaced:t,square7:t,cdn77:[0,{r:t}],"cdn77-ssl":t,gb:t,hu:t,jp:t,se:t,uk:t,clickrising:t,"ddns-ip":t,"dns-cloud":t,"dns-dynamic":t,cloudaccess:t,cloudflare:[2,{cdn:t}],cloudflareanycast:ge,cloudflarecn:ge,cloudflareglobal:ge,ctfcloud:t,"feste-ip":t,"knx-server":t,"static-access":t,cryptonomic:i,dattolocal:t,mydatto:t,debian:t,definima:t,deno:[2,{sandbox:t}],icp:i,de5:t,"at-band-camp":t,blogdns:t,"broke-it":t,buyshouses:t,dnsalias:t,dnsdojo:t,"does-it":t,dontexist:t,dynalias:t,dynathome:t,endofinternet:t,"from-az":t,"from-co":t,"from-la":t,"from-ny":t,"gets-it":t,"ham-radio-op":t,homeftp:t,homeip:t,homelinux:t,homeunix:t,"in-the-band":t,"is-a-chef":t,"is-a-geek":t,"isa-geek":t,"kicks-ass":t,"office-on-the":t,podzone:t,"scrapper-site":t,selfip:t,"sells-it":t,servebbs:t,serveftp:t,thruhere:t,webhop:t,casacam:t,dynu:t,dynuddns:t,mysynology:t,opik:t,spryt:t,dynv6:t,twmail:t,ru:t,channelsdvr:[2,{u:t}],fastly:[0,{freetls:t,map:t,prod:[0,{a:t,global:t}],ssl:[0,{a:t,b:t,global:t}]}],fastlylb:[2,{map:t}],"keyword-on":t,"live-on":t,"server-on":t,"cdn-edges":t,heteml:t,cloudfunctions:t,"grafana-dev":t,iobb:t,moonscale:t,"in-dsl":t,"in-vpn":t,oninferno:t,botdash:t,"apps-1and1":t,ipifony:t,cloudjiffy:[2,{"fra1-de":t,"west1-us":t}],elastx:[0,{"jls-sto1":t,"jls-sto2":t,"jls-sto3":t}],massivegrid:[0,{paas:[0,{"fr-1":t,"lon-1":t,"lon-2":t,"ny-1":t,"ny-2":t,"sg-1":t}]}],saveincloud:[0,{jelastic:t,"nordeste-idc":t}],scaleforce:L,kinghost:t,uni5:t,krellian:t,ggff:t,localto:i,barsy:t,luyani:t,memset:t,"azure-api":t,"azure-mobile":t,azureedge:t,azurefd:t,azurestaticapps:[2,{1:t,2:t,3:t,4:t,5:t,6:t,7:t,centralus:t,eastasia:t,eastus2:t,westeurope:t,westus2:t}],azurewebsites:t,cloudapp:t,trafficmanager:t,usgovcloudapi:Te,usgovcloudapp:t,usgovtrafficmanager:t,windows:Te,mynetname:[0,{sn:t}],routingthecloud:t,bounceme:t,ddns:t,"eating-organic":t,mydissent:t,myeffect:t,mymediapc:t,mypsx:t,mysecuritycamera:t,nhlfan:t,"no-ip":t,pgafan:t,privatizehealthinsurance:t,redirectme:t,serveblog:t,serveminecraft:t,sytes:t,dnsup:t,hicam:t,"now-dns":t,ownip:t,vpndns:t,cloudycluster:t,ovh:[0,{hosting:i,webpaas:i}],rackmaze:t,myradweb:t,in:t,"subsc-pay":t,squares:t,schokokeks:t,"firewall-gateway":t,seidat:t,senseering:t,siteleaf:t,mafelo:t,myspreadshop:t,"vps-host":[2,{jelastic:[0,{atl:t,njs:t,ric:t}]}],srcf:[0,{soc:t,user:t}],supabase:t,dsmynas:t,familyds:t,ts:[2,{c:i}],torproject:[2,{pages:t}],tunnelmole:t,vusercontent:t,"reserve-online":t,localcert:t,"community-pro":t,meinforum:t,yandexcloud:[2,{storage:t,website:t}],za:t,zabc:t}],nf:[1,{arts:e,com:e,firm:e,info:e,net:e,other:e,per:e,rec:e,store:e,web:e}],ng:[1,{com:e,edu:e,gov:e,i:e,mil:e,mobi:e,name:e,net:e,org:e,sch:e,biz:[2,{co:t,dl:t,go:t,lg:t,on:t}],col:t,firm:t,gen:t,ltd:t,ngo:t,plc:t}],ni:[1,{ac:e,biz:e,co:e,com:e,edu:e,gob:e,in:e,info:e,int:e,mil:e,net:e,nom:e,org:e,web:e}],nl:[1,{co:t,"hosting-cluster":t,gov:t,khplay:t,"123website":t,myspreadshop:t,transurl:i,cistron:t,demon:t}],no:[1,{fhs:e,folkebibl:e,fylkesbibl:e,idrett:e,museum:e,priv:e,vgs:e,dep:e,herad:e,kommune:e,mil:e,stat:e,aa:Ee,ah:Ee,bu:Ee,fm:Ee,hl:Ee,hm:Ee,"jan-mayen":Ee,mr:Ee,nl:Ee,nt:Ee,of:Ee,ol:Ee,oslo:Ee,rl:Ee,sf:Ee,st:Ee,svalbard:Ee,tm:Ee,tr:Ee,va:Ee,vf:Ee,akrehamn:e,"xn--krehamn-dxa":e,åkrehamn:e,algard:e,"xn--lgrd-poac":e,ålgård:e,arna:e,bronnoysund:e,"xn--brnnysund-m8ac":e,brønnøysund:e,brumunddal:e,bryne:e,drobak:e,"xn--drbak-wua":e,drøbak:e,egersund:e,fetsund:e,floro:e,"xn--flor-jra":e,florø:e,fredrikstad:e,hokksund:e,honefoss:e,"xn--hnefoss-q1a":e,hønefoss:e,jessheim:e,jorpeland:e,"xn--jrpeland-54a":e,jørpeland:e,kirkenes:e,kopervik:e,krokstadelva:e,langevag:e,"xn--langevg-jxa":e,langevåg:e,leirvik:e,mjondalen:e,"xn--mjndalen-64a":e,mjøndalen:e,"mo-i-rana":e,mosjoen:e,"xn--mosjen-eya":e,mosjøen:e,nesoddtangen:e,orkanger:e,osoyro:e,"xn--osyro-wua":e,osøyro:e,raholt:e,"xn--rholt-mra":e,råholt:e,sandnessjoen:e,"xn--sandnessjen-ogb":e,sandnessjøen:e,skedsmokorset:e,slattum:e,spjelkavik:e,stathelle:e,stavern:e,stjordalshalsen:e,"xn--stjrdalshalsen-sqb":e,stjørdalshalsen:e,tananger:e,tranby:e,vossevangen:e,aarborte:e,aejrie:e,afjord:e,"xn--fjord-lra":e,åfjord:e,agdenes:e,akershus:De,aknoluokta:e,"xn--koluokta-7ya57h":e,ákŋoluokta:e,al:e,"xn--l-1fa":e,ål:e,alaheadju:e,"xn--laheadju-7ya":e,álaheadju:e,alesund:e,"xn--lesund-hua":e,ålesund:e,alstahaug:e,alta:e,"xn--lt-liac":e,áltá:e,alvdal:e,amli:e,"xn--mli-tla":e,åmli:e,amot:e,"xn--mot-tla":e,åmot:e,andasuolo:e,andebu:e,andoy:e,"xn--andy-ira":e,andøy:e,ardal:e,"xn--rdal-poa":e,årdal:e,aremark:e,arendal:e,"xn--s-1fa":e,ås:e,aseral:e,"xn--seral-lra":e,åseral:e,asker:e,askim:e,askoy:e,"xn--asky-ira":e,askøy:e,askvoll:e,asnes:e,"xn--snes-poa":e,åsnes:e,audnedaln:e,aukra:e,aure:e,aurland:e,"aurskog-holand":e,"xn--aurskog-hland-jnb":e,"aurskog-høland":e,austevoll:e,austrheim:e,averoy:e,"xn--avery-yua":e,averøy:e,badaddja:e,"xn--bdddj-mrabd":e,bådåddjå:e,"xn--brum-voa":e,bærum:e,bahcavuotna:e,"xn--bhcavuotna-s4a":e,báhcavuotna:e,bahccavuotna:e,"xn--bhccavuotna-k7a":e,báhccavuotna:e,baidar:e,"xn--bidr-5nac":e,báidár:e,bajddar:e,"xn--bjddar-pta":e,bájddar:e,balat:e,"xn--blt-elab":e,bálát:e,balestrand:e,ballangen:e,balsfjord:e,bamble:e,bardu:e,barum:e,batsfjord:e,"xn--btsfjord-9za":e,båtsfjord:e,bearalvahki:e,"xn--bearalvhki-y4a":e,bearalváhki:e,beardu:e,beiarn:e,berg:e,bergen:e,berlevag:e,"xn--berlevg-jxa":e,berlevåg:e,bievat:e,"xn--bievt-0qa":e,bievát:e,bindal:e,birkenes:e,bjerkreim:e,bjugn:e,bodo:e,"xn--bod-2na":e,bodø:e,bokn:e,bomlo:e,"xn--bmlo-gra":e,bømlo:e,bremanger:e,bronnoy:e,"xn--brnny-wuac":e,brønnøy:e,budejju:e,buskerud:De,bygland:e,bykle:e,cahcesuolo:e,"xn--hcesuolo-7ya35b":e,čáhcesuolo:e,davvenjarga:e,"xn--davvenjrga-y4a":e,davvenjárga:e,davvesiida:e,deatnu:e,dielddanuorri:e,divtasvuodna:e,divttasvuotna:e,donna:e,"xn--dnna-gra":e,dønna:e,dovre:e,drammen:e,drangedal:e,dyroy:e,"xn--dyry-ira":e,dyrøy:e,eid:e,eidfjord:e,eidsberg:e,eidskog:e,eidsvoll:e,eigersund:e,elverum:e,enebakk:e,engerdal:e,etne:e,etnedal:e,evenassi:e,"xn--eveni-0qa01ga":e,evenášši:e,evenes:e,"evje-og-hornnes":e,farsund:e,fauske:e,fedje:e,fet:e,finnoy:e,"xn--finny-yua":e,finnøy:e,fitjar:e,fjaler:e,fjell:e,fla:e,"xn--fl-zia":e,flå:e,flakstad:e,flatanger:e,flekkefjord:e,flesberg:e,flora:e,folldal:e,forde:e,"xn--frde-gra":e,førde:e,forsand:e,fosnes:e,"xn--frna-woa":e,fræna:e,frana:e,frei:e,frogn:e,froland:e,frosta:e,froya:e,"xn--frya-hra":e,frøya:e,fuoisku:e,fuossko:e,fusa:e,fyresdal:e,gaivuotna:e,"xn--givuotna-8ya":e,gáivuotna:e,galsa:e,"xn--gls-elac":e,gálsá:e,gamvik:e,gangaviika:e,"xn--ggaviika-8ya47h":e,gáŋgaviika:e,gaular:e,gausdal:e,giehtavuoatna:e,gildeskal:e,"xn--gildeskl-g0a":e,gildeskål:e,giske:e,gjemnes:e,gjerdrum:e,gjerstad:e,gjesdal:e,gjovik:e,"xn--gjvik-wua":e,gjøvik:e,gloppen:e,gol:e,gran:e,grane:e,granvin:e,gratangen:e,grimstad:e,grong:e,grue:e,gulen:e,guovdageaidnu:e,ha:e,"xn--h-2fa":e,hå:e,habmer:e,"xn--hbmer-xqa":e,hábmer:e,hadsel:e,"xn--hgebostad-g3a":e,hægebostad:e,hagebostad:e,halden:e,halsa:e,hamar:e,hamaroy:e,hammarfeasta:e,"xn--hmmrfeasta-s4ac":e,hámmárfeasta:e,hammerfest:e,hapmir:e,"xn--hpmir-xqa":e,hápmir:e,haram:e,hareid:e,harstad:e,hasvik:e,hattfjelldal:e,haugesund:e,hedmark:[0,{os:e,valer:e,"xn--vler-qoa":e,våler:e}],hemne:e,hemnes:e,hemsedal:e,hitra:e,hjartdal:e,hjelmeland:e,hobol:e,"xn--hobl-ira":e,hobøl:e,hof:e,hol:e,hole:e,holmestrand:e,holtalen:e,"xn--holtlen-hxa":e,holtålen:e,hordaland:[0,{os:e}],hornindal:e,horten:e,hoyanger:e,"xn--hyanger-q1a":e,høyanger:e,hoylandet:e,"xn--hylandet-54a":e,høylandet:e,hurdal:e,hurum:e,hvaler:e,hyllestad:e,ibestad:e,inderoy:e,"xn--indery-fya":e,inderøy:e,iveland:e,ivgu:e,jevnaker:e,jolster:e,"xn--jlster-bya":e,jølster:e,jondal:e,kafjord:e,"xn--kfjord-iua":e,kåfjord:e,karasjohka:e,"xn--krjohka-hwab49j":e,kárášjohka:e,karasjok:e,karlsoy:e,karmoy:e,"xn--karmy-yua":e,karmøy:e,kautokeino:e,klabu:e,"xn--klbu-woa":e,klæbu:e,klepp:e,kongsberg:e,kongsvinger:e,kraanghke:e,"xn--kranghke-b0a":e,kråanghke:e,kragero:e,"xn--krager-gya":e,kragerø:e,kristiansand:e,kristiansund:e,krodsherad:e,"xn--krdsherad-m8a":e,krødsherad:e,"xn--kvfjord-nxa":e,kvæfjord:e,"xn--kvnangen-k0a":e,kvænangen:e,kvafjord:e,kvalsund:e,kvam:e,kvanangen:e,kvinesdal:e,kvinnherad:e,kviteseid:e,kvitsoy:e,"xn--kvitsy-fya":e,kvitsøy:e,laakesvuemie:e,"xn--lrdal-sra":e,lærdal:e,lahppi:e,"xn--lhppi-xqa":e,láhppi:e,lardal:e,larvik:e,lavagis:e,lavangen:e,leangaviika:e,"xn--leagaviika-52b":e,leaŋgaviika:e,lebesby:e,leikanger:e,leirfjord:e,leka:e,leksvik:e,lenvik:e,lerdal:e,lesja:e,levanger:e,lier:e,lierne:e,lillehammer:e,lillesand:e,lindas:e,"xn--linds-pra":e,lindås:e,lindesnes:e,loabat:e,"xn--loabt-0qa":e,loabát:e,lodingen:e,"xn--ldingen-q1a":e,lødingen:e,lom:e,loppa:e,lorenskog:e,"xn--lrenskog-54a":e,lørenskog:e,loten:e,"xn--lten-gra":e,løten:e,lund:e,lunner:e,luroy:e,"xn--lury-ira":e,lurøy:e,luster:e,lyngdal:e,lyngen:e,malatvuopmi:e,"xn--mlatvuopmi-s4a":e,málatvuopmi:e,malselv:e,"xn--mlselv-iua":e,målselv:e,malvik:e,mandal:e,marker:e,marnardal:e,masfjorden:e,masoy:e,"xn--msy-ula0h":e,måsøy:e,"matta-varjjat":e,"xn--mtta-vrjjat-k7af":e,"mátta-várjjat":e,meland:e,meldal:e,melhus:e,meloy:e,"xn--mely-ira":e,meløy:e,meraker:e,"xn--merker-kua":e,meråker:e,midsund:e,"midtre-gauldal":e,moareke:e,"xn--moreke-jua":e,moåreke:e,modalen:e,modum:e,molde:e,"more-og-romsdal":[0,{heroy:e,sande:e}],"xn--mre-og-romsdal-qqb":[0,{"xn--hery-ira":e,sande:e}],"møre-og-romsdal":[0,{herøy:e,sande:e}],moskenes:e,moss:e,muosat:e,"xn--muost-0qa":e,muosát:e,naamesjevuemie:e,"xn--nmesjevuemie-tcba":e,nååmesjevuemie:e,"xn--nry-yla5g":e,nærøy:e,namdalseid:e,namsos:e,namsskogan:e,nannestad:e,naroy:e,narviika:e,narvik:e,naustdal:e,navuotna:e,"xn--nvuotna-hwa":e,návuotna:e,"nedre-eiker":e,nesna:e,nesodden:e,nesseby:e,nesset:e,nissedal:e,nittedal:e,"nord-aurdal":e,"nord-fron":e,"nord-odal":e,norddal:e,nordkapp:e,nordland:[0,{bo:e,"xn--b-5ga":e,bø:e,heroy:e,"xn--hery-ira":e,herøy:e}],"nordre-land":e,nordreisa:e,"nore-og-uvdal":e,notodden:e,notteroy:e,"xn--nttery-byae":e,nøtterøy:e,odda:e,oksnes:e,"xn--ksnes-uua":e,øksnes:e,omasvuotna:e,oppdal:e,oppegard:e,"xn--oppegrd-ixa":e,oppegård:e,orkdal:e,orland:e,"xn--rland-uua":e,ørland:e,orskog:e,"xn--rskog-uua":e,ørskog:e,orsta:e,"xn--rsta-fra":e,ørsta:e,osen:e,osteroy:e,"xn--ostery-fya":e,osterøy:e,ostfold:[0,{valer:e}],"xn--stfold-9xa":[0,{"xn--vler-qoa":e}],østfold:[0,{våler:e}],"ostre-toten":e,"xn--stre-toten-zcb":e,"østre-toten":e,overhalla:e,"ovre-eiker":e,"xn--vre-eiker-k8a":e,"øvre-eiker":e,oyer:e,"xn--yer-zna":e,øyer:e,oygarden:e,"xn--ygarden-p1a":e,øygarden:e,"oystre-slidre":e,"xn--ystre-slidre-ujb":e,"øystre-slidre":e,porsanger:e,porsangu:e,"xn--porsgu-sta26f":e,porsáŋgu:e,porsgrunn:e,rade:e,"xn--rde-ula":e,råde:e,radoy:e,"xn--rady-ira":e,radøy:e,"xn--rlingen-mxa":e,rælingen:e,rahkkeravju:e,"xn--rhkkervju-01af":e,ráhkkerávju:e,raisa:e,"xn--risa-5na":e,ráisa:e,rakkestad:e,ralingen:e,rana:e,randaberg:e,rauma:e,rendalen:e,rennebu:e,rennesoy:e,"xn--rennesy-v1a":e,rennesøy:e,rindal:e,ringebu:e,ringerike:e,ringsaker:e,risor:e,"xn--risr-ira":e,risør:e,rissa:e,roan:e,rodoy:e,"xn--rdy-0nab":e,rødøy:e,rollag:e,romsa:e,romskog:e,"xn--rmskog-bya":e,rømskog:e,roros:e,"xn--rros-gra":e,røros:e,rost:e,"xn--rst-0na":e,røst:e,royken:e,"xn--ryken-vua":e,røyken:e,royrvik:e,"xn--ryrvik-bya":e,røyrvik:e,ruovat:e,rygge:e,salangen:e,salat:e,"xn--slat-5na":e,sálat:e,"xn--slt-elab":e,sálát:e,saltdal:e,samnanger:e,sandefjord:e,sandnes:e,sandoy:e,"xn--sandy-yua":e,sandøy:e,sarpsborg:e,sauda:e,sauherad:e,sel:e,selbu:e,selje:e,seljord:e,siellak:e,sigdal:e,siljan:e,sirdal:e,skanit:e,"xn--sknit-yqa":e,skánit:e,skanland:e,"xn--sknland-fxa":e,skånland:e,skaun:e,skedsmo:e,ski:e,skien:e,skierva:e,"xn--skierv-uta":e,skiervá:e,skiptvet:e,skjak:e,"xn--skjk-soa":e,skjåk:e,skjervoy:e,"xn--skjervy-v1a":e,skjervøy:e,skodje:e,smola:e,"xn--smla-hra":e,smøla:e,snaase:e,"xn--snase-nra":e,snåase:e,snasa:e,"xn--snsa-roa":e,snåsa:e,snillfjord:e,snoasa:e,sogndal:e,sogne:e,"xn--sgne-gra":e,søgne:e,sokndal:e,sola:e,solund:e,somna:e,"xn--smna-gra":e,sømna:e,"sondre-land":e,"xn--sndre-land-0cb":e,"søndre-land":e,songdalen:e,"sor-aurdal":e,"xn--sr-aurdal-l8a":e,"sør-aurdal":e,"sor-fron":e,"xn--sr-fron-q1a":e,"sør-fron":e,"sor-odal":e,"xn--sr-odal-q1a":e,"sør-odal":e,"sor-varanger":e,"xn--sr-varanger-ggb":e,"sør-varanger":e,sorfold:e,"xn--srfold-bya":e,sørfold:e,sorreisa:e,"xn--srreisa-q1a":e,sørreisa:e,sortland:e,sorum:e,"xn--srum-gra":e,sørum:e,spydeberg:e,stange:e,stavanger:e,steigen:e,steinkjer:e,stjordal:e,"xn--stjrdal-s1a":e,stjørdal:e,stokke:e,"stor-elvdal":e,stord:e,stordal:e,storfjord:e,strand:e,stranda:e,stryn:e,sula:e,suldal:e,sund:e,sunndal:e,surnadal:e,sveio:e,svelvik:e,sykkylven:e,tana:e,telemark:[0,{bo:e,"xn--b-5ga":e,bø:e}],time:e,tingvoll:e,tinn:e,tjeldsund:e,tjome:e,"xn--tjme-hra":e,tjøme:e,tokke:e,tolga:e,tonsberg:e,"xn--tnsberg-q1a":e,tønsberg:e,torsken:e,"xn--trna-woa":e,træna:e,trana:e,tranoy:e,"xn--trany-yua":e,tranøy:e,troandin:e,trogstad:e,"xn--trgstad-r1a":e,trøgstad:e,tromsa:e,tromso:e,"xn--troms-zua":e,tromsø:e,trondheim:e,trysil:e,tvedestrand:e,tydal:e,tynset:e,tysfjord:e,tysnes:e,"xn--tysvr-vra":e,tysvær:e,tysvar:e,ullensaker:e,ullensvang:e,ulvik:e,unjarga:e,"xn--unjrga-rta":e,unjárga:e,utsira:e,vaapste:e,vadso:e,"xn--vads-jra":e,vadsø:e,"xn--vry-yla5g":e,værøy:e,vaga:e,"xn--vg-yiab":e,vågå:e,vagan:e,"xn--vgan-qoa":e,vågan:e,vagsoy:e,"xn--vgsy-qoa0j":e,vågsøy:e,vaksdal:e,valle:e,vang:e,vanylven:e,vardo:e,"xn--vard-jra":e,vardø:e,varggat:e,"xn--vrggt-xqad":e,várggát:e,varoy:e,vefsn:e,vega:e,vegarshei:e,"xn--vegrshei-c0a":e,vegårshei:e,vennesla:e,verdal:e,verran:e,vestby:e,vestfold:[0,{sande:e}],vestnes:e,"vestre-slidre":e,"vestre-toten":e,vestvagoy:e,"xn--vestvgy-ixa6o":e,vestvågøy:e,vevelstad:e,vik:e,vikna:e,vindafjord:e,voagat:e,volda:e,voss:e,co:t,"123hjemmeside":t,myspreadshop:t}],np:y,nr:xe,nu:[1,{merseine:t,mine:t,shacknet:t,enterprisecloud:t}],nz:[1,{ac:e,co:e,cri:e,geek:e,gen:e,govt:e,health:e,iwi:e,kiwi:e,maori:e,"xn--mori-qsa":e,māori:e,mil:e,net:e,org:e,parliament:e,school:e,cloudns:t}],om:[1,{co:e,com:e,edu:e,gov:e,med:e,museum:e,net:e,org:e,pro:e}],onion:e,org:[1,{altervista:t,pimienta:t,poivron:t,potager:t,sweetpepper:t,cdn77:[0,{c:t,rsc:t}],"cdn77-secure":[0,{origin:[0,{ssl:t}]}],ae:t,cloudns:t,"ip-dynamic":t,ddnss:t,dpdns:t,duckdns:t,tunk:t,blogdns:t,blogsite:t,boldlygoingnowhere:t,dnsalias:t,dnsdojo:t,doesntexist:t,dontexist:t,doomdns:t,dvrdns:t,dynalias:t,dyndns:[2,{go:t,home:t}],endofinternet:t,endoftheinternet:t,"from-me":t,"game-host":t,gotdns:t,"hobby-site":t,homedns:t,homeftp:t,homelinux:t,homeunix:t,"is-a-bruinsfan":t,"is-a-candidate":t,"is-a-celticsfan":t,"is-a-chef":t,"is-a-geek":t,"is-a-knight":t,"is-a-linux-user":t,"is-a-patsfan":t,"is-a-soxfan":t,"is-found":t,"is-lost":t,"is-saved":t,"is-very-bad":t,"is-very-evil":t,"is-very-good":t,"is-very-nice":t,"is-very-sweet":t,"isa-geek":t,"kicks-ass":t,misconfused:t,podzone:t,readmyblog:t,selfip:t,sellsyourhome:t,servebbs:t,serveftp:t,servegame:t,"stuff-4-sale":t,webhop:t,accesscam:t,camdvr:t,freeddns:t,mywire:t,roxa:t,webredirect:t,twmail:t,eu:[2,{al:t,asso:t,at:t,au:t,be:t,bg:t,ca:t,cd:t,ch:t,cn:t,cy:t,cz:t,de:t,dk:t,edu:t,ee:t,es:t,fi:t,fr:t,gr:t,hr:t,hu:t,ie:t,il:t,in:t,int:t,is:t,it:t,jp:t,kr:t,lt:t,lu:t,lv:t,me:t,mk:t,mt:t,my:t,net:t,ng:t,nl:t,no:t,nz:t,pl:t,pt:t,ro:t,ru:t,se:t,si:t,sk:t,tr:t,uk:t,us:t}],fedorainfracloud:t,fedorapeople:t,fedoraproject:[0,{cloud:t,os:se,stg:[0,{os:se}]}],freedesktop:t,hatenadiary:t,hepforge:t,"in-dsl":t,"in-vpn":t,js:t,barsy:t,mayfirst:t,routingthecloud:t,bmoattachments:t,"cable-modem":t,collegefan:t,couchpotatofries:t,hopto:t,mlbfan:t,myftp:t,mysecuritycamera:t,nflfan:t,"no-ip":t,"read-books":t,ufcfan:t,zapto:t,dynserv:t,"now-dns":t,"is-local":t,httpbin:t,pubtls:t,jpn:t,"my-firewall":t,myfirewall:t,spdns:t,"small-web":t,dsmynas:t,familyds:t,teckids:be,tuxfamily:t,hk:t,us:t,toolforge:t,wmcloud:[2,{beta:t}],wmflabs:t,za:t}],pa:[1,{abo:e,ac:e,com:e,edu:e,gob:e,ing:e,med:e,net:e,nom:e,org:e,sld:e}],pe:[1,{com:e,edu:e,gob:e,mil:e,net:e,nom:e,org:e}],pf:[1,{com:e,edu:e,org:e}],pg:y,ph:[1,{com:e,edu:e,gov:e,i:e,mil:e,net:e,ngo:e,org:e,cloudns:t}],pk:[1,{ac:e,biz:e,com:e,edu:e,fam:e,gkp:e,gob:e,gog:e,gok:e,gop:e,gos:e,gov:e,net:e,org:e,web:e}],pl:[1,{com:e,net:e,org:e,agro:e,aid:e,atm:e,auto:e,biz:e,edu:e,gmina:e,gsm:e,info:e,mail:e,media:e,miasta:e,mil:e,nieruchomosci:e,nom:e,pc:e,powiat:e,priv:e,realestate:e,rel:e,sex:e,shop:e,sklep:e,sos:e,szkola:e,targi:e,tm:e,tourism:e,travel:e,turystyka:e,gov:[1,{ap:e,griw:e,ic:e,is:e,kmpsp:e,konsulat:e,kppsp:e,kwp:e,kwpsp:e,mup:e,mw:e,oia:e,oirm:e,oke:e,oow:e,oschr:e,oum:e,pa:e,pinb:e,piw:e,po:e,pr:e,psp:e,psse:e,pup:e,rzgw:e,sa:e,sdn:e,sko:e,so:e,sr:e,starostwo:e,ug:e,ugim:e,um:e,umig:e,upow:e,uppo:e,us:e,uw:e,uzs:e,wif:e,wiih:e,winb:e,wios:e,witd:e,wiw:e,wkz:e,wsa:e,wskr:e,wsse:e,wuoz:e,wzmiuw:e,zp:e,zpisdn:e}],augustow:e,"babia-gora":e,bedzin:e,beskidy:e,bialowieza:e,bialystok:e,bielawa:e,bieszczady:e,boleslawiec:e,bydgoszcz:e,bytom:e,cieszyn:e,czeladz:e,czest:e,dlugoleka:e,elblag:e,elk:e,glogow:e,gniezno:e,gorlice:e,grajewo:e,ilawa:e,jaworzno:e,"jelenia-gora":e,jgora:e,kalisz:e,karpacz:e,kartuzy:e,kaszuby:e,katowice:e,"kazimierz-dolny":e,kepno:e,ketrzyn:e,klodzko:e,kobierzyce:e,kolobrzeg:e,konin:e,konskowola:e,kutno:e,lapy:e,lebork:e,legnica:e,lezajsk:e,limanowa:e,lomza:e,lowicz:e,lubin:e,lukow:e,malbork:e,malopolska:e,mazowsze:e,mazury:e,mielec:e,mielno:e,mragowo:e,naklo:e,nowaruda:e,nysa:e,olawa:e,olecko:e,olkusz:e,olsztyn:e,opoczno:e,opole:e,ostroda:e,ostroleka:e,ostrowiec:e,ostrowwlkp:e,pila:e,pisz:e,podhale:e,podlasie:e,polkowice:e,pomorskie:e,pomorze:e,prochowice:e,pruszkow:e,przeworsk:e,pulawy:e,radom:e,"rawa-maz":e,rybnik:e,rzeszow:e,sanok:e,sejny:e,skoczow:e,slask:e,slupsk:e,sosnowiec:e,"stalowa-wola":e,starachowice:e,stargard:e,suwalki:e,swidnica:e,swiebodzin:e,swinoujscie:e,szczecin:e,szczytno:e,tarnobrzeg:e,tgory:e,turek:e,tychy:e,ustka:e,walbrzych:e,warmia:e,warszawa:e,waw:e,wegrow:e,wielun:e,wlocl:e,wloclawek:e,wodzislaw:e,wolomin:e,wroclaw:e,zachpomor:e,zagan:e,zarow:e,zgora:e,zgorzelec:e,art:t,gliwice:t,krakow:t,poznan:t,wroc:t,zakopane:t,beep:t,"ecommerce-shop":t,cfolks:t,dfirma:t,dkonto:t,you2:t,shoparena:t,homesklep:t,sdscloud:t,unicloud:t,lodz:t,pabianice:t,plock:t,sieradz:t,skierniewice:t,zgierz:t,krasnik:t,leczna:t,lubartow:t,lublin:t,poniatowa:t,swidnik:t,co:t,torun:t,simplesite:t,myspreadshop:t,gda:t,gdansk:t,gdynia:t,med:t,sopot:t,bielsko:t}],pm:[1,{own:t,name:t}],pn:[1,{co:e,edu:e,gov:e,net:e,org:e}],post:e,pr:[1,{biz:e,com:e,edu:e,gov:e,info:e,isla:e,name:e,net:e,org:e,pro:e,ac:e,est:e,prof:e}],pro:[1,{aaa:e,aca:e,acct:e,avocat:e,bar:e,cpa:e,eng:e,jur:e,law:e,med:e,recht:e,cloudns:t,keenetic:t,barsy:t,ngrok:t}],ps:[1,{com:e,edu:e,gov:e,net:e,org:e,plo:e,sec:e}],pt:[1,{com:e,edu:e,gov:e,int:e,net:e,nome:e,org:e,publ:e,"123paginaweb":t}],pw:[1,{gov:e,cloudns:t,x443:t}],py:[1,{com:e,coop:e,edu:e,gov:e,mil:e,net:e,org:e}],qa:[1,{com:e,edu:e,gov:e,mil:e,name:e,net:e,org:e,sch:e}],re:[1,{asso:e,com:e,netlib:t,can:t}],ro:[1,{arts:e,com:e,firm:e,info:e,nom:e,nt:e,org:e,rec:e,store:e,tm:e,www:e,co:t,shop:t,barsy:t}],rs:[1,{ac:e,co:e,edu:e,gov:e,in:e,org:e,brendly:v,barsy:t,ox:t}],ru:[1,{ac:t,edu:t,gov:t,int:t,mil:t,eurodir:t,adygeya:t,bashkiria:t,bir:t,cbg:t,com:t,dagestan:t,grozny:t,kalmykia:t,kustanai:t,marine:t,mordovia:t,msk:t,mytis:t,nalchik:t,nov:t,pyatigorsk:t,spb:t,vladikavkaz:t,vladimir:t,na4u:t,mircloud:t,myjino:[2,{hosting:i,landing:i,spectrum:i,vps:i}],cldmail:[0,{hb:t}],mcdir:[2,{vps:t}],mcpre:t,net:t,org:t,pp:t,ras:t}],rw:[1,{ac:e,co:e,coop:e,gov:e,mil:e,net:e,org:e}],sa:[1,{com:e,edu:e,gov:e,med:e,net:e,org:e,pub:e,sch:e}],sb:n,sc:n,sd:[1,{com:e,edu:e,gov:e,info:e,med:e,net:e,org:e,tv:e}],se:[1,{a:e,ac:e,b:e,bd:e,brand:e,c:e,d:e,e,f:e,fh:e,fhsk:e,fhv:e,g:e,h:e,i:e,k:e,komforb:e,kommunalforbund:e,komvux:e,l:e,lanbib:e,m:e,n:e,naturbruksgymn:e,o:e,org:e,p:e,parti:e,pp:e,press:e,r:e,s:e,t:e,tm:e,u:e,w:e,x:e,y:e,z:e,com:t,iopsys:t,"123minsida":t,itcouldbewor:t,myspreadshop:t}],sg:[1,{com:e,edu:e,gov:e,net:e,org:e,enscaled:t}],sh:[1,{com:e,gov:e,mil:e,net:e,org:e,hashbang:t,botda:t,lovable:t,platform:[0,{ent:t,eu:t,us:t}],teleport:t,now:t}],si:[1,{f5:t,gitapp:t,gitpage:t}],sj:e,sk:[1,{org:e}],sl:n,sm:e,sn:[1,{art:e,com:e,edu:e,gouv:e,org:e,univ:e}],so:[1,{com:e,edu:e,gov:e,me:e,net:e,org:e,surveys:t}],sr:e,ss:[1,{biz:e,co:e,com:e,edu:e,gov:e,me:e,net:e,org:e,sch:e}],st:[1,{co:e,com:e,consulado:e,edu:e,embaixada:e,mil:e,net:e,org:e,principe:e,saotome:e,store:e,helioho:t,cn:i,kirara:t,noho:t}],su:[1,{abkhazia:t,adygeya:t,aktyubinsk:t,arkhangelsk:t,armenia:t,ashgabad:t,azerbaijan:t,balashov:t,bashkiria:t,bryansk:t,bukhara:t,chimkent:t,dagestan:t,"east-kazakhstan":t,exnet:t,georgia:t,grozny:t,ivanovo:t,jambyl:t,kalmykia:t,kaluga:t,karacol:t,karaganda:t,karelia:t,khakassia:t,krasnodar:t,kurgan:t,kustanai:t,lenug:t,mangyshlak:t,mordovia:t,msk:t,murmansk:t,nalchik:t,navoi:t,"north-kazakhstan":t,nov:t,obninsk:t,penza:t,pokrovsk:t,sochi:t,spb:t,tashkent:t,termez:t,togliatti:t,troitsk:t,tselinograd:t,tula:t,tuva:t,vladikavkaz:t,vladimir:t,vologda:t}],sv:[1,{com:e,edu:e,gob:e,org:e,red:e}],sx:c,sy:r,sz:[1,{ac:e,co:e,org:e}],tc:e,td:e,tel:e,tf:[1,{sch:t}],tg:e,th:[1,{ac:e,co:e,go:e,in:e,mi:e,net:e,or:e,online:t,shop:t}],tj:[1,{ac:e,biz:e,co:e,com:e,edu:e,go:e,gov:e,int:e,mil:e,name:e,net:e,nic:e,org:e,test:e,web:e}],tk:e,tl:c,tm:[1,{co:e,com:e,edu:e,gov:e,mil:e,net:e,nom:e,org:e}],tn:[1,{com:e,ens:e,fin:e,gov:e,ind:e,info:e,intl:e,mincom:e,nat:e,net:e,org:e,perso:e,tourism:e,orangecloud:t}],to:[1,{611:t,com:e,edu:e,gov:e,mil:e,net:e,org:e,oya:t,x0:t,quickconnect:D,vpnplus:t,nett:t}],tr:[1,{av:e,bbs:e,bel:e,biz:e,com:e,dr:e,edu:e,gen:e,gov:e,info:e,k12:e,kep:e,mil:e,name:e,net:e,org:e,pol:e,tel:e,tsk:e,tv:e,web:e,nc:c}],tt:[1,{biz:e,co:e,com:e,edu:e,gov:e,info:e,mil:e,name:e,net:e,org:e,pro:e}],tv:[1,{"better-than":t,dyndns:t,"on-the-web":t,"worse-than":t,from:t,sakura:t}],tw:[1,{club:e,com:[1,{mymailer:t}],ebiz:e,edu:e,game:e,gov:e,idv:e,mil:e,net:e,org:e,url:t,mydns:t}],tz:[1,{ac:e,co:e,go:e,hotel:e,info:e,me:e,mil:e,mobi:e,ne:e,or:e,sc:e,tv:e}],ua:[1,{com:e,edu:e,gov:e,in:e,net:e,org:e,cherkassy:e,cherkasy:e,chernigov:e,chernihiv:e,chernivtsi:e,chernovtsy:e,ck:e,cn:e,cr:e,crimea:e,cv:e,dn:e,dnepropetrovsk:e,dnipropetrovsk:e,donetsk:e,dp:e,if:e,"ivano-frankivsk":e,kh:e,kharkiv:e,kharkov:e,kherson:e,khmelnitskiy:e,khmelnytskyi:e,kiev:e,kirovograd:e,km:e,kr:e,kropyvnytskyi:e,krym:e,ks:e,kv:e,kyiv:e,lg:e,lt:e,lugansk:e,luhansk:e,lutsk:e,lv:e,lviv:e,mk:e,mykolaiv:e,nikolaev:e,od:e,odesa:e,odessa:e,pl:e,poltava:e,rivne:e,rovno:e,rv:e,sb:e,sebastopol:e,sevastopol:e,sm:e,sumy:e,te:e,ternopil:e,uz:e,uzhgorod:e,uzhhorod:e,vinnica:e,vinnytsia:e,vn:e,volyn:e,yalta:e,zakarpattia:e,zaporizhzhe:e,zaporizhzhia:e,zhitomir:e,zhytomyr:e,zp:e,zt:e,cc:t,inf:t,ltd:t,cx:t,biz:t,co:t,pp:t,v:t}],ug:[1,{ac:e,co:e,com:e,edu:e,go:e,gov:e,mil:e,ne:e,or:e,org:e,sc:e,us:e}],uk:[1,{ac:e,co:[1,{bytemark:[0,{dh:t,vm:t}],layershift:L,barsy:t,barsyonline:t,retrosnub:ye,"nh-serv":t,"no-ip":t,adimo:t,myspreadshop:t}],gov:[1,{api:t,campaign:t,service:t}],ltd:e,me:e,net:e,nhs:e,org:[1,{glug:t,lug:t,lugs:t,affinitylottery:t,raffleentry:t,weeklylottery:t}],plc:e,police:e,sch:y,conn:t,copro:t,hosp:t,"independent-commission":t,"independent-inquest":t,"independent-inquiry":t,"independent-panel":t,"independent-review":t,"public-inquiry":t,"royal-commission":t,pymnt:t,barsy:t,nimsite:t,oraclegovcloudapps:i}],us:[1,{dni:e,isa:e,nsn:e,ak:Oe,al:Oe,ar:Oe,as:Oe,az:Oe,ca:Oe,co:Oe,ct:Oe,dc:Oe,de:ke,fl:Oe,ga:Oe,gu:Oe,hi:Ae,ia:Oe,id:Oe,il:Oe,in:Oe,ks:Oe,ky:Oe,la:Oe,ma:[1,{k12:[1,{chtr:e,paroch:e,pvt:e}],cc:e,lib:e}],md:Oe,me:Oe,mi:[1,{k12:e,cc:e,lib:e,"ann-arbor":e,cog:e,dst:e,eaton:e,gen:e,mus:e,tec:e,washtenaw:e}],mn:Oe,mo:Oe,ms:[1,{k12:e,cc:e}],mt:Oe,nc:Oe,nd:Ae,ne:Oe,nh:Oe,nj:Oe,nm:Oe,nv:Oe,ny:Oe,oh:Oe,ok:Oe,or:Oe,pa:Oe,pr:Oe,ri:Ae,sc:Oe,sd:Ae,tn:Oe,tx:Oe,ut:Oe,va:Oe,vi:Oe,vt:Oe,wa:Oe,wi:Oe,wv:ke,wy:Oe,cloudns:t,"is-by":t,"land-4-sale":t,"stuff-4-sale":t,heliohost:t,enscaled:[0,{phx:t}],mircloud:t,"azure-api":t,azurewebsites:t,ngo:t,golffan:t,noip:t,pointto:t,freeddns:t,srv:[2,{gh:t,gl:t}],servername:t}],uy:[1,{com:e,edu:e,gub:e,mil:e,net:e,org:e,gv:t}],uz:[1,{co:e,com:e,net:e,org:e}],va:e,vc:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,gv:[2,{d:t}],"0e":i,mydns:t}],ve:[1,{arts:e,bib:e,co:e,com:e,e12:e,edu:e,emprende:e,firm:e,gob:e,gov:e,ia:e,info:e,int:e,mil:e,net:e,nom:e,org:e,rar:e,rec:e,store:e,tec:e,web:e}],vg:[1,{edu:e}],vi:[1,{co:e,com:e,k12:e,net:e,org:e}],vn:[1,{ac:e,ai:e,biz:e,com:e,edu:e,gov:e,health:e,id:e,info:e,int:e,io:e,name:e,net:e,org:e,pro:e,angiang:e,bacgiang:e,backan:e,baclieu:e,bacninh:e,"baria-vungtau":e,bentre:e,binhdinh:e,binhduong:e,binhphuoc:e,binhthuan:e,camau:e,cantho:e,caobang:e,daklak:e,daknong:e,danang:e,dienbien:e,dongnai:e,dongthap:e,gialai:e,hagiang:e,haiduong:e,haiphong:e,hanam:e,hanoi:e,hatinh:e,haugiang:e,hoabinh:e,hue:e,hungyen:e,khanhhoa:e,kiengiang:e,kontum:e,laichau:e,lamdong:e,langson:e,laocai:e,longan:e,namdinh:e,nghean:e,ninhbinh:e,ninhthuan:e,phutho:e,phuyen:e,quangbinh:e,quangnam:e,quangngai:e,quangninh:e,quangtri:e,soctrang:e,sonla:e,tayninh:e,thaibinh:e,thainguyen:e,thanhhoa:e,thanhphohochiminh:e,thuathienhue:e,tiengiang:e,travinh:e,tuyenquang:e,vinhlong:e,vinhphuc:e,yenbai:e}],vu:le,wf:[1,{biz:t,sch:t}],ws:[1,{com:e,edu:e,gov:e,net:e,org:e,advisor:i,cloud66:t,dyndns:t,mypets:t}],yt:[1,{org:t}],"xn--mgbaam7a8h":e,امارات:e,"xn--y9a3aq":e,հայ:e,"xn--54b7fta0cc":e,বাংলা:e,"xn--90ae":e,бг:e,"xn--mgbcpq6gpa1a":e,البحرين:e,"xn--90ais":e,бел:e,"xn--fiqs8s":e,中国:e,"xn--fiqz9s":e,中國:e,"xn--lgbbat1ad8j":e,الجزائر:e,"xn--wgbh1c":e,مصر:e,"xn--e1a4c":e,ею:e,"xn--qxa6a":e,ευ:e,"xn--mgbah1a3hjkrd":e,موريتانيا:e,"xn--node":e,გე:e,"xn--qxam":e,ελ:e,"xn--j6w193g":[1,{"xn--gmqw5a":e,"xn--55qx5d":e,"xn--mxtq1m":e,"xn--wcvs22d":e,"xn--uc0atv":e,"xn--od0alg":e}],香港:[1,{個人:e,公司:e,政府:e,教育:e,組織:e,網絡:e}],"xn--2scrj9c":e,ಭಾರತ:e,"xn--3hcrj9c":e,ଭାରତ:e,"xn--45br5cyl":e,ভাৰত:e,"xn--h2breg3eve":e,भारतम्:e,"xn--h2brj9c8c":e,भारोत:e,"xn--mgbgu82a":e,ڀارت:e,"xn--rvc1e0am3e":e,ഭാരതം:e,"xn--h2brj9c":e,भारत:e,"xn--mgbbh1a":e,بارت:e,"xn--mgbbh1a71e":e,بھارت:e,"xn--fpcrj9c3d":e,భారత్:e,"xn--gecrj9c":e,ભારત:e,"xn--s9brj9c":e,ਭਾਰਤ:e,"xn--45brj9c":e,ভারত:e,"xn--xkc2dl3a5ee0h":e,இந்தியா:e,"xn--mgba3a4f16a":e,ایران:e,"xn--mgba3a4fra":e,ايران:e,"xn--mgbtx2b":e,عراق:e,"xn--mgbayh7gpa":e,الاردن:e,"xn--3e0b707e":e,한국:e,"xn--80ao21a":e,қаз:e,"xn--q7ce6a":e,ລາວ:e,"xn--fzc2c9e2c":e,ලංකා:e,"xn--xkc2al3hye2a":e,இலங்கை:e,"xn--mgbc0a9azcg":e,المغرب:e,"xn--d1alf":e,мкд:e,"xn--l1acc":e,мон:e,"xn--mix891f":e,澳門:e,"xn--mix082f":e,澳门:e,"xn--mgbx4cd0ab":e,مليسيا:e,"xn--mgb9awbf":e,عمان:e,"xn--mgbai9azgqp6j":e,پاکستان:e,"xn--mgbai9a5eva00b":e,پاكستان:e,"xn--ygbi2ammx":e,فلسطين:e,"xn--90a3ac":[1,{"xn--80au":e,"xn--90azh":e,"xn--d1at":e,"xn--c1avg":e,"xn--o1ac":e,"xn--o1ach":e}],срб:[1,{ак:e,обр:e,од:e,орг:e,пр:e,упр:e}],"xn--p1ai":e,рф:e,"xn--wgbl6a":e,قطر:e,"xn--mgberp4a5d4ar":e,السعودية:e,"xn--mgberp4a5d4a87g":e,السعودیة:e,"xn--mgbqly7c0a67fbc":e,السعودیۃ:e,"xn--mgbqly7cvafr":e,السعوديه:e,"xn--mgbpl2fh":e,سودان:e,"xn--yfro4i67o":e,新加坡:e,"xn--clchc0ea0b2g2a9gcd":e,சிங்கப்பூர்:e,"xn--ogbpf8fl":e,سورية:e,"xn--mgbtf8fl":e,سوريا:e,"xn--o3cw4h":[1,{"xn--o3cyx2a":e,"xn--12co0c3b4eva":e,"xn--m3ch0j3a":e,"xn--h3cuzk1di":e,"xn--12c1fe0br":e,"xn--12cfi8ixb8l":e}],ไทย:[1,{ทหาร:e,ธุรกิจ:e,เน็ต:e,รัฐบาล:e,ศึกษา:e,องค์กร:e}],"xn--pgbs0dh":e,تونس:e,"xn--kpry57d":e,台灣:e,"xn--kprw13d":e,台湾:e,"xn--nnx388a":e,臺灣:e,"xn--j1amh":e,укр:e,"xn--mgb2ddes":e,اليمن:e,xxx:e,ye:r,za:[0,{ac:e,agric:e,alt:e,co:e,edu:e,gov:e,grondar:e,law:e,mil:e,net:e,ngo:e,nic:e,nis:e,nom:e,org:e,school:e,tm:e,web:e}],zm:[1,{ac:e,biz:e,co:e,com:e,edu:e,gov:e,info:e,mil:e,net:e,org:e,sch:e}],zw:[1,{ac:e,co:e,gov:e,mil:e,org:e}],aaa:e,aarp:e,abb:e,abbott:e,abbvie:e,abc:e,able:e,abogado:e,abudhabi:e,academy:[1,{official:t}],accenture:e,accountant:e,accountants:e,aco:e,actor:e,ads:e,adult:e,aeg:e,aetna:e,afl:e,africa:e,agakhan:e,agency:e,aig:e,airbus:e,airforce:e,airtel:e,akdn:e,alibaba:e,alipay:e,allfinanz:e,allstate:e,ally:e,alsace:e,alstom:e,amazon:e,americanexpress:e,americanfamily:e,amex:e,amfam:e,amica:e,amsterdam:e,analytics:e,android:e,anquan:e,anz:e,aol:e,apartments:e,app:[1,{adaptable:t,aiven:t,beget:i,brave:a,clerk:t,clerkstage:t,cloudflare:t,wnext:t,csb:[2,{preview:t}],convex:t,corespeed:t,deta:t,ondigitalocean:t,easypanel:t,encr:[2,{frontend:t}],evervault:o,expo:[2,{on:t,staging:[2,{on:t}]}],edgecompute:t,"on-fleek":t,flutterflow:t,sprites:t,e2b:t,framer:t,gadget:t,github:t,hosted:i,run:[0,{"*":t,mtls:i}],web:t,hackclub:t,hasura:t,onhercules:t,botdash:t,shiptoday:t,leapcell:t,loginline:t,lovable:t,luyani:t,magicpatterns:t,medusajs:t,messerli:t,miren:t,mocha:t,netlify:t,ngrok:t,"ngrok-free":t,developer:i,noop:t,northflank:i,pplx:t,upsun:i,railway:[0,{up:t}],replit:s,nyat:t,snowflake:[0,{"*":t,privatelink:i}],streamlit:t,spawnbase:t,telebit:t,typedream:t,vercel:t,wal:t,wasmer:t,bookonline:t,windsurf:t,base44:t,zeabur:t,zerops:i}],apple:[1,{int:[2,{cloud:[0,{"*":t,r:[0,{"*":t,"ap-north-1":i,"ap-south-1":i,"ap-south-2":i,"eu-central-1":i,"eu-north-1":i,"us-central-1":i,"us-central-2":i,"us-east-1":i,"us-east-2":i,"us-west-1":i,"us-west-2":i,"us-west-3":i}]}]}]}],aquarelle:e,arab:e,aramco:e,archi:e,army:e,art:e,arte:e,asda:e,associates:e,athleta:e,attorney:e,auction:e,audi:e,audible:e,audio:e,auspost:e,author:e,auto:e,autos:e,aws:[1,{on:[0,{"af-south-1":l,"ap-east-1":l,"ap-northeast-1":l,"ap-northeast-2":l,"ap-northeast-3":l,"ap-south-1":l,"ap-south-2":u,"ap-southeast-1":l,"ap-southeast-2":l,"ap-southeast-3":l,"ap-southeast-4":u,"ap-southeast-5":u,"ca-central-1":l,"ca-west-1":u,"eu-central-1":l,"eu-central-2":u,"eu-north-1":l,"eu-south-1":l,"eu-south-2":u,"eu-west-1":l,"eu-west-2":l,"eu-west-3":l,"il-central-1":u,"me-central-1":u,"me-south-1":l,"sa-east-1":l,"us-east-1":l,"us-east-2":l,"us-west-1":l,"us-west-2":l,"ap-southeast-7":d,"mx-central-1":d,"us-gov-east-1":f,"us-gov-west-1":f}],sagemaker:[0,{"ap-northeast-1":m,"ap-northeast-2":m,"ap-south-1":m,"ap-southeast-1":m,"ap-southeast-2":m,"ca-central-1":g,"eu-central-1":m,"eu-west-1":m,"eu-west-2":m,"us-east-1":g,"us-east-2":g,"us-west-2":g,"af-south-1":p,"ap-east-1":p,"ap-northeast-3":p,"ap-south-2":h,"ap-southeast-3":p,"ap-southeast-4":h,"ca-west-1":[0,{notebook:t,"notebook-fips":t}],"eu-central-2":p,"eu-north-1":p,"eu-south-1":p,"eu-south-2":p,"eu-west-3":p,"il-central-1":p,"me-central-1":p,"me-south-1":p,"sa-east-1":p,"us-gov-east-1":_,"us-gov-west-1":_,"us-west-1":[0,{notebook:t,"notebook-fips":t,studio:t}],experiments:i}],repost:[0,{private:i}]}],axa:e,azure:e,baby:e,baidu:e,banamex:e,band:e,bank:e,bar:e,barcelona:e,barclaycard:e,barclays:e,barefoot:e,bargains:e,baseball:e,basketball:[1,{aus:t,nz:t}],bauhaus:e,bayern:e,bbc:e,bbt:e,bbva:e,bcg:e,bcn:e,beats:e,beauty:e,beer:e,berlin:e,best:e,bestbuy:e,bet:e,bharti:e,bible:e,bid:e,bike:e,bing:e,bingo:e,bio:e,black:e,blackfriday:e,blockbuster:e,blog:e,bloomberg:e,blue:e,bms:e,bmw:e,bnpparibas:e,boats:e,boehringer:e,bofa:e,bom:e,bond:e,boo:e,book:e,booking:e,bosch:e,bostik:e,boston:e,bot:e,boutique:e,box:e,bradesco:e,bridgestone:e,broadway:e,broker:e,brother:e,brussels:e,build:[1,{shiptoday:t,v0:t,windsurf:t}],builders:[1,{cloudsite:t}],business:b,buy:e,buzz:e,bzh:e,cab:e,cafe:e,cal:e,call:e,calvinklein:e,cam:e,camera:e,camp:[1,{emf:[0,{at:t}]}],canon:e,capetown:e,capital:e,capitalone:e,car:e,caravan:e,cards:e,care:e,career:e,careers:e,cars:e,casa:[1,{nabu:[0,{ui:t}]}],case:[1,{sav:t}],cash:e,casino:e,catering:e,catholic:e,cba:e,cbn:e,cbre:e,center:e,ceo:e,cern:e,cfa:e,cfd:e,chanel:e,channel:e,charity:e,chase:e,chat:e,cheap:e,chintai:e,christmas:e,chrome:e,church:e,cipriani:e,circle:e,cisco:e,citadel:e,citi:e,citic:e,city:e,claims:e,cleaning:e,click:e,clinic:e,clinique:e,clothing:e,cloud:[1,{antagonist:t,begetcdn:i,convex:S,elementor:t,emergent:t,encoway:[0,{eu:t}],statics:i,ravendb:t,axarnet:[0,{"es-1":t}],diadem:t,jelastic:[0,{vip:t}],jele:t,"jenv-aruba":[0,{aruba:[0,{eur:[0,{it1:t}]}],it1:t}],keliweb:[2,{cs:t}],oxa:[2,{tn:t,uk:t}],primetel:[2,{uk:t}],reclaim:[0,{ca:t,uk:t,us:t}],trendhosting:[0,{ch:t,de:t}],jote:t,jotelulu:t,kuleuven:t,laravel:t,linkyard:t,magentosite:i,matlab:t,observablehq:t,perspecta:t,vapor:t,"on-rancher":i,scw:[0,{baremetal:[0,{"fr-par-1":t,"fr-par-2":t,"nl-ams-1":t}],"fr-par":[0,{cockpit:t,ddl:t,dtwh:t,fnc:[2,{functions:t}],ifr:t,k8s:C,kafk:t,mgdb:t,rdb:t,s3:t,"s3-website":t,scbl:t,whm:t}],instances:[0,{priv:t,pub:t}],k8s:t,"nl-ams":[0,{cockpit:t,ddl:t,dtwh:t,ifr:t,k8s:C,kafk:t,mgdb:t,rdb:t,s3:t,"s3-website":t,scbl:t,whm:t}],"pl-waw":[0,{cockpit:t,ddl:t,dtwh:t,ifr:t,k8s:C,kafk:t,mgdb:t,rdb:t,s3:t,"s3-website":t,scbl:t}],scalebook:t,smartlabeling:t}],servebolt:t,onstackit:[0,{runs:t}],trafficplex:t,"unison-services":t,urown:t,voorloper:t,zap:t}],club:[1,{cloudns:t,jele:t,barsy:t}],clubmed:e,coach:e,codes:[1,{owo:i}],coffee:e,college:e,cologne:e,commbank:e,community:[1,{nog:t,ravendb:t,myforum:t}],company:[1,{mybox:t}],compare:e,computer:e,comsec:e,condos:e,construction:e,consulting:e,contact:e,contractors:e,cooking:e,cool:[1,{elementor:t,de:t}],corsica:e,country:e,coupon:e,coupons:e,courses:e,cpa:e,credit:e,creditcard:e,creditunion:e,cricket:e,crown:e,crs:e,cruise:e,cruises:e,cuisinella:e,cymru:e,cyou:e,dad:e,dance:e,data:e,date:e,dating:e,datsun:e,day:e,dclk:e,dds:e,deal:e,dealer:e,deals:e,degree:e,delivery:e,dell:e,deloitte:e,delta:e,democrat:e,dental:e,dentist:e,desi:e,design:[1,{graphic:t,bss:t}],dev:[1,{myaddr:t,panel:t,bearblog:t,brave:a,lcl:i,lclstage:i,stg:i,stgstage:i,pages:t,r2:t,workers:t,deno:t,"deno-staging":t,deta:t,lp:[2,{api:t,objects:t}],evervault:o,payload:t,fly:t,githubpreview:t,gateway:i,grebedoc:t,botdash:t,inbrowser:i,"is-a-good":t,iserv:t,leapcell:t,runcontainers:t,localcert:[0,{user:i}],loginline:t,barsy:t,mediatech:t,"mocha-sandbox":t,modx:t,ngrok:t,"ngrok-free":t,"is-a-fullstack":t,"is-cool":t,"is-not-a":t,localplayer:t,xmit:t,"platter-app":t,replit:[2,{archer:t,bones:t,canary:t,global:t,hacker:t,id:t,janeway:t,kim:t,kira:t,kirk:t,odo:t,paris:t,picard:t,pike:t,prerelease:t,reed:t,riker:t,sisko:t,spock:t,staging:t,sulu:t,tarpit:t,teams:t,tucker:t,wesley:t,worf:t}],crm:[0,{aa:i,ab:i,ac:i,ad:i,ae:i,af:i,ci:i,d:i,pa:i,pb:i,pc:i,pd:i,pe:i,pf:i,w:i,wa:i,wb:i,wc:i,wd:i,we:i,wf:i}],erp:de,vercel:t,webhare:i,hrsn:t,"is-a":t}],dhl:e,diamonds:e,diet:e,digital:[1,{cloudapps:[2,{london:t}]}],direct:[1,{libp2p:t}],directory:e,discount:e,discover:e,dish:e,diy:[1,{discourse:t,imagine:t}],dnp:e,docs:e,doctor:e,dog:e,domains:e,dot:e,download:e,drive:e,dtv:e,dubai:e,dupont:e,durban:e,dvag:e,dvr:e,earth:e,eat:e,eco:e,edeka:e,education:b,email:[1,{crisp:[0,{on:t}],intouch:t,tawk:pe,tawkto:pe}],emerck:e,energy:e,engineer:e,engineering:e,enterprises:e,epson:e,equipment:e,ericsson:e,erni:e,esq:e,estate:[1,{compute:i}],eurovision:e,eus:[1,{party:me}],events:[1,{koobin:t,co:t}],exchange:e,expert:e,exposed:e,express:e,extraspace:e,fage:e,fail:e,fairwinds:e,faith:e,family:e,fan:e,fans:e,farm:[1,{storj:t}],farmers:e,fashion:e,fast:e,fedex:e,feedback:e,ferrari:e,ferrero:e,fidelity:e,fido:e,film:e,final:e,finance:e,financial:b,fire:e,firestone:e,firmdale:e,fish:e,fishing:e,fit:e,fitness:e,flickr:e,flights:e,flir:e,florist:e,flowers:e,fly:e,foo:e,food:e,football:e,ford:e,forex:e,forsale:e,forum:e,foundation:e,fox:e,free:e,fresenius:e,frl:e,frogans:e,frontier:e,ftr:e,fujitsu:e,fun:he,fund:e,furniture:e,futbol:e,fyi:e,gal:e,gallery:e,gallo:e,gallup:e,game:e,games:[1,{pley:t,sheezy:t}],gap:e,garden:e,gay:[1,{pages:t}],gbiz:e,gdn:[1,{cnpy:t}],gea:e,gent:e,genting:e,george:e,ggee:e,gift:e,gifts:e,gives:e,giving:e,glass:e,gle:e,global:[1,{appwrite:t}],globo:e,gmail:e,gmbh:e,gmo:e,gmx:e,godaddy:e,gold:e,goldpoint:e,golf:e,goodyear:e,goog:[1,{cloud:t,translate:t,usercontent:i}],google:e,gop:e,got:e,grainger:e,graphics:e,gratis:e,green:e,gripe:e,grocery:e,group:[1,{discourse:t}],gucci:e,guge:e,guide:e,guitars:e,guru:e,hair:e,hamburg:e,hangout:e,haus:e,hbo:e,hdfc:e,hdfcbank:e,health:[1,{hra:t}],healthcare:e,help:e,helsinki:e,here:e,hermes:e,hiphop:e,hisamitsu:e,hitachi:e,hiv:e,hkt:e,hockey:e,holdings:e,holiday:e,homedepot:e,homegoods:e,homes:e,homesense:e,honda:e,horse:e,hospital:e,host:[1,{cloudaccess:t,freesite:t,easypanel:t,emergent:t,fastvps:t,myfast:t,gadget:t,tempurl:t,wpmudev:t,iserv:t,jele:t,mircloud:t,bolt:t,wp2:t,half:t}],hosting:[1,{opencraft:t}],hot:e,hotel:e,hotels:e,hotmail:e,house:e,how:e,hsbc:e,hughes:e,hyatt:e,hyundai:e,ibm:e,icbc:e,ice:e,icu:e,ieee:e,ifm:e,ikano:e,imamat:e,imdb:e,immo:e,immobilien:e,inc:e,industries:e,infiniti:e,ing:e,ink:e,institute:e,insurance:e,insure:e,international:e,intuit:e,investments:e,ipiranga:e,irish:e,ismaili:e,ist:e,istanbul:e,itau:e,itv:e,jaguar:e,java:e,jcb:e,jeep:e,jetzt:e,jewelry:e,jio:e,jll:e,jmp:e,jnj:e,joburg:e,jot:e,joy:e,jpmorgan:e,jprs:e,juegos:e,juniper:e,kaufen:e,kddi:e,kerryhotels:e,kerryproperties:e,kfh:e,kia:e,kids:e,kim:e,kindle:e,kitchen:e,kiwi:e,koeln:e,komatsu:e,kosher:e,kpmg:e,kpn:e,krd:[1,{co:t,edu:t}],kred:e,kuokgroup:e,kyoto:e,lacaixa:e,lamborghini:e,lamer:e,land:e,landrover:e,lanxess:e,lasalle:e,lat:e,latino:e,latrobe:e,law:e,lawyer:e,lds:e,lease:e,leclerc:e,lefrak:e,legal:e,lego:e,lexus:e,lgbt:e,lidl:e,life:e,lifeinsurance:e,lifestyle:e,lighting:e,like:e,lilly:e,limited:e,limo:e,lincoln:e,link:[1,{myfritz:t,cyon:t,joinmc:t,dweb:i,inbrowser:i,keenetic:t,nftstorage:Se,mypep:t,storacha:Se,w3s:Se}],live:[1,{aem:t,hlx:t,ewp:i}],living:e,llc:e,llp:e,loan:e,loans:e,locker:e,locus:e,lol:[1,{omg:t}],london:e,lotte:e,lotto:e,love:e,lpl:e,lplfinancial:e,ltd:e,ltda:e,lundbeck:e,luxe:e,luxury:e,madrid:e,maif:e,maison:e,makeup:e,man:e,management:e,mango:e,map:e,market:e,marketing:e,markets:e,marriott:e,marshalls:e,mattel:e,mba:e,mckinsey:e,med:e,media:Ce,meet:e,melbourne:e,meme:e,memorial:e,men:e,menu:[1,{barsy:t,barsyonline:t}],merck:e,merckmsd:e,miami:e,microsoft:e,mini:e,mint:e,mit:e,mitsubishi:e,mlb:e,mls:e,mma:e,mobile:e,moda:e,moe:e,moi:e,mom:e,monash:e,money:e,monster:e,mormon:e,mortgage:e,moscow:e,moto:e,motorcycles:e,mov:e,movie:e,msd:e,mtn:e,mtr:e,music:e,nab:e,nagoya:e,navy:e,nba:e,nec:e,netbank:e,netflix:e,network:[1,{aem:t,alces:i,appwrite:t,co:t,arvo:t,azimuth:t,tlon:t}],neustar:e,new:e,news:[1,{noticeable:t}],next:e,nextdirect:e,nexus:e,nfl:e,ngo:e,nhk:e,nico:e,nike:e,nikon:e,ninja:e,nissan:e,nissay:e,nokia:e,norton:e,now:e,nowruz:e,nowtv:e,nra:e,nrw:e,ntt:e,nyc:e,obi:e,observer:e,office:e,okinawa:e,olayan:e,olayangroup:e,ollo:e,omega:e,one:[1,{kin:i,service:t,website:t}],ong:e,onl:e,online:[1,{eero:t,"eero-stage":t,websitebuilder:t,leapcell:t,barsy:t}],ooo:e,open:e,oracle:e,orange:[1,{tech:t}],organic:e,origins:e,osaka:e,otsuka:e,ott:e,ovh:[1,{nerdpol:t}],page:[1,{aem:t,hlx:t,codeberg:t,deuxfleurs:t,mybox:t,heyflow:t,prvcy:t,rocky:t,statichost:t,pdns:t,plesk:t}],panasonic:e,paris:e,pars:e,partners:e,parts:e,party:e,pay:e,pccw:e,pet:e,pfizer:e,pharmacy:e,phd:e,philips:e,phone:e,photo:e,photography:e,photos:Ce,physio:e,pics:e,pictet:e,pictures:[1,{1337:t}],pid:e,pin:e,ping:e,pink:e,pioneer:e,pizza:[1,{ngrok:t}],place:b,play:e,playstation:e,plumbing:e,plus:[1,{playit:[2,{at:i,with:t}]}],pnc:e,pohl:e,poker:e,politie:e,porn:e,praxi:e,press:e,prime:e,prod:e,productions:e,prof:e,progressive:e,promo:e,properties:e,property:e,protection:e,pru:e,prudential:e,pub:[1,{id:i,kin:i,barsy:t}],pwc:e,qpon:e,quebec:e,quest:e,racing:e,radio:e,read:e,realestate:e,realtor:e,realty:e,recipes:e,red:e,redumbrella:e,rehab:e,reise:e,reisen:e,reit:e,reliance:e,ren:e,rent:e,rentals:e,repair:e,report:e,republican:e,rest:e,restaurant:e,review:e,reviews:[1,{aem:t}],rexroth:e,rich:e,richardli:e,ricoh:e,ril:e,rio:e,rip:[1,{clan:t}],rocks:[1,{myddns:t,stackit:t,"lima-city":t,webspace:t}],rodeo:e,rogers:e,room:e,rsvp:e,rugby:e,ruhr:e,run:[1,{appwrite:i,canva:t,development:t,ravendb:t,liara:[2,{iran:t}],lovable:t,needle:t,build:i,code:i,database:i,migration:i,onporter:t,repl:t,stackit:t,val:de,vercel:t,wix:t}],rwe:e,ryukyu:e,saarland:e,safe:e,safety:e,sakura:e,sale:e,salon:e,samsclub:e,samsung:e,sandvik:e,sandvikcoromant:e,sanofi:e,sap:e,sarl:e,sas:e,save:e,saxo:e,sbi:e,sbs:e,scb:e,schaeffler:e,schmidt:e,scholarships:e,school:e,schule:e,schwarz:e,science:e,scot:[1,{co:t,me:t,org:t,gov:[2,{service:t}]}],search:e,seat:e,secure:e,security:e,seek:e,select:e,sener:e,services:[1,{loginline:t}],seven:e,sew:e,sex:e,sexy:e,sfr:e,shangrila:e,sharp:e,shell:e,shia:e,shiksha:e,shoes:e,shop:[1,{base:t,hoplix:t,barsy:t,barsyonline:t,shopware:t}],shopping:e,shouji:e,show:he,silk:e,sina:e,singles:e,site:[1,{square:t,canva:w,cloudera:i,convex:S,cyon:t,caffeine:t,fastvps:t,figma:t,"figma-gov":t,preview:t,heyflow:t,jele:t,jouwweb:t,loginline:t,barsy:t,co:t,notion:t,omniwe:t,opensocial:t,madethis:t,support:t,platformsh:i,tst:i,byen:t,sol:t,srht:t,novecore:t,cpanel:t,wpsquared:t,sourcecraft:t}],ski:e,skin:e,sky:e,skype:e,sling:e,smart:e,smile:e,sncf:e,soccer:e,social:e,softbank:e,software:e,sohu:e,solar:e,solutions:e,song:e,sony:e,soy:e,spa:e,space:[1,{myfast:t,heiyu:t,hf:[2,{static:t}],"app-ionos":t,project:t,uber:t,xs4all:t}],sport:e,spot:e,srl:e,stada:e,staples:e,star:e,statebank:e,statefarm:e,stc:e,stcgroup:e,stockholm:e,storage:e,store:[1,{barsy:t,sellfy:t,shopware:t,storebase:t}],stream:e,studio:e,study:e,style:e,sucks:e,supplies:e,supply:e,support:[1,{barsy:t}],surf:e,surgery:e,suzuki:e,swatch:e,swiss:e,sydney:e,systems:[1,{knightpoint:t,miren:t}],tab:e,taipei:e,talk:e,taobao:e,target:e,tatamotors:e,tatar:e,tattoo:e,tax:e,taxi:e,tci:e,tdk:e,team:[1,{discourse:t,jelastic:t}],tech:[1,{cleverapps:t}],technology:b,temasek:e,tennis:e,teva:e,thd:e,theater:e,theatre:e,tiaa:e,tickets:e,tienda:e,tips:e,tires:e,tirol:e,tjmaxx:e,tjx:e,tkmaxx:e,tmall:e,today:[1,{prequalifyme:t}],tokyo:e,tools:[1,{addr:ue,myaddr:t}],top:[1,{ntdll:t,wadl:i}],toray:e,toshiba:e,total:e,tours:e,town:e,toyota:e,toys:e,trade:e,trading:e,training:e,travel:e,travelers:e,travelersinsurance:e,trust:e,trv:e,tube:e,tui:e,tunes:e,tushu:e,tvs:e,ubank:e,ubs:e,unicom:e,university:e,uno:e,uol:e,ups:e,vacations:e,vana:e,vanguard:e,vegas:e,ventures:e,verisign:e,versicherung:e,vet:e,viajes:e,video:e,vig:e,viking:e,villas:e,vin:e,vip:[1,{hidns:t}],virgin:e,visa:e,vision:e,viva:e,vivo:e,vlaanderen:e,vodka:e,volvo:e,vote:e,voting:e,voto:e,voyage:e,wales:e,walmart:e,walter:e,wang:e,wanggou:e,watch:e,watches:e,weather:e,weatherchannel:e,webcam:e,weber:e,website:Ce,wed:e,wedding:e,weibo:e,weir:e,whoswho:e,wien:e,wiki:Ce,williamhill:e,win:e,windows:e,wine:e,winners:e,wme:e,woodside:e,work:[1,{"imagine-proxy":t}],works:e,world:e,wow:e,wtc:e,wtf:e,xbox:e,xerox:e,xihuan:e,xin:e,"xn--11b4c3d":e,कॉम:e,"xn--1ck2e1b":e,セール:e,"xn--1qqw23a":e,佛山:e,"xn--30rr7y":e,慈善:e,"xn--3bst00m":e,集团:e,"xn--3ds443g":e,在线:e,"xn--3pxu8k":e,点看:e,"xn--42c2d9a":e,คอม:e,"xn--45q11c":e,八卦:e,"xn--4gbrim":e,موقع:e,"xn--55qw42g":e,公益:e,"xn--55qx5d":e,公司:e,"xn--5su34j936bgsg":e,香格里拉:e,"xn--5tzm5g":e,网站:e,"xn--6frz82g":e,移动:e,"xn--6qq986b3xl":e,我爱你:e,"xn--80adxhks":e,москва:e,"xn--80aqecdr1a":e,католик:e,"xn--80asehdb":e,онлайн:e,"xn--80aswg":e,сайт:e,"xn--8y0a063a":e,联通:e,"xn--9dbq2a":e,קום:e,"xn--9et52u":e,时尚:e,"xn--9krt00a":e,微博:e,"xn--b4w605ferd":e,淡马锡:e,"xn--bck1b9a5dre4c":e,ファッション:e,"xn--c1avg":e,орг:e,"xn--c2br7g":e,नेट:e,"xn--cck2b3b":e,ストア:e,"xn--cckwcxetd":e,アマゾン:e,"xn--cg4bki":e,삼성:e,"xn--czr694b":e,商标:e,"xn--czrs0t":e,商店:e,"xn--czru2d":e,商城:e,"xn--d1acj3b":e,дети:e,"xn--eckvdtc9d":e,ポイント:e,"xn--efvy88h":e,新闻:e,"xn--fct429k":e,家電:e,"xn--fhbei":e,كوم:e,"xn--fiq228c5hs":e,中文网:e,"xn--fiq64b":e,中信:e,"xn--fjq720a":e,娱乐:e,"xn--flw351e":e,谷歌:e,"xn--fzys8d69uvgm":e,電訊盈科:e,"xn--g2xx48c":e,购物:e,"xn--gckr3f0f":e,クラウド:e,"xn--gk3at1e":e,通販:e,"xn--hxt814e":e,网店:e,"xn--i1b6b1a6a2e":e,संगठन:e,"xn--imr513n":e,餐厅:e,"xn--io0a7i":e,网络:e,"xn--j1aef":e,ком:e,"xn--jlq480n2rg":e,亚马逊:e,"xn--jvr189m":e,食品:e,"xn--kcrx77d1x4a":e,飞利浦:e,"xn--kput3i":e,手机:e,"xn--mgba3a3ejt":e,ارامكو:e,"xn--mgba7c0bbn0a":e,العليان:e,"xn--mgbab2bd":e,بازار:e,"xn--mgbca7dzdo":e,ابوظبي:e,"xn--mgbi4ecexp":e,كاثوليك:e,"xn--mgbt3dhd":e,همراه:e,"xn--mk1bu44c":e,닷컴:e,"xn--mxtq1m":e,政府:e,"xn--ngbc5azd":e,شبكة:e,"xn--ngbe9e0a":e,بيتك:e,"xn--ngbrx":e,عرب:e,"xn--nqv7f":e,机构:e,"xn--nqv7fs00ema":e,组织机构:e,"xn--nyqy26a":e,健康:e,"xn--otu796d":e,招聘:e,"xn--p1acf":[1,{"xn--90amc":t,"xn--j1aef":t,"xn--j1ael8b":t,"xn--h1ahn":t,"xn--j1adp":t,"xn--c1avg":t,"xn--80aaa0cvac":t,"xn--h1aliz":t,"xn--90a1af":t,"xn--41a":t}],рус:[1,{биз:t,ком:t,крым:t,мир:t,мск:t,орг:t,самара:t,сочи:t,спб:t,я:t}],"xn--pssy2u":e,大拿:e,"xn--q9jyb4c":e,みんな:e,"xn--qcka1pmc":e,グーグル:e,"xn--rhqv96g":e,世界:e,"xn--rovu88b":e,書籍:e,"xn--ses554g":e,网址:e,"xn--t60b56a":e,닷넷:e,"xn--tckwe":e,コム:e,"xn--tiq49xqyj":e,天主教:e,"xn--unup4y":e,游戏:e,"xn--vermgensberater-ctb":e,vermögensberater:e,"xn--vermgensberatung-pwb":e,vermögensberatung:e,"xn--vhquv":e,企业:e,"xn--vuq861b":e,信息:e,"xn--w4r85el8fhu5dnra":e,嘉里大酒店:e,"xn--w4rs40l":e,嘉里:e,"xn--xhq521b":e,广东:e,"xn--zfr164b":e,政务:e,xyz:[1,{caffeine:t,exe:t,botdash:t,telebit:i}],yachts:e,yahoo:e,yamaxun:e,yandex:e,yodobashi:e,yoga:e,yokohama:e,you:e,youtube:e,yun:e,zappos:e,zara:e,zero:e,zip:e,zone:[1,{stackit:t,lima:t,triton:i}],zuerich:e}]})();function vHe(e,t,n,r){let i=null,a=t;for(;a!==void 0&&((a[0]&r)!==0&&(i={index:n+1,isIcann:(a[0]&1)!=0,isPrivate:(a[0]&2)!=0}),n!==-1);){let t=a[1];a=Object.prototype.hasOwnProperty.call(t,e[n])?t[e[n]]:t[`*`],--n}return i}function yHe(e,t,n){if(hHe(e,t,n))return;let r=e.split(`.`),i=(t.allowPrivateDomains?2:0)|!!t.allowIcannDomains,a=vHe(r,gHe,r.length-1,i);if(a!==null){n.isIcann=a.isIcann,n.isPrivate=a.isPrivate,n.publicSuffix=r.slice(a.index+1).join(`.`);return}let o=vHe(r,_He,r.length-1,i);if(o!==null){n.isIcann=o.isIcann,n.isPrivate=o.isPrivate,n.publicSuffix=r.slice(o.index).join(`.`);return}n.isIcann=!1,n.isPrivate=!1,n.publicSuffix=r[r.length-1]??null}var bHe=fHe();function xHe(e,t={}){return pHe(bHe),mHe(e,3,yHe,t,bHe).domain}function SHe(e,t){return!!(t===e||e.indexOf(t)===0&&(t[t.length-1]===`/`||e.startsWith(t)&&e[t.length]===`/`))}var CHe=[`local`,`example`,`invalid`,`localhost`,`test`],wHe=[`localhost`,`invalid`],THe={allowSpecialUseDomain:!1,ignoreError:!1};function L6(e,t={}){t={...THe,...t};let n=e.split(`.`),r=n[n.length-1],i=!!t.allowSpecialUseDomain,a=!!t.ignoreError;if(i&&r!==void 0&&CHe.includes(r)){if(n.length>1)return`${n[n.length-2]}.${r}`;if(wHe.includes(r))return r}if(!a&&r!==void 0&&CHe.includes(r))throw Error(`Cookie has domain set to the public suffix "${r}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`);let o=xHe(e,{allowIcannDomains:!0,allowPrivateDomains:!0});if(o)return o}function EHe(e,t){let n=L6(e,{allowSpecialUseDomain:t});if(!n)return;if(n==e)return[e];e.slice(-1)==`.`&&(e=e.slice(0,-1));let r=e.slice(0,-(n.length+1)).split(`.`).reverse(),i=n,a=[i];for(;r.length;)i=`${r.shift()}.${i}`,a.push(i);return a}var DHe=class{constructor(){this.synchronous=!1}findCookie(e,t,n,r){throw Error(`findCookie is not implemented`)}findCookies(e,t,n=!1,r){throw Error(`findCookies is not implemented`)}putCookie(e,t){throw Error(`putCookie is not implemented`)}updateCookie(e,t,n){throw Error(`updateCookie is not implemented`)}removeCookie(e,t,n,r){throw Error(`removeCookie is not implemented`)}removeCookies(e,t,n){throw Error(`removeCookies is not implemented`)}removeAllCookies(e){throw Error(`removeAllCookies is not implemented`)}getAllCookies(e){throw Error(`getAllCookies is not implemented (therefore jar cannot be serialized)`)}},R6=e=>Object.prototype.toString.call(e),OHe=(e,t)=>typeof e.join==`function`?(t.add(e),e.map(e=>e==null||t.has(e)?``:kHe(e,t)).join()):R6(e),kHe=(e,t=new WeakSet)=>typeof e!=`object`||!e?String(e):typeof e.toString==`function`?Array.isArray(e)?OHe(e,t):String(e):R6(e),z6=e=>kHe(e);function B6(e){let t,n,r,i=new Promise((e,t)=>{n=e,r=t});return t=typeof e==`function`?(t,n)=>{try{t?e(t):e(null,n)}catch(e){r(e instanceof Error?e:Error())}}:(e,t)=>{try{e?r(e):n(t)}catch(e){r(e instanceof Error?e:Error())}},{promise:i,callback:t,resolve:e=>(t(null,e),i),reject:e=>(t(e),i)}}function V6(e,t){return e in t}var AHe=class extends DHe{constructor(){super(),this.synchronous=!0,this.idx=Object.create(null)}findCookie(e,t,n,r){let i=B6(r);if(e==null||t==null||n==null)return i.resolve(void 0);let a=this.idx[e]?.[t]?.[n];return i.resolve(a)}findCookies(e,t,n=!1,r){typeof n==`function`&&(r=n,n=!0);let i=[],a=B6(r);if(!e)return a.resolve([]);let o;o=t?function(e){for(let n in e)if(SHe(t,n)){let t=e[n];for(let e in t){let n=t[e];n&&i.push(n)}}}:function(e){for(let t in e){let n=e[t];for(let e in n){let t=n[e];t&&i.push(t)}}};let s=EHe(e,n)||[e],c=this.idx;return s.forEach(e=>{let t=c[e];t&&o(t)}),a.resolve(i)}putCookie(e,t){let n=B6(t),{domain:r,path:i,key:a}=e;if(r==null||i==null||a==null)return n.resolve(void 0);let o=this.idx[r]??Object.create(null);this.idx[r]=o;let s=o[i]??Object.create(null);return o[i]=s,s[a]=e,n.resolve(void 0)}updateCookie(e,t,n){if(n)this.putCookie(t,n);else return this.putCookie(t)}removeCookie(e,t,n,r){let i=B6(r);return delete this.idx[e]?.[t]?.[n],i.resolve(void 0)}removeCookies(e,t,n){let r=B6(n),i=this.idx[e];return i&&(t?delete i[t]:delete this.idx[e]),r.resolve(void 0)}removeAllCookies(e){let t=B6(e);return this.idx=Object.create(null),t.resolve(void 0)}getAllCookies(e){let t=B6(e),n=[],r=this.idx;return Object.keys(r).forEach(e=>{let t=r[e]??{};Object.keys(t).forEach(e=>{let r=t[e]??{};Object.keys(r).forEach(e=>{let t=r[e];t!=null&&n.push(t)})})}),n.sort((e,t)=>(e.creationIndex||0)-(t.creationIndex||0)),t.resolve(n)}};function H6(e){return jHe(e)&&e!==``}function U6(e){return e===``||e instanceof String&&e.toString()===``}function jHe(e){return typeof e==`string`||e instanceof String}function W6(e){return R6(e)===`[object Object]`}function G6(e,t,n){if(e)return;let r=typeof t==`function`?t:void 0,i=typeof t==`function`?n:t;W6(i)||(i=`[object Object]`);let a=new MHe(z6(i));if(r)r(a);else throw a}var MHe=class extends Error{},NHe=`6.0.1`,K6={SILENT:`silent`,STRICT:`strict`,DISABLED:`unsafe-disabled`};Object.freeze(K6);var PHe=` +\\[?(?: +(?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)| +(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)| +(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,2}|:)| +(?:[a-fA-F\\d]{1,4}:){4}(?:(?::[a-fA-F\\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,3}|:)| +(?:[a-fA-F\\d]{1,4}:){3}(?:(?::[a-fA-F\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,4}|:)| +(?:[a-fA-F\\d]{1,4}:){2}(?:(?::[a-fA-F\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,5}|:)| +(?:[a-fA-F\\d]{1,4}:){1}(?:(?::[a-fA-F\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,6}|:)| +(?::(?:(?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:)) +)(?:%[0-9a-zA-Z]{1,})?\\]? +`.replace(/\s*\/\/.*$/gm,``).replace(/\n/g,``).trim(),q6=RegExp(`^${PHe}$`),FHe=RegExp(`^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$`);function IHe(e){return new URL(`http://${e}`).hostname}function J6(e){if(e==null)return;let t=e.trim().replace(/^\./,``);return q6.test(t)?(t.startsWith(`[`)||(t=`[`+t),t.endsWith(`]`)||(t+=`]`),IHe(t).slice(1,-1)):/[^\u0001-\u007f]/.test(t)?IHe(t):t.toLowerCase()}function LHe(e){return e.toUTCString()}function Y6(e){if(!e)return;let t={foundTime:void 0,foundDayOfMonth:void 0,foundMonth:void 0,foundYear:void 0},n=e.split(zHe).filter(e=>e.length>0);for(let e of n){if(t.foundTime===void 0){let[,n,r,i]=BHe.exec(e)||[];if(n!=null&&r!=null&&i!=null){let e=parseInt(n,10),a=parseInt(r,10),o=parseInt(i,10);if(!isNaN(e)&&!isNaN(a)&&!isNaN(o)){t.foundTime={hours:e,minutes:a,seconds:o};continue}}}if(t.foundDayOfMonth===void 0&&VHe.test(e)){let n=parseInt(e,10);if(!isNaN(n)){t.foundDayOfMonth=n;continue}}if(t.foundMonth===void 0&&HHe.test(e)){let n=RHe.indexOf(e.substring(0,3).toLowerCase());if(n>=0&&n<=11){t.foundMonth=n;continue}}if(t.foundYear===void 0&&UHe.test(e)){let n=parseInt(e,10);if(!isNaN(n)){t.foundYear=n;continue}}}if(t.foundYear!==void 0&&t.foundYear>=70&&t.foundYear<=99&&(t.foundYear+=1900),t.foundYear!==void 0&&t.foundYear>=0&&t.foundYear<=69&&(t.foundYear+=2e3),t.foundDayOfMonth===void 0||t.foundMonth===void 0||t.foundYear===void 0||t.foundTime===void 0||t.foundDayOfMonth<1||t.foundDayOfMonth>31||t.foundYear<1601||t.foundTime.hours>23||t.foundTime.minutes>59||t.foundTime.seconds>59)return;let r=new Date(Date.UTC(t.foundYear,t.foundMonth,t.foundDayOfMonth,t.foundTime.hours,t.foundTime.minutes,t.foundTime.seconds));if(!(r.getUTCFullYear()!==t.foundYear||r.getUTCMonth()!==t.foundMonth||r.getUTCDate()!==t.foundDayOfMonth))return r}var RHe=[`jan`,`feb`,`mar`,`apr`,`may`,`jun`,`jul`,`aug`,`sep`,`oct`,`nov`,`dec`],zHe=/[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/,BHe=/^(\d{1,2}):(\d{1,2}):(\d{1,2})(?:[\x00-\x2F\x3A-\xFF][\x00-\xFF]*)?$/,VHe=/^[0-9]{1,2}(?:[\x00-\x2F\x3A-\xFF][\x00-\xFF]*)?$/,HHe=/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[\x00-\xFF]*$/i,UHe=/^[\x30-\x39]{2,4}(?:[\x00-\x2F\x3A-\xFF][\x00-\xFF]*)?$/,WHe=/^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/,GHe=/[\x20-\x3A\x3C-\x7E]+/,KHe=/[\x00-\x1F]/,qHe=[` +`,`\r`,`\0`];function JHe(e){if(U6(e))return e;for(let t=0;t{if(t&&typeof t==`object`&&V6(e,t)){let r=t[e];if(r===void 0||V6(e,X6)&&r===X6[e])return;switch(e){case`key`:case`value`:case`sameSite`:typeof r==`string`&&(n[e]=r);break;case`expires`:case`creation`:case`lastAccessed`:typeof r==`number`||typeof r==`string`||r instanceof Date?n[e]=t[e]==`Infinity`?`Infinity`:new Date(r):r===null&&(n[e]=null);break;case`maxAge`:(typeof r==`number`||r===`Infinity`||r===`-Infinity`)&&(n[e]=r);break;case`domain`:case`path`:(typeof r==`string`||r===null)&&(n[e]=r);break;case`secure`:case`httpOnly`:typeof r==`boolean`&&(n[e]=r);break;case`extensions`:Array.isArray(r)&&r.every(e=>typeof e==`string`)&&(n[e]=r);break;case`hostOnly`:case`pathIsDefault`:(typeof r==`boolean`||r===null)&&(n[e]=r);break}}}),n}var X6={key:``,value:``,expires:`Infinity`,maxAge:null,domain:null,path:null,secure:!1,httpOnly:!1,extensions:null,hostOnly:null,pathIsDefault:null,creation:null,lastAccessed:null,sameSite:void 0},Z6=class e{constructor(t={}){this.key=t.key??X6.key,this.value=t.value??X6.value,this.expires=t.expires??X6.expires,this.maxAge=t.maxAge??X6.maxAge,this.domain=t.domain??X6.domain,this.path=t.path??X6.path,this.secure=t.secure??X6.secure,this.httpOnly=t.httpOnly??X6.httpOnly,this.extensions=t.extensions??X6.extensions,this.creation=t.creation??X6.creation,this.hostOnly=t.hostOnly??X6.hostOnly,this.pathIsDefault=t.pathIsDefault??X6.pathIsDefault,this.lastAccessed=t.lastAccessed??X6.lastAccessed,this.sameSite=t.sameSite??X6.sameSite,this.creation=t.creation??new Date,Object.defineProperty(this,`creationIndex`,{configurable:!1,enumerable:!1,writable:!0,value:++e.cookiesCreated}),this.creationIndex=e.cookiesCreated}[Symbol.for(`nodejs.util.inspect.custom`)](){let e=Date.now(),t=this.hostOnly==null?`?`:this.hostOnly.toString(),n=this.creation&&this.creation!==`Infinity`?`${String(e-this.creation.getTime())}ms`:`?`,r=this.lastAccessed&&this.lastAccessed!==`Infinity`?`${String(e-this.lastAccessed.getTime())}ms`:`?`;return`Cookie="${this.toString()}; hostOnly=${t}; aAge=${r}; cAge=${n}"`}toJSON(){let t={};for(let n of e.serializableProperties){let e=this[n];if(e!==X6[n])switch(n){case`key`:case`value`:case`sameSite`:typeof e==`string`&&(t[n]=e);break;case`expires`:case`creation`:case`lastAccessed`:typeof e==`number`||typeof e==`string`||e instanceof Date?t[n]=e==`Infinity`?`Infinity`:new Date(e).toISOString():e===null&&(t[n]=null);break;case`maxAge`:(typeof e==`number`||e===`Infinity`||e===`-Infinity`)&&(t[n]=e);break;case`domain`:case`path`:(typeof e==`string`||e===null)&&(t[n]=e);break;case`secure`:case`httpOnly`:typeof e==`boolean`&&(t[n]=e);break;case`extensions`:Array.isArray(e)&&(t[n]=e);break;case`hostOnly`:case`pathIsDefault`:(typeof e==`boolean`||e===null)&&(t[n]=e);break}}return t}clone(){return ZHe(this.toJSON())}validate(){if(!this.value||!WHe.test(this.value)||this.expires!=`Infinity`&&!(this.expires instanceof Date)&&!Y6(this.expires)||this.maxAge!=null&&this.maxAge!==`Infinity`&&(this.maxAge===`-Infinity`||this.maxAge<=0)||this.path!=null&&!GHe.test(this.path))return!1;let e=this.cdomain();return!(e&&(e.match(/\.$/)||L6(e)==null))}setExpires(e){e instanceof Date?this.expires=e:this.expires=Y6(e)||`Infinity`}setMaxAge(e){e===1/0?this.maxAge=`Infinity`:e===-1/0?this.maxAge=`-Infinity`:this.maxAge=e}cookieString(){let e=this.value||``;return this.key?`${this.key}=${e}`:e}toString(){let t=this.cookieString();return this.expires!=`Infinity`&&this.expires instanceof Date&&(t+=`; Expires=${LHe(this.expires)}`),this.maxAge!=null&&this.maxAge!=1/0&&(t+=`; Max-Age=${String(this.maxAge)}`),this.domain&&!this.hostOnly&&(t+=`; Domain=${this.domain}`),this.path&&(t+=`; Path=${this.path}`),this.secure&&(t+=`; Secure`),this.httpOnly&&(t+=`; HttpOnly`),this.sameSite&&this.sameSite!==`none`&&(this.sameSite.toLowerCase()===e.sameSiteCanonical.lax.toLowerCase()?t+=`; SameSite=${e.sameSiteCanonical.lax}`:this.sameSite.toLowerCase()===e.sameSiteCanonical.strict.toLowerCase()?t+=`; SameSite=${e.sameSiteCanonical.strict}`:t+=`; SameSite=${this.sameSite}`),this.extensions&&this.extensions.forEach(e=>{t+=`; ${e}`}),t}TTL(e=Date.now()){if(this.maxAge!=null&&typeof this.maxAge==`number`)return this.maxAge<=0?0:this.maxAge*1e3;let t=this.expires;return t===`Infinity`?1/0:(t?.getTime()??e)-(e||Date.now())}expiryTime(e){if(this.maxAge!=null){let t=e||this.lastAccessed||new Date,n=typeof this.maxAge==`number`?this.maxAge:-1/0,r=n<=0?-1/0:n*1e3;return t===`Infinity`?1/0:t.getTime()+r}return this.expires==`Infinity`?1/0:this.expires?this.expires.getTime():void 0}expiryDate(e){let t=this.expiryTime(e);return t==1/0?new Date(2147483647e3):t==-1/0?new Date(0):t==null?void 0:new Date(t)}isPersistent(){return this.maxAge!=null||this.expires!=`Infinity`}canonicalizedDomain(){return J6(this.domain)}cdomain(){return J6(this.domain)}static parse(e,t){return XHe(e,t)}static fromJSON(e){return ZHe(e)}};Z6.cookiesCreated=0,Z6.sameSiteLevel={strict:3,lax:2,none:1},Z6.sameSiteCanonical={strict:`Strict`,lax:`Lax`},Z6.serializableProperties=[`key`,`value`,`expires`,`maxAge`,`domain`,`path`,`secure`,`httpOnly`,`extensions`,`hostOnly`,`pathIsDefault`,`creation`,`lastAccessed`,`sameSite`];var Q6=Z6,QHe=2147483647e3;function $He(e,t){let n,r=e.path?e.path.length:0;return n=(t.path?t.path.length:0)-r,n!==0||(n=(e.creation&&e.creation instanceof Date?e.creation.getTime():QHe)-(t.creation&&t.creation instanceof Date?t.creation.getTime():QHe),n!==0)||(n=(e.creationIndex||0)-(t.creationIndex||0)),n}function eUe(e){if(!e||e.slice(0,1)!==`/`)return`/`;if(e===`/`)return e;let t=e.lastIndexOf(`/`);return t===0?`/`:e.slice(0,t)}var tUe=/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-f\d]{1,4}:){7}(?:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,2}|:)|(?:[a-f\d]{1,4}:){4}(?:(?::[a-f\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,3}|:)|(?:[a-f\d]{1,4}:){3}(?:(?::[a-f\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,4}|:)|(?:[a-f\d]{1,4}:){2}(?:(?::[a-f\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,5}|:)|(?:[a-f\d]{1,4}:){1}(?:(?::[a-f\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,6}|:)|(?::(?:(?::[a-f\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,7}|:)))$)/;function nUe(e,t,n){if(e==null||t==null)return;let r,i;if(n===!1?(r=e,i=t):(r=J6(e),i=J6(t)),r==null||i==null)return;if(r==i)return!0;let a=r.lastIndexOf(i);return a<=0||r.length!==i.length+a||r.substring(a-1,a)!==`.`?!1:!tUe.test(r)}function rUe(e){let t=e.split(`.`);return t.length===4&&t[0]!==void 0&&parseInt(t[0],10)===127}function iUe(e){return e===`::1`}function aUe(e){return e.endsWith(`.localhost`)}function oUe(e){let t=e.toLowerCase();return t===`localhost`||aUe(t)}function sUe(e){return e.length>=2&&e.startsWith(`[`)&&e.endsWith(`]`)?e.substring(1,e.length-1):e}function cUe(e,t=!0){let n;if(typeof e==`string`)try{n=new URL(e)}catch{return!1}else n=e;let r=n.protocol.replace(`:`,``).toLowerCase(),i=sUe(n.hostname).replace(/\.+$/,``);return r===`https`||r===`wss`?!0:t?FHe.test(i)?rUe(i):q6.test(i)?iUe(i):oUe(i):!1}var lUe={loose:!1,sameSiteContext:void 0,ignoreError:!1,http:!0},uUe={http:!0,expire:!0,allPaths:!1,sameSiteContext:void 0,sort:void 0},dUe=`Invalid sameSiteContext option for getCookies(); expected one of "strict", "lax", or "none"`;function fUe(e){if(e&&typeof e==`object`&&`hostname`in e&&typeof e.hostname==`string`&&`pathname`in e&&typeof e.pathname==`string`&&`protocol`in e&&typeof e.protocol==`string`)return{hostname:e.hostname,pathname:e.pathname,protocol:e.protocol};if(typeof e==`string`)try{return new URL(decodeURI(e))}catch{return new URL(e)}else throw new MHe("`url` argument is not a string or URL.")}function pUe(e){let t=String(e).toLowerCase();if(t===`none`||t===`lax`||t===`strict`)return t}function mUe(e){return!(typeof e.key==`string`&&e.key.startsWith(`__Secure-`))||e.secure}function hUe(e){return!(typeof e.key==`string`&&e.key.startsWith(`__Host-`))||!!(e.secure&&e.hostOnly&&e.path!=null&&e.path===`/`)}function $6(e){let t=e.toLowerCase();switch(t){case K6.STRICT:case K6.SILENT:case K6.DISABLED:return t;default:return K6.SILENT}}var gUe=class e{constructor(e,t){typeof t==`boolean`&&(t={rejectPublicSuffixes:t}),this.rejectPublicSuffixes=t?.rejectPublicSuffixes??!0,this.enableLooseMode=t?.looseMode??!1,this.allowSpecialUseDomain=t?.allowSpecialUseDomain??!0,this.allowSecureOnLocal=t?.allowSecureOnLocal??!0,this.prefixSecurity=$6(t?.prefixSecurity??`silent`),this.store=e??new AHe}callSync(e){if(!this.store.synchronous)throw Error(`CookieJar store is not synchronous; use async API instead.`);let t=null,n;try{e.call(this,(e,r)=>{t=e,n=r})}catch(e){t=e}if(t)throw t;return n}setCookie(e,t,n,r){typeof n==`function`&&(r=n,n=void 0);let i=B6(r),a=i.callback,o;try{if(typeof t==`string`&&G6(H6(t),r,z6(n)),o=fUe(t),typeof t==`function`)return i.reject(Error(`No URL was specified`));if(typeof n==`function`&&(n=lUe),G6(typeof a==`function`,a),!H6(e)&&!W6(e)&&e instanceof String&&e.length==0)return i.resolve(void 0)}catch(e){return i.reject(e)}let s=J6(o.hostname)??null,c=n?.loose||this.enableLooseMode,l=null;if(n?.sameSiteContext&&(l=pUe(n.sameSiteContext),!l))return i.reject(Error(dUe));if(typeof e==`string`||e instanceof String){let t=Q6.parse(e.toString(),{loose:c});if(!t){let e=Error(`Cookie failed to parse`);return n?.ignoreError?i.resolve(void 0):i.reject(e)}e=t}else if(!(e instanceof Q6)){let e=Error(`First argument to setCookie must be a Cookie object or string`);return n?.ignoreError?i.resolve(void 0):i.reject(e)}let u=n?.now||new Date;if(this.rejectPublicSuffixes&&e.domain)try{let t=e.cdomain();if((typeof t==`string`?L6(t,{allowSpecialUseDomain:this.allowSpecialUseDomain,ignoreError:n?.ignoreError}):null)==null&&!q6.test(e.domain)){let e=Error(`Cookie has domain set to a public suffix`);return n?.ignoreError?i.resolve(void 0):i.reject(e)}}catch(e){return n?.ignoreError?i.resolve(void 0):i.reject(e)}if(e.domain){if(!nUe(s??void 0,e.cdomain()??void 0,!1)){let t=Error(`Cookie not in this host's domain. Cookie:${e.cdomain()??`null`} Request:${s??`null`}`);return n?.ignoreError?i.resolve(void 0):i.reject(t)}e.hostOnly??=!1}else e.hostOnly=!0,e.domain=s;if((!e.path||e.path[0]!==`/`)&&(e.path=eUe(o.pathname),e.pathIsDefault=!0),n?.http===!1&&e.httpOnly){let e=Error(`Cookie is HttpOnly and this isn't an HTTP API`);return n.ignoreError?i.resolve(void 0):i.reject(e)}if(e.sameSite!==`none`&&e.sameSite!==void 0&&l&&l===`none`){let e=Error(`Cookie is SameSite but this is a cross-origin request`);return n?.ignoreError?i.resolve(void 0):i.reject(e)}let d=this.prefixSecurity===K6.SILENT;if(this.prefixSecurity!==K6.DISABLED){let t=!1,r;if(mUe(e)?hUe(e)||(t=!0,r=`Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'`):(t=!0,r=`Cookie has __Secure prefix but Secure attribute is not set`),t)return n?.ignoreError||d?i.resolve(void 0):i.reject(Error(r))}let f=this.store;return f.updateCookie||=async function(e,t,n){return this.putCookie(t).then(()=>n?.(null),e=>n?.(e))},f.findCookie(e.domain,e.path,e.key,function(t,r){if(t){a(t);return}let i=function(t){t?a(t):typeof e==`string`?a(null,void 0):a(null,e)};if(r){if(n&&`http`in n&&n.http===!1&&r.httpOnly){t=Error(`old Cookie is HttpOnly and this isn't an HTTP API`),n.ignoreError?a(null,void 0):a(t);return}e instanceof Q6&&(e.creation=r.creation,e.creationIndex=r.creationIndex,e.lastAccessed=u,f.updateCookie(r,e,i))}else e instanceof Q6&&(e.creation=e.lastAccessed=u,f.putCookie(e,i))}),i.promise}setCookieSync(e,t,n){let r=n?this.setCookie.bind(this,e,t,n):this.setCookie.bind(this,e,t);return this.callSync(r)}getCookies(e,t,n){typeof t==`function`?(n=t,t=uUe):t===void 0&&(t=uUe);let r=B6(n),i=r.callback,a;try{typeof e==`string`&&G6(H6(e),i,e),a=fUe(e),G6(W6(t),i,z6(t)),G6(typeof i==`function`,i)}catch(e){return r.reject(e)}let o=J6(a.hostname),s=a.pathname||`/`,c=cUe(e,this.allowSecureOnLocal),l=0;if(t.sameSiteContext){let e=pUe(t.sameSiteContext);if(e==null||(l=Q6.sameSiteLevel[e],!l))return r.reject(Error(dUe))}let u=t.http??!0,d=Date.now(),f=t.expire??!0,p=t.allPaths??!1,m=this.store;function h(e){if(e.hostOnly){if(e.domain!=o)return!1}else if(!nUe(o??void 0,e.domain??void 0,!1))return!1;if(!p&&typeof e.path==`string`&&!SHe(s,e.path)||e.secure&&!c||e.httpOnly&&!u)return!1;if(l){let t;if(t=e.sameSite===`lax`?Q6.sameSiteLevel.lax:e.sameSite===`strict`?Q6.sameSiteLevel.strict:Q6.sameSiteLevel.none,t>l)return!1}let t=e.expiryTime();return f&&t!=null&&t<=d?(m.removeCookie(e.domain,e.path,e.key,()=>{}),!1):!0}return m.findCookies(o,p?null:s,this.allowSpecialUseDomain,(e,n)=>{if(e){i(e);return}if(n==null){i(null,[]);return}n=n.filter(h),`sort`in t&&t.sort!==!1&&(n=n.sort($He));let r=new Date;for(let e of n)e.lastAccessed=r;i(null,n)}),r.promise}getCookiesSync(e,t){return this.callSync(this.getCookies.bind(this,e,t))??[]}getCookieString(e,t,n){typeof t==`function`&&(n=t,t=void 0);let r=B6(n);return this.getCookies(e,t,function(e,t){e?r.callback(e):r.callback(null,t?.sort($He).map(e=>e.cookieString()).join(`; `))}),r.promise}getCookieStringSync(e,t){return this.callSync(t?this.getCookieString.bind(this,e,t):this.getCookieString.bind(this,e))??``}getSetCookieStrings(e,t,n){typeof t==`function`&&(n=t,t=void 0);let r=B6(n);return this.getCookies(e,t,function(e,t){e?r.callback(e):r.callback(null,t?.map(e=>e.toString()))}),r.promise}getSetCookieStringsSync(e,t={}){return this.callSync(this.getSetCookieStrings.bind(this,e,t))??[]}serialize(e){let t=B6(e),n=this.store.constructor.name;W6(n)&&(n=null);let r={version:`tough-cookie@${NHe}`,storeType:n,rejectPublicSuffixes:this.rejectPublicSuffixes,enableLooseMode:this.enableLooseMode,allowSpecialUseDomain:this.allowSpecialUseDomain,prefixSecurity:$6(this.prefixSecurity),cookies:[]};return typeof this.store.getAllCookies==`function`?(this.store.getAllCookies((e,n)=>{if(e){t.callback(e);return}if(n==null){t.callback(null,r);return}r.cookies=n.map(e=>{let t=e.toJSON();return delete t.creationIndex,t}),t.callback(null,r)}),t.promise):t.reject(Error(`store does not support getAllCookies and cannot be serialized`))}serializeSync(){return this.callSync(e=>{this.serialize(e)})}toJSON(){return this.serializeSync()}_importCookies(e,t){let n;if(e&&typeof e==`object`&&V6(`cookies`,e)&&Array.isArray(e.cookies)&&(n=e.cookies),!n){t(Error(`serialized jar has no cookies array`),void 0);return}n=n.slice();let r=e=>{if(e){t(e,void 0);return}if(Array.isArray(n)){if(!n.length){t(e,this);return}let i;try{i=Q6.fromJSON(n.shift())}catch(e){t(e instanceof Error?e:Error(),void 0);return}if(i===void 0){r(null);return}this.store.putCookie(i,r)}};r(null)}_importCookiesSync(e){this.callSync(this._importCookies.bind(this,e))}clone(t,n){typeof t==`function`&&(n=t,t=void 0);let r=B6(n),i=r.callback;return this.serialize((n,a)=>n?r.reject(n):e.deserialize(a??``,t,i)),r.promise}_cloneSync(e){let t=e&&typeof e!=`function`?this.clone.bind(this,e):this.clone.bind(this);return this.callSync(e=>{t(e)})}cloneSync(e){if(!e)return this._cloneSync();if(!e.synchronous)throw Error(`CookieJar clone destination store is not synchronous; use async API instead.`);return this._cloneSync(e)}removeAllCookies(e){let t=B6(e),n=t.callback,r=this.store;return typeof r.removeAllCookies==`function`&&r.removeAllCookies!==DHe.prototype.removeAllCookies?(r.removeAllCookies(n),t.promise):(r.getAllCookies((e,t)=>{if(e){n(e);return}if(t||=[],t.length===0){n(null,void 0);return}let i=0,a=[],o=function(e){if(e&&a.push(e),i++,i===t.length){a[0]?n(a[0]):n(null,void 0);return}};t.forEach(e=>{r.removeCookie(e.domain,e.path,e.key,o)})}),t.promise)}removeAllCookiesSync(){this.callSync(e=>{this.removeAllCookies(e)})}static deserialize(t,n,r){typeof n==`function`&&(r=n,n=void 0);let i=B6(r),a;if(typeof t==`string`)try{a=JSON.parse(t)}catch(e){return i.reject(e instanceof Error?e:Error())}else a=t;let o=e=>a&&typeof a==`object`&&V6(e,a)?a[e]:void 0,s=e=>{let t=o(e);return typeof t==`boolean`?t:void 0},c=new e(n,{rejectPublicSuffixes:s(`rejectPublicSuffixes`),looseMode:s(`enableLooseMode`),allowSpecialUseDomain:s(`allowSpecialUseDomain`),prefixSecurity:$6((e=>{let t=o(e);return typeof t==`string`?t:void 0})(`prefixSecurity`)??`silent`)});return c._importCookies(a,e=>{if(e){i.callback(e);return}i.callback(null,c)}),i.promise}static deserializeSync(t,n){let r=typeof t==`string`?JSON.parse(t):t,i=e=>r&&typeof r==`object`&&V6(e,r)?r[e]:void 0,a=e=>{let t=i(e);return typeof t==`boolean`?t:void 0},o=new e(n,{rejectPublicSuffixes:a(`rejectPublicSuffixes`),looseMode:a(`enableLooseMode`),allowSpecialUseDomain:a(`allowSpecialUseDomain`),prefixSecurity:$6((e=>{let t=i(e);return typeof t==`string`?t:void 0})(`prefixSecurity`)??`silent`)});if(!o.store.synchronous)throw Error(`CookieJar store is not synchronous; use async API instead.`);return o._importCookiesSync(r),o}static fromJSON(t,n){return e.deserializeSync(t,n)}};function _Ue(e){try{return JSON.parse(e)}catch{return}}var vUe=new class{#e=`__msw-cookie-store__`;#t;#n;constructor(){cVe()||b6(typeof localStorage<`u`,"Failed to create a CookieStore: `localStorage` is not available in this environment. This is likely an issue with your environment, which has been detected as browser (or browser-like) environment and must implement global browser APIs correctly."),this.#n=new AHe,this.#n.idx=this.getCookieStoreIndex(),this.#t=new gUe(this.#n)}getCookies(e){return this.#t.getCookiesSync(e)}async setCookie(e,t){await this.#t.setCookie(e,t),this.persist()}getCookieStoreIndex(){if(typeof localStorage>`u`||typeof localStorage.getItem!=`function`)return{};let e=localStorage.getItem(this.#e);if(e==null)return{};let t=_Ue(e);if(t==null)return{};let n={};for(let e of t){let t=Q6.fromJSON(e);t!=null&&t.domain!=null&&t.path!=null&&(n[t.domain]||={},n[t.domain][t.path]||={},n[t.domain][t.path][t.key]=t)}return n}persist(){if(typeof localStorage>`u`||typeof localStorage.setItem!=`function`)return;let e=[],{idx:t}=this.#n;for(let n in t)for(let r in t[n])for(let i in t[n][r])e.push(t[n][r][i].toJSON());localStorage.setItem(this.#e,JSON.stringify(e))}};function yUe(e){let t=XVe(e),n={};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function bUe(){return yUe(document.cookie)}function xUe(e){if(typeof document>`u`||typeof location>`u`)return{};switch(e.credentials){case`same-origin`:{let t=new URL(e.url);return location.origin===t.origin?bUe():{}}case`include`:return bUe();default:return{}}}function SUe(e){let t=e.headers.get(`cookie`),n=t?yUe(t):{},r=xUe(e);for(let t in r)e.headers.append(`cookie`,ZVe(t,r[t]));let i=vUe.getCookies(e.url),a=Object.fromEntries(i.map(e=>[e.key,e.value]));for(let t of i)e.headers.append(`cookie`,t.toString());return{...r,...a,...n}}var e8=(e=>(e.HEAD=`HEAD`,e.GET=`GET`,e.POST=`POST`,e.PUT=`PUT`,e.PATCH=`PATCH`,e.OPTIONS=`OPTIONS`,e.DELETE=`DELETE`,e))(e8||{}),CUe=class extends DBe{constructor(e,t,n,r){let i=typeof t==`function`?`[custom predicate]`:t;super({info:{header:`${e}${i?` ${i}`:``}`,path:t,method:e},resolver:n,options:r}),this.checkRedundantQueryParameters()}checkRedundantQueryParameters(){let{method:e,path:t}=this.info;!t||t instanceof RegExp||typeof t==`function`||NVe(t)!==t&&S6.warn(`Found a redundant usage of query parameters in the request handler URL for "${e} ${t}". Please match against a path instead and access query parameters using "new URL(request.url).searchParams" instead. Learn more: https://mswjs.io/docs/http/intercepting-requests#querysearch-parameters`)}async parse(e){let t=new URL(e.request.url),n=SUe(e.request);if(typeof this.info.path==`function`){let t=await this.info.path({request:e.request,cookies:n});return{match:typeof t==`boolean`?{matches:t,params:{}}:t,cookies:n}}return{match:this.info.path?RVe(t,this.info.path,e.resolutionContext?.baseUrl):{matches:!1,params:{}},cookies:n}}async predicate(e){let t=this.matchMethod(e.request.method),n=e.parsedResult.match.matches;return t&&n}matchMethod(e){return this.info.method instanceof RegExp?this.info.method.test(e):OBe(this.info.method,e)}extendResolverArgs(e){return{params:e.parsedResult.match?.params||{},cookies:e.parsedResult.cookies}}async log(e){let t=zVe(e.request.url),n=await jBe(e.request),r=await KBe(e.response),i=kBe(r.status);console.groupCollapsed(S6.formatMessage(`${ABe()} ${e.request.method} ${t} (%c${r.status} ${r.statusText}%c)`),`color:${i}`,`color:inherit`),console.log(`Request`,n),console.log(`Handler:`,this),console.log(`Response`,r),console.groupEnd()}};function t8(e){return(t,n,r={})=>new CUe(e,t,n,r)}var n8={all:t8(/.+/),head:t8(e8.HEAD),get:t8(e8.GET),post:t8(e8.POST),put:t8(e8.PUT),delete:t8(e8.DELETE),patch:t8(e8.PATCH),options:t8(e8.OPTIONS)},wUe=Object.create,TUe=Object.defineProperty,EUe=Object.getOwnPropertyDescriptor,DUe=Object.getOwnPropertyNames,OUe=Object.getPrototypeOf,kUe=Object.prototype.hasOwnProperty,AUe=(e,t)=>function(){return t||(0,e[DUe(e)[0]])((t={exports:{}}).exports,t),t.exports},jUe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of DUe(t))!kUe.call(e,i)&&i!==n&&TUe(e,i,{get:()=>t[i],enumerable:!(r=EUe(t,i))||r.enumerable});return e},MUe=((e,t,n)=>(n=e==null?{}:wUe(OUe(e)),jUe(t||!e||!e.__esModule?TUe(n,`default`,{value:e,enumerable:!0}):n,e)))(AUe({"node_modules/set-cookie-parser/lib/set-cookie.js"(e,t){var n={decodeValues:!0,map:!1,silent:!1};function r(e){return typeof e==`string`&&!!e.trim()}function i(e,t){var i=e.split(`;`).filter(r),o=a(i.shift()),s=o.name,c=o.value;t=t?Object.assign({},n,t):n;try{c=t.decodeValues?decodeURIComponent(c):c}catch(e){console.error(`set-cookie-parser encountered an error while decoding a cookie with value '`+c+`'. Set options.decodeValues to false to disable this feature.`,e)}var l={name:s,value:c};return i.forEach(function(e){var t=e.split(`=`),n=t.shift().trimLeft().toLowerCase(),r=t.join(`=`);n===`expires`?l.expires=new Date(r):n===`max-age`?l.maxAge=parseInt(r,10):n===`secure`?l.secure=!0:n===`httponly`?l.httpOnly=!0:n===`samesite`?l.sameSite=r:l[n]=r}),l}function a(e){var t=``,n=``,r=e.split(`=`);return r.length>1?(t=r.shift(),n=r.join(`=`)):n=e,{name:t,value:n}}function o(e,t){if(t=t?Object.assign({},n,t):n,!e)return t.map?{}:[];if(e.headers)if(typeof e.headers.getSetCookie==`function`)e=e.headers.getSetCookie();else if(e.headers[`set-cookie`])e=e.headers[`set-cookie`];else{var a=e.headers[Object.keys(e.headers).find(function(e){return e.toLowerCase()===`set-cookie`})];!a&&e.headers.cookie&&!t.silent&&console.warn(`Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning.`),e=a}return Array.isArray(e)||(e=[e]),t=t?Object.assign({},n,t):n,t.map?e.filter(r).reduce(function(e,n){var r=i(n,t);return e[r.name]=r,e},{}):e.filter(r).map(function(e){return i(e,t)})}function s(e){if(Array.isArray(e))return e;if(typeof e!=`string`)return[];var t=[],n=0,r,i,a,o,s;function c(){for(;n=e.length)&&t.push(e.substring(r,e.length))}return t}t.exports=o,t.exports.parse=o,t.exports.parseString=i,t.exports.splitCookiesString=s}})()),NUe=/[^a-z0-9\-#$%&'*+.^_`|~]/i;function r8(e){if(NUe.test(e)||e.trim()===``)throw TypeError(`Invalid character in header field name`);return e.trim().toLowerCase()}var PUe=[` +`,`\r`,` `,` `],FUe=RegExp(`(^[${PUe.join(``)}]|$[${PUe.join(``)}])`,`g`);function i8(e){return e.replace(FUe,``)}function a8(e){if(typeof e!=`string`||e.length===0)return!1;for(let t=0;t127||!IUe(n))return!1}return!0}function IUe(e){return![127,32,`(`,`)`,`<`,`>`,`@`,`,`,`;`,`:`,`\\`,`"`,`/`,`[`,`]`,`?`,`=`,`{`,`}`].includes(e)}function LUe(e){if(typeof e!=`string`||e.trim()!==e)return!1;for(let t=0;t{this.append(t,e)},this):Array.isArray(t)?t.forEach(([e,t])=>{this.append(e,Array.isArray(t)?t.join(RUe):t)}):t&&Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e];this.append(e,Array.isArray(n)?n.join(RUe):n)})}[(zUe=o8,BUe=s8,VUe=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[e]of this.entries())yield e}*values(){for(let[,e]of this.entries())yield e}*entries(){let e=Object.keys(this[o8]).sort((e,t)=>e.localeCompare(t));for(let t of e)if(t===`set-cookie`)for(let e of this.getSetCookie())yield[t,e];else yield[t,this.get(t)]}has(e){if(!a8(e))throw TypeError(`Invalid header name "${e}"`);return this[o8].hasOwnProperty(r8(e))}get(e){if(!a8(e))throw TypeError(`Invalid header name "${e}"`);return this[o8][r8(e)]??null}set(e,t){if(!a8(e)||!LUe(t))return;let n=r8(e),r=i8(t);this[o8][n]=i8(r),this[s8].set(n,e)}append(e,t){if(!a8(e)||!LUe(t))return;let n=r8(e),r=i8(t),i=this.has(n)?`${this.get(n)}, ${r}`:r;this.set(e,i)}delete(e){if(!a8(e)||!this.has(e))return;let t=r8(e);delete this[o8][t],this[s8].delete(t)}forEach(e,t){for(let[n,r]of this.entries())e.call(t,r,n,this)}getSetCookie(){let e=this.get(`set-cookie`);return e===null?[]:e===``?[``]:(0,MUe.splitCookiesString)(e)}},{message:UUe}=WBe,WUe=Symbol(`kSetCookie`);function c8(e={}){let t=e?.status||200,n=e?.statusText||UUe[t]||``,r=new Headers(e?.headers);return{...e,headers:r,status:t,statusText:n}}function GUe(e,t){t.type&&Object.defineProperty(e,`type`,{value:t.type,enumerable:!0,writable:!1});let n=t.headers.get(`set-cookie`);if(n&&(Object.defineProperty(e,WUe,{value:n,enumerable:!1,writable:!1}),typeof document<`u`)){let e=HUe.prototype.getSetCookie.call(t.headers);for(let t of e)document.cookie=t}return e}var KUe=Symbol(`bodyType`),l8=Symbol.for(`kDefaultContentType`),u8=class e extends sVe{[KUe]=null;constructor(e,t){let n=c8(t);super(e,n),GUe(this,n)}static error(){return super.error()}static text(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`text/plain`),r.headers.has(`Content-Length`)||r.headers.set(`Content-Length`,t?new Blob([t]).size.toString():`0`);let a=new e(t,r);return i||Object.defineProperty(a,l8,{value:!0,enumerable:!1}),a}static json(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`application/json`);let a=JSON.stringify(t);r.headers.has(`Content-Length`)||r.headers.set(`Content-Length`,a?new Blob([a]).size.toString():`0`);let o=new e(a,r);return i||Object.defineProperty(o,l8,{value:!0,enumerable:!1}),o}static xml(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`text/xml`);let a=new e(t,r);return i||Object.defineProperty(a,l8,{value:!0,enumerable:!1}),a}static html(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`text/html`);let a=new e(t,r);return i||Object.defineProperty(a,l8,{value:!0,enumerable:!1}),a}static arrayBuffer(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`application/octet-stream`),t&&!r.headers.has(`Content-Length`)&&r.headers.set(`Content-Length`,t.byteLength.toString());let a=new e(t,r);return i||Object.defineProperty(a,l8,{value:!0,enumerable:!1}),a}static formData(t,n){return new e(t,c8(n))}};function qUe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var JUe=Symbol(`kConnect`),YUe=Symbol(`kAutoConnect`);async function XUe(e){try{return[null,await e().catch(e=>{throw e})]}catch(e){return[e,null]}}var ZUe=async({request:e,requestId:t,handlers:n,resolutionContext:r})=>{let i=null,a=null;for(let o of n)if(a=await o.run({request:e,requestId:t,resolutionContext:r}),a!==null&&(i=o),a?.response)break;return i?{handler:i,parsedResult:a?.parsedResult,response:a?.response}:null};function QUe(e){let t=new URL(e.url);return t.protocol===`file:`||/(fonts\.googleapis\.com)/.test(t.hostname)||/node_modules/.test(t.pathname)||t.pathname.includes(`@vite`)?!0:/\.(s?css|less|m?jsx?|m?tsx?|html|ttf|otf|woff|woff2|eot|gif|jpe?g|png|avif|webp|svg|mp4|webm|ogg|mov|mp3|wav|ogg|flac|aac|pdf|txt|csv|json|xml|md|zip|tar|gz|rar|7z)$/i.test(t.pathname)}async function $Ue(e,t){let n=Reflect.get(t,WUe);n&&await vUe.setCookie(n,e.url)}function eWe(e){let t=[];for(let n of e)n instanceof Promise&&t.push(n);if(t.length>0)return Promise.all(t).then(()=>{})}var d8=(e=>(e[e.DISABLED=0]=`DISABLED`,e[e.ENABLED=1]=`ENABLED`,e))(d8||{});function tWe(e){let t=0,n=new O6,r=e=>e instanceof bBe?e:new xBe(e||[]),i={...e},a=r(i.handlers),o;return{get readyState(){return t},events:n,configure(e){b6(t===0,``),e.handlers&&!Object.is(e.handlers,i.handlers)&&(a=r(e.handlers)),i={...i,...e}},enable(){return b6(t===0,`Failed to call "enable" on the network: already enabled`),o=new AbortController,t=1,eWe(i.sources.map(e=>(e.on(`frame`,async({frame:e})=>{e.events.on(`*`,e=>n.emit(e),{signal:o.signal});let t=e.getHandlers(a);await e.resolve(t,i.onUnhandledFrame||`warn`,i.context)}),e.enable())))},disable(){return b6(t===1,`Failed to call "disable" on the network: already disabled`),o.abort(),t=0,eWe(i.sources.map(e=>e.disable()))},use(...e){a.use(e)},resetHandlers(...e){a.reset(e)},restoreHandlers(){for(let e of a.currentHandlers())`isUsed`in e&&(e.isUsed=!1)},listHandlers(){return SBe(a.currentHandlers())}}}var nWe=class extends D6{frame;constructor(e,t){super(e,{}),this.frame=t}},rWe=class{emitter;constructor(){this.emitter=new O6}async queue(e){await this.emitter.emitAsPromise(new nWe(`frame`,e))}on(e,t,n){this.emitter.on(e,t,n)}disable(){this.emitter.removeAllListeners()}},iWe=class{constructor(e,t){this.protocol=e,this.data=t,this.events=new O6}events};function aWe(e){return!!e.headers.get(`accept`)?.includes(`msw/passthrough`)}function oWe(e){return e.status===302&&e.headers.get(`x-msw-intention`)===`passthrough`}function sWe(e){let t=e.headers.get(`accept`);if(t){let n=t.replace(/(,\s+)?msw\/passthrough/,``);n?e.headers.set(`accept`,n):e.headers.delete(`accept`)}}async function f8(e,t){let n=async t=>{if(t===`bypass`)return;let n=await e.getUnhandledMessage();switch(t){case`warn`:return S6.warn(`Warning: %s`,n);case`error`:return S6.error(`Error: %s`,n)}},r=async e=>{if(b6.as(C6,e===`bypass`||e===`warn`||e===`error`,S6.formatMessage(`Failed to react to an unhandled network frame: unknown strategy "%s". Please provide one of the supported strategies ("bypass", "warn", "error") or a custom callback function as the value of the "onUnhandledRequest" option.`,e)),e!==`bypass`&&(await n(e),e===`error`))return Promise.reject(new C6(S6.formatMessage(`Cannot bypass a request when using the "error" strategy for the "onUnhandledRequest" option.`)))};if(typeof t==`function`)return t({frame:e,defaults:{warn:n.bind(null,`warn`),error:n.bind(null,`error`)}});if(!(e instanceof m8&&QUe(e.data.request)))return r(t)}var p8=class extends D6{requestId;request;constructor(e,t){super(e,{}),this.requestId=t.requestId,this.request=t.request}},cWe=class extends D6{requestId;request;response;constructor(e,t){super(e,{}),this.requestId=t.requestId,this.request=t.request,this.response=t.response}},lWe=class extends D6{error;requestId;request;constructor(e,t){super(e,{}),this.error=t.error,this.requestId=t.requestId,this.request=t.request}},m8=class extends iWe{constructor(e){let t=e.id||kVe();super(`http`,{id:t,request:e.request})}getHandlers(e){return e.getHandlersByKind(`request`)}async getUnhandledMessage(){let{request:e}=this.data,t=new URL(e.url),n=zVe(t)+t.search,r=e.body==null?null:await e.clone().text();return`intercepted a request without a matching request handler:${` + + \u2022 ${e.method} ${n} + +${r?` \u2022 Request body: ${r} + +`:``}`}If you still wish to intercept this unhandled request, please create a request handler for it. +Read more: https://mswjs.io/docs/http/intercepting-requests`}async resolve(e,t,n){let{id:r,request:i}=this.data,a=n?.quiet?null:i.clone();if(this.events.emit(new p8(`request:start`,{requestId:r,request:i})),aWe(i))return this.events.emit(new p8(`request:end`,{requestId:r,request:i})),this.passthrough(),null;let[o,s]=await XUe(()=>ZUe({requestId:r,request:i,handlers:e,resolutionContext:{baseUrl:n?.baseUrl?.toString(),quiet:n?.quiet}}));if(o!=null)return this.events.emit(new lWe(`unhandledException`,{error:o,requestId:r,request:i}))||(console.error(o),S6.error(`Encountered an unhandled exception during the handler lookup for "%s %s". Please see the original error above.`,i.method,i.url)),this.errorWith(o),null;if(s==null)return this.events.emit(new p8(`request:unhandled`,{requestId:r,request:i})),await f8(this,t).then(()=>this.passthrough(),e=>this.errorWith(e)),this.events.emit(new p8(`request:end`,{requestId:r,request:i})),!1;let{response:c,handler:l,parsedResult:u}=s;return this.events.emit(new p8(`request:match`,{requestId:r,request:i})),c==null||oWe(c)?(this.events.emit(new p8(`request:end`,{requestId:r,request:i})),this.passthrough(),null):(await $Ue(i,c),this.respondWith(c.clone()),this.events.emit(new p8(`request:end`,{requestId:r,request:i})),n?.quiet||l.log({request:a,response:c,parsedResult:u}),!0)}},uWe=class extends D6{url;protocols;constructor(e,t){super(e,{}),this.url=t.url,this.protocols=t.protocols}},dWe=class extends D6{url;protocols;error;constructor(e,t){super(e,{}),this.url=t.url,this.protocols=t.protocols,this.error=t.error}},fWe=class extends iWe{constructor(e){super(`ws`,{connection:e.connection})}getHandlers(e){return e.getHandlersByKind(`websocket`)}async resolve(e,t,n){let{connection:r}=this.data;if(this.events.emit(new uWe(`connection`,{url:r.client.url,protocols:r.info.protocols})),e.length===0)return await f8(this,t).then(()=>this.passthrough(),e=>this.errorWith(e)),!1;let i=!1;for(let t of e){let e=await t.run(r,{baseUrl:n?.baseUrl?.toString(),[YUe]:!1});if(!e)continue;i=!0;let a=n?.quiet?void 0:t.log(r);try{t[JUe](e)||a?.()}catch(e){throw this.events.emit(new dWe(`unhandledException`,{error:e,url:r.client.url,protocols:r.info.protocols}))||(console.error(e),S6.error(`Encountered an unhandled exception during the handler lookup for "%s". Please see the original error above.`,r.client.url)),e}}return i?!0:(await f8(this,t).then(()=>this.passthrough(),e=>this.errorWith(e)),!1)}async getUnhandledMessage(){let{connection:e}=this.data;return`intercepted a WebSocket connection without a matching event handler:${` + + \u2022 ${e.client.url} + +`}If you still wish to intercept this unhandled connection, please create an event handler for it. +Read more: https://mswjs.io/docs/websocket`}},pWe=class extends rWe{#e;#t;constructor(e){super(),this.#e=new AVe({name:`interceptor-source`,interceptors:e.interceptors}),this.#t=new Map}enable(){this.#e.apply(),this.#e.on(`request`,this.#n.bind(this)).on(`response`,this.#r.bind(this)).on(`connection`,this.#i.bind(this))}disable(){super.disable(),this.#e.dispose(),this.#t.clear()}async#n({requestId:e,request:t,controller:n}){let r=new mWe({id:e,request:t,controller:n});this.#t.set(e,r),await this.queue(r)}async#r({requestId:e,request:t,response:n,isMockedResponse:r}){let i=this.#t.get(e);this.#t.delete(e),i!=null&&queueMicrotask(()=>{i.events.emit(new cWe(r?`response:mocked`:`response:bypass`,{requestId:e,request:t,response:n}))})}async#i(e){await this.queue(new hWe({connection:e}))}},mWe=class extends m8{#e;constructor(e){super({id:e.id,request:e.request}),this.#e=e.controller}passthrough(){sWe(this.data.request)}respondWith(e){e&&this.#e.respondWith(e)}errorWith(e){if(e instanceof Response)return this.respondWith(e);throw e instanceof C6&&this.#e.errorWith(e),e}},hWe=class extends fWe{constructor(e){super({connection:e.connection})}errorWith(e){if(e instanceof Error){let{client:t}=this.data.connection,n=new Event(`error`);Object.defineProperty(n,`cause`,{enumerable:!0,configurable:!1,value:e}),t.socket.dispatchEvent(n)}}passthrough(){this.data.connection.server.connect()}};function gWe(e){return({frame:t,defaults:n})=>{let r=e();if(r!=null){if(typeof r==`function`){let e=t instanceof m8?t.data.request:t instanceof fWe?new Request(t.data.connection.client.url,{headers:{connection:`upgrade`,upgrade:`websocket`}}):null;return b6(e!=null,'Failed to coerce a network frame to a legacy `onUnhandledRequest` strategy: unknown frame protocol "%s"',t.protocol),r(e,{warning:n.warn,error:n.error})}return f8(t,r)}}}function _We(e){return{status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries())}}var vWe=/(%?)(%([sdijo]))/g;function yWe(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 h8(e,...t){if(t.length===0)return e;let n=0,r=e.replace(vWe,(e,r,i,a)=>{let o=t[n],s=yWe(o,a);return r?e:(n++,s)});return n{if(!e)throw new SWe(t,...n)};g8.as=(e,t,n,...r)=>{if(!t){let t=r.length===0?n:h8(n,...r),i;try{i=Reflect.construct(e,[t])}catch{i=e(t)}throw i}};function _8(){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 CWe=Object.defineProperty,wWe=(e,t)=>{for(var n in t)CWe(e,n,{get:t[n],enumerable:!0})},v8={};wWe(v8,{blue:()=>EWe,gray:()=>y8,green:()=>OWe,red:()=>DWe,yellow:()=>TWe});function TWe(e){return`\x1B[33m${e}\x1B[0m`}function EWe(e){return`\x1B[34m${e}\x1B[0m`}function y8(e){return`\x1B[90m${e}\x1B[0m`}function DWe(e){return`\x1B[31m${e}\x1B[0m`}function OWe(e){return`\x1B[32m${e}\x1B[0m`}var b8=_8(),kWe=class{constructor(e){this.name=e,this.prefix=`[${this.name}]`;let t=PWe(`DEBUG`),n=PWe(`LOG_LEVEL`);t===`1`||t===`true`||t!==void 0&&this.name.startsWith(t)?(this.debug=S8(n,`debug`)?x8:this.debug,this.info=S8(n,`info`)?x8:this.info,this.success=S8(n,`success`)?x8:this.success,this.warning=S8(n,`warning`)?x8:this.warning,this.error=S8(n,`error`)?x8:this.error):(this.info=x8,this.success=x8,this.warning=x8,this.error=x8,this.only=x8)}prefix;extend(e){return new kWe(`${this.name}:${e}`)}debug(e,...t){this.logEntry({level:`debug`,message:y8(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 AWe;return(e,...t)=>{n.measure(),this.logEntry({level:`info`,message:`${e} ${y8(`${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:v8[s],prefix:v8[c]};this.getWriter(t)([l.timestamp(this.formatTimestamp(o.timestamp))].concat(r==null?[]:l.prefix(r),FWe(n)).join(` `),...a.map(FWe))}formatTimestamp(e){return`${e.toLocaleTimeString(`en-GB`)}:${e.getMilliseconds()}`}getWriter(e){switch(e){case`debug`:case`success`:case`info`:return jWe;case`warning`:return MWe;case`error`:return NWe}}},AWe=class{startTime;endTime;deltaTime;constructor(){this.startTime=performance.now()}measure(){this.endTime=performance.now(),this.deltaTime=(this.endTime-this.startTime).toFixed(2)}},x8=()=>void 0;function jWe(e,...t){if(b8){process.stdout.write(h8(e,...t)+` +`);return}console.log(e,...t)}function MWe(e,...t){if(b8){process.stderr.write(h8(e,...t)+` +`);return}console.warn(e,...t)}function NWe(e,...t){if(b8){process.stderr.write(h8(e,...t)+` +`);return}console.error(e,...t)}function PWe(e){return b8?{}[e]:globalThis[e]?.toString()}function S8(e,t){return e!==void 0&&e!==t}function FWe(e){return e===void 0?`undefined`:e===null?`null`:typeof e==`string`?e:typeof e==`object`?JSON.stringify(e):e.toString()}var IWe=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`}},LWe=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=LWe.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 IWe(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)}},RWe=LWe;RWe.defaultMaxListeners=10;var zWe=`x-interceptors-internal-request-id`;function BWe(e){return globalThis[e]||void 0}function VWe(e,t){globalThis[e]=t}function HWe(e){delete globalThis[e]}var C8=(function(e){return e.INACTIVE=`INACTIVE`,e.APPLYING=`APPLYING`,e.APPLIED=`APPLIED`,e.DISPOSING=`DISPOSING`,e.DISPOSED=`DISPOSED`,e})({}),w8=class{constructor(e){this.symbol=e,this.readyState=C8.INACTIVE,this.emitter=new RWe,this.subscriptions=[],this.logger=new kWe(e.description),this.emitter.setMaxListeners(0),this.logger.info(`constructing the interceptor...`)}checkEnvironment(){return!0}apply(){let e=this.logger.extend(`apply`);if(e.info(`applying the interceptor...`),this.readyState===C8.APPLIED){e.info(`intercepted already applied!`);return}if(!this.checkEnvironment()){e.info(`the interceptor cannot be applied in this environment!`);return}this.readyState=C8.APPLYING;let t=this.getInstance();if(t){e.info(`found a running instance, reusing...`),this.on=(n,r)=>(e.info(`proxying the "%s" listener`,n),t.emitter.addListener(n,r),this.subscriptions.push(()=>{t.emitter.removeListener(n,r),e.info(`removed proxied "%s" listener!`,n)}),this),this.readyState=C8.APPLIED;return}e.info(`no running instance found, setting up a new instance...`),this.setup(),this.setInstance(),this.readyState=C8.APPLIED}setup(){}on(e,t){let n=this.logger.extend(`on`);return this.readyState===C8.DISPOSING||this.readyState===C8.DISPOSED?(n.info(`cannot listen to events, already disposed!`),this):(n.info(`adding "%s" event listener:`,e,t),this.emitter.on(e,t),this)}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}removeAllListeners(e){return this.emitter.removeAllListeners(e),this}dispose(){let e=this.logger.extend(`dispose`);if(this.readyState===C8.DISPOSED){e.info(`cannot dispose, already disposed!`);return}if(e.info(`disposing the interceptor...`),this.readyState=C8.DISPOSING,!this.getInstance()){e.info(`no interceptors running, skipping dispose...`);return}if(this.clearInstance(),e.info(`global symbol deleted:`,BWe(this.symbol)),this.subscriptions.length>0){e.info(`disposing of %d subscriptions...`,this.subscriptions.length);for(let e of this.subscriptions)e();this.subscriptions=[],e.info(`disposed of all subscriptions!`,this.subscriptions.length)}this.emitter.removeAllListeners(),e.info(`destroyed the listener!`),this.readyState=C8.DISPOSED}getInstance(){let e=BWe(this.symbol);return this.logger.info(`retrieved global instance:`,e?.constructor?.name),e}setInstance(){VWe(this.symbol,this),this.logger.info(`set global instance!`,this.symbol.description)}clearInstance(){HWe(this.symbol),this.logger.info(`cleared global instance!`,this.symbol.description)}};function T8(){return Math.random().toString(16).slice(2)}function UWe(e){if(typeof e==`string`)return UWe(new URL(e,typeof location<`u`?location.href:void 0));if(e.protocol===`http:`?e.protocol=`ws:`:e.protocol===`https:`&&(e.protocol=`wss:`),e.protocol!==`ws:`&&e.protocol!==`wss:`)throw SyntaxError(`Failed to construct 'WebSocket': The URL's scheme must be either 'http', 'https', 'ws', or 'wss'. '${e.protocol}' is not allowed.`);if(e.hash!==``)throw SyntaxError(`Failed to construct 'WebSocket': The URL contains a fragment identifier ('${e.hash}'). Fragment identifiers are not allowed in WebSocket URLs.`);return e.href}async function E8(e,t,...n){let r=e.listeners(t);if(r.length!==0)for(let t of r)await t.apply(e,n)}function D8(e){let t=Object.getOwnPropertyDescriptor(globalThis,e);return t===void 0||typeof t.get==`function`&&t.get()===void 0||t.get===void 0&&t.value==null?!1:t.set===void 0&&!t.configurable?(console.error(`[MSW] Failed to apply interceptor: the global \`${e}\` property is non-configurable. This is likely an issue with your environment. If you are using a framework, please open an issue about this in their repository.`),!1):!0}function WWe(){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 O8=class extends Promise{#e;resolve;reject;constructor(e=null){let t=WWe();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}})}};function k8(e,t){return Object.defineProperties(t,{target:{value:e,enumerable:!0,writable:!0},currentTarget:{value:e,enumerable:!0,writable:!0}}),t}var A8=Symbol(`kCancelable`),j8=Symbol(`kDefaultPrevented`),M8=class extends MessageEvent{constructor(e,t){super(e,t),this[A8]=!!t.cancelable,this[j8]=!1}get cancelable(){return this[A8]}set cancelable(e){this[A8]=e}get defaultPrevented(){return this[j8]}set defaultPrevented(e){this[j8]=e}preventDefault(){this.cancelable&&!this[j8]&&(this[j8]=!0)}},N8=class extends Event{constructor(e,t={}){super(e,t),this.code=t.code===void 0?0:t.code,this.reason=t.reason===void 0?``:t.reason,this.wasClean=t.wasClean===void 0?!1:t.wasClean}},GWe=class extends N8{constructor(e,t={}){super(e,t),this[A8]=!!t.cancelable,this[j8]=!1}get cancelable(){return this[A8]}set cancelable(e){this[A8]=e}get defaultPrevented(){return this[j8]}set defaultPrevented(e){this[j8]=e}preventDefault(){this.cancelable&&!this[j8]&&(this[j8]=!0)}},P8=Symbol(`kEmitter`),F8=Symbol(`kBoundListener`),KWe=class{constructor(e,t){this.socket=e,this.transport=t,this.id=T8(),this.url=new URL(e.url),this[P8]=new EventTarget,this.transport.addEventListener(`outgoing`,e=>{let t=k8(this.socket,new M8(`message`,{data:e.data,origin:e.origin,cancelable:!0}));this[P8].dispatchEvent(t),t.defaultPrevented&&e.preventDefault()}),this.transport.addEventListener(`close`,e=>{this[P8].dispatchEvent(k8(this.socket,new N8(`close`,e)))})}addEventListener(e,t,n){if(!Reflect.has(t,F8)){let e=t.bind(this.socket);Object.defineProperty(t,F8,{value:e,enumerable:!1,configurable:!1})}this[P8].addEventListener(e,Reflect.get(t,F8),n)}removeEventListener(e,t,n){this[P8].removeEventListener(e,Reflect.get(t,F8),n)}send(e){this.transport.send(e)}close(e,t){this.transport.close(e,t)}},qWe=`InvalidAccessError: close code out of user configurable range`,I8=Symbol(`kPassthroughPromise`),JWe=Symbol(`kOnSend`),L8=Symbol(`kClose`),YWe=class extends EventTarget{static{this.CONNECTING=0}static{this.OPEN=1}static{this.CLOSING=2}static{this.CLOSED=3}constructor(e,t){super(),this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,this._onopen=null,this._onmessage=null,this._onerror=null,this._onclose=null,this.url=UWe(e),this.protocol=``,this.extensions=``,this.binaryType=`blob`,this.readyState=this.CONNECTING,this.bufferedAmount=0,this[I8]=new O8,queueMicrotask(async()=>{await this[I8]||(this.protocol=typeof t==`string`?t:Array.isArray(t)&&t.length>0?t[0]:``,this.readyState===this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent(k8(this,new Event(`open`)))))})}set onopen(e){this.removeEventListener(`open`,this._onopen),this._onopen=e,e!==null&&this.addEventListener(`open`,e)}get onopen(){return this._onopen}set onmessage(e){this.removeEventListener(`message`,this._onmessage),this._onmessage=e,e!==null&&this.addEventListener(`message`,e)}get onmessage(){return this._onmessage}set onerror(e){this.removeEventListener(`error`,this._onerror),this._onerror=e,e!==null&&this.addEventListener(`error`,e)}get onerror(){return this._onerror}set onclose(e){this.removeEventListener(`close`,this._onclose),this._onclose=e,e!==null&&this.addEventListener(`close`,e)}get onclose(){return this._onclose}send(e){if(this.readyState===this.CONNECTING)throw this.close(),new DOMException(`InvalidStateError`);this.readyState===this.CLOSING||this.readyState===this.CLOSED||(this.bufferedAmount+=XWe(e),queueMicrotask(()=>{this.bufferedAmount=0,this[JWe]?.(e)}))}close(e=1e3,t){g8(e,qWe),g8(e===1e3||e>=3e3&&e<=4999,qWe),this[L8](e,t)}[L8](e=1e3,t,n=!0){this.readyState===this.CLOSING||this.readyState===this.CLOSED||(this.readyState=this.CLOSING,queueMicrotask(()=>{this.readyState=this.CLOSED,this.dispatchEvent(k8(this,new N8(`close`,{code:e,reason:t,wasClean:n}))),this._onopen=null,this._onmessage=null,this._onerror=null,this._onclose=null}))}addEventListener(e,t,n){return super.addEventListener(e,t,n)}removeEventListener(e,t,n){return super.removeEventListener(e,t,n)}};function XWe(e){return typeof e==`string`?e.length:e instanceof Blob?e.size:e.byteLength}var R8=Symbol(`kEmitter`),z8=Symbol(`kBoundListener`),B8=Symbol(`kSend`),ZWe=class{constructor(e,t,n){this.client=e,this.transport=t,this.createConnection=n,this[R8]=new EventTarget,this.mockCloseController=new AbortController,this.realCloseController=new AbortController,this.transport.addEventListener(`outgoing`,e=>{this.realWebSocket!==void 0&&queueMicrotask(()=>{e.defaultPrevented||this[B8](e.data)})}),this.transport.addEventListener(`incoming`,this.handleIncomingMessage.bind(this))}get socket(){return g8(this.realWebSocket,'Cannot access "socket" on the original WebSocket server object: the connection is not open. Did you forget to call `server.connect()`?'),this.realWebSocket}connect(){g8(!this.realWebSocket||this.realWebSocket.readyState!==WebSocket.OPEN,`Failed to call "connect()" on the original WebSocket instance: the connection already open`);let e=this.createConnection();e.binaryType=this.client.binaryType,e.addEventListener(`open`,e=>{this[R8].dispatchEvent(k8(this.realWebSocket,new Event(`open`,e)))},{once:!0}),e.addEventListener(`message`,e=>{this.transport.dispatchEvent(k8(this.realWebSocket,new MessageEvent(`incoming`,{data:e.data,origin:e.origin})))}),this.client.addEventListener(`close`,e=>{this.handleMockClose(e)},{signal:this.mockCloseController.signal}),e.addEventListener(`close`,e=>{this.handleRealClose(e)},{signal:this.realCloseController.signal}),e.addEventListener(`error`,()=>{let t=k8(e,new Event(`error`,{cancelable:!0}));this[R8].dispatchEvent(t),t.defaultPrevented||this.client.dispatchEvent(k8(this.client,new Event(`error`)))}),this.realWebSocket=e}addEventListener(e,t,n){if(!Reflect.has(t,z8)){let e=t.bind(this.client);Object.defineProperty(t,z8,{value:e,enumerable:!1})}this[R8].addEventListener(e,Reflect.get(t,z8),n)}removeEventListener(e,t,n){this[R8].removeEventListener(e,Reflect.get(t,z8),n)}send(e){this[B8](e)}[B8](e){let{realWebSocket:t}=this;if(g8(t,`Failed to call "server.send()" for "%s": the connection is not open. Did you forget to call "server.connect()"?`,this.client.url),!(t.readyState===WebSocket.CLOSING||t.readyState===WebSocket.CLOSED)){if(t.readyState===WebSocket.CONNECTING){t.addEventListener(`open`,()=>{t.send(e)},{once:!0});return}t.send(e)}}close(){let{realWebSocket:e}=this;g8(e,`Failed to close server connection for "%s": the connection is not open. Did you forget to call "server.connect()"?`,this.client.url),this.realCloseController.abort(),!(e.readyState===WebSocket.CLOSING||e.readyState===WebSocket.CLOSED)&&(e.close(),queueMicrotask(()=>{this[R8].dispatchEvent(k8(this.realWebSocket,new GWe(`close`,{code:1e3,cancelable:!0})))}))}handleIncomingMessage(e){let t=k8(e.target,new M8(`message`,{data:e.data,origin:e.origin,cancelable:!0}));this[R8].dispatchEvent(t),t.defaultPrevented||this.client.dispatchEvent(k8(this.client,new MessageEvent(`message`,{data:e.data,origin:e.origin})))}handleMockClose(e){this.realWebSocket&&this.realWebSocket.close()}handleRealClose(e){this.mockCloseController.abort();let t=k8(this.realWebSocket,new GWe(`close`,{code:e.code,reason:e.reason,wasClean:e.wasClean,cancelable:!0}));this[R8].dispatchEvent(t),t.defaultPrevented||this.client[L8](e.code,e.reason)}},QWe=class extends EventTarget{constructor(e){super(),this.socket=e,this.socket.addEventListener(`close`,e=>{this.dispatchEvent(k8(this.socket,new N8(`close`,e)))}),this.socket[JWe]=e=>{this.dispatchEvent(k8(this.socket,new M8(`outgoing`,{data:e,origin:this.socket.url,cancelable:!0})))}}addEventListener(e,t,n){return super.addEventListener(e,t,n)}dispatchEvent(e){return super.dispatchEvent(e)}send(e){queueMicrotask(()=>{if(this.socket.readyState===this.socket.CLOSING||this.socket.readyState===this.socket.CLOSED)return;let t=()=>{this.socket.dispatchEvent(k8(this.socket,new MessageEvent(`message`,{data:e,origin:this.socket.url})))};this.socket.readyState===this.socket.CONNECTING?this.socket.addEventListener(`open`,()=>{t()},{once:!0}):t()})}close(e,t){this.socket[L8](e,t)}},$We=class e extends w8{static{this.symbol=Symbol(`websocket`)}constructor(){super(e.symbol)}checkEnvironment(){return D8(`WebSocket`)}setup(){let e=Object.getOwnPropertyDescriptor(globalThis,`WebSocket`),t=new Proxy(globalThis.WebSocket,{construct:(e,t,n)=>{let[r,i]=t,a=()=>Reflect.construct(e,t,n),o=new YWe(r,i),s=new QWe(o);return queueMicrotask(async()=>{try{let e=new ZWe(o,s,a),t=this.emitter.listenerCount(`connection`)>0;await E8(this.emitter,`connection`,{client:new KWe(o,s),server:e,info:{protocols:i}}),t?o[I8].resolve(!1):(o[I8].resolve(!0),e.connect(),e.addEventListener(`open`,()=>{o.dispatchEvent(k8(o,new Event(`open`))),e.realWebSocket&&(o.protocol=e.realWebSocket.protocol)}))}catch(e){e instanceof Error&&(o.dispatchEvent(new Event(`error`)),o.readyState!==WebSocket.CLOSING&&o.readyState!==WebSocket.CLOSED&&o[L8](1011,e.message,!1),console.error(e))}}),o}});Object.defineProperty(globalThis,`WebSocket`,{value:t,configurable:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis,`WebSocket`,e)})}};function V8(){return typeof navigator<`u`&&`serviceWorker`in navigator&&typeof location<`u`&&location.protocol!==`file:`}function eGe(){try{let e=new ReadableStream({start:e=>e.close()});return new MessageChannel().port1.postMessage(e,[e]),!0}catch{return!1}}var H8=Symbol(`isPatchedModule`),U8=class e extends Error{constructor(t){super(t),this.name=`InterceptorError`,Object.setPrototypeOf(this,e.prototype)}},W8=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 O8}get#e(){return this.handled}async passthrough(){g8.as(U8,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){g8.as(U8,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){g8.as(U8,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 tGe(e){try{return new URL(e),!0}catch{return!1}}function nGe(e,t){let n=Object.getOwnPropertySymbols(t).find(t=>t.description===e);if(n)return Reflect.get(t,n)}var G8=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:`||!tGe(e))return;let n=nGe(`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{throw e})]}catch(e){return[e,null]}}function uGe(e){return new URL(e,location.href).href}function K8(e,t,n){return[e.active,e.installing,e.waiting].filter(e=>e!=null).find(e=>n(e.scriptURL,t))||null}var dGe=async(e,t={},n)=>{let r=uGe(e),i=await navigator.serviceWorker.getRegistrations().then(e=>e.filter(e=>K8(e,r,n)));!navigator.serviceWorker.controller&&i.length>0&&location.reload();let[a]=i;if(a)return a.update(),[K8(a,r,n),a];let[o,s]=await lGe(async()=>{let i=await navigator.serviceWorker.register(e,t);return[K8(i,r,n),i]});if(o){if(o.message.includes(`(404)`)){let e=new URL(t?.scope||`/`,location.href);throw Error(S6.formatMessage(`Failed to register a Service Worker for scope ('${e.href}') with script ('${r}'): Service Worker script does not exist at the given path. + +Did you forget to run "npx msw init "? + +Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init`))}throw Error(S6.formatMessage(`Failed to register the Service Worker: + +%s`,o.message))}return s},fGe=class{#e;#t;constructor(){this.#e=[],this.#t=new Map}get[Symbol.iterator](){return this.#e[Symbol.iterator].bind(this.#e)}entries(){return this.#t.entries()}get(e){return this.#t.get(e)||[]}getAll(){return this.#e.map(([,e])=>e)}append(e,t){this.#e.push([e,t]),this.#n(e,e=>e.push(t))}prepend(e,t){this.#e.unshift([e,t]),this.#n(e,e=>e.unshift(t))}delete(e,t){if(this.size===0)return;this.#e=this.#e.filter(e=>e[1]!==t);let n=this.#t.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}deleteAll(e){this.size!==0&&(this.#e=this.#e.filter(t=>t[0]!==e),this.#t.delete(e))}get size(){return this.#e.length}clear(){this.size!==0&&(this.#e.length=0,this.#t.clear())}#n(e,t){t(this.#t.get(e)||this.#t.set(e,[]).get(e))}},q8=Symbol(`kDefaultPrevented`),J8=Symbol(`kPropagationStopped`),Y8=Symbol(`kImmediatePropagationStopped`),pGe=class extends MessageEvent{[q8];[J8];[Y8];constructor(...e){super(e[0],e[1]),this[q8]=!1}get defaultPrevented(){return this[q8]}preventDefault(){super.preventDefault(),this[q8]=!0}stopImmediatePropagation(){super.stopImmediatePropagation(),this[Y8]=!0}},mGe=class{#e;#t;#n;#r;#i;hooks;constructor(){this.#e=new fGe,this.#t=new WeakMap,this.#n=new WeakSet,this.#r=new fGe,this.#i=new WeakMap,this.hooks={on:(e,t,n)=>{if(n?.once){let n=t,r=((...t)=>(this.#r.delete(e,r),n(...t)));t=r}this.#r.append(e,t),n&&this.#i.set(t,n),n?.signal&&n.signal.addEventListener(`abort`,()=>{this.#r.delete(e,t)},{once:!0})},removeListener:(e,t)=>{this.#r.delete(e,t)}}}on(e,t,n){return this.#a(e,t,n),this}once(e,t,n){return this.on(e,t,{...n||{},once:!0})}earlyOn(e,t,n){return this.#a(e,t,n,`prepend`),this}earlyOnce(e,t,n){return this.earlyOn(e,t,{...n||{},once:!0})}emit(e){if(this.#e.size===0)return!1;let t=this.listenerCount(e.type)>0,n=this.#o(e);for(let t of this.#c(e.type)){if(n.event[J8]!=null&&n.event[J8]!==this)return n.revoke(),!1;if(n.event[Y8])break;this.#s(n.event,t)}return n.revoke(),t}async emitAsPromise(e){if(this.#e.size===0)return[];let t=[],n=this.#o(e);for(let r of this.#c(e.type)){if(n.event[J8]!=null&&n.event[J8]!==this)return n.revoke(),[];if(n.event[Y8])break;let e=await Promise.resolve(this.#s(n.event,r));this.#l(r)||t.push(e)}return n.revoke(),Promise.allSettled(t).then(e=>e.map(e=>e.status===`fulfilled`?e.value:e.reason))}*emitAsGenerator(e){if(this.#e.size===0)return;let t=this.#o(e);for(let n of this.#c(e.type)){if(t.event[J8]!=null&&t.event[J8]!==this){t.revoke();return}if(t.event[Y8])break;let e=this.#s(t.event,n);this.#l(n)||(yield e)}t.revoke()}removeListener(e,t){let n=this.#t.get(t);this.#e.delete(e,t);for(let r of this.#r.get(`removeListener`))r(e,t,n)}removeAllListeners(e){if(e==null){this.#e.clear();for(let[e,t]of this.#r)this.#i.get(t)?.persist||this.#r.delete(e,t);return}this.#e.deleteAll(e)}listeners(e){return e==null?this.#e.getAll():this.#e.get(e)}listenerCount(e){return e==null?this.#e.size:this.listeners(e).length}#a(e,t,n,r=`append`){for(let r of this.#r.get(`newListener`))r(e,t,n);e===`*`&&this.#n.add(t),r===`prepend`?this.#e.prepend(e,t):this.#e.append(e,t),n&&(this.#t.set(t,n),n.signal&&n.signal.addEventListener(`abort`,()=>{this.removeListener(e,t)},{once:!0}))}#o(e){let{stopPropagation:t}=e;return e.stopPropagation=()=>{e[J8]=this,t.call(e)},{event:e,revoke(){e.stopPropagation=t}}}#s(e,t){for(let t of this.#r.get(`beforeEmit`))if(t(e)===!1)return;let n=t.call(this,e),r=this.#t.get(t);if(r?.once){let n=this.#l(t)?`*`:e.type;this.#e.delete(n,t);for(let e of this.#r.get(`removeListener`))e(n,t,r)}return n}*#c(e){for(let[t,n]of this.#e)(t===`*`||t===e)&&(yield n)}#l(e){return this.#n.has(e)}},hGe=V8(),gGe=class extends pGe{#e;constructor(e){let t=e.data.type,n=e.data.payload;super(t,{data:n}),this.#e=e}get ports(){return this.#e.ports}postMessage(e,...t){this.#e.ports[0].postMessage({type:e,data:t[0]},{transfer:t[1]})}},_Ge=class extends mGe{constructor(e){super(),this.options=e,hGe&&navigator.serviceWorker.addEventListener(`message`,async e=>{let t=await this.options.worker;e.source!=null&&e.source!==t||e.data&&qUe(e.data)&&`type`in e.data&&this.emit(new gGe(e))})}postMessage(e){g8(hGe,`Failed to post message on a WorkerChannel: the Service Worker API is unavailable in this context. This is likely an issue with MSW. Please report it on GitHub: https://github.com/mswjs/msw/issues`),this.options.worker.then(t=>{t.postMessage(e)})}};function vGe(e){if(![`HEAD`,`GET`].includes(e.method))return e.body}function yGe(e){return new Request(e.url,{...e,body:vGe(e)})}function bGe(e){location.href.startsWith(e.scope)||S6.warn(`Cannot intercept requests on this page because it's outside of the worker's scope ("${e.scope}"). If you wish to mock API requests on this page, you must resolve this scope issue. + +- (Recommended) Register the worker at the root level ("/") of your application. +- Set the "Service-Worker-Allowed" response header to allow out-of-scope workers.`)}var xGe=class extends rWe{constructor(e){super(),this.options=e,g8(V8(),`Failed to use Service Worker as the network source: the Service Worker API is not supported in this environment`),this.#e=new Map,this.workerPromise=new O8,this.#t=new _Ge({worker:this.workerPromise.then(([e])=>e)})}#e;#t;#n;#r;#i;workerPromise;async enable(){if(this.#i=void 0,this.workerPromise.state!==`pending`)return S6.warn(`Found a redundant "worker.start()" call. Note that starting the worker while mocking is already enabled will have no effect. Consider removing this "worker.start()" call.`),this.workerPromise.then(([,e])=>e);this.#t.removeAllListeners();let[e,t]=await this.#a();if(e.state!==`activated`){let t=new AbortController,n=new O8;n.then(()=>t.abort()),e.addEventListener(`statechange`,()=>{e.state===`activated`&&n.resolve()},{signal:t.signal}),await n}this.#t.postMessage(`MOCK_ACTIVATE`);let n=new O8;return this.#n=n,this.#t.once(`MOCKING_ENABLED`,e=>{n.resolve(e.data.client)}),await n,this.options.quiet||this.#u(),t}disable(){if(this.#i!==void 0){S6.warn(`Found a redundant "worker.stop()" call. Notice that stopping the worker after it has already been stopped has no effect. Consider removing this "worker.stop()" call.`);return}this.#i=Date.now(),this.#e.clear(),this.workerPromise=new O8,this.options.quiet||this.#d()}async#a(){this.#r&&clearInterval(this.#r);let e=this.options.serviceWorker.url,[t,n]=await dGe(e,this.options.serviceWorker.options,this.options.findWorker||this.#c);if(t==null){let t=this.options?.findWorker?S6.formatMessage(`Failed to locate the Service Worker registration using a custom "findWorker" predicate. + +Please ensure that the custom predicate properly locates the Service Worker registration at "%s". +More details: https://mswjs.io/docs/api/setup-worker/start#findworker + `,e):S6.formatMessage(`Failed to locate the Service Worker registration. + +This most likely means that the worker script URL "%s" cannot resolve against the actual public hostname (%s). This may happen if your application runs behind a proxy, or has a dynamic hostname. + +Please consider using a custom "serviceWorker.url" option to point to the actual worker script location, or a custom "findWorker" option to resolve the Service Worker registration manually. More details: https://mswjs.io/docs/api/setup-worker/start`,e,location.host);throw Error(t)}return this.workerPromise.resolve([t,n]),this.#t.on(`REQUEST`,this.#o.bind(this)),this.#t.on(`RESPONSE`,this.#s.bind(this)),window.addEventListener(`beforeunload`,()=>{t.state!==`redundant`&&this.#t.postMessage(`CLIENT_CLOSED`),clearInterval(this.#r),window.postMessage({type:`msw/worker:stop`})}),await this.#l().catch(e=>{S6.error(`Error while checking the worker script integrity. Please report this on GitHub (https://github.com/mswjs/msw/issues) and include the original error below.`),console.error(e)}),this.#r=window.setInterval(()=>{this.#t.postMessage(`KEEPALIVE_REQUEST`)},5e3),this.options.quiet||bGe(n),[t,n]}async#o(e){if(this.#i&&e.data.interceptedAt>this.#i)return e.postMessage(`PASSTHROUGH`);let t=yGe(e.data);DBe.cache.set(t,t.clone());let n=new SGe({event:e,request:t});this.#e.set(e.data.id,n),await this.queue(n)}async#s(e){let{request:t,response:n,isMockedResponse:r}=e.data;if(n.type?.includes(`opaque`)){this.#e.delete(t.id);return}let i=this.#e.get(t.id);if(this.#e.delete(t.id),i==null)return;let a=yGe(t),o=n.status===0?Response.error():new G8(G8.isResponseWithBody(n.status)?n.body:null,{...n,url:t.url});i.events.emit(new cWe(r?`response:mocked`:`response:bypass`,{requestId:i.data.id,request:a,response:o,isMockedResponse:r}))}#c=(e,t)=>e===t;async#l(){let e=new O8;return this.#t.postMessage(`INTEGRITY_CHECK_REQUEST`),this.#t.once(`INTEGRITY_CHECK_RESPONSE`,t=>{let{checksum:n,packageVersion:r}=t.data;n!==`4db4a41e972cec1b64cc569c66952d82`&&S6.warn(`The currently registered Service Worker has been generated by a different version of MSW (${r}) and may not be fully compatible with the installed version. + +It's recommended you update your worker script by running this command: + + \u2022 npx msw init + +You can also automate this process and make the worker script update automatically upon the library installations. Read more: https://mswjs.io/docs/cli/init.`),e.resolve()}),e}async#u(){if(this.workerPromise.state===`rejected`)return;g8(this.#n!=null,`[ServiceWorkerSource] Failed to print a start message: client confirmation not received`);let e=await this.#n,[t,n]=await this.workerPromise;console.groupCollapsed(`%c${S6.formatMessage(`Mocking enabled.`)}`,`color:orangered;font-weight:bold;`),console.log(`%cDocumentation: %chttps://mswjs.io/docs`,`font-weight:bold`,`font-weight:normal`),console.log(`Found an issue? https://github.com/mswjs/msw/issues`),console.log(`Worker script URL:`,t.scriptURL),console.log(`Worker scope:`,n.scope),e&&console.log(`Client ID: %s (%s)`,e.id,e.frameType),console.groupEnd()}#d(){console.log(`%c${S6.formatMessage(`Mocking disabled.`)}`,`color:orangered;font-weight:bold;`)}},SGe=class extends m8{#e;constructor(e){super({request:e.request}),this.#e=e.event}passthrough(){this.#e.postMessage(`PASSTHROUGH`)}respondWith(e){e&&this.#t(e)}errorWith(e){if(e instanceof Response)return this.respondWith(e);S6.warn(`Uncaught exception in the request handler for "%s %s". This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/http/mocking-responses/error-responses`,this.data.request.method,this.data.request.url);let t=e instanceof Error?e:Error(e?.toString()||`Request failure`);this.respondWith(u8.json({name:t.name,message:t.message,stack:t.stack},{status:500,statusText:`Request Handler Error`}))}async#t(e){let t,n,r=_We(e);eGe()?(t=e.body,n=e.body==null?void 0:[e.body]):t=e.body==null?null:await e.clone().arrayBuffer(),this.#e.postMessage(`MOCK_RESPONSE`,{...r,body:t},n)}},CGe=async e=>{try{return{error:null,data:await e().catch(e=>{throw e})}}catch(e){return{error:e,data:null}}};function wGe(e,t=!1){return t?Object.prototype.toString.call(e).startsWith(`[object `):Object.prototype.toString.call(e)===`[object Object]`}function X8(e,t){try{return e[t],!0}catch{return!1}}function TGe(e){return new Response(JSON.stringify(e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:e),{status:500,statusText:`Unhandled Exception`,headers:{"Content-Type":`application/json`}})}function Z8(e){return e!=null&&e instanceof Response&&X8(e,`type`)&&e.type===`error`}function EGe(e){return wGe(e,!0)&&X8(e,`status`)&&X8(e,`statusText`)&&X8(e,`bodyUsed`)}function DGe(e){return e==null||!(e instanceof Error)?!1:`code`in e&&`errno`in e}async function OGe(e){let t=async t=>t instanceof Error?(await e.controller.errorWith(t),!0):Z8(t)||EGe(t)?(await e.controller.respondWith(t),!0):wGe(t)?(await e.controller.errorWith(t),!0):!1,n=async n=>{if(n instanceof U8)throw i.error;return DGe(n)?(await e.controller.errorWith(n),!0):n instanceof Response?await t(n):!1},r=new O8;if(e.request.signal){if(e.request.signal.aborted){await e.controller.errorWith(e.request.signal.reason);return}e.request.signal.addEventListener(`abort`,()=>{r.reject(e.request.signal.reason)},{once:!0})}let i=await CGe(async()=>{let t=E8(e.emitter,`request`,{requestId:e.requestId,request:e.request,controller:e.controller});await Promise.race([r,t,e.controller.handled])});if(r.state===`rejected`){await e.controller.errorWith(r.rejectionReason);return}if(i.error){if(await n(i.error))return;if(e.emitter.listenerCount(`unhandledException`)>0){let n=new W8(e.request,{passthrough(){},async respondWith(e){await t(e)},async errorWith(t){await e.controller.errorWith(t)}});if(await E8(e.emitter,`unhandledException`,{error:i.error,request:e.request,requestId:e.requestId,controller:n}),n.readyState!==W8.PENDING)return}await e.controller.respondWith(TGe(i.error));return}return e.controller.readyState===W8.PENDING?await e.controller.passthrough():e.controller.handled}function Q8(e){return Object.assign(TypeError(`Failed to fetch`),{cause:e})}var kGe=[`content-encoding`,`content-language`,`content-location`,`content-type`,`content-length`],$8=Symbol(`kRedirectCount`);async function AGe(e,t){if(t.status!==303&&e.body!=null)return Promise.reject(Q8());let n=new URL(e.url),r;try{r=new URL(t.headers.get(`location`),e.url)}catch(e){return Promise.reject(Q8(e))}if(!(r.protocol===`http:`||r.protocol===`https:`))return Promise.reject(Q8(`URL scheme must be a HTTP(S) scheme`));if(Reflect.get(e,$8)>20)return Promise.reject(Q8(`redirect count exceeded`));if(Object.defineProperty(e,$8,{value:(Reflect.get(e,$8)||0)+1}),e.mode===`cors`&&(r.username||r.password)&&!jGe(n,r))return Promise.reject(Q8(`cross origin not allowed for request mode "cors"`));let i={};([301,302].includes(t.status)&&e.method===`POST`||t.status===303&&![`HEAD`,`GET`].includes(e.method))&&(i.method=`GET`,i.body=null,kGe.forEach(t=>{e.headers.delete(t)})),jGe(n,r)||(e.headers.delete(`authorization`),e.headers.delete(`proxy-authorization`),e.headers.delete(`cookie`),e.headers.delete(`host`)),i.headers=e.headers;let a=await fetch(new Request(r,i));return Object.defineProperty(a,`redirected`,{value:!0,configurable:!0}),a}function jGe(e,t){return e.origin===t.origin&&e.origin===`null`||e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port}var MGe=class extends TransformStream{constructor(){console.warn(`[Interceptors]: Brotli decompression of response streams is not supported in the browser`),super({transform(e,t){t.enqueue(e)}})}},NGe=class extends TransformStream{constructor(e,...t){super({},...t);let n=[super.readable,...e].reduce((e,t)=>e.pipeThrough(t));Object.defineProperty(this,`readable`,{get(){return n}})}};function PGe(e){return e.toLowerCase().split(`,`).map(e=>e.trim())}function FGe(e){if(e===``)return null;let t=PGe(e);return t.length===0?null:new NGe(t.reduceRight((e,t)=>t===`gzip`||t===`x-gzip`?e.concat(new DecompressionStream(`gzip`)):t===`deflate`?e.concat(new DecompressionStream(`deflate`)):t===`br`?e.concat(new MGe):(e.length=0,e),[]))}function IGe(e){if(e.body===null)return null;let t=FGe(e.headers.get(`content-encoding`)||``);return t?(e.body.pipeTo(t.writable),t.readable):null}var LGe=class e extends w8{static{this.symbol=Symbol(`fetch`)}constructor(){super(e.symbol)}checkEnvironment(){return D8(`fetch`)}async setup(){let e=globalThis.fetch;g8(!e[H8],`Failed to patch the "fetch" module: already patched.`),globalThis.fetch=async(t,n)=>{let r=T8(),i=typeof t==`string`&&typeof location<`u`&&!tGe(t)?new URL(t,location.href):t,a=new Request(i,n);t instanceof Request&&iGe(a,t);let o=new O8,s=new W8(a,{passthrough:async()=>{this.logger.info(`request has not been handled, passthrough...`);let t=a.clone(),{error:n,data:i}=await CGe(()=>e(a));if(n)return o.reject(n);if(this.logger.info(`original fetch performed`,i),this.emitter.listenerCount(`response`)>0){this.logger.info(`emitting the "response" event...`);let e=i.clone();await E8(this.emitter,`response`,{response:e,isMockedResponse:!1,request:t,requestId:r})}o.resolve(i)},respondWith:async e=>{if(Z8(e)){this.logger.info(`request has errored!`,{response:e}),o.reject(Q8(e));return}this.logger.info(`received mocked response!`,{rawResponse:e});let t=IGe(e),n=t===null?e:new G8(t,e);if(G8.setUrl(a.url,n),G8.isRedirectResponse(n.status)){if(a.redirect===`error`){o.reject(Q8(`unexpected redirect`));return}if(a.redirect===`follow`){AGe(a,n).then(e=>{o.resolve(e)},e=>{o.reject(e)});return}}this.emitter.listenerCount(`response`)>0&&(this.logger.info(`emitting the "response" event...`),await E8(this.emitter,`response`,{response:n.clone(),isMockedResponse:!0,request:a,requestId:r})),o.resolve(n)},errorWith:e=>{this.logger.info(`request has been aborted!`,{reason:e}),o.reject(e)}});return this.logger.info(`[%s] %s`,a.method,a.url),this.logger.info(`awaiting for the mocked response...`),this.logger.info(`emitting the "request" event for %s listener(s)...`,this.emitter.listenerCount(`request`)),await OGe({request:a,requestId:r,emitter:this.emitter,controller:s}),o},Object.defineProperty(globalThis.fetch,H8,{enumerable:!0,configurable:!0,value:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis.fetch,H8,{value:void 0}),globalThis.fetch=e,this.logger.info(`restored native "globalThis.fetch"!`,globalThis.fetch.name)})}};function RGe(e,t){let n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}var zGe=class{constructor(e,t){this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.type=``,this.srcElement=null,this.currentTarget=null,this.eventPhase=0,this.isTrusted=!0,this.composed=!1,this.cancelable=!0,this.defaultPrevented=!1,this.bubbles=!0,this.lengthComputable=!0,this.loaded=0,this.total=0,this.cancelBubble=!1,this.returnValue=!0,this.type=e,this.target=t?.target||null,this.currentTarget=t?.currentTarget||null,this.timeStamp=Date.now()}composedPath(){return[]}initEvent(e,t,n){this.type=e,this.bubbles=!!t,this.cancelable=!!n}preventDefault(){this.defaultPrevented=!0}stopPropagation(){}stopImmediatePropagation(){}},BGe=class extends zGe{constructor(e,t){super(e),this.lengthComputable=t?.lengthComputable||!1,this.composed=t?.composed||!1,this.loaded=t?.loaded||0,this.total=t?.total||0}},VGe=typeof ProgressEvent<`u`;function HGe(e,t,n){let r=[`error`,`progress`,`loadstart`,`loadend`,`load`,`timeout`,`abort`],i=VGe?ProgressEvent:BGe;return r.includes(t)?new i(t,{lengthComputable:!0,loaded:n?.loaded||0,total:n?.total||0}):new zGe(t,{target:e,currentTarget:e})}function UGe(e,t){if(!(t in e))return null;if(Object.prototype.hasOwnProperty.call(e,t))return e;let n=Reflect.getPrototypeOf(e);return n?UGe(n,t):null}function e5(e,t){return new Proxy(e,WGe(t))}function WGe(e){let{constructorCall:t,methodCall:n,getProperty:r,setProperty:i}=e,a={};return t!==void 0&&(a.construct=function(e,n,r){let i=Reflect.construct.bind(null,e,n,r);return t.call(r,n,i)}),a.set=function(e,t,n){let r=()=>{let r=UGe(e,t)||e,i=Reflect.getOwnPropertyDescriptor(r,t);return i?.set===void 0?Reflect.defineProperty(r,t,{writable:!0,enumerable:!0,configurable:!0,value:n}):(i.set.apply(e,[n]),!0)};return i===void 0?r():i.call(e,[t,n],r)},a.get=function(e,t,i){let a=()=>e[t],o=r===void 0?a():r.call(e,[t,i],a);return typeof o==`function`?(...r)=>{let i=o.bind(e,...r);return n===void 0?i():n.call(e,[t,r],i)}:o},a}function GGe(e){return[`application/xhtml+xml`,`application/xml`,`image/svg+xml`,`text/html`,`text/xml`].some(t=>e.startsWith(t))}function KGe(e){try{return JSON.parse(e)}catch{return null}}function qGe(e,t){return new G8(G8.isResponseWithBody(e.status)?t:null,{url:e.responseURL,status:e.status,statusText:e.statusText,headers:JGe(e.getAllResponseHeaders())})}function JGe(e){let t=new Headers,n=e.split(/[\r\n]+/);for(let e of n){if(e.trim()===``)continue;let[n,...r]=e.split(`: `),i=r.join(`: `);t.append(n,i)}return t}async function YGe(e){let t=e.headers.get(`content-length`);return t!=null&&t!==``?Number(t):(await e.arrayBuffer()).byteLength}var t5=Symbol(`kIsRequestHandled`),XGe=_8(),n5=Symbol(`kFetchRequest`),ZGe=class{constructor(e,t){this.initialRequest=e,this.logger=t,this.method=`GET`,this.url=null,this[t5]=!1,this.events=new Map,this.uploadEvents=new Map,this.requestId=T8(),this.requestHeaders=new Headers,this.responseBuffer=new Uint8Array,this.request=e5(e,{setProperty:([e,t],n)=>{switch(e){case`ontimeout`:{let r=e.slice(2);return this.request.addEventListener(r,t),n()}default:return n()}},methodCall:([e,t],n)=>{switch(e){case`open`:{let[e,r]=t;return r===void 0?(this.method=`GET`,this.url=QGe(e)):(this.method=e,this.url=QGe(r)),this.logger=this.logger.extend(`${this.method} ${this.url.href}`),this.logger.info(`open`,this.method,this.url.href),n()}case`addEventListener`:{let[e,r]=t;return this.registerEvent(e,r),this.logger.info(`addEventListener`,e,r),n()}case`setRequestHeader`:{let[e,r]=t;return this.requestHeaders.set(e,r),this.logger.info(`setRequestHeader`,e,r),n()}case`send`:{let[e]=t;this.request.addEventListener(`load`,()=>{if(this.onResponse!==void 0){let e=qGe(this.request,this.request.response);this.onResponse.call(this,{response:e,isMockedResponse:this[t5],request:i,requestId:this.requestId})}});let r=typeof e==`string`?oGe(e):e,i=this.toFetchApiRequest(r);this[n5]=i.clone(),queueMicrotask(()=>{(this.onRequest?.call(this,{request:i,requestId:this.requestId})||Promise.resolve()).finally(()=>{if(!this[t5])return this.logger.info(`request callback settled but request has not been handled (readystate %d), performing as-is...`,this.request.readyState),XGe&&this.request.setRequestHeader(zWe,this.requestId),n()})});break}default:return n()}}}),r5(this.request,`upload`,e5(this.request.upload,{setProperty:([e,t],n)=>{switch(e){case`onloadstart`:case`onprogress`:case`onaboart`:case`onerror`:case`onload`:case`ontimeout`:case`onloadend`:{let n=e.slice(2);this.registerUploadEvent(n,t)}}return n()},methodCall:([e,t],n)=>{switch(e){case`addEventListener`:{let[e,r]=t;return this.registerUploadEvent(e,r),this.logger.info(`upload.addEventListener`,e,r),n()}}}}))}registerEvent(e,t){let n=(this.events.get(e)||[]).concat(t);this.events.set(e,n),this.logger.info(`registered event "%s"`,e,t)}registerUploadEvent(e,t){let n=(this.uploadEvents.get(e)||[]).concat(t);this.uploadEvents.set(e,n),this.logger.info(`registered upload event "%s"`,e,t)}async respondWith(e){if(this[t5]=!0,this[n5]){let e=await YGe(this[n5]);this.trigger(`loadstart`,this.request.upload,{loaded:0,total:e}),this.trigger(`progress`,this.request.upload,{loaded:e,total:e}),this.trigger(`load`,this.request.upload,{loaded:e,total:e}),this.trigger(`loadend`,this.request.upload,{loaded:e,total:e})}this.logger.info(`responding with a mocked response: %d %s`,e.status,e.statusText),r5(this.request,`status`,e.status),r5(this.request,`statusText`,e.statusText),r5(this.request,`responseURL`,this.url.href),this.request.getResponseHeader=new Proxy(this.request.getResponseHeader,{apply:(t,n,r)=>{if(this.logger.info(`getResponseHeader`,r[0]),this.request.readyState{if(this.logger.info(`getAllResponseHeaders`),this.request.readyState`${e}: ${t}`).join(`\r +`);return this.logger.info(`resolved all response headers to`,t),t}}),Object.defineProperties(this.request,{response:{enumerable:!0,configurable:!1,get:()=>this.response},responseText:{enumerable:!0,configurable:!1,get:()=>this.responseText},responseXML:{enumerable:!0,configurable:!1,get:()=>this.responseXML}});let t=await YGe(e.clone());this.logger.info(`calculated response body length`,t),this.trigger(`loadstart`,this.request,{loaded:0,total:t}),this.setReadyState(this.request.HEADERS_RECEIVED),this.setReadyState(this.request.LOADING);let n=()=>{this.logger.info(`finalizing the mocked response...`),this.setReadyState(this.request.DONE),this.trigger(`load`,this.request,{loaded:this.responseBuffer.byteLength,total:t}),this.trigger(`loadend`,this.request,{loaded:this.responseBuffer.byteLength,total:t})};if(e.body){this.logger.info(`mocked response has body, streaming...`);let r=e.body.getReader(),i=async()=>{let{value:e,done:a}=await r.read();if(a){this.logger.info(`response body stream done!`),n();return}e&&(this.logger.info(`read response body chunk:`,e),this.responseBuffer=RGe(this.responseBuffer,e),this.trigger(`progress`,this.request,{loaded:this.responseBuffer.byteLength,total:t})),i()};i()}else n()}responseBufferToText(){return sGe(this.responseBuffer)}get response(){if(this.logger.info(`getResponse (responseType: %s)`,this.request.responseType),this.request.readyState!==this.request.DONE)return null;switch(this.request.responseType){case`json`:{let e=KGe(this.responseBufferToText());return this.logger.info(`resolved response JSON`,e),e}case`arraybuffer`:{let e=cGe(this.responseBuffer);return this.logger.info(`resolved response ArrayBuffer`,e),e}case`blob`:{let e=this.request.getResponseHeader(`Content-Type`)||`text/plain`,t=new Blob([this.responseBufferToText()],{type:e});return this.logger.info(`resolved response Blob (mime type: %s)`,t,e),t}default:{let e=this.responseBufferToText();return this.logger.info(`resolving "%s" response type as text`,this.request.responseType,e),e}}}get responseText(){if(g8(this.request.responseType===``||this.request.responseType===`text`,`InvalidStateError: The object is in invalid state.`),this.request.readyState!==this.request.LOADING&&this.request.readyState!==this.request.DONE)return``;let e=this.responseBufferToText();return this.logger.info(`getResponseText: "%s"`,e),e}get responseXML(){if(g8(this.request.responseType===``||this.request.responseType===`document`,`InvalidStateError: The object is in invalid state.`),this.request.readyState!==this.request.DONE)return null;let e=this.request.getResponseHeader(`Content-Type`)||``;return typeof DOMParser>`u`?(console.warn(`Cannot retrieve XMLHttpRequest response body as XML: DOMParser is not defined. You are likely using an environment that is not browser or does not polyfill browser globals correctly.`),null):GGe(e)?new DOMParser().parseFromString(this.responseBufferToText(),e):null}errorWith(e){this[t5]=!0,this.logger.info(`responding with an error`),this.setReadyState(this.request.DONE),this.trigger(`error`,this.request),this.trigger(`loadend`,this.request)}setReadyState(e){if(this.logger.info(`setReadyState: %d -> %d`,this.request.readyState,e),this.request.readyState===e){this.logger.info(`ready state identical, skipping transition...`);return}r5(this.request,`readyState`,e),this.logger.info(`set readyState to: %d`,e),e!==this.request.UNSENT&&(this.logger.info(`triggering "readystatechange" event...`),this.trigger(`readystatechange`,this.request))}trigger(e,t,n){let r=t[`on${e}`],i=HGe(t,e,n);this.logger.info(`trigger "%s"`,e,n||``),typeof r==`function`&&(this.logger.info(`found a direct "%s" callback, calling...`,e),r.call(t,i));let a=t instanceof XMLHttpRequestUpload?this.uploadEvents:this.events;for(let[n,r]of a)n===e&&(this.logger.info(`found %d listener(s) for "%s" event, calling...`,r.length,e),r.forEach(e=>e.call(t,i)))}toFetchApiRequest(e){this.logger.info(`converting request to a Fetch API Request...`);let t=e instanceof Document?e.documentElement.innerText:e,n=new Request(this.url.href,{method:this.method,headers:this.requestHeaders,credentials:this.request.withCredentials?`include`:`same-origin`,body:[`GET`,`HEAD`].includes(this.method.toUpperCase())?null:t});return r5(n,`headers`,e5(n.headers,{methodCall:([e,t],r)=>{switch(e){case`append`:case`set`:{let[e,n]=t;this.request.setRequestHeader(e,n);break}case`delete`:{let[e]=t;console.warn(`XMLHttpRequest: Cannot remove a "${e}" header from the Fetch API representation of the "${n.method} ${n.url}" request. XMLHttpRequest headers cannot be removed.`);break}}return r()}})),iGe(n,this.request),this.logger.info(`converted request to a Fetch API Request!`,n),n}};function QGe(e){return typeof location>`u`?new URL(e):new URL(e.toString(),location.href)}function r5(e,t,n){Reflect.defineProperty(e,t,{writable:!0,enumerable:!0,value:n})}function $Ge({emitter:e,logger:t}){return new Proxy(globalThis.XMLHttpRequest,{construct(n,r,i){t.info(`constructed new XMLHttpRequest`);let a=Reflect.construct(n,r,i),o=Object.getOwnPropertyDescriptors(n.prototype);for(let e in o)Reflect.defineProperty(a,e,o[e]);let s=new ZGe(a,t);return s.onRequest=async function({request:t,requestId:n}){let r=new W8(t,{passthrough:()=>{this.logger.info(`no mocked response received, performing request as-is...`)},respondWith:async e=>{if(Z8(e)){this.errorWith(TypeError(`Network error`));return}await this.respondWith(e)},errorWith:e=>{this.logger.info(`request errored!`,{error:e}),e instanceof Error&&this.errorWith(e)}});this.logger.info(`awaiting mocked response...`),this.logger.info(`emitting the "request" event for %s listener(s)...`,e.listenerCount(`request`)),await OGe({request:t,requestId:n,controller:r,emitter:e})},s.onResponse=async function({response:t,isMockedResponse:n,request:r,requestId:i}){this.logger.info(`emitting the "response" event for %s listener(s)...`,e.listenerCount(`response`)),e.emit(`response`,{response:t,isMockedResponse:n,request:r,requestId:i})},s.request}})}var eKe=class e extends w8{static{this.interceptorSymbol=Symbol(`xhr`)}constructor(){super(e.interceptorSymbol)}checkEnvironment(){return D8(`XMLHttpRequest`)}setup(){let e=this.logger.extend(`setup`);e.info(`patching "XMLHttpRequest" module...`);let t=globalThis.XMLHttpRequest;g8(!t[H8],`Failed to patch the "XMLHttpRequest" module: already patched.`),globalThis.XMLHttpRequest=$Ge({emitter:this.emitter,logger:this.logger}),e.info(`native "XMLHttpRequest" module patched!`,globalThis.XMLHttpRequest.name),Object.defineProperty(globalThis.XMLHttpRequest,H8,{enumerable:!0,configurable:!0,value:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis.XMLHttpRequest,H8,{value:void 0}),globalThis.XMLHttpRequest=t,e.info(`native "XMLHttpRequest" module restored!`,globalThis.XMLHttpRequest.name)})}},tKe=class extends pWe{constructor(e){super({interceptors:[new eKe,new LGe]}),this.options=e}enable(){super.enable(),this.options.quiet||this.#e()}disable(){super.disable(),this.options.quiet||this.#t()}#e(){console.groupCollapsed(`%c${S6.formatMessage(`Mocking enabled (fallback mode).`)}`,`color:orangered;font-weight:bold;`),console.log(`%cDocumentation: %chttps://mswjs.io/docs`,`font-weight:bold`,`font-weight:normal`),console.log(`Found an issue? https://github.com/mswjs/msw/issues`),console.groupEnd()}#t(){console.log(`%c${S6.formatMessage(`Mocking disabled.`)}`,`color:orangered;font-weight:bold;`)}},nKe=`/mockServiceWorker.js`;function rKe(...e){g8(!_8(),S6.formatMessage("Failed to execute `setupWorker` in a non-browser environment"));let t=tWe({sources:[],handlers:e});return{async start(e){if(e?.waitUntilReady!=null&&S6.warn(`The "waitUntilReady" option has been deprecated. Please remove it from this "worker.start()" call. Follow the recommended Browser integration (https://mswjs.io/docs/integrations/browser) to eliminate any race conditions between the Service Worker registration and any requests made by your application on initial render.`),t.readyState===d8.ENABLED){S6.warn(`Found a redundant "worker.start()" call. Note that starting the worker while mocking is already enabled will have no effect. Consider removing this "worker.start()" call.`);return}let n=V8()?new xGe({serviceWorker:{url:e?.serviceWorker?.url?.toString()||nKe,options:e?.serviceWorker?.options},findWorker:e?.findWorker,quiet:e?.quiet}):new tKe({quiet:e?.quiet});if(t.configure({sources:[n,new pWe({interceptors:[new $We]})],onUnhandledFrame:gWe(()=>e?.onUnhandledRequest||`warn`),context:{quiet:e?.quiet}}),await t.enable(),n instanceof xGe){let[,e]=await n.workerPromise;return e}},stop(){if(t.readyState===d8.DISABLED){S6.warn(`Found a redundant "worker.stop()" call. Notice that stopping the worker after it has already been stopped has no effect. Consider removing this "worker.stop()" call.`);return}t.disable(),window.postMessage({type:`msw/worker:stop`})},events:t.events,use:t.use.bind(t),resetHandlers:t.resetHandlers.bind(t),restoreHandlers:t.restoreHandlers.bind(t),listHandlers:t.listHandlers.bind(t)}}function iKe(e){let t={},n=Array.from(new Set(e.searchParams.keys()));for(let r of n){let n=e.searchParams.getAll(r),i=n.length===1?n[0]:n,a=e=>{if(e===`true`)return!0;if(e===`false`)return!1;if(e===`null`)return null;if(e===`undefined`)return;let t=Number(e);if(!isNaN(t)&&e.trim()!==``&&String(t)===e)return t;if(e.startsWith(`{`)&&e.endsWith(`}`)||e.startsWith(`[`)&&e.endsWith(`]`))try{return JSON.parse(e)}catch{}return e};Array.isArray(i)?t[r]=i.map(a):t[r]=a(i)}return t}var aKe=class{constructor(e={}){this.name=`com.objectstack.plugin.msw`,this.type=`server`,this.version=`0.9.0`,this.handlers=[],this.init=async e=>{e.logger.debug(`Initializing MSW plugin`,{enableBrowser:this.options.enableBrowser,baseUrl:this.options.baseUrl,logRequests:this.options.logRequests}),e.logger.info(`MSW plugin initialized`)},this.start=async e=>{e.logger.debug(`Starting MSW plugin`);try{try{this.protocol=e.getService(`protocol`),e.logger.debug(`Protocol service found from context`)}catch{}if(!this.protocol)try{let t=e.getService(`objectql`),{ObjectStackProtocolImplementation:n}=await Gf(async()=>{let{ObjectStackProtocolImplementation:e}=await Promise.resolve().then(()=>UPe);return{ObjectStackProtocolImplementation:e}},void 0,import.meta.url);this.protocol=new n(t),e.logger.debug(`Protocol implementation created dynamically`)}catch(t){if(t.code===`ERR_MODULE_NOT_FOUND`)e.logger.warn(`Module @objectstack/objectql not found. Protocol not initialized.`);else throw t}this.protocol||e.logger.warn(`No ObjectStackProtocol service available. MSW will only serve static/custom handlers if configured.`)}catch(t){throw e.logger.error(`Failed to initialize protocol`,t),Error(`[MSWPlugin] Failed to initialize protocol`)}this.setupHandlers(e),await this.startWorker(e)},this.options={enableBrowser:!0,baseUrl:`/api/v1`,logRequests:!0,...e}}async destroy(){await this.stopWorker()}setupHandlers(e){try{this.dispatcher=new UAe(e.getKernel())}catch{e.logger.warn(`[MSWPlugin] Could not initialize HttpDispatcher via Kernel. Falling back to simple handlers.`)}let t=this.options.baseUrl||`/api/v1`;if(this.handlers=[...this.options.customHandlers||[]],this.handlers.push(n8.get(`*/.well-known/objectstack`,async()=>this.dispatcher?u8.json({data:await this.dispatcher.getDiscoveryInfo(t)}):u8.json({data:{version:`v1`,apiName:`ObjectStack API`,url:t,capabilities:{graphql:!1,search:!1,websockets:!1,files:!1,analytics:!1,hub:!1}}}))),this.handlers.push(n8.get(`*${t}`,async()=>this.dispatcher?u8.json({data:await this.dispatcher.getDiscoveryInfo(t)}):u8.json({data:{version:`v1`,url:t}})),n8.get(`*${t}/discovery`,async()=>this.dispatcher?u8.json({data:await this.dispatcher.getDiscoveryInfo(t)}):u8.json({data:{version:`v1`,url:t}}))),this.dispatcher){let n=this.dispatcher,r=async({request:e,params:r})=>{let i=new URL(e.url),a=i.pathname;a.startsWith(t)&&(a=a.slice(t.length)),this.options.logRequests&&console.log(`[MSW] Intercepted: ${e.method} ${i.pathname}`,{path:a});let o;if(e.method!==`GET`&&e.method!==`HEAD`)try{o=await e.clone().json()}catch{}let s=iKe(i),c=await n.dispatch(e.method,a,o,s,{request:e},t);if(c.handled){if(c.response)return u8.json(c.response.body,{status:c.response.status,headers:c.response.headers});if(c.result)return c.result.type===`redirect`?u8.redirect(c.result.url):u8.json(c.result)}};this.handlers.push(n8.all(`*${t}/*`,r),n8.all(`*${t}`,r)),e.logger.info(`MSW handlers set up using HttpDispatcher`,{baseUrl:t})}else e.logger.warn(`[MSWPlugin] No dispatcher available. No API routes registered.`)}async startWorker(e){this.options.enableBrowser&&typeof window<`u`?(e.logger.debug(`Starting MSW in browser mode`),this.worker=rKe(...this.handlers),await this.worker.start({onUnhandledRequest:`bypass`}),e.logger.info(`MSW started in browser mode`)):e.logger.debug(`MSW browser mode disabled or not in browser environment`)}async stopWorker(){this.worker&&(this.worker.stop(),console.log(`[MSWPlugin] Stopped MSW worker`))}getWorker(){return this.worker}getHandlers(){return this.handlers}},i5={administration:`area_administration`,platform:`area_platform`,system:`area_system`,ai:`area_ai`},oKe=[{id:i5.administration,label:`Administration`,icon:`shield`,order:10,description:`User management, roles, permissions, and security settings`,navigation:[]},{id:i5.platform,label:`Platform`,icon:`layers`,order:20,description:`Objects, fields, layouts, automation, and extensibility settings`,navigation:[]},{id:i5.system,label:`System`,icon:`settings`,order:30,description:`Datasources, integrations, jobs, logs, and environment configuration`,navigation:[]},{id:i5.ai,label:`AI`,icon:`brain`,order:40,description:`AI agents, model registry, RAG pipelines, and intelligence settings`,navigation:[]}],sKe={name:`setup`,label:`Setup`,description:`Platform settings and administration`,icon:`settings`,active:!0,isDefault:!1,branding:{primaryColor:`#475569`},requiredPermissions:[`setup.access`],areas:[]},cKe=class{constructor(){this.name=`com.objectstack.setup`,this.type=`standard`,this.version=`1.0.0`,this.dependencies=[`com.objectstack.engine.objectql`],this.contributions=[]}async init(e){e.logger.info(`Initializing Setup Plugin...`),e.registerService(`setupNav`,{contribute:e=>{this.contributions.push(e)}}),e.logger.info(`Setup Plugin initialized — setupNav service registered`)}async start(e){e.logger.info(`Starting Setup Plugin — finalizing Setup App...`);let t=this.mergeAreas(this.contributions),n={...sKe,areas:t.length>0?t:void 0};e.getService(`manifest`).register({id:`com.objectstack.setup`,name:`Setup`,version:`1.0.0`,type:`plugin`,namespace:`sys`,objects:[],apps:[n]}),e.logger.info(`Setup App registered with ${t.length} area(s) and ${this.contributions.length} contribution(s)`)}async destroy(){this.contributions=[]}mergeAreas(e){let t=new Map(oKe.map(e=>[e.id,{...e,navigation:[...e.navigation]}]));for(let n of e){let e=t.get(n.areaId);e?e.navigation.push(...n.items):t.set(n.areaId,{id:n.areaId,label:n.areaId,order:100,navigation:[...n.items]})}return Array.from(t.values()).filter(e=>e.navigation.length>0).sort((e,t)=>(e.order??0)-(t.order??0))}};r().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 a5=r().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)`);r().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 lKe=E([`on_create`,`on_update`,`on_create_or_update`,`on_delete`,`schedule`]),uKe=h({name:r().describe(`Action name`),type:m(`field_update`),field:r().describe(`Field to update`),value:u().describe(`Value or Formula to set`)}),dKe=h({name:r().describe(`Action name`),type:m(`email_alert`),template:r().describe(`Email template ID/DevName`),recipients:C(r()).describe(`List of recipient emails or user IDs`)}),fKe=h({name:r().describe(`Action name`),type:m(`connector_action`),connectorId:r().describe(`Target Connector ID (e.g. slack, twilio)`),actionId:r().describe(`Target Action ID (e.g. send_message)`),input:d(r(),u()).describe(`Input parameters matching the action schema`)}),pKe=I(`type`,[uKe,dKe,h({name:r().describe(`Action name`),type:m(`http_call`),url:r().describe(`Target URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`]).default(`POST`).describe(`HTTP Method`),headers:d(r(),r()).optional().describe(`HTTP Headers`),body:r().optional().describe(`Request body (JSON or text)`)}),fKe,h({name:r().describe(`Action name`),type:m(`task_creation`),taskObject:r().describe(`Task object name (e.g., "task", "project_task")`),subject:r().describe(`Task subject/title`),description:r().optional().describe(`Task description`),assignedTo:r().optional().describe(`User ID or field reference for assignee`),dueDate:r().optional().describe(`Due date (ISO string or formula)`),priority:r().optional().describe(`Task priority`),relatedTo:r().optional().describe(`Related record ID or field reference`),additionalFields:d(r(),u()).optional().describe(`Additional custom fields`)}),h({name:r().describe(`Action name`),type:m(`push_notification`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),recipients:C(r()).describe(`User IDs or device tokens`),data:d(r(),u()).optional().describe(`Additional data payload`),badge:P().optional().describe(`Badge count (iOS)`),sound:r().optional().describe(`Notification sound`),clickAction:r().optional().describe(`Action/URL when notification is clicked`)}),h({name:r().describe(`Action name`),type:m(`custom_script`),language:E([`javascript`,`typescript`,`python`]).default(`javascript`).describe(`Script language`),code:r().describe(`Script code to execute`),timeout:P().default(3e4).describe(`Execution timeout in milliseconds`),context:d(r(),u()).optional().describe(`Additional context variables`)})]),mKe=h({id:r().optional().describe(`Unique identifier`),timeLength:P().int().describe(`Duration amount (e.g. 1, 30)`),timeUnit:E([`minutes`,`hours`,`days`]).describe(`Unit of time`),offsetDirection:E([`before`,`after`]).describe(`Before or After the reference date`),offsetFrom:E([`trigger_date`,`date_field`]).describe(`Basis for calculation`),dateField:r().optional().describe(`Date field to calculate from (required if offsetFrom is date_field)`),actions:C(pKe).describe(`Actions to execute at the scheduled time`)});h({name:a5.describe(`Unique workflow name (lowercase snake_case)`),objectName:r().describe(`Target Object`),triggerType:lKe.describe(`When to evaluate`),criteria:r().optional().describe(`Formula condition. If TRUE, actions execute.`),actions:C(pKe).optional().describe(`Immediate actions`),timeTriggers:C(mKe).optional().describe(`Scheduled actions relative to trigger or date field`),active:S().default(!0).describe(`Whether this workflow is active`),executionOrder:P().int().min(0).default(100).describe(`Deterministic execution order when multiple workflows match (lower runs first)`),reevaluateOnChange:S().default(!1).describe(`Re-evaluate rule if field updates change the record validity`)});var hKe=E([`start`,`end`,`decision`,`assignment`,`loop`,`create_record`,`update_record`,`delete_record`,`get_record`,`http_request`,`script`,`screen`,`wait`,`subflow`,`connector_action`,`parallel_gateway`,`join_gateway`,`boundary_event`]),gKe=h({name:r().describe(`Variable name`),type:r().describe(`Data type (text, number, boolean, object, list)`),isInput:S().default(!1).describe(`Is input parameter`),isOutput:S().default(!1).describe(`Is output parameter`)}),_Ke=h({id:r().describe(`Node unique ID`),type:hKe.describe(`Action type`),label:r().describe(`Node label`),config:d(r(),u()).optional().describe(`Node configuration`),connectorConfig:h({connectorId:r(),actionId:r(),input:d(r(),u()).describe(`Mapped inputs for the action`)}).optional(),position:h({x:P(),y:P()}).optional(),timeoutMs:P().int().min(0).optional().describe(`Maximum execution time for this node in milliseconds`),inputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Parameter type`),required:S().default(!1).describe(`Whether the parameter is required`),description:r().optional().describe(`Parameter description`)})).optional().describe(`Input parameter schema for this node`),outputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Output type`),description:r().optional().describe(`Output description`)})).optional().describe(`Output schema declaration for this node`),waitEventConfig:h({eventType:E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`What kind of event resumes the execution`),timerDuration:r().optional().describe(`ISO 8601 duration (e.g., "PT1H") or wait time for timer events`),signalName:r().optional().describe(`Named signal or webhook event to wait for`),timeoutMs:P().int().min(0).optional().describe(`Maximum wait time before timeout (ms)`),onTimeout:E([`fail`,`continue`]).default(`fail`).describe(`Behavior when the wait times out`)}).optional().describe(`Configuration for wait node event resumption`),boundaryConfig:h({attachedToNodeId:r().describe(`Host node ID this boundary event monitors`),eventType:E([`error`,`timer`,`signal`,`cancel`]).describe(`Boundary event trigger type`),interrupting:S().default(!0).describe(`If true, the host activity is cancelled when this event fires`),errorCode:r().optional().describe(`Specific error code to catch (empty = catch all errors)`),timerDuration:r().optional().describe(`ISO 8601 duration for timer boundary events`),signalName:r().optional().describe(`Named signal to catch`)}).optional().describe(`Configuration for boundary events attached to host nodes`)}),vKe=h({id:r().describe(`Edge unique ID`),source:r().describe(`Source Node ID`),target:r().describe(`Target Node ID`),condition:r().optional().describe(`Expression returning boolean used for branching`),type:E([`default`,`fault`,`conditional`]).default(`default`).describe(`Connection type: default (normal flow), fault (error path), or conditional (expression-guarded)`),label:r().optional().describe(`Label on the connector`),isDefault:S().default(!1).describe(`Marks this edge as the default path when no other conditions match`)}),yKe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name`),label:r().describe(`Flow label`),description:r().optional(),version:P().int().default(1).describe(`Version number`),status:E([`draft`,`active`,`obsolete`,`invalid`]).default(`draft`).describe(`Deployment status`),template:S().default(!1).describe(`Is logic template (Subflow)`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).describe(`Flow type`),variables:C(gKe).optional().describe(`Flow variables`),nodes:C(_Ke).describe(`Flow nodes`),edges:C(vKe).describe(`Flow connections`),active:S().default(!1).describe(`Is active (Deprecated: use status)`),runAs:E([`system`,`user`]).default(`user`).describe(`Execution context`),errorHandling:h({strategy:E([`fail`,`retry`,`continue`]).default(`fail`).describe(`How to handle node execution errors`),maxRetries:P().int().min(0).max(10).default(0).describe(`Number of retry attempts (only for retry strategy)`),retryDelayMs:P().int().min(0).default(1e3).describe(`Delay between retries in milliseconds`),backoffMultiplier:P().min(1).default(1).describe(`Multiplier for exponential backoff between retries`),maxRetryDelayMs:P().int().min(0).default(3e4).describe(`Maximum delay between retries in milliseconds`),jitter:S().default(!1).describe(`Add random jitter to retry delay to avoid thundering herd`),fallbackNodeId:r().optional().describe(`Node ID to jump to on unrecoverable error`)}).optional().describe(`Flow-level error handling configuration`)});h({flowName:r().describe(`Flow machine name`),version:P().int().min(1).describe(`Version number`),definition:yKe.describe(`Complete flow definition snapshot`),createdAt:r().datetime().describe(`When this version was created`),createdBy:r().optional().describe(`User who created this version`),changeNote:r().optional().describe(`Description of what changed in this version`)});var bKe=E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]),xKe=h({nodeId:r().describe(`Node ID that was executed`),nodeType:r().describe(`Node action type (e.g., "decision", "http_request")`),nodeLabel:r().optional().describe(`Human-readable node label`),status:E([`success`,`failure`,`skipped`]).describe(`Step execution result`),startedAt:r().datetime().describe(`When the step started`),completedAt:r().datetime().optional().describe(`When the step completed`),durationMs:P().int().min(0).optional().describe(`Step execution duration in milliseconds`),input:d(r(),u()).optional().describe(`Input data passed to the node`),output:d(r(),u()).optional().describe(`Output data produced by the node`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`)}).optional().describe(`Error details if step failed`),retryAttempt:P().int().min(0).optional().describe(`Retry attempt number (0 = first try)`)});h({id:r().describe(`Execution instance ID`),flowName:r().describe(`Machine name of the executed flow`),flowVersion:P().int().optional().describe(`Version of the flow that was executed`),status:bKe.describe(`Current execution status`),trigger:h({type:r().describe(`Trigger type (e.g., "record_change", "schedule", "api", "manual")`),recordId:r().optional().describe(`Triggering record ID`),object:r().optional().describe(`Triggering object name`),userId:r().optional().describe(`User who triggered the execution`),metadata:d(r(),u()).optional().describe(`Additional trigger context`)}).describe(`What triggered this execution`),steps:C(xKe).describe(`Ordered list of executed steps`),variables:d(r(),u()).optional().describe(`Final state of flow variables`),startedAt:r().datetime().describe(`Execution start timestamp`),completedAt:r().datetime().optional().describe(`Execution completion timestamp`),durationMs:P().int().min(0).optional().describe(`Total execution duration in milliseconds`),runAs:E([`system`,`user`]).optional().describe(`Execution context identity`),tenantId:r().optional().describe(`Tenant ID for multi-tenant isolation`)});var SKe=E([`warning`,`error`,`critical`]);h({id:r().describe(`Error record ID`),executionId:r().describe(`Parent execution ID`),nodeId:r().optional().describe(`Node where the error occurred`),severity:SKe.describe(`Error severity level`),code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),stack:r().optional().describe(`Stack trace for debugging`),context:d(r(),u()).optional().describe(`Additional diagnostic context (input data, config snapshot)`),timestamp:r().datetime().describe(`When the error occurred`),retryable:S().default(!1).describe(`Whether this error can be retried`),resolvedAt:r().datetime().optional().describe(`When the error was resolved (e.g., after successful retry)`)}),h({id:r().describe(`Checkpoint ID`),executionId:r().describe(`Parent execution ID`),flowName:r().describe(`Flow machine name`),currentNodeId:r().describe(`Node ID where execution is paused`),variables:d(r(),u()).describe(`Flow variable state at checkpoint`),completedNodeIds:C(r()).describe(`List of node IDs already executed`),createdAt:r().datetime().describe(`Checkpoint creation timestamp`),expiresAt:r().datetime().optional().describe(`Checkpoint expiration (auto-cleanup)`),reason:E([`wait`,`screen_input`,`approval`,`error`,`manual_pause`,`parallel_join`,`boundary_event`]).describe(`Why the execution was checkpointed`)}),h({maxConcurrent:P().int().min(1).default(1).describe(`Maximum number of concurrent executions allowed`),onConflict:E([`queue`,`reject`,`cancel_existing`]).default(`queue`).describe(`queue = enqueue for later, reject = fail immediately, cancel_existing = stop running instance`),lockScope:E([`global`,`per_record`,`per_user`]).default(`global`).describe(`Scope of the concurrency lock`),queueTimeoutMs:P().int().min(0).optional().describe(`Maximum time to wait in queue before timing out (ms)`)}),h({id:r().describe(`Schedule instance ID`),flowName:r().describe(`Flow machine name`),cronExpression:r().describe(`Cron expression (e.g., "0 9 * * MON-FRI")`),timezone:r().default(`UTC`).describe(`IANA timezone for cron evaluation`),status:E([`active`,`paused`,`disabled`,`expired`]).default(`active`).describe(`Current schedule status`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution timestamp`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),lastExecutionId:r().optional().describe(`Execution ID of the last run`),lastRunStatus:bKe.optional().describe(`Status of the last run`),totalRuns:P().int().min(0).default(0).describe(`Total number of executions`),consecutiveFailures:P().int().min(0).default(0).describe(`Consecutive failed executions`),startDate:r().datetime().optional().describe(`Schedule effective start date`),endDate:r().datetime().optional().describe(`Schedule expiration date`),maxRuns:P().int().min(1).optional().describe(`Maximum total executions before auto-disable`),createdAt:r().datetime().describe(`Schedule creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the schedule`)});var CKe=E([`create`,`update`,`delete`,`undelete`,`api`]);h({name:a5.describe(`Webhook unique name (lowercase snake_case)`),label:r().optional().describe(`Human-readable webhook label`),object:r().optional().describe(`Object to listen to (optional for manual webhooks)`),triggers:C(CKe).optional().describe(`Events that trigger execution`),url:r().url().describe(`External webhook endpoint URL`),method:E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]).default(`POST`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),body:u().optional().describe(`Request body payload (if not using default record data)`),payloadFields:C(r()).optional().describe(`Fields to include. Empty = All`),includeSession:S().default(!1).describe(`Include user session info`),authentication:h({type:E([`none`,`bearer`,`basic`,`api-key`]).describe(`Authentication type`),credentials:d(r(),r()).optional().describe(`Authentication credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:h({maxRetries:P().int().min(0).max(10).default(3).describe(`Maximum retry attempts`),backoffStrategy:E([`exponential`,`linear`,`fixed`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:P().int().min(100).default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().int().min(1e3).default(6e4).describe(`Maximum retry delay in milliseconds`)}).optional().describe(`Retry policy configuration`),timeoutMs:P().int().min(1e3).max(3e5).default(3e4).describe(`Request timeout in milliseconds`),secret:r().optional().describe(`Signing secret for HMAC signature verification`),isActive:S().default(!0).describe(`Whether webhook is active`),description:r().optional().describe(`Webhook description`),tags:C(r()).optional().describe(`Tags for organization`)}),h({name:a5.describe(`Webhook receiver unique name (lowercase snake_case)`),path:r().describe(`URL Path (e.g. /webhooks/stripe)`),verificationType:E([`none`,`header_token`,`hmac`,`ip_whitelist`]).default(`none`),verificationParams:h({header:r().optional(),secret:r().optional(),ips:C(r()).optional()}).optional(),action:E([`trigger_flow`,`script`,`upsert_record`]).default(`trigger_flow`),target:r().describe(`Flow ID or Script name`)});var wKe=E([`user`,`role`,`manager`,`field`,`queue`]),o5=h({type:E([`field_update`,`email_alert`,`webhook`,`script`,`connector_action`]),name:r().describe(`Action name`),config:d(r(),u()).describe(`Action configuration`),connectorId:r().optional(),actionId:r().optional()}),TKe=h({name:a5.describe(`Step machine name`),label:r().describe(`Step display label`),description:r().optional(),entryCriteria:r().optional().describe(`Formula expression to enter this step`),approvers:C(h({type:wKe,value:r().describe(`User ID, Role Name, or Field Name`)})).min(1).describe(`List of allowed approvers`),behavior:E([`first_response`,`unanimous`]).default(`first_response`).describe(`How to handle multiple approvers`),rejectionBehavior:E([`reject_process`,`back_to_previous`]).default(`reject_process`).describe(`What happens if rejected`),onApprove:C(o5).optional().describe(`Actions on step approval`),onReject:C(o5).optional().describe(`Actions on step rejection`)}),EKe=h({name:a5.describe(`Unique process name`),label:r().describe(`Human readable label`),object:r().describe(`Target Object Name`),active:S().default(!1),description:r().optional(),entryCriteria:r().optional().describe(`Formula to allow submission`),lockRecord:S().default(!0).describe(`Lock record from editing during approval`),steps:C(TKe).min(1).describe(`Sequence of approval steps`),escalation:h({enabled:S().default(!1).describe(`Enable SLA-based escalation`),timeoutHours:P().min(1).describe(`Hours before escalation triggers`),action:E([`reassign`,`auto_approve`,`auto_reject`,`notify`]).default(`notify`).describe(`Action to take on escalation timeout`),escalateTo:r().optional().describe(`User ID, role, or manager level to escalate to`),notifySubmitter:S().default(!0).describe(`Notify the original submitter on escalation`)}).optional().describe(`SLA escalation configuration for pending approval steps`),onSubmit:C(o5).optional().describe(`Actions on initial submission`),onFinalApprove:C(o5).optional().describe(`Actions on final approval`),onFinalReject:C(o5).optional().describe(`Actions on final rejection`),onRecall:C(o5).optional().describe(`Actions on recall`)});Object.assign(EKe,{create:e=>e});var DKe=E([`database`,`api`,`file`,`stream`,`object`,`warehouse`,`storage`,`spreadsheet`]),OKe=h({type:DKe.describe(`Source type`),connector:r().optional().describe(`Connector ID`),config:d(r(),u()).describe(`Source configuration`),incremental:h({enabled:S().default(!1),cursorField:r().describe(`Field to track progress (e.g., updated_at)`),cursorValue:u().optional().describe(`Last processed value`)}).optional().describe(`Incremental extraction config`)}),kKe=h({type:DKe.describe(`Destination type`),connector:r().optional().describe(`Connector ID`),config:d(r(),u()).describe(`Destination configuration`),writeMode:E([`append`,`overwrite`,`upsert`,`merge`]).default(`append`).describe(`How to write data`),primaryKey:C(r()).optional().describe(`Primary key fields`)}),AKe=E([`map`,`filter`,`aggregate`,`join`,`script`,`lookup`,`split`,`merge`,`normalize`,`deduplicate`]),jKe=h({name:r().optional().describe(`Transformation name`),type:AKe.describe(`Transformation type`),config:d(r(),u()).describe(`Transformation config`),continueOnError:S().default(!1).describe(`Continue on error`)}),MKe=E([`full`,`incremental`,`cdc`]);h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Pipeline identifier (snake_case)`),label:r().optional().describe(`Pipeline display name`),description:r().optional().describe(`Pipeline description`),source:OKe.describe(`Data source`),destination:kKe.describe(`Data destination`),transformations:C(jKe).optional().describe(`Transformation pipeline`),syncMode:MKe.default(`full`).describe(`Sync mode`),schedule:r().optional().describe(`Cron schedule expression`),enabled:S().default(!0).describe(`Pipeline enabled status`),retry:h({maxAttempts:P().int().min(0).default(3).describe(`Max retry attempts`),backoffMs:P().int().min(0).default(6e4).describe(`Backoff in milliseconds`)}).optional().describe(`Retry configuration`),notifications:h({onSuccess:C(r()).optional().describe(`Email addresses for success notifications`),onFailure:C(r()).optional().describe(`Email addresses for failure notifications`)}).optional().describe(`Notification settings`),tags:C(r()).optional().describe(`Pipeline tags`),metadata:d(r(),u()).optional().describe(`Custom metadata`)});var NKe=E([`pending`,`running`,`succeeded`,`failed`,`cancelled`,`timeout`]);h({id:r().describe(`Run identifier`),pipelineName:r().describe(`Pipeline name`),status:NKe.describe(`Run status`),startedAt:r().datetime().describe(`Start time`),completedAt:r().datetime().optional().describe(`Completion time`),durationMs:P().optional().describe(`Duration in ms`),stats:h({recordsRead:P().int().default(0).describe(`Records extracted`),recordsWritten:P().int().default(0).describe(`Records loaded`),recordsErrored:P().int().default(0).describe(`Records with errors`),bytesProcessed:P().int().default(0).describe(`Bytes processed`)}).optional().describe(`Run statistics`),error:h({message:r().describe(`Error message`),code:r().optional().describe(`Error code`),details:u().optional().describe(`Error details`)}).optional().describe(`Error information`),logs:C(r()).optional().describe(`Execution logs`)});var PKe=E([`crm`,`payment`,`communication`,`storage`,`analytics`,`database`,`marketing`,`accounting`,`hr`,`productivity`,`ecommerce`,`support`,`devtools`,`social`,`other`]),FKe=E([`none`,`apiKey`,`basic`,`bearer`,`oauth1`,`oauth2`,`custom`]),IKe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Field name (snake_case)`),label:r().describe(`Field label`),type:E([`text`,`password`,`url`,`select`]).default(`text`).describe(`Field type`),description:r().optional().describe(`Field description`),required:S().default(!0).describe(`Required field`),default:r().optional().describe(`Default value`),options:C(h({label:r(),value:r()})).optional().describe(`Select field options`),placeholder:r().optional().describe(`Placeholder text`)}),LKe=h({authorizationUrl:r().url().describe(`Authorization endpoint URL`),tokenUrl:r().url().describe(`Token endpoint URL`),scopes:C(r()).optional().describe(`OAuth scopes`),clientIdField:r().default(`client_id`).describe(`Client ID field name`),clientSecretField:r().default(`client_secret`).describe(`Client secret field name`)}),RKe=h({type:FKe.describe(`Authentication type`),fields:C(IKe).optional().describe(`Authentication fields`),oauth2:LKe.optional().describe(`OAuth 2.0 configuration`),test:h({url:r().optional().describe(`Test endpoint URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`]).default(`GET`).describe(`HTTP method`)}).optional().describe(`Authentication test configuration`)}),zKe=E([`read`,`write`,`delete`,`search`,`trigger`,`action`]),BKe=h({name:r().describe(`Parameter name`),label:r().describe(`Parameter label`),description:r().optional().describe(`Parameter description`),type:E([`string`,`number`,`boolean`,`array`,`object`,`date`,`file`]).describe(`Parameter type`),required:S().default(!1).describe(`Required parameter`),default:u().optional().describe(`Default value`),validation:d(r(),u()).optional().describe(`Validation rules`),dynamicOptions:r().optional().describe(`Function to load dynamic options`)}),VKe=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Operation ID (snake_case)`),name:r().describe(`Operation name`),description:r().optional().describe(`Operation description`),type:zKe.describe(`Operation type`),inputSchema:C(BKe).optional().describe(`Input parameters`),outputSchema:d(r(),u()).optional().describe(`Output schema`),sampleOutput:u().optional().describe(`Sample output`),supportsPagination:S().default(!1).describe(`Supports pagination`),supportsFiltering:S().default(!1).describe(`Supports filtering`)}),HKe=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Trigger ID (snake_case)`),name:r().describe(`Trigger name`),description:r().optional().describe(`Trigger description`),type:E([`webhook`,`polling`,`stream`]).describe(`Trigger mechanism`),config:d(r(),u()).optional().describe(`Trigger configuration`),outputSchema:d(r(),u()).optional().describe(`Event payload schema`),pollingIntervalMs:P().int().min(1e3).optional().describe(`Polling interval in ms`)});h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Connector ID (snake_case)`),name:r().describe(`Connector name`),description:r().optional().describe(`Connector description`),version:r().optional().describe(`Connector version`),icon:r().optional().describe(`Connector icon`),category:PKe.describe(`Connector category`),baseUrl:r().url().optional().describe(`API base URL`),authentication:RKe.describe(`Authentication config`),operations:C(VKe).optional().describe(`Connector operations`),triggers:C(HKe).optional().describe(`Connector triggers`),rateLimit:h({requestsPerSecond:P().optional().describe(`Max requests per second`),requestsPerMinute:P().optional().describe(`Max requests per minute`),requestsPerHour:P().optional().describe(`Max requests per hour`)}).optional().describe(`Rate limiting`),author:r().optional().describe(`Connector author`),documentation:r().url().optional().describe(`Documentation URL`),homepage:r().url().optional().describe(`Homepage URL`),license:r().optional().describe(`License (SPDX identifier)`),tags:C(r()).optional().describe(`Connector tags`),verified:S().default(!1).describe(`Verified connector`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),h({id:r().describe(`Instance ID`),connectorId:r().describe(`Connector ID`),name:r().describe(`Instance name`),description:r().optional().describe(`Instance description`),credentials:d(r(),u()).describe(`Encrypted credentials`),config:d(r(),u()).optional().describe(`Additional config`),active:S().default(!0).describe(`Instance active status`),createdAt:r().datetime().optional().describe(`Creation time`),lastTestedAt:r().datetime().optional().describe(`Last test time`),testStatus:E([`unknown`,`success`,`failed`]).default(`unknown`).describe(`Connection test status`)});var UKe=I(`type`,[h({type:m(`constant`),value:u().describe(`Constant value to use`)}).describe(`Set a constant value`),h({type:m(`cast`),targetType:E([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),h({type:m(`lookup`),table:r().describe(`Lookup table name`),keyField:r().describe(`Field to match on`),valueField:r().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),h({type:m(`javascript`),expression:r().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),h({type:m(`map`),mappings:d(r(),u()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]),WKe=h({source:r().describe(`Source field name`),target:r().describe(`Target field name`),transform:UKe.optional().describe(`Transformation to apply`),defaultValue:u().optional().describe(`Default if source is null/undefined`)}),GKe=E([`push`,`pull`,`bidirectional`]),KKe=E([`full`,`incremental`,`realtime`]),qKe=E([`source_wins`,`destination_wins`,`latest_wins`,`manual`,`merge`]),JKe=h({object:r().optional().describe(`ObjectStack object name`),filters:u().optional().describe(`Filter conditions`),fields:C(r()).optional().describe(`Fields to sync`),connectorInstanceId:r().optional().describe(`Connector instance ID`),externalResource:r().optional().describe(`External resource ID`)}),YKe=h({object:r().optional().describe(`ObjectStack object name`),connectorInstanceId:r().optional().describe(`Connector instance ID`),operation:E([`insert`,`update`,`upsert`,`delete`,`sync`]).describe(`Sync operation`),mapping:l([d(r(),r()),C(WKe)]).optional().describe(`Field mappings`),externalResource:r().optional().describe(`External resource ID`),matchKey:C(r()).optional().describe(`Match key fields`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Sync configuration name (snake_case)`),label:r().optional().describe(`Sync display name`),description:r().optional().describe(`Sync description`),source:JKe.describe(`Data source`),destination:YKe.describe(`Data destination`),direction:GKe.default(`push`).describe(`Sync direction`),syncMode:KKe.default(`incremental`).describe(`Sync mode`),conflictResolution:qKe.default(`latest_wins`).describe(`Conflict resolution`),schedule:r().optional().describe(`Cron schedule`),enabled:S().default(!0).describe(`Sync enabled`),changeTrackingField:r().optional().describe(`Field for change tracking`),batchSize:P().int().min(1).max(1e4).default(100).describe(`Batch size for processing`),retry:h({maxAttempts:P().int().min(0).default(3).describe(`Max retries`),backoffMs:P().int().min(0).default(3e4).describe(`Backoff duration`)}).optional().describe(`Retry configuration`),validation:h({required:C(r()).optional().describe(`Required fields`),unique:C(r()).optional().describe(`Unique constraint fields`),custom:C(h({name:r(),condition:r().describe(`Validation condition`),message:r().describe(`Error message`)})).optional().describe(`Custom validation rules`)}).optional().describe(`Validation rules`),errorHandling:h({onValidationError:E([`skip`,`fail`,`log`]).default(`skip`),onSyncError:E([`skip`,`fail`,`retry`]).default(`retry`),notifyOnError:C(r()).optional().describe(`Email notifications`)}).optional().describe(`Error handling`),optimization:h({parallelBatches:S().default(!1).describe(`Process batches in parallel`),cacheEnabled:S().default(!0).describe(`Enable caching`),compressionEnabled:S().default(!1).describe(`Enable compression`)}).optional().describe(`Performance optimization`),audit:h({logLevel:E([`none`,`error`,`warn`,`info`,`debug`]).default(`info`),retainLogsForDays:P().int().min(1).default(30),trackChanges:S().default(!0).describe(`Track all changes`)}).optional().describe(`Audit configuration`),tags:C(r()).optional().describe(`Sync tags`),metadata:d(r(),u()).optional().describe(`Custom metadata`)});var XKe=E([`pending`,`running`,`completed`,`partial`,`failed`,`cancelled`]);h({id:r().describe(`Execution ID`),syncName:r().describe(`Sync name`),status:XKe.describe(`Execution status`),startedAt:r().datetime().describe(`Start time`),completedAt:r().datetime().optional().describe(`Completion time`),durationMs:P().optional().describe(`Duration in ms`),stats:h({recordsProcessed:P().int().default(0).describe(`Total records processed`),recordsInserted:P().int().default(0).describe(`Records inserted`),recordsUpdated:P().int().default(0).describe(`Records updated`),recordsDeleted:P().int().default(0).describe(`Records deleted`),recordsSkipped:P().int().default(0).describe(`Records skipped`),recordsErrored:P().int().default(0).describe(`Records with errors`),conflictsDetected:P().int().default(0).describe(`Conflicts detected`),conflictsResolved:P().int().default(0).describe(`Conflicts resolved`)}).optional().describe(`Execution statistics`),errors:C(h({recordId:r().optional().describe(`Record ID`),field:r().optional().describe(`Field name`),message:r().describe(`Error message`),code:r().optional().describe(`Error code`)})).optional().describe(`Errors`),logs:C(r()).optional().describe(`Execution logs`)});var s5=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),ZKe=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),c5=h({target:r().optional().describe(`Target State ID`),cond:ZKe.optional().describe(`Condition (Guard) required to take this path`),actions:C(s5).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)});h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)});var QKe=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(s5).optional().describe(`Actions to run when entering this state`),exit:C(s5).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),c5,C(c5)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(c5).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),QKe).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()}));h({id:a5.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),QKe).describe(`State Nodes`),on:d(r(),l([r(),c5,C(c5)])).optional()});var $Ke=E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`Wait event type determining how a paused flow is resumed`);h({executionId:r().describe(`Execution ID of the paused flow`),checkpointId:r().describe(`Checkpoint ID to resume from`),nodeId:r().describe(`Wait node ID being resumed`),eventType:$Ke.describe(`Event type that triggered resume`),signalName:r().optional().describe(`Signal name (when eventType is signal)`),webhookPayload:d(r(),u()).optional().describe(`Webhook request payload (when eventType is webhook)`),resumedBy:r().optional().describe(`User ID or system identifier that triggered resume`),resumedAt:r().datetime().describe(`ISO 8601 timestamp of the resume event`),variables:d(r(),u()).optional().describe(`Variables to merge into flow context upon resume`)}).describe(`Payload for resuming a paused wait node`);var eqe=E([`fail`,`continue`,`fallback`]).describe(`Behavior when a wait node exceeds its timeout`);h({defaultTimeoutMs:P().int().min(0).default(864e5).describe(`Default timeout in ms (default: 24 hours)`),defaultTimeoutBehavior:eqe.default(`fail`).describe(`Default behavior when wait timeout is exceeded`),conditionPollIntervalMs:P().int().min(1e3).default(3e4).describe(`Polling interval for condition waits in ms (default: 30s)`),conditionMaxPolls:P().int().min(0).default(0).describe(`Max polling attempts for condition waits (0 = unlimited)`),webhookUrlPattern:r().default(`/api/v1/automation/resume/{executionId}/{nodeId}`).describe(`URL pattern for webhook resume endpoints`),persistCheckpoints:S().default(!0).describe(`Persist wait checkpoints to durable storage`),maxPausedExecutions:P().int().min(0).default(0).describe(`Max concurrent paused executions (0 = unlimited)`)}).describe(`Wait node executor plugin configuration`),h({id:r().describe(`Unique executor plugin identifier`),name:r().describe(`Display name`),nodeTypes:C(r()).min(1).describe(`FlowNodeAction types this executor handles`),version:r().describe(`Plugin version (semver)`),description:r().optional().describe(`Executor description`),supportsPause:S().default(!1).describe(`Whether the executor supports async pause/resume`),supportsCancellation:S().default(!1).describe(`Whether the executor supports mid-execution cancellation`),supportsRetry:S().default(!0).describe(`Whether the executor supports retry on failure`),configSchemaRef:r().optional().describe(`JSON Schema $ref for executor-specific config`)}).describe(`Node executor plugin descriptor`);var tqe=h({bpmnType:r().describe(`BPMN XML element type (e.g., "bpmn:parallelGateway")`),flowNodeAction:r().describe(`ObjectStack FlowNodeAction value`),bidirectional:S().default(!0).describe(`Whether the mapping supports both import and export`),notes:r().optional().describe(`Notes about mapping limitations`)}).describe(`Mapping between BPMN XML element and ObjectStack FlowNodeAction`);h({unmappedStrategy:E([`skip`,`warn`,`error`,`comment`]).describe(`Strategy for unmapped BPMN elements during import`).default(`warn`).describe(`How to handle unmapped BPMN elements`),customMappings:C(tqe).optional().describe(`Custom element mappings to override or extend defaults`),importLayout:S().default(!0).describe(`Import BPMN DI layout positions into canvas node coordinates`),importDocumentation:S().default(!0).describe(`Import BPMN documentation elements as node descriptions`),flowName:r().optional().describe(`Override flow name (defaults to BPMN process name)`),validateAfterImport:S().default(!0).describe(`Validate imported flow against FlowSchema after import`)}).describe(`Options for importing BPMN 2.0 XML into an ObjectStack flow`),h({version:E([`2.0`,`2.0.2`]).describe(`BPMN specification version for export`).default(`2.0`).describe(`Target BPMN specification version`),includeLayout:S().default(!0).describe(`Include BPMN DI layout data from canvas positions`),includeExtensions:S().default(!1).describe(`Include ObjectStack extensions in BPMN extensionElements`),customMappings:C(tqe).optional().describe(`Custom element mappings for export`),prettyPrint:S().default(!0).describe(`Pretty-print XML output with indentation`),namespacePrefix:r().default(`bpmn`).describe(`XML namespace prefix for BPMN elements`)}).describe(`Options for exporting an ObjectStack flow as BPMN 2.0 XML`);var nqe=h({severity:E([`info`,`warning`,`error`]).describe(`Diagnostic severity`),message:r().describe(`Diagnostic message`),bpmnElementId:r().optional().describe(`BPMN element ID related to this diagnostic`),nodeId:r().optional().describe(`ObjectStack node ID related to this diagnostic`)}).describe(`Diagnostic message from BPMN import/export`);h({success:S().describe(`Whether the operation completed successfully`),diagnostics:C(nqe).default([]).describe(`Diagnostic messages from the operation`),mappedCount:P().int().min(0).default(0).describe(`Number of elements successfully mapped`),unmappedCount:P().int().min(0).default(0).describe(`Number of elements that could not be mapped`)}).describe(`Result of a BPMN import/export operation`);var rqe=class{constructor(e){this.flows=new Map,this.flowEnabled=new Map,this.flowVersionHistory=new Map,this.nodeExecutors=new Map,this.triggers=new Map,this.executionLogs=[],this.maxLogSize=1e3,this.runCounter=0,this.logger=e}registerNodeExecutor(e){this.nodeExecutors.has(e.type)&&this.logger.warn(`Node executor '${e.type}' replaced`),this.nodeExecutors.set(e.type,e),this.logger.info(`Node executor registered: ${e.type}`)}unregisterNodeExecutor(e){this.nodeExecutors.delete(e),this.logger.info(`Node executor unregistered: ${e}`)}registerTrigger(e){this.triggers.set(e.type,e),this.logger.info(`Trigger registered: ${e.type}`)}unregisterTrigger(e){this.triggers.delete(e),this.logger.info(`Trigger unregistered: ${e}`)}getRegisteredNodeTypes(){return[...this.nodeExecutors.keys()]}getRegisteredTriggerTypes(){return[...this.triggers.keys()]}registerFlow(e,t){let n=yKe.parse(t);this.detectCycles(n);let r=this.flowVersionHistory.get(e)??[];r.push({version:n.version,definition:n,createdAt:new Date().toISOString()}),this.flowVersionHistory.set(e,r),this.flows.set(e,n),this.flowEnabled.has(e)||this.flowEnabled.set(e,!0),this.logger.info(`Flow registered: ${e} (version ${n.version})`)}unregisterFlow(e){this.flows.delete(e),this.flowEnabled.delete(e),this.flowVersionHistory.delete(e),this.logger.info(`Flow unregistered: ${e}`)}async listFlows(){return[...this.flows.keys()]}async getFlow(e){return this.flows.get(e)??null}async toggleFlow(e,t){if(!this.flows.has(e))throw Error(`Flow '${e}' not found`);this.flowEnabled.set(e,t),this.logger.info(`Flow '${e}' ${t?`enabled`:`disabled`}`)}getFlowVersionHistory(e){return this.flowVersionHistory.get(e)??[]}rollbackFlow(e,t){let n=this.flowVersionHistory.get(e);if(!n)throw Error(`Flow '${e}' has no version history`);let r=n.find(e=>e.version===t);if(!r)throw Error(`Version ${t} not found for flow '${e}'`);this.flows.set(e,r.definition),this.logger.info(`Flow '${e}' rolled back to version ${t}`)}async listRuns(e,t){let n=t?.limit??20;return this.executionLogs.filter(t=>t.flowName===e).slice(-n).reverse()}async getRun(e){return this.executionLogs.find(t=>t.id===e)??null}async execute(e,t){let n=Date.now(),r=this.flows.get(e);if(!r)return{success:!1,error:`Flow '${e}' not found`};if(this.flowEnabled.get(e)===!1)return{success:!1,error:`Flow '${e}' is disabled`};let i=new Map;if(r.variables)for(let e of r.variables)e.isInput&&t?.params?.[e.name]!==void 0&&i.set(e.name,t.params[e.name]);t?.record&&i.set(`$record`,t.record);let a=`run_${++this.runCounter}`,o=new Date().toISOString(),s=[];try{let c=r.nodes.find(e=>e.type===`start`);if(!c)return{success:!1,error:`Flow has no start node`};this.validateNodeInputSchemas(r,i),await this.executeNode(c,r,i,t??{},s);let l={};if(r.variables)for(let e of r.variables)e.isOutput&&(l[e.name]=i.get(e.name));let u=Date.now()-n;return this.recordLog({id:a,flowName:e,flowVersion:r.version,status:`completed`,startedAt:o,completedAt:new Date().toISOString(),durationMs:u,trigger:{type:t?.event??`manual`,userId:t?.userId,object:t?.object},steps:s,output:l}),{success:!0,output:l,durationMs:u}}catch(i){let c=i instanceof Error?i.message:String(i),l=Date.now()-n;return this.recordLog({id:a,flowName:e,flowVersion:r.version,status:`failed`,startedAt:o,completedAt:new Date().toISOString(),durationMs:l,trigger:{type:t?.event??`manual`,userId:t?.userId,object:t?.object},steps:s,error:c}),r.errorHandling?.strategy===`retry`?this.retryExecution(e,t,n,r.errorHandling):{success:!1,error:c,durationMs:l}}}recordLog(e){this.executionLogs.push(e),this.executionLogs.length>this.maxLogSize&&this.executionLogs.splice(0,this.executionLogs.length-this.maxLogSize)}detectCycles(e){let t=new Map,n=new Map,r=new Map;for(let n of e.nodes)t.set(n.id,0),r.set(n.id,[]);for(let t of e.edges){let e=r.get(t.source);e&&e.push(t.target)}let i=e=>{t.set(e,1);for(let a of r.get(e)??[]){if(t.get(a)===1){let t=[a,e],r=e;for(;r!==a&&(r=n.get(r),r);)t.push(r);return t.reverse()}if(t.get(a)===0){n.set(a,e);let t=i(a);if(t)return t}}return t.set(e,2),null};for(let n of e.nodes)if(t.get(n.id)===0){let e=i(n.id);if(e)throw Error(`Flow contains a cycle: ${e.join(` → `)}. Only DAG flows are allowed.`)}}getValueType(e){return Array.isArray(e)?`array`:typeof e==`object`&&e?`object`:typeof e}validateNodeInputSchemas(e,t){for(let t of e.nodes)if(t.inputSchema&&t.config)for(let[e,n]of Object.entries(t.inputSchema)){if(n.required&&!(e in t.config))throw Error(`Node '${t.id}' missing required input parameter '${e}'`);let r=t.config[e];if(r!==void 0){let i=this.getValueType(r);if(i!==n.type)throw Error(`Node '${t.id}' parameter '${e}' expected type '${n.type}' but got '${i}'`)}}}async executeNode(e,t,n,r,i){if(e.type===`end`)return;let a=Date.now(),o=new Date().toISOString(),s=this.nodeExecutors.get(e.type);if(s){let c;try{c=e.timeoutMs&&e.timeoutMs>0?await this.executeWithTimeout(s.execute(e,n,r),e.timeoutMs,e.id):await s.execute(e,n,r)}catch(s){let c=s instanceof Error?s.message:String(s);i.push({nodeId:e.id,nodeType:e.type,status:`failure`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a,error:{code:`EXECUTION_ERROR`,message:c}});let l=t.edges.find(t=>t.source===e.id&&t.type===`fault`);if(l){n.set(`$error`,{nodeId:e.id,message:c});let a=t.nodes.find(e=>e.id===l.target);if(a){await this.executeNode(a,t,n,r,i);return}}throw s}if(!c.success){let s=c.error??`Unknown error`;i.push({nodeId:e.id,nodeType:e.type,status:`failure`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a,error:{code:`NODE_FAILURE`,message:s}}),n.set(`$error`,{nodeId:e.id,message:s,output:c.output});let l=t.edges.find(t=>t.source===e.id&&t.type===`fault`);if(l){let e=t.nodes.find(e=>e.id===l.target);if(e){await this.executeNode(e,t,n,r,i);return}}throw Error(`Node '${e.id}' failed: ${s}`)}if(i.push({nodeId:e.id,nodeType:e.type,status:`success`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a}),c.output)for(let[t,r]of Object.entries(c.output))n.set(`${e.id}.${t}`,r)}else{if(e.type!==`start`)throw i.push({nodeId:e.id,nodeType:e.type,status:`failure`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a,error:{code:`NO_EXECUTOR`,message:`No executor registered for node type '${e.type}'`}}),Error(`No executor registered for node type '${e.type}'`);i.push({nodeId:e.id,nodeType:e.type,status:`success`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a})}let c=t.edges.filter(t=>t.source===e.id&&t.type!==`fault`),l=[],u=[];for(let e of c)e.condition?l.push(e):u.push(e);for(let e of l)if(this.evaluateCondition(e.condition,n)){let a=t.nodes.find(t=>t.id===e.target);a&&await this.executeNode(a,t,n,r,i)}if(u.length>0){let e=u.map(e=>t.nodes.find(t=>t.id===e.target)).filter(e=>e!=null).map(e=>this.executeNode(e,t,n,r,i));await Promise.all(e)}}executeWithTimeout(e,t,n){return Promise.race([e,new Promise((e,r)=>setTimeout(()=>r(Error(`Node '${n}' timed out after ${t}ms`)),t))])}evaluateCondition(e,t){let n=e;for(let[e,r]of t)n=n.split(`{${e}}`).join(String(r));n=n.trim();try{if(n===`true`)return!0;if(n===`false`)return!1;for(let e of[`===`,`!==`,`>=`,`<=`,`!=`,`==`,`>`,`<`]){let t=n.indexOf(e);if(t!==-1){let r=n.slice(0,t).trim(),i=n.slice(t+e.length).trim();return this.compareValues(r,e,i)}}let e=Number(n);return isNaN(e)?!1:e!==0}catch{return!1}}compareValues(e,t,n){let r=Number(e),i=Number(n);if(!isNaN(r)&&!isNaN(i)&&e!==``&&n!==``)switch(t){case`>`:return r>i;case`<`:return r=`:return r>=i;case`<=`:return r<=i;case`==`:case`===`:return r===i;case`!=`:case`!==`:return r!==i;default:return!1}switch(t){case`==`:case`===`:return e===n;case`!=`:case`!==`:return e!==n;case`>`:return e>n;case`<`:return e=`:return e>=n;case`<=`:return e<=n;default:return!1}}async retryExecution(e,t,n,r){let i=r.maxRetries??3,a=r.retryDelayMs??1e3,o=r.backoffMultiplier??1,s=r.maxRetryDelayMs??3e4,c=r.jitter??!1,l=`Max retries exceeded`;for(let n=0;nsetTimeout(e,r));let i=await this.executeWithoutRetry(e,t);if(i.success)return i;l=i.error??`Unknown error`}return{success:!1,error:l,durationMs:Date.now()-n}}async executeWithoutRetry(e,t){let n=Date.now(),r=this.flows.get(e);if(!r)return{success:!1,error:`Flow '${e}' not found`};if(this.flowEnabled.get(e)===!1)return{success:!1,error:`Flow '${e}' is disabled`};let i=new Map;if(r.variables)for(let e of r.variables)e.isInput&&t?.params?.[e.name]!==void 0&&i.set(e.name,t.params[e.name]);t?.record&&i.set(`$record`,t.record);let a=`run_${++this.runCounter}`,o=new Date().toISOString(),s=[];try{let c=r.nodes.find(e=>e.type===`start`);if(!c)return{success:!1,error:`Flow has no start node`};await this.executeNode(c,r,i,t??{},s);let l={};if(r.variables)for(let e of r.variables)e.isOutput&&(l[e.name]=i.get(e.name));let u=Date.now()-n;return this.recordLog({id:a,flowName:e,flowVersion:r.version,status:`completed`,startedAt:o,completedAt:new Date().toISOString(),durationMs:u,trigger:{type:t?.event??`manual`,userId:t?.userId,object:t?.object},steps:s,output:l}),{success:!0,output:l,durationMs:u}}catch(i){let c=i instanceof Error?i.message:String(i),l=Date.now()-n;return this.recordLog({id:a,flowName:e,flowVersion:r.version,status:`failed`,startedAt:o,completedAt:new Date().toISOString(),durationMs:l,trigger:{type:t?.event??`manual`,userId:t?.userId,object:t?.object},steps:s,error:c}),{success:!1,error:c,durationMs:l}}}},iqe=class{constructor(e={}){this.name=`com.objectstack.service-automation`,this.version=`1.0.0`,this.type=`standard`,this.dependencies=[],this.options=e}async init(e){this.engine=new rqe(e.logger),e.registerService(`automation`,this.engine),this.options.debug&&e.hook(`automation:beforeExecute`,async t=>{e.logger.debug(`[Automation] Before execute: ${t}`)}),e.logger.info(`[Automation] Engine initialized`)}async start(e){if(!this.engine)return;await e.trigger(`automation:ready`,this.engine);let t=this.engine.getRegisteredNodeTypes();e.logger.info(`[Automation] Engine started with ${t.length} node types: ${t.join(`, `)||`(none)`}`)}async destroy(){this.engine=void 0}},aqe=class{constructor(){this.cubes=new Map}register(e){this.cubes.set(e.name,e)}registerAll(e){for(let t of e)this.register(t)}get(e){return this.cubes.get(e)}has(e){return this.cubes.has(e)}getAll(){return Array.from(this.cubes.values())}names(){return Array.from(this.cubes.keys())}get size(){return this.cubes.size}clear(){this.cubes.clear()}inferFromObject(e,t){let n={count:{name:`count`,label:`Count`,type:`count`,sql:`*`}},r={};for(let e of t){let t=e.label||e.name,i=this.fieldTypeToDimensionType(e.type);r[e.name]={name:e.name,label:t,type:i,sql:e.name,...i===`time`?{granularities:[`day`,`week`,`month`,`quarter`,`year`]}:{}},(e.type===`number`||e.type===`currency`||e.type===`percent`)&&(n[`${e.name}_sum`]={name:`${e.name}_sum`,label:`${t} (Sum)`,type:`sum`,sql:e.name},n[`${e.name}_avg`]={name:`${e.name}_avg`,label:`${t} (Avg)`,type:`avg`,sql:e.name})}let i={name:e,title:e,sql:e,measures:n,dimensions:r,public:!1};return this.register(i),i}fieldTypeToDimensionType(e){switch(e){case`number`:case`currency`:case`percent`:return`number`;case`boolean`:return`boolean`;case`date`:case`datetime`:return`time`;default:return`string`}}},oqe=class{constructor(){this.name=`NativeSQLStrategy`,this.priority=10}canHandle(e,t){return e.cube?t.queryCapabilities(e.cube).nativeSql&&typeof t.executeRawSql==`function`:!1}async execute(e,t){let{sql:n,params:r}=await this.generateSql(e,t),i=t.getCube(e.cube),a=this.extractObjectName(i);return{rows:await t.executeRawSql(a,n,r),fields:this.buildFieldMeta(e,i),sql:n}}async generateSql(e,t){let n=t.getCube(e.cube);if(!n)throw Error(`Cube not found: ${e.cube}`);let r=[],i=[],a=[];if(e.dimensions&&e.dimensions.length>0)for(let t of e.dimensions){let e=this.resolveDimensionSql(n,t);i.push(`${e} AS "${t}"`),a.push(e)}if(e.measures&&e.measures.length>0)for(let t of e.measures){let e=this.resolveMeasureSql(n,t);i.push(`${e} AS "${t}"`)}let o=[];if(e.filters&&e.filters.length>0)for(let t of e.filters){let e=this.resolveFieldSql(n,t.member),i=this.buildFilterClause(e,t.operator,t.values,r);i&&o.push(i)}if(e.timeDimensions&&e.timeDimensions.length>0)for(let t of e.timeDimensions){let e=this.resolveFieldSql(n,t.dimension);if(t.dateRange){let n=Array.isArray(t.dateRange)?t.dateRange:[t.dateRange,t.dateRange];n.length===2&&(r.push(n[0],n[1]),o.push(`${e} BETWEEN $${r.length-1} AND $${r.length}`))}}let s=this.extractObjectName(n),c=`SELECT ${i.join(`, `)} FROM "${s}"`;if(o.length>0&&(c+=` WHERE ${o.join(` AND `)}`),a.length>0&&(c+=` GROUP BY ${a.join(`, `)}`),e.order&&Object.keys(e.order).length>0){let t=Object.entries(e.order).map(([e,t])=>`"${e}" ${t.toUpperCase()}`);c+=` ORDER BY ${t.join(`, `)}`}return e.limit!=null&&(c+=` LIMIT ${e.limit}`),e.offset!=null&&(c+=` OFFSET ${e.offset}`),{sql:c,params:r}}resolveDimensionSql(e,t){let n=t.includes(`.`)?t.split(`.`)[1]:t,r=e.dimensions[n];return r?r.sql:n}resolveMeasureSql(e,t){let n=t.includes(`.`)?t.split(`.`)[1]:t,r=e.measures[n];if(!r)return`COUNT(*)`;let i=r.sql;switch(r.type){case`count`:return`COUNT(*)`;case`sum`:return`SUM(${i})`;case`avg`:return`AVG(${i})`;case`min`:return`MIN(${i})`;case`max`:return`MAX(${i})`;case`count_distinct`:return`COUNT(DISTINCT ${i})`;default:return`COUNT(*)`}}resolveFieldSql(e,t){let n=t.includes(`.`)?t.split(`.`)[1]:t,r=e.dimensions[n];if(r)return r.sql;let i=e.measures[n];return i?i.sql:n}buildFilterClause(e,t,n,r){let i={equals:`=`,notEquals:`!=`,gt:`>`,gte:`>=`,lt:`<`,lte:`<=`,contains:`LIKE`,notContains:`NOT LIKE`};if(t===`set`)return`${e} IS NOT NULL`;if(t===`notSet`)return`${e} IS NULL`;let a=i[t];return!a||!n||n.length===0?null:(t===`contains`||t===`notContains`?r.push(`%${n[0]}%`):r.push(n[0]),`${e} ${a} $${r.length}`)}extractObjectName(e){return e.sql.trim()}buildFieldMeta(e,t){let n=[];if(e.dimensions)for(let r of e.dimensions){let e=r.includes(`.`)?r.split(`.`)[1]:r,i=t.dimensions[e];n.push({name:r,type:i?.type||`string`})}if(e.measures)for(let t of e.measures)n.push({name:t,type:`number`});return n}},sqe=class{constructor(){this.name=`ObjectQLStrategy`,this.priority=20}canHandle(e,t){return e.cube?t.queryCapabilities(e.cube).objectqlAggregate&&typeof t.executeAggregate==`function`:!1}async execute(e,t){let n=t.getCube(e.cube),r=this.extractObjectName(n),i=[];if(e.dimensions&&e.dimensions.length>0)for(let t of e.dimensions)i.push(this.resolveFieldName(n,t,`dimension`));let a=[];if(e.measures&&e.measures.length>0)for(let t of e.measures){let{field:e,method:r}=this.resolveMeasureAggregation(n,t);a.push({field:e,method:r,alias:t})}let o={};if(e.filters&&e.filters.length>0)for(let t of e.filters){let e=this.resolveFieldName(n,t.member,`any`);o[e]=this.convertFilter(t.operator,t.values)}return{rows:(await t.executeAggregate(r,{groupBy:i.length>0?i:void 0,aggregations:a.length>0?a:void 0,filter:Object.keys(o).length>0?o:void 0})).map(t=>{let r={};if(e.dimensions)for(let i of e.dimensions){let e=this.resolveFieldName(n,i,`dimension`);e in t&&(r[i]=t[e])}if(e.measures)for(let n of e.measures)n in t&&(r[n]=t[n]);return r}),fields:this.buildFieldMeta(e,n)}}async generateSql(e,t){let n=t.getCube(e.cube);if(!n)throw Error(`Cube not found: ${e.cube}`);let r=[],i=[];if(e.dimensions)for(let t of e.dimensions){let e=this.resolveFieldName(n,t,`dimension`);r.push(`${e} AS "${t}"`),i.push(e)}if(e.measures)for(let t of e.measures){let{field:e,method:i}=this.resolveMeasureAggregation(n,t),a=i===`count`?`COUNT(*)`:`${i.toUpperCase()}(${e})`;r.push(`${a} AS "${t}"`)}let a=this.extractObjectName(n),o=`SELECT ${r.join(`, `)} FROM "${a}"`;return i.length>0&&(o+=` GROUP BY ${i.join(`, `)}`),{sql:o,params:[]}}resolveFieldName(e,t,n){let r=t.includes(`.`)?t.split(`.`)[1]:t;if(n===`dimension`||n===`any`){let t=e.dimensions[r];if(t)return t.sql.replace(/^\$/,``)}if(n===`measure`||n===`any`){let t=e.measures[r];if(t)return t.sql.replace(/^\$/,``)}return r}resolveMeasureAggregation(e,t){let n=t.includes(`.`)?t.split(`.`)[1]:t,r=e.measures[n];return r?{field:r.sql.replace(/^\$/,``),method:r.type===`count_distinct`?`count_distinct`:r.type}:{field:`*`,method:`count`}}convertFilter(e,t){if(e===`set`)return{$ne:null};if(e===`notSet`)return null;if(!(!t||t.length===0))switch(e){case`equals`:return t[0];case`notEquals`:return{$ne:t[0]};case`gt`:return{$gt:t[0]};case`gte`:return{$gte:t[0]};case`lt`:return{$lt:t[0]};case`lte`:return{$lte:t[0]};case`contains`:return{$regex:t[0]};default:return t[0]}}extractObjectName(e){return e.sql.trim()}buildFieldMeta(e,t){let n=[];if(e.dimensions)for(let r of e.dimensions){let e=r.includes(`.`)?r.split(`.`)[1]:r,i=t.dimensions[e];n.push({name:r,type:i?.type||`string`})}if(e.measures)for(let t of e.measures)n.push({name:t,type:`number`});return n}},cqe={nativeSql:!1,objectqlAggregate:!1,inMemory:!0},lqe=class{constructor(e={}){this.logger=e.logger||$f({level:`info`,format:`pretty`}),this.cubeRegistry=new aqe,e.cubes&&this.cubeRegistry.registerAll(e.cubes),this.strategyCtx={getCube:e=>this.cubeRegistry.get(e),queryCapabilities:e.queryCapabilities||(()=>cqe),executeRawSql:e.executeRawSql,executeAggregate:e.executeAggregate,fallbackService:e.fallbackService};let t=[new oqe,new sqe];e.fallbackService&&t.push(new uqe);let n=e.strategies||[];this.strategies=[...t,...n].sort((e,t)=>e.priority-t.priority),this.logger.info(`[Analytics] Initialized with ${this.cubeRegistry.size} cubes, ${this.strategies.length} strategies: ${this.strategies.map(e=>e.name).join(` → `)}`)}async query(e){if(!e.cube)throw Error(`Cube name is required in analytics query`);let t=this.resolveStrategy(e);return this.logger.debug(`[Analytics] Query on cube "${e.cube}" \u2192 ${t.name}`),t.execute(e,this.strategyCtx)}async getMeta(e){return(e?[this.cubeRegistry.get(e)].filter(Boolean):this.cubeRegistry.getAll()).map(e=>({name:e.name,title:e.title,measures:Object.entries(e.measures).map(([t,n])=>({name:`${e.name}.${t}`,type:n.type,title:n.label})),dimensions:Object.entries(e.dimensions).map(([t,n])=>({name:`${e.name}.${t}`,type:n.type,title:n.label}))}))}async generateSql(e){if(!e.cube)throw Error(`Cube name is required for SQL generation`);let t=this.resolveStrategy(e);return this.logger.debug(`[Analytics] generateSql on cube "${e.cube}" \u2192 ${t.name}`),t.generateSql(e,this.strategyCtx)}resolveStrategy(e){for(let t of this.strategies)if(t.canHandle(e,this.strategyCtx))return t;throw Error(`[Analytics] No strategy can handle query for cube "${e.cube}". Checked: ${this.strategies.map(e=>e.name).join(`, `)}. Ensure a compatible driver is configured or a fallback service is registered.`)}},uqe=class{constructor(){this.name=`FallbackDelegateStrategy`,this.priority=30}canHandle(e,t){return e.cube?!!t.fallbackService:!1}async execute(e,t){return t.fallbackService.query(e)}async generateSql(e,t){return t.fallbackService?.generateSql?t.fallbackService.generateSql(e):{sql:`-- FallbackDelegateStrategy: SQL generation not supported for cube "${e.cube}"`,params:[]}}},dqe=class{constructor(e={}){this.name=`com.objectstack.service-analytics`,this.version=`1.0.0`,this.type=`standard`,this.dependencies=[],this.options=e}async init(e){let t;try{let n=e.getService(`analytics`);n&&typeof n.query==`function`&&(t=n,e.logger.debug(`[Analytics] Found existing analytics service, using as fallback`))}catch{}this.service=new lqe({cubes:this.options.cubes,logger:e.logger,queryCapabilities:this.options.queryCapabilities,executeRawSql:this.options.executeRawSql,executeAggregate:this.options.executeAggregate,fallbackService:t}),t?e.replaceService(`analytics`,this.service):e.registerService(`analytics`,this.service),this.options.debug&&e.hook(`analytics:beforeQuery`,async t=>{e.logger.debug(`[Analytics] Before query`,{query:t})}),e.logger.info(`[Analytics] Service initialized`)}async start(e){this.service&&(await e.trigger(`analytics:ready`,this.service),e.logger.info(`[Analytics] Service started with ${this.service.cubeRegistry.size} cubes: ${this.service.cubeRegistry.names().join(`, `)||`(none)`}`))}async destroy(){this.service=void 0}};function fqe(e){return e==null}function pqe(e){return typeof e==`object`&&!!e}function mqe(e){return Array.isArray(e)?e:fqe(e)?[]:[e]}function hqe(e,t){var n,r,i,a;if(t)for(a=Object.keys(t),n=0,r=a.length;ns&&(a=` ... `,t=r-s+a.length),n-r>s&&(o=` ...`,n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,`→`)+o,pos:r-t+a.length}}function p5(e,t){return l5.repeat(` `,t-e.length)+e}function yqe(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||=79,typeof t.indent!=`number`&&(t.indent=1),typeof t.linesBefore!=`number`&&(t.linesBefore=3),typeof t.linesAfter!=`number`&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],i=[],a,o=-1;a=n.exec(e.buffer);)i.push(a.index),r.push(a.index+a[0].length),e.position<=a.index&&o<0&&(o=r.length-2);o<0&&(o=r.length-1);var s=``,c,l,u=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(o-c<0);c++)l=f5(e.buffer,r[o-c],i[o-c],e.position-(r[o]-r[o-c]),d),s=l5.repeat(` `,t.indent)+p5((e.line-c+1).toString(),u)+` | `+l.str+` +`+s;for(l=f5(e.buffer,r[o],i[o],e.position,d),s+=l5.repeat(` `,t.indent)+p5((e.line+1).toString(),u)+` | `+l.str+` +`,s+=l5.repeat(`-`,t.indent+u+3+l.pos)+`^ +`,c=1;c<=t.linesAfter&&!(o+c>=i.length);c++)l=f5(e.buffer,r[o+c],i[o+c],e.position-(r[o]-r[o+c]),d),s+=l5.repeat(` `,t.indent)+p5((e.line+c+1).toString(),u)+` | `+l.str+` +`;return s.replace(/\n$/,``)}var bqe=yqe,xqe=[`kind`,`multi`,`resolve`,`construct`,`instanceOf`,`predicate`,`represent`,`representName`,`defaultStyle`,`styleAliases`],Sqe=[`scalar`,`sequence`,`mapping`];function Cqe(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}function wqe(e,t){if(t||={},Object.keys(t).forEach(function(t){if(xqe.indexOf(t)===-1)throw new d5(`Unknown option "`+t+`" is met in definition of "`+e+`" YAML type.`)}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Cqe(t.styleAliases||null),Sqe.indexOf(this.kind)===-1)throw new d5(`Unknown kind "`+this.kind+`" is specified for "`+e+`" YAML type.`)}var m5=wqe;function Tqe(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)}),n[t]=e}),n}function Eqe(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(t=0,n=arguments.length;t=0?`0b`+e.toString(2):`-0b`+e.toString(2).slice(1)},octal:function(e){return e>=0?`0o`+e.toString(8):`-0o`+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?`0x`+e.toString(16).toUpperCase():`-0x`+e.toString(16).toUpperCase().slice(1)}},defaultStyle:`decimal`,styleAliases:{binary:[2,`bin`],octal:[8,`oct`],decimal:[10,`dec`],hexadecimal:[16,`hex`]}}),Uqe=RegExp(`^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function Wqe(e){return!(e===null||!Uqe.test(e)||e[e.length-1]===`_`)}function Gqe(e){var t=e.replace(/_/g,``).toLowerCase(),n=t[0]===`-`?-1:1;return`+-`.indexOf(t[0])>=0&&(t=t.slice(1)),t===`.inf`?n===1?1/0:-1/0:t===`.nan`?NaN:n*parseFloat(t,10)}var Kqe=/^[-+]?[0-9]+e/;function qqe(e,t){var n;if(isNaN(e))switch(t){case`lowercase`:return`.nan`;case`uppercase`:return`.NAN`;case`camelcase`:return`.NaN`}else if(e===1/0)switch(t){case`lowercase`:return`.inf`;case`uppercase`:return`.INF`;case`camelcase`:return`.Inf`}else if(e===-1/0)switch(t){case`lowercase`:return`-.inf`;case`uppercase`:return`-.INF`;case`camelcase`:return`-.Inf`}else if(l5.isNegativeZero(e))return`-0.0`;return n=e.toString(10),Kqe.test(n)?n.replace(`e`,`.e`):n}function Jqe(e){return Object.prototype.toString.call(e)===`[object Number]`&&(e%1!=0||l5.isNegativeZero(e))}var Yqe=new m5(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:Wqe,construct:Gqe,predicate:Jqe,represent:qqe,defaultStyle:`lowercase`}),Xqe=Dqe.extend({implicit:[jqe,Fqe,Hqe,Yqe]}),Zqe=Xqe,Qqe=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),$qe=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function eJe(e){return e===null?!1:Qqe.exec(e)!==null||$qe.exec(e)!==null}function tJe(e){var t,n,r,i,a,o,s,c=0,l=null,u,d,f;if(t=Qqe.exec(e),t===null&&(t=$qe.exec(e)),t===null)throw Error(`Date resolve error`);if(n=+t[1],r=t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,r,i));if(a=+t[4],o=+t[5],s=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+=`0`;c=+c}return t[9]&&(u=+t[10],d=+(t[11]||0),l=(u*60+d)*6e4,t[9]===`-`&&(l=-l)),f=new Date(Date.UTC(n,r,i,a,o,s,c)),l&&f.setTime(f.getTime()-l),f}function nJe(e){return e.toISOString()}var rJe=new m5(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:eJe,construct:tJe,instanceOf:Date,represent:nJe});function iJe(e){return e===`<<`||e===null}var aJe=new m5(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:iJe}),g5=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= +\r`;function oJe(e){if(e===null)return!1;var t,n,r=0,i=e.length,a=g5;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0}function sJe(e){var t,n,r=e.replace(/[\r\n=]/g,``),i=r.length,a=g5,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(o&255)),o=o<<6|a.indexOf(r.charAt(t));return n=i%4*6,n===0?(s.push(o>>16&255),s.push(o>>8&255),s.push(o&255)):n===18?(s.push(o>>10&255),s.push(o>>2&255)):n===12&&s.push(o>>4&255),new Uint8Array(s)}function cJe(e){var t=``,n=0,r,i,a=e.length,o=g5;for(r=0;r>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]),n=(n<<8)+e[r];return i=a%3,i===0?(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]):i===2?(t+=o[n>>10&63],t+=o[n>>4&63],t+=o[n<<2&63],t+=o[64]):i===1&&(t+=o[n>>2&63],t+=o[n<<4&63],t+=o[64],t+=o[64]),t}function lJe(e){return Object.prototype.toString.call(e)===`[object Uint8Array]`}var uJe=new m5(`tag:yaml.org,2002:binary`,{kind:`scalar`,resolve:oJe,construct:sJe,predicate:lJe,represent:cJe}),dJe=Object.prototype.hasOwnProperty,fJe=Object.prototype.toString;function pJe(e){if(e===null)return!0;var t=[],n,r,i,a,o,s=e;for(n=0,r=s.length;n>10)+55296,(e-65536&1023)+56320)}function BJe(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}for(var VJe=Array(256),HJe=Array(256),T5=0;T5<256;T5++)VJe[T5]=+!!RJe(T5),HJe[T5]=RJe(T5);function UJe(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||wJe,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function WJe(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=bqe(n),new d5(t,n)}function E5(e,t){throw WJe(e,t)}function D5(e,t){e.onWarning&&e.onWarning.call(null,WJe(e,t))}var GJe={YAML:function(e,t,n){var r,i,a;e.version!==null&&E5(e,`duplication of %YAML directive`),n.length!==1&&E5(e,`YAML directive accepts exactly one argument`),r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),r===null&&E5(e,`ill-formed argument of the YAML directive`),i=parseInt(r[1],10),a=parseInt(r[2],10),i!==1&&E5(e,`unacceptable YAML version of the document`),e.version=n[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&D5(e,`unsupported YAML version of the document`)},TAG:function(e,t,n){var r,i;n.length!==2&&E5(e,`TAG directive accepts exactly two arguments`),r=n[0],i=n[1],MJe.test(r)||E5(e,`ill-formed tag handle (first argument) of the TAG directive`),_5.call(e.tagMap,r)&&E5(e,`there is a previously declared suffix for "`+r+`" tag handle`),NJe.test(i)||E5(e,`ill-formed tag prefix (second argument) of the TAG directive`);try{i=decodeURIComponent(i)}catch{E5(e,`tag prefix is malformed: `+i)}e.tagMap[r]=i}};function O5(e,t,n,r){var i,a,o,s;if(t1&&(e.result+=l5.repeat(` +`,t-1))}function qJe(e,t,n){var r,i,a,o,s,c,l,u,d=e.kind,f=e.result,p=e.input.charCodeAt(e.position);if(C5(p)||w5(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=e.input.charCodeAt(e.position+1),C5(i)||n&&w5(i)))return!1;for(e.kind=`scalar`,e.result=``,a=o=e.position,s=!1;p!==0;){if(p===58){if(i=e.input.charCodeAt(e.position+1),C5(i)||n&&w5(i))break}else if(p===35){if(r=e.input.charCodeAt(e.position-1),C5(r))break}else if(e.position===e.lineStart&&M5(e)||n&&w5(p))break;else if(x5(p))if(c=e.line,l=e.lineStart,u=e.lineIndent,j5(e,!1,-1),e.lineIndent>=t){s=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=c,e.lineStart=l,e.lineIndent=u;break}s&&=(O5(e,a,o,!1),N5(e,e.line-c),a=o=e.position,!1),S5(p)||(o=e.position+1),p=e.input.charCodeAt(++e.position)}return O5(e,a,o,!1),e.result?!0:(e.kind=d,e.result=f,!1)}function JJe(e,t){var n=e.input.charCodeAt(e.position),r,i;if(n!==39)return!1;for(e.kind=`scalar`,e.result=``,e.position++,r=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(O5(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,i=e.position;else return!0;else x5(n)?(O5(e,r,i,!0),N5(e,j5(e,!1,t)),r=i=e.position):e.position===e.lineStart&&M5(e)?E5(e,`unexpected end of the document within a single quoted scalar`):(e.position++,i=e.position);E5(e,`unexpected end of the stream within a single quoted scalar`)}function YJe(e,t){var n,r,i,a,o,s=e.input.charCodeAt(e.position);if(s!==34)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(s=e.input.charCodeAt(e.position))!==0;)if(s===34)return O5(e,n,e.position,!0),e.position++,!0;else if(s===92){if(O5(e,n,e.position,!0),s=e.input.charCodeAt(++e.position),x5(s))j5(e,!1,t);else if(s<256&&VJe[s])e.result+=HJe[s],e.position++;else if((o=IJe(s))>0){for(i=o,a=0;i>0;i--)s=e.input.charCodeAt(++e.position),(o=FJe(s))>=0?a=(a<<4)+o:E5(e,`expected hexadecimal character`);e.result+=zJe(a),e.position++}else E5(e,`unknown escape sequence`);n=r=e.position}else x5(s)?(O5(e,n,r,!0),N5(e,j5(e,!1,t)),n=r=e.position):e.position===e.lineStart&&M5(e)?E5(e,`unexpected end of the document within a double quoted scalar`):(e.position++,r=e.position);E5(e,`unexpected end of the stream within a double quoted scalar`)}function XJe(e,t){var n=!0,r,i,a,o=e.tag,s,c=e.anchor,l,u,d,f,p,m=Object.create(null),h,g,_,v=e.input.charCodeAt(e.position);if(v===91)u=93,p=!1,s=[];else if(v===123)u=125,p=!0,s={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),v=e.input.charCodeAt(++e.position);v!==0;){if(j5(e,!0,t),v=e.input.charCodeAt(e.position),v===u)return e.position++,e.tag=o,e.anchor=c,e.kind=p?`mapping`:`sequence`,e.result=s,!0;n?v===44&&E5(e,`expected the node content, but found ','`):E5(e,`missed comma between flow collection entries`),g=h=_=null,d=f=!1,v===63&&(l=e.input.charCodeAt(e.position+1),C5(l)&&(d=f=!0,e.position++,j5(e,!0,t))),r=e.line,i=e.lineStart,a=e.position,P5(e,t,v5,!1,!0),g=e.tag,h=e.result,j5(e,!0,t),v=e.input.charCodeAt(e.position),(f||e.line===r)&&v===58&&(d=!0,v=e.input.charCodeAt(++e.position),j5(e,!0,t),P5(e,t,v5,!1,!0),_=e.result),p?k5(e,s,m,g,h,_,r,i,a):d?s.push(k5(e,null,m,g,h,_,r,i,a)):s.push(h),j5(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}E5(e,`unexpected end of the stream within a flow collection`)}function ZJe(e,t){var n,r,i=b5,a=!1,o=!1,s=t,c=0,l=!1,u,d=e.input.charCodeAt(e.position);if(d===124)r=!1;else if(d===62)r=!0;else return!1;for(e.kind=`scalar`,e.result=``;d!==0;)if(d=e.input.charCodeAt(++e.position),d===43||d===45)b5===i?i=d===43?OJe:DJe:E5(e,`repeat of a chomping mode identifier`);else if((u=LJe(d))>=0)u===0?E5(e,`bad explicit indentation width of a block scalar; it cannot be less than one`):o?E5(e,`repeat of an indentation width identifier`):(s=t+u-1,o=!0);else break;if(S5(d)){do d=e.input.charCodeAt(++e.position);while(S5(d));if(d===35)do d=e.input.charCodeAt(++e.position);while(!x5(d)&&d!==0)}for(;d!==0;){for(A5(e),e.lineIndent=0,d=e.input.charCodeAt(e.position);(!o||e.lineIndents&&(s=e.lineIndent),x5(d)){c++;continue}if(e.lineIndentt)&&c!==0)E5(e,`bad indentation of a sequence entry`);else if(e.lineIndentt)&&(g&&(o=e.line,s=e.lineStart,c=e.position),P5(e,t,y5,!0,i)&&(g?m=e.result:h=e.result),g||(k5(e,d,f,p,m,h,o,s,c),p=m=h=null),j5(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&v!==0)E5(e,`bad indentation of a mapping entry`);else if(e.lineIndentt?c=1:e.lineIndent===t?c=0:e.lineIndentt?c=1:e.lineIndent===t?c=0:e.lineIndent tag; it should be "scalar", not "`+e.kind+`"`),d=0,f=e.implicitTypes.length;d`),e.result!==null&&m.kind!==e.kind&&E5(e,`unacceptable node kind for !<`+e.tag+`> tag; it should be "`+m.kind+`", not "`+e.kind+`"`),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):E5(e,`cannot resolve a node with !<`+e.tag+`> explicit tag`)}return e.listener!==null&&e.listener(`close`,e),e.tag!==null||e.anchor!==null||u}function rYe(e){var t=e.position,n,r,i,a=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(j5(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(a=!0,o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!C5(o);)o=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),i=[],r.length<1&&E5(e,`directive name must not be less than one character in length`);o!==0;){for(;S5(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!x5(o));break}if(x5(o))break;for(n=e.position;o!==0&&!C5(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&A5(e),_5.call(GJe,r)?GJe[r](e,r,i):D5(e,`unknown document directive "`+r+`"`)}if(j5(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,j5(e,!0,-1)):a&&E5(e,`directives end mark is expected`),P5(e,e.lineIndent-1,y5,!1,!0),j5(e,!0,-1),e.checkLineBreaks&&AJe.test(e.input.slice(t,e.position))&&D5(e,`non-ASCII line breaks are interpreted as content`),e.documents.push(e.result),e.position===e.lineStart&&M5(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,j5(e,!0,-1));return}if(e.position=55296&&n<=56319&&t+1=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function UYe(e){return/^\n* /.test(e)}var WYe=1,G5=2,GYe=3,KYe=4,K5=5;function qYe(e,t,n,r,i,a,o,s){var c,l=0,u=null,d=!1,f=!1,p=r!==-1,m=-1,h=VYe(W5(e,0))&&HYe(W5(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(l=W5(e,c),!U5(l))return K5;h&&=BYe(l,u,s),u=l}else{for(c=0;c=65536?c+=2:c++){if(l=W5(e,c),l===I5)d=!0,p&&(f||=c-m-1>r&&e[m+1]!==` `,m=c);else if(!U5(l))return K5;h&&=BYe(l,u,s),u=l}f||=p&&c-m-1>r&&e[m+1]!==` `}return!d&&!f?h&&!o&&!i(e)?WYe:a===B5?K5:G5:n>9&&UYe(e)?K5:o?a===B5?K5:G5:f?KYe:GYe}function JYe(e,t,n,r,i){e.dump=function(){if(t.length===0)return e.quotingType===B5?`""`:`''`;if(!e.noCompatMode&&(jYe.indexOf(t)!==-1||MYe.test(t)))return e.quotingType===B5?`"`+t+`"`:`'`+t+`'`;var a=e.indent*Math.max(1,n),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),s=r||e.flowLevel>-1&&n>=e.flowLevel;function c(t){return RYe(e,t)}switch(qYe(t,s,e.indent,o,c,e.quotingType,e.forceQuotes&&!r,i)){case WYe:return t;case G5:return`'`+t.replace(/'/g,`''`)+`'`;case GYe:return`|`+YYe(t,e.indent)+XYe(LYe(t,a));case KYe:return`>`+YYe(t,e.indent)+XYe(LYe(ZYe(t,o),a));case K5:return`"`+$Ye(t)+`"`;default:throw new d5(`impossible error: invalid scalar style`)}}()}function YYe(e,t){var n=UYe(e)?String(t):``,r=e[e.length-1]===` +`;return n+(r&&(e[e.length-2]===` +`||e===` +`)?`+`:r?``:`-`)+` +`}function XYe(e){return e[e.length-1]===` +`?e.slice(0,-1):e}function ZYe(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var r=e.indexOf(` +`);return r=r===-1?e.length:r,n.lastIndex=r,QYe(e.slice(0,r),t)}(),i=e[0]===` +`||e[0]===` `,a,o;o=n.exec(e);){var s=o[1],c=o[2];a=c[0]===` `,r+=s+(!i&&!a&&c!==``?` +`:``)+QYe(c,t),i=a}return r}function QYe(e,t){if(e===``||e[0]===` `)return e;for(var n=/ [^ ]/g,r,i=0,a,o=0,s=0,c=``;r=n.exec(e);)s=r.index,s-i>t&&(a=o>i?o:s,c+=` +`+e.slice(i,a),i=a+1),o=s;return c+=` +`,e.length-i>t&&o>i?c+=e.slice(i,o)+` +`+e.slice(o+1):c+=e.slice(i),c.slice(1)}function $Ye(e){for(var t=``,n=0,r,i=0;i=65536?i+=2:i++)n=W5(e,i),r=z5[n],!r&&U5(n)?(t+=e[i],n>=65536&&(t+=e[i+1])):t+=r||PYe(n);return t}function eXe(e,t,n){var r=``,i=e.tag,a,o,s;for(a=0,o=n.length;a1024&&(u+=`? `),u+=e.dump+(e.condenseFlow?`"`:``)+`:`+(e.condenseFlow?``:` `),q5(e,t,l,!1,!1)&&(u+=e.dump,r+=u));e.tag=i,e.dump=`{`+r+`}`}function rXe(e,t,n,r){var i=``,a=e.tag,o=Object.keys(n),s,c,l,u,d,f;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys==`function`)o.sort(e.sortKeys);else if(e.sortKeys)throw new d5(`sortKeys must be a boolean or a function`);for(s=0,c=o.length;s1024,d&&(e.dump&&I5===e.dump.charCodeAt(0)?f+=`?`:f+=`? `),f+=e.dump,d&&(f+=V5(e,t)),q5(e,t+1,u,!0,d)&&(e.dump&&I5===e.dump.charCodeAt(0)?f+=`:`:f+=`: `,f+=e.dump,i+=f));e.tag=a,e.dump=i||`{}`}function iXe(e,t,n){var r,i=n?e.explicitTypes:e.implicitTypes,a,o,s,c;for(a=0,o=i.length;a tag resolver accepts not "`+c+`" style`);e.dump=r}return!0}return!1}function q5(e,t,n,r,i,a,o){e.tag=null,e.dump=n,iXe(e,n,!1)||iXe(e,n,!0);var s=cYe.call(e.dump),c=r,l;r&&=e.flowLevel<0||e.flowLevel>t;var u=s===`[object Object]`||s===`[object Array]`,d,f;if(u&&(d=e.duplicates.indexOf(n),f=d!==-1),(e.tag!==null&&e.tag!==`?`||f||e.indent!==2&&t>0)&&(i=!1),f&&e.usedDuplicates[d])e.dump=`*ref_`+d;else{if(u&&f&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),s===`[object Object]`)r&&Object.keys(e.dump).length!==0?(rXe(e,t,e.dump,i),f&&(e.dump=`&ref_`+d+e.dump)):(nXe(e,t,e.dump),f&&(e.dump=`&ref_`+d+` `+e.dump));else if(s===`[object Array]`)r&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?tXe(e,t-1,e.dump,i):tXe(e,t,e.dump,i),f&&(e.dump=`&ref_`+d+e.dump)):(eXe(e,t,e.dump),f&&(e.dump=`&ref_`+d+` `+e.dump));else if(s===`[object String]`)e.tag!==`?`&&JYe(e,e.dump,t,a,c);else if(s===`[object Undefined]`)return!1;else{if(e.skipInvalid)return!1;throw new d5(`unacceptable kind of an object to dump `+s)}e.tag!==null&&e.tag!==`?`&&(l=encodeURI(e.tag[0]===`!`?e.tag.slice(1):e.tag).replace(/!/g,`%21`),l=e.tag[0]===`!`?`!`+l:l.slice(0,18)===`tag:yaml.org,2002:`?`!!`+l.slice(18):`!<`+l+`>`,e.dump=l+` `+e.dump)}return!0}function aXe(e,t){var n=[],r=[],i,a;for(J5(e,n,r),i=0,a=r.length;i({on:()=>{},close:()=>{}}),fXe=(e,t,n)=>{let r=e instanceof RegExp?pXe(e,n):e,i=t instanceof RegExp?pXe(t,n):t,a=r!==null&&i!=null&&mXe(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},pXe=(e,t)=>{let n=t.match(e);return n?n[0]:null},mXe=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},hXe=`\0SLASH`+Math.random()+`\0`,gXe=`\0OPEN`+Math.random()+`\0`,Y5=`\0CLOSE`+Math.random()+`\0`,_Xe=`\0COMMA`+Math.random()+`\0`,vXe=`\0PERIOD`+Math.random()+`\0`,yXe=new RegExp(hXe,`g`),bXe=new RegExp(gXe,`g`),xXe=new RegExp(Y5,`g`),SXe=new RegExp(_Xe,`g`),CXe=new RegExp(vXe,`g`),wXe=/\\\\/g,TXe=/\\{/g,EXe=/\\}/g,DXe=/\\,/g,OXe=/\\./g,kXe=1e5;function X5(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function AXe(e){return e.replace(wXe,hXe).replace(TXe,gXe).replace(EXe,Y5).replace(DXe,_Xe).replace(OXe,vXe)}function jXe(e){return e.replace(yXe,`\\`).replace(bXe,`{`).replace(xXe,`}`).replace(SXe,`,`).replace(CXe,`.`)}function MXe(e){if(!e)return[``];let t=[],n=fXe(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=MXe(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function NXe(e,t={}){if(!e)return[];let{max:n=kXe}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),Z5(AXe(e),n,!0).map(jXe)}function PXe(e){return`{`+e+`}`}function FXe(e){return/^-?0\d/.test(e)}function IXe(e,t){return e<=t}function LXe(e,t){return e>=t}function Z5(e,t,n){let r=[],i=fXe(`{`,`}`,e);if(!i)return[e];let a=i.pre,o=i.post.length?Z5(i.post,t,!1):[``];if(/\$$/.test(i.pre))for(let e=0;e=0;if(!l&&!u)return i.post.match(/,(?!,).*\}/)?(e=i.pre+`{`+i.body+Y5+i.post,Z5(e,t,!0)):[e];let d;if(l)d=i.body.split(/\.\./);else if(d=MXe(i.body),d.length===1&&d[0]!==void 0&&(d=Z5(d[0],t,!1).map(PXe),d.length===1))return o.map(e=>i.pre+d[0]+e);let f;if(l&&d[0]!==void 0&&d[1]!==void 0){let e=X5(d[0]),t=X5(d[1]),n=Math.max(d[0].length,d[1].length),r=d.length===3&&d[2]!==void 0?Math.abs(X5(d[2])):1,i=IXe;t0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},RXe={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},$5=e=>e.replace(/[[\]\\-]/g,`\\$&`),zXe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),BXe=e=>e.join(``),VXe=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;t:for(;ad?r.push($5(d)+`-`+$5(t)):t===d&&r.push($5(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push($5(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push($5(t)),a++}if(un?t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`):t?e.replace(/\[([^\/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,`$1$2`).replace(/\\([^\/{}])/g,`$1`),HXe=new Set([`!`,`?`,`+`,`*`,`@`]),UXe=e=>HXe.has(e),WXe=`(?!(?:^|/)\\.\\.?(?:$|/))`,t7=`(?!\\.)`,GXe=new Set([`[`,`.`]),KXe=new Set([`..`,`.`]),qXe=new Set(`().*{}+?[]^$\\!`),JXe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),n7=`[^/]`,YXe=n7+`*?`,XXe=n7+`+?`,ZXe=class e{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&rtypeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let t=this.#i;for(let n=0;ntypeof e!=`string`),i=this.#r.map(n=>{let[i,a,o,s]=typeof n==`string`?e.#m(n,this.#t,r):n.toRegExpSource(t);return this.#t=this.#t||o,this.#n=this.#n||s,i}).join(``),a=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&KXe.has(this.#r[0]))){let e=GXe,r=n&&e.has(i.charAt(0))||i.startsWith(`\\.`)&&e.has(i.charAt(2))||i.startsWith(`\\.\\.`)&&e.has(i.charAt(4)),o=!n&&!t&&e.has(i.charAt(0));a=r?WXe:o?t7:``}let o=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(o=`(?:$|\\/)`),[a+i+o,e7(i),this.#t=!!this.#t,this.#n]}let r=this.type===`*`||this.type===`+`,i=this.type===`!`?`(?:(?!(?:`:`(?:`,a=this.#p(n);if(this.isStart()&&this.isEnd()&&!a&&this.type!==`!`){let e=this.toString();return this.#r=[e],this.type=null,this.#t=void 0,[e,e7(this.toString()),!1,!1]}let o=!r||t||n||!t7?``:this.#p(!0);o===a&&(o=``),o&&(a=`(?:${a})(?:${o})*?`);let s=``;if(this.type===`!`&&this.#u)s=(this.isStart()&&!n?t7:``)+XXe;else{let e=this.type===`!`?`))`+(this.isStart()&&!n&&!t?t7:``)+YXe+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&o?`)`:this.type===`*`&&o?`)?`:`)${this.type}`;s=i+a+e}return[s,e7(a),this.#t=!!this.#t,this.#n]}#p(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#m(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;sn?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),r7=(e,t,n={})=>(Q5(t),!n.nocomment&&t.charAt(0)===`#`?!1:new o7(t,n).match(e)),$Xe=/^\*+([^+@!?\*\[\(]*)$/,eZe=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),tZe=e=>t=>t.endsWith(e),nZe=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),rZe=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),iZe=/^\*+\.\*+$/,aZe=e=>!e.startsWith(`.`)&&e.includes(`.`),oZe=e=>e!==`.`&&e!==`..`&&e.includes(`.`),sZe=/^\.\*+$/,cZe=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),lZe=/^\*+$/,uZe=e=>e.length!==0&&!e.startsWith(`.`),dZe=e=>e.length!==0&&e!==`.`&&e!==`..`,fZe=/^\?+([^+@!?\*\[\(]*)?$/,pZe=([e,t=``])=>{let n=_Ze([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},mZe=([e,t=``])=>{let n=vZe([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},hZe=([e,t=``])=>{let n=vZe([e]);return t?e=>n(e)&&e.endsWith(t):n},gZe=([e,t=``])=>{let n=_Ze([e]);return t?e=>n(e)&&e.endsWith(t):n},_Ze=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},vZe=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},yZe=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,bZe={win32:{sep:`\\`},posix:{sep:`/`}};r7.sep=yZe===`win32`?bZe.win32.sep:bZe.posix.sep;var i7=Symbol(`globstar **`);r7.GLOBSTAR=i7;var xZe=`[^/]*?`,SZe=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,CZe=`(?:(?!(?:\\/|^)\\.).)*?`;r7.filter=(e,t={})=>n=>r7(n,e,t);var a7=(e,t={})=>Object.assign({},e,t);r7.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return r7;let t=r7;return Object.assign((n,r,i={})=>t(n,r,a7(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,a7(e,n))}static defaults(n){return t.defaults(a7(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,a7(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,a7(e,r))}},unescape:(n,r={})=>t.unescape(n,a7(e,r)),escape:(n,r={})=>t.escape(n,a7(e,r)),filter:(n,r={})=>t.filter(n,a7(e,r)),defaults:n=>t.defaults(a7(e,n)),makeRe:(n,r={})=>t.makeRe(n,a7(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,a7(e,r)),match:(n,r,i={})=>t.match(n,r,a7(e,i)),sep:t.sep,GLOBSTAR:i7})};var wZe=(e,t={})=>(Q5(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:NXe(e,{max:t.braceExpandMax}));r7.braceExpand=wZe,r7.makeRe=(e,t={})=>new o7(e,t).makeRe(),r7.match=(e,t,n={})=>{let r=new o7(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var TZe=/[?*]|[+@!]\(.*?\)|\[|\]/,EZe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),o7=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){Q5(e),t||={},this.options=t,this.pattern=e,this.platform=t.platform||yZe,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!TZe.test(e[2]))&&!TZe.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;nr&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;ee.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;ro?t=t.slice(s):o>s&&(e=e.slice(o)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(e=this.levelTwoFileOptimize(e)),this.debug(`matchOne`,this,{file:e,pattern:t}),this.debug(`matchOne`,e.length,t.length);for(var a=0,o=0,s=e.length,c=t.length;a>> no match, partial?`,e,d,t,f),d===s))}let i;if(typeof l==`string`?(i=u===l,this.debug(`string match`,l,u,i)):(i=l.test(u),this.debug(`pattern match`,l,u,i)),!i)return!1}if(a===s&&o===c)return!0;if(a===s)return n;if(o===c)return a===s-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return wZe(this.pattern,this.options)}parse(e){Q5(e);let t=this.options;if(e===`**`)return i7;if(e===``)return``;let n,r=null;(n=e.match(lZe))?r=t.dot?dZe:uZe:(n=e.match($Xe))?r=(t.nocase?t.dot?rZe:nZe:t.dot?tZe:eZe)(n[1]):(n=e.match(fZe))?r=(t.nocase?t.dot?mZe:pZe:t.dot?hZe:gZe)(n):(n=e.match(iZe))?r=t.dot?oZe:aZe:(n=e.match(sZe))&&(r=cZe);let i=ZXe.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,`test`,{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?xZe:t.dot?SZe:CZe,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?EZe(e):e===i7?i7:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==i7||a===i7||(a===void 0?i!==void 0&&i!==i7?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==i7&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=i7))});let i=t.filter(e=>e!==i7);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e{typeof s7.emitWarning==`function`?s7.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},c7=globalThis.AbortController,AZe=globalThis.AbortSignal;if(typeof c7>`u`){AZe=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},c7=class{constructor(){t()}signal=new AZe;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(let t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e=s7.env?.LRU_CACHE_IGNORE_AC_WARNING!==`1`,t=()=>{e&&(e=!1,kZe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.",`NO_ABORT_CONTROLLER`,`ENOTSUP`,t))}}var jZe=e=>!OZe.has(e),l7=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),MZe=e=>l7(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?u7:null:null,u7=class extends Array{constructor(e){super(e),this.fill(0)}},NZe=class e{heap;length;static#e=!1;static create(t){let n=MZe(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},d7=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#V(t),backgroundFetch:(t,n,r,i)=>e.#B(t,n,r,i),moveToTail:t=>e.#U(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:S,ignoreFetchAbort:C,perf:w}=t;if(w!==void 0&&typeof w?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=w??DZe,n!==0&&!l7(n))throw TypeError(`max option must be a nonnegative integer`);let T=n?MZe(n):Array;if(!T)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=new Map,this.#d=Array(n).fill(void 0),this.#f=Array(n).fill(void 0),this.#p=new T(n),this.#m=new T(n),this.#h=0,this.#g=0,this.#_=NZe.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#t!==0&&!l7(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!l7(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=l7(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!l7(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;jZe(t)&&(OZe.add(t),kZe(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new u7(this.#e),t=new u7(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array(this.#e):void 0;this.#S=n,this.#A=(r,i,a=this.#s.now())=>{if(t[r]=i===0?0:a,e[r]=i,n?.[r]&&(clearTimeout(n[r]),n[r]=void 0),i!==0&&n){let e=setTimeout(()=>{this.#j(r)&&this.#W(this.#d[r],`expire`)},i+1);e.unref&&e.unref(),n[r]=e}},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now()},this.#k=(n,a)=>{if(e[a]){let o=e[a],s=t[a];if(!o||!s)return;n.ttl=o,n.start=s,n.now=r||i(),n.remainingTTL=o-(n.now-s)}};let r=0,i=()=>{let e=this.#s.now();if(this.ttlResolution>0){r=e;let t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{let a=this.#u.get(n);if(a===void 0)return 0;let o=e[a],s=t[a];return!o||!s?1/0:o-((r||i())-s)},this.#j=n=>{let a=t[n],o=e[n];return!!o&&!!a&&(r||i())-a>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new u7(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(this.#V(t))return 0;if(!l7(n))if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!l7(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`);return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#z(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;!(!this.#R(t)||((e||!this.#j(t))&&(yield t),t===this.#h));)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;!(!this.#R(t)||((e||!this.#j(t))&&(yield t),t===this.#g));)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#V(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#V(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#V(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#V(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#V(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#V(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.get(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#W(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#V(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#V(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:i,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:s}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,l=this.#F(e,t,n.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return s&&(s.set=`miss`,s.maxEntrySizeExceeded=!0),this.#W(e,`set`),this;let u=this.#c===0?void 0:this.#u.get(e);if(u===void 0)u=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#z(!1):this.#c:this.#_.pop(),this.#d[u]=e,this.#f[u]=t,this.#u.set(e,u),this.#p[this.#g]=u,this.#m[u]=this.#g,this.#g=u,this.#c++,this.#P(u,l,s),s&&(s.set=`add`),c=!1,this.#E&&this.#r?.(t,e,`add`);else{this.#U(u);let n=this.#f[u];if(t!==n){if(this.#w&&this.#V(n)){n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:t}=n;t!==void 0&&!a&&(this.#C&&this.#n?.(t,e,`set`),this.#T&&this.#v?.push([t,e,`set`]))}else a||(this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`]));if(this.#N(u),this.#P(u,l,s),this.#f[u]=t,s){s.set=`replace`;let e=n&&this.#V(n)?n.__staleWhileFetching:n;e!==void 0&&(s.oldValue=e)}}else s&&(s.set=`update`);this.#E&&this.onInsert?.(t,e,t===n?`update`:`replace`)}if(r!==0&&!this.#x&&this.#D(),this.#x&&(c||this.#A(u,r,i),s&&this.#k(s,u)),!a&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#z(!0),this.#V(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#z(e){let t=this.#h,n=this.#d[t],r=this.#f[t];return this.#w&&this.#V(r)?r.__abortController.abort(Error(`evicted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(r,n,`evict`),this.#T&&this.#v?.push([r,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#V(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#u.get(e);if(r===void 0||!n&&this.#j(r))return;let i=this.#f[r];return this.#V(i)?i.__staleWhileFetching:i}#B(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#V(i))return i;let a=new c7,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||c&&i&&p===void 0)&&(r===void 0?d.__staleWhileFetching===void 0?this.#W(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,s.options))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#W(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);o&&o instanceof Promise&&o.then(e=>t(e===void 0?void 0:e),r),a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.set(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#V(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof c7}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(!this.#w)return g&&(g.fetch=`get`),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#B(e,y,v,m);return t.__returned=t}else{let t=this.#f[y];if(this.#V(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#U(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#B(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,forceRefresh:i,...a}=t,o=this.get(e,a);if(!i&&o!==void 0)return o;let s=n(e,o,{options:a,context:r});return this.set(e,s,a),s}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o!==void 0){let t=this.#f[o],s=this.#V(t);return a&&this.#k(a,o),this.#j(o)?(a&&(a.get=`stale`),s?(a&&n&&t.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?t.__staleWhileFetching:void 0):(i||this.#W(e,`expire`),a&&n&&(a.returnedStale=!0),n?t:void 0)):(a&&(a.get=`hit`),s?t.__staleWhileFetching:(this.#U(o),r&&this.#O(o),t))}else a&&(a.get=`miss`)}#H(e,t){this.#m[t]=e,this.#p[e]=t}#U(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#H(this.#m[e],this.#p[e]),this.#H(this.#g,e),this.#g=e)}delete(e){return this.#W(e,`delete`)}#W(e,t){let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0)if(this.#S?.[r]&&(clearTimeout(this.#S?.[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#G(t);else{this.#N(r);let n=this.#f[r];if(this.#V(n)?n.__abortController.abort(Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#G(`delete`)}#G(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#V(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}},PZe=typeof process==`object`&&process?process:{stdout:null,stderr:null},FZe=e=>!!e&&typeof e==`object`&&(e instanceof V7||e instanceof Fd||IZe(e)||LZe(e)),IZe=e=>!!e&&typeof e==`object`&&e instanceof Pd&&typeof e.pipe==`function`&&e.pipe!==Fd.Writable.prototype.pipe,LZe=e=>!!e&&typeof e==`object`&&e instanceof Pd&&typeof e.write==`function`&&typeof e.end==`function`,f7=Symbol(`EOF`),p7=Symbol(`maybeEmitEnd`),m7=Symbol(`emittedEnd`),h7=Symbol(`emittingEnd`),g7=Symbol(`emittedError`),_7=Symbol(`closed`),RZe=Symbol(`read`),v7=Symbol(`flush`),zZe=Symbol(`flushChunk`),y7=Symbol(`encoding`),b7=Symbol(`decoder`),x7=Symbol(`flowing`),S7=Symbol(`paused`),C7=Symbol(`resume`),w7=Symbol(`buffer`),T7=Symbol(`pipes`),E7=Symbol(`bufferLength`),D7=Symbol(`bufferPush`),O7=Symbol(`bufferShift`),k7=Symbol(`objectMode`),A7=Symbol(`destroyed`),j7=Symbol(`error`),M7=Symbol(`emitData`),BZe=Symbol(`emitEnd`),N7=Symbol(`emitEnd2`),P7=Symbol(`async`),F7=Symbol(`abort`),I7=Symbol(`aborted`),L7=Symbol(`signal`),R7=Symbol(`dataListeners`),z7=Symbol(`discarded`),B7=e=>Promise.resolve().then(e),VZe=e=>e(),HZe=e=>e===`end`||e===`finish`||e===`prefinish`,UZe=e=>e instanceof ArrayBuffer||!!e&&typeof e==`object`&&e.constructor&&e.constructor.name===`ArrayBuffer`&&e.byteLength>=0,WZe=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),GZe=class{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[C7](),this.dest.on(`drain`,this.ondrain)}unpipe(){this.dest.removeListener(`drain`,this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},KZe=class extends GZe{unpipe(){this.src.removeListener(`error`,this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=e=>this.dest.emit(`error`,e),e.on(`error`,this.proxyErrors)}},qZe=e=>!!e.objectMode,JZe=e=>!e.objectMode&&!!e.encoding&&e.encoding!==`buffer`,V7=class extends Pd{[x7]=!1;[S7]=!1;[T7]=[];[w7]=[];[k7];[y7];[P7];[b7];[f7]=!1;[m7]=!1;[h7]=!1;[_7]=!1;[g7]=null;[E7]=0;[A7]=!1;[L7];[I7]=!1;[R7]=0;[z7]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding==`string`)throw TypeError(`Encoding and objectMode may not be used together`);qZe(t)?(this[k7]=!0,this[y7]=null):JZe(t)?(this[y7]=t.encoding,this[k7]=!1):(this[k7]=!1,this[y7]=null),this[P7]=!!t.async,this[b7]=this[y7]?new Bd(this[y7]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,`buffer`,{get:()=>this[w7]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,`pipes`,{get:()=>this[T7]});let{signal:n}=t;n&&(this[L7]=n,n.aborted?this[F7]():n.addEventListener(`abort`,()=>this[F7]()))}get bufferLength(){return this[E7]}get encoding(){return this[y7]}set encoding(e){throw Error(`Encoding must be set at instantiation time`)}setEncoding(e){throw Error(`Encoding must be set at instantiation time`)}get objectMode(){return this[k7]}set objectMode(e){throw Error(`objectMode must be set at instantiation time`)}get async(){return this[P7]}set async(e){this[P7]=this[P7]||!!e}[F7](){this[I7]=!0,this.emit(`abort`,this[L7]?.reason),this.destroy(this[L7]?.reason)}get aborted(){return this[I7]}set aborted(e){}write(e,t,n){if(this[I7])return!1;if(this[f7])throw Error(`write after end`);if(this[A7])return this.emit(`error`,Object.assign(Error(`Cannot call write after a stream was destroyed`),{code:`ERR_STREAM_DESTROYED`})),!0;typeof t==`function`&&(n=t,t=`utf8`),t||=`utf8`;let r=this[P7]?B7:VZe;if(!this[k7]&&!Buffer.isBuffer(e)){if(WZe(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(UZe(e))e=Buffer.from(e);else if(typeof e!=`string`)throw Error(`Non-contiguous data written to non-objectMode stream`)}return this[k7]?(this[x7]&&this[E7]!==0&&this[v7](!0),this[x7]?this.emit(`data`,e):this[D7](e),this[E7]!==0&&this.emit(`readable`),n&&r(n),this[x7]):e.length?(typeof e==`string`&&!(t===this[y7]&&!this[b7]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[y7]&&(e=this[b7].write(e)),this[x7]&&this[E7]!==0&&this[v7](!0),this[x7]?this.emit(`data`,e):this[D7](e),this[E7]!==0&&this.emit(`readable`),n&&r(n),this[x7]):(this[E7]!==0&&this.emit(`readable`),n&&r(n),this[x7])}read(e){if(this[A7])return null;if(this[z7]=!1,this[E7]===0||e===0||e&&e>this[E7])return this[p7](),null;this[k7]&&(e=null),this[w7].length>1&&!this[k7]&&(this[w7]=[this[y7]?this[w7].join(``):Buffer.concat(this[w7],this[E7])]);let t=this[RZe](e||null,this[w7][0]);return this[p7](),t}[RZe](e,t){if(this[k7])this[O7]();else{let n=t;e===n.length||e===null?this[O7]():typeof n==`string`?(this[w7][0]=n.slice(e),t=n.slice(0,e),this[E7]-=e):(this[w7][0]=n.subarray(e),t=n.subarray(0,e),this[E7]-=e)}return this.emit(`data`,t),!this[w7].length&&!this[f7]&&this.emit(`drain`),t}end(e,t,n){return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=`utf8`),e!==void 0&&this.write(e,t),n&&this.once(`end`,n),this[f7]=!0,this.writable=!1,(this[x7]||!this[S7])&&this[p7](),this}[C7](){this[A7]||(!this[R7]&&!this[T7].length&&(this[z7]=!0),this[S7]=!1,this[x7]=!0,this.emit(`resume`),this[w7].length?this[v7]():this[f7]?this[p7]():this.emit(`drain`))}resume(){return this[C7]()}pause(){this[x7]=!1,this[S7]=!0,this[z7]=!1}get destroyed(){return this[A7]}get flowing(){return this[x7]}get paused(){return this[S7]}[D7](e){this[k7]?this[E7]+=1:this[E7]+=e.length,this[w7].push(e)}[O7](){return this[k7]?--this[E7]:this[E7]-=this[w7][0].length,this[w7].shift()}[v7](e=!1){do;while(this[zZe](this[O7]())&&this[w7].length);!e&&!this[w7].length&&!this[f7]&&this.emit(`drain`)}[zZe](e){return this.emit(`data`,e),this[x7]}pipe(e,t){if(this[A7])return e;this[z7]=!1;let n=this[m7];return t||={},e===PZe.stdout||e===PZe.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[T7].push(t.proxyErrors?new KZe(this,e,t):new GZe(this,e,t)),this[P7]?B7(()=>this[C7]()):this[C7]()),e}unpipe(e){let t=this[T7].find(t=>t.dest===e);t&&(this[T7].length===1?(this[x7]&&this[R7]===0&&(this[x7]=!1),this[T7]=[]):this[T7].splice(this[T7].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e===`data`)this[z7]=!1,this[R7]++,!this[T7].length&&!this[x7]&&this[C7]();else if(e===`readable`&&this[E7]!==0)super.emit(`readable`);else if(HZe(e)&&this[m7])super.emit(e),this.removeAllListeners(e);else if(e===`error`&&this[g7]){let e=t;this[P7]?B7(()=>e.call(this,this[g7])):e.call(this,this[g7])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e===`data`&&(this[R7]=this.listeners(`data`).length,this[R7]===0&&!this[z7]&&!this[T7].length&&(this[x7]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e===`data`||e===void 0)&&(this[R7]=0,!this[z7]&&!this[T7].length&&(this[x7]=!1)),t}get emittedEnd(){return this[m7]}[p7](){!this[h7]&&!this[m7]&&!this[A7]&&this[w7].length===0&&this[f7]&&(this[h7]=!0,this.emit(`end`),this.emit(`prefinish`),this.emit(`finish`),this[_7]&&this.emit(`close`),this[h7]=!1)}emit(e,...t){let n=t[0];if(e!==`error`&&e!==`close`&&e!==A7&&this[A7])return!1;if(e===`data`)return!this[k7]&&!n?!1:this[P7]?(B7(()=>this[M7](n)),!0):this[M7](n);if(e===`end`)return this[BZe]();if(e===`close`){if(this[_7]=!0,!this[m7]&&!this[A7])return!1;let e=super.emit(`close`);return this.removeAllListeners(`close`),e}else if(e===`error`){this[g7]=n,super.emit(j7,n);let e=!this[L7]||this.listeners(`error`).length?super.emit(`error`,n):!1;return this[p7](),e}else if(e===`resume`){let e=super.emit(`resume`);return this[p7](),e}else if(e===`finish`||e===`prefinish`){let t=super.emit(e);return this.removeAllListeners(e),t}let r=super.emit(e,...t);return this[p7](),r}[M7](e){for(let t of this[T7])t.dest.write(e)===!1&&this.pause();let t=this[z7]?!1:super.emit(`data`,e);return this[p7](),t}[BZe](){return this[m7]?!1:(this[m7]=!0,this.readable=!1,this[P7]?(B7(()=>this[N7]()),!0):this[N7]())}[N7](){if(this[b7]){let e=this[b7].end();if(e){for(let t of this[T7])t.dest.write(e);this[z7]||super.emit(`data`,e)}}for(let e of this[T7])e.end();let e=super.emit(`end`);return this.removeAllListeners(`end`),e}async collect(){let e=Object.assign([],{dataLength:0});this[k7]||(e.dataLength=0);let t=this.promise();return this.on(`data`,t=>{e.push(t),this[k7]||(e.dataLength+=t.length)}),await t,e}async concat(){if(this[k7])throw Error(`cannot concat in objectMode`);let e=await this.collect();return this[y7]?e.join(``):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(A7,()=>t(Error(`stream destroyed`))),this.on(`error`,e=>t(e)),this.on(`end`,()=>e())})}[Symbol.asyncIterator](){this[z7]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[f7])return t();let r,i,a=e=>{this.off(`data`,o),this.off(`end`,s),this.off(A7,c),t(),i(e)},o=e=>{this.off(`error`,a),this.off(`end`,s),this.off(A7,c),this.pause(),r({value:e,done:!!this[f7]})},s=()=>{this.off(`error`,a),this.off(`data`,o),this.off(A7,c),t(),r({done:!0,value:void 0})},c=()=>a(Error(`stream destroyed`));return new Promise((e,t)=>{i=t,r=e,this.once(A7,c),this.once(`error`,a),this.once(`end`,s),this.once(`data`,o)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[z7]=!1;let e=!1,t=()=>(this.pause(),this.off(j7,t),this.off(A7,t),this.off(`end`,t),e=!0,{done:!0,value:void 0});return this.once(`end`,t),this.once(j7,t),this.once(A7,t),{next:()=>{if(e)return t();let n=this.read();return n===null?t():{done:!1,value:n}},throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[A7])return e?this.emit(`error`,e):this.emit(A7),this;this[A7]=!0,this[z7]=!0,this[w7].length=0,this[E7]=0;let t=this;return typeof t.close==`function`&&!this[_7]&&t.close(),e?this.emit(`error`,e):this.emit(A7),this}static get isStream(){return FZe}},H7={lstatSync:Zd,readdir:mf,readdirSync:hf,readlinkSync:_f,realpathSync:yf.native,promises:{lstat:xf,readdir:mf,readlink:gf,realpath:vf}},YZe=e=>!e||e===H7||e===Nd?H7:{...H7,...e,promises:{...H7.promises,...e.promises||{}}},XZe=/^\\\\\?\\([a-z]:)\\?$/i,ZZe=e=>e.replace(/\//g,`\\`).replace(XZe,`$1\\`),QZe=/[\\\/]/,U7=0,$Ze=1,eQe=2,W7=4,tQe=6,nQe=8,G7=10,rQe=12,K7=15,q7=~K7,J7=16,iQe=32,Y7=64,X7=128,Z7=256,Q7=512,aQe=Y7|X7|Q7,oQe=1023,$7=e=>e.isFile()?nQe:e.isDirectory()?W7:e.isSymbolicLink()?G7:e.isCharacterDevice()?eQe:e.isBlockDevice()?tQe:e.isSocket()?rQe:e.isFIFO()?$Ze:U7,sQe=new d7({max:2**12}),e9=e=>{let t=sQe.get(e);if(t)return t;let n=e.normalize(`NFKD`);return sQe.set(e,n),n},cQe=new d7({max:2**12}),t9=e=>{let t=cQe.get(e);if(t)return t;let n=e9(e.toLowerCase());return cQe.set(e,n),n},lQe=class extends d7{constructor(){super({max:256})}},uQe=class extends d7{constructor(e=16*1024){super({maxSize:e,sizeCalculation:e=>e.length+1})}},dQe=Symbol(`PathScurry setAsCwd`),n9=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#i;get uid(){return this.#i}#a;get gid(){return this.#a}#o;get rdev(){return this.#o}#s;get blksize(){return this.#s}#c;get ino(){return this.#c}#l;get size(){return this.#l}#u;get blocks(){return this.#u}#d;get atimeMs(){return this.#d}#f;get mtimeMs(){return this.#f}#p;get ctimeMs(){return this.#p}#m;get birthtimeMs(){return this.#m}#h;get atime(){return this.#h}#g;get mtime(){return this.#g}#_;get ctime(){return this.#_}#v;get birthtime(){return this.#v}#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=U7,n,r,i,a,o){this.name=e,this.#y=i?t9(e):e9(e),this.#T=t&oQe,this.nocase=i,this.roots=r,this.root=n||this,this.#E=a,this.#x=o.fullpath,this.#C=o.relative,this.#w=o.relativePosix,this.parent=o.parent,this.parent?this.#e=this.parent.#e:this.#e=YZe(o.fs)}depth(){return this.#b===void 0?this.parent?this.#b=this.parent.depth()+1:this.#b=0:this.#b}childrenCache(){return this.#E}resolve(e){if(!e)return this;let t=this.getRootString(e),n=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#k(n):this.#k(n)}#k(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#E.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#E.set(this,t),this.#T&=~J7,t}child(e,t){if(e===``||e===`.`)return this;if(e===`..`)return this.parent||this;let n=this.children(),r=this.nocase?t9(e):e9(e);for(let e of n)if(e.#y===r)return e;let i=this.parent?this.sep:``,a=this.#x?this.#x+i+e:void 0,o=this.newChild(e,U7,{...t,parent:this,fullpath:a});return this.canReaddir()||(o.#T|=X7),n.push(o),o}relative(){if(this.isCWD)return``;if(this.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.name;let n=t.relative();return n+(!n||!t.parent?``:this.sep)+e}relativePosix(){if(this.sep===`/`)return this.relative();if(this.isCWD)return``;if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?``:`/`)+e}fullpath(){if(this.#x!==void 0)return this.#x;let e=this.name,t=this.parent;return t?this.#x=t.fullpath()+(t.parent?this.sep:``)+e:this.#x=this.name}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep===`/`)return this.#S=this.fullpath();if(!this.parent){let e=this.fullpath().replace(/\\/g,`/`);return/^[a-z]:\//i.test(e)?this.#S=`//?/${e}`:this.#S=e}let e=this.parent,t=e.fullpathPosix();return this.#S=t+(!t||!e.parent?``:`/`)+this.name}isUnknown(){return(this.#T&K7)===U7}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?`Unknown`:this.isDirectory()?`Directory`:this.isFile()?`File`:this.isSymbolicLink()?`SymbolicLink`:this.isFIFO()?`FIFO`:this.isCharacterDevice()?`CharacterDevice`:this.isBlockDevice()?`BlockDevice`:this.isSocket()?`Socket`:`Unknown`}isFile(){return(this.#T&K7)===nQe}isDirectory(){return(this.#T&K7)===W7}isCharacterDevice(){return(this.#T&K7)===eQe}isBlockDevice(){return(this.#T&K7)===tQe}isFIFO(){return(this.#T&K7)===$Ze}isSocket(){return(this.#T&K7)===rQe}isSymbolicLink(){return(this.#T&G7)===G7}lstatCached(){return this.#T&iQe?this:void 0}readlinkCached(){return this.#D}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#D)return!0;if(!this.parent)return!1;let e=this.#T&K7;return!(e!==U7&&e!==G7||this.#T&Z7||this.#T&X7)}calledReaddir(){return!!(this.#T&J7)}isENOENT(){return!!(this.#T&X7)}isNamed(e){return this.nocase?this.#y===t9(e):this.#y===e9(e)}async readlink(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=await this.#e.promises.readlink(this.fullpath()),t=(await this.parent.realpath())?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}readlinkSync(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=this.#e.readlinkSync(this.fullpath()),t=this.parent.realpathSync()?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}#A(e){this.#T|=J7;for(let t=e.provisional;tt(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let r=n.slice(0,n.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#U.push(e),this.#W)return;this.#W=!0;let r=this.fullpath();this.#e.readdir(r,{withFileTypes:!0},(e,t)=>{if(e)this.#F(e.code),n.provisional=0;else{for(let e of t)this.#R(e,n);this.#A(n)}this.#G(n.slice(0,n.provisional))})}#K;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#K)await this.#K;else{let n=()=>{};this.#K=new Promise(e=>n=e);try{for(let n of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}this.#K=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#e.readdirSync(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#T&aQe)return!1;let e=K7&this.#T;return e===U7||e===W7||e===G7}shouldWalk(e,t){return(this.#T&W7)===W7&&!(this.#T&aQe)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((Q7|Z7|X7)&this.#T))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}realpathSync(){if(this.#O)return this.#O;if(!((Q7|Z7|X7)&this.#T))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}[dQe](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),n=[],r=this;for(;r&&r.parent;)t.add(r),r.#C=n.join(this.sep),r.#w=n.join(`/`),r=r.parent,n.push(`..`);for(r=e;r&&r.parent&&!t.has(r);)r.#C=void 0,r.#w=void 0,r=r.parent}},fQe=class e extends n9{sep=`\\`;splitSep=QZe;constructor(e,t=U7,n,r,i,a,o){super(e,t,n,r,i,a,o)}newChild(t,n=U7,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return cf.parse(e).root}getRoot(e){if(e=ZZe(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new r9(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,`\\`).replace(XZe,`$1\\`),e===t}},pQe=class e extends n9{splitSep=`/`;sep=`/`;constructor(e,t=U7,n,r,i,a,o){super(e,t,n,r,i,a,o)}getRootString(e){return e.startsWith(`/`)?`/`:``}getRoot(e){return this.root}newChild(t,n=U7,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}},mQe=class{root;rootPath;roots;cwd;#e;#t;#n;nocase;#r;constructor(e=process.cwd(),t,n,{nocase:r,childrenCacheSize:i=16*1024,fs:a=H7}={}){this.#r=YZe(a),(e instanceof URL||e.startsWith(`file://`))&&(e=ff(e));let o=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#e=new lQe,this.#t=new lQe,this.#n=new uQe(i);let s=o.substring(this.rootPath.length).split(n);if(s.length===1&&!s[0]&&s.pop(),r===void 0)throw TypeError(`must provide nocase setting to PathScurryBase ctor`);this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let c=this.root,l=s.length-1,u=t.sep,d=this.rootPath,f=!1;for(let e of s){let t=l--;c=c.child(e,{relative:Array(t).fill(`..`).join(u),relativePosix:Array(t).fill(`..`).join(`/`),fullpath:d+=(f?``:u)+e}),f=!0}this.cwd=c}depth(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(!(!r||r===`.`)&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#e.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpath();return this.#e.set(t,r),r}resolvePosix(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(!(!r||r===`.`)&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#t.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpathPosix();return this.#t.set(t,r),r}relative(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let t=await e.readdir();return n?t:t.map(e=>e.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(e=>e.name):[]}async lstat(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=new Set,c=(e,t)=>{s.add(e),e.readdirCB((e,l)=>{if(e)return t(e);let u=l.length;if(!u)return t();let d=()=>{--u===0&&t()};for(let e of l)(!i||i(e))&&o.push(n?e:e.fullpath()),r&&e.isSymbolicLink()?e.realpath().then(e=>e?.isUnknown()?e.lstat():e).then(e=>e?.shouldWalk(s,a)?c(e,d):d()):e.shouldWalk(s,a)?c(e,d):d()},!0)},l=e;return new Promise((e,t)=>{c(l,n=>{if(n)return t(n);e(o)})})}walkSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=new Set([e]);for(let e of s){let t=e.readdirSync();for(let e of t){(!i||i(e))&&o.push(n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&s.add(t)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t;(!i||i(e))&&(yield n?e:e.fullpath());let o=new Set([e]);for(let e of o){let t=e.readdirSync();for(let e of t){(!i||i(e))&&(yield n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(o,a)&&o.add(t)}}}stream(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new V7({objectMode:!0});(!i||i(e))&&o.write(n?e:e.fullpath());let s=new Set,c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let d=(t,p,m=!1)=>{if(t)return o.emit(`error`,t);if(r&&!m){let e=[];for(let t of p)t.isSymbolicLink()&&e.push(t.realpath().then(e=>e?.isUnknown()?e.lstat():e));if(e.length){Promise.all(e).then(()=>d(null,p,!0));return}}for(let t of p)t&&(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of p){let t=e.realpathCached()||e;t.shouldWalk(s,a)&&c.push(t)}e&&!o.flowing?o.once(`drain`,u):f||u()},f=!0;t.readdirCB(d,!0),f=!1}};return u(),o}streamSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new V7({objectMode:!0}),s=new Set;(!i||i(e))&&o.write(n?e:e.fullpath());let c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let u=t.readdirSync();for(let t of u)(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of u){let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&c.push(t)}}e&&!o.flowing&&o.once(`drain`,u)};return u(),o}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e==`string`?this.cwd.resolve(e):e,this.cwd[dQe](t)}},r9=class extends mQe{sep=`\\`;constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,cf,`\\`,{...t,nocase:n}),this.nocase=n;for(let e=this.cwd;e;e=e.parent)e.nocase=this.nocase}parseRootPath(e){return cf.parse(e).root.toUpperCase()}newRoot(e){return new fQe(this.rootPath,W7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)||e.startsWith(`\\`)||/^[a-z]:(\/|\\)/i.test(e)}},i9=class extends mQe{sep=`/`;constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,sf,`/`,{...t,nocase:n}),this.nocase=n}parseRootPath(e){return`/`}newRoot(e){return new pQe(this.rootPath,W7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)}},hQe=class extends i9{constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}};process.platform;var gQe=process.platform===`win32`?r9:process.platform===`darwin`?hQe:i9,_Qe=e=>e.length>=1,vQe=e=>e.length>=1,yQe=Symbol.for(`nodejs.util.inspect.custom`),bQe=class e{#e;#t;#n;length;#r;#i;#a;#o;#s;#c;#l=!0;constructor(e,t,n,r){if(!_Qe(e))throw TypeError(`empty pattern list`);if(!vQe(t))throw TypeError(`empty glob list`);if(t.length!==e.length)throw TypeError(`mismatched pattern list and glob list lengths`);if(this.length=e.length,n<0||n>=this.length)throw TypeError(`index out of range`);if(this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#n===0){if(this.isUNC()){let[e,t,n,r,...i]=this.#e,[a,o,s,c,...l]=this.#t;i[0]===``&&(i.shift(),l.shift());let u=[e,t,n,r,``].join(`/`),d=[a,o,s,c,``].join(`/`);this.#e=[u,...i],this.#t=[d,...l],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[e,...t]=this.#e,[n,...r]=this.#t;t[0]===``&&(t.shift(),r.shift());let i=e+`/`,a=n+`/`;this.#e=[i,...t],this.#t=[a,...r],this.length=this.#e.length}}}[yQe](){return`Pattern <`+this.#t.slice(this.#n).join(`/`)+`>`}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]==`string`}isGlobstar(){return this.#e[this.#n]===i7}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#a=this.#a||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join(`/`):this.#t.join(`/`):this.#t.slice(this.#n).join(`/`))}hasMore(){return this.length>this.#n+1}rest(){return this.#i===void 0?this.hasMore()?(this.#i=new e(this.#e,this.#t,this.#n+1,this.#r),this.#i.#c=this.#c,this.#i.#s=this.#s,this.#i.#o=this.#o,this.#i):this.#i=null:this.#i}isUNC(){let e=this.#e;return this.#s===void 0?this.#s=this.#r===`win32`&&this.#n===0&&e[0]===``&&e[1]===``&&typeof e[2]==`string`&&!!e[2]&&typeof e[3]==`string`&&!!e[3]:this.#s}isDrive(){let e=this.#e;return this.#o===void 0?this.#o=this.#r===`win32`&&this.#n===0&&this.length>1&&typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]):this.#o}isAbsolute(){let e=this.#e;return this.#c===void 0?this.#c=e[0]===``&&e.length>1||this.isDrive()||this.isUNC():this.#c}root(){let e=this.#e[0];return typeof e==`string`&&this.isAbsolute()&&this.#n===0?e:``}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}},xQe=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`,SQe=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:r,noglobstar:i,platform:a=xQe}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:r,noglobstar:i,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let t of e)this.add(t)}add(e){let t=new o7(e,this.mmopts);for(let e=0;e[e,!!(t&2),!!(t&1)])}},TQe=class{store=new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(e=>e.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw Error(`attempting to walk unknown path`);return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},EQe=class e{hasWalkedCache;matches=new wQe;subwalks=new TQe;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new CQe}processPatterns(e,t){this.patterns=t;let n=t.map(t=>[e,t]);for(let[e,t]of n){this.hasWalkedCache.storeWalked(e,t);let n=t.root(),r=t.isAbsolute()&&this.opts.absolute!==!1;if(n){e=e.resolve(n===`/`&&this.opts.root!==void 0?this.opts.root:n);let r=t.rest();if(r)t=r;else{this.matches.add(e,!0,!1);continue}}if(e.isENOENT())continue;let i,a,o=!1;for(;typeof(i=t.pattern())==`string`&&(a=t.rest());)e=e.resolve(i),t=a,o=!0;if(i=t.pattern(),a=t.rest(),o){if(this.hasWalkedCache.hasWalked(e,t))continue;this.hasWalkedCache.storeWalked(e,t)}if(typeof i==`string`){let t=i===`..`||i===``||i===`.`;this.matches.add(e.resolve(i),r,t);continue}else if(i===i7){(!e.isSymbolicLink()||this.follow||t.checkFollowGlobstar())&&this.subwalks.add(e,t);let n=a?.pattern(),i=a?.rest();if(!a||(n===``||n===`.`)&&!i)this.matches.add(e,r,n===``||n===`.`);else if(n===`..`){let t=e.parent||e;i?this.hasWalkedCache.hasWalked(t,i)||this.subwalks.add(t,i):this.matches.add(t,r,!0)}}else i instanceof RegExp&&this.subwalks.add(e,t)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),r=this.child();for(let e of t)for(let t of n){let n=t.isAbsolute(),i=t.pattern(),a=t.rest();i===i7?r.testGlobstar(e,t,a,n):i instanceof RegExp?r.testRegExp(e,i,a,n):r.testString(e,i,a,n)}return r}testGlobstar(e,t,n,r){if((this.dot||!e.name.startsWith(`.`))&&(t.hasMore()||this.matches.add(e,r,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let t=n.pattern();if(typeof t==`string`&&t!==`..`&&t!==``&&t!==`.`)this.testString(e,t,n.rest(),r);else if(t===`..`){let t=e.parent||e;this.subwalks.add(t,n)}else t instanceof RegExp&&this.testRegExp(e,t,n.rest(),r)}}testRegExp(e,t,n,r){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}testString(e,t,n,r){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}},DQe=(e,t)=>typeof e==`string`?new SQe([e],t):Array.isArray(e)?new SQe(e,t):e,OQe=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#t;#n;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#n=!n.posix&&n.platform===`win32`?`\\`:`/`,this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#t=DQe(n.ignore??[],n),!this.includeChildMatches&&typeof this.#t.add!=`function`))throw Error(`cannot ignore child matches, ignore lacks add() method.`);this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener(`abort`,()=>{this.#e.length=0}))}#r(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#i(e){return!!this.#t?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=await r.realpath();e&&(e.isUnknown()||this.opts.stat)&&await e.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#r(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=r.realpathSync();e&&(e?.isUnknown()||this.opts.stat)&&e.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#r(e))return;if(!this.includeChildMatches&&this.#t?.add){let t=`${e.relativePosix()}/**`;this.#t.add(t)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let r=this.opts.mark&&e.isDirectory()?this.#n:``;if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let t=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(t+r)}else{let t=this.opts.posix?e.relativePosix():e.relative(),n=this.opts.dotRelative&&!t.startsWith(`..`+this.#n)?`.`+this.#n:``;this.matchEmit(t?n+t+r:`.`+r)}}async match(e,t,n){let r=await this.matchCheck(e,n);r&&this.matchFinish(r,t)}matchSync(e,t,n){let r=this.matchCheckSync(e,n);r&&this.matchFinish(r,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new EQe(this.opts),n)}walkCB2(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirCached();e.calledReaddir()?this.walkCB3(e,t,n,a):e.readdirCB((t,r)=>this.walkCB3(e,r,n,a),!0)}a()}walkCB3(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let[e,t]of n.subwalks.entries())i++,this.walkCB2(e,t,n.child(),a);a()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new EQe(this.opts),n)}walkCB2Sync(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirSync();this.walkCB3Sync(e,t,n,a)}a()}walkCB3Sync(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let[e,t]of n.subwalks.entries())i++,this.walkCB2Sync(e,t,n.child(),a);a()}},kQe=class extends OQe{matches=new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},AQe=class extends OQe{results;constructor(e,t,n){super(e,t,n),this.results=new V7({signal:this.signal,objectMode:!0}),this.results.on(`drain`,()=>this.resume()),this.results.on(`resume`,()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},jQe=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`,a9=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw TypeError(`glob options required`);if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith(`file://`))&&(t.cwd=ff(t.cwd)):this.cwd=``,this.cwd=t.cwd||``,this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth==`number`?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error(`cannot set absolute and withFileTypes:true`);if(typeof e==`string`&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(e=>e.replace(/\\/g,`/`))),this.matchBase){if(t.noglobstar)throw TypeError(`base matching requires globstar`);e=e.map(e=>e.includes(`/`)?e:`./**/${e}`)}if(this.pattern=e,this.platform=t.platform||jQe,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw Error(`nocase option contradicts provided scurry option`)}else this.scurry=new(t.platform===`win32`?r9:t.platform===`darwin`?hQe:t.platform?i9:gQe)(this.cwd,{nocase:t.nocase,fs:t.fs});this.nocase=this.scurry.nocase;let n=this.platform===`darwin`||this.platform===`win32`,r={braceExpandMax:1e4,...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[i,a]=this.pattern.map(e=>new o7(e,r)).reduce((e,t)=>(e[0].push(...t.set),e[1].push(...t.globParts),e),[[],[]]);this.patterns=i.map((e,t)=>{let n=a[t];if(!n)throw Error(`invalid pattern object`);return new bQe(e,n,0,this.platform)})}async walk(){return[...await new kQe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new kQe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new AQe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new AQe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}},MQe=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let n of e)if(new o7(n,t).hasMagic())return!0;return!1};function o9(e,t={}){return new a9(e,t).streamSync()}function NQe(e,t={}){return new a9(e,t).stream()}function PQe(e,t={}){return new a9(e,t).walkSync()}async function FQe(e,t={}){return new a9(e,t).walk()}function s9(e,t={}){return new a9(e,t).iterateSync()}function IQe(e,t={}){return new a9(e,t).iterate()}var LQe=o9,RQe=Object.assign(NQe,{sync:o9}),zQe=s9,BQe=Object.assign(IQe,{sync:s9}),VQe=Object.assign(PQe,{stream:o9,iterate:s9}),c9=Object.assign(FQe,{glob:FQe,globSync:PQe,sync:VQe,globStream:NQe,stream:RQe,globStreamSync:o9,streamSync:LQe,globIterate:IQe,iterate:BQe,globIterateSync:s9,iterateSync:zQe,Glob:a9,hasMagic:MQe,escape:QXe,unescape:e7});c9.glob=c9;var HQe=Object.defineProperty,UQe=(e,t)=>{for(var n in t)HQe(e,n,{get:t[n],enumerable:!0})},WQe=class{serialize(e,t){let{prettify:n=!0,indent:r=2,sortKeys:i=!1}=t||{};if(i){let t=this.sortObjectKeys(e);return n?JSON.stringify(t,null,r):JSON.stringify(t)}return n?JSON.stringify(e,null,r):JSON.stringify(e)}deserialize(e,t){let n=JSON.parse(e);return t?t.parse(n):n}getExtension(){return`.json`}canHandle(e){return e===`json`}getFormat(){return`json`}sortObjectKeys(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>this.sortObjectKeys(e));let t={},n=Object.keys(e).sort();for(let r of n)t[r]=this.sortObjectKeys(e[r]);return t}},GQe=class{serialize(e,t){let{indent:n=2,sortKeys:r=!1}=t||{};return uXe(e,{indent:n,sortKeys:r,lineWidth:-1,noRefs:!0})}deserialize(e,t){let n=lXe(e,{schema:cXe});return t?t.parse(n):n}getExtension(){return`.yaml`}canHandle(e){return e===`yaml`}getFormat(){return`yaml`}},KQe=class{constructor(e=`typescript`){this.format=e}serialize(e,t){let{prettify:n=!0,indent:r=2}=t||{},i=JSON.stringify(e,null,n?r:0);return this.format===`typescript`?`import type { ServiceObject } from '@objectstack/spec/data'; + +export const metadata: ServiceObject = ${i}; + +export default metadata; +`:`export const metadata = ${i}; + +export default metadata; +`}deserialize(e,t){let n=e.indexOf(`export const`);if(n===-1&&(n=e.indexOf(`export default`)),n===-1)throw Error(`Could not parse TypeScript/JavaScript module. Expected export pattern: "export const metadata = {...};" or "export default {...};"`);let r=e.indexOf(`{`,n);if(r===-1)throw Error(`Could not find object literal in export statement`);let i=0,a=-1,o=!1,s=``;for(let t=r;t0?e[t-1]:``;if((n===`"`||n===`'`)&&r!==`\\`&&(o?n===s&&(o=!1,s=``):(o=!0,s=n)),!o&&(n===`{`&&i++,n===`}`&&(i--,i===0))){a=t;break}}if(a===-1)throw Error(`Could not find matching closing brace for object literal`);let c=e.substring(r,a+1);try{let e=JSON.parse(c);return t?t.parse(e):e}catch(e){throw Error(`Failed to parse object literal as JSON: ${e instanceof Error?e.message:String(e)}. Make sure the TypeScript/JavaScript object uses JSON-compatible syntax (no functions, comments, or trailing commas).`)}}getExtension(){return this.format===`typescript`?`.ts`:`.js`}canHandle(e){return e===`typescript`||e===`javascript`}getFormat(){return this.format}},qQe=O.create({namespace:`sys`,name:`metadata`,label:`System Metadata`,pluralLabel:`System Metadata`,icon:`settings`,isSystem:!0,description:`Stores platform and user-scope metadata records (objects, views, flows, etc.)`,fields:{id:j.text({label:`ID`,required:!0,readonly:!0}),name:j.text({label:`Name`,required:!0,searchable:!0,maxLength:255}),type:j.text({label:`Metadata Type`,required:!0,searchable:!0,maxLength:100}),namespace:j.text({label:`Namespace`,required:!1,defaultValue:`default`,maxLength:100}),package_id:j.text({label:`Package ID`,required:!1,maxLength:255}),managed_by:j.select([`package`,`platform`,`user`],{label:`Managed By`,required:!1}),scope:j.select([`system`,`platform`,`user`],{label:`Scope`,required:!0,defaultValue:`platform`}),metadata:j.textarea({label:`Metadata`,required:!0,description:`JSON-serialized metadata payload`}),extends:j.text({label:`Extends`,required:!1,maxLength:255}),strategy:j.select([`merge`,`replace`],{label:`Strategy`,required:!1,defaultValue:`merge`}),owner:j.text({label:`Owner`,required:!1,maxLength:255}),state:j.select([`draft`,`active`,`archived`,`deprecated`],{label:`State`,required:!1,defaultValue:`active`}),tenant_id:j.text({label:`Tenant ID`,required:!1,maxLength:255}),version:j.number({label:`Version`,required:!1,defaultValue:1}),checksum:j.text({label:`Checksum`,required:!1,maxLength:64}),source:j.select([`filesystem`,`database`,`api`,`migration`],{label:`Source`,required:!1}),tags:j.textarea({label:`Tags`,required:!1,description:`JSON-serialized array of classification tags`}),created_by:j.text({label:`Created By`,required:!1,readonly:!0,maxLength:255}),created_at:j.datetime({label:`Created At`,required:!1,readonly:!0}),updated_by:j.text({label:`Updated By`,required:!1,maxLength:255}),updated_at:j.datetime({label:`Updated At`,required:!1})},indexes:[{fields:[`type`,`name`],unique:!0},{fields:[`type`,`scope`]},{fields:[`tenant_id`]},{fields:[`state`]},{fields:[`namespace`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1}}),JQe=O.create({namespace:`sys`,name:`metadata_history`,label:`Metadata History`,pluralLabel:`Metadata History`,icon:`history`,isSystem:!0,description:`Version history and audit trail for metadata changes`,fields:{id:j.text({label:`ID`,required:!0,readonly:!0}),metadata_id:j.text({label:`Metadata ID`,required:!0,readonly:!0,maxLength:255}),name:j.text({label:`Name`,required:!0,searchable:!0,readonly:!0,maxLength:255}),type:j.text({label:`Metadata Type`,required:!0,searchable:!0,readonly:!0,maxLength:100}),version:j.number({label:`Version`,required:!0,readonly:!0}),operation_type:j.select([`create`,`update`,`publish`,`revert`,`delete`],{label:`Operation Type`,required:!0,readonly:!0}),metadata:j.textarea({label:`Metadata`,required:!0,readonly:!0,description:`JSON-serialized metadata snapshot at this version`}),checksum:j.text({label:`Checksum`,required:!0,readonly:!0,maxLength:64}),previous_checksum:j.text({label:`Previous Checksum`,required:!1,readonly:!0,maxLength:64}),change_note:j.textarea({label:`Change Note`,required:!1,readonly:!0,description:`Description of what changed in this version`}),tenant_id:j.text({label:`Tenant ID`,required:!1,readonly:!0,maxLength:255}),recorded_by:j.text({label:`Recorded By`,required:!1,readonly:!0,maxLength:255}),recorded_at:j.datetime({label:`Recorded At`,required:!0,readonly:!0})},indexes:[{fields:[`metadata_id`,`version`],unique:!0},{fields:[`metadata_id`,`recorded_at`]},{fields:[`type`,`name`]},{fields:[`recorded_at`]},{fields:[`operation_type`]},{fields:[`tenant_id`]}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`],trash:!1}});async function l9(e){let t=u9(e),n=JSON.stringify(t);if(globalThis.crypto!==void 0&&globalThis.crypto.subtle){let e=new TextEncoder().encode(n),t=await globalThis.crypto.subtle.digest(`SHA-256`,e);return Array.from(new Uint8Array(t)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}return YQe(n)}function u9(e){if(e==null)return e;if(Array.isArray(e))return e.map(u9);if(typeof e==`object`){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=u9(e[r]);return t}return e}function YQe(e){let t=5381;for(let n=0;ne.op===`add`).length,r=e.filter(e=>e.op===`remove`).length,i=e.filter(e=>e.op===`replace`).length;return n>0&&t.push(`${n} field${n>1?`s`:``} added`),r>0&&t.push(`${r} field${r>1?`s`:``} removed`),i>0&&t.push(`${i} field${i>1?`s`:``} modified`),t.join(`, `)}var ZQe=class{constructor(e){this.contract={name:`database`,protocol:`datasource:`,capabilities:{read:!0,write:!0,watch:!1,list:!0}},this.schemaReady=!1,this.historySchemaReady=!1,this.driver=e.driver,this.tableName=e.tableName??`sys_metadata`,this.historyTableName=e.historyTableName??`sys_metadata_history`,this.tenantId=e.tenantId,this.trackHistory=e.trackHistory!==!1}async ensureSchema(){if(!this.schemaReady)try{await this.driver.syncSchema(this.tableName,{...qQe,name:this.tableName}),this.schemaReady=!0}catch{this.schemaReady=!0}}async ensureHistorySchema(){if(!(!this.trackHistory||this.historySchemaReady))try{await this.driver.syncSchema(this.historyTableName,{...JQe,name:this.historyTableName}),this.historySchemaReady=!0}catch(e){console.error(`Failed to ensure history schema, will retry on next operation:`,e)}}baseFilter(e,t){let n={type:e};return t!==void 0&&(n.name=t),this.tenantId&&(n.tenant_id=this.tenantId),n}async createHistoryRecord(e,t,n,r,i,a,o,s,c){if(!this.trackHistory)return;await this.ensureHistorySchema();let l=new Date().toISOString(),u=await l9(i);if(o&&u===o&&a===`update`)return;let d={id:QQe(),metadataId:e,name:n,type:t,version:r,operationType:a,metadata:JSON.stringify(i),checksum:u,previousChecksum:o,changeNote:s,recordedBy:c,recordedAt:l,...this.tenantId?{tenantId:this.tenantId}:{}};try{await this.driver.create(this.historyTableName,{id:d.id,metadata_id:d.metadataId,name:d.name,type:d.type,version:d.version,operation_type:d.operationType,metadata:d.metadata,checksum:d.checksum,previous_checksum:d.previousChecksum,change_note:d.changeNote,recorded_by:d.recordedBy,recorded_at:d.recordedAt,...this.tenantId?{tenant_id:this.tenantId}:{}})}catch(e){console.error(`Failed to create history record for ${t}/${n}:`,e)}}rowToData(e){return!e||!e.metadata?null:typeof e.metadata==`string`?JSON.parse(e.metadata):e.metadata}rowToRecord(e){return{id:e.id,name:e.name,type:e.type,namespace:e.namespace??`default`,packageId:e.package_id,managedBy:e.managed_by,scope:e.scope??`platform`,metadata:this.rowToData(e)??{},extends:e.extends,strategy:e.strategy??`merge`,owner:e.owner,state:e.state??`active`,tenantId:e.tenant_id,version:e.version??1,checksum:e.checksum,source:e.source,tags:e.tags?typeof e.tags==`string`?JSON.parse(e.tags):e.tags:void 0,createdBy:e.created_by,createdAt:e.created_at,updatedBy:e.updated_by,updatedAt:e.updated_at}}async load(e,t,n){let r=Date.now();await this.ensureSchema();try{let n=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});return n?{data:this.rowToData(n),source:`database`,format:`json`,etag:this.rowToRecord(n).checksum,loadTime:Date.now()-r}:{data:null,loadTime:Date.now()-r}}catch{return{data:null,loadTime:Date.now()-r}}}async loadMany(e,t){await this.ensureSchema();try{return(await this.driver.find(this.tableName,{object:this.tableName,where:this.baseFilter(e)})).map(e=>this.rowToData(e)).filter(e=>e!==null)}catch{return[]}}async exists(e,t){await this.ensureSchema();try{return await this.driver.count(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)})>0}catch{return!1}}async stat(e,t){await this.ensureSchema();try{let n=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});if(!n)return null;let r=this.rowToRecord(n);return{size:(typeof n.metadata==`string`?n.metadata:JSON.stringify(n.metadata)).length,mtime:r.updatedAt??r.createdAt??new Date().toISOString(),format:`json`,etag:r.checksum}}catch{return null}}async list(e){await this.ensureSchema();try{return(await this.driver.find(this.tableName,{object:this.tableName,where:this.baseFilter(e),fields:[`name`]})).map(e=>e.name).filter(e=>typeof e==`string`)}catch{return[]}}async getHistoryRecord(e,t,n){if(!this.trackHistory)return null;await this.ensureHistorySchema();let r=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});if(!r)return null;let i={metadata_id:r.id,version:n};this.tenantId&&(i.tenant_id=this.tenantId);let a=await this.driver.findOne(this.historyTableName,{object:this.historyTableName,where:i});return a?{id:a.id,metadataId:a.metadata_id,name:a.name,type:a.type,version:a.version,operationType:a.operation_type,metadata:typeof a.metadata==`string`?JSON.parse(a.metadata):a.metadata,checksum:a.checksum,previousChecksum:a.previous_checksum,changeNote:a.change_note,tenantId:a.tenant_id,recordedBy:a.recorded_by,recordedAt:a.recorded_at}:null}async registerRollback(e,t,n,r,i,a){await this.ensureSchema();let o=new Date().toISOString(),s=JSON.stringify(n),c=await l9(n),l=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});if(!l)throw Error(`Metadata ${e}/${t} not found for rollback`);let u=l.checksum,d=(l.version??0)+1;await this.driver.update(this.tableName,l.id,{metadata:s,version:d,checksum:c,updated_at:o,state:`active`}),await this.createHistoryRecord(l.id,e,t,d,n,`revert`,u,i??`Rolled back to version ${r}`,a)}async save(e,t,n,r){let i=Date.now();await this.ensureSchema();let a=new Date().toISOString(),o=JSON.stringify(n),s=await l9(n);try{let r=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});if(r){let c=r.checksum;if(s===c)return{success:!0,path:`datasource://${this.tableName}/${e}/${t}`,size:o.length,saveTime:Date.now()-i};let l=(r.version??0)+1;return await this.driver.update(this.tableName,r.id,{metadata:o,version:l,checksum:s,updated_at:a,state:`active`}),await this.createHistoryRecord(r.id,e,t,l,n,`update`,c),{success:!0,path:`datasource://${this.tableName}/${e}/${t}`,size:o.length,saveTime:Date.now()-i}}else{let r=QQe();return await this.driver.create(this.tableName,{id:r,name:t,type:e,namespace:`default`,scope:n?.scope??`platform`,metadata:o,checksum:s,strategy:`merge`,state:`active`,version:1,source:`database`,...this.tenantId?{tenant_id:this.tenantId}:{},created_at:a,updated_at:a}),await this.createHistoryRecord(r,e,t,1,n,`create`),{success:!0,path:`datasource://${this.tableName}/${e}/${t}`,size:o.length,saveTime:Date.now()-i}}}catch(n){throw Error(`DatabaseLoader save failed for ${e}/${t}: ${n instanceof Error?n.message:String(n)}`)}}async delete(e,t){await this.ensureSchema();let n=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});n&&await this.driver.delete(this.tableName,n.id)}};function QQe(){return globalThis.crypto!==void 0&&typeof globalThis.crypto.randomUUID==`function`?globalThis.crypto.randomUUID():`meta_${Date.now()}_${Math.random().toString(36).substring(2,10)}`}var $Qe=class{constructor(e){this.loaders=new Map,this.watchCallbacks=new Map,this.registry=new Map,this.overlays=new Map,this.typeRegistry=[],this.dependencies=new Map,this.config=e,this.logger=$f({level:`info`,format:`pretty`}),this.serializers=new Map;let t=e.formats||[`typescript`,`json`,`yaml`];t.includes(`json`)&&this.serializers.set(`json`,new WQe),t.includes(`yaml`)&&this.serializers.set(`yaml`,new GQe),t.includes(`typescript`)&&this.serializers.set(`typescript`,new KQe(`typescript`)),t.includes(`javascript`)&&this.serializers.set(`javascript`,new KQe(`javascript`)),e.loaders&&e.loaders.length>0&&e.loaders.forEach(e=>this.registerLoader(e)),e.datasource&&e.driver&&this.setDatabaseDriver(e.driver)}setTypeRegistry(e){this.typeRegistry=e}setDatabaseDriver(e){let t=this.config.tableName??`sys_metadata`,n=new ZQe({driver:e,tableName:t});this.registerLoader(n),this.logger.info(`DatabaseLoader configured`,{datasource:this.config.datasource,tableName:t})}setRealtimeService(e){this.realtimeService=e,this.logger.info(`RealtimeService configured for metadata events`)}registerLoader(e){this.loaders.set(e.contract.name,e),this.logger.info(`Registered metadata loader: ${e.contract.name} (${e.contract.protocol})`)}async register(e,t,n){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,n);for(let r of this.loaders.values())r.save&&r.contract.protocol===`datasource:`&&r.contract.capabilities.write&&await r.save(e,t,n);if(this.realtimeService){let r={type:`metadata.${e}.created`,object:e,payload:{metadataType:e,name:t,definition:n,packageId:n?.packageId},timestamp:new Date().toISOString()};try{await this.realtimeService.publish(r),this.logger.debug(`Published metadata.${e}.created event`,{name:t})}catch(n){this.logger.warn(`Failed to publish metadata event`,{type:e,name:t,error:n})}}}async get(e,t){let n=this.registry.get(e);return n?.has(t)?n.get(t):await this.load(e,t)??void 0}async list(e){let t=new Map,n=this.registry.get(e);if(n)for(let[e,r]of n)t.set(e,r);for(let n of this.loaders.values())try{let r=await n.loadMany(e);for(let e of r){let n=e;n&&typeof n.name==`string`&&!t.has(n.name)&&t.set(n.name,e)}}catch(t){this.logger.warn(`Loader ${n.contract.name} failed to loadMany ${e}`,{error:t})}return Array.from(t.values())}async unregister(e,t){let n=this.registry.get(e);n&&(n.delete(t),n.size===0&&this.registry.delete(e));for(let n of this.loaders.values())if(!(n.contract.protocol!==`datasource:`||!n.contract.capabilities.write)&&typeof n.delete==`function`)try{await n.delete(e,t)}catch(r){this.logger.warn(`Failed to delete ${e}/${t} from loader ${n.contract.name}`,{error:r})}if(this.realtimeService){let n={type:`metadata.${e}.deleted`,object:e,payload:{metadataType:e,name:t},timestamp:new Date().toISOString()};try{await this.realtimeService.publish(n),this.logger.debug(`Published metadata.${e}.deleted event`,{name:t})}catch(n){this.logger.warn(`Failed to publish metadata event`,{type:e,name:t,error:n})}}}async exists(e,t){if(this.registry.get(e)?.has(t))return!0;for(let n of this.loaders.values())if(await n.exists(e,t))return!0;return!1}async listNames(e){let t=new Set,n=this.registry.get(e);if(n)for(let e of n.keys())t.add(e);for(let n of this.loaders.values())(await n.list(e)).forEach(e=>t.add(e));return Array.from(t)}async getObject(e){return this.get(`object`,e)}async listObjects(){return this.list(`object`)}async getView(e){return this.get(`view`,e)}async listViews(e){let t=await this.list(`view`);return e?t.filter(t=>t?.object===e):t}async getDashboard(e){return this.get(`dashboard`,e)}async listDashboards(){return this.list(`dashboard`)}async unregisterPackage(e){let t=[];for(let[n,r]of this.registry)for(let[i,a]of r){let r=a;(r?.packageId===e||r?.package===e)&&t.push({type:n,name:i})}for(let{type:e,name:n}of t)await this.unregister(e,n)}async publishPackage(e,t){let n=new Date().toISOString(),r=t?.validate!==!1,i=t?.publishedBy,a=[];for(let[t,n]of this.registry)for(let[r,i]of n){let n=i;(n?.packageId===e||n?.package===e)&&a.push({type:t,name:r,data:n})}if(a.length===0)return{success:!1,packageId:e,version:0,publishedAt:n,itemsPublished:0,validationErrors:[{type:``,name:``,message:`No metadata items found for package '${e}'`}]};if(r){let t=[];for(let e of a){let n=await this.validate(e.type,e.data);if(!n.valid&&n.errors)for(let r of n.errors)t.push({type:e.type,name:e.name,message:r.message})}let r=new Set(a.map(e=>`${e.type}:${e.name}`));for(let e of a){let n=await this.getDependencies(e.type,e.name);for(let i of n){let n=`${i.targetType}:${i.targetName}`;if(r.has(n))continue;let a=await this.get(i.targetType,i.targetName);if(!a)t.push({type:e.type,name:e.name,message:`Dependency '${i.targetType}:${i.targetName}' not found`});else{let n=a;n.publishedDefinition===void 0&&n.state!==`active`&&t.push({type:e.type,name:e.name,message:`Dependency '${i.targetType}:${i.targetName}' is not published`})}}}if(t.length>0)return{success:!1,packageId:e,version:0,publishedAt:n,itemsPublished:0,validationErrors:t}}let o=0;for(let e of a){let t=typeof e.data.version==`number`?e.data.version:0;t>o&&(o=t)}let s=o+1;for(let e of a){let t={...e.data,publishedDefinition:structuredClone(e.data.metadata??e.data),publishedAt:n,publishedBy:i??e.data.publishedBy,version:s,state:`active`};await this.register(e.type,e.name,t)}return{success:!0,packageId:e,version:s,publishedAt:n,itemsPublished:a.length}}async revertPackage(e){let t=[];for(let[n,r]of this.registry)for(let[i,a]of r){let r=a;(r?.packageId===e||r?.package===e)&&t.push({type:n,name:i,data:r})}if(t.length===0)throw Error(`No metadata items found for package '${e}'`);if(!t.some(e=>e.data.publishedDefinition!==void 0))throw Error(`Package '${e}' has never been published`);for(let e of t)if(e.data.publishedDefinition!==void 0){let t={...e.data,metadata:structuredClone(e.data.publishedDefinition),state:`active`};await this.register(e.type,e.name,t)}}async getPublished(e,t){let n=await this.get(e,t);if(!n)return;let r=n;return r.publishedDefinition===void 0?r.metadata??n:r.publishedDefinition}async query(e){let{types:t,search:n,page:r=1,pageSize:i=50,sortBy:a=`name`,sortOrder:o=`asc`}=e,s=[],c=t&&t.length>0?t:Array.from(this.registry.keys());for(let e of c){let t=await this.list(e);for(let n of t){let t=n;s.push({type:e,name:t?.name??``,namespace:t?.namespace,label:t?.label,scope:t?.scope,state:t?.state,packageId:t?.packageId,updatedAt:t?.updatedAt})}}let l=s;if(n){let e=n.toLowerCase();l=l.filter(t=>t.name.toLowerCase().includes(e)||t.label&&t.label.toLowerCase().includes(e))}e.scope&&(l=l.filter(t=>t.scope===e.scope)),e.state&&(l=l.filter(t=>t.state===e.state)),e.namespaces&&e.namespaces.length>0&&(l=l.filter(t=>t.namespace&&e.namespaces.includes(t.namespace))),e.packageId&&(l=l.filter(t=>t.packageId===e.packageId)),e.tags&&e.tags.length>0&&(l=l.filter(t=>{let n=t;return n?.tags&&e.tags.some(e=>n.tags.includes(e))})),l.sort((e,t)=>{let n=e[a]??``,r=t[a]??``,i=String(n).localeCompare(String(r));return o===`desc`?-i:i});let u=l.length,d=(r-1)*i;return{items:l.slice(d,d+i),total:u,page:r,pageSize:i}}async bulkRegister(e,t){let{continueOnError:n=!1}=t??{},r=0,i=0,a=[];for(let t of e)try{await this.register(t.type,t.name,t.data),r++}catch(e){if(i++,a.push({type:t.type,name:t.name,error:e instanceof Error?e.message:String(e)}),!n)break}return{total:e.length,succeeded:r,failed:i,errors:a.length>0?a:void 0}}async bulkUnregister(e){let t=0,n=0,r=[];for(let i of e)try{await this.unregister(i.type,i.name),t++}catch(e){n++,r.push({type:i.type,name:i.name,error:e instanceof Error?e.message:String(e)})}return{total:e.length,succeeded:t,failed:n,errors:r.length>0?r:void 0}}overlayKey(e,t,n=`platform`){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}:${n}`}async getOverlay(e,t,n){return this.overlays.get(this.overlayKey(e,t,n??`platform`))}async saveOverlay(e){let t=this.overlayKey(e.baseType,e.baseName,e.scope);this.overlays.set(t,e)}async removeOverlay(e,t,n){this.overlays.delete(this.overlayKey(e,t,n??`platform`))}async getEffective(e,t,n){let r=await this.get(e,t);if(!r)return;let i={...r},a=await this.getOverlay(e,t,`platform`);if(a?.active&&a.patch&&(i={...i,...a.patch}),n?.userId){let r=this.overlayKey(e,t,`user`)+`:${n.userId}`,a=this.overlays.get(r)??await this.getOverlay(e,t,`user`);a?.active&&a.patch&&(!a.owner||a.owner===n.userId)&&(i={...i,...a.patch})}else{let n=await this.getOverlay(e,t,`user`);n?.active&&n.patch&&!n.owner&&(i={...i,...n.patch})}return i}watchService(e,t){let n=n=>{t({type:n.type===`added`?`registered`:n.type===`deleted`?`unregistered`:`updated`,metadataType:n.metadataType??e,name:n.name??``,data:n.data})};return this.addWatchCallback(e,n),{unsubscribe:()=>this.removeWatchCallback(e,n)}}async exportMetadata(e){let t={},n=e?.types??Array.from(this.registry.keys());for(let e of n){let n=await this.list(e);n.length>0&&(t[e]=n)}return t}async importMetadata(e,t){let{conflictResolution:n=`skip`,validate:r=!0,dryRun:i=!1}=t??{},a=e,o=0,s=0,c=0,l=0,u=[];for(let[e,t]of Object.entries(a))if(Array.isArray(t))for(let r of t){o++;let t=r?.name;if(!t){l++,u.push({type:e,name:`(unknown)`,error:`Item missing name field`});continue}try{let a=await this.exists(e,t);if(a&&n===`skip`){c++;continue}if(!i)if(a&&n===`merge`){let n={...await this.get(e,t),...r};await this.register(e,t,n)}else await this.register(e,t,r);s++}catch(n){l++,u.push({type:e,name:t,error:n instanceof Error?n.message:String(n)})}}return{total:o,imported:s,skipped:c,failed:l,errors:u.length>0?u:void 0}}async validate(e,t){if(t==null)return{valid:!1,errors:[{path:``,message:`Metadata data cannot be null or undefined`}]};if(typeof t!=`object`)return{valid:!1,errors:[{path:``,message:`Metadata data must be an object`}]};let n=t,r=[];return n.name?(n.label||r.push({path:`label`,message:`Missing label field (recommended)`}),{valid:!0,warnings:r.length>0?r:void 0}):{valid:!1,errors:[{path:`name`,message:`Metadata item must have a name field`}]}}async getRegisteredTypes(){let e=new Set;for(let t of this.typeRegistry)e.add(t.type);for(let t of this.registry.keys())e.add(t);return Array.from(e)}async getTypeInfo(e){let t=this.typeRegistry.find(t=>t.type===e);if(t)return{type:t.type,label:t.label,description:t.description,filePatterns:t.filePatterns,supportsOverlay:t.supportsOverlay,domain:t.domain}}async getDependencies(e,t){return this.dependencies.get(`${encodeURIComponent(e)}:${encodeURIComponent(t)}`)??[]}async getDependents(e,t){let n=[];for(let r of this.dependencies.values())for(let i of r)i.targetType===e&&i.targetName===t&&n.push(i);return n}addDependency(e){let t=`${encodeURIComponent(e.sourceType)}:${encodeURIComponent(e.sourceName)}`;this.dependencies.has(t)||this.dependencies.set(t,[]);let n=this.dependencies.get(t);n.some(t=>t.targetType===e.targetType&&t.targetName===e.targetName&&t.kind===e.kind)||n.push(e)}async load(e,t,n){for(let r of this.loaders.values())try{let i=await r.load(e,t,n);if(i.data)return i.data}catch(n){this.logger.warn(`Loader ${r.contract.name} failed to load ${e}:${t}`,{error:n})}return null}async loadMany(e,t){let n=[];for(let r of this.loaders.values())try{let i=await r.loadMany(e,t);for(let e of i){let t=e;t&&typeof t.name==`string`&&n.some(e=>e&&e.name===t.name)||n.push(e)}}catch(t){this.logger.warn(`Loader ${r.contract.name} failed to loadMany ${e}`,{error:t})}return n}async save(e,t,n,r){let i=r?.loader,a;if(i){if(a=this.loaders.get(i),!a)throw Error(`Loader not found: ${i}`)}else{for(let n of this.loaders.values())if(n.save)try{if(await n.exists(e,t)){a=n,this.logger.info(`Updating existing metadata in loader: ${n.contract.name}`);break}}catch{}if(!a){let e=this.loaders.get(`filesystem`);e&&e.save&&(a=e)}if(!a){for(let e of this.loaders.values())if(e.save){a=e;break}}}if(!a)throw Error(`No loader available for saving type: ${e}`);if(!a.save)throw Error(`Loader '${a.contract?.name}' does not support saving`);return a.save(e,t,n,r)}addWatchCallback(e,t){this.watchCallbacks.has(e)||this.watchCallbacks.set(e,new Set),this.watchCallbacks.get(e).add(t)}removeWatchCallback(e,t){let n=this.watchCallbacks.get(e);n&&(n.delete(t),n.size===0&&this.watchCallbacks.delete(e))}async stopWatching(){}notifyWatchers(e,t){let n=this.watchCallbacks.get(e);if(n)for(let r of n)try{r(t)}catch(t){this.logger.error(`Watch callback error`,void 0,{type:e,error:t instanceof Error?t.message:String(t)})}}getDatabaseLoader(){let e=this.loaders.get(`database`);if(e&&e instanceof ZQe)return e}async getHistory(e,t,n){let r=this.getDatabaseLoader();if(!r)throw Error(`History tracking requires a database loader to be configured`);let i=r.driver,a=r.tableName,o=r.historyTableName,s=r.tenantId,c={type:e,name:t};s&&(c.tenant_id=s);let l=await i.findOne(a,{object:a,where:c});if(!l)return{records:[],total:0,hasMore:!1};let u={metadata_id:l.id};s&&(u.tenant_id=s),n?.operationType&&(u.operation_type=n.operationType),n?.since&&(u.recorded_at={$gte:n.since}),n?.until&&(u.recorded_at?u.recorded_at.$lte=n.until:u.recorded_at={$lte:n.until});let d=n?.limit??50,f=n?.offset??0,p=await i.find(o,{object:o,where:u,orderBy:[{field:`recorded_at`,order:`desc`}],limit:d+1,offset:f}),m=p.length>d,h=p.slice(0,d),g=await i.count(o,{object:o,where:u}),_=n?.includeMetadata!==!1;return{records:h.map(e=>{let t=typeof e.metadata==`string`?JSON.parse(e.metadata):e.metadata;return{id:e.id,metadataId:e.metadata_id,name:e.name,type:e.type,version:e.version,operationType:e.operation_type,metadata:_?t:null,checksum:e.checksum,previousChecksum:e.previous_checksum,changeNote:e.change_note,tenantId:e.tenant_id,recordedBy:e.recorded_by,recordedAt:e.recorded_at}}),total:g,hasMore:m}}async rollback(e,t,n,r){let i=this.getDatabaseLoader();if(!i)throw Error(`Rollback requires a database loader to be configured`);let a=await i.getHistoryRecord(e,t,n);if(!a)throw Error(`Version ${n} not found in history for ${e}/${t}`);if(!a.metadata)throw Error(`Version ${n} metadata snapshot not available`);let o=a.metadata;return await i.registerRollback(e,t,o,n,r?.changeNote,r?.recordedBy),this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,o),o}async diff(e,t,n,r){let i=this.getDatabaseLoader();if(!i)throw Error(`Diff requires a database loader to be configured`);let a=await i.getHistoryRecord(e,t,n),o=await i.getHistoryRecord(e,t,r);if(!a)throw Error(`Version ${n} not found in history for ${e}/${t}`);if(!o)throw Error(`Version ${r} not found in history for ${e}/${t}`);if(!a.metadata||!o.metadata)throw Error(`Version metadata snapshots not available`);let s=d9(a.metadata,o.metadata),c=s.length===0,l=XQe(s);return{type:e,name:t,version1:n,version2:r,checksum1:a.checksum,checksum2:o.checksum,identical:c,patch:s,summary:l}}},e$e=class{constructor(e,t,n){this.rootDir=e,this.serializers=t,this.logger=n,this.contract={name:`filesystem`,protocol:`file:`,capabilities:{read:!0,write:!0,watch:!0,list:!0},supportedFormats:[`json`,`yaml`,`typescript`,`javascript`],supportsWatch:!0,supportsWrite:!0,supportsCache:!0},this.cache=new Map}async load(e,t,n){let r=Date.now(),{validate:i=!0,useCache:a=!0,ifNoneMatch:o}=n||{};try{let n=await this.findFile(e,t);if(!n)return{data:null,fromCache:!1,notModified:!1,loadTime:Date.now()-r};let i=await this.stat(e,t);if(!i)return{data:null,fromCache:!1,notModified:!1,loadTime:Date.now()-r};if(a&&o&&i.etag===o)return{data:null,fromCache:!0,notModified:!0,etag:i.etag,stats:i,loadTime:Date.now()-r};let s=`${e}:${t}`;if(a&&this.cache.has(s)){let e=this.cache.get(s);if(e.etag===i.etag)return{data:e.data,fromCache:!0,notModified:!1,etag:i.etag,stats:i,loadTime:Date.now()-r}}let c=await If(n,`utf-8`),l=this.getSerializer(i.format);if(!l)throw Error(`No serializer found for format: ${i.format}`);let u=l.deserialize(c);return a&&this.cache.set(s,{data:u,etag:i.etag||``,timestamp:Date.now()}),{data:u,fromCache:!1,notModified:!1,etag:i.etag,stats:i,loadTime:Date.now()-r}}catch(n){throw this.logger?.error(`Failed to load metadata`,void 0,{type:e,name:t,error:n instanceof Error?n.message:String(n)}),n}}async loadMany(e,t){let{patterns:n=[`**/*`],recursive:r=!0,limit:i}=t||{},a=$d(this.rootDir,e),o=[];try{let e=n.map(e=>$d(a,e));for(let t of e){let e=await c9(t,{ignore:[`**/node_modules/**`,`**/*.test.*`,`**/*.spec.*`],nodir:!0});for(let t of e){if(i&&o.length>=i)break;try{let e=await If(t,`utf-8`),n=this.detectFormat(t),r=this.getSerializer(n);if(r){let t=r.deserialize(e);o.push(t)}}catch(e){this.logger?.warn(`Failed to load file`,{file:t,error:e instanceof Error?e.message:String(e)})}}if(i&&o.length>=i)break}return o}catch(t){throw this.logger?.error(`Failed to load many`,void 0,{type:e,patterns:n,error:t instanceof Error?t.message:String(t)}),t}}async exists(e,t){return await this.findFile(e,t)!==null}async stat(e,t){let n=await this.findFile(e,t);if(!n)return null;try{let e=await Sf(n),t=await If(n,`utf-8`),r=this.generateETag(t),i=this.detectFormat(n);return{size:e.size,modifiedAt:e.mtime.toISOString(),etag:r,format:i,path:n}}catch(r){return this.logger?.error(`Failed to stat file`,void 0,{type:e,name:t,filePath:n,error:r instanceof Error?r.message:String(r)}),null}}async list(e){let t=$d(this.rootDir,e);try{return(await c9(`**/*`,{cwd:t,ignore:[`**/node_modules/**`,`**/*.test.*`,`**/*.spec.*`],nodir:!0})).map(e=>tf(e,nf(e)))}catch(t){return this.logger?.error(`Failed to list`,void 0,{type:e,error:t instanceof Error?t.message:String(t)}),[]}}async save(e,t,n,r){let i=Date.now(),{format:a=`typescript`,prettify:o=!0,indent:s=2,sortKeys:c=!1,backup:l=!1,overwrite:u=!0,atomic:d=!0,path:f}=r||{};try{let r=this.getSerializer(a);if(!r)throw Error(`No serializer found for format: ${a}`);let p=$d(this.rootDir,e),m=`${t}${r.getExtension()}`,h=f||$d(p,m);if(!u)try{throw await Cf(h),Error(`File already exists: ${h}`)}catch(e){if(e.code!==`ENOENT`)throw e}await void 0;let g;if(l)try{await Cf(h),g=`${h}.bak`,await void 0}catch{}let _=r.serialize(n,{prettify:o,indent:s,sortKeys:c});if(d){let e=`${h}.tmp`;await Lf(e,_,`utf-8`),await Rf(e,h)}else await Lf(h,_,`utf-8`);return{success:!0,path:h,size:Buffer.byteLength(_,`utf-8`),backupPath:g,saveTime:Date.now()-i}}catch(n){throw this.logger?.error(`Failed to save metadata`,void 0,{type:e,name:t,error:n instanceof Error?n.message:String(n)}),n}}async findFile(e,t){let n=$d(this.rootDir,e);for(let e of[`.json`,`.yaml`,`.yml`,`.ts`,`.js`]){let r=$d(n,`${t}${e}`);try{return await Cf(r),r}catch{}}return null}detectFormat(e){switch(nf(e).toLowerCase()){case`.json`:return`json`;case`.yaml`:case`.yml`:return`yaml`;case`.ts`:return`typescript`;case`.js`:return`javascript`;default:return`json`}}getSerializer(e){return this.serializers.get(e)}generateETag(e){return`"${Bf(`sha256`).update(e).digest(`hex`).substring(0,32)}"`}},t$e=class extends $Qe{constructor(e){if(super(e),!e.loaders||e.loaders.length===0){let t=e.rootDir||process.cwd();this.registerLoader(new e$e(t,this.serializers,this.logger))}e.watch&&this.startWatching()}async stopWatching(){this.watcher&&=(await this.watcher.close(),void 0)}startWatching(){let e=this.config.rootDir||process.cwd(),{ignored:t=[`**/node_modules/**`,`**/*.test.*`],persistent:n=!0}=this.config.watchOptions||{};this.watcher=dXe(e,{ignored:t,persistent:n,ignoreInitial:!0}),this.watcher.on(`add`,async e=>{await this.handleFileEvent(`added`,e)}),this.watcher.on(`change`,async e=>{await this.handleFileEvent(`changed`,e)}),this.watcher.on(`unlink`,async e=>{await this.handleFileEvent(`deleted`,e)}),this.logger.info(`File watcher started`,{rootDir:e})}async handleFileEvent(e,t){let n=rf(this.config.rootDir||process.cwd(),t).split(`/`);if(n.length<2)return;let r=n[0],i=n[n.length-1],a=tf(i,nf(i)),o;if(e!==`deleted`)try{o=await this.load(r,a,{useCache:!1})}catch(e){this.logger.error(`Failed to load changed file`,void 0,{filePath:t,error:e instanceof Error?e.message:String(e)});return}let s={type:e,metadataType:r,name:a,path:t,data:o,timestamp:new Date().toISOString()};this.notifyWatchers(r,s)}},n$e=class{constructor(e={}){this.name=`com.objectstack.metadata`,this.type=`standard`,this.version=`1.0.0`,this.init=async e=>{e.logger.info(`Initializing Metadata Manager`,{root:this.options.rootDir||process.cwd(),watch:this.options.watch}),e.registerService(`metadata`,this.manager),console.log(`[MetadataPlugin] Registered metadata service, has getRegisteredTypes:`,typeof this.manager.getRegisteredTypes);try{e.getService(`manifest`).register({id:`com.objectstack.metadata`,name:`Metadata`,version:`1.0.0`,type:`plugin`,namespace:`sys`,objects:[qQe]})}catch{}e.logger.info(`MetadataPlugin providing metadata service (primary mode)`,{mode:`file-system`,features:[`watch`,`persistence`,`multi-format`,`query`,`overlay`,`type-registry`]})},this.start=async e=>{e.logger.info(`Loading metadata from file system...`);let t=[...G1].sort((e,t)=>e.loadOrder-t.loadOrder),n=0;for(let r of t)try{let t=await this.manager.loadMany(r.type,{recursive:!0});if(t.length>0){for(let e of t){let t=e;t?.name&&await this.manager.register(r.type,t.name,e)}e.logger.info(`Loaded ${t.length} ${r.type} from file system`),n+=t.length}}catch(t){e.logger.debug(`No ${r.type} metadata found`,{error:t.message})}e.logger.info(`Metadata loading complete`,{totalItems:n,registeredTypes:t.length});try{let t=e.getServices();for(let[n,r]of t)if(n.startsWith(`driver.`)&&r){e.logger.info(`[MetadataPlugin] Bridging driver to MetadataManager for database-backed persistence`,{driverService:n}),this.manager.setDatabaseDriver(r);break}}catch(t){e.logger.debug(`[MetadataPlugin] No driver service found — database metadata persistence not available`,{error:t.message})}try{let t=e.getService(`realtime`);t&&typeof t==`object`&&`publish`in t&&(e.logger.info(`[MetadataPlugin] Bridging realtime service to MetadataManager for event publishing`),this.manager.setRealtimeService(t))}catch(t){e.logger.debug(`[MetadataPlugin] No realtime service found — metadata events will not be published`,{error:t.message})}},this.options={watch:!0,...e},this.manager=new t$e({rootDir:this.options.rootDir||process.cwd(),watch:this.options.watch??!0,formats:[`yaml`,`json`,`typescript`,`javascript`]}),this.manager.setTypeRegistry(G1)}};UQe({},{MigrationExecutor:()=>r$e});var r$e=class{constructor(e){this.driver=e}async executeChangeSet(e){console.log(`Executing ChangeSet: ${e.name} (${e.id})`);for(let t of e.operations)try{await this.executeOperation(t)}catch(e){throw console.error(`Failed to execute operation ${t.type}:`,e),e}}async executeOperation(e){switch(e.type){case`create_object`:console.log(` > Create Object: ${e.object.name}`),await this.driver.createCollection(e.object.name,e.object);break;case`add_field`:console.log(` > Add Field: ${e.objectName}.${e.fieldName}`),await this.driver.addColumn(e.objectName,e.fieldName,e.field);break;case`remove_field`:console.log(` > Remove Field: ${e.objectName}.${e.fieldName}`),await this.driver.dropColumn(e.objectName,e.fieldName);break;case`delete_object`:console.log(` > Delete Object: ${e.objectName}`),await this.driver.dropCollection(e.objectName);break;case`execute_sql`:console.log(` > Execute SQL`),await this.driver.executeRaw(e.sql);break;case`modify_field`:console.warn(` ! Modify Field: ${e.objectName}.${e.fieldName} (Not fully implemented)`);break;case`rename_object`:console.warn(` ! Rename Object: ${e.oldName} -> ${e.newName} (Not fully implemented)`);break;default:throw Error(`Unknown operation type`)}}},i$e=r().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)`),a$e=r().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)`);r().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 f9=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),o$e=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),p9=h({target:r().optional().describe(`Target State ID`),cond:o$e.optional().describe(`Condition (Guard) required to take this path`),actions:C(f9).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)});h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)});var s$e=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(f9).optional().describe(`Actions to run when entering this state`),exit:C(f9).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),p9,C(p9)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(p9).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),s$e).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),c$e=h({id:a$e.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),s$e).describe(`State Nodes`),on:d(r(),l([r(),p9,C(p9)])).optional()}),l$e=h({provider:E([`openai`,`azure_openai`,`anthropic`,`local`]).default(`openai`),model:r().describe(`Model name (e.g. gpt-4, claude-3-opus)`),temperature:P().min(0).max(2).default(.7),maxTokens:P().optional(),topP:P().optional()}),u$e=h({type:E([`action`,`flow`,`query`,`vector_search`]),name:r().describe(`Reference name (Action Name, Flow Name)`),description:r().optional().describe(`Override description for the LLM`)}),d$e=h({topics:C(r()).describe(`Topics/Tags to recruit knowledge from`),indexes:C(r()).describe(`Vector Store Indexes`)}),f$e=E([`json_object`,`json_schema`,`regex`,`grammar`,`xml`]).describe(`Output format for structured agent responses`),p$e=E([`trim`,`parse_json`,`validate`,`coerce_types`]).describe(`Post-processing step for structured output`),m$e=h({format:f$e.describe(`Expected output format`),schema:d(r(),u()).optional().describe(`JSON Schema definition for output`),strict:S().default(!1).describe(`Enforce exact schema compliance`),retryOnValidationFailure:S().default(!0).describe(`Retry generation when output fails validation`),maxRetries:P().int().min(0).default(3).describe(`Maximum retries on validation failure`),fallbackFormat:f$e.optional().describe(`Fallback format if primary format fails`),transformPipeline:C(p$e).optional().describe(`Post-processing steps applied to output`)}).describe(`Structured output configuration for agent responses`),m9=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Agent unique identifier`),label:r().describe(`Agent display name`),avatar:r().optional(),role:r().describe(`The persona/role (e.g. "Senior Support Engineer")`),instructions:r().describe(`System Prompt / Prime Directives`),model:l$e.optional(),lifecycle:c$e.optional().describe(`State machine defining the agent conversation follow and constraints`),skills:C(r().regex(/^[a-z_][a-z0-9_]*$/)).optional().describe(`Skill names to attach (Agent→Skill→Tool architecture)`),tools:C(u$e).optional().describe(`Direct tool references (legacy fallback)`),knowledge:d$e.optional().describe(`RAG access`),active:S().default(!0),access:C(r()).optional().describe(`Who can chat with this agent`),permissions:C(r()).optional().describe(`Required permissions or roles`),tenantId:r().optional().describe(`Tenant/Organization ID`),visibility:E([`global`,`organization`,`private`]).default(`organization`),planning:h({strategy:E([`react`,`plan_and_execute`,`reflexion`,`tree_of_thought`]).default(`react`).describe(`Autonomous reasoning strategy`),maxIterations:P().int().min(1).max(100).default(10).describe(`Maximum planning loop iterations`),allowReplan:S().default(!0).describe(`Allow dynamic re-planning based on intermediate results`)}).optional().describe(`Autonomous reasoning and planning configuration`),memory:h({shortTerm:h({maxMessages:P().int().min(1).default(50).describe(`Max recent messages in working memory`),maxTokens:P().int().min(100).optional().describe(`Max tokens for short-term context window`)}).optional().describe(`Short-term / working memory`),longTerm:h({enabled:S().default(!1).describe(`Enable long-term memory persistence`),store:E([`vector`,`database`,`redis`]).default(`vector`).describe(`Long-term memory storage backend`),maxEntries:P().int().min(1).optional().describe(`Max entries in long-term memory`)}).optional().describe(`Long-term / persistent memory`),reflectionInterval:P().int().min(1).optional().describe(`Reflect every N interactions to improve behavior`)}).optional().describe(`Agent memory management`),guardrails:h({maxTokensPerInvocation:P().int().min(1).optional().describe(`Token budget per single invocation`),maxExecutionTimeSec:P().int().min(1).optional().describe(`Max execution time in seconds`),blockedTopics:C(r()).optional().describe(`Forbidden topics or action names`)}).optional().describe(`Safety guardrails for the agent`),structuredOutput:m$e.optional().describe(`Structured output format and validation configuration`)}),h$e=E([`data`,`action`,`flow`,`integration`,`vector_search`,`analytics`,`utility`]).describe(`Tool operational category`),g$e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool unique identifier (snake_case)`),label:r().describe(`Tool display name`),description:r().describe(`Tool description for LLM function calling`),category:h$e.optional().describe(`Tool category for grouping and filtering`),parameters:d(r(),u()).describe(`JSON Schema for tool parameters`),outputSchema:d(r(),u()).optional().describe(`JSON Schema for tool output`),objectName:r().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object name (snake_case)`),requiresConfirmation:S().default(!1).describe(`Require user confirmation before execution`),permissions:C(r()).optional().describe(`Required permissions or roles`),active:S().default(!0).describe(`Whether the tool is enabled`),builtIn:S().default(!1).describe(`Platform built-in tool flag`)});function h9(e){return g$e.parse(e)}var _$e=h({field:r().describe(`Context field to evaluate`),operator:E([`eq`,`neq`,`in`,`not_in`,`contains`]).describe(`Comparison operator`),value:l([r(),C(r())]).describe(`Expected value or values`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Skill unique identifier (snake_case)`),label:r().describe(`Skill display name`),description:r().optional().describe(`Skill description`),instructions:r().optional().describe(`LLM instructions when skill is active`),tools:C(r().regex(/^[a-z_][a-z0-9_]*$/)).describe(`Tool names belonging to this skill`),triggerPhrases:C(r()).optional().describe(`Phrases that activate this skill`),triggerConditions:C(_$e).optional().describe(`Programmatic activation conditions`),permissions:C(r()).optional().describe(`Required permissions or roles`),active:S().default(!0).describe(`Whether the skill is enabled`)});var v$e=E([`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`]),y$e=E([`change_view_mode`,`apply_filter`,`clear_filter`,`apply_sort`,`change_grouping`,`show_columns`,`expand_record`,`collapse_record`,`refresh_view`,`export_data`]),b$e=E([`create_record`,`update_record`,`delete_record`,`fill_field`,`clear_field`,`submit_form`,`cancel_form`,`validate_form`,`save_draft`]),x$e=E([`select_record`,`deselect_record`,`select_all`,`deselect_all`,`bulk_update`,`bulk_delete`,`bulk_export`]),S$e=E([`trigger_flow`,`trigger_approval`,`trigger_webhook`,`run_report`,`send_email`,`send_notification`,`schedule_task`]),C$e=E([`open_modal`,`close_modal`,`open_sidebar`,`close_sidebar`,`show_notification`,`hide_notification`,`open_dropdown`,`close_dropdown`,`toggle_section`]),w$e=l([v$e,y$e,b$e,x$e,S$e,C$e]),T$e=h({object:r().optional().describe(`Object name (for object-specific navigation)`),recordId:r().optional().describe(`Record ID (for detail page)`),viewType:E([`list`,`form`,`detail`,`kanban`,`calendar`,`gantt`]).optional(),dashboardId:r().optional().describe(`Dashboard ID`),reportId:r().optional().describe(`Report ID`),appName:r().optional().describe(`App name`),mode:E([`new`,`edit`,`view`]).optional().describe(`Form mode`),openInNewTab:S().optional().describe(`Open in new tab`)}),E$e=h({viewMode:E([`list`,`kanban`,`calendar`,`gantt`,`pivot`]).optional(),filters:d(r(),u()).optional().describe(`Filter conditions`),sort:C(h({field:r(),order:E([`asc`,`desc`])})).optional(),groupBy:r().optional().describe(`Field to group by`),columns:C(r()).optional().describe(`Columns to show/hide`),recordId:r().optional().describe(`Record to expand/collapse`),exportFormat:E([`csv`,`xlsx`,`pdf`,`json`]).optional()}),D$e=h({object:r().optional().describe(`Object name`),recordId:r().optional().describe(`Record ID (for edit/delete)`),fieldValues:d(r(),u()).optional().describe(`Field name-value pairs`),fieldName:r().optional().describe(`Specific field to fill/clear`),fieldValue:u().optional().describe(`Value to set`),validateOnly:S().optional().describe(`Validate without saving`)}),O$e=h({recordIds:C(r()).optional().describe(`Record IDs to select/operate on`),filters:d(r(),u()).optional().describe(`Filter for bulk operations`),updateData:d(r(),u()).optional().describe(`Data for bulk update`),exportFormat:E([`csv`,`xlsx`,`pdf`,`json`]).optional()}),k$e=h({flowName:r().optional().describe(`Flow/workflow name`),approvalProcessName:r().optional().describe(`Approval process name`),webhookUrl:r().optional().describe(`Webhook URL`),reportName:r().optional().describe(`Report name`),emailTemplate:r().optional().describe(`Email template`),recipients:C(r()).optional().describe(`Email recipients`),subject:r().optional().describe(`Email subject`),message:r().optional().describe(`Notification/email message`),taskData:d(r(),u()).optional().describe(`Task creation data`),scheduleTime:r().optional().describe(`Schedule time (ISO 8601)`),contextData:d(r(),u()).optional().describe(`Additional context data`)}),A$e=h({componentId:r().optional().describe(`Component ID`),modalConfig:h({title:r().optional(),content:u().optional(),size:E([`small`,`medium`,`large`,`fullscreen`]).optional()}).optional(),notificationConfig:h({type:E([`info`,`success`,`warning`,`error`]).optional(),message:r(),duration:P().optional().describe(`Duration in ms`)}).optional(),sidebarConfig:h({position:E([`left`,`right`]).optional(),width:r().optional(),content:u().optional()}).optional()}),g9=h({id:r().optional().describe(`Unique action ID`),type:w$e.describe(`Type of UI action to perform`),params:l([T$e,E$e,D$e,O$e,k$e,A$e]).describe(`Action-specific parameters`),requireConfirmation:S().default(!1).describe(`Require user confirmation before executing`),confirmationMessage:r().optional().describe(`Message to show in confirmation dialog`),successMessage:r().optional().describe(`Message to show on success`),onError:E([`retry`,`skip`,`abort`]).default(`abort`).describe(`Error handling strategy`),metadata:h({intent:r().optional().describe(`Original user intent/query`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),agentName:r().optional().describe(`Agent that generated this action`),timestamp:r().datetime().optional().describe(`Generation timestamp (ISO 8601)`)}).optional()});l([g9.extend({type:v$e,params:T$e}),g9.extend({type:y$e,params:E$e}),g9.extend({type:b$e,params:D$e}),g9.extend({type:x$e,params:O$e}),g9.extend({type:S$e,params:k$e}),g9.extend({type:C$e,params:A$e})]),h({id:r().optional().describe(`Unique sequence ID`),actions:C(g9).describe(`Ordered list of actions`),mode:E([`sequential`,`parallel`]).default(`sequential`).describe(`Execution mode`),stopOnError:S().default(!0).describe(`Stop sequence on first error`),atomic:S().default(!1).describe(`Transaction mode (all-or-nothing)`),startTime:r().datetime().optional().describe(`Execution start time (ISO 8601)`),endTime:r().datetime().optional().describe(`Execution end time (ISO 8601)`),metadata:h({intent:r().optional().describe(`Original user intent`),confidence:P().min(0).max(1).optional().describe(`Overall confidence score`),agentName:r().optional().describe(`Agent that generated this sequence`)}).optional()});var j$e=h({actionId:r().describe(`ID of the executed action`),status:E([`success`,`error`,`cancelled`,`pending`]).describe(`Execution status`),data:u().optional().describe(`Action result data`),error:h({code:r(),message:r(),details:u().optional()}).optional().describe(`Error details if status is "error"`),metadata:h({startTime:r().optional().describe(`Execution start time (ISO 8601)`),endTime:r().optional().describe(`Execution end time (ISO 8601)`),duration:P().optional().describe(`Execution duration in ms`)}).optional()});h({sequenceId:r().describe(`ID of the executed sequence`),status:E([`success`,`partial_success`,`error`,`cancelled`]).describe(`Overall execution status`),results:C(j$e).describe(`Results for each action`),summary:h({total:P().describe(`Total number of actions`),successful:P().describe(`Number of successful actions`),failed:P().describe(`Number of failed actions`),cancelled:P().describe(`Number of cancelled actions`)}),metadata:h({startTime:r().optional(),endTime:r().optional(),totalDuration:P().optional().describe(`Total execution time in ms`)}).optional()}),h({intent:r().describe(`Intent pattern (e.g., "open_new_record_form")`),examples:C(r()).optional().describe(`Example user queries`),actionTemplate:g9.describe(`Action to execute`),paramExtraction:d(r(),h({type:E([`entity`,`slot`,`context`]),required:S().default(!1),default:u().optional()})).optional().describe(`Rules for extracting parameters from user input`),minConfidence:P().min(0).max(1).default(.7).describe(`Minimum confidence to execute`)});var M$e=E([`frontend`,`backend`,`api`,`database`,`tests`,`documentation`,`infrastructure`]).describe(`Code generation target`),N$e=h({enabled:S().optional().default(!0).describe(`Enable code generation`),targets:C(M$e).describe(`Code generation targets`),templateRepo:r().optional().describe(`Template repository for scaffolding`),styleGuide:r().optional().describe(`Code style guide to follow`),includeTests:S().optional().default(!0).describe(`Generate tests with code`),includeDocumentation:S().optional().default(!0).describe(`Generate documentation`),validationMode:E([`strict`,`moderate`,`permissive`]).optional().default(`strict`).describe(`Code validation strictness`)}),P$e=h({enabled:S().optional().default(!0).describe(`Enable automated testing`),testTypes:C(E([`unit`,`integration`,`e2e`,`performance`,`security`,`accessibility`])).optional().default([`unit`,`integration`]).describe(`Types of tests to run`),coverageThreshold:P().min(0).max(100).optional().default(80).describe(`Minimum test coverage percentage`),framework:r().optional().describe(`Testing framework (e.g., vitest, jest, playwright)`),preCommitTests:S().optional().default(!0).describe(`Run tests before committing`),autoFix:S().optional().default(!1).describe(`Attempt to auto-fix failing tests`)}),F$e=h({name:r().describe(`Pipeline stage name`),type:E([`build`,`test`,`lint`,`security_scan`,`deploy`,`smoke_test`,`rollback`]).describe(`Stage type`),order:P().int().min(0).describe(`Execution order`),parallel:S().optional().default(!1).describe(`Can run in parallel with other stages`),commands:C(r()).describe(`Commands to execute`),env:d(r(),r()).optional().describe(`Stage-specific environment variables`),timeout:P().int().min(60).optional().default(600).describe(`Stage timeout in seconds`),retryOnFailure:S().optional().default(!1).describe(`Retry stage on failure`),maxRetries:P().int().min(0).max(5).optional().default(0).describe(`Maximum retry attempts`)}),I$e=h({name:r().describe(`Pipeline name`),trigger:E([`push`,`pull_request`,`release`,`schedule`,`manual`]).describe(`Pipeline trigger`),branches:C(r()).optional().describe(`Branches to run pipeline on`),stages:C(F$e).describe(`Pipeline stages`),notifications:h({onSuccess:S().optional().default(!1),onFailure:S().optional().default(!0),channels:C(r()).optional().describe(`Notification channels (e.g., slack, email)`)}).optional().describe(`Pipeline notifications`)}),L$e=h({scheme:E([`semver`,`calver`,`custom`]).optional().default(`semver`).describe(`Versioning scheme`),autoIncrement:E([`major`,`minor`,`patch`,`none`]).optional().default(`patch`).describe(`Auto-increment strategy`),prefix:r().optional().default(`v`).describe(`Version tag prefix`),generateChangelog:S().optional().default(!0).describe(`Generate changelog automatically`),changelogFormat:E([`conventional`,`keepachangelog`,`custom`]).optional().default(`conventional`).describe(`Changelog format`),tagReleases:S().optional().default(!0).describe(`Create Git tags for releases`)}),R$e=h({type:E([`rolling`,`blue_green`,`canary`,`recreate`]).optional().default(`rolling`).describe(`Deployment strategy`),canaryPercentage:P().min(0).max(100).optional().default(10).describe(`Canary deployment percentage`),healthCheckUrl:r().optional().describe(`Health check endpoint`),healthCheckTimeout:P().int().min(10).optional().default(60).describe(`Health check timeout in seconds`),autoRollback:S().optional().default(!0).describe(`Automatically rollback on failure`),smokeTests:C(r()).optional().describe(`Smoke test commands to run post-deployment`)}),z$e=h({enabled:S().optional().default(!0).describe(`Enable monitoring`),metrics:C(E([`performance`,`errors`,`usage`,`availability`,`latency`])).optional().default([`performance`,`errors`,`availability`]).describe(`Metrics to monitor`),alerts:C(h({name:r().describe(`Alert name`),metric:r().describe(`Metric to monitor`),threshold:P().describe(`Alert threshold`),severity:E([`info`,`warning`,`critical`]).describe(`Alert severity`)})).optional().describe(`Alert configurations`),integrations:C(r()).optional().describe(`Monitoring service integrations`)}),B$e=h({specificationSource:r().describe(`Path to ObjectStack specification`),codeGeneration:N$e.describe(`Code generation settings`),testing:P$e.optional().describe(`Testing configuration`),linting:h({enabled:S().optional().default(!0),autoFix:S().optional().default(!0),rules:d(r(),u()).optional()}).optional().describe(`Code linting configuration`),formatting:h({enabled:S().optional().default(!0),autoFormat:S().optional().default(!0),config:d(r(),u()).optional()}).optional().describe(`Code formatting configuration`)}),V$e=h({connector:r().describe(`GitHub connector name`),repository:h({owner:r().describe(`Repository owner`),name:r().describe(`Repository name`)}).describe(`Repository configuration`),featureBranch:r().optional().default(`develop`).describe(`Default feature branch`),pullRequest:h({autoCreate:S().optional().default(!0).describe(`Automatically create PRs`),autoMerge:S().optional().default(!1).describe(`Automatically merge PRs when checks pass`),requireReviews:S().optional().default(!0).describe(`Require reviews before merge`),deleteBranchOnMerge:S().optional().default(!0).describe(`Delete feature branch after merge`)}).optional().describe(`Pull request settings`)}),H$e=h({connector:r().describe(`Vercel connector name`),project:r().describe(`Vercel project name`),environments:h({production:r().optional().default(`main`).describe(`Production branch`),preview:C(r()).optional().default([`develop`,`feature/*`]).describe(`Preview branches`)}).optional().describe(`Environment mapping`),deployment:h({autoDeployProduction:S().optional().default(!1).describe(`Auto-deploy to production`),autoDeployPreview:S().optional().default(!0).describe(`Auto-deploy preview environments`),requireApproval:S().optional().default(!0).describe(`Require approval for production deployments`)}).optional().describe(`Deployment settings`)}),U$e=h({github:V$e.describe(`GitHub integration configuration`),vercel:H$e.describe(`Vercel integration configuration`),additional:d(r(),u()).optional().describe(`Additional integration configurations`)});m9.extend({developmentConfig:B$e.describe(`Development configuration`),pipelines:C(I$e).optional().describe(`CI/CD pipelines`),versionManagement:L$e.optional().describe(`Version management configuration`),deploymentStrategy:R$e.optional().describe(`Deployment strategy`),monitoring:z$e.optional().describe(`Monitoring configuration`),integrations:U$e.describe(`Integration configurations`),selfIteration:h({enabled:S().optional().default(!0).describe(`Enable self-iteration`),iterationFrequency:r().optional().describe(`Iteration frequency (cron expression)`),optimizationGoals:C(E([`performance`,`security`,`code_quality`,`test_coverage`,`documentation`])).optional().describe(`Optimization goals`),learningMode:E([`conservative`,`balanced`,`aggressive`]).optional().default(`balanced`).describe(`Learning mode`)}).optional().describe(`Self-iteration configuration`)}),u$e.extend({type:E([`action`,`flow`,`query`,`vector_search`,`git_operation`,`code_generation`,`test_execution`,`deployment`,`monitoring`])}),h({description:r().describe(`What the plugin should do`),pluginType:E([`driver`,`app`,`widget`,`integration`,`automation`,`analytics`,`ai-agent`,`custom`]),outputFormat:E([`source-code`,`low-code-schema`,`dsl`]).default(`source-code`).describe(`Format of the generated output`),language:E([`typescript`,`javascript`,`python`]).default(`typescript`),framework:h({runtime:E([`node`,`browser`,`edge`,`universal`]).optional(),uiFramework:E([`react`,`vue`,`svelte`,`none`]).optional(),testing:E([`vitest`,`jest`,`mocha`,`none`]).optional()}).optional(),capabilities:C(r()).optional().describe(`Protocol IDs to implement`),dependencies:C(r()).optional().describe(`Required plugin IDs`),examples:C(h({input:r(),expectedOutput:r(),description:r().optional()})).optional(),style:h({indentation:E([`tab`,`2spaces`,`4spaces`]).default(`2spaces`),quotes:E([`single`,`double`]).default(`single`),semicolons:S().default(!0),trailingComma:S().default(!0)}).optional(),schemaOptions:h({format:E([`json`,`yaml`,`typescript`]).default(`typescript`).describe(`Output schema format`),includeExamples:S().default(!0),strictValidation:S().default(!0),generateUI:S().default(!0).describe(`Generate view, dashboard, and page definitions`),generateDataModels:S().default(!0).describe(`Generate object and field definitions`)}).optional(),context:h({existingCode:r().optional(),documentationUrls:C(r()).optional(),referencePlugins:C(r()).optional()}).optional(),options:h({generateTests:S().default(!0),generateDocs:S().default(!0),generateExamples:S().default(!0),targetCoverage:P().min(0).max(100).default(80),optimizationLevel:E([`none`,`basic`,`aggressive`]).default(`basic`)}).optional()}),h({outputFormat:E([`source-code`,`low-code-schema`,`dsl`]),code:r().optional(),language:r().optional(),schemas:C(h({type:E([`object`,`view`,`dashboard`,`app`,`workflow`,`api`,`page`]),path:r().describe(`File path for the schema`),content:r().describe(`Schema content (JSON/YAML/TypeScript)`),description:r().optional()})).optional().describe(`Generated low-code schema files`),files:C(h({path:r(),content:r(),description:r().optional()})),tests:C(h({path:r(),content:r(),coverage:P().min(0).max(100).optional()})).optional(),documentation:h({readme:r().optional(),api:r().optional(),usage:r().optional()}).optional(),package:h({name:r(),version:r(),dependencies:d(r(),r()).optional(),devDependencies:d(r(),r()).optional()}).optional(),quality:h({complexity:P().optional().describe(`Cyclomatic complexity`),maintainability:P().min(0).max(100).optional(),testCoverage:P().min(0).max(100).optional(),lintScore:P().min(0).max(100).optional()}).optional(),confidence:P().min(0).max(100).describe(`AI confidence in generated code`),suggestions:C(r()).optional(),warnings:C(r()).optional()}),h({id:r(),name:r(),description:r(),pluginType:r(),structure:C(h({type:E([`file`,`directory`]),path:r(),template:r().optional().describe(`Template content with variables`),optional:S().default(!1)})),variables:C(h({name:r(),description:r(),type:E([`string`,`number`,`boolean`,`array`,`object`]),required:S().default(!0),default:u().optional(),validation:r().optional().describe(`Validation regex or rule`)})),scripts:C(h({name:r(),command:r(),description:r().optional(),optional:S().default(!1)})).optional()}),h({assessment:E([`excellent`,`good`,`acceptable`,`needs-improvement`,`poor`]),score:P().min(0).max(100),issues:C(h({severity:E([`critical`,`error`,`warning`,`info`,`style`]),category:E([`bug`,`security`,`performance`,`maintainability`,`style`,`documentation`,`testing`,`type-safety`,`best-practice`]),file:r(),line:P().int().optional(),column:P().int().optional(),message:r(),suggestion:r().optional(),autoFixable:S().default(!1),autoFix:r().optional().describe(`Automated fix code`)})),highlights:C(h({category:r(),description:r(),file:r().optional()})).optional(),metrics:h({complexity:P().optional(),maintainability:P().min(0).max(100).optional(),testCoverage:P().min(0).max(100).optional(),duplicateCode:P().min(0).max(100).optional(),technicalDebt:r().optional().describe(`Estimated technical debt`)}).optional(),recommendations:C(h({priority:E([`high`,`medium`,`low`]),title:r(),description:r(),effort:E([`trivial`,`small`,`medium`,`large`]).optional()})),security:h({vulnerabilities:C(h({severity:E([`critical`,`high`,`medium`,`low`]),type:r(),description:r(),remediation:r().optional()})).optional(),score:P().min(0).max(100).optional()}).optional()}),h({goal:r().describe(`What should the composed plugins achieve`),availablePlugins:C(h({pluginId:r(),version:r(),capabilities:C(r()).optional(),description:r().optional()})),constraints:h({maxPlugins:P().int().min(1).optional(),requiredPlugins:C(r()).optional(),excludedPlugins:C(r()).optional(),performance:h({maxLatency:P().optional().describe(`Maximum latency in ms`),maxMemory:P().optional().describe(`Maximum memory in bytes`)}).optional()}).optional(),optimize:E([`performance`,`reliability`,`simplicity`,`cost`,`security`]).optional()}),h({plugins:C(h({pluginId:r(),version:r(),role:r().describe(`Role in the composition`),configuration:d(r(),u()).optional()})),integration:h({code:r(),config:d(r(),u()).optional(),initOrder:C(r())}),dataFlow:C(h({from:r(),to:r(),data:r().describe(`Data type or description`)})),performance:h({estimatedLatency:P().optional().describe(`Estimated latency in ms`),estimatedMemory:P().optional().describe(`Estimated memory in bytes`)}).optional(),confidence:P().min(0).max(100),alternatives:C(h({description:r(),plugins:C(r()),tradeoffs:r()})).optional(),warnings:C(r()).optional()}),h({context:h({installedPlugins:C(r()).optional(),industry:r().optional(),useCases:C(r()).optional(),teamSize:P().int().optional(),budget:E([`free`,`low`,`medium`,`high`,`unlimited`]).optional()}),criteria:h({prioritize:E([`popularity`,`rating`,`compatibility`,`features`,`cost`,`support`]).optional(),certifiedOnly:S().default(!1),minRating:P().min(0).max(5).optional(),maxResults:P().int().min(1).max(50).default(10)}).optional()}),h({recommendations:C(h({pluginId:r(),name:r(),description:r(),score:P().min(0).max(100).describe(`Relevance score`),reasons:C(r()).describe(`Why this plugin is recommended`),benefits:C(r()),considerations:C(r()).optional(),alternatives:C(r()).optional(),estimatedValue:r().optional().describe(`Expected value/ROI`)})),combinations:C(h({plugins:C(r()),description:r(),synergies:C(r()).describe(`How these plugins work well together`),totalScore:P().min(0).max(100)})).optional(),learningPath:C(h({step:P().int(),plugin:r(),reason:r(),resources:C(r()).optional()})).optional()});var _9=E([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),W$e=h({interval:P().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:P().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:P().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:P().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:r().optional().describe(`Method name to call for health check`),autoRestart:S().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:P().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)});h({status:_9,timestamp:r().datetime(),message:r().optional(),metrics:h({uptime:P().describe(`Plugin uptime in milliseconds`),memoryUsage:P().optional().describe(`Memory usage in bytes`),cpuUsage:P().optional().describe(`CPU usage percentage`),activeConnections:P().optional().describe(`Number of active connections`),errorRate:P().optional().describe(`Error rate (errors per minute)`),responseTime:P().optional().describe(`Average response time in ms`)}).partial().optional(),checks:C(h({name:r().describe(`Check name`),status:E([`passed`,`failed`,`warning`]),message:r().optional(),data:d(r(),u()).optional()})).optional(),dependencies:C(h({pluginId:r(),status:_9,message:r().optional()})).optional()});var G$e=h({provider:E([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:C(r()).optional().describe(`Backend connection endpoints`),keyPrefix:r().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:P().int().min(0).optional().describe(`State expiration time in seconds`),auth:h({username:r().optional(),password:r().optional(),token:r().optional(),certificate:r().optional()}).optional(),replication:h({enabled:S().default(!0),minReplicas:P().int().min(1).default(1)}).optional(),customConfig:d(r(),u()).optional().describe(`Provider-specific configuration`)}),K$e=h({enabled:S().default(!1),watchPatterns:C(r()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:P().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:S().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:E([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:G$e.optional().describe(`Configuration for distributed state management`),shutdownTimeout:P().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:C(r()).optional().describe(`Hook names to call before reload`),afterReload:C(r()).optional().describe(`Hook names to call after reload`)}),q$e=h({enabled:S().default(!0),fallbackMode:E([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:C(r()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:C(r()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:C(h({feature:r().describe(`Feature name`),enabled:S().describe(`Whether feature is available in degraded mode`),reason:r().optional()})).optional(),autoRecovery:h({enabled:S().default(!0),retryInterval:P().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:P().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),J$e=h({mode:E([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:h({major:S().default(!1).describe(`Allow major version updates`),minor:S().default(!0).describe(`Allow minor version updates`),patch:S().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:h({cron:r().optional(),timezone:r().default(`UTC`),maintenanceWindow:P().int().min(1).default(60)}).optional(),rollback:h({enabled:S().default(!0),automatic:S().default(!0),keepVersions:P().int().min(1).default(3),timeout:P().int().min(1e3).default(3e4)}).optional(),validation:h({checkCompatibility:S().default(!0),runTests:S().default(!1),testSuite:r().optional()}).optional()});h({pluginId:r(),version:r(),timestamp:r().datetime(),state:d(r(),u()),metadata:h({checksum:r().optional().describe(`State checksum for verification`),compressed:S().default(!1),encryption:r().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),h({health:W$e.optional(),hotReload:K$e.optional(),degradation:q$e.optional(),updates:J$e.optional(),resources:h({maxMemory:P().int().optional().describe(`Maximum memory in bytes`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:P().int().optional().describe(`Maximum concurrent connections`),timeout:P().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:h({enableMetrics:S().default(!0),enableTracing:S().default(!0),enableProfiling:S().default(!1),metricsInterval:P().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()});var Y$e=h({enabled:S().default(!0),metrics:C(E([`cpu-usage`,`memory-usage`,`response-time`,`error-rate`,`throughput`,`latency`,`connection-count`,`queue-depth`])),algorithm:E([`statistical`,`machine-learning`,`heuristic`,`hybrid`]).default(`hybrid`),sensitivity:E([`low`,`medium`,`high`]).default(`medium`).describe(`How aggressively to detect anomalies`),timeWindow:P().int().min(60).default(300).describe(`Historical data window for anomaly detection`),confidenceThreshold:P().min(0).max(100).default(80).describe(`Minimum confidence to flag as anomaly`),alertOnDetection:S().default(!0)}),X$e=h({id:r(),type:E([`restart`,`scale`,`rollback`,`clear-cache`,`adjust-config`,`execute-script`,`notify`]),trigger:h({healthStatus:C(_9).optional(),anomalyTypes:C(r()).optional(),errorPatterns:C(r()).optional(),customCondition:r().optional().describe(`Custom trigger condition (e.g., "errorRate > 0.1")`)}),parameters:d(r(),u()).optional(),maxAttempts:P().int().min(1).default(3),cooldown:P().int().min(0).default(60),timeout:P().int().min(1).default(300),requireApproval:S().default(!1),priority:P().int().min(1).default(5).describe(`Action priority (lower number = higher priority)`)}),Z$e=h({enabled:S().default(!0),strategy:E([`conservative`,`moderate`,`aggressive`]).default(`moderate`),actions:C(X$e),anomalyDetection:Y$e.optional(),maxConcurrentHealing:P().int().min(1).default(1).describe(`Maximum number of simultaneous healing attempts`),learning:h({enabled:S().default(!0).describe(`Learn from successful/failed healing attempts`),feedbackLoop:S().default(!0).describe(`Adjust strategy based on outcomes`)}).optional()}),Q$e=h({enabled:S().default(!1),metric:E([`cpu-usage`,`memory-usage`,`request-rate`,`response-time`,`queue-depth`,`custom`]),customMetric:r().optional(),targetValue:P().describe(`Desired metric value (e.g., 70 for 70% CPU)`),bounds:h({minInstances:P().int().min(1).default(1),maxInstances:P().int().min(1).default(10),minResources:h({cpu:r().optional().describe(`CPU limit (e.g., "0.5", "1")`),memory:r().optional().describe(`Memory limit (e.g., "512Mi", "1Gi")`)}).optional(),maxResources:h({cpu:r().optional(),memory:r().optional()}).optional()}),scaleUp:h({threshold:P().describe(`Metric value that triggers scale up`),stabilizationWindow:P().int().min(0).default(60).describe(`How long metric must exceed threshold`),cooldown:P().int().min(0).default(300).describe(`Minimum time between scale-up operations`),stepSize:P().int().min(1).default(1).describe(`Number of instances to add`)}),scaleDown:h({threshold:P().describe(`Metric value that triggers scale down`),stabilizationWindow:P().int().min(0).default(300).describe(`How long metric must be below threshold`),cooldown:P().int().min(0).default(600).describe(`Minimum time between scale-down operations`),stepSize:P().int().min(1).default(1).describe(`Number of instances to remove`)}),predictive:h({enabled:S().default(!1).describe(`Use ML to predict future load`),lookAhead:P().int().min(60).default(300).describe(`How far ahead to predict (seconds)`),confidence:P().min(0).max(100).default(80).describe(`Minimum confidence for prediction-based scaling`)}).optional()});h({incidentId:r(),pluginId:r(),symptoms:C(h({type:r().describe(`Symptom type`),description:r(),severity:E([`low`,`medium`,`high`,`critical`]),timestamp:r().datetime()})),timeRange:h({start:r().datetime(),end:r().datetime()}),analyzeLogs:S().default(!0),analyzeMetrics:S().default(!0),analyzeDependencies:S().default(!0),context:d(r(),u()).optional()}),h({analysisId:r(),incidentId:r(),rootCauses:C(h({id:r(),description:r(),confidence:P().min(0).max(100),category:E([`code-defect`,`configuration`,`resource-exhaustion`,`dependency-failure`,`network-issue`,`data-corruption`,`security-breach`,`other`]),evidence:C(h({type:E([`log`,`metric`,`trace`,`event`]),content:r(),timestamp:r().datetime().optional()})),impact:E([`low`,`medium`,`high`,`critical`]),recommendations:C(r())})),contributingFactors:C(h({description:r(),confidence:P().min(0).max(100)})).optional(),timeline:C(h({timestamp:r().datetime(),event:r(),significance:E([`low`,`medium`,`high`])})).optional(),remediation:h({immediate:C(r()),shortTerm:C(r()),longTerm:C(r())}).optional(),overallConfidence:P().min(0).max(100),timestamp:r().datetime()}),h({id:r(),pluginId:r(),type:E([`caching`,`query-optimization`,`resource-allocation`,`code-refactoring`,`architecture-change`,`configuration-tuning`]),description:r(),expectedImpact:h({performanceGain:P().min(0).max(100).describe(`Expected performance improvement (%)`),resourceSavings:h({cpu:P().optional().describe(`CPU reduction (%)`),memory:P().optional().describe(`Memory reduction (%)`),network:P().optional().describe(`Network reduction (%)`)}).optional(),costReduction:P().optional().describe(`Estimated cost reduction (%)`)}),difficulty:E([`trivial`,`easy`,`moderate`,`complex`,`very-complex`]),steps:C(r()),risks:C(r()).optional(),confidence:P().min(0).max(100),priority:E([`low`,`medium`,`high`,`critical`])}),h({agentId:r(),pluginId:r(),selfHealing:Z$e.optional(),autoScaling:C(Q$e).optional(),monitoring:h({enabled:S().default(!0),interval:P().int().min(1e3).default(6e4).describe(`Monitoring interval in milliseconds`),metrics:C(r()).optional()}).optional(),optimization:h({enabled:S().default(!0),scanInterval:P().int().min(3600).default(86400).describe(`How often to scan for optimization opportunities`),autoApply:S().default(!1).describe(`Automatically apply low-risk optimizations`)}).optional(),incidentResponse:h({enabled:S().default(!0),autoRCA:S().default(!0),notifications:C(h({channel:E([`email`,`slack`,`webhook`,`sms`]),config:d(r(),u())})).optional()}).optional()});var $$e=E([`openai`,`azure_openai`,`anthropic`,`google`,`cohere`,`huggingface`,`local`,`custom`]),e1e=h({textGeneration:S().optional().default(!0).describe(`Supports text generation`),textEmbedding:S().optional().default(!1).describe(`Supports text embedding`),imageGeneration:S().optional().default(!1).describe(`Supports image generation`),imageUnderstanding:S().optional().default(!1).describe(`Supports image understanding`),functionCalling:S().optional().default(!1).describe(`Supports function calling`),codeGeneration:S().optional().default(!1).describe(`Supports code generation`),reasoning:S().optional().default(!1).describe(`Supports advanced reasoning`)}),t1e=h({maxTokens:P().int().positive().describe(`Maximum tokens per request`),contextWindow:P().int().positive().describe(`Context window size`),maxOutputTokens:P().int().positive().optional().describe(`Maximum output tokens`),rateLimit:h({requestsPerMinute:P().int().positive().optional(),tokensPerMinute:P().int().positive().optional()}).optional()}),n1e=h({currency:r().optional().default(`USD`),inputCostPer1kTokens:P().optional().describe(`Cost per 1K input tokens`),outputCostPer1kTokens:P().optional().describe(`Cost per 1K output tokens`),embeddingCostPer1kTokens:P().optional().describe(`Cost per 1K embedding tokens`)}),r1e=h({id:r().describe(`Unique model identifier`),name:r().describe(`Model display name`),version:r().describe(`Model version (e.g., "gpt-4-turbo-2024-04-09")`),provider:$$e,capabilities:e1e,limits:t1e,pricing:n1e.optional(),endpoint:r().url().optional().describe(`Custom API endpoint`),apiKey:r().optional().describe(`API key (Warning: Prefer secretRef)`),secretRef:r().optional().describe(`Reference to stored secret (e.g. system:openai_api_key)`),region:r().optional().describe(`Deployment region (e.g., "us-east-1")`),description:r().optional(),tags:C(r()).optional().describe(`Tags for categorization`),deprecated:S().optional().default(!1),recommendedFor:C(r()).optional().describe(`Use case recommendations`)}),i1e=h({name:r().describe(`Variable name (e.g., "user_name", "context")`),type:E([`string`,`number`,`boolean`,`object`,`array`]).default(`string`),required:S().default(!1),defaultValue:u().optional(),description:r().optional(),validation:h({minLength:P().optional(),maxLength:P().optional(),pattern:r().optional(),enum:C(u()).optional()}).optional()}),a1e=h({id:r().describe(`Unique template identifier`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template name (snake_case)`),label:r().describe(`Display name`),system:r().optional().describe(`System prompt`),user:r().describe(`User prompt template with variables`),assistant:r().optional().describe(`Assistant message prefix`),variables:C(i1e).optional().describe(`Template variables`),modelId:r().optional().describe(`Recommended model ID`),temperature:P().min(0).max(2).optional(),maxTokens:P().optional(),topP:P().optional(),frequencyPenalty:P().optional(),presencePenalty:P().optional(),stopSequences:C(r()).optional(),version:r().optional().default(`1.0.0`),description:r().optional(),category:r().optional().describe(`Template category (e.g., "code_generation", "support")`),tags:C(r()).optional(),examples:C(h({input:d(r(),u()).describe(`Example variable values`),output:r().describe(`Expected output`)})).optional()}),o1e=h({model:r1e,status:E([`active`,`deprecated`,`experimental`,`disabled`]).default(`active`),priority:P().int().default(0).describe(`Priority for model selection`),fallbackModels:C(r()).optional().describe(`Fallback model IDs`),healthCheck:h({enabled:S().default(!0),intervalSeconds:P().int().default(300),lastChecked:r().optional().describe(`ISO timestamp`),status:E([`healthy`,`unhealthy`,`unknown`]).default(`unknown`)}).optional()});h({name:r().describe(`Registry name`),models:d(r(),o1e).describe(`Model entries by ID`),promptTemplates:d(r(),a1e).optional().describe(`Prompt templates by name`),defaultModel:r().optional().describe(`Default model ID`),enableAutoFallback:S().default(!0).describe(`Auto-fallback on errors`)}),h({capabilities:C(r()).optional().describe(`Required capabilities`),maxCostPer1kTokens:P().optional().describe(`Maximum acceptable cost`),minContextWindow:P().optional().describe(`Minimum context window size`),provider:$$e.optional(),tags:C(r()).optional(),excludeDeprecated:S().default(!0)});var s1e=h({type:E([`stdio`,`http`,`websocket`,`grpc`]),url:r().url().optional().describe(`Server URL (for HTTP/WebSocket/gRPC)`),headers:d(r(),r()).optional().describe(`Custom headers for requests`),auth:h({type:E([`none`,`bearer`,`api_key`,`oauth2`,`custom`]).default(`none`),token:r().optional().describe(`Bearer token or API key`),secretRef:r().optional().describe(`Reference to stored secret`),headerName:r().optional().describe(`Custom auth header name`)}).optional(),timeout:P().int().positive().optional().default(3e4).describe(`Request timeout in milliseconds`),retryAttempts:P().int().min(0).max(5).optional().default(3),retryDelay:P().int().positive().optional().default(1e3).describe(`Delay between retries in milliseconds`),command:r().optional().describe(`Command to execute (for stdio transport)`),args:C(r()).optional().describe(`Command arguments`),env:d(r(),r()).optional().describe(`Environment variables`),workingDirectory:r().optional().describe(`Working directory for the process`)}),c1e=E([`text`,`json`,`binary`,`stream`]),l1e=h({uri:r().describe(`Unique resource identifier (e.g., "objectstack://objects/account/ABC123")`),name:r().describe(`Human-readable resource name`),description:r().optional().describe(`Resource description for AI consumption`),mimeType:r().optional().describe(`MIME type (e.g., "application/json", "text/plain")`),resourceType:c1e.default(`json`),content:u().optional().describe(`Resource content (for static resources)`),contentUrl:r().url().optional().describe(`URL to fetch content dynamically`),size:P().int().nonnegative().optional().describe(`Resource size in bytes`),lastModified:r().datetime().optional().describe(`Last modification timestamp (ISO 8601)`),tags:C(r()).optional().describe(`Tags for resource categorization`),permissions:h({read:S().default(!0),write:S().default(!1),delete:S().default(!1)}).optional(),cacheable:S().default(!0).describe(`Whether this resource can be cached`),cacheMaxAge:P().int().nonnegative().optional().describe(`Cache max age in seconds`)}),u1e=h({uriPattern:r().describe(`URI pattern with variables (e.g., "objectstack://objects/{objectName}/{recordId}")`),name:r().describe(`Template name`),description:r().optional(),parameters:C(h({name:r().describe(`Parameter name`),type:E([`string`,`number`,`boolean`]).default(`string`),required:S().default(!0),description:r().optional(),pattern:r().optional().describe(`Regex validation pattern`),default:u().optional()})).describe(`URI parameters`),handler:r().optional().describe(`Handler function name for dynamic generation`),mimeType:r().optional(),resourceType:c1e.default(`json`)}),v9=h({name:r().describe(`Parameter name`),type:E([`string`,`number`,`boolean`,`object`,`array`]),description:r().describe(`Parameter description for AI consumption`),required:S().default(!1),default:u().optional(),enum:C(u()).optional().describe(`Allowed values`),pattern:r().optional().describe(`Regex validation pattern (for strings)`),minimum:P().optional().describe(`Minimum value (for numbers)`),maximum:P().optional().describe(`Maximum value (for numbers)`),minLength:P().int().nonnegative().optional().describe(`Minimum length (for strings/arrays)`),maxLength:P().int().nonnegative().optional().describe(`Maximum length (for strings/arrays)`),properties:d(r(),F(()=>v9)).optional().describe(`Properties for object types`),items:F(()=>v9).optional().describe(`Item schema for array types`)}),d1e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool function name (snake_case)`),description:r().describe(`Tool description for AI consumption (be detailed and specific)`),parameters:C(v9).describe(`Tool parameters`),returns:h({type:E([`string`,`number`,`boolean`,`object`,`array`,`void`]),description:r().optional(),schema:v9.optional().describe(`Return value schema`)}).optional(),handler:r().describe(`Handler function or endpoint reference`),async:S().default(!0).describe(`Whether the tool executes asynchronously`),timeout:P().int().positive().optional().describe(`Execution timeout in milliseconds`),sideEffects:E([`none`,`read`,`write`,`delete`]).default(`read`).describe(`Tool side effects`),requiresConfirmation:S().default(!1).describe(`Require user confirmation before execution`),confirmationMessage:r().optional(),examples:C(h({description:r(),parameters:d(r(),u()),result:u().optional()})).optional().describe(`Usage examples for AI learning`),category:r().optional().describe(`Tool category (e.g., "data", "workflow", "analytics")`),tags:C(r()).optional(),deprecated:S().default(!1),version:r().optional().default(`1.0.0`)}),f1e=h({name:r().describe(`Argument name`),description:r().optional(),type:E([`string`,`number`,`boolean`]).default(`string`),required:S().default(!1),default:u().optional()}),p1e=h({role:E([`system`,`user`,`assistant`]).describe(`Message role`),content:r().describe(`Message content (can include {{variable}} placeholders)`)}),m1e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Prompt template name (snake_case)`),description:r().optional().describe(`Prompt description`),messages:C(p1e).describe(`Prompt message sequence`),arguments:C(f1e).optional().describe(`Dynamic arguments for the prompt`),category:r().optional(),tags:C(r()).optional(),version:r().optional().default(`1.0.0`)}),h1e=h({enabled:S().describe(`Enable streaming for MCP communication`),chunkSize:P().int().positive().optional().describe(`Size of each streamed chunk in bytes`),heartbeatIntervalMs:P().int().positive().optional().default(3e4).describe(`Heartbeat interval in milliseconds`),backpressure:E([`drop`,`buffer`,`block`]).optional().describe(`Backpressure handling strategy`)}).describe(`Streaming configuration for MCP communication`),g1e=h({requireApproval:S().default(!1).describe(`Require approval before tool execution`),approvalStrategy:E([`human_in_loop`,`auto_approve`,`policy_based`]).describe(`Approval strategy for tool execution`),dangerousToolPatterns:C(r()).optional().describe(`Regex patterns for tools needing approval`),autoApproveTimeout:P().int().positive().optional().describe(`Auto-approve timeout in seconds`)}).describe(`Tool approval configuration for MCP`),_1e=h({enabled:S().describe(`Enable LLM sampling`),maxTokens:P().int().positive().describe(`Maximum tokens to generate`),temperature:P().min(0).max(2).optional().describe(`Sampling temperature`),stopSequences:C(r()).optional().describe(`Stop sequences to end generation`),modelPreferences:C(r()).optional().describe(`Preferred model IDs in priority order`),systemPrompt:r().optional().describe(`System prompt for sampling context`)}).describe(`Sampling configuration for MCP`),v1e=h({roots:C(h({uri:r().describe(`Root URI (e.g., file:///path/to/project)`),name:r().optional().describe(`Human-readable root name`),readOnly:S().optional().describe(`Whether the root is read-only`)}).describe(`A single root directory or resource`)).describe(`Root directories or resources available to the client`),watchForChanges:S().default(!1).describe(`Watch root directories for filesystem changes`),notifyOnChange:S().default(!0).describe(`Notify server when root contents change`)}).describe(`Roots configuration for MCP client`),y1e=h({resources:S().default(!1).describe(`Supports resource listing and retrieval`),resourceTemplates:S().default(!1).describe(`Supports dynamic resource templates`),tools:S().default(!1).describe(`Supports tool/function calling`),prompts:S().default(!1).describe(`Supports prompt templates`),sampling:S().default(!1).describe(`Supports sampling from LLMs`),logging:S().default(!1).describe(`Supports logging and debugging`)}),b1e=h({name:r().describe(`Server name`),version:r().describe(`Server version (semver)`),description:r().optional(),capabilities:y1e,protocolVersion:r().default(`2024-11-05`).describe(`MCP protocol version`),vendor:r().optional().describe(`Server vendor/provider`),homepage:r().url().optional().describe(`Server homepage URL`),documentation:r().url().optional().describe(`Documentation URL`)}),x1e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Server unique identifier (snake_case)`),label:r().describe(`Display name`),description:r().optional(),serverInfo:b1e,transport:s1e,resources:C(l1e).optional().describe(`Static resources`),resourceTemplates:C(u1e).optional().describe(`Dynamic resource templates`),tools:C(d1e).optional().describe(`Available tools`),prompts:C(m1e).optional().describe(`Prompt templates`),autoStart:S().default(!1).describe(`Auto-start server on system boot`),restartOnFailure:S().default(!0).describe(`Auto-restart on failure`),healthCheck:h({enabled:S().default(!0),interval:P().int().positive().default(6e4).describe(`Health check interval in milliseconds`),timeout:P().int().positive().default(5e3).describe(`Health check timeout in milliseconds`),endpoint:r().optional().describe(`Health check endpoint (for HTTP servers)`)}).optional(),permissions:h({allowedAgents:C(r()).optional().describe(`Agent names allowed to use this server`),allowedUsers:C(r()).optional().describe(`User IDs allowed to use this server`),requireAuth:S().default(!0)}).optional(),rateLimit:h({enabled:S().default(!1),requestsPerMinute:P().int().positive().optional(),requestsPerHour:P().int().positive().optional(),burstSize:P().int().positive().optional()}).optional(),tags:C(r()).optional(),status:E([`active`,`inactive`,`maintenance`,`deprecated`]).default(`active`),version:r().optional().default(`1.0.0`),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional(),streaming:h1e.optional().describe(`Streaming configuration`),toolApproval:g1e.optional().describe(`Tool approval configuration`),sampling:_1e.optional().describe(`LLM sampling configuration`)});h({uri:r().describe(`Resource URI to fetch`),parameters:d(r(),u()).optional().describe(`URI template parameters`)}),h({resource:l1e,content:u().describe(`Resource content`)}),h({toolName:r().describe(`Tool to invoke`),parameters:d(r(),u()).describe(`Tool parameters`),timeout:P().int().positive().optional(),confirmationProvided:S().optional().describe(`User confirmation for tools that require it`),context:h({userId:r().optional(),sessionId:r().optional(),agentName:r().optional(),metadata:d(r(),u()).optional()}).optional()}),h({toolName:r(),status:E([`success`,`error`,`timeout`,`cancelled`]),result:u().optional().describe(`Tool execution result`),error:h({code:r(),message:r(),details:u().optional()}).optional(),executionTime:P().nonnegative().optional().describe(`Execution time in milliseconds`),timestamp:r().datetime().optional()}),h({promptName:r().describe(`Prompt template to use`),arguments:d(r(),u()).optional().describe(`Prompt arguments`)}),h({promptName:r(),messages:C(p1e).describe(`Rendered prompt messages`)}),h({servers:C(x1e).describe(`MCP servers to connect to`),defaultTimeout:P().int().positive().default(3e4).describe(`Default timeout for requests`),enableCaching:S().default(!0).describe(`Enable client-side caching`),cacheMaxAge:P().int().nonnegative().default(300).describe(`Cache max age in seconds`),retryAttempts:P().int().min(0).max(5).default(3),retryDelay:P().int().positive().default(1e3),enableLogging:S().default(!0),logLevel:E([`debug`,`info`,`warn`,`error`]).default(`info`),roots:v1e.optional().describe(`Root directories/resources configuration`)});var y9=h({prompt:P().int().nonnegative().describe(`Input tokens`),completion:P().int().nonnegative().describe(`Output tokens`),total:P().int().nonnegative().describe(`Total tokens`)});h({operationId:r(),operationType:E([`conversation`,`orchestration`,`prediction`,`rag`,`nlq`]),agentName:r().optional().describe(`Agent that performed the operation`),modelId:r(),tokens:y9,cost:P().nonnegative().describe(`Cost in USD`),timestamp:r().datetime(),metadata:d(r(),u()).optional()}),E([`token`,`request`,`character`,`second`,`image`,`embedding`]);var S1e=E([`hourly`,`daily`,`weekly`,`monthly`,`quarterly`,`yearly`,`custom`]);h({id:r().describe(`Unique cost entry ID`),timestamp:r().datetime().describe(`ISO 8601 timestamp`),modelId:r().describe(`AI model used`),provider:r().describe(`AI provider (e.g., "openai", "anthropic")`),operation:r().describe(`Operation type (e.g., "chat_completion", "embedding")`),tokens:y9.optional().describe(`Standardized token usage`),requestCount:P().int().positive().default(1),promptCost:P().nonnegative().optional().describe(`Cost of prompt tokens`),completionCost:P().nonnegative().optional().describe(`Cost of completion tokens`),totalCost:P().nonnegative().describe(`Total cost in base currency`),currency:r().default(`USD`),sessionId:r().optional().describe(`Conversation session ID`),userId:r().optional().describe(`User who triggered the request`),agentId:r().optional().describe(`AI agent ID`),object:r().optional().describe(`Related object (e.g., "case", "project")`),recordId:r().optional().describe(`Related record ID`),tags:C(r()).optional(),metadata:d(r(),u()).optional()});var b9=E([`global`,`user`,`agent`,`object`,`project`,`department`]);h({type:b9,scope:r().optional().describe(`Scope identifier (userId, agentId, etc.)`),maxCost:P().nonnegative().describe(`Maximum cost limit`),currency:r().default(`USD`),period:S1e,customPeriodDays:P().int().positive().optional().describe(`Custom period in days`),softLimit:P().nonnegative().optional().describe(`Soft limit for warnings`),warnThresholds:C(P().min(0).max(1)).optional().describe(`Warning thresholds (e.g., [0.5, 0.8, 0.95])`),enforced:S().default(!0).describe(`Block requests when exceeded`),gracePeriodSeconds:P().int().nonnegative().default(0).describe(`Grace period after limit exceeded`),allowRollover:S().default(!1).describe(`Allow unused budget to rollover`),maxRolloverPercentage:P().min(0).max(1).optional().describe(`Max rollover as % of limit`),name:r().optional().describe(`Budget name`),description:r().optional(),active:S().default(!0),tags:C(r()).optional()});var C1e=h({budgetId:r(),type:b9,scope:r().optional(),periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),currentCost:P().nonnegative().default(0),maxCost:P().nonnegative(),currency:r().default(`USD`),percentageUsed:P().nonnegative().describe(`Usage as percentage (can exceed 1.0 if over budget)`),remainingCost:P().describe(`Remaining budget (can be negative if exceeded)`),isExceeded:S().default(!1),isWarning:S().default(!1),projectedCost:P().nonnegative().optional().describe(`Projected cost for period`),projectedOverage:P().nonnegative().optional().describe(`Projected overage`),lastUpdated:r().datetime().describe(`ISO 8601 timestamp`)}),w1e=E([`threshold_warning`,`threshold_critical`,`limit_exceeded`,`anomaly_detected`,`projection_exceeded`]),T1e=h({id:r(),timestamp:r().datetime().describe(`ISO 8601 timestamp`),type:w1e,severity:E([`info`,`warning`,`critical`]),budgetId:r().optional(),budgetType:b9.optional(),scope:r().optional(),message:r().describe(`Alert message`),currentCost:P().nonnegative(),maxCost:P().nonnegative().optional(),threshold:P().min(0).max(1).optional(),currency:r().default(`USD`),recommendations:C(r()).optional(),acknowledged:S().default(!1),acknowledgedBy:r().optional(),acknowledgedAt:r().datetime().optional(),resolved:S().default(!1),metadata:d(r(),u()).optional()}),E1e=E([`model`,`provider`,`user`,`agent`,`object`,`operation`,`date`,`hour`,`tag`]),x9=h({dimension:E1e,value:r().describe(`Dimension value (e.g., model ID, user ID)`),totalCost:P().nonnegative(),requestCount:P().int().nonnegative(),totalTokens:P().int().nonnegative().optional(),percentageOfTotal:P().min(0).max(1),periodStart:r().datetime().optional(),periodEnd:r().datetime().optional()}),D1e=h({periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),totalCost:P().nonnegative(),totalRequests:P().int().nonnegative(),totalTokens:P().int().nonnegative().optional(),currency:r().default(`USD`),averageCostPerRequest:P().nonnegative(),averageCostPerToken:P().nonnegative().optional(),averageRequestsPerDay:P().nonnegative(),costTrend:E([`increasing`,`decreasing`,`stable`]).optional(),trendPercentage:P().optional().describe(`% change vs previous period`),byModel:C(x9).optional(),byProvider:C(x9).optional(),byUser:C(x9).optional(),byAgent:C(x9).optional(),byOperation:C(x9).optional(),byDate:C(x9).optional(),topModels:C(x9).optional(),topUsers:C(x9).optional(),topAgents:C(x9).optional(),tokensPerDollar:P().nonnegative().optional(),requestsPerDollar:P().nonnegative().optional()}),O1e=h({id:r(),type:E([`switch_model`,`reduce_tokens`,`batch_requests`,`cache_results`,`adjust_parameters`,`limit_usage`]),title:r(),description:r(),estimatedSavings:P().nonnegative().optional(),savingsPercentage:P().min(0).max(1).optional(),priority:E([`low`,`medium`,`high`]),effort:E([`low`,`medium`,`high`]),actionable:S().default(!0),actionSteps:C(r()).optional(),targetModel:r().optional(),alternativeModel:r().optional(),affectedUsers:C(r()).optional(),status:E([`pending`,`accepted`,`rejected`,`implemented`]).default(`pending`),implementedAt:r().datetime().optional()});h({id:r(),name:r(),generatedAt:r().datetime().describe(`ISO 8601 timestamp`),periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),period:S1e,analytics:D1e,budgets:C(C1e).optional(),alerts:C(T1e).optional(),activeAlertCount:P().int().nonnegative().default(0),recommendations:C(O1e).optional(),previousPeriodCost:P().nonnegative().optional(),costChange:P().optional().describe(`Change vs previous period`),costChangePercentage:P().optional(),forecastedCost:P().nonnegative().optional(),forecastedBudgetStatus:E([`under`,`at`,`over`]).optional(),format:E([`summary`,`detailed`,`executive`]).default(`summary`),currency:r().default(`USD`)}),h({startDate:r().datetime().optional().describe(`ISO 8601 timestamp`),endDate:r().datetime().optional().describe(`ISO 8601 timestamp`),modelIds:C(r()).optional(),providers:C(r()).optional(),userIds:C(r()).optional(),agentIds:C(r()).optional(),operations:C(r()).optional(),sessionIds:C(r()).optional(),minCost:P().nonnegative().optional(),maxCost:P().nonnegative().optional(),tags:C(r()).optional(),groupBy:C(E1e).optional(),orderBy:E([`timestamp`,`cost`,`tokens`]).optional().default(`timestamp`),orderDirection:E([`asc`,`desc`]).optional().default(`desc`),limit:P().int().positive().optional(),offset:P().int().nonnegative().optional()});var k1e=E([`pinecone`,`weaviate`,`qdrant`,`milvus`,`chroma`,`pgvector`,`redis`,`opensearch`,`elasticsearch`,`custom`]),A1e=h({provider:E([`openai`,`cohere`,`huggingface`,`azure_openai`,`local`,`custom`]),model:r().describe(`Model name (e.g., "text-embedding-3-large")`),dimensions:P().int().positive().describe(`Embedding vector dimensions`),maxTokens:P().int().positive().optional().describe(`Maximum tokens per embedding`),batchSize:P().int().positive().optional().default(100).describe(`Batch size for embedding`),endpoint:r().url().optional().describe(`Custom endpoint URL`),apiKey:r().optional().describe(`API key`),secretRef:r().optional().describe(`Reference to stored secret`)}),j1e=I(`type`,[h({type:m(`fixed`),chunkSize:P().int().positive().describe(`Fixed chunk size in tokens/chars`),chunkOverlap:P().int().min(0).default(0).describe(`Overlap between chunks`),unit:E([`tokens`,`characters`]).default(`tokens`)}),h({type:m(`semantic`),model:r().optional().describe(`Model for semantic chunking`),minChunkSize:P().int().positive().default(100),maxChunkSize:P().int().positive().default(1e3)}),h({type:m(`recursive`),separators:C(r()).default([` + +`,` +`,` `,``]),chunkSize:P().int().positive(),chunkOverlap:P().int().min(0).default(0)}),h({type:m(`markdown`),maxChunkSize:P().int().positive().default(1e3),respectHeaders:S().default(!0).describe(`Keep headers with content`),respectCodeBlocks:S().default(!0).describe(`Keep code blocks intact`)})]),M1e=h({source:r().describe(`Document source (file path, URL, etc.)`),sourceType:E([`file`,`url`,`api`,`database`,`custom`]).optional(),title:r().optional(),author:r().optional().describe(`Document author`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`),tags:C(r()).optional(),category:r().optional(),language:r().optional().describe(`Document language (ISO 639-1 code)`),custom:d(r(),u()).optional().describe(`Custom metadata fields`)});h({id:r().describe(`Unique chunk identifier`),content:r().describe(`Chunk text content`),embedding:C(P()).optional().describe(`Embedding vector`),metadata:M1e,chunkIndex:P().int().min(0).describe(`Chunk position in document`),tokens:P().int().optional().describe(`Token count`)});var N1e=I(`type`,[h({type:m(`similarity`),topK:P().int().positive().default(5).describe(`Number of results to retrieve`),scoreThreshold:P().min(0).max(1).optional().describe(`Minimum similarity score`)}),h({type:m(`mmr`),topK:P().int().positive().default(5),fetchK:P().int().positive().default(20).describe(`Initial fetch size`),lambda:P().min(0).max(1).default(.5).describe(`Diversity vs relevance (0=diverse, 1=relevant)`)}),h({type:m(`hybrid`),topK:P().int().positive().default(5),vectorWeight:P().min(0).max(1).default(.7).describe(`Weight for vector search`),keywordWeight:P().min(0).max(1).default(.3).describe(`Weight for keyword search`)}),h({type:m(`parent_document`),topK:P().int().positive().default(5),retrieveParent:S().default(!0).describe(`Retrieve full parent document`)})]),P1e=h({enabled:S().default(!1),model:r().optional().describe(`Reranking model name`),provider:E([`cohere`,`huggingface`,`custom`]).optional(),topK:P().int().positive().default(3).describe(`Final number of results after reranking`)}),F1e=h({provider:k1e,indexName:r().describe(`Index/collection name`),namespace:r().optional().describe(`Namespace for multi-tenancy`),host:r().optional().describe(`Vector store host`),port:P().int().optional().describe(`Vector store port`),secretRef:r().optional().describe(`Reference to stored secret`),apiKey:r().optional().describe(`API key or reference to secret`),dimensions:P().int().positive().describe(`Vector dimensions`),metric:E([`cosine`,`euclidean`,`dotproduct`]).optional().default(`cosine`),batchSize:P().int().positive().optional().default(100),connectionPoolSize:P().int().positive().optional().default(10),timeout:P().int().positive().optional().default(3e4).describe(`Timeout in milliseconds`)}),I1e=h({type:E([`file`,`directory`,`url`,`api`,`database`,`custom`]),source:r().describe(`Source path, URL, or identifier`),fileTypes:C(r()).optional().describe(`Accepted file extensions (e.g., [".pdf", ".md"])`),recursive:S().optional().default(!1).describe(`Process directories recursively`),maxFileSize:P().int().optional().describe(`Maximum file size in bytes`),excludePatterns:C(r()).optional().describe(`Patterns to exclude`),extractImages:S().optional().default(!1).describe(`Extract text from images (OCR)`),extractTables:S().optional().default(!1).describe(`Extract and format tables`),loaderConfig:d(r(),u()).optional().describe(`Custom loader-specific config`)}),L1e=h({field:r().describe(`Metadata field to filter`),operator:E([`eq`,`neq`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`,`contains`]).default(`eq`),value:l([r(),P(),S(),C(l([r(),P()]))]).describe(`Filter value`)}),R1e=h({logic:E([`and`,`or`]).default(`and`),filters:C(l([L1e,F(()=>R1e)]))}),z1e=l([L1e,R1e,d(r(),l([r(),P(),S(),C(l([r(),P()]))]))]);h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Pipeline name (snake_case)`),label:r().describe(`Display name`),description:r().optional(),embedding:A1e,vectorStore:F1e,chunking:j1e,retrieval:N1e,reranking:P1e.optional(),loaders:C(I1e).optional().describe(`Document loaders`),maxContextTokens:P().int().positive().default(4e3).describe(`Maximum tokens in context`),contextWindow:P().int().positive().optional().describe(`LLM context window size`),metadataFilters:z1e.optional().describe(`Global filters for retrieval`),enableCache:S().default(!0),cacheTTL:P().int().positive().default(3600).describe(`Cache TTL in seconds`),cacheInvalidationStrategy:E([`time_based`,`manual`,`on_update`]).default(`time_based`).optional()}),h({query:r().describe(`User query`),pipelineName:r().describe(`Pipeline to use`),topK:P().int().positive().optional(),metadataFilters:d(r(),u()).optional(),conversationHistory:C(h({role:E([`user`,`assistant`,`system`]),content:r()})).optional(),includeMetadata:S().default(!0),includeSources:S().default(!0)}),h({query:r(),results:C(h({content:r(),score:P(),metadata:M1e.optional(),chunkId:r().optional()})),context:r().describe(`Assembled context for LLM`),tokens:y9.optional().describe(`Token usage for this query`),cost:P().nonnegative().optional().describe(`Cost for this query in USD`),retrievalTime:P().optional().describe(`Retrieval time in milliseconds`)}),h({name:r(),status:E([`active`,`indexing`,`error`,`disabled`]),documentsIndexed:P().int().min(0),lastIndexed:r().datetime().optional().describe(`ISO timestamp`),errorMessage:r().optional(),health:h({vectorStore:E([`healthy`,`unhealthy`,`unknown`]),embeddingService:E([`healthy`,`unhealthy`,`unknown`])}).optional()});var S9=E([`select`,`aggregate`,`filter`,`sort`,`compare`,`trend`,`insight`,`create`,`update`,`delete`]),B1e=h({type:E([`object`,`field`,`value`,`operator`,`function`,`timeframe`]),text:r().describe(`Original text from query`),value:u().describe(`Normalized value`),confidence:P().min(0).max(1).describe(`Confidence score`),span:w([P(),P()]).optional().describe(`Character span in query`)}),V1e=h({type:E([`absolute`,`relative`]),start:r().optional().describe(`Start date (ISO format)`),end:r().optional().describe(`End date (ISO format)`),relative:h({unit:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]),value:P().int(),direction:E([`past`,`future`,`current`]).default(`past`)}).optional(),text:r().describe(`Original timeframe text`)}),H1e=h({naturalLanguage:r().describe(`NL field name (e.g., "customer name")`),objectField:r().describe(`Actual field name (e.g., "account.name")`),object:r().describe(`Object name`),field:r().describe(`Field name`),confidence:P().min(0).max(1)}),U1e=h({userId:r().optional(),userRole:r().optional(),currentObject:r().optional().describe(`Current object being viewed`),currentRecordId:r().optional().describe(`Current record ID`),conversationHistory:C(h({query:r(),timestamp:r(),intent:S9.optional()})).optional(),defaultLimit:P().int().default(100),timezone:r().default(`UTC`),locale:r().default(`en-US`)}),W1e=h({originalQuery:r(),intent:S9,intentConfidence:P().min(0).max(1),entities:C(B1e),targetObject:r().optional().describe(`Primary object to query`),fields:C(H1e).optional(),timeframe:V1e.optional(),ast:d(r(),u()).describe(`Generated ObjectQL AST`),confidence:P().min(0).max(1).describe(`Overall confidence`),ambiguities:C(h({type:r(),description:r(),suggestions:C(r()).optional()})).optional().describe(`Detected ambiguities requiring clarification`),alternatives:C(h({interpretation:r(),confidence:P(),ast:u()})).optional()});h({query:r().describe(`Natural language query`),context:U1e.optional(),includeAlternatives:S().default(!1).describe(`Include alternative interpretations`),maxAlternatives:P().int().default(3),minConfidence:P().min(0).max(1).default(.5).describe(`Minimum confidence threshold`),executeQuery:S().default(!1).describe(`Execute query and return results`),maxResults:P().int().optional().describe(`Maximum results to return`)}),h({parseResult:W1e,results:C(d(r(),u())).optional().describe(`Query results`),totalCount:P().int().optional(),executionTime:P().optional().describe(`Execution time in milliseconds`),needsClarification:S().describe(`Whether query needs clarification`),tokens:y9.optional().describe(`Token usage for this query`),cost:P().nonnegative().optional().describe(`Cost for this query in USD`),suggestions:C(r()).optional().describe(`Query refinement suggestions`)}),h({query:r().describe(`Natural language query`),context:U1e.optional(),expectedIntent:S9,expectedObject:r().optional(),expectedAST:d(r(),u()).describe(`Expected ObjectQL AST`),category:r().optional().describe(`Example category`),tags:C(r()).optional(),notes:r().optional()}),h({modelId:r().describe(`Model from registry`),systemPrompt:r().optional().describe(`System prompt override`),includeSchema:S().default(!0).describe(`Include object schema in prompt`),includeExamples:S().default(!0).describe(`Include examples in prompt`),enableIntentDetection:S().default(!0),intentThreshold:P().min(0).max(1).default(.7),enableEntityRecognition:S().default(!0),entityRecognitionModel:r().optional(),enableFuzzyMatching:S().default(!0).describe(`Fuzzy match field names`),fuzzyMatchThreshold:P().min(0).max(1).default(.8),enableTimeframeDetection:S().default(!0),defaultTimeframe:r().optional().describe(`Default timeframe if not specified`),enableCaching:S().default(!0),cacheTTL:P().int().default(3600).describe(`Cache TTL in seconds`)}),h({totalQueries:P().int(),successfulQueries:P().int(),failedQueries:P().int(),averageConfidence:P().min(0).max(1),intentDistribution:d(r(),P().int()).describe(`Count by intent type`),topQueries:C(h({query:r(),count:P().int(),averageConfidence:P()})),averageParseTime:P().describe(`Average parse time in milliseconds`),averageExecutionTime:P().optional(),lowConfidenceQueries:C(h({query:r(),confidence:P(),timestamp:r().datetime()})),startDate:r().datetime().describe(`ISO timestamp`),endDate:r().datetime().describe(`ISO timestamp`)}),h({object:r().describe(`Object name`),field:r().describe(`Field name`),synonyms:C(r()).describe(`Natural language synonyms`),examples:C(r()).optional().describe(`Example queries using synonyms`)}),h({id:r(),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template name (snake_case)`),label:r(),pattern:r().describe(`Query pattern with placeholders`),variables:C(h({name:r(),type:E([`object`,`field`,`value`,`timeframe`]),required:S().default(!1)})),astTemplate:d(r(),u()).describe(`AST template with variable placeholders`),category:r().optional(),examples:C(r()).optional(),tags:C(r()).optional()});var G1e=E([`record_created`,`record_updated`,`field_changed`,`scheduled`,`manual`,`webhook`,`batch`]),K1e=E([`classify`,`extract`,`summarize`,`generate`,`predict`,`translate`,`sentiment`,`entity_recognition`,`anomaly_detection`,`recommendation`]),q1e=h({id:r().optional().describe(`Optional task ID for referencing`),name:r().describe(`Human-readable task name`),type:K1e,model:r().optional().describe(`Model ID from registry (uses default if not specified)`),promptTemplate:r().optional().describe(`Prompt template ID for this task`),inputFields:C(r()).describe(`Source fields to process (e.g., ["description", "comments"])`),inputSchema:d(r(),u()).optional().describe(`Validation schema for inputs`),inputContext:d(r(),u()).optional().describe(`Additional context for the AI model`),outputField:r().describe(`Target field to store the result`),outputSchema:d(r(),u()).optional().describe(`Validation schema for output`),outputFormat:E([`text`,`json`,`number`,`boolean`,`array`]).optional().default(`text`),classes:C(r()).optional().describe(`Valid classes for classification tasks`),multiClass:S().optional().default(!1).describe(`Allow multiple classes to be selected`),extractionSchema:d(r(),u()).optional().describe(`JSON schema for structured extraction`),maxLength:P().optional().describe(`Maximum length for generated content`),temperature:P().min(0).max(2).optional().describe(`Model temperature override`),fallbackValue:u().optional().describe(`Fallback value if AI task fails`),retryAttempts:P().int().min(0).max(5).optional().default(1),condition:r().optional().describe(`Formula condition - task only runs if TRUE`),description:r().optional(),active:S().optional().default(!0)}),J1e=h({field:r().describe(`Field name to monitor`),operator:E([`changed`,`changed_to`,`changed_from`,`is`,`is_not`]).optional().default(`changed`),value:u().optional().describe(`Value to compare against (for changed_to/changed_from/is/is_not)`)}),Y1e=h({type:E([`cron`,`interval`,`daily`,`weekly`,`monthly`]).default(`cron`),cron:r().optional().describe(`Cron expression (required if type is "cron")`),interval:P().optional().describe(`Interval in minutes (required if type is "interval")`),time:r().optional().describe(`Time of day for daily schedules (HH:MM format)`),dayOfWeek:P().int().min(0).max(6).optional().describe(`Day of week for weekly (0=Sunday)`),dayOfMonth:P().int().min(1).max(31).optional().describe(`Day of month for monthly`),timezone:r().optional().default(`UTC`)}),X1e=h({type:E([`field_update`,`send_email`,`create_record`,`update_related`,`trigger_flow`,`webhook`]),name:r().describe(`Action name`),config:d(r(),u()).describe(`Action-specific configuration`),condition:r().optional().describe(`Execute only if condition is TRUE`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Orchestration unique identifier (snake_case)`),label:r().describe(`Display name`),description:r().optional(),objectName:r().describe(`Target object for this orchestration`),trigger:G1e,fieldConditions:C(J1e).optional().describe(`Fields to monitor (for field_changed trigger)`),schedule:Y1e.optional().describe(`Schedule configuration (for scheduled trigger)`),webhookConfig:h({secret:r().optional().describe(`Webhook verification secret`),headers:d(r(),r()).optional().describe(`Expected headers`)}).optional().describe(`Webhook configuration (for webhook trigger)`),entryCriteria:r().optional().describe(`Formula condition - workflow only runs if TRUE`),aiTasks:C(q1e).describe(`AI tasks to execute in sequence`),postActions:C(X1e).optional().describe(`Actions after AI tasks complete`),executionMode:E([`sequential`,`parallel`]).optional().default(`sequential`).describe(`How to execute multiple AI tasks`),stopOnError:S().optional().default(!1).describe(`Stop workflow if any task fails`),timeout:P().optional().describe(`Maximum execution time in seconds`),priority:E([`low`,`normal`,`high`,`critical`]).optional().default(`normal`),enableLogging:S().optional().default(!0),enableMetrics:S().optional().default(!0),notifyOnFailure:C(r()).optional().describe(`User IDs to notify on failure`),active:S().optional().default(!0),version:r().optional().default(`1.0.0`),tags:C(r()).optional(),category:r().optional().describe(`Workflow category (e.g., "support", "sales", "hr")`),owner:r().optional().describe(`User ID of workflow owner`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`)}),h({workflowName:r().describe(`Orchestration to execute`),recordIds:C(r()).describe(`Records to process`),batchSize:P().int().min(1).max(1e3).optional().default(10),parallelism:P().int().min(1).max(10).optional().default(3),priority:E([`low`,`normal`,`high`]).optional().default(`normal`)}),h({workflowName:r(),recordId:r(),status:E([`success`,`partial_success`,`failed`,`skipped`]),executionTime:P().describe(`Execution time in milliseconds`),tasksExecuted:P().int().describe(`Number of tasks executed`),tasksSucceeded:P().int().describe(`Number of tasks succeeded`),tasksFailed:P().int().describe(`Number of tasks failed`),taskResults:C(h({taskId:r().optional(),taskName:r(),status:E([`success`,`failed`,`skipped`]),output:u().optional(),error:r().optional(),executionTime:P().optional().describe(`Task execution time in milliseconds`),modelUsed:r().optional(),tokensUsed:P().optional()})).optional(),tokens:y9.optional().describe(`Total token usage for this execution`),cost:P().nonnegative().optional().describe(`Total cost for this execution in USD`),error:r().optional(),startedAt:r().datetime().describe(`ISO timestamp`),completedAt:r().datetime().optional().describe(`ISO timestamp`)});var Z1e=E([`message_passing`,`shared_memory`,`blackboard`]),Q1e=E([`coordinator`,`specialist`,`critic`,`executor`]),$1e=h({agentId:r().describe(`Agent identifier (reference to AgentSchema.name)`),role:Q1e.describe(`Agent role within the group`),capabilities:C(r()).optional().describe(`List of capabilities this agent contributes`),dependencies:C(r()).optional().describe(`Agent IDs this agent depends on for input`),priority:P().int().min(0).optional().describe(`Execution priority (0 = highest)`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Group unique identifier (snake_case)`),label:r().describe(`Group display name`),description:r().optional(),strategy:E([`sequential`,`parallel`,`debate`,`hierarchical`,`swarm`]).describe(`Multi-agent orchestration strategy`),agents:C($1e).min(2).describe(`Agent members (minimum 2)`),communication:h({protocol:Z1e.describe(`Inter-agent communication protocol`),messageQueue:r().optional().describe(`Message queue identifier for async communication`),maxRounds:P().int().min(1).optional().describe(`Maximum communication rounds before forced termination`)}).describe(`Communication configuration`),conflictResolution:E([`voting`,`priorityBased`,`consensusBased`,`coordinatorDecides`]).optional().describe(`How conflicts between agents are resolved`),timeout:P().int().min(1).optional().describe(`Maximum execution time in seconds for the group`),active:S().default(!0).describe(`Whether this agent group is active`)});var e0e=E([`classification`,`regression`,`clustering`,`forecasting`,`anomaly_detection`,`recommendation`,`ranking`]),t0e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Feature name (snake_case)`),label:r().optional().describe(`Human-readable label`),field:r().describe(`Source field name`),object:r().optional().describe(`Source object (if different from target)`),dataType:E([`numeric`,`categorical`,`text`,`datetime`,`boolean`]).describe(`Feature data type`),transformation:E([`none`,`normalize`,`standardize`,`one_hot_encode`,`label_encode`,`log_transform`,`binning`,`embedding`]).optional().default(`none`),required:S().optional().default(!0),defaultValue:u().optional(),description:r().optional(),importance:P().optional().describe(`Feature importance score (0-1)`)}),n0e=h({learningRate:P().optional().describe(`Learning rate for training`),epochs:P().int().optional().describe(`Number of training epochs`),batchSize:P().int().optional().describe(`Training batch size`),maxDepth:P().int().optional().describe(`Maximum tree depth`),numTrees:P().int().optional().describe(`Number of trees in ensemble`),minSamplesSplit:P().int().optional().describe(`Minimum samples to split node`),minSamplesLeaf:P().int().optional().describe(`Minimum samples in leaf node`),hiddenLayers:C(P().int()).optional().describe(`Hidden layer sizes`),activation:r().optional().describe(`Activation function`),dropout:P().optional().describe(`Dropout rate`),l1Regularization:P().optional().describe(`L1 regularization strength`),l2Regularization:P().optional().describe(`L2 regularization strength`),numClusters:P().int().optional().describe(`Number of clusters (k-means, etc.)`),seasonalPeriod:P().int().optional().describe(`Seasonal period for time series`),forecastHorizon:P().int().optional().describe(`Number of periods to forecast`),custom:d(r(),u()).optional().describe(`Algorithm-specific parameters`)}),r0e=h({trainingDataRatio:P().min(0).max(1).optional().default(.8).describe(`Proportion of data for training`),validationDataRatio:P().min(0).max(1).optional().default(.1).describe(`Proportion for validation`),testDataRatio:P().min(0).max(1).optional().default(.1).describe(`Proportion for testing`),dataFilter:r().optional().describe(`Formula to filter training data`),minRecords:P().int().optional().default(100).describe(`Minimum records required`),maxRecords:P().int().optional().describe(`Maximum records to use`),strategy:E([`full`,`incremental`,`online`,`transfer_learning`]).optional().default(`full`),crossValidation:S().optional().default(!0),folds:P().int().min(2).max(10).optional().default(5).describe(`Cross-validation folds`),earlyStoppingEnabled:S().optional().default(!0),earlyStoppingPatience:P().int().optional().default(10).describe(`Epochs without improvement before stopping`),maxTrainingTime:P().optional().describe(`Maximum training time in seconds`),gpuEnabled:S().optional().default(!1),randomSeed:P().int().optional().describe(`Random seed for reproducibility`)}).superRefine((e,t)=>{if(e.trainingDataRatio&&e.validationDataRatio&&e.testDataRatio){let n=e.trainingDataRatio+e.validationDataRatio+e.testDataRatio;Math.abs(n-1)>.01&&t.addIssue({code:de.custom,message:`Data split ratios must sum to 1. Current sum: ${n}`,path:[`trainingDataRatio`]})}}),i0e=h({accuracy:P().optional(),precision:P().optional(),recall:P().optional(),f1Score:P().optional(),auc:P().optional().describe(`Area Under ROC Curve`),mse:P().optional().describe(`Mean Squared Error`),rmse:P().optional().describe(`Root Mean Squared Error`),mae:P().optional().describe(`Mean Absolute Error`),r2Score:P().optional().describe(`R-squared score`),silhouetteScore:P().optional(),daviesBouldinIndex:P().optional(),mape:P().optional().describe(`Mean Absolute Percentage Error`),smape:P().optional().describe(`Symmetric MAPE`),custom:d(r(),P()).optional()});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Model unique identifier (snake_case)`),label:r().describe(`Model display name`),description:r().optional(),type:e0e,algorithm:r().optional().describe(`Specific algorithm (e.g., "random_forest", "xgboost", "lstm")`),objectName:r().describe(`Target object for predictions`),target:r().describe(`Target field to predict`),targetType:E([`numeric`,`categorical`,`binary`]).optional().describe(`Target field type`),features:C(t0e).describe(`Input features for the model`),hyperparameters:n0e.optional(),training:r0e.optional(),metrics:i0e.optional().describe(`Evaluation metrics from last training`),deploymentStatus:E([`draft`,`training`,`trained`,`deployed`,`deprecated`]).optional().default(`draft`),version:r().optional().default(`1.0.0`),predictionField:r().optional().describe(`Field to store predictions`),confidenceField:r().optional().describe(`Field to store confidence scores`),updateTrigger:E([`on_create`,`on_update`,`manual`,`scheduled`]).optional().default(`on_create`),autoRetrain:S().optional().default(!1),retrainSchedule:r().optional().describe(`Cron expression for auto-retraining`),retrainThreshold:P().optional().describe(`Performance threshold to trigger retraining`),enableExplainability:S().optional().default(!1).describe(`Generate feature importance & explanations`),enableMonitoring:S().optional().default(!0),alertOnDrift:S().optional().default(!0).describe(`Alert when model drift is detected`),active:S().optional().default(!0),owner:r().optional().describe(`User ID of model owner`),permissions:C(r()).optional().describe(`User/group IDs with access`),tags:C(r()).optional(),category:r().optional().describe(`Model category (e.g., "sales", "marketing", "operations")`),lastTrainedAt:r().datetime().optional().describe(`ISO timestamp`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`)}),h({modelName:r().describe(`Model to use for prediction`),recordIds:C(r()).optional().describe(`Specific records to predict (if not provided, uses all)`),inputData:d(r(),u()).optional().describe(`Direct input data (alternative to recordIds)`),returnConfidence:S().optional().default(!0),returnExplanation:S().optional().default(!1)}),h({modelName:r(),modelVersion:r(),recordId:r().optional(),prediction:u().describe(`The predicted value`),confidence:P().optional().describe(`Confidence score (0-1)`),probabilities:d(r(),P()).optional().describe(`Class probabilities (for classification)`),explanation:h({topFeatures:C(h({feature:r(),importance:P(),value:u()})).optional(),reasoning:r().optional()}).optional(),tokens:y9.optional().describe(`Token usage for this prediction (if AI-powered)`),cost:P().nonnegative().optional().describe(`Cost for this prediction in USD`),metadata:h({executionTime:P().optional().describe(`Execution time in milliseconds`),timestamp:r().datetime().optional().describe(`ISO timestamp`)}).optional()}),h({modelName:r(),driftType:E([`feature_drift`,`prediction_drift`,`performance_drift`]),severity:E([`low`,`medium`,`high`,`critical`]),detectedAt:r().datetime().describe(`ISO timestamp`),metrics:h({driftScore:P().describe(`Drift magnitude (0-1)`),affectedFeatures:C(r()).optional(),performanceChange:P().optional().describe(`Change in performance metric`)}),recommendation:r().optional(),autoRetrainTriggered:S().optional().default(!1)});var a0e=E([`system`,`user`,`assistant`,`function`,`tool`]);E([`text`,`image`,`file`,`code`,`structured`]);var o0e=l([h({type:m(`text`),text:r().describe(`Text content`),metadata:d(r(),u()).optional()}),h({type:m(`image`),imageUrl:r().url().describe(`Image URL`),detail:E([`low`,`high`,`auto`]).optional().default(`auto`),metadata:d(r(),u()).optional()}),h({type:m(`file`),fileUrl:r().url().describe(`File attachment URL`),mimeType:r().describe(`MIME type`),fileName:r().optional(),metadata:d(r(),u()).optional()}),h({type:m(`code`),text:r().describe(`Code snippet`),language:r().optional().default(`text`),metadata:d(r(),u()).optional()})]),s0e=h({name:r().describe(`Function name`),arguments:r().describe(`JSON string of function arguments`),result:r().optional().describe(`Function execution result`)}),c0e=h({id:r().describe(`Tool call ID`),type:E([`function`]).default(`function`),function:s0e}),l0e=h({id:r().describe(`Unique message ID`),timestamp:r().datetime().describe(`ISO 8601 timestamp`),role:a0e,content:C(o0e).describe(`Message content (multimodal array)`),functionCall:s0e.optional().describe(`Legacy function call`),toolCalls:C(c0e).optional().describe(`Tool calls`),toolCallId:r().optional().describe(`Tool call ID this message responds to`),name:r().optional().describe(`Name of the function/user`),tokens:y9.optional().describe(`Token usage for this message`),cost:P().nonnegative().optional().describe(`Cost for this message in USD`),pinned:S().optional().default(!1).describe(`Prevent removal during pruning`),importance:P().min(0).max(1).optional().describe(`Importance score for pruning`),embedding:C(P()).optional().describe(`Vector embedding for semantic search`),metadata:d(r(),u()).optional()}),u0e=E([`fifo`,`importance`,`semantic`,`sliding_window`,`summary`]),d0e=h({maxTokens:P().int().positive().describe(`Maximum total tokens`),maxPromptTokens:P().int().positive().optional().describe(`Max tokens for prompt`),maxCompletionTokens:P().int().positive().optional().describe(`Max tokens for completion`),reserveTokens:P().int().nonnegative().default(500).describe(`Reserve tokens for system messages`),bufferPercentage:P().min(0).max(1).default(.1).describe(`Buffer percentage (0.1 = 10%)`),strategy:u0e.default(`sliding_window`),slidingWindowSize:P().int().positive().optional().describe(`Number of recent messages to keep`),minImportanceScore:P().min(0).max(1).optional().describe(`Minimum importance to keep`),semanticThreshold:P().min(0).max(1).optional().describe(`Semantic similarity threshold`),enableSummarization:S().default(!1).describe(`Enable context summarization`),summarizationThreshold:P().int().positive().optional().describe(`Trigger summarization at N tokens`),summaryModel:r().optional().describe(`Model ID for summarization`),warnThreshold:P().min(0).max(1).default(.8).describe(`Warn at % of budget (0.8 = 80%)`)}),f0e=h({promptTokens:P().int().nonnegative().default(0),completionTokens:P().int().nonnegative().default(0),totalTokens:P().int().nonnegative().default(0),budgetLimit:P().int().positive(),budgetUsed:P().int().nonnegative().default(0),budgetRemaining:P().int().nonnegative(),budgetPercentage:P().min(0).max(1).describe(`Usage as percentage of budget`),messageCount:P().int().nonnegative().default(0),prunedMessageCount:P().int().nonnegative().default(0),summarizedMessageCount:P().int().nonnegative().default(0)}),p0e=h({sessionId:r().describe(`Conversation session ID`),userId:r().optional().describe(`User identifier`),agentId:r().optional().describe(`AI agent identifier`),object:r().optional().describe(`Related object (e.g., "case", "project")`),recordId:r().optional().describe(`Related record ID`),scope:d(r(),u()).optional().describe(`Additional context scope`),systemMessage:r().optional().describe(`System prompt/instructions`),metadata:d(r(),u()).optional()});h({id:r().describe(`Unique session ID`),name:r().optional().describe(`Session name/title`),context:p0e,modelId:r().optional().describe(`AI model ID`),tokenBudget:d0e,messages:C(l0e).default([]),tokens:f0e.optional(),totalTokens:y9.optional().describe(`Total tokens across all messages`),totalCost:P().nonnegative().optional().describe(`Total cost for this session in USD`),status:E([`active`,`paused`,`completed`,`archived`]).default(`active`),createdAt:r().datetime().describe(`ISO 8601 timestamp`),updatedAt:r().datetime().describe(`ISO 8601 timestamp`),expiresAt:r().datetime().optional().describe(`ISO 8601 timestamp`),metadata:d(r(),u()).optional()}),h({summary:r().describe(`Conversation summary`),keyPoints:C(r()).optional().describe(`Key discussion points`),originalTokens:P().int().nonnegative().describe(`Original token count`),summaryTokens:P().int().nonnegative().describe(`Summary token count`),tokensSaved:P().int().nonnegative().describe(`Tokens saved`),messageRange:h({startIndex:P().int().nonnegative(),endIndex:P().int().nonnegative()}).describe(`Range of messages summarized`),generatedAt:r().datetime().describe(`ISO 8601 timestamp`),modelId:r().optional().describe(`Model used for summarization`)}),h({timestamp:r().datetime().describe(`Event timestamp`),prunedMessages:C(h({messageId:r(),role:a0e,tokens:P().int().nonnegative(),importance:P().min(0).max(1).optional()})),tokensFreed:P().int().nonnegative(),messagesRemoved:P().int().nonnegative(),remainingTokens:P().int().nonnegative(),remainingMessages:P().int().nonnegative()}),h({sessionId:r(),totalMessages:P().int().nonnegative(),userMessages:P().int().nonnegative(),assistantMessages:P().int().nonnegative(),systemMessages:P().int().nonnegative(),totalTokens:P().int().nonnegative(),averageTokensPerMessage:P().nonnegative(),peakTokenUsage:P().int().nonnegative(),pruningEvents:P().int().nonnegative().default(0),summarizationEvents:P().int().nonnegative().default(0),tokensSavedByPruning:P().int().nonnegative().default(0),tokensSavedBySummarization:P().int().nonnegative().default(0),duration:P().nonnegative().optional().describe(`Session duration in seconds`),firstMessageAt:r().datetime().optional().describe(`ISO 8601 timestamp`),lastMessageAt:r().datetime().optional().describe(`ISO 8601 timestamp`)});var m0e=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),h0e=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),g0e=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),_0e=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:m0e.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:h0e.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:g0e.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:_0e.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var v0e=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),y0e=h({field:r().describe(`Field name to apply masking to`),strategy:v0e.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(y0e).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var b0e=E(`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(`.`)),x0e=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:i$e.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var S0e=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var C0e=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),w0e=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),T0e=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),E0e=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),C9=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:b0e.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(x0e).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:S0e.optional().describe(`Configuration for currency field type`),vectorConfig:C0e.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:w0e.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:_0e.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:y0e.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:E0e.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:T0e.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),w9=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label for the rule listing`),description:r().optional().describe(`Administrative notes explaining the business reason`),active:S().default(!0),events:C(E([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:P().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:C(r()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:E([`error`,`warning`,`info`]).default(`error`),message:r().describe(`Error message to display to the user`)}),D0e=w9.extend({type:m(`script`),condition:r().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),O0e=w9.extend({type:m(`unique`),fields:C(r()).describe(`Fields that must be combined unique`),scope:r().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:S().default(!0)}),k0e=w9.extend({type:m(`state_machine`),field:r().describe(`State field (e.g. status)`),transitions:d(r(),C(r())).describe(`Map of { OldState: [AllowedNewStates] }`)}),A0e=w9.extend({type:m(`format`),field:r(),regex:r().optional(),format:E([`email`,`url`,`phone`,`json`]).optional()}),j0e=w9.extend({type:m(`cross_field`),condition:r().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:C(r()).describe(`Fields involved in the validation`)}),M0e=w9.extend({type:m(`json_schema`),field:r().describe(`JSON field to validate`),schema:d(r(),u()).describe(`JSON Schema object definition`)}),N0e=w9.extend({type:m(`async`),field:r().describe(`Field to validate`),validatorUrl:r().optional().describe(`External API endpoint for validation`),method:E([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:d(r(),r()).optional().describe(`Custom headers for the request`),validatorFunction:r().optional().describe(`Reference to custom validator function`),timeout:P().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:P().optional().describe(`Debounce delay in milliseconds`),params:d(r(),u()).optional().describe(`Additional parameters to pass to validator`)}),P0e=w9.extend({type:m(`custom`),handler:r().describe(`Name of the custom validation function registered in the system`),params:d(r(),u()).optional().describe(`Parameters passed to the custom handler`)}),T9=F(()=>I(`type`,[D0e,O0e,k0e,A0e,j0e,M0e,N0e,P0e,F0e])),F0e=w9.extend({type:m(`conditional`),when:r().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:T9.describe(`Validation rule to apply when condition is true`),otherwise:T9.optional().describe(`Validation rule to apply when condition is false`)});h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var E9=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),I0e=h({ariaLabel:E9.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var L0e=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),R0e=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:L0e.optional().describe(`Default number formatting rules`),dateFormat:R0e.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var z0e=h({name:r(),label:E9,type:b0e,required:S().default(!1),options:C(h({label:E9,value:r()})).optional()}),B0e=E([`script`,`url`,`modal`,`flow`,`api`]),V0e=new Set(B0e.options.filter(e=>e!==`script`)),H0e=h({name:a$e.describe(`Machine name (lowercase snake_case)`),label:E9.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:B0e.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(z0e).optional().describe(`Input parameters required from user`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:E9.optional().describe(`Confirmation message before execution`),successMessage:E9.optional().describe(`Success message to show after execution`),refreshAfter:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:I0e.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(V0e.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),U0e=E([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),W0e=h({trackHistory:S().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:S().default(!0).describe(`Index records for global search`),apiEnabled:S().default(!0).describe(`Expose object via automatic APIs`),apiMethods:C(U0e).optional().describe(`Whitelist of allowed API operations`),files:S().default(!1).describe(`Enable file attachments and document management`),feeds:S().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:S().default(!1).describe(`Enable standard tasks and events tracking`),trash:S().default(!0).describe(`Enable soft-delete with restore capability`),mru:S().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:S().default(!0).describe(`Allow record deep cloning`)}),G0e=h({name:r().optional().describe(`Index name (auto-generated if not provided)`),fields:C(r()).describe(`Fields included in the index`),type:E([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:S().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:r().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),K0e=h({fields:C(r()).describe(`Fields to index for full-text search weighting`),displayFields:C(r()).optional().describe(`Fields to display in search result cards`),filters:C(r()).optional().describe(`Default filters for search results`)}),q0e=h({enabled:S().describe(`Enable multi-tenancy for this object`),strategy:E([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:r().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:S().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),J0e=h({enabled:S().describe(`Enable soft delete (trash/recycle bin)`),field:r().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:S().default(!1).describe(`Cascade soft delete to related records`)}),Y0e=h({enabled:S().describe(`Enable record versioning`),strategy:E([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:P().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:r().default(`version`).describe(`Field name for version number/timestamp`)}),X0e=h({enabled:S().describe(`Enable table partitioning`),strategy:E([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:r().describe(`Field name to partition by`),interval:r().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"`}),Z0e=h({enabled:S().describe(`Enable Change Data Capture`),events:C(E([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:r().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),Q0e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:r().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:r().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:r().optional().describe(`Developer documentation / description`),icon:r().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:r().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:C(r()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:S().optional().default(!0).describe(`Is the object active and usable`),isSystem:S().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:S().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:r().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:r().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:d(r().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),C9).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:C(G0e).optional().describe(`Database performance indexes`),tenancy:q0e.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:J0e.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:Y0e.optional().describe(`Record versioning and history tracking configuration`),partitioning:X0e.optional().describe(`Table partitioning configuration for performance`),cdc:Z0e.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:C(T9).optional().describe(`Object-level validation rules`),stateMachines:d(r(),c$e).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:r().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:h({type:E([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:r().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:P().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:r().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:C(r()).optional().describe(`Primary fields for hover/cards/lookups`),search:K0e.optional().describe(`Search engine configuration`),enable:W0e.optional().describe(`Enabled system features modules`),recordTypes:C(r()).optional().describe(`Record type names for this object`),sharingModel:E([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:r().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:C(H0e).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function $0e(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var e2e=Object.assign(Q0e,{create:e=>{let t={...e,label:e.label??$0e(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return Q0e.parse(t)}});E([`own`,`extend`]),h({extend:r().describe(`Target object name (FQN) to extend`),fields:d(r(),C9).optional().describe(`Fields to add/override`),label:r().optional().describe(`Override label for the extended object`),pluralLabel:r().optional().describe(`Override plural label for the extended object`),description:r().optional().describe(`Override description for the extended object`),validations:C(T9).optional().describe(`Additional validation rules to merge into the target object`),indexes:C(G0e).optional().describe(`Additional indexes to merge into the target object`),priority:P().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)});var t2e=I(`type`,[h({type:m(`add_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to add`),field:C9.describe(`Full field definition to add`)}).describe(`Add a new field to an existing object`),h({type:m(`modify_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to modify`),changes:d(r(),u()).describe(`Partial field definition updates`)}).describe(`Modify properties of an existing field`),h({type:m(`remove_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to remove`)}).describe(`Remove a field from an existing object`),h({type:m(`create_object`),object:e2e.describe(`Full object definition to create`)}).describe(`Create a new object`),h({type:m(`rename_object`),oldName:r().describe(`Current object name`),newName:r().describe(`New object name`)}).describe(`Rename an existing object`),h({type:m(`delete_object`),objectName:r().describe(`Name of the object to delete`)}).describe(`Delete an existing object`),h({type:m(`execute_sql`),sql:r().describe(`Raw SQL statement to execute`),description:r().optional().describe(`Human-readable description of the SQL`)}).describe(`Execute a raw SQL statement`)]),n2e=h({migrationId:r().describe(`ID of the migration this depends on`),package:r().optional().describe(`Package that owns the dependency migration`)}).describe(`Dependency reference to another migration that must run first`),r2e=h({id:r().uuid().describe(`Unique identifier for this change set`),name:r().describe(`Human readable name for the migration`),description:r().optional().describe(`Detailed description of what this migration does`),author:r().optional().describe(`Author who created this migration`),createdAt:r().datetime().optional().describe(`ISO 8601 timestamp when the migration was created`),dependencies:C(n2e).optional().describe(`Migrations that must run before this one`),operations:C(t2e).describe(`Ordered list of atomic migration operations`),rollback:C(t2e).optional().describe(`Operations to reverse this migration`)}).describe(`A versioned set of atomic schema migration operations`),i2e=h({file:r().optional(),line:P().optional(),column:P().optional(),package:r().optional(),object:r().optional(),field:r().optional(),component:r().optional()}),a2e=h({id:r(),severity:E([`critical`,`error`,`warning`,`info`]),message:r(),stackTrace:r().optional(),timestamp:r().datetime(),userId:r().optional(),context:d(r(),u()).optional(),source:i2e.optional()}),o2e=h({issueId:r(),reasoning:r().describe(`Explanation of why this fix is needed`),confidence:P().min(0).max(1),fix:I(`type`,[h({type:m(`metadata_change`),changeSet:r2e}),h({type:m(`manual_intervention`),instructions:r()})])});h({issue:a2e,analysis:r().optional().describe(`AI analysis of the root cause`),resolutions:C(o2e).optional(),status:E([`open`,`analyzing`,`resolved`,`ignored`]).default(`open`)});var s2e=Object.defineProperty,c2e=Object.getOwnPropertyNames,D9=(e,t)=>function(){return e&&(t=(0,e[c2e(e)[0]])(e=0)),t},l2e=(e,t)=>{for(var n in t)s2e(e,n,{get:t[n],enumerable:!0})},u2e={};l2e(u2e,{AGGREGATE_DATA_TOOL:()=>M9,DATA_TOOL_DEFINITIONS:()=>h2e,GET_RECORD_TOOL:()=>j9,QUERY_RECORDS_TOOL:()=>A9,registerDataTools:()=>m2e});function d2e(e){return async t=>{let{objectName:n,where:r,fields:i,orderBy:a,limit:o,offset:s}=t,c=o??k9,l=Number.isFinite(c)&&c>0?Math.min(Math.floor(c),O9):k9,u=Number.isFinite(s)&&s>=0?Math.floor(s):void 0,d=await e.dataEngine.find(n,{where:r,fields:i,orderBy:a,limit:l,offset:u});return JSON.stringify({count:d.length,records:d})}}function f2e(e){return async t=>{let{objectName:n,recordId:r,fields:i}=t,a=await e.dataEngine.findOne(n,{where:{id:r},fields:i});return JSON.stringify(a||{error:`Record "${r}" not found in "${n}"`})}}function p2e(e){return async t=>{let{objectName:n,aggregations:r,groupBy:i,where:a}=t;for(let e of r)if(!N9.has(e.function))return JSON.stringify({error:`Invalid aggregation function "${e.function}". Allowed: ${[...N9].join(`, `)}`});let o=await e.dataEngine.aggregate(n,{where:a,groupBy:i,aggregations:r.map(e=>({function:e.function,field:e.field,alias:e.alias}))});return JSON.stringify(o)}}function m2e(e,t){e.register(A9,d2e(t)),e.register(j9,f2e(t)),e.register(M9,p2e(t))}var O9,k9,A9,j9,M9,h2e,N9,P9=D9({"src/tools/data-tools.ts"(){O9=200,k9=20,A9={name:`query_records`,description:`Query records from a data object with optional filters, field selection, sorting, and pagination. Returns an array of matching records.`,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`The snake_case name of the object to query`},where:{type:`object`,description:`Filter conditions as key-value pairs (e.g. { "status": "active" }) or MongoDB-style operators (e.g. { "amount": { "$gt": 100 } })`},fields:{type:`array`,items:{type:`string`},description:`List of field names to return (omit for all fields)`},orderBy:{type:`array`,items:{type:`object`,properties:{field:{type:`string`},order:{type:`string`,enum:[`asc`,`desc`]}}},description:`Sort order (e.g. [{ "field": "created_at", "order": "desc" }])`},limit:{type:`number`,description:`Maximum number of records to return (default ${k9}, max ${O9})`},offset:{type:`number`,description:`Number of records to skip for pagination`}},required:[`objectName`],additionalProperties:!1}},j9={name:`get_record`,description:`Get a single record by its ID from a data object.`,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`The snake_case name of the object`},recordId:{type:`string`,description:`The unique ID of the record`},fields:{type:`array`,items:{type:`string`},description:`List of field names to return (omit for all fields)`}},required:[`objectName`,`recordId`],additionalProperties:!1}},M9={name:`aggregate_data`,description:`Perform aggregation/statistical operations on a data object. Supports count, sum, avg, min, max with optional groupBy and where filters.`,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`The snake_case name of the object to aggregate`},aggregations:{type:`array`,items:{type:`object`,properties:{function:{type:`string`,enum:[`count`,`sum`,`avg`,`min`,`max`,`count_distinct`],description:`Aggregation function`},field:{type:`string`,description:`Field to aggregate (optional for count)`},alias:{type:`string`,description:`Result column alias`}},required:[`function`,`alias`]},description:`Aggregation definitions`},groupBy:{type:`array`,items:{type:`string`},description:`Fields to group by`},where:{type:`object`,description:`Filter conditions applied before aggregation`}},required:[`objectName`,`aggregations`],additionalProperties:!1}},h2e=[A9,j9,M9],N9=new Set([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`])}}),F9,g2e=D9({"src/tools/create-object.tool.ts"(){F9=h9({name:`create_object`,label:`Create Object`,description:`Creates a new data object (table) with the specified name, label, and optional field definitions. Use this when the user wants to create a new entity, table, or data model.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{name:{type:`string`,description:`Machine name for the object (snake_case, e.g. project_task)`},label:{type:`string`,description:`Human-readable display name (e.g. Project Task)`},fields:{type:`array`,description:`Initial fields to create with the object`,items:{type:`object`,properties:{name:{type:`string`,description:`Field machine name (snake_case)`},label:{type:`string`,description:`Field display name`},type:{type:`string`,description:`Field data type`,enum:[`text`,`textarea`,`number`,`boolean`,`date`,`datetime`,`select`,`lookup`,`formula`,`autonumber`]},required:{type:`boolean`,description:`Whether the field is required`}},required:[`name`,`type`]}},enableFeatures:{type:`object`,description:`Object capability flags`,properties:{trackHistory:{type:`boolean`},apiEnabled:{type:`boolean`}}}},required:[`name`,`label`],additionalProperties:!1}})}}),I9,_2e=D9({"src/tools/add-field.tool.ts"(){I9=h9({name:`add_field`,label:`Add Field`,description:`Adds a new field (column) to an existing data object. Use this when the user wants to add a property, column, or attribute to a table.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`Target object machine name (snake_case)`},name:{type:`string`,description:`Field machine name (snake_case, e.g. due_date)`},label:{type:`string`,description:`Human-readable field label (e.g. Due Date)`},type:{type:`string`,description:`Field data type`,enum:[`text`,`textarea`,`number`,`boolean`,`date`,`datetime`,`select`,`lookup`,`formula`,`autonumber`]},required:{type:`boolean`,description:`Whether the field is required`},defaultValue:{description:`Default value for the field`},options:{type:`array`,description:`Options for select/picklist fields`,items:{type:`object`,properties:{label:{type:`string`},value:{type:`string`,description:`Option machine identifier (lowercase snake_case, e.g. high_priority)`,pattern:`^[a-z_][a-z0-9_]*$`}}}},reference:{type:`string`,description:`Referenced object name for lookup fields (snake_case, e.g. account)`}},required:[`objectName`,`name`,`type`],additionalProperties:!1}})}}),L9,v2e=D9({"src/tools/modify-field.tool.ts"(){L9=h9({name:`modify_field`,label:`Modify Field`,description:`Modifies an existing field definition (label, type, required, default value, etc.) on a data object. Use this when the user wants to change or reconfigure an existing column or attribute (not rename it).`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`Target object machine name (snake_case)`},fieldName:{type:`string`,description:`Existing field machine name to modify (snake_case)`},changes:{type:`object`,description:`Field properties to update (partial patch)`,properties:{label:{type:`string`,description:`New display label`},type:{type:`string`,description:`New field type`},required:{type:`boolean`,description:`Update required constraint`},defaultValue:{description:`New default value`}}}},required:[`objectName`,`fieldName`,`changes`],additionalProperties:!1}})}}),R9,y2e=D9({"src/tools/delete-field.tool.ts"(){R9=h9({name:`delete_field`,label:`Delete Field`,description:`Removes a field (column) from an existing data object. This is a destructive operation. Use this when the user explicitly wants to remove an attribute or column from a table.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`Target object machine name (snake_case)`},fieldName:{type:`string`,description:`Field machine name to delete (snake_case)`}},required:[`objectName`,`fieldName`],additionalProperties:!1}})}}),z9,b2e=D9({"src/tools/list-objects.tool.ts"(){z9=h9({name:`list_objects`,label:`List Objects`,description:`Lists all registered data objects (tables) in the current environment. Use this when the user wants to see what tables, entities, or data models are available.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{filter:{type:`string`,description:`Optional name or label substring to filter objects`},includeFields:{type:`boolean`,description:`Whether to include field summaries for each object (default: false)`}},additionalProperties:!1}})}}),B9,x2e=D9({"src/tools/describe-object.tool.ts"(){B9=h9({name:`describe_object`,label:`Describe Object`,description:`Returns the full schema details of a data object, including all fields, types, relationships, and configuration. Use this to understand the structure of a table before querying or modifying it.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`Object machine name to describe (snake_case)`}},required:[`objectName`],additionalProperties:!1}})}}),S2e={};l2e(S2e,{METADATA_TOOL_DEFINITIONS:()=>A2e,addFieldTool:()=>I9,createObjectTool:()=>F9,deleteFieldTool:()=>R9,describeObjectTool:()=>B9,listObjectsTool:()=>z9,modifyFieldTool:()=>L9,registerMetadataTools:()=>k2e});function V9(e){return j2e.test(e)}function C2e(e){return async t=>{let{name:n,label:r,fields:i,enableFeatures:a}=t;if(!n||!r)return JSON.stringify({error:`Both "name" and "label" are required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});if(await e.metadataService.getObject(n))return JSON.stringify({error:`Object "${n}" already exists`});let o={};if(i&&Array.isArray(i)){let e=new Set;for(let t of i){if(!t.name)return JSON.stringify({error:`Each field must have a "name" property`});if(!V9(t.name))return JSON.stringify({error:`Invalid field name "${t.name}". Must be snake_case.`});if(e.has(t.name))return JSON.stringify({error:`Duplicate field name "${t.name}" in initial fields`});e.add(t.name),o[t.name]={type:t.type,...t.label?{label:t.label}:{},...t.required===void 0?{}:{required:t.required}}}}let s={name:n,label:r,...Object.keys(o).length>0?{fields:o}:{},...a?{enable:a}:{}};return await e.metadataService.register(`object`,n,s),JSON.stringify({name:n,label:r,fieldCount:Object.keys(o).length})}}function w2e(e){return async t=>{let{objectName:n,name:r,label:i,type:a,required:o,defaultValue:s,options:c,reference:l}=t;if(!n||!r||!a)return JSON.stringify({error:`"objectName", "name", and "type" are required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});if(!V9(r))return JSON.stringify({error:`Invalid field name "${r}". Must be snake_case.`});if(l&&!V9(l))return JSON.stringify({error:`Invalid reference "${l}". Must be a snake_case object name.`});if(c&&Array.isArray(c)){for(let e of c)if(e.value&&!V9(e.value))return JSON.stringify({error:`Invalid option value "${e.value}". Must be lowercase snake_case.`})}let u=await e.metadataService.getObject(n);if(!u)return JSON.stringify({error:`Object "${n}" not found`});let d=u;if(d.fields&&d.fields[r])return JSON.stringify({error:`Field "${r}" already exists on object "${n}"`});let f={type:a,...i?{label:i}:{},...o===void 0?{}:{required:o},...s===void 0?{}:{defaultValue:s},...c?{options:c}:{},...l?{reference:l}:{}},p={...d.fields??{},[r]:f};return await e.metadataService.register(`object`,n,{...d,fields:p}),JSON.stringify({objectName:n,fieldName:r,fieldType:a})}}function T2e(e){return async t=>{let{objectName:n,fieldName:r,changes:i}=t;if(!n||!r||!i)return JSON.stringify({error:`"objectName", "fieldName", and "changes" are required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});if(!V9(r))return JSON.stringify({error:`Invalid field name "${r}". Must be snake_case.`});let a=await e.metadataService.getObject(n);if(!a)return JSON.stringify({error:`Object "${n}" not found`});let o=a;if(!o.fields||!o.fields[r])return JSON.stringify({error:`Field "${r}" not found on object "${n}"`});let s={...o.fields[r],...i},c={...o.fields,[r]:s};return await e.metadataService.register(`object`,n,{...o,fields:c}),JSON.stringify({objectName:n,fieldName:r,updatedProperties:Object.keys(i)})}}function E2e(e){return async t=>{let{objectName:n,fieldName:r}=t;if(!n||!r)return JSON.stringify({error:`"objectName" and "fieldName" are required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});if(!V9(r))return JSON.stringify({error:`Invalid field name "${r}". Must be snake_case.`});let i=await e.metadataService.getObject(n);if(!i)return JSON.stringify({error:`Object "${n}" not found`});let a=i;if(!a.fields||!a.fields[r])return JSON.stringify({error:`Field "${r}" not found on object "${n}"`});let{[r]:o,...s}=a.fields;return await e.metadataService.register(`object`,n,{...a,fields:s}),JSON.stringify({objectName:n,fieldName:r,success:!0})}}function D2e(e){return async t=>{let{filter:n,includeFields:r}=t??{},i=(await e.metadataService.listObjects()).map(e=>{let t={name:e.name,label:e.label??e.name,fieldCount:e.fields?Object.keys(e.fields).length:0};return r&&e.fields&&(t.fields=Object.entries(e.fields).map(([e,t])=>({name:e,type:t.type,label:t.label??e}))),t});if(n){let e=n.toLowerCase();i=i.filter(t=>t.name.toLowerCase().includes(e)||t.label.toLowerCase().includes(e))}return JSON.stringify({objects:i,totalCount:i.length})}}function O2e(e){return async t=>{let{objectName:n}=t;if(!n)return JSON.stringify({error:`"objectName" is required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});let r=await e.metadataService.getObject(n);if(!r)return JSON.stringify({error:`Object "${n}" not found`});let i=r,a=i.fields??{},o=Object.entries(a).map(([e,t])=>({name:e,type:t.type,label:t.label??e,required:t.required??!1,...t.reference?{reference:t.reference}:{},...t.options?{options:t.options}:{}}));return JSON.stringify({name:i.name,label:i.label??i.name,fields:o,enableFeatures:i.enable??{}})}}function k2e(e,t){e.register(F9,C2e(t)),e.register(I9,w2e(t)),e.register(L9,T2e(t)),e.register(R9,E2e(t)),e.register(z9,D2e(t)),e.register(B9,O2e(t))}var A2e,j2e,H9=D9({"src/tools/metadata-tools.ts"(){g2e(),_2e(),v2e(),y2e(),b2e(),x2e(),g2e(),_2e(),v2e(),y2e(),b2e(),x2e(),A2e=[F9,I9,L9,R9,z9,B9],j2e=/^[a-z_][a-z0-9_]*$/}}),M2e=class{constructor(){this.name=`memory`}async chat(e,t){let n=[...e].reverse().find(e=>e.role===`user`),r=n?.content;return{content:n?`[memory] ${typeof r==`string`?r:`(complex content)`}`:`[memory] (no user message)`,model:t?.model??`memory`,usage:{promptTokens:0,completionTokens:0,totalTokens:0}}}async complete(e,t){return{content:`[memory] ${e}`,model:t?.model??`memory`,usage:{promptTokens:0,completionTokens:0,totalTokens:0}}}async*streamChat(e,t){let n=(await this.chat(e)).content.split(` `);for(let e=0;e[0,0,0])}async listModels(){return[`memory`]}},N2e=class{constructor(){this.definitions=new Map,this.handlers=new Map}register(e,t){this.definitions.set(e.name,e),this.handlers.set(e.name,t)}unregister(e){this.definitions.delete(e),this.handlers.delete(e)}has(e){return this.definitions.has(e)}getDefinition(e){return this.definitions.get(e)}getAll(){return Array.from(this.definitions.values())}get size(){return this.definitions.size}names(){return Array.from(this.definitions.keys())}async execute(e){let t=this.handlers.get(e.toolName);if(!t)return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:{type:`text`,value:`Tool "${e.toolName}" is not registered`},isError:!0};try{let n=await t(typeof e.input==`string`?JSON.parse(e.input):e.input??{});return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:{type:`text`,value:n}}}catch(t){let n=t instanceof Error?t.message:String(t);return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:{type:`text`,value:n},isError:!0}}}async executeAll(e){return Promise.all(e.map(e=>this.execute(e)))}clear(){this.definitions.clear(),this.handlers.clear()}},P2e=class{constructor(){this.store=new Map,this.counter=0}async create(e={}){let t=new Date().toISOString(),n=`conv_${++this.counter}`,r={id:n,title:e.title,agentId:e.agentId,userId:e.userId,messages:[],createdAt:t,updatedAt:t,metadata:e.metadata};return this.store.set(n,r),r}async get(e){return this.store.get(e)??null}async list(e={}){let t=Array.from(this.store.values());if(e.userId&&(t=t.filter(t=>t.userId===e.userId)),e.agentId&&(t=t.filter(t=>t.agentId===e.agentId)),e.cursor){let n=t.findIndex(t=>t.id===e.cursor);n>=0&&(t=t.slice(n+1))}return e.limit&&e.limit>0&&(t=t.slice(0,e.limit)),t}async addMessage(e,t){let n=this.store.get(e);if(!n)throw Error(`Conversation "${e}" not found`);return n.messages.push(t),n.updatedAt=new Date().toISOString(),n}async delete(e){this.store.delete(e)}get size(){return this.store.size}clear(){this.store.clear(),this.counter=0}};function U9(e,t){return{type:`text-delta`,id:e,text:t}}function W9(e){return{type:`finish`,finishReason:`stop`,totalUsage:e?.usage??{promptTokens:0,completionTokens:0,totalTokens:0},rawFinishReason:`stop`}}var F2e=class e{constructor(e={}){this.adapter=e.adapter??new M2e,this.logger=e.logger??$f({level:`info`,format:`pretty`}),this.toolRegistry=e.toolRegistry??new N2e,this.conversationService=e.conversationService??new P2e,this.logger.info(`[AI] Service initialized with adapter="${this.adapter.name}", tools=${this.toolRegistry.size}`)}get adapterName(){return this.adapter.name}async chat(e,t){return this.logger.debug(`[AI] chat`,{messageCount:e.length,model:t?.model}),this.adapter.chat(e,t)}async complete(e,t){return this.logger.debug(`[AI] complete`,{promptLength:e.length,model:t?.model}),this.adapter.complete(e,t)}async*streamChat(e,t){if(this.logger.debug(`[AI] streamChat`,{messageCount:e.length,model:t?.model}),!this.adapter.streamChat){let n=await this.adapter.chat(e,t);yield U9(`fallback`,n.content),yield W9(n);return}yield*this.adapter.streamChat(e,t)}async embed(e,t){if(!this.adapter.embed)throw Error(`[AI] Adapter "${this.adapter.name}" does not support embeddings`);return this.adapter.embed(e,t)}async listModels(){return this.adapter.listModels?this.adapter.listModels():[]}static extractOutputText(e){return e.output&&typeof e.output==`object`&&`value`in e.output?String(e.output.value):`unknown error`}async chatWithTools(t,n){let{maxIterations:r,onToolError:i,...a}=n??{},o=r??e.DEFAULT_MAX_ITERATIONS,s=[...this.toolRegistry.getAll(),...a.tools??[]],c={...a,tools:s.length>0?s:void 0,toolChoice:s.length>0?a.toolChoice??`auto`:void 0},l=[...t],u=[];this.logger.debug(`[AI] chatWithTools start`,{messageCount:l.length,toolCount:s.length,maxIterations:o});let d=!1;for(let t=0;te.toolName)});let r=[];n.content&&r.push({type:`text`,text:n.content}),r.push(...n.toolCalls),l.push({role:`assistant`,content:r});let a=await this.toolRegistry.executeAll(n.toolCalls);for(let r of a){if(r.isError){let a=n.toolCalls.find(e=>e.toolCallId===r.toolCallId),o=a?.toolName??`unknown`,s=e.extractOutputText(r),c={iteration:t,toolName:o,error:s};u.push(c),this.logger.warn(`[AI] chatWithTools tool error`,c),i&&a&&i(a,s)===`abort`&&(d=!0)}l.push({role:`tool`,content:[r]})}if(d)break}return d?this.logger.warn(`[AI] chatWithTools aborted by onToolError callback`,{toolErrors:u}):this.logger.warn(`[AI] chatWithTools max iterations reached, forcing final response`,{toolErrors:u.length>0?u:void 0}),await this.adapter.chat(l,{...c,tools:void 0,toolChoice:void 0})}async*streamChatWithTools(t,n){let{maxIterations:r,onToolError:i,...a}=n??{},o=r??e.DEFAULT_MAX_ITERATIONS,s=[...this.toolRegistry.getAll(),...a.tools??[]],c={...a,tools:s.length>0?s:void 0,toolChoice:s.length>0?a.toolChoice??`auto`:void 0},l=[...t],u=!1;for(let t=0;te.toolCallId===n.toolCallId);r&&i(r,e.extractOutputText(n))===`abort`&&(u=!0)}yield{type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,output:n.output},l.push({role:`tool`,content:[n]})}if(u)break}u?this.logger.warn(`[AI] streamChatWithTools aborted by onToolError callback`):this.logger.warn(`[AI] streamChatWithTools max iterations reached`);let d={...c,tools:void 0,toolChoice:void 0},f=await this.adapter.chat(l,d);yield U9(`stream`,f.content),yield W9(f)}};F2e.DEFAULT_MAX_ITERATIONS=10;var I2e=F2e;function G9(e){return`data: ${JSON.stringify(e)} + +`}function L2e(e,t){return`${e}:${JSON.stringify(t)} +`}function R2e(e){switch(e.type){case`text-delta`:return G9({type:`text-delta`,id:`0`,delta:e.text});case`tool-input-start`:return G9({type:`tool-input-start`,toolCallId:e.id,toolName:e.toolName});case`tool-input-delta`:return G9({type:`tool-input-delta`,toolCallId:e.id,inputTextDelta:e.delta});case`tool-call`:return G9({type:`tool-input-available`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input});case`tool-result`:return G9({type:`tool-output-available`,toolCallId:e.toolCallId,output:e.output});case`error`:return G9({type:`error`,errorText:String(e.error)});case`reasoning-start`:return L2e(`g`,{text:``});case`reasoning-delta`:return L2e(`g`,{text:e.text});case`reasoning-end`:return``;default:return e.type?.startsWith(`step-`)?G9(e):``}}async function*z2e(e){yield G9({type:`start`}),yield G9({type:`start-step`}),yield G9({type:`text-start`,id:`0`});let t=!0,n=`stop`;for await(let r of e){if(r.type===`finish`&&(n=r.finishReason??`stop`),r.type===`finish-step`||r.type===`finish`){t&&=(yield G9({type:`text-end`,id:`0`}),!1);continue}let e=R2e(r);e&&(yield e)}t&&(yield G9({type:`text-end`,id:`0`})),yield G9({type:`finish-step`}),yield G9({type:`finish`,finishReason:n}),yield`data: [DONE] + +`}function K9(e){let t=e.role;if(typeof e.content==`string`||Array.isArray(e.content))return{role:t,content:e.content};if(Array.isArray(e.parts)){let n=e.parts.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text);if(n.length>0)return{role:t,content:n.join(``)}}return{role:t,content:``}}function B2e(e,t){let n=e.content;if(Array.isArray(e.parts)||typeof n==`string`)return null;if(Array.isArray(n)){for(let e of n){if(typeof e!=`object`||!e)return`message.content array elements must be non-null objects`;let t=e;if(typeof t.type!=`string`)return`each message.content array element must have a string "type" property`;if(t.type===`text`&&typeof t.text!=`string`)return`message.content elements with type "text" must have a string "text" property`}return null}return n==null&&t?.allowEmptyContent?null:`message.content must be a string, an array, or include parts`}var V2e=new Set([`system`,`user`,`assistant`,`tool`]);function q9(e){if(typeof e!=`object`||!e)return`each message must be an object`;let t=e;return typeof t.role!=`string`||!V2e.has(t.role)?`message.role must be one of ${[...V2e].map(e=>`"${e}"`).join(`, `)}`:B2e(t,{allowEmptyContent:t.role===`assistant`||t.role===`tool`})}function H2e(e,t,n){return[{method:`POST`,path:`/api/v1/ai/chat`,description:`Chat completion (supports Vercel AI Data Stream Protocol)`,auth:!0,permissions:[`ai:chat`],handler:async t=>{let r=t.body??{},i=r.messages;if(!Array.isArray(i)||i.length===0)return{status:400,body:{error:`messages array is required`}};for(let e of i){let t=q9(e);if(t)return{status:400,body:{error:t}}}let a={...r.options??{},...r.model!=null&&{model:r.model},...r.temperature!=null&&{temperature:r.temperature},...r.maxTokens!=null&&{maxTokens:r.maxTokens}},o=r.system??r.systemPrompt;if(o!=null&&typeof o!=`string`)return{status:400,body:{error:`system/systemPrompt must be a string`}};let s=o,c=[...s?[{role:`system`,content:s}]:[],...i.map(e=>K9(e))];if(r.stream!==!1)try{return e.streamChatWithTools?{status:200,stream:!0,vercelDataStream:!0,contentType:`text/event-stream`,headers:{"Content-Type":`text/event-stream`,"Cache-Control":`no-cache`,Connection:`keep-alive`,"x-vercel-ai-ui-message-stream":`v1`},events:z2e(e.streamChatWithTools(c,a))}:{status:501,body:{error:`Streaming is not supported by the configured AI service`}}}catch(e){return n.error(`[AI Route] /chat stream error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}try{return{status:200,body:await e.chatWithTools(c,a)}}catch(e){return n.error(`[AI Route] /chat error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/chat/stream`,description:`SSE streaming chat completion`,auth:!0,permissions:[`ai:chat`],handler:async t=>{let{messages:r,options:i}=t.body??{};if(!Array.isArray(r)||r.length===0)return{status:400,body:{error:`messages array is required`}};for(let e of r){let t=q9(e);if(t)return{status:400,body:{error:t}}}try{return e.streamChat?{status:200,stream:!0,events:e.streamChat(r.map(e=>K9(e)),i)}:{status:501,body:{error:`Streaming is not supported by the configured AI service`}}}catch(e){return n.error(`[AI Route] /chat/stream error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/complete`,description:`Text completion`,auth:!0,permissions:[`ai:complete`],handler:async t=>{let{prompt:r,options:i}=t.body??{};if(!r||typeof r!=`string`)return{status:400,body:{error:`prompt string is required`}};try{return{status:200,body:await e.complete(r,i)}}catch(e){return n.error(`[AI Route] /complete error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`GET`,path:`/api/v1/ai/models`,description:`List available models`,auth:!0,permissions:[`ai:read`],handler:async()=>{try{return{status:200,body:{models:e.listModels?await e.listModels():[]}}}catch(e){return n.error(`[AI Route] /models error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/conversations`,description:`Create a conversation`,auth:!0,permissions:[`ai:conversations`],handler:async e=>{try{if(e.body!==void 0&&e.body!==null&&(typeof e.body!=`object`||Array.isArray(e.body)))return{status:400,body:{error:`Invalid request payload`}};let n={...e.body??{}};return e.user?.userId&&(n.userId=e.user.userId),{status:201,body:await t.create(n)}}catch(e){return n.error(`[AI Route] POST /conversations error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`GET`,path:`/api/v1/ai/conversations`,description:`List conversations`,auth:!0,permissions:[`ai:conversations`],handler:async e=>{try{let n=e.query??{},r={...n};if(typeof n.limit==`string`){let e=Number(n.limit);if(!Number.isFinite(e)||e<=0||!Number.isInteger(e))return{status:400,body:{error:`Invalid limit parameter`}};r.limit=e}return e.user?.userId&&(r.userId=e.user.userId),{status:200,body:{conversations:await t.list(r)}}}catch(e){return n.error(`[AI Route] GET /conversations error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/conversations/:id/messages`,description:`Add message to a conversation`,auth:!0,permissions:[`ai:conversations`],handler:async e=>{let r=e.params?.id;if(!r)return{status:400,body:{error:`conversation id is required`}};let i=e.body,a=q9(i);if(a)return{status:400,body:{error:a}};try{if(e.user?.userId){let n=await t.get(r);if(!n)return{status:404,body:{error:`Conversation "${r}" not found`}};if(n.userId&&n.userId!==e.user.userId)return{status:403,body:{error:`You do not have access to this conversation`}}}return{status:200,body:await t.addMessage(r,i)}}catch(e){let t=e instanceof Error?e.message:String(e);return t.includes(`not found`)?{status:404,body:{error:t}}:(n.error(`[AI Route] POST /conversations/:id/messages error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}})}}},{method:`DELETE`,path:`/api/v1/ai/conversations/:id`,description:`Delete a conversation`,auth:!0,permissions:[`ai:conversations`],handler:async e=>{let r=e.params?.id;if(!r)return{status:400,body:{error:`conversation id is required`}};try{if(e.user?.userId){let n=await t.get(r);if(!n)return{status:404,body:{error:`Conversation "${r}" not found`}};if(n.userId&&n.userId!==e.user.userId)return{status:403,body:{error:`You do not have access to this conversation`}}}return await t.delete(r),{status:204}}catch(e){return n.error(`[AI Route] DELETE /conversations/:id error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}}]}var U2e=new Set([`user`,`assistant`]);function W2e(e){if(typeof e!=`object`||!e)return`each message must be an object`;let t=e;return typeof t.role!=`string`||!U2e.has(t.role)?`message.role must be one of ${[...U2e].map(e=>`"${e}"`).join(`, `)} for agent chat`:B2e(t,{allowEmptyContent:t.role===`assistant`})}function G2e(e,t,n){return[{method:`GET`,path:`/api/v1/ai/agents`,description:`List all active AI agents`,auth:!0,permissions:[`ai:chat`],handler:async()=>{try{return{status:200,body:{agents:await t.listAgents()}}}catch(e){return n.error(`[AI Route] /agents list error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/agents/:agentName/chat`,description:`Chat with a specific AI agent (supports Vercel AI Data Stream Protocol)`,auth:!0,permissions:[`ai:chat`,`ai:agents`],handler:async r=>{let i=r.params?.agentName;if(!i)return{status:400,body:{error:`agentName parameter is required`}};let a=r.body??{},{messages:o,context:s,options:c}=a;if(!Array.isArray(o)||o.length===0)return{status:400,body:{error:`messages array is required`}};for(let e of o){let t=W2e(e);if(t)return{status:400,body:{error:t}}}let l=await t.loadAgent(i);if(!l)return{status:404,body:{error:`Agent "${i}" not found`}};if(!l.active)return{status:403,body:{error:`Agent "${i}" is not active`}};try{let n=t.buildSystemMessages(l,s),r=t.buildRequestOptions(l,e.toolRegistry.getAll()),i={};if(c){let e=new Set([`temperature`,`maxTokens`,`stop`]);for(let t of Object.keys(c))e.has(t)&&(i[t]=c[t])}let u={...r,...i},d=[...n,...o.map(e=>K9(e))],f={...u,maxIterations:l.planning?.maxIterations};return a.stream===!1?{status:200,body:await e.chatWithTools(d,f)}:e.streamChatWithTools?{status:200,stream:!0,vercelDataStream:!0,contentType:`text/event-stream`,headers:{"Content-Type":`text/event-stream`,"Cache-Control":`no-cache`,Connection:`keep-alive`,"x-vercel-ai-ui-message-stream":`v1`},events:z2e(e.streamChatWithTools(d,f))}:{status:501,body:{error:`Streaming is not supported by the configured AI service`}}}catch(e){return n.error(`[AI Route] /agents/:agentName/chat error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}}]}function K2e(e){return e?typeof e==`string`?e:typeof e==`object`&&`value`in e?String(e.value??``):JSON.stringify(e):``}function q2e(e,t){return[{method:`GET`,path:`/api/v1/ai/tools`,description:`List all registered AI tools`,auth:!0,permissions:[`ai:tools`],handler:async()=>{try{return{status:200,body:{tools:e.toolRegistry.getAll().map(e=>({name:e.name,description:e.description,category:e.category}))}}}catch(e){return t.error(`[AI Route] /tools list error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/tools/:toolName/execute`,description:`Execute a tool with parameters (playground/testing)`,auth:!0,permissions:[`ai:tools`,`ai:execute`],handler:async n=>{let r=n.params?.toolName;if(!r)return{status:400,body:{error:`toolName parameter is required`}};let{parameters:i}=n.body??{};if(!i||typeof i!=`object`)return{status:400,body:{error:`parameters object is required`}};try{if(!e.toolRegistry.has(r))return{status:404,body:{error:`Tool "${r}" not found`}};let n=Date.now(),a={type:`tool-call`,toolCallId:`playground-${Date.now()}`,toolName:r,input:i},o=await e.toolRegistry.execute(a),s=Date.now()-n;if(o.isError){let e=K2e(o.output);return t.error(`[AI Route] Tool execution error: ${r}`,Error(e)),{status:500,body:{error:e,duration:s}}}return{status:200,body:{result:K2e(o.output),duration:s,toolName:r}}}catch(e){return t.error(`[AI Route] /tools/:toolName/execute error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}}]}var J9=`ai_conversations`,Y9=`ai_messages`,J2e=[{field:`created_at`,order:`asc`},{field:`id`,order:`asc`}],Y2e=[{field:`created_at`,order:`asc`},{field:`id`,order:`asc`}],X2e=class{constructor(e){this.engine=e}async create(e={}){let t=new Date().toISOString(),n=`conv_${Vf()}`,r={id:n,title:e.title??null,agent_id:e.agentId??null,user_id:e.userId??null,metadata:e.metadata?JSON.stringify(e.metadata):null,created_at:t,updated_at:t};return await this.engine.insert(J9,r),{id:n,title:e.title,agentId:e.agentId,userId:e.userId,messages:[],createdAt:t,updatedAt:t,metadata:e.metadata}}async get(e){let t=await this.engine.findOne(J9,{where:{id:e}});if(!t)return null;let n=await this.engine.find(Y9,{where:{conversation_id:e},orderBy:Y2e});return this.toConversation(t,n)}async list(e={}){let t={};if(e.userId&&(t.user_id=e.userId),e.agentId&&(t.agent_id=e.agentId),e.cursor){let n=await this.engine.findOne(J9,{where:{id:e.cursor},fields:[`created_at`,`id`]});n&&(t.$or=[{created_at:{$gt:n.created_at}},{created_at:n.created_at,id:{$gt:n.id}}])}let n=await this.engine.find(J9,{where:Object.keys(t).length>0?t:void 0,orderBy:J2e,limit:e.limit&&e.limit>0?e.limit:void 0});return await Promise.all(n.map(async e=>{let t=await this.engine.find(Y9,{where:{conversation_id:e.id},orderBy:Y2e});return this.toConversation(e,t)}))}async addMessage(e,t){if(!await this.engine.findOne(J9,{where:{id:e}}))throw Error(`Conversation "${e}" not found`);let n=new Date().toISOString(),r=`msg_${Vf()}`,i,a=null,o=null;if(t.role===`system`||t.role===`user`)i=typeof t.content==`string`?t.content:JSON.stringify(t.content);else if(t.role===`assistant`)if(typeof t.content==`string`)i=t.content;else{let e=t.content,n=e.filter(e=>e.type===`text`).map(e=>e.text),r=e.filter(e=>e.type===`tool-call`);i=n.join(``),r.length>0&&(a=JSON.stringify(r))}else if(t.role===`tool`){i=JSON.stringify(t.content);let e=Array.isArray(t.content)?t.content[0]:void 0;e&&`toolCallId`in e&&(o=e.toolCallId)}else i=``;return await this.engine.insert(Y9,{id:r,conversation_id:e,role:t.role,content:i,tool_calls:a,tool_call_id:o,created_at:n}),await this.engine.update(J9,{id:e,updated_at:n},{where:{id:e}}),await this.get(e)}async delete(e){await this.engine.delete(Y9,{where:{conversation_id:e},multi:!0}),await this.engine.delete(J9,{where:{id:e}})}safeParse(e,t){if(e)try{return JSON.parse(e)}catch{return t}}toConversation(e,t){return{id:e.id,title:e.title??void 0,agentId:e.agent_id??void 0,userId:e.user_id??void 0,messages:t.map(e=>this.toMessage(e)),createdAt:e.created_at,updatedAt:e.updated_at,metadata:this.safeParse(e.metadata)}}toMessage(e){switch(e.role){case`system`:return{role:`system`,content:e.content};case`user`:return{role:`user`,content:e.content};case`assistant`:{let t=this.safeParse(e.tool_calls);if(t&&t.length>0){let n=[];return e.content&&n.push({type:`text`,text:e.content}),n.push(...t),{role:`assistant`,content:n}}return{role:`assistant`,content:e.content}}case`tool`:{let t=this.safeParse(e.content);return t&&t.length>0&&t[0]?.type===`tool-result`?{role:`tool`,content:t}:{role:`tool`,content:[{type:`tool-result`,toolCallId:e.tool_call_id??``,toolName:`unknown`,output:{type:`text`,value:e.content}}]}}default:return{role:`user`,content:e.content}}}},Z2e=O.create({namespace:`ai`,name:`conversations`,label:`AI Conversation`,pluralLabel:`AI Conversations`,icon:`message-square`,isSystem:!0,description:`Persistent AI conversation metadata`,fields:{id:j.text({label:`Conversation ID`,required:!0,readonly:!0}),title:j.text({label:`Title`,required:!1,maxLength:500,description:`Conversation title or summary`}),agent_id:j.text({label:`Agent ID`,required:!1,maxLength:255,description:`Associated AI agent identifier`}),user_id:j.text({label:`User ID`,required:!1,maxLength:255,description:`User who owns the conversation`}),metadata:j.textarea({label:`Metadata`,required:!1,description:`JSON-serialized conversation metadata`}),created_at:j.datetime({label:`Created At`,required:!0,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,required:!0,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`user_id`]},{fields:[`agent_id`]},{fields:[`created_at`]}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),Q2e=O.create({namespace:`ai`,name:`messages`,label:`AI Message`,pluralLabel:`AI Messages`,icon:`message-circle`,isSystem:!0,description:`Individual messages within AI conversations`,fields:{id:j.text({label:`Message ID`,required:!0,readonly:!0}),conversation_id:j.text({label:`Conversation ID`,required:!0,description:`Foreign key to ai_conversations`}),role:j.select({label:`Role`,required:!0,options:[{label:`System`,value:`system`},{label:`User`,value:`user`},{label:`Assistant`,value:`assistant`},{label:`Tool`,value:`tool`}]}),content:j.textarea({label:`Content`,required:!0,description:`Message content`}),tool_calls:j.textarea({label:`Tool Calls`,required:!1,description:`JSON-serialized tool calls (when role=assistant)`}),tool_call_id:j.text({label:`Tool Call ID`,required:!1,maxLength:255,description:`ID of the tool call this message responds to (when role=tool)`}),created_at:j.datetime({label:`Created At`,required:!0,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`conversation_id`]},{fields:[`conversation_id`,`created_at`]}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`],trash:!1,mru:!1}});P9(),H9();var $2e=class{constructor(e){this.metadataService=e}async listAgents(){let e=await this.metadataService.list(`agent`),t=[];for(let n of e){let e=m9.safeParse(n);e.success&&e.data.active&&t.push({name:e.data.name,label:e.data.label,role:e.data.role})}return t}async loadAgent(e){let t=await this.metadataService.get(`agent`,e);if(!t)return;let n=m9.safeParse(t);if(n.success)return n.data}buildSystemMessages(e,t){let n=[];if(n.push(e.instructions),t){let e=[];t.objectName&&e.push(`Current object: ${t.objectName}`),t.recordId&&e.push(`Selected record ID: ${t.recordId}`),t.viewName&&e.push(`Current view: ${t.viewName}`),e.length>0&&n.push(` +--- Current Context --- +`+e.join(` +`))}return[{role:`system`,content:n.join(` +`)}]}buildRequestOptions(e,t){let n={};if(e.model&&(n.model=e.model.model,n.temperature=e.model.temperature,n.maxTokens=e.model.maxTokens),e.tools&&e.tools.length>0){let r=new Map(t.map(e=>[e.name,e])),i=[];for(let t of e.tools){let e=r.get(t.name);e&&i.push(e)}i.length>0&&(n.tools=i,n.toolChoice=`auto`)}return n}},X9={name:`data_chat`,label:`Data Assistant`,role:`Business Data Analyst`,instructions:`You are a helpful data assistant that helps users explore and understand their business data through natural language. + +Capabilities: +- List available data objects (tables) and their schemas +- Query records with filters, sorting, and pagination +- Look up individual records by ID +- Perform aggregations and statistical analysis (count, sum, avg, min, max) + +Guidelines: +1. Always use the describe_object tool first to understand a table's structure before querying it. +2. Respect the user's current context — if they are viewing a specific object or record, use that as the default scope. +3. When presenting data, format it in a clear and readable way using markdown tables or bullet lists. +4. For large result sets, summarize the data and mention the total count. +5. When performing aggregations, explain the results in plain language. +6. If a query returns no results, suggest possible reasons and alternative queries. +7. Never expose internal IDs unless the user explicitly asks for them. +8. Always answer in the same language the user is using.`,model:{provider:`openai`,model:`gpt-4`,temperature:.3,maxTokens:4096},tools:[{type:`query`,name:`list_objects`,description:`List all available data objects`},{type:`query`,name:`describe_object`,description:`Get schema/fields of a data object`},{type:`query`,name:`query_records`,description:`Query records with filters and pagination`},{type:`query`,name:`get_record`,description:`Get a single record by ID`},{type:`query`,name:`aggregate_data`,description:`Aggregate/statistics on data`}],active:!0,visibility:`global`,guardrails:{maxTokensPerInvocation:8192,maxExecutionTimeSec:30,blockedTopics:[`delete_records`,`drop_table`,`alter_schema`]},planning:{strategy:`react`,maxIterations:5,allowReplan:!1},memory:{shortTerm:{maxMessages:20,maxTokens:4096}}},Z9={name:`metadata_assistant`,label:`Metadata Assistant`,role:`Schema Architect`,instructions:`You are an expert metadata architect that helps users design and manage their data models through natural language. + +Capabilities: +- Create new data objects (tables) with fields +- Add fields (columns) to existing objects +- Modify field properties (label, type, required, default value) +- Delete fields from objects +- List all registered metadata objects and their schemas +- Describe the full schema of a specific object + +Guidelines: +1. Before creating a new object, use list_objects to check if a similar one already exists. +2. Before modifying or deleting fields, use describe_object to understand the current schema. +3. Always use snake_case for object names and field names (e.g. project_task, due_date). +4. Suggest meaningful field types based on the user's description (e.g. "deadline" → date, "active" → boolean). +5. When creating objects, propose a reasonable set of initial fields based on the entity type. +6. Explain what changes you are about to make before executing them. +7. After making changes, confirm the result by describing the updated schema. +8. For destructive operations (deleting fields), always warn the user about potential data loss. +9. Always answer in the same language the user is using. +10. If the user's request is ambiguous, ask clarifying questions before proceeding.`,model:{provider:`openai`,model:`gpt-4`,temperature:.2,maxTokens:4096},tools:[{type:`action`,name:`create_object`,description:`Create a new data object (table)`},{type:`action`,name:`add_field`,description:`Add a field to an existing object`},{type:`action`,name:`modify_field`,description:`Modify an existing field definition`},{type:`action`,name:`delete_field`,description:`Delete a field from an object`},{type:`query`,name:`list_objects`,description:`List all data objects`},{type:`query`,name:`describe_object`,description:`Describe an object schema`}],active:!0,visibility:`global`,guardrails:{maxTokensPerInvocation:8192,maxExecutionTimeSec:60,blockedTopics:[`drop_database`,`raw_sql`,`system_tables`]},planning:{strategy:`react`,maxIterations:10,allowReplan:!0},memory:{shortTerm:{maxMessages:30,maxTokens:8192}}};function Q9(e){if(!e)return{};let t={};if(e.temperature!=null&&(t.temperature=e.temperature),e.maxTokens!=null&&(t.maxTokens=e.maxTokens),e.stop?.length&&(t.stopSequences=e.stop),e.tools?.length){let n={};for(let t of e.tools)n[t.name]=FC({description:t.description,inputSchema:DC(t.parameters)});t.tools=n}return e.toolChoice!=null&&(t.toolChoice=e.toolChoice),t}var e4e=class{constructor(e){this.name=`vercel`,this.model=e.model}async chat(e,t){let n=await YE({model:this.model,messages:e,...Q9(t)});return{content:n.text,model:n.response?.modelId,toolCalls:n.toolCalls?.length?n.toolCalls:void 0,usage:n.usage?{promptTokens:n.usage.inputTokens??0,completionTokens:n.usage.outputTokens??0,totalTokens:n.usage.totalTokens??0}:void 0}}async complete(e,t){let n=await YE({model:this.model,prompt:e,...Q9(t)});return{content:n.text,model:n.response?.modelId,usage:n.usage?{promptTokens:n.usage.inputTokens??0,completionTokens:n.usage.outputTokens??0,totalTokens:n.usage.totalTokens??0}:void 0}}async*streamChat(e,t){let n=Rme({model:this.model,messages:e,...Q9(t)});for await(let e of n.fullStream)yield e}async embed(e){throw Error(`[VercelLLMAdapter] Embeddings require a dedicated EmbeddingModel. Configure an embedding adapter instead.`)}async listModels(){return[]}},t4e=class{constructor(e={}){this.name=`com.objectstack.service-ai`,this.version=`1.0.0`,this.type=`standard`,this.dependencies=[`com.objectstack.engine.objectql`],this.options=e}async detectAdapter(e){let t={}.AI_GATEWAY_MODEL;if(t)try{let{gateway:e}=await Gf(async()=>{let{gateway:e}=await import(`@ai-sdk/gateway`);return{gateway:e}},[],import.meta.url);return{adapter:new e4e({model:e(t)}),description:`Vercel AI Gateway (model: ${t})`}}catch(n){e.logger.warn(`[AI] Failed to load @ai-sdk/gateway for AI_GATEWAY_MODEL=${t}, trying next provider`,n instanceof Error?{error:n.message}:void 0)}for(let{envKey:t,pkg:n,factory:r,defaultModel:i,displayName:a}of[{envKey:`OPENAI_API_KEY`,pkg:`@ai-sdk/openai`,factory:`openai`,defaultModel:`gpt-4o`,displayName:`OpenAI`},{envKey:`ANTHROPIC_API_KEY`,pkg:`@ai-sdk/anthropic`,factory:`anthropic`,defaultModel:`claude-sonnet-4-20250514`,displayName:`Anthropic`},{envKey:`GOOGLE_GENERATIVE_AI_API_KEY`,pkg:`@ai-sdk/google`,factory:`google`,defaultModel:`gemini-2.0-flash`,displayName:`Google`}])if({}[t])try{let e=await Gf(()=>import(n),[],import.meta.url),t=e[r]??e.default;if(typeof t==`function`){let e={}.AI_MODEL??i;return{adapter:new e4e({model:t(e)}),description:`${a} (model: ${e})`}}}catch(r){e.logger.warn(`[AI] Failed to load ${n} for ${t}, trying next provider`,r instanceof Error?{error:r.message}:void 0)}return e.logger.warn(`[AI] No LLM provider configured via environment variables. Falling back to MemoryLLMAdapter (echo mode). Set AI_GATEWAY_MODEL, OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_GENERATIVE_AI_API_KEY to use a real LLM.`),{adapter:new M2e,description:`MemoryLLMAdapter (echo mode - for testing only)`}}async init(e){let t=!1;try{let n=e.getService(`ai`);n&&typeof n.chat==`function`&&(t=!0,e.logger.debug(`[AI] Found existing AI service, replacing`))}catch{}let n=this.options.conversationService;if(!n)try{let t=e.getService(`data`);t&&typeof t.find==`function`&&(n=new X2e(t),e.logger.info(`[AI] Using ObjectQLConversationService (IDataEngine detected)`))}catch{}let r,i;if(this.options.adapter)r=this.options.adapter,i=`${r.name} (explicitly configured)`;else{let t=await this.detectAdapter(e);r=t.adapter,i=t.description}e.logger.info(`[AI] Using LLM adapter: ${i}`),this.service=new I2e({adapter:r,logger:e.logger,conversationService:n}),t?e.replaceService(`ai`,this.service):e.registerService(`ai`,this.service),e.getService(`manifest`).register({id:`com.objectstack.service-ai`,name:`AI Service`,version:`1.0.0`,type:`plugin`,namespace:`ai`,objects:[Z2e,Q2e]}),this.options.debug&&e.hook(`ai:beforeChat`,async t=>{e.logger.debug(`[AI] Before chat`,{messages:t})});try{let t=e.getService(`setupNav`);t&&(t.contribute({areaId:`area_ai`,items:[{id:`nav_ai_conversations`,type:`object`,label:`Conversations`,objectName:`conversations`,icon:`message-square`,order:10},{id:`nav_ai_messages`,type:`object`,label:`Messages`,objectName:`messages`,icon:`messages-square`,order:20}]}),e.logger.info(`[AI] Navigation items contributed to Setup App`))}catch{}e.logger.info(`[AI] Service initialized`)}async start(e){if(!this.service)return;let t;try{t=e.getService(`metadata`),console.log(`[AI Plugin] Retrieved metadata service:`,!!t,`has getRegisteredTypes:`,typeof t?.getRegisteredTypes)}catch(t){console.log(`[AI] Metadata service not available:`,t.message),e.logger.debug(`[AI] Metadata service not available`)}try{let n=e.getService(`data`);if(n){if(m2e(this.service.toolRegistry,{dataEngine:n}),e.logger.info(`[AI] Built-in data tools registered`),t){let{DATA_TOOL_DEFINITIONS:n}=await Promise.resolve().then(()=>(P9(),u2e));for(let e of n)typeof t.exists==`function`&&await t.exists(`tool`,e.name)||await t.register(`tool`,e.name,e);e.logger.info(`[AI] ${n.length} data tools registered as metadata`)}if(t)try{typeof t.exists==`function`&&await t.exists(`agent`,X9.name)?(console.log(`[AI] data_chat agent already exists, skipping`),e.logger.debug(`[AI] data_chat agent already exists, skipping auto-registration`)):(await t.register(`agent`,X9.name,X9),console.log(`[AI] Registered data_chat agent to metadataService`),e.logger.info(`[AI] data_chat agent registered`))}catch(t){e.logger.warn(`[AI] Failed to register data_chat agent`,t instanceof Error?{error:t.message,stack:t.stack}:{error:String(t)})}}}catch{e.logger.debug(`[AI] Data engine not available, skipping data tools`)}if(t)try{k2e(this.service.toolRegistry,{metadataService:t}),e.logger.info(`[AI] Built-in metadata tools registered`);let{METADATA_TOOL_DEFINITIONS:n}=await Promise.resolve().then(()=>(H9(),S2e));for(let e of n)typeof t.exists==`function`&&await t.exists(`tool`,e.name)||await t.register(`tool`,e.name,e);e.logger.info(`[AI] ${n.length} metadata tools registered as metadata`);try{typeof t.exists==`function`&&await t.exists(`agent`,Z9.name)?(console.log(`[AI] metadata_assistant agent already exists, skipping`),e.logger.debug(`[AI] metadata_assistant agent already exists, skipping auto-registration`)):(await t.register(`agent`,Z9.name,Z9),console.log(`[AI] Registered metadata_assistant agent to metadataService`),e.logger.info(`[AI] metadata_assistant agent registered`))}catch(t){e.logger.warn(`[AI] Failed to register metadata_assistant agent`,t instanceof Error?{error:t.message,stack:t.stack}:{error:String(t)})}}catch(t){e.logger.debug(`[AI] Failed to register metadata tools`,t instanceof Error?t:void 0)}await e.trigger(`ai:ready`,this.service);let n=H2e(this.service,this.service.conversationService,e.logger),r=q2e(this.service,e.logger);if(n.push(...r),e.logger.info(`[AI] Tool routes registered (${r.length} routes)`),t){let r=new $2e(t),i=G2e(this.service,r,e.logger);n.push(...i),e.logger.info(`[AI] Agent routes registered (${i.length} routes)`)}else e.logger.debug(`[AI] Metadata service not available, skipping agent routes`);await e.trigger(`ai:routes`,n);let i=e.getKernel();i&&(i.__aiRoutes=n),e.logger.info(`[AI] Service started \u2014 adapter="${this.service.adapterName}", tools=${this.service.toolRegistry.size}, routes=${n.length}`)}async destroy(){this.service=void 0}};P9(),H9(),H9();var n4e=class{constructor(e={}){this.items=new Map,this.counter=0,this.subscriptions=new Map,this.maxItems=e.maxItems??0}async listFeed(e){let t=Array.from(this.items.values()).filter(t=>t.object===e.object&&t.recordId===e.recordId);e.filter&&e.filter!==`all`&&(t=t.filter(t=>{switch(e.filter){case`comments_only`:return t.type===`comment`;case`changes_only`:return t.type===`field_change`;case`tasks_only`:return t.type===`task`;default:return!0}})),t.sort((e,t)=>{let n=new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime();return n===0?t.ide.id):n});let n=t.length,r=e.limit??20,i=0;if(e.cursor){let n=t.findIndex(t=>t.id===e.cursor);n>=0&&(i=n+1)}let a=t.slice(i,i+r),o=i+r0?a[a.length-1].id:void 0,hasMore:o}}async createFeedItem(e){if(this.maxItems>0&&this.items.size>=this.maxItems)throw Error(`Maximum feed item limit reached (${this.maxItems}). Delete existing items before adding new ones.`);let t=`feed_${++this.counter}`,n=new Date().toISOString();if(e.parentId){let t=this.items.get(e.parentId);if(!t)throw Error(`Parent feed item not found: ${e.parentId}`);let r={...t,replyCount:(t.replyCount??0)+1,updatedAt:n};this.items.set(t.id,r)}let r={id:t,type:e.type,object:e.object,recordId:e.recordId,actor:{type:e.actor.type,id:e.actor.id,...e.actor.name?{name:e.actor.name}:{},...e.actor.avatarUrl?{avatarUrl:e.actor.avatarUrl}:{}},...e.body===void 0?{}:{body:e.body},...e.mentions?{mentions:e.mentions}:{},...e.changes?{changes:e.changes}:{},...e.parentId?{parentId:e.parentId}:{},visibility:e.visibility??`public`,replyCount:0,isEdited:!1,pinned:!1,starred:!1,createdAt:n};return this.items.set(t,r),r}async updateFeedItem(e,t){let n=this.items.get(e);if(!n)throw Error(`Feed item not found: ${e}`);let r=new Date().toISOString(),i={...n,...t.body===void 0?{}:{body:t.body},...t.mentions===void 0?{}:{mentions:t.mentions},...t.visibility===void 0?{}:{visibility:t.visibility},updatedAt:r,editedAt:r,isEdited:!0};return this.items.set(e,i),i}async deleteFeedItem(e){let t=this.items.get(e);if(!t)throw Error(`Feed item not found: ${e}`);if(t.parentId){let e=this.items.get(t.parentId);if(e){let t={...e,replyCount:Math.max(0,(e.replyCount??0)-1)};this.items.set(e.id,t)}}this.items.delete(e)}async getFeedItem(e){return this.items.get(e)??null}async addReaction(e,t,n){let r=this.items.get(e);if(!r)throw Error(`Feed item not found: ${e}`);let i=[...r.reactions??[]],a=i.find(e=>e.emoji===t);if(a){if(a.userIds.includes(n))throw Error(`Reaction already exists: ${t} by ${n}`);a.userIds=[...a.userIds,n],a.count=a.userIds.length}else i.push({emoji:t,userIds:[n],count:1});let o={...r,reactions:i};return this.items.set(e,o),i}async removeReaction(e,t,n){let r=this.items.get(e);if(!r)throw Error(`Feed item not found: ${e}`);let i=[...r.reactions??[]],a=i.find(e=>e.emoji===t);if(!a||!a.userIds.includes(n))throw Error(`Reaction not found: ${t} by ${n}`);a.userIds=a.userIds.filter(e=>e!==n),a.count=a.userIds.length,i=i.filter(e=>e.count>0);let o={...r,reactions:i};return this.items.set(e,o),i}async subscribe(e){let t=this.subscriptionKey(e.object,e.recordId,e.userId),n=this.findSubscription(e.object,e.recordId,e.userId);if(n){let r={...n,events:e.events??n.events,channels:e.channels??n.channels,active:!0};return this.subscriptions.set(t,r),r}let r=new Date().toISOString(),i={object:e.object,recordId:e.recordId,userId:e.userId,events:e.events??[`all`],channels:e.channels??[`in_app`],active:!0,createdAt:r};return this.subscriptions.set(t,i),i}async unsubscribe(e,t,n){let r=this.subscriptionKey(e,t,n);return this.subscriptions.delete(r)}async getSubscription(e,t,n){return this.findSubscription(e,t,n)}getItemCount(){return this.items.size}getSubscriptionCount(){return this.subscriptions.size}subscriptionKey(e,t,n){return`${e}:${t}:${n}`}findSubscription(e,t,n){let r=this.subscriptionKey(e,t,n);return this.subscriptions.get(r)??null}},r4e=O.create({name:`sys_feed_item`,label:`Feed Item`,pluralLabel:`Feed Items`,icon:`message-square`,description:`Unified activity timeline entries (comments, field changes, tasks, events)`,titleFormat:`{type}: {body}`,compactLayout:[`type`,`object`,`record_id`,`created_at`],fields:{id:j.text({label:`Feed Item ID`,required:!0,readonly:!0}),type:j.select({label:`Type`,required:!0,options:[{label:`Comment`,value:`comment`},{label:`Field Change`,value:`field_change`},{label:`Task`,value:`task`},{label:`Event`,value:`event`},{label:`Email`,value:`email`},{label:`Call`,value:`call`},{label:`Note`,value:`note`},{label:`File`,value:`file`},{label:`Record Create`,value:`record_create`},{label:`Record Delete`,value:`record_delete`},{label:`Approval`,value:`approval`},{label:`Sharing`,value:`sharing`},{label:`System`,value:`system`}]}),object:j.text({label:`Object Name`,required:!0,searchable:!0}),record_id:j.text({label:`Record ID`,required:!0,searchable:!0}),actor_type:j.select({label:`Actor Type`,required:!0,options:[{label:`User`,value:`user`},{label:`System`,value:`system`},{label:`Service`,value:`service`},{label:`Automation`,value:`automation`}]}),actor_id:j.text({label:`Actor ID`,required:!0}),actor_name:j.text({label:`Actor Name`}),actor_avatar_url:j.url({label:`Actor Avatar URL`}),body:j.textarea({label:`Body`,description:`Rich text body (Markdown supported)`}),mentions:j.textarea({label:`Mentions`,description:`Array of @mention objects (JSON)`}),changes:j.textarea({label:`Field Changes`,description:`Array of field change entries (JSON)`}),reactions:j.textarea({label:`Reactions`,description:`Array of emoji reaction objects (JSON)`}),parent_id:j.text({label:`Parent Feed Item ID`,description:`For threaded replies`}),reply_count:j.number({label:`Reply Count`,defaultValue:0}),visibility:j.select({label:`Visibility`,defaultValue:`public`,options:[{label:`Public`,value:`public`},{label:`Internal`,value:`internal`},{label:`Private`,value:`private`}]}),is_edited:j.boolean({label:`Is Edited`,defaultValue:!1}),edited_at:j.datetime({label:`Edited At`}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`object`,`record_id`],unique:!1},{fields:[`actor_id`],unique:!1},{fields:[`parent_id`],unique:!1},{fields:[`created_at`],unique:!1}],enable:{trackHistory:!1,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),i4e=O.create({name:`sys_feed_reaction`,label:`Feed Reaction`,pluralLabel:`Feed Reactions`,icon:`smile`,description:`Emoji reactions on feed items`,titleFormat:`{emoji} by {user_id}`,compactLayout:[`feed_item_id`,`emoji`,`user_id`],fields:{id:j.text({label:`Reaction ID`,required:!0,readonly:!0}),feed_item_id:j.text({label:`Feed Item ID`,required:!0}),emoji:j.text({label:`Emoji`,required:!0,description:`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`}),user_id:j.text({label:`User ID`,required:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`feed_item_id`,`emoji`,`user_id`],unique:!0},{fields:[`feed_item_id`],unique:!1},{fields:[`user_id`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`delete`],trash:!1,mru:!1}}),a4e=O.create({name:`sys_record_subscription`,label:`Record Subscription`,pluralLabel:`Record Subscriptions`,icon:`bell`,description:`Record-level notification subscriptions for feed events`,titleFormat:`{object}/{record_id} — {user_id}`,compactLayout:[`object`,`record_id`,`user_id`,`active`],fields:{id:j.text({label:`Subscription ID`,required:!0,readonly:!0}),object:j.text({label:`Object Name`,required:!0}),record_id:j.text({label:`Record ID`,required:!0}),user_id:j.text({label:`User ID`,required:!0}),events:j.textarea({label:`Subscribed Events`,description:`Array of event types: comment, mention, field_change, task, approval, all (JSON)`}),channels:j.textarea({label:`Notification Channels`,description:`Array of channels: in_app, email, push, slack (JSON)`}),active:j.boolean({label:`Active`,defaultValue:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`object`,`record_id`,`user_id`],unique:!0},{fields:[`user_id`],unique:!1},{fields:[`object`,`record_id`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),o4e=class{constructor(e={}){this.name=`com.objectstack.service.feed`,this.version=`1.0.0`,this.type=`standard`,this.dependencies=[`com.objectstack.engine.objectql`],this.options={adapter:`memory`,...e}}async init(e){let t=new n4e(this.options.memory);e.registerService(`feed`,t),e.getService(`manifest`).register({id:`com.objectstack.service.feed`,name:`Feed Service`,version:`1.0.0`,type:`plugin`,objects:[r4e,i4e,a4e]}),e.logger.info(`FeedServicePlugin: registered in-memory feed adapter`)}},s4e=O.create({namespace:`sys`,name:`user`,label:`User`,pluralLabel:`Users`,icon:`user`,isSystem:!0,description:`User accounts for authentication`,titleFormat:`{name} ({email})`,compactLayout:[`name`,`email`,`email_verified`],fields:{id:j.text({label:`User ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),email:j.email({label:`Email`,required:!0,searchable:!0}),email_verified:j.boolean({label:`Email Verified`,defaultValue:!1}),name:j.text({label:`Name`,required:!0,searchable:!0,maxLength:255}),image:j.url({label:`Profile Image`,required:!1})},indexes:[{fields:[`email`],unique:!0},{fields:[`created_at`],unique:!1}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!0},validations:[{name:`email_unique`,type:`unique`,severity:`error`,message:`Email must be unique`,fields:[`email`],caseSensitive:!1}]}),c4e=O.create({namespace:`sys`,name:`session`,label:`Session`,pluralLabel:`Sessions`,icon:`key`,isSystem:!0,description:`Active user sessions`,titleFormat:`Session {token}`,compactLayout:[`user_id`,`expires_at`,`ip_address`],fields:{id:j.text({label:`Session ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),user_id:j.text({label:`User ID`,required:!0}),expires_at:j.datetime({label:`Expires At`,required:!0}),token:j.text({label:`Session Token`,required:!0}),ip_address:j.text({label:`IP Address`,required:!1,maxLength:45}),user_agent:j.textarea({label:`User Agent`,required:!1})},indexes:[{fields:[`token`],unique:!0},{fields:[`user_id`],unique:!1},{fields:[`expires_at`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`delete`],trash:!1,mru:!1}}),l4e=O.create({namespace:`sys`,name:`account`,label:`Account`,pluralLabel:`Accounts`,icon:`link`,isSystem:!0,description:`OAuth and authentication provider accounts`,titleFormat:`{provider_id} - {account_id}`,compactLayout:[`provider_id`,`user_id`,`account_id`],fields:{id:j.text({label:`Account ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),provider_id:j.text({label:`Provider ID`,required:!0,description:`OAuth provider identifier (google, github, etc.)`}),account_id:j.text({label:`Provider Account ID`,required:!0,description:`User's ID in the provider's system`}),user_id:j.text({label:`User ID`,required:!0,description:`Link to user table`}),access_token:j.textarea({label:`Access Token`,required:!1}),refresh_token:j.textarea({label:`Refresh Token`,required:!1}),id_token:j.textarea({label:`ID Token`,required:!1}),access_token_expires_at:j.datetime({label:`Access Token Expires At`,required:!1}),refresh_token_expires_at:j.datetime({label:`Refresh Token Expires At`,required:!1}),scope:j.text({label:`OAuth Scope`,required:!1}),password:j.text({label:`Password Hash`,required:!1,description:`Hashed password for email/password provider`})},indexes:[{fields:[`user_id`],unique:!1},{fields:[`provider_id`,`account_id`],unique:!0}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!1}}),u4e=O.create({namespace:`sys`,name:`verification`,label:`Verification`,pluralLabel:`Verifications`,icon:`shield-check`,isSystem:!0,description:`Email and phone verification tokens`,titleFormat:`Verification for {identifier}`,compactLayout:[`identifier`,`expires_at`,`created_at`],fields:{id:j.text({label:`Verification ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),value:j.text({label:`Verification Token`,required:!0,description:`Token or code for verification`}),expires_at:j.datetime({label:`Expires At`,required:!0}),identifier:j.text({label:`Identifier`,required:!0,description:`Email address or phone number`})},indexes:[{fields:[`value`],unique:!0},{fields:[`identifier`],unique:!1},{fields:[`expires_at`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`create`,`delete`],trash:!1,mru:!1}}),d4e=O.create({namespace:`sys`,name:`organization`,label:`Organization`,pluralLabel:`Organizations`,icon:`building-2`,isSystem:!0,description:`Organizations for multi-tenant grouping`,titleFormat:`{name}`,compactLayout:[`name`,`slug`,`created_at`],fields:{id:j.text({label:`Organization ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`Name`,required:!0,searchable:!0,maxLength:255}),slug:j.text({label:`Slug`,required:!1,maxLength:255,description:`URL-friendly identifier`}),logo:j.url({label:`Logo`,required:!1}),metadata:j.textarea({label:`Metadata`,required:!1,description:`JSON-serialized organization metadata`})},indexes:[{fields:[`slug`],unique:!0},{fields:[`name`]}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!0}}),f4e=O.create({namespace:`sys`,name:`member`,label:`Member`,pluralLabel:`Members`,icon:`user-check`,isSystem:!0,description:`Organization membership records`,titleFormat:`{user_id} in {organization_id}`,compactLayout:[`user_id`,`organization_id`,`role`],fields:{id:j.text({label:`Member ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),organization_id:j.text({label:`Organization ID`,required:!0}),user_id:j.text({label:`User ID`,required:!0}),role:j.text({label:`Role`,required:!1,description:`Member role within the organization (e.g. admin, member)`,maxLength:100})},indexes:[{fields:[`organization_id`,`user_id`],unique:!0},{fields:[`user_id`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),p4e=O.create({namespace:`sys`,name:`invitation`,label:`Invitation`,pluralLabel:`Invitations`,icon:`mail`,isSystem:!0,description:`Organization invitations for user onboarding`,titleFormat:`Invitation to {organization_id}`,compactLayout:[`email`,`organization_id`,`status`],fields:{id:j.text({label:`Invitation ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),organization_id:j.text({label:`Organization ID`,required:!0}),email:j.email({label:`Email`,required:!0,description:`Email address of the invited user`}),role:j.text({label:`Role`,required:!1,maxLength:100,description:`Role to assign upon acceptance`}),status:j.select([`pending`,`accepted`,`rejected`,`expired`,`canceled`],{label:`Status`,required:!0,defaultValue:`pending`}),inviter_id:j.text({label:`Inviter ID`,required:!0,description:`User ID of the person who sent the invitation`}),expires_at:j.datetime({label:`Expires At`,required:!0}),team_id:j.text({label:`Team ID`,required:!1,description:`Optional team to assign upon acceptance`})},indexes:[{fields:[`organization_id`]},{fields:[`email`]},{fields:[`expires_at`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),m4e=O.create({namespace:`sys`,name:`team`,label:`Team`,pluralLabel:`Teams`,icon:`users`,isSystem:!0,description:`Teams within organizations for fine-grained grouping`,titleFormat:`{name}`,compactLayout:[`name`,`organization_id`,`created_at`],fields:{id:j.text({label:`Team ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`Name`,required:!0,searchable:!0,maxLength:255}),organization_id:j.text({label:`Organization ID`,required:!0})},indexes:[{fields:[`organization_id`]},{fields:[`name`,`organization_id`],unique:!0}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!1}}),h4e=O.create({namespace:`sys`,name:`team_member`,label:`Team Member`,pluralLabel:`Team Members`,icon:`user-plus`,isSystem:!0,description:`Team membership records linking users to teams`,titleFormat:`{user_id} in {team_id}`,compactLayout:[`user_id`,`team_id`,`created_at`],fields:{id:j.text({label:`Team Member ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),team_id:j.text({label:`Team ID`,required:!0}),user_id:j.text({label:`User ID`,required:!0})},indexes:[{fields:[`team_id`,`user_id`],unique:!0},{fields:[`user_id`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`delete`],trash:!1,mru:!1}}),g4e=O.create({namespace:`sys`,name:`api_key`,label:`API Key`,pluralLabel:`API Keys`,icon:`key-round`,isSystem:!0,description:`API keys for programmatic access`,titleFormat:`{name}`,compactLayout:[`name`,`user_id`,`expires_at`],fields:{id:j.text({label:`API Key ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`Name`,required:!0,maxLength:255,description:`Human-readable label for the API key`}),key:j.text({label:`Key`,required:!0,description:`Hashed API key value`}),prefix:j.text({label:`Prefix`,required:!1,maxLength:16,description:`Visible prefix for identifying the key (e.g., "osk_")`}),user_id:j.text({label:`User ID`,required:!0,description:`Owner user of this API key`}),scopes:j.textarea({label:`Scopes`,required:!1,description:`JSON array of permission scopes`}),expires_at:j.datetime({label:`Expires At`,required:!1}),last_used_at:j.datetime({label:`Last Used At`,required:!1}),revoked:j.boolean({label:`Revoked`,defaultValue:!1})},indexes:[{fields:[`key`],unique:!0},{fields:[`user_id`]},{fields:[`prefix`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),_4e=O.create({namespace:`sys`,name:`two_factor`,label:`Two Factor`,pluralLabel:`Two Factor Credentials`,icon:`smartphone`,isSystem:!0,description:`Two-factor authentication credentials`,titleFormat:`Two-factor for {user_id}`,compactLayout:[`user_id`,`created_at`],fields:{id:j.text({label:`Two Factor ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),user_id:j.text({label:`User ID`,required:!0}),secret:j.text({label:`Secret`,required:!0,description:`TOTP secret key`}),backup_codes:j.textarea({label:`Backup Codes`,required:!1,description:`JSON-serialized backup recovery codes`})},indexes:[{fields:[`user_id`],unique:!0}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`create`,`update`,`delete`],trash:!1,mru:!1}});O.create({namespace:`sys`,name:`user_preference`,label:`User Preference`,pluralLabel:`User Preferences`,icon:`settings`,isSystem:!0,description:`Per-user key-value preferences (theme, locale, etc.)`,titleFormat:`{key}`,compactLayout:[`user_id`,`key`],fields:{id:j.text({label:`Preference ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),user_id:j.text({label:`User ID`,required:!0,maxLength:255,description:`Owner user of this preference`}),key:j.text({label:`Key`,required:!0,maxLength:255,description:`Preference key (e.g., theme, locale, plugin.ai.auto_save)`}),value:j.json({label:`Value`,description:`Preference value (any JSON-serializable type)`})},indexes:[{fields:[`user_id`,`key`],unique:!0},{fields:[`user_id`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}});var v4e=[s4e,c4e,l4e,u4e,d4e,f4e,p4e,m4e,h4e,g4e,_4e,O.create({namespace:`sys`,name:`role`,label:`Role`,pluralLabel:`Roles`,icon:`shield`,isSystem:!0,description:`Role definitions for RBAC access control`,titleFormat:`{name}`,compactLayout:[`name`,`label`,`active`],fields:{id:j.text({label:`Role ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`API Name`,required:!0,searchable:!0,maxLength:100,description:`Unique machine name for the role (e.g. admin, editor, viewer)`}),label:j.text({label:`Display Name`,required:!0,maxLength:255}),description:j.textarea({label:`Description`,required:!1}),permissions:j.textarea({label:`Permissions`,required:!1,description:`JSON-serialized array of permission strings`}),active:j.boolean({label:`Active`,defaultValue:!0}),is_default:j.boolean({label:`Default Role`,defaultValue:!1,description:`Automatically assigned to new users`})},indexes:[{fields:[`name`],unique:!0},{fields:[`active`]}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!0}}),O.create({namespace:`sys`,name:`permission_set`,label:`Permission Set`,pluralLabel:`Permission Sets`,icon:`lock`,isSystem:!0,description:`Named permission groupings for fine-grained access control`,titleFormat:`{name}`,compactLayout:[`name`,`label`,`active`],fields:{id:j.text({label:`Permission Set ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`API Name`,required:!0,searchable:!0,maxLength:100,description:`Unique machine name for the permission set`}),label:j.text({label:`Display Name`,required:!0,maxLength:255}),description:j.textarea({label:`Description`,required:!1}),object_permissions:j.textarea({label:`Object Permissions`,required:!1,description:`JSON-serialized object-level CRUD permissions`}),field_permissions:j.textarea({label:`Field Permissions`,required:!1,description:`JSON-serialized field-level read/write permissions`}),active:j.boolean({label:`Active`,defaultValue:!0})},indexes:[{fields:[`name`],unique:!0},{fields:[`active`]}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!0}}),O.create({namespace:`sys`,name:`audit_log`,label:`Audit Log`,pluralLabel:`Audit Logs`,icon:`scroll-text`,isSystem:!0,description:`Immutable audit trail for platform events`,titleFormat:`{action} on {object_name} by {user_id}`,compactLayout:[`action`,`object_name`,`user_id`,`created_at`],fields:{id:j.text({label:`Audit Log ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Timestamp`,required:!0,defaultValue:`NOW()`,readonly:!0}),user_id:j.text({label:`User ID`,required:!1,description:`User who performed the action (null for system actions)`}),action:j.select([`create`,`update`,`delete`,`restore`,`login`,`logout`,`permission_change`,`config_change`,`export`,`import`],{label:`Action`,required:!0,description:`Action type (snake_case). Values: create, update, delete, restore, login, logout, permission_change, config_change, export, import`}),object_name:j.text({label:`Object Name`,required:!1,maxLength:255,description:`Target object (e.g. sys_user, project_task)`}),record_id:j.text({label:`Record ID`,required:!1,description:`ID of the affected record`}),old_value:j.textarea({label:`Old Value`,required:!1,description:`JSON-serialized previous state`}),new_value:j.textarea({label:`New Value`,required:!1,description:`JSON-serialized new state`}),ip_address:j.text({label:`IP Address`,required:!1,maxLength:45}),user_agent:j.textarea({label:`User Agent`,required:!1}),tenant_id:j.text({label:`Tenant ID`,required:!1,description:`Tenant context for multi-tenant isolation`}),metadata:j.textarea({label:`Metadata`,required:!1,description:`JSON-serialized additional context`})},indexes:[{fields:[`created_at`]},{fields:[`user_id`]},{fields:[`object_name`,`record_id`]},{fields:[`action`]},{fields:[`tenant_id`]}],enable:{trackHistory:!1,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`],trash:!1,mru:!1,clone:!1}})];async function y4e(e){let{enableBrowser:t=!0}=e,n=e.appConfigs||(e.appConfig?[e.appConfig]:[]);console.log(`[KernelFactory] Creating ObjectStack Kernel...`),console.log(`[KernelFactory] App Configs:`,n.length);let r=new lBe,i=new lp;await i.use(new $0),await i.use(new BAe(r,`memory`));let a={name:`system`,manifest:{id:`com.objectstack.system`,name:`System`,version:`1.0.0`,type:`plugin`,namespace:`sys`},objects:v4e};console.log(`[KernelFactory] Loading system objects:`,v4e.length),await i.use(new A1(a));for(let e of n)console.log(`[KernelFactory] Loading app:`,e.manifest?.id||e.name||`unknown`),await i.use(new A1(e));await i.use(new cKe),await i.use(new o4e),await i.use(new n$e({watch:!1})),await i.use(new t4e),await i.use(new iqe),await i.use(new dqe),console.log(`[KernelFactory] Protocol service will be registered by ObjectQLPlugin`),await i.use(new aKe({enableBrowser:t,baseUrl:`/api/v1`,logRequests:!0})),await i.bootstrap();let o=i.context?.getService(`objectql`);if(o){let e=new Set([`base`,`system`]),t=(t,n)=>t.includes(`__`)||!n||e.has(n)?t:`${n}__${t}`;for(let e of n){let n=(e.manifest||e)?.namespace,r=[];Array.isArray(e.data)&&r.push(...e.data),e.manifest&&Array.isArray(e.manifest.data)&&r.push(...e.manifest.data);for(let e of r){if(!e.records||!e.object)continue;let r=t(e.object,n),i=await o.find(r);if(i&&i.value&&(i=i.value),!i||i.length===0){console.log(`[KernelFactory] Manual Seeding ${e.records.length} records for ${r}`);for(let t of e.records)await o.insert(r,t)}else console.log(`[KernelFactory] Data verified present for ${r}: ${i.length} records.`)}}}return i}var $9=null;function b4e(e){return e.default||e}var x4e=[b4e(CAe)];async function S4e(){if(!$9)return console.log(`[MSW] Starting ObjectStack Runtime (Browser Mode)...`),$9=await y4e({appConfigs:x4e,enableBrowser:!0}),$9}async function C4e(){if(Fse(),Nse()){console.log(`[Console] Starting in MSW mode (in-browser kernel)`);try{await S4e()}catch(e){console.error(`[Console] ❌ Failed to start MSW mock server:`,e)}}else console.log(`[Console] Starting in Server mode`);ue.createRoot(document.getElementById(`root`)).render((0,B.jsx)(L.StrictMode,{children:(0,B.jsx)(nve,{})}))}C4e().catch(e=>{console.error(`[Console] ❌ Fatal bootstrap error:`,e);let t=document.getElementById(`root`);t&&(t.innerHTML=` +
+

Failed to start

+
${e instanceof Error?e.stack||e.message:String(e)}
+
+ `)}); \ No newline at end of file diff --git a/apps/server/public/assets/index-ffw1U6iI.css b/apps/server/public/assets/index-ffw1U6iI.css new file mode 100644 index 000000000..babece656 --- /dev/null +++ b/apps/server/public/assets/index-ffw1U6iI.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-950:oklch(25.8% .092 26.042);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-400:oklch(75% .183 55.934);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-orange-950:oklch(26.6% .079 36.259);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-950:oklch(27.9% .077 45.635);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-950:oklch(26.2% .051 172.552);--color-cyan-50:oklch(98.4% .019 200.873);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-600:oklch(60.9% .126 221.723);--color-cyan-800:oklch(45% .085 224.283);--color-cyan-950:oklch(30.2% .056 229.695);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-blue-950:oklch(28.2% .091 267.935);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-800:oklch(43.8% .218 303.724);--color-purple-900:oklch(38.1% .176 304.987);--color-purple-950:oklch(29.1% .149 302.717);--color-pink-50:oklch(97.1% .014 343.198);--color-pink-200:oklch(89.9% .061 343.231);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-600:oklch(59.2% .249 .584);--color-pink-800:oklch(45.9% .187 3.815);--color-pink-950:oklch(28.4% .109 3.907);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-gray-950:oklch(13% .028 261.692);--color-black:#000;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-relaxed:1.625;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:hsl(var(--border));outline-color:hsl(var(--ring))}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-3\.5{top:calc(var(--spacing) * 3.5)}.top-4{top:calc(var(--spacing) * 4)}.top-\[50\%\]{top:50%}.right-0{right:calc(var(--spacing) * 0)}.right-1{right:calc(var(--spacing) * 1)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.bottom-0{bottom:calc(var(--spacing) * 0)}.left-0{left:calc(var(--spacing) * 0)}.left-2{left:calc(var(--spacing) * 2)}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-\[50\%\]{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[100\]{z-index:100}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-3\.5{margin-inline:calc(var(--spacing) * 3.5)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing) * 1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-8{margin-right:calc(var(--spacing) * 8)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.-ml-1{margin-left:calc(var(--spacing) * -1)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-24{height:calc(var(--spacing) * 24)}.h-32{height:calc(var(--spacing) * 32)}.h-\[1px\]{height:1px}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[85vh\]{max-height:85vh}.max-h-screen{max-height:100vh}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-10{min-height:calc(var(--spacing) * 10)}.min-h-\[36px\]{min-height:36px}.min-h-\[60px\]{min-height:60px}.min-h-\[200px\]{min-height:200px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.w-0{width:calc(var(--spacing) * 0)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-3\/4{width:75%}.w-4{width:calc(var(--spacing) * 4)}.w-4\.5{width:calc(var(--spacing) * 4.5)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-15{width:calc(var(--spacing) * 15)}.w-20{width:calc(var(--spacing) * 20)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-60{width:calc(var(--spacing) * 60)}.w-72{width:calc(var(--spacing) * 72)}.w-\[--radix-dropdown-menu-trigger-width\]{width:--radix-dropdown-menu-trigger-width}.w-\[--sidebar-width-icon\]{width:--sidebar-width-icon}.w-\[--sidebar-width\]{width:--sidebar-width}.w-\[1px\]{width:1px}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-\[--skeleton-width\]{max-width:--skeleton-width}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-64{min-width:calc(var(--spacing) * 64)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-px{--tw-translate-x:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-px{--tw-translate-x:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-0{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-75{--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize-none{resize:none}.resize-y{resize:vertical}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 0) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 0) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 4) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-x-reverse)))}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-0{border-right-style:var(--tw-border-style);border-right-width:0}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-300{border-color:var(--color-amber-300)}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/30{border-color:color-mix(in oklab, var(--color-blue-500) 30%, transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/40{border-color:color-mix(in oklab, var(--color-blue-500) 40%, transparent)}}.border-border,.border-border\/30{border-color:hsl(var(--border))}@supports (color:color-mix(in lab, red, red)){.border-border\/30{border-color:color-mix(in oklab, hsl(var(--border)) 30%, transparent)}}.border-border\/50{border-color:hsl(var(--border))}@supports (color:color-mix(in lab, red, red)){.border-border\/50{border-color:color-mix(in oklab, hsl(var(--border)) 50%, transparent)}}.border-cyan-200{border-color:var(--color-cyan-200)}.border-destructive,.border-destructive\/20{border-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.border-destructive\/20{border-color:color-mix(in oklab, hsl(var(--destructive)) 20%, transparent)}}.border-destructive\/30{border-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.border-destructive\/30{border-color:color-mix(in oklab, hsl(var(--destructive)) 30%, transparent)}}.border-destructive\/50{border-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.border-destructive\/50{border-color:color-mix(in oklab, hsl(var(--destructive)) 50%, transparent)}}.border-emerald-200{border-color:var(--color-emerald-200)}.border-emerald-300{border-color:var(--color-emerald-300)}.border-gray-200{border-color:var(--color-gray-200)}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab, red, red)){.border-green-500\/30{border-color:color-mix(in oklab, var(--color-green-500) 30%, transparent)}}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-orange-200{border-color:var(--color-orange-200)}.border-pink-200{border-color:var(--color-pink-200)}.border-primary,.border-primary\/20{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.border-primary\/20{border-color:color-mix(in oklab, hsl(var(--primary)) 20%, transparent)}}.border-purple-200{border-color:var(--color-purple-200)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-transparent{border-color:#0000}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/40{border-color:color-mix(in oklab, var(--color-yellow-500) 40%, transparent)}}.border-t-primary{border-top-color:hsl(var(--primary))}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-background{background-color:hsl(var(--background))}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab, red, red)){.bg-black\/80{background-color:color-mix(in oklab, var(--color-black) 80%, transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/5{background-color:color-mix(in oklab, var(--color-blue-500) 5%, transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/10{background-color:color-mix(in oklab, var(--color-blue-500) 10%, transparent)}}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-cyan-50{background-color:var(--color-cyan-50)}.bg-destructive,.bg-destructive\/5{background-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/5{background-color:color-mix(in oklab, hsl(var(--destructive)) 5%, transparent)}}.bg-destructive\/10{background-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/10{background-color:color-mix(in oklab, hsl(var(--destructive)) 10%, transparent)}}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/10{background-color:color-mix(in oklab, var(--color-green-500) 10%, transparent)}}.bg-muted,.bg-muted\/10{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/10{background-color:color-mix(in oklab, hsl(var(--muted)) 10%, transparent)}}.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/20{background-color:color-mix(in oklab, hsl(var(--muted)) 20%, transparent)}}.bg-muted\/30{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/30{background-color:color-mix(in oklab, hsl(var(--muted)) 30%, transparent)}}.bg-muted\/50{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/50{background-color:color-mix(in oklab, hsl(var(--muted)) 50%, transparent)}}.bg-orange-50{background-color:var(--color-orange-50)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-pink-50{background-color:var(--color-pink-50)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary,.bg-primary\/5{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.bg-primary\/5{background-color:color-mix(in oklab, hsl(var(--primary)) 5%, transparent)}}.bg-primary\/10{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.bg-primary\/10{background-color:color-mix(in oklab, hsl(var(--primary)) 10%, transparent)}}.bg-purple-50{background-color:var(--color-purple-50)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-500{background-color:var(--color-red-500)}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-transparent{background-color:#0000}.bg-yellow-500\/10{background-color:#edb2001a}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/10{background-color:color-mix(in oklab, var(--color-yellow-500) 10%, transparent)}}.fill-background{fill:hsl(var(--background))}.fill-current{fill:currentColor}.fill-foreground{fill:hsl(var(--foreground))}.fill-muted{fill:hsl(var(--muted))}.stroke-border{stroke:hsl(var(--border))}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-\[1px\]{padding:1px}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-1{padding-left:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-xs\/6{font-size:var(--text-xs);line-height:calc(var(--spacing) * 6)}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-600\/80{color:#155dfccc}@supports (color:color-mix(in lab, red, red)){.text-blue-600\/80{color:color-mix(in oklab, var(--color-blue-600) 80%, transparent)}}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-600{color:var(--color-cyan-600)}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-destructive\/80{color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.text-destructive\/80{color:color-mix(in oklab, hsl(var(--destructive)) 80%, transparent)}}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-foreground,.text-foreground\/50{color:hsl(var(--foreground))}@supports (color:color-mix(in lab, red, red)){.text-foreground\/50{color:color-mix(in oklab, hsl(var(--foreground)) 50%, transparent)}}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-muted-foreground,.text-muted-foreground\/40{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\/40{color:color-mix(in oklab, hsl(var(--muted-foreground)) 40%, transparent)}}.text-muted-foreground\/50{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\/50{color:color-mix(in oklab, hsl(var(--muted-foreground)) 50%, transparent)}}.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\/60{color:color-mix(in oklab, hsl(var(--muted-foreground)) 60%, transparent)}}.text-orange-600{color:var(--color-orange-600)}.text-orange-800{color:var(--color-orange-800)}.text-pink-600{color:var(--color-pink-600)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-500{color:var(--color-purple-500)}.text-purple-600{color:var(--color-purple-600)}.text-purple-800{color:var(--color-purple-800)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground,.text-sidebar-foreground\/50{color:hsl(var(--sidebar-foreground))}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\/50{color:color-mix(in oklab, hsl(var(--sidebar-foreground)) 50%, transparent)}}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground))}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\/70{color:color-mix(in oklab, hsl(var(--sidebar-foreground)) 70%, transparent)}}.text-yellow-600{color:var(--color-yellow-600)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:hsl(var(--primary))}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,hsl(var(--sidebar-border)));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-sidebar-ring{--tw-ring-color:hsl(var(--sidebar-ring))}.ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[margin\,opa\]{transition-property:margin,opa;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-linear{--tw-ease:linear;transition-timing-function:linear}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.group-focus-within\/menu-item\:opacity-100:is(:where(.group\/menu-item):focus-within *){opacity:1}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *),.group-hover\/menu-item\:opacity-100:is(:where(.group\/menu-item):hover *){opacity:1}}.group-has-\[\[data-sidebar\=menu-action\]\]\/menu-item\:pr-8:is(:where(.group\/menu-item):has([data-sidebar=menu-action]) *){padding-right:calc(var(--spacing) * 8)}.group-data-\[collapsible\=icon\]\:hidden:is(:where(.group)[data-collapsible=icon] *){display:none}.group-data-\[collapsible\=icon\]\:\!size-8:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--spacing) * 8)!important;height:calc(var(--spacing) * 8)!important}.group-data-\[collapsible\=icon\]\:\!p-0:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 0)!important}.group-data-\[collapsible\=icon\]\:\!p-2:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 2)!important}.group-data-\[collapsible\=offcanvas\]\:translate-x-0:is(:where(.group)[data-collapsible=offcanvas] *){--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[side\=left\]\:-right-4:is(:where(.group)[data-side=left] *){right:calc(var(--spacing) * -4)}.group-data-\[side\=right\]\:left-0:is(:where(.group)[data-side=right] *){left:calc(var(--spacing) * 0)}.group-\[\.destructive\]\:border-muted\/40:is(:where(.group).destructive *){border-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.group-\[\.destructive\]\:border-muted\/40:is(:where(.group).destructive *){border-color:color-mix(in oklab, hsl(var(--muted)) 40%, transparent)}}.group-\[\.destructive\]\:text-red-300:is(:where(.group).destructive *){color:var(--color-red-300)}@media (hover:hover){.peer-hover\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button):hover~*){color:hsl(var(--sidebar-accent-foreground))}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button)[data-active=true]~*){color:hsl(var(--sidebar-accent-foreground))}.peer-data-\[size\=default\]\/menu-button\:top-1\.5:is(:where(.peer\/menu-button)[data-size=default]~*){top:calc(var(--spacing) * 1.5)}.peer-data-\[size\=lg\]\/menu-button\:top-2\.5:is(:where(.peer\/menu-button)[data-size=lg]~*){top:calc(var(--spacing) * 2.5)}.peer-data-\[size\=sm\]\/menu-button\:top-1:is(:where(.peer\/menu-button)[data-size=sm]~*){top:calc(var(--spacing) * 1)}.peer-data-\[variant\=inset\]\:min-h-\[calc\(100svh-theme\(spacing\.4\)\)\]:is(:where(.peer)[data-variant=inset]~*){min-height:calc(100svh - 1rem)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:calc(var(--spacing) * -2)}.after\:inset-y-0:after{content:var(--tw-content);inset-block:calc(var(--spacing) * 0)}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:calc(var(--spacing) * 1)}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[collapsible\=offcanvas\]\:after\:left-full:is(:where(.group)[data-collapsible=offcanvas] *):after{content:var(--tw-content);left:100%}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media (hover:hover){.hover\:border-border:hover{border-color:hsl(var(--border))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab, hsl(var(--primary)) 50%, transparent)}}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-background:hover,.hover\:bg-background\/50:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-background\/50:hover{background-color:color-mix(in oklab, hsl(var(--background)) 50%, transparent)}}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/80:hover{background-color:color-mix(in oklab, hsl(var(--destructive)) 80%, transparent)}}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab, hsl(var(--destructive)) 90%, transparent)}}.hover\:bg-emerald-100:hover{background-color:var(--color-emerald-100)}.hover\:bg-muted:hover,.hover\:bg-muted\/30:hover{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/30:hover{background-color:color-mix(in oklab, hsl(var(--muted)) 30%, transparent)}}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab, hsl(var(--muted)) 50%, transparent)}}.hover\:bg-muted\/60:hover{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/60:hover{background-color:color-mix(in oklab, hsl(var(--muted)) 60%, transparent)}}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/80:hover{background-color:color-mix(in oklab, hsl(var(--primary)) 80%, transparent)}}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab, hsl(var(--primary)) 90%, transparent)}}.hover\:bg-secondary:hover,.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab, hsl(var(--secondary)) 80%, transparent)}}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-transparent:hover{background-color:#0000}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-sidebar-foreground:hover{color:hsl(var(--sidebar-foreground))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow:0 0 0 1px var(--tw-shadow-color,hsl(var(--sidebar-accent)));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-data-\[collapsible\=offcanvas\]\:hover\:bg-sidebar:is(:where(.group)[data-collapsible=offcanvas] *):hover{background-color:hsl(var(--sidebar-background))}.group-\[\.destructive\]\:hover\:border-destructive\/30:is(:where(.group).destructive *):hover{border-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.group-\[\.destructive\]\:hover\:border-destructive\/30:is(:where(.group).destructive *):hover{border-color:color-mix(in oklab, hsl(var(--destructive)) 30%, transparent)}}.group-\[\.destructive\]\:hover\:bg-destructive:is(:where(.group).destructive *):hover{background-color:hsl(var(--destructive))}.group-\[\.destructive\]\:hover\:text-destructive-foreground:is(:where(.group).destructive *):hover{color:hsl(var(--destructive-foreground))}.group-\[\.destructive\]\:hover\:text-red-50:is(:where(.group).destructive *):hover{color:var(--color-red-50)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-destructive:focus{color:hsl(var(--destructive))}.focus\:opacity-100:focus{opacity:1}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.group-\[\.destructive\]\:focus\:ring-destructive:is(:where(.group).destructive *):focus{--tw-ring-color:hsl(var(--destructive))}.group-\[\.destructive\]\:focus\:ring-red-400:is(:where(.group).destructive *):focus{--tw-ring-color:var(--color-red-400)}.group-\[\.destructive\]\:focus\:ring-offset-red-600:is(:where(.group).destructive *):focus{--tw-ring-offset-color:var(--color-red-600)}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:ring-sidebar-ring:focus-visible{--tw-ring-color:hsl(var(--sidebar-ring))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-data-\[variant\=inset\]\:bg-sidebar:has([data-variant=inset]){background-color:hsl(var(--sidebar-background))}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[active\=true\]\:font-medium[data-active=true]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:calc(var(--spacing) * 0)}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:calc(var(--spacing) * 1)}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing) * 4);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=closed\]\:duration-300[data-state=closed]{--tw-duration:.3s;transition-duration:.3s}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[state\=open\]\:duration-500[data-state=open]{--tw-duration:.5s;transition-duration:.5s}@media (hover:hover){.data-\[state\=open\]\:hover\:bg-sidebar-accent[data-state=open]:hover{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground[data-state=open]:hover{color:hsl(var(--sidebar-accent-foreground))}}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x:var(--radix-toast-swipe-end-x);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x:var(--radix-toast-swipe-move-x);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}@media (width>=40rem){.sm\:top-auto{top:auto}.sm\:right-0{right:calc(var(--spacing) * 0)}.sm\:bottom-0{bottom:calc(var(--spacing) * 0)}.sm\:flex{display:flex}.sm\:inline{display:inline}.sm\:inline-flex{display:inline-flex}.sm\:w-28{width:calc(var(--spacing) * 28)}.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:max-w-sm{max-width:var(--container-sm)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[1fr_1fr_140px\]{grid-template-columns:1fr 1fr 140px}.sm\:flex-col{flex-direction:column}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2\.5{gap:calc(var(--spacing) * 2.5)}:where(.sm\:space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}@media (width>=48rem){.md\:block{display:block}.md\:flex{display:flex}.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:opacity-0{opacity:0}.md\:peer-data-\[variant\=inset\]\:m-2:is(:where(.peer)[data-variant=inset]~*){margin:calc(var(--spacing) * 2)}.md\:peer-data-\[variant\=inset\]\:ml-0:is(:where(.peer)[data-variant=inset]~*){margin-left:calc(var(--spacing) * 0)}.md\:peer-data-\[variant\=inset\]\:rounded-xl:is(:where(.peer)[data-variant=inset]~*){border-radius:calc(var(--radius) + 4px)}.md\:peer-data-\[variant\=inset\]\:shadow:is(:where(.peer)[data-variant=inset]~*){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.md\:peer-data-\[state\=collapsed\]\:peer-data-\[variant\=inset\]\:ml-2:is(:where(.peer)[data-state=collapsed]~*):is(:where(.peer)[data-variant=inset]~*){margin-left:calc(var(--spacing) * 2)}}.after\:md\:hidden:after{content:var(--tw-content)}@media (width>=48rem){.after\:md\:hidden:after{display:none}}@media (width>=64rem){.lg\:inline-flex{display:inline-flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-\[1fr_320px\]{grid-template-columns:1fr 320px}.lg\:grid-cols-\[240px_1fr\]{grid-template-columns:240px 1fr}.lg\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}.lg\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.lg\:pr-4{padding-right:calc(var(--spacing) * 4)}}.dark\:scale-0:is(.dark *){--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x) var(--tw-scale-y)}.dark\:scale-100:is(.dark *){--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.dark\:-rotate-90:is(.dark *){rotate:-90deg}.dark\:rotate-0:is(.dark *){rotate:0deg}.dark\:border-amber-800:is(.dark *){border-color:var(--color-amber-800)}.dark\:border-blue-800:is(.dark *){border-color:var(--color-blue-800)}.dark\:border-cyan-800:is(.dark *){border-color:var(--color-cyan-800)}.dark\:border-emerald-800:is(.dark *){border-color:var(--color-emerald-800)}.dark\:border-gray-700:is(.dark *){border-color:var(--color-gray-700)}.dark\:border-gray-800:is(.dark *){border-color:var(--color-gray-800)}.dark\:border-orange-800:is(.dark *){border-color:var(--color-orange-800)}.dark\:border-pink-800:is(.dark *){border-color:var(--color-pink-800)}.dark\:border-purple-800:is(.dark *){border-color:var(--color-purple-800)}.dark\:border-red-800:is(.dark *){border-color:var(--color-red-800)}.dark\:bg-amber-950:is(.dark *){background-color:var(--color-amber-950)}.dark\:bg-amber-950\/50:is(.dark *){background-color:#46190180}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-950\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-amber-950) 50%, transparent)}}.dark\:bg-blue-900:is(.dark *){background-color:var(--color-blue-900)}.dark\:bg-blue-950:is(.dark *){background-color:var(--color-blue-950)}.dark\:bg-blue-950\/50:is(.dark *){background-color:#16245680}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-950\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-blue-950) 50%, transparent)}}.dark\:bg-cyan-950:is(.dark *){background-color:var(--color-cyan-950)}.dark\:bg-emerald-950:is(.dark *){background-color:var(--color-emerald-950)}.dark\:bg-emerald-950\/50:is(.dark *){background-color:#002c2280}@supports (color:color-mix(in lab, red, red)){.dark\:bg-emerald-950\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-emerald-950) 50%, transparent)}}.dark\:bg-gray-900:is(.dark *){background-color:var(--color-gray-900)}.dark\:bg-gray-950:is(.dark *){background-color:var(--color-gray-950)}.dark\:bg-green-900:is(.dark *){background-color:var(--color-green-900)}.dark\:bg-orange-900:is(.dark *){background-color:var(--color-orange-900)}.dark\:bg-orange-950:is(.dark *){background-color:var(--color-orange-950)}.dark\:bg-pink-950:is(.dark *){background-color:var(--color-pink-950)}.dark\:bg-purple-900:is(.dark *){background-color:var(--color-purple-900)}.dark\:bg-purple-950:is(.dark *){background-color:var(--color-purple-950)}.dark\:bg-red-950\/50:is(.dark *){background-color:#46080980}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-950\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-red-950) 50%, transparent)}}.dark\:text-amber-400:is(.dark *){color:var(--color-amber-400)}.dark\:text-blue-200:is(.dark *){color:var(--color-blue-200)}.dark\:text-blue-300:is(.dark *){color:var(--color-blue-300)}.dark\:text-blue-300\/80:is(.dark *){color:#90c5ffcc}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-300\/80:is(.dark *){color:color-mix(in oklab, var(--color-blue-300) 80%, transparent)}}.dark\:text-blue-400:is(.dark *){color:var(--color-blue-400)}.dark\:text-cyan-400:is(.dark *){color:var(--color-cyan-400)}.dark\:text-emerald-400:is(.dark *){color:var(--color-emerald-400)}.dark\:text-gray-200:is(.dark *){color:var(--color-gray-200)}.dark\:text-gray-400:is(.dark *){color:var(--color-gray-400)}.dark\:text-green-200:is(.dark *){color:var(--color-green-200)}.dark\:text-green-300:is(.dark *){color:var(--color-green-300)}.dark\:text-green-400:is(.dark *){color:var(--color-green-400)}.dark\:text-orange-200:is(.dark *){color:var(--color-orange-200)}.dark\:text-orange-400:is(.dark *){color:var(--color-orange-400)}.dark\:text-pink-400:is(.dark *){color:var(--color-pink-400)}.dark\:text-purple-200:is(.dark *){color:var(--color-purple-200)}.dark\:text-purple-400:is(.dark *){color:var(--color-purple-400)}.dark\:text-red-400:is(.dark *){color:var(--color-red-400)}.dark\:text-yellow-400:is(.dark *){color:var(--color-yellow-400)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing) * 0)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\[\&\>span\:last-child\]\:truncate>span:last-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.\[\&\>svg\]\:size-3\.5>svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&\>svg\]\:size-4>svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>tr\]\:last\:border-b-0>tr:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{rotate:90deg}[data-side=left] .\[\[data-side\=left\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:calc(var(--spacing) * -2)}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize,[data-side=right] .\[\[data-side\=right\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:calc(var(--spacing) * -2)}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}}:root{--radius:.625rem;--background:0 0% 100%;--foreground:240 10% 3.9%;--card:0 0% 100%;--card-foreground:240 10% 3.9%;--popover:0 0% 100%;--popover-foreground:240 10% 3.9%;--primary:240 5.9% 10%;--primary-foreground:0 0% 98%;--secondary:240 4.8% 95.9%;--secondary-foreground:240 5.9% 10%;--muted:240 4.8% 95.9%;--muted-foreground:240 3.8% 46.1%;--accent:240 4.8% 95.9%;--accent-foreground:240 5.9% 10%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:240 5.9% 90%;--input:240 5.9% 90%;--ring:240 5.9% 10%;--chart-1:12 76% 61%;--chart-2:173 58% 39%;--chart-3:197 37% 24%;--chart-4:43 74% 66%;--chart-5:27 87% 67%;--sidebar-background:0 0% 98%;--sidebar-foreground:240 5.3% 26.1%;--sidebar-primary:240 5.9% 10%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:240 4.8% 95.9%;--sidebar-accent-foreground:240 5.9% 10%;--sidebar-border:220 13% 91%;--sidebar-ring:240 5.9% 10%}.dark{--background:240 10% 3.9%;--foreground:0 0% 98%;--card:240 10% 3.9%;--card-foreground:0 0% 98%;--popover:240 10% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:240 5.9% 10%;--secondary:240 3.7% 15.9%;--secondary-foreground:0 0% 98%;--muted:240 3.7% 15.9%;--muted-foreground:240 5% 64.9%;--accent:240 3.7% 15.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:240 3.7% 15.9%;--input:240 3.7% 15.9%;--ring:240 4.9% 83.9%;--chart-1:220 70% 50%;--chart-2:160 60% 45%;--chart-3:30 80% 55%;--chart-4:280 65% 60%;--chart-5:340 75% 55%;--sidebar-background:240 5.9% 10%;--sidebar-foreground:240 4.8% 95.9%;--sidebar-primary:224.3 76.3% 48%;--sidebar-primary-foreground:0 0% 100%;--sidebar-accent:240 3.7% 15.9%;--sidebar-accent-foreground:240 4.8% 95.9%;--sidebar-border:240 3.7% 15.9%;--sidebar-ring:240 4.9% 83.9%}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}} diff --git a/apps/server/public/index.html b/apps/server/public/index.html new file mode 100644 index 000000000..503023f09 --- /dev/null +++ b/apps/server/public/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + ObjectStack Studio + + + + + + +
+ + diff --git a/apps/server/public/mockServiceWorker.js b/apps/server/public/mockServiceWorker.js new file mode 100644 index 000000000..86e26f3b6 --- /dev/null +++ b/apps/server/public/mockServiceWorker.js @@ -0,0 +1,349 @@ +/* eslint-disable */ +/* tslint:disable */ + +/** + * Mock Service Worker. + * @see https://github.com/mswjs/msw + * - Please do NOT modify this file. + */ + +const PACKAGE_VERSION = '2.13.3' +const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82' +const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') +const activeClientIds = new Set() + +addEventListener('install', function () { + self.skipWaiting() +}) + +addEventListener('activate', function (event) { + event.waitUntil(self.clients.claim()) +}) + +addEventListener('message', async function (event) { + const clientId = Reflect.get(event.source || {}, 'id') + + if (!clientId || !self.clients) { + return + } + + const client = await self.clients.get(clientId) + + if (!client) { + return + } + + const allClients = await self.clients.matchAll({ + type: 'window', + }) + + switch (event.data) { + case 'KEEPALIVE_REQUEST': { + sendToClient(client, { + type: 'KEEPALIVE_RESPONSE', + }) + break + } + + case 'INTEGRITY_CHECK_REQUEST': { + sendToClient(client, { + type: 'INTEGRITY_CHECK_RESPONSE', + payload: { + packageVersion: PACKAGE_VERSION, + checksum: INTEGRITY_CHECKSUM, + }, + }) + break + } + + case 'MOCK_ACTIVATE': { + activeClientIds.add(clientId) + + sendToClient(client, { + type: 'MOCKING_ENABLED', + payload: { + client: { + id: client.id, + frameType: client.frameType, + }, + }, + }) + break + } + + case 'CLIENT_CLOSED': { + activeClientIds.delete(clientId) + + const remainingClients = allClients.filter((client) => { + return client.id !== clientId + }) + + // Unregister itself when there are no more clients + if (remainingClients.length === 0) { + self.registration.unregister() + } + + break + } + } +}) + +addEventListener('fetch', function (event) { + const requestInterceptedAt = Date.now() + + // Bypass navigation requests. + if (event.request.mode === 'navigate') { + return + } + + // Opening the DevTools triggers the "only-if-cached" request + // that cannot be handled by the worker. Bypass such requests. + if ( + event.request.cache === 'only-if-cached' && + event.request.mode !== 'same-origin' + ) { + return + } + + // Bypass all requests when there are no active clients. + // Prevents the self-unregistered worked from handling requests + // after it's been terminated (still remains active until the next reload). + if (activeClientIds.size === 0) { + return + } + + const requestId = crypto.randomUUID() + event.respondWith(handleRequest(event, requestId, requestInterceptedAt)) +}) + +/** + * @param {FetchEvent} event + * @param {string} requestId + * @param {number} requestInterceptedAt + */ +async function handleRequest(event, requestId, requestInterceptedAt) { + const client = await resolveMainClient(event) + const requestCloneForEvents = event.request.clone() + const response = await getResponse( + event, + client, + requestId, + requestInterceptedAt, + ) + + // Send back the response clone for the "response:*" life-cycle events. + // Ensure MSW is active and ready to handle the message, otherwise + // this message will pend indefinitely. + if (client && activeClientIds.has(client.id)) { + const serializedRequest = await serializeRequest(requestCloneForEvents) + + // Clone the response so both the client and the library could consume it. + const responseClone = response.clone() + + sendToClient( + client, + { + type: 'RESPONSE', + payload: { + isMockedResponse: IS_MOCKED_RESPONSE in response, + request: { + id: requestId, + ...serializedRequest, + }, + response: { + type: responseClone.type, + status: responseClone.status, + statusText: responseClone.statusText, + headers: Object.fromEntries(responseClone.headers.entries()), + body: responseClone.body, + }, + }, + }, + responseClone.body ? [serializedRequest.body, responseClone.body] : [], + ) + } + + return response +} + +/** + * Resolve the main client for the given event. + * Client that issues a request doesn't necessarily equal the client + * that registered the worker. It's with the latter the worker should + * communicate with during the response resolving phase. + * @param {FetchEvent} event + * @returns {Promise} + */ +async function resolveMainClient(event) { + const client = await self.clients.get(event.clientId) + + if (activeClientIds.has(event.clientId)) { + return client + } + + if (client?.frameType === 'top-level') { + return client + } + + const allClients = await self.clients.matchAll({ + type: 'window', + }) + + return allClients + .filter((client) => { + // Get only those clients that are currently visible. + return client.visibilityState === 'visible' + }) + .find((client) => { + // Find the client ID that's recorded in the + // set of clients that have registered the worker. + return activeClientIds.has(client.id) + }) +} + +/** + * @param {FetchEvent} event + * @param {Client | undefined} client + * @param {string} requestId + * @param {number} requestInterceptedAt + * @returns {Promise} + */ +async function getResponse(event, client, requestId, requestInterceptedAt) { + // Clone the request because it might've been already used + // (i.e. its body has been read and sent to the client). + const requestClone = event.request.clone() + + function passthrough() { + // Cast the request headers to a new Headers instance + // so the headers can be manipulated with. + const headers = new Headers(requestClone.headers) + + // Remove the "accept" header value that marked this request as passthrough. + // This prevents request alteration and also keeps it compliant with the + // user-defined CORS policies. + const acceptHeader = headers.get('accept') + if (acceptHeader) { + const values = acceptHeader.split(',').map((value) => value.trim()) + const filteredValues = values.filter( + (value) => value !== 'msw/passthrough', + ) + + if (filteredValues.length > 0) { + headers.set('accept', filteredValues.join(', ')) + } else { + headers.delete('accept') + } + } + + return fetch(requestClone, { headers }) + } + + // Bypass mocking when the client is not active. + if (!client) { + return passthrough() + } + + // Bypass initial page load requests (i.e. static assets). + // The absence of the immediate/parent client in the map of the active clients + // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet + // and is not ready to handle requests. + if (!activeClientIds.has(client.id)) { + return passthrough() + } + + // Notify the client that a request has been intercepted. + const serializedRequest = await serializeRequest(event.request) + const clientMessage = await sendToClient( + client, + { + type: 'REQUEST', + payload: { + id: requestId, + interceptedAt: requestInterceptedAt, + ...serializedRequest, + }, + }, + [serializedRequest.body], + ) + + switch (clientMessage.type) { + case 'MOCK_RESPONSE': { + return respondWithMock(clientMessage.data) + } + + case 'PASSTHROUGH': { + return passthrough() + } + } + + return passthrough() +} + +/** + * @param {Client} client + * @param {any} message + * @param {Array} transferrables + * @returns {Promise} + */ +function sendToClient(client, message, transferrables = []) { + return new Promise((resolve, reject) => { + const channel = new MessageChannel() + + channel.port1.onmessage = (event) => { + if (event.data && event.data.error) { + return reject(event.data.error) + } + + resolve(event.data) + } + + client.postMessage(message, [ + channel.port2, + ...transferrables.filter(Boolean), + ]) + }) +} + +/** + * @param {Response} response + * @returns {Response} + */ +function respondWithMock(response) { + // Setting response status code to 0 is a no-op. + // However, when responding with a "Response.error()", the produced Response + // instance will have status code set to 0. Since it's not possible to create + // a Response instance with status code 0, handle that use-case separately. + if (response.status === 0) { + return Response.error() + } + + const mockedResponse = new Response(response.body, response) + + Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, { + value: true, + enumerable: true, + }) + + return mockedResponse +} + +/** + * @param {Request} request + */ +async function serializeRequest(request) { + return { + url: request.url, + mode: request.mode, + method: request.method, + headers: Object.fromEntries(request.headers.entries()), + cache: request.cache, + credentials: request.credentials, + destination: request.destination, + integrity: request.integrity, + redirect: request.redirect, + referrer: request.referrer, + referrerPolicy: request.referrerPolicy, + body: await request.arrayBuffer(), + keepalive: request.keepalive, + } +} diff --git a/apps/server/public/vite.svg b/apps/server/public/vite.svg new file mode 100644 index 000000000..896c26fc4 --- /dev/null +++ b/apps/server/public/vite.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/server/server/index.ts b/apps/server/server/index.ts index fc43c0309..88c4d4caa 100644 --- a/apps/server/server/index.ts +++ b/apps/server/server/index.ts @@ -64,7 +64,7 @@ async function ensureKernel(): Promise { await kernel.use(new ObjectQLPlugin()); // Register Memory Driver for example apps (volatile, fast) - await kernel.use(new DriverPlugin(new InMemoryDriver(), { name: 'memory' })); + await kernel.use(new DriverPlugin(new InMemoryDriver(), 'memory')); // Register Turso Driver for system objects (persistent, production) const tursoUrl = process.env.TURSO_DATABASE_URL; @@ -80,7 +80,7 @@ async function ensureKernel(): Promise { // Remote mode - no local sync needed for Vercel }); - await kernel.use(new DriverPlugin(tursoDriver, { name: 'turso' })); + await kernel.use(new DriverPlugin(tursoDriver, 'turso')); // Configure datasource mapping // This must be done before loading apps, so ObjectQL can route objects correctly From 9814b8aa0d292e092178f3e36dd19c4cbfc3fd98 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Wed, 15 Apr 2026 01:52:18 +0000 Subject: [PATCH 7/7] chore(server): Add public/ to .gitignore (build artifacts) Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/38859349-2ac2-4ed9-a6ab-dc857bf07fba Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- apps/server/.gitignore | 1 + .../__vite-browser-external-BJgzPGy7.js | 1 - apps/server/public/assets/chunk-DECur_0Z.js | 1 - apps/server/public/assets/data-CGvg7kH3.js | 39 -- apps/server/public/assets/index-BqvyhY64.js | 306 --------------- apps/server/public/assets/index-ffw1U6iI.css | 2 - apps/server/public/index.html | 19 - apps/server/public/mockServiceWorker.js | 349 ------------------ apps/server/public/vite.svg | 5 - 9 files changed, 1 insertion(+), 722 deletions(-) delete mode 100644 apps/server/public/assets/__vite-browser-external-BJgzPGy7.js delete mode 100644 apps/server/public/assets/chunk-DECur_0Z.js delete mode 100644 apps/server/public/assets/data-CGvg7kH3.js delete mode 100644 apps/server/public/assets/index-BqvyhY64.js delete mode 100644 apps/server/public/assets/index-ffw1U6iI.css delete mode 100644 apps/server/public/index.html delete mode 100644 apps/server/public/mockServiceWorker.js delete mode 100644 apps/server/public/vite.svg diff --git a/apps/server/.gitignore b/apps/server/.gitignore index 7b9ccd07e..82709e40f 100644 --- a/apps/server/.gitignore +++ b/apps/server/.gitignore @@ -1,6 +1,7 @@ # Build artifacts dist/ .turbo/ +public/ # Bundled API handler (generated during Vercel build) api/_handler.js diff --git a/apps/server/public/assets/__vite-browser-external-BJgzPGy7.js b/apps/server/public/assets/__vite-browser-external-BJgzPGy7.js deleted file mode 100644 index 7b1c56949..000000000 --- a/apps/server/public/assets/__vite-browser-external-BJgzPGy7.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chunk-DECur_0Z.js";var t=e(((e,t)=>{t.exports={}}));export default t(); \ No newline at end of file diff --git a/apps/server/public/assets/chunk-DECur_0Z.js b/apps/server/public/assets/chunk-DECur_0Z.js deleted file mode 100644 index c7f309007..000000000 --- a/apps/server/public/assets/chunk-DECur_0Z.js +++ /dev/null @@ -1 +0,0 @@ -var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));export{s as n,l as r,o as t}; \ No newline at end of file diff --git a/apps/server/public/assets/data-CGvg7kH3.js b/apps/server/public/assets/data-CGvg7kH3.js deleted file mode 100644 index a3b06359a..000000000 --- a/apps/server/public/assets/data-CGvg7kH3.js +++ /dev/null @@ -1,39 +0,0 @@ -import{n as e}from"./chunk-DECur_0Z.js";Object.freeze({status:`aborted`});function t(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var n=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},r=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},i={};function a(e){return e&&Object.assign(i,e),i}function o(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function s(e,t){return typeof t==`bigint`?t.toString():t}function c(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function l(e){return e==null}function u(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ee(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var te=Symbol(`evaluating`);function d(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==te)return r===void 0&&(r=te,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function f(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function ne(e){return JSON.stringify(e)}function re(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ie=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ae(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var oe=c(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function m(e){if(ae(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ae(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function se(e){return m(e)?{...e}:Array.isArray(e)?[...e]:e}var ce=new Set([`string`,`number`,`symbol`]);function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function g(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function le(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ue={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function de(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return g(e,p(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return f(this,`shape`,e),e},checks:[]}))}function fe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return g(e,p(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return f(this,`shape`,r),r},checks:[]}))}function pe(e,t){if(!m(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return g(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function me(e,t){if(!m(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return g(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function he(e,t){return g(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return f(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function ge(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return g(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return f(this,`shape`,i),i},checks:[]}))}function _e(e,t,n){return g(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return f(this,`shape`,i),i}}))}function v(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ve(e){return typeof e==`string`?e:e?.message}function b(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=ve(e.inst?._zod.def?.error?.(e))??ve(t?.error?.(e))??ve(n.customError?.(e))??ve(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ye(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function be(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var xe=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,s,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Se=t(`$ZodError`,xe),Ce=t(`$ZodError`,xe,{Parent:Error});function we(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Te(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r(t,r,i,o)=>{let s=i?Object.assign(i,{async:!1}):{async:!1},c=t._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new n;if(c.issues.length){let t=new(o?.Err??e)(c.issues.map(e=>b(e,s,a())));throw ie(t,o?.callee),t}return c.value},De=Ee(Ce),Oe=e=>async(t,n,r,i)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(i?.Err??e)(s.issues.map(e=>b(e,o,a())));throw ie(t,i?.callee),t}return s.value},ke=Oe(Ce),Ae=e=>(t,r,i)=>{let o=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new n;return s.issues.length?{success:!1,error:new(e??Se)(s.issues.map(e=>b(e,o,a())))}:{success:!0,data:s.value}},je=Ae(Ce),Me=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>b(e,i,a())))}:{success:!0,data:o.value}},Ne=Me(Ce),Pe=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ee(e)(t,n,i)},Fe=e=>(t,n,r)=>Ee(e)(t,n,r),Ie=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Oe(e)(t,n,i)},Le=e=>async(t,n,r)=>Oe(e)(t,n,r),Re=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ae(e)(t,n,i)},ze=e=>(t,n,r)=>Ae(e)(t,n,r),Be=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Me(e)(t,n,i)},Ve=e=>async(t,n,r)=>Me(e)(t,n,r),He=/^[cC][^\s-]{8,}$/,Ue=/^[0-9a-z]+$/,We=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ge=/^[0-9a-vA-V]{20}$/,Ke=/^[A-Za-z0-9]{27}$/,qe=/^[a-zA-Z0-9_-]{21}$/,Je=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ye=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Xe=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ze=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qe=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function $e(){return new RegExp(Qe,`u`)}var et=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,it=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,at=/^[A-Za-z0-9_-]*$/,ot=/^\+[1-9]\d{6,14}$/,st=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,ct=RegExp(`^${st}$`);function lt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ut(e){return RegExp(`^${lt(e)}$`)}function dt(e){let t=lt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${st}T(?:${r})$`)}var ft=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},pt=/^-?\d+$/,mt=/^-?\d+(?:\.\d+)?$/,ht=/^(?:true|false)$/i,gt=/^null$/i,_t=/^[^A-Z]*$/,vt=/^[^a-z]*$/,x=t(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),yt={number:`number`,bigint:`bigint`,object:`date`},bt=t(`$ZodCheckLessThan`,(e,t)=>{x.init(e,t);let n=yt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{x.init(e,t);let n=yt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),St=t(`$ZodCheckMultipleOf`,(e,t)=>{x.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):ee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ct=t(`$ZodCheckNumberFormat`,(e,t)=>{x.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ue[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=pt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),wt=t(`$ZodCheckMaxLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!l(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=ye(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Tt=t(`$ZodCheckMinLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!l(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ye(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Et=t(`$ZodCheckLengthEquals`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!l(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ye(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Dt=t(`$ZodCheckStringFormat`,(e,t)=>{var n,r;x.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ot=t(`$ZodCheckRegex`,(e,t)=>{Dt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),kt=t(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=_t,Dt.init(e,t)}),At=t(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=vt,Dt.init(e,t)}),jt=t(`$ZodCheckIncludes`,(e,t)=>{x.init(e,t);let n=h(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Mt=t(`$ZodCheckStartsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`^${h(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Nt=t(`$ZodCheckEndsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`.*${h(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Pt=t(`$ZodCheckOverwrite`,(e,t)=>{x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ft=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` -`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(` -`))}},It={major:4,minor:3,patch:6},S=t(`$ZodType`,(e,t)=>{var r;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=It;let i=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let i=v(e),a;for(let o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&r?.async===!1)throw new n;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||=v(e,t))});else{if(e.issues.length===t)continue;i||=v(e,t)}}return a?a.then(()=>e):e},r=(r,a,o)=>{if(v(r))return r.aborted=!0,r;let s=t(a,i,o);if(s instanceof Promise){if(o.async===!1)throw new n;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new n;return s.then(e=>t(e,i,o))}return t(s,i,o)}}d(e,`~standard`,()=>({validate:t=>{try{let n=je(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ne(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Lt=t(`$ZodString`,(e,t)=>{S.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ft(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),C=t(`$ZodStringFormat`,(e,t)=>{Dt.init(e,t),Lt.init(e,t)}),Rt=t(`$ZodGUID`,(e,t)=>{t.pattern??=Ye,C.init(e,t)}),zt=t(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Xe(e)}else t.pattern??=Xe();C.init(e,t)}),Bt=t(`$ZodEmail`,(e,t)=>{t.pattern??=Ze,C.init(e,t)}),Vt=t(`$ZodURL`,(e,t)=>{C.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ht=t(`$ZodEmoji`,(e,t)=>{t.pattern??=$e(),C.init(e,t)}),Ut=t(`$ZodNanoID`,(e,t)=>{t.pattern??=qe,C.init(e,t)}),Wt=t(`$ZodCUID`,(e,t)=>{t.pattern??=He,C.init(e,t)}),Gt=t(`$ZodCUID2`,(e,t)=>{t.pattern??=Ue,C.init(e,t)}),Kt=t(`$ZodULID`,(e,t)=>{t.pattern??=We,C.init(e,t)}),qt=t(`$ZodXID`,(e,t)=>{t.pattern??=Ge,C.init(e,t)}),Jt=t(`$ZodKSUID`,(e,t)=>{t.pattern??=Ke,C.init(e,t)}),Yt=t(`$ZodISODateTime`,(e,t)=>{t.pattern??=dt(t),C.init(e,t)}),Xt=t(`$ZodISODate`,(e,t)=>{t.pattern??=ct,C.init(e,t)}),Zt=t(`$ZodISOTime`,(e,t)=>{t.pattern??=ut(t),C.init(e,t)}),Qt=t(`$ZodISODuration`,(e,t)=>{t.pattern??=Je,C.init(e,t)}),$t=t(`$ZodIPv4`,(e,t)=>{t.pattern??=et,C.init(e,t),e._zod.bag.format=`ipv4`}),en=t(`$ZodIPv6`,(e,t)=>{t.pattern??=tt,C.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),tn=t(`$ZodCIDRv4`,(e,t)=>{t.pattern??=nt,C.init(e,t)}),nn=t(`$ZodCIDRv6`,(e,t)=>{t.pattern??=rt,C.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function rn(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var an=t(`$ZodBase64`,(e,t)=>{t.pattern??=it,C.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{rn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function on(e){if(!at.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return rn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var sn=t(`$ZodBase64URL`,(e,t)=>{t.pattern??=at,C.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{on(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),cn=t(`$ZodE164`,(e,t)=>{t.pattern??=ot,C.init(e,t)});function ln(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var un=t(`$ZodJWT`,(e,t)=>{C.init(e,t),e._zod.check=n=>{ln(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),dn=t(`$ZodNumber`,(e,t)=>{S.init(e,t),e._zod.pattern=e._zod.bag.pattern??mt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),fn=t(`$ZodNumberFormat`,(e,t)=>{Ct.init(e,t),dn.init(e,t)}),pn=t(`$ZodBoolean`,(e,t)=>{S.init(e,t),e._zod.pattern=ht,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),mn=t(`$ZodNull`,(e,t)=>{S.init(e,t),e._zod.pattern=gt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),hn=t(`$ZodAny`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),gn=t(`$ZodUnknown`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),_n=t(`$ZodNever`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),vn=t(`$ZodVoid`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),yn=t(`$ZodDate`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function bn(e,t,n){e.issues.length&&t.issues.push(...y(n,e.issues)),t.value[n]=e.value}var xn=t(`$ZodArray`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;ebn(t,n,e))):bn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Sn(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...y(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Cn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=le(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function wn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Sn(e,n,i,t,u))):Sn(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Tn=t(`$ZodObject`,(e,t)=>{if(S.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=c(()=>Cn(t));d(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ae,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Sn(n,t,e,s,r))):Sn(i,t,e,s,r)}return i?wn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),En=t(`$ZodObjectJIT`,(e,t)=>{Tn.init(e,t);let n=e._zod.parse,r=c(()=>Cn(t)),a=e=>{let t=new Ft([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ne(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ne(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(` - if (${n}.issues.length) { - if (${o} in input) { - payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${o}, ...iss.path] : [${o}] - }))); - } - } - - if (${n}.value === undefined) { - if (${o} in input) { - newResult[${o}] = undefined; - } - } else { - newResult[${o}] = ${n}.value; - } - - `):t.write(` - if (${n}.issues.length) { - payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${o}, ...iss.path] : [${o}] - }))); - } - - if (${n}.value === undefined) { - if (${o} in input) { - newResult[${o}] = undefined; - } - } else { - newResult[${o}] = ${n}.value; - } - - `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},o,s=ae,l=!i.jitless,u=l&&oe.value,ee=t.catchall,te;e._zod.parse=(i,c)=>{te??=r.value;let d=i.value;return s(d)?l&&u&&c?.async===!1&&c.jitless!==!0?(o||=a(t.shape),i=o(i,c),ee?wn([],d,i,c,te,e):i):n(i,c):(i.issues.push({expected:`object`,code:`invalid_type`,input:d,inst:e}),i)}});function Dn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!v(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>b(e,r,a())))}),t)}var On=t(`$ZodUnion`,(e,t)=>{S.init(e,t),d(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),d(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),d(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),d(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>u(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>Dn(t,i,e,a)):Dn(s,i,e,a)}}),kn=t(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,On.init(e,t);let n=e._zod.parse;d(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=c(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!ae(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),An=t(`$ZodIntersection`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Mn(e,t,n)):Mn(e,i,a)}});function jn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(m(e)&&m(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=jn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;re.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),v(e))return e;let o=jn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Nn=t(`$ZodTuple`,(e,t)=>{S.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=[...n].reverse().findIndex(e=>e._zod.optin!==`optional`),c=s===-1?0:n.length-s;if(!t.rest){let t=a.length>n.length,i=a.length=a.length&&l>=c)continue;let t=e._zod.run({value:a[l],issues:[]},i);t instanceof Promise?o.push(t.then(e=>Pn(e,r,l))):Pn(t,r,l)}if(t.rest){let e=a.slice(n.length);for(let n of e){l++;let e=t.rest._zod.run({value:n,issues:[]},i);e instanceof Promise?o.push(e.then(e=>Pn(e,r,l))):Pn(e,r,l)}}return o.length?Promise.all(o).then(()=>r):r}});function Pn(e,t,n){e.issues.length&&t.issues.push(...y(n,e.issues)),t.value[n]=e.value}var Fn=t(`$ZodRecord`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!m(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let o=[],s=t.keyType._zod.values;if(s){n.value={};let a=new Set;for(let e of s)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){a.add(typeof e==`number`?e.toString():e);let s=t.valueType._zod.run({value:i[e],issues:[]},r);s instanceof Promise?o.push(s.then(t=>{t.issues.length&&n.issues.push(...y(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(...y(e,s.issues)),n.value[e]=s.value)}let c;for(let e in i)a.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let s of Reflect.ownKeys(i)){if(s===`__proto__`)continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof s==`string`&&mt.test(s)&&c.issues.length){let e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[s]=i[s]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>b(e,r,a())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&n.issues.push(...y(s,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...y(s,l.issues)),n.value[c.value]=l.value)}}return o.length?Promise.all(o).then(()=>n):n}}),In=t(`$ZodEnum`,(e,t)=>{S.init(e,t);let n=o(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ce.has(typeof e)).map(e=>typeof e==`string`?h(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ln=t(`$ZodLiteral`,(e,t)=>{if(S.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?h(e):e?h(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Rn=t(`$ZodTransform`,(e,t)=>{S.init(e,t),e._zod.parse=(i,a)=>{if(a.direction===`backward`)throw new r(e.constructor.name);let o=t.transform(i.value,i);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(i.value=e,i));if(o instanceof Promise)throw new n;return i.value=o,i}});function zn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Bn=t(`$ZodOptional`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${u(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>zn(t,e.value)):zn(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Vn=t(`$ZodExactOptional`,(e,t)=>{Bn.init(e,t),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Hn=t(`$ZodNullable`,(e,t)=>{S.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${u(e.source)}|null)$`):void 0}),d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Un=t(`$ZodDefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Wn(e,t)):Wn(r,t)}});function Wn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Gn=t(`$ZodPrefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Kn=t(`$ZodNonOptional`,(e,t)=>{S.init(e,t),d(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>qn(t,e)):qn(i,e)}});function qn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Jn=t(`$ZodCatch`,(e,t)=>{S.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>b(e,n,a()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>b(e,n,a()))},input:e.value}),e.issues=[]),e)}}),Yn=t(`$ZodPipe`,(e,t)=>{S.init(e,t),d(e._zod,`values`,()=>t.in._zod.values),d(e._zod,`optin`,()=>t.in._zod.optin),d(e._zod,`optout`,()=>t.out._zod.optout),d(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Xn(e,t.in,n)):Xn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Xn(e,t.out,n)):Xn(r,t.out,n)}});function Xn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Zn=t(`$ZodReadonly`,(e,t)=>{S.init(e,t),d(e._zod,`propValues`,()=>t.innerType._zod.propValues),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`optin`,()=>t.innerType?._zod?.optin),d(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Qn):Qn(r)}});function Qn(e){return e.value=Object.freeze(e.value),e}var $n=t(`$ZodFunction`,(e,t)=>(S.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?De(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?De(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await ke(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await ke(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new Nn({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),er=t(`$ZodPromise`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),tr=t(`$ZodLazy`,(e,t)=>{S.init(e,t),d(e._zod,`innerType`,()=>t.getter()),d(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),d(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),d(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),d(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),nr=t(`$ZodCustom`,(e,t)=>{x.init(e,t),S.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>rr(t,n,r,e));rr(i,n,r,e)}});function rr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(be(e))}}var ir,ar=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function or(){return new ar}(ir=globalThis).__zod_globalRegistry??(ir.__zod_globalRegistry=or());var sr=globalThis.__zod_globalRegistry;function cr(e,t){return new e({type:`string`,..._(t)})}function lr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,..._(t)})}function ur(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,..._(t)})}function dr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,..._(t)})}function fr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,..._(t)})}function pr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,..._(t)})}function mr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,..._(t)})}function hr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,..._(t)})}function gr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,..._(t)})}function _r(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,..._(t)})}function vr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,..._(t)})}function yr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,..._(t)})}function br(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,..._(t)})}function xr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,..._(t)})}function Sr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,..._(t)})}function Cr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,..._(t)})}function wr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,..._(t)})}function Tr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,..._(t)})}function Er(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,..._(t)})}function Dr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,..._(t)})}function Or(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,..._(t)})}function kr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,..._(t)})}function Ar(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,..._(t)})}function jr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,..._(t)})}function Mr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,..._(t)})}function Nr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,..._(t)})}function Pr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,..._(t)})}function Fr(e,t){return new e({type:`number`,checks:[],..._(t)})}function Ir(e,t){return new e({type:`number`,coerce:!0,checks:[],..._(t)})}function Lr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,..._(t)})}function Rr(e,t){return new e({type:`boolean`,..._(t)})}function zr(e,t){return new e({type:`boolean`,coerce:!0,..._(t)})}function Br(e,t){return new e({type:`null`,..._(t)})}function Vr(e){return new e({type:`any`})}function Hr(e){return new e({type:`unknown`})}function Ur(e,t){return new e({type:`never`,..._(t)})}function Wr(e,t){return new e({type:`void`,..._(t)})}function Gr(e,t){return new e({type:`date`,..._(t)})}function Kr(e,t){return new bt({check:`less_than`,..._(t),value:e,inclusive:!1})}function qr(e,t){return new bt({check:`less_than`,..._(t),value:e,inclusive:!0})}function Jr(e,t){return new xt({check:`greater_than`,..._(t),value:e,inclusive:!1})}function Yr(e,t){return new xt({check:`greater_than`,..._(t),value:e,inclusive:!0})}function Xr(e,t){return new St({check:`multiple_of`,..._(t),value:e})}function Zr(e,t){return new wt({check:`max_length`,..._(t),maximum:e})}function Qr(e,t){return new Tt({check:`min_length`,..._(t),minimum:e})}function $r(e,t){return new Et({check:`length_equals`,..._(t),length:e})}function ei(e,t){return new Ot({check:`string_format`,format:`regex`,..._(t),pattern:e})}function ti(e){return new kt({check:`string_format`,format:`lowercase`,..._(e)})}function ni(e){return new At({check:`string_format`,format:`uppercase`,..._(e)})}function ri(e,t){return new jt({check:`string_format`,format:`includes`,..._(t),includes:e})}function ii(e,t){return new Mt({check:`string_format`,format:`starts_with`,..._(t),prefix:e})}function ai(e,t){return new Nt({check:`string_format`,format:`ends_with`,..._(t),suffix:e})}function w(e){return new Pt({check:`overwrite`,tx:e})}function oi(e){return w(t=>t.normalize(e))}function si(){return w(e=>e.trim())}function ci(){return w(e=>e.toLowerCase())}function li(){return w(e=>e.toUpperCase())}function ui(){return w(e=>re(e))}function di(e,t,n){return new e({type:`array`,element:t,..._(n)})}function fi(e,t,n){let r=_(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function pi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,..._(n)})}function mi(e){let t=hi(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(be(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(be(r))}},e(n.value,n)));return t}function hi(e,t){let n=new x({check:`custom`,..._(t)});return n._zod.check=e,n}function gi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??sr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function T(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,T(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&E(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function _i(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/ - -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function vi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:bi(t,`input`,e.processors),output:bi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function E(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return E(r.element,n);if(r.type===`set`)return E(r.valueType,n);if(r.type===`lazy`)return E(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return E(r.innerType,n);if(r.type===`intersection`)return E(r.left,n)||E(r.right,n);if(r.type===`record`||r.type===`map`)return E(r.keyType,n)||E(r.valueType,n);if(r.type===`pipe`)return E(r.in,n)||E(r.out,n);if(r.type===`object`){for(let e in r.shape)if(E(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(E(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(E(e,n))return!0;return!!(r.rest&&E(r.rest,n))}return!1}var yi=(e,t={})=>n=>{let r=gi({...n,processors:t});return T(e,r),_i(r,e),vi(r,e)},bi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=gi({...i??{},target:a,io:t,processors:n});return T(e,o),_i(o,e),vi(o,e)},xi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Si=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=xi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ci=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},wi=(e,t,n,r)=>{n.type=`boolean`},Ti=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},Ei=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},Di=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Oi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},ki=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Ai=(e,t,n,r)=>{n.not={}},ji=(e,t,n,r)=>{},Mi=(e,t,n,r)=>{},Ni=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Pi=(e,t,n,r)=>{let i=e._zod.def,a=o(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Fi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Ii=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},Li=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Ri=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},zi=(e,t,n,r)=>{n.type=`boolean`},Bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Vi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Hi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ui=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Wi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Gi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=T(a.element,t,{...r,path:[...r.path,`items`]})},Ki=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=T(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=T(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},qi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>T(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ji=(e,t,n,r)=>{let i=e._zod.def,a=T(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=T(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Yi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>T(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?T(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:ee}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof ee==`number`&&(i.maxItems=ee)},Xi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=T(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=T(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=T(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Zi=(e,t,n,r)=>{let i=e._zod.def,a=T(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Qi=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},$i=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ea=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ta=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},na=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;T(a,t,r);let o=t.seen.get(e);o.ref=a},ra=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ia=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},aa=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},oa=(e,t,n,r)=>{let i=e._zod.innerType;T(i,t,r);let a=t.seen.get(e);a.ref=i},sa={string:Si,number:Ci,boolean:wi,bigint:Ti,symbol:Ei,null:Di,undefined:Oi,void:ki,never:Ai,any:ji,unknown:Mi,date:Ni,enum:Pi,literal:Fi,nan:Ii,template_literal:Li,file:Ri,success:zi,custom:Bi,function:Vi,transform:Hi,map:Ui,set:Wi,array:Gi,object:Ki,union:qi,intersection:Ji,tuple:Yi,record:Xi,nullable:Zi,nonoptional:Qi,default:$i,prefault:ea,catch:ta,pipe:na,readonly:ra,promise:ia,optional:aa,lazy:oa};function ca(e,t){if(`_idmap`in e){let n=e,r=gi({...t,processors:sa}),i={};for(let e of n._idmap.entries()){let[t,n]=e;T(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;_i(r,n),a[t]=vi(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=gi({...t,processors:sa});return T(e,n),_i(n,e),vi(n,e)}var la=t(`ZodISODateTime`,(e,t)=>{Yt.init(e,t),A.init(e,t)});function ua(e){return jr(la,e)}var da=t(`ZodISODate`,(e,t)=>{Xt.init(e,t),A.init(e,t)});function fa(e){return Mr(da,e)}var pa=t(`ZodISOTime`,(e,t)=>{Zt.init(e,t),A.init(e,t)});function ma(e){return Nr(pa,e)}var ha=t(`ZodISODuration`,(e,t)=>{Qt.init(e,t),A.init(e,t)});function ga(e){return Pr(ha,e)}var _a=(e,t)=>{Se.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Te(e,t)},flatten:{value:t=>we(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,s,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,s,2)}},isEmpty:{get(){return e.issues.length===0}}})},va=t(`ZodError`,_a),D=t(`ZodError`,_a,{Parent:Error}),ya=Ee(D),ba=Oe(D),xa=Ae(D),Sa=Me(D),Ca=Pe(D),wa=Fe(D),Ta=Ie(D),Ea=Le(D),Da=Re(D),Oa=ze(D),ka=Be(D),Aa=Ve(D),O=t(`ZodType`,(e,t)=>(S.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:bi(e,`input`),output:bi(e,`output`)}}),e.toJSONSchema=yi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(p(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>g(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>ya(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>xa(e,t,n),e.parseAsync=async(t,n)=>ba(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Sa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ca(e,t,n),e.decode=(t,n)=>wa(e,t,n),e.encodeAsync=async(t,n)=>Ta(e,t,n),e.decodeAsync=async(t,n)=>Ea(e,t,n),e.safeEncode=(t,n)=>Da(e,t,n),e.safeDecode=(t,n)=>Oa(e,t,n),e.safeEncodeAsync=async(t,n)=>ka(e,t,n),e.safeDecodeAsync=async(t,n)=>Aa(e,t,n),e.refine=(t,n)=>e.check(Jo(t,n)),e.superRefine=t=>e.check(Yo(t)),e.overwrite=t=>e.check(w(t)),e.optional=()=>Eo(e),e.exactOptional=()=>Oo(e),e.nullable=()=>Ao(e),e.nullish=()=>Eo(Ao(e)),e.nonoptional=t=>Io(e,t),e.array=()=>L(e),e.or=t=>z([e,t]),e.and=t=>vo(e,t),e.transform=t=>Bo(e,wo(t)),e.default=t=>Mo(e,t),e.prefault=t=>Po(e,t),e.catch=t=>Ro(e,t),e.pipe=t=>Bo(e,t),e.readonly=()=>Ho(e),e.describe=t=>{let n=e.clone();return sr.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return sr.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return sr.get(e);let n=e.clone();return sr.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ja=t(`_ZodString`,(e,t)=>{Lt.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ei(...t)),e.includes=(...t)=>e.check(ri(...t)),e.startsWith=(...t)=>e.check(ii(...t)),e.endsWith=(...t)=>e.check(ai(...t)),e.min=(...t)=>e.check(Qr(...t)),e.max=(...t)=>e.check(Zr(...t)),e.length=(...t)=>e.check($r(...t)),e.nonempty=(...t)=>e.check(Qr(1,...t)),e.lowercase=t=>e.check(ti(t)),e.uppercase=t=>e.check(ni(t)),e.trim=()=>e.check(si()),e.normalize=(...t)=>e.check(oi(...t)),e.toLowerCase=()=>e.check(ci()),e.toUpperCase=()=>e.check(li()),e.slugify=()=>e.check(ui())}),Ma=t(`ZodString`,(e,t)=>{Lt.init(e,t),ja.init(e,t),e.email=t=>e.check(lr(Na,t)),e.url=t=>e.check(hr(Ia,t)),e.jwt=t=>e.check(Ar(Za,t)),e.emoji=t=>e.check(gr(La,t)),e.guid=t=>e.check(ur(Pa,t)),e.uuid=t=>e.check(dr(Fa,t)),e.uuidv4=t=>e.check(fr(Fa,t)),e.uuidv6=t=>e.check(pr(Fa,t)),e.uuidv7=t=>e.check(mr(Fa,t)),e.nanoid=t=>e.check(_r(Ra,t)),e.guid=t=>e.check(ur(Pa,t)),e.cuid=t=>e.check(vr(za,t)),e.cuid2=t=>e.check(yr(Ba,t)),e.ulid=t=>e.check(br(Va,t)),e.base64=t=>e.check(Dr(Ja,t)),e.base64url=t=>e.check(Or(Ya,t)),e.xid=t=>e.check(xr(Ha,t)),e.ksuid=t=>e.check(Sr(Ua,t)),e.ipv4=t=>e.check(Cr(Wa,t)),e.ipv6=t=>e.check(wr(Ga,t)),e.cidrv4=t=>e.check(Tr(Ka,t)),e.cidrv6=t=>e.check(Er(qa,t)),e.e164=t=>e.check(kr(Xa,t)),e.datetime=t=>e.check(ua(t)),e.date=t=>e.check(fa(t)),e.time=t=>e.check(ma(t)),e.duration=t=>e.check(ga(t))});function k(e){return cr(Ma,e)}var A=t(`ZodStringFormat`,(e,t)=>{C.init(e,t),ja.init(e,t)}),Na=t(`ZodEmail`,(e,t)=>{Bt.init(e,t),A.init(e,t)}),Pa=t(`ZodGUID`,(e,t)=>{Rt.init(e,t),A.init(e,t)}),Fa=t(`ZodUUID`,(e,t)=>{zt.init(e,t),A.init(e,t)}),Ia=t(`ZodURL`,(e,t)=>{Vt.init(e,t),A.init(e,t)}),La=t(`ZodEmoji`,(e,t)=>{Ht.init(e,t),A.init(e,t)}),Ra=t(`ZodNanoID`,(e,t)=>{Ut.init(e,t),A.init(e,t)}),za=t(`ZodCUID`,(e,t)=>{Wt.init(e,t),A.init(e,t)}),Ba=t(`ZodCUID2`,(e,t)=>{Gt.init(e,t),A.init(e,t)}),Va=t(`ZodULID`,(e,t)=>{Kt.init(e,t),A.init(e,t)}),Ha=t(`ZodXID`,(e,t)=>{qt.init(e,t),A.init(e,t)}),Ua=t(`ZodKSUID`,(e,t)=>{Jt.init(e,t),A.init(e,t)}),Wa=t(`ZodIPv4`,(e,t)=>{$t.init(e,t),A.init(e,t)}),Ga=t(`ZodIPv6`,(e,t)=>{en.init(e,t),A.init(e,t)}),Ka=t(`ZodCIDRv4`,(e,t)=>{tn.init(e,t),A.init(e,t)}),qa=t(`ZodCIDRv6`,(e,t)=>{nn.init(e,t),A.init(e,t)}),Ja=t(`ZodBase64`,(e,t)=>{an.init(e,t),A.init(e,t)}),Ya=t(`ZodBase64URL`,(e,t)=>{sn.init(e,t),A.init(e,t)}),Xa=t(`ZodE164`,(e,t)=>{cn.init(e,t),A.init(e,t)}),Za=t(`ZodJWT`,(e,t)=>{un.init(e,t),A.init(e,t)}),Qa=t(`ZodNumber`,(e,t)=>{dn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.gt=(t,n)=>e.check(Jr(t,n)),e.gte=(t,n)=>e.check(Yr(t,n)),e.min=(t,n)=>e.check(Yr(t,n)),e.lt=(t,n)=>e.check(Kr(t,n)),e.lte=(t,n)=>e.check(qr(t,n)),e.max=(t,n)=>e.check(qr(t,n)),e.int=t=>e.check(eo(t)),e.safe=t=>e.check(eo(t)),e.positive=t=>e.check(Jr(0,t)),e.nonnegative=t=>e.check(Yr(0,t)),e.negative=t=>e.check(Kr(0,t)),e.nonpositive=t=>e.check(qr(0,t)),e.multipleOf=(t,n)=>e.check(Xr(t,n)),e.step=(t,n)=>e.check(Xr(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function j(e){return Fr(Qa,e)}var $a=t(`ZodNumberFormat`,(e,t)=>{fn.init(e,t),Qa.init(e,t)});function eo(e){return Lr($a,e)}var to=t(`ZodBoolean`,(e,t)=>{pn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function M(e){return Rr(to,e)}var no=t(`ZodNull`,(e,t)=>{mn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r)});function ro(e){return Br(no,e)}var io=t(`ZodAny`,(e,t)=>{hn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function N(){return Vr(io)}var ao=t(`ZodUnknown`,(e,t)=>{gn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function P(){return Hr(ao)}var oo=t(`ZodNever`,(e,t)=>{_n.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r)});function so(e){return Ur(oo,e)}var co=t(`ZodVoid`,(e,t)=>{vn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r)});function F(e){return Wr(co,e)}var lo=t(`ZodDate`,(e,t)=>{yn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.min=(t,n)=>e.check(Yr(t,n)),e.max=(t,n)=>e.check(qr(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function I(e){return Gr(lo,e)}var uo=t(`ZodArray`,(e,t)=>{xn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Qr(t,n)),e.nonempty=t=>e.check(Qr(1,t)),e.max=(t,n)=>e.check(Zr(t,n)),e.length=(t,n)=>e.check($r(t,n)),e.unwrap=()=>e.element});function L(e,t){return di(uo,e,t)}var fo=t(`ZodObject`,(e,t)=>{En.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),d(e,`shape`,()=>t.shape),e.keyof=()=>H(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:P()}),e.loose=()=>e.clone({...e._zod.def,catchall:P()}),e.strict=()=>e.clone({...e._zod.def,catchall:so()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>pe(e,t),e.safeExtend=t=>me(e,t),e.merge=t=>he(e,t),e.pick=t=>de(e,t),e.omit=t=>fe(e,t),e.partial=(...t)=>ge(To,e,t[0]),e.required=(...t)=>_e(Fo,e,t[0])});function R(e,t){return new fo({type:`object`,shape:e??{},..._(t)})}function po(e,t){return new fo({type:`object`,shape:e,catchall:so(),..._(t)})}var mo=t(`ZodUnion`,(e,t)=>{On.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.options=t.options});function z(e,t){return new mo({type:`union`,options:e,..._(t)})}var ho=t(`ZodDiscriminatedUnion`,(e,t)=>{mo.init(e,t),kn.init(e,t)});function go(e,t,n){return new ho({type:`union`,options:t,discriminator:e,..._(n)})}var _o=t(`ZodIntersection`,(e,t)=>{An.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r)});function vo(e,t){return new _o({type:`intersection`,left:e,right:t})}var yo=t(`ZodTuple`,(e,t)=>{Nn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function B(e,t,n){let r=t instanceof S;return new yo({type:`tuple`,items:e,rest:r?t:null,..._(r?n:t)})}var bo=t(`ZodRecord`,(e,t)=>{Fn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function V(e,t,n){return new bo({type:`record`,keyType:e,valueType:t,..._(n)})}var xo=t(`ZodEnum`,(e,t)=>{In.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new xo({...t,checks:[],..._(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new xo({...t,checks:[],..._(r),entries:i})}});function H(e,t){return new xo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,..._(t)})}var So=t(`ZodLiteral`,(e,t)=>{Ln.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function U(e,t){return new So({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}var Co=t(`ZodTransform`,(e,t)=>{Rn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e._zod.parse=(n,i)=>{if(i.direction===`backward`)throw new r(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(be(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(be(t))}};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n)):(n.value=a,n)}});function wo(e){return new Co({type:`transform`,transform:e})}var To=t(`ZodOptional`,(e,t)=>{Bn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Eo(e){return new To({type:`optional`,innerType:e})}var Do=t(`ZodExactOptional`,(e,t)=>{Vn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e){return new Do({type:`optional`,innerType:e})}var ko=t(`ZodNullable`,(e,t)=>{Hn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ao(e){return new ko({type:`nullable`,innerType:e})}var jo=t(`ZodDefault`,(e,t)=>{Un.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mo(e,t){return new jo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}var No=t(`ZodPrefault`,(e,t)=>{Gn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Po(e,t){return new No({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}var Fo=t(`ZodNonOptional`,(e,t)=>{Kn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Io(e,t){return new Fo({type:`nonoptional`,innerType:e,..._(t)})}var Lo=t(`ZodCatch`,(e,t)=>{Jn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ro(e,t){return new Lo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var zo=t(`ZodPipe`,(e,t)=>{Yn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>na(e,t,n,r),e.in=t.in,e.out=t.out});function Bo(e,t){return new zo({type:`pipe`,in:e,out:t})}var Vo=t(`ZodReadonly`,(e,t)=>{Zn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ra(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ho(e){return new Vo({type:`readonly`,innerType:e})}var Uo=t(`ZodLazy`,(e,t)=>{tr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oa(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function W(e){return new Uo({type:`lazy`,getter:e})}var Wo=t(`ZodPromise`,(e,t)=>{er.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function G(e){return new Wo({type:`promise`,innerType:e})}var Go=t(`ZodFunction`,(e,t)=>{$n.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r)});function K(e){return new Go({type:`function`,input:Array.isArray(e?.input)?B(e?.input):e?.input??L(P()),output:e?.output??P()})}var Ko=t(`ZodCustom`,(e,t)=>{nr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r)});function qo(e,t){return fi(Ko,e??(()=>!0),t)}function Jo(e,t={}){return pi(Ko,e,t)}function Yo(e){return mi(e)}function Xo(e,t={}){let n=new Ko({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,..._(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Zo(e,t){return Bo(wo(e),t)}var Qo=e({AggregationFunction:()=>ls,AggregationMetricType:()=>xl,AggregationNodeSchema:()=>us,AggregationStageSchema:()=>nl,ApiMethod:()=>ac,AsyncValidationSchema:()=>Hs,BaseEngineOptionsSchema:()=>Q,CDCConfigSchema:()=>pc,ComputedFieldCacheSchema:()=>Ns,ConditionalValidationSchema:()=>Gs,ConsistencyLevelSchema:()=>Yc,CrossFieldValidationSchema:()=>Bs,CubeJoinSchema:()=>El,CurrencyConfigSchema:()=>ks,CustomValidatorSchema:()=>Us,DataEngineAggregateRequestSchema:()=>Ic,DataEngineBatchRequestSchema:()=>zc,DataEngineCountRequestSchema:()=>Fc,DataEngineDeleteRequestSchema:()=>Pc,DataEngineExecuteRequestSchema:()=>Lc,DataEngineFilterSchema:()=>Z,DataEngineFindOneRequestSchema:()=>jc,DataEngineFindRequestSchema:()=>Ac,DataEngineInsertOptionsSchema:()=>Cc,DataEngineInsertRequestSchema:()=>Mc,DataEngineSortSchema:()=>xc,DataEngineUpdateRequestSchema:()=>Nc,DataEngineVectorFindRequestSchema:()=>Rc,DataQualityRulesSchema:()=>Ms,DataTypeMappingSchema:()=>Kc,DatasetLoadResultSchema:()=>ul,DatasetMode:()=>rl,DatasetSchema:()=>il,DatasourceCapabilities:()=>bl,DimensionSchema:()=>Tl,DimensionType:()=>Sl,DocumentSchemaValidationSchema:()=>$c,DocumentTemplateSchema:()=>pl,DocumentVersionSchema:()=>fl,DriverCapabilitiesSchema:()=>Hc,DriverConfigSchema:()=>Wc,DriverOptionsSchema:()=>$,DriverType:()=>yl,ESignatureConfigSchema:()=>ml,EngineAggregateOptionsSchema:()=>Ec,EngineCountOptionsSchema:()=>Dc,EngineDeleteOptionsSchema:()=>Tc,EngineQueryOptionsSchema:()=>Sc,EngineUpdateOptionsSchema:()=>wc,ExternalDataSourceSchema:()=>_l,ExternalFieldMappingSchema:()=>vl,FILTER_OPERATORS:()=>os,FeedActorSchema:()=>jl,FeedItemType:()=>Dl,FeedVisibility:()=>Ml,Field:()=>Fs,FieldChangeEntrySchema:()=>kl,FieldMappingSchema:()=>yc,FieldNodeSchema:()=>_s,FieldOperatorsSchema:()=>$o,FieldReferenceSchema:()=>q,FieldSchema:()=>Ps,FieldType:()=>Ds,FileAttachmentConfigSchema:()=>js,FilterConditionSchema:()=>J,FormatValidationSchema:()=>zs,FullTextSearchSchema:()=>vs,HookEvent:()=>_c,IndexSchema:()=>sc,JSONValidationSchema:()=>Vs,JoinNodeSchema:()=>ps,JoinStrategy:()=>fs,JoinType:()=>ds,LOGICAL_OPERATORS:()=>ss,MentionSchema:()=>Ol,MetricSchema:()=>wl,NoSQLDataTypeMappingSchema:()=>el,NoSQLDatabaseTypeSchema:()=>Jc,NoSQLIndexTypeSchema:()=>Xc,NoSQLQueryOptionsSchema:()=>tl,NormalizedFilterSchema:()=>es,NotificationChannel:()=>Pl,ObjectCapabilities:()=>oc,ObjectDependencyGraphSchema:()=>sl,ObjectDependencyNodeSchema:()=>ol,ObjectSchema:()=>gc,PartitioningConfigSchema:()=>fc,PoolConfigSchema:()=>Uc,QuerySchema:()=>Y,ReactionSchema:()=>Al,ReferenceResolutionErrorSchema:()=>cl,ReferenceResolutionSchema:()=>al,ReplicationConfigSchema:()=>Qc,SQLDialectSchema:()=>Gc,SSLConfigSchema:()=>qc,ScriptValidationSchema:()=>Is,SearchConfigSchema:()=>cc,SeedLoaderConfigSchema:()=>ll,SeedLoaderRequestSchema:()=>dl,SelectOptionSchema:()=>Os,ShardingConfigSchema:()=>Zc,SoftDeleteConfigSchema:()=>uc,SortNodeSchema:()=>cs,StateMachineValidationSchema:()=>Rs,SubscriptionEventType:()=>Nl,TenancyConfigSchema:()=>lc,TenantDatabaseLifecycleSchema:()=>Ll,TenantResolverStrategySchema:()=>Fl,TimeUpdateInterval:()=>Cl,TransformType:()=>vc,TursoGroupSchema:()=>Il,UniquenessValidationSchema:()=>Ls,VALID_AST_OPERATORS:()=>ts,ValidationRuleSchema:()=>Ws,VectorConfigSchema:()=>As,VersioningConfigSchema:()=>dc,WindowFunction:()=>ms,WindowFunctionNodeSchema:()=>gs,WindowSpecSchema:()=>hs,isFilterAST:()=>ns,parseFilterAST:()=>as}),q=R({$field:k().describe(`Field Reference/Column Name`)});R({$eq:N().optional(),$ne:N().optional()}),R({$gt:z([j(),I(),q]).optional(),$gte:z([j(),I(),q]).optional(),$lt:z([j(),I(),q]).optional(),$lte:z([j(),I(),q]).optional()}),R({$in:L(N()).optional(),$nin:L(N()).optional()}),R({$between:B([z([j(),I(),q]),z([j(),I(),q])]).optional()}),R({$contains:k().optional(),$notContains:k().optional(),$startsWith:k().optional(),$endsWith:k().optional()}),R({$null:M().optional(),$exists:M().optional()});var $o=R({$eq:N().optional(),$ne:N().optional(),$gt:z([j(),I(),q]).optional(),$gte:z([j(),I(),q]).optional(),$lt:z([j(),I(),q]).optional(),$lte:z([j(),I(),q]).optional(),$in:L(N()).optional(),$nin:L(N()).optional(),$between:B([z([j(),I(),q]),z([j(),I(),q])]).optional(),$contains:k().optional(),$notContains:k().optional(),$startsWith:k().optional(),$endsWith:k().optional(),$null:M().optional(),$exists:M().optional()}),J=W(()=>V(k(),P()).and(R({$and:L(J).optional(),$or:L(J).optional(),$not:J.optional()})));R({where:J.optional()});var es=W(()=>R({$and:L(z([V(k(),$o),es])).optional(),$or:L(z([V(k(),$o),es])).optional(),$not:z([V(k(),$o),es]).optional()})),ts=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function ns(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=>ns(e));if(e.length>=2&&typeof e[1]==`string`)return ts.has(e[1].toLowerCase())}return e.every(e=>ns(e))?e.length>0:!1}var rs={"=":`$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 is(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=rs[i];return a?{[t]:{[a]:r}}:{[t]:{[`$${i}`]:r}}}function as(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=>as(e)).filter(Boolean);return r.length===0?void 0:r.length===1?r[0]:{[n]:r}}if(e.length>=2&&typeof t==`string`)return is(e);if(e.every(e=>Array.isArray(e))){let t=e.map(e=>as(e)).filter(Boolean);return t.length===0?void 0:t.length===1?t[0]:{$and:t}}}var os=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],ss=[`$and`,`$or`,`$not`];[...os,...ss];var cs=R({field:k(),order:H([`asc`,`desc`]).default(`asc`)}),ls=H([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),us=R({function:ls.describe(`Aggregation function`),field:k().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:k().describe(`Result column alias`),distinct:M().optional().describe(`Apply DISTINCT before aggregation`),filter:J.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)}),ds=H([`inner`,`left`,`right`,`full`]),fs=H([`auto`,`database`,`hash`,`loop`]),ps=W(()=>R({type:ds.describe(`Join type`),strategy:fs.optional().describe(`Execution strategy hint`),object:k().describe(`Object/table to join`),alias:k().optional().describe(`Table alias`),on:J.describe(`Join condition`),subquery:W(()=>Y).optional().describe(`Subquery instead of object`)})),ms=H([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),hs=R({partitionBy:L(k()).optional().describe(`PARTITION BY fields`),orderBy:L(cs).optional().describe(`ORDER BY specification`),frame:R({type:H([`rows`,`range`]).optional(),start:k().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:k().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)}),gs=R({function:ms.describe(`Window function name`),field:k().optional().describe(`Field to operate on (for aggregate window functions)`),alias:k().describe(`Result column alias`),over:hs.describe(`Window specification (OVER clause)`)}),_s=W(()=>z([k(),R({field:k(),fields:L(_s).optional(),alias:k().optional()})])),vs=R({query:k().describe(`Search query text`),fields:L(k()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:M().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:H([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:V(k(),j()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:j().optional().describe(`Minimum relevance score threshold`),language:k().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:M().optional().default(!1).describe(`Enable search result highlighting`)}),Y=R({object:k().describe(`Object name (e.g. account)`),fields:L(_s).optional().describe(`Fields to retrieve`),where:J.optional().describe(`Filtering criteria (WHERE)`),search:vs.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:L(cs).optional().describe(`Sorting instructions (ORDER BY)`),limit:j().optional().describe(`Max records to return (LIMIT)`),offset:j().optional().describe(`Records to skip (OFFSET)`),top:j().optional().describe(`Alias for limit (OData compatibility)`),cursor:V(k(),P()).optional().describe(`Cursor for keyset pagination`),joins:L(ps).optional().describe(`Explicit Table Joins`),aggregations:L(us).optional().describe(`Aggregation functions`),groupBy:L(k()).optional().describe(`GROUP BY fields`),having:J.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:L(gs).optional().describe(`Window functions with OVER clause`),distinct:M().optional().describe(`SELECT DISTINCT flag`)}).extend({expand:W(()=>V(k(),Y)).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.`)}),ys=k().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)`),bs=k().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)`);k().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 xs=H([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),Ss=H([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),Cs=R({enabled:M().default(!1).describe(`Enable automatic key rotation`),frequencyDays:j().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:j().default(3).describe(`Number of old key versions to retain`),autoRotate:M().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),ws=R({enabled:M().default(!1).describe(`Enable field-level encryption`),algorithm:xs.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:R({provider:Ss.describe(`Key management service provider`),keyId:k().optional().describe(`Key identifier in the provider`),rotationPolicy:Cs.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:H([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:M().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:M().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);R({fieldName:k().describe(`Name of the field to encrypt`),encryptionConfig:ws.describe(`Encryption settings for this field`),indexable:M().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var Ts=H([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),Es=R({field:k().describe(`Field name to apply masking to`),strategy:Ts.describe(`Masking strategy to use`),pattern:k().optional().describe(`Regex pattern for partial masking`),preserveFormat:M().default(!0).describe(`Keep the original data format after masking`),preserveLength:M().default(!0).describe(`Keep the original data length after masking`),roles:L(k()).optional().describe(`Roles that see masked data`),exemptRoles:L(k()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);R({enabled:M().default(!1).describe(`Enable data masking`),rules:L(Es).describe(`List of field-level masking rules`),auditUnmasking:M().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var Ds=H(`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(`.`)),Os=R({label:k().describe(`Display label (human-readable, any case allowed)`),value:ys.describe(`Stored value (lowercase machine identifier)`),color:k().optional().describe(`Color code for badges/charts`),default:M().optional().describe(`Is default option`)});R({latitude:j().min(-90).max(90).describe(`Latitude coordinate`),longitude:j().min(-180).max(180).describe(`Longitude coordinate`),altitude:j().optional().describe(`Altitude in meters`),accuracy:j().optional().describe(`Accuracy in meters`)});var ks=R({precision:j().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:H([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:k().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});R({value:j().describe(`Monetary amount`),currency:k().length(3).describe(`Currency code (ISO 4217)`)}),R({street:k().optional().describe(`Street address`),city:k().optional().describe(`City name`),state:k().optional().describe(`State/Province`),postalCode:k().optional().describe(`Postal/ZIP code`),country:k().optional().describe(`Country name or code`),countryCode:k().optional().describe(`ISO country code (e.g., US, GB)`),formatted:k().optional().describe(`Formatted address string`)});var As=R({dimensions:j().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:H([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:M().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:M().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:H([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),js=R({minSize:j().min(0).optional().describe(`Minimum file size in bytes`),maxSize:j().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:L(k()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:L(k()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:L(k()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:L(k()).optional().describe(`Blocked MIME types`),virusScan:M().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:H([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:M().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:M().default(!0).describe(`Quarantine files if threat detected`),storageProvider:k().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:k().optional().describe(`Target bucket name`),storagePrefix:k().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:R({minWidth:j().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:j().min(1).optional().describe(`Maximum image width in pixels`),minHeight:j().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:j().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:k().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:M().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:L(R({name:k().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:j().min(1).describe(`Thumbnail width in pixels`),height:j().min(1).describe(`Thumbnail height in pixels`),crop:M().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:M().default(!1).describe(`Preserve EXIF metadata`),autoRotate:M().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:M().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:M().default(!0).describe(`Allow replacing existing files`),allowDelete:M().default(!0).describe(`Allow deleting uploaded files`),requireUpload:M().default(!1).describe(`Require at least one file when field is required`),extractMetadata:M().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:M().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:M().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:j().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:M().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:j().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`}),Ms=R({uniqueness:M().default(!1).describe(`Enforce unique values across all records`),completeness:j().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:R({source:k().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:j().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),Ns=R({enabled:M().describe(`Enable caching for computed field results`),ttl:j().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:L(k()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),Ps=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:k().optional().describe(`Human readable label`),type:Ds.describe(`Field Data Type`),description:k().optional().describe(`Tooltip/Help text`),format:k().optional().describe(`Format string (e.g. email, phone)`),columnName:k().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:M().default(!1).describe(`Is required`),searchable:M().default(!1).describe(`Is searchable`),multiple:M().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:M().default(!1).describe(`Is unique constraint`),defaultValue:P().optional().describe(`Default value`),maxLength:j().optional().describe(`Max character length`),minLength:j().optional().describe(`Min character length`),precision:j().optional().describe(`Total digits`),scale:j().optional().describe(`Decimal places`),min:j().optional().describe(`Minimum value`),max:j().optional().describe(`Maximum value`),options:L(Os).optional().describe(`Static options for select/multiselect`),reference:k().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:L(k()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:M().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:H([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:k().optional().describe(`Formula expression`),summaryOperations:R({object:k().describe(`Source child object name for roll-up`),field:k().describe(`Field on child object to aggregate`),function:H([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:k().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:k().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:M().optional().describe(`Show line numbers in code editor`),maxRating:j().optional().describe(`Maximum rating value (default: 5)`),allowHalf:M().optional().describe(`Allow half-star ratings`),displayMap:M().optional().describe(`Display map widget for location field`),allowGeocoding:M().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:H([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:H([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:M().optional().describe(`Allow transparency/alpha channel`),presetColors:L(k()).optional().describe(`Preset color options`),step:j().optional().describe(`Step increment for slider (default: 1)`),showValue:M().optional().describe(`Display current value on slider`),marks:V(k(),k()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:H([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:H([`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:M().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:M().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:ks.optional().describe(`Configuration for currency field type`),vectorConfig:As.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:js.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:ws.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:Es.optional().describe(`Data masking rules for PII protection`),auditTrail:M().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:L(k()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:Ns.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:Ms.optional().describe(`Data quality validation and monitoring rules`),group:k().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:k().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:M().default(!1).describe(`Hidden from default UI`),readonly:M().default(!1).describe(`Read-only in UI`),sortable:M().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:k().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:M().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:M().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:k().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:M().default(!1).describe(`Create standard database index`),externalId:M().default(!1).describe(`Is external ID for upsert operations`)}),Fs={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})},X=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:k().optional().describe(`Human-readable label for the rule listing`),description:k().optional().describe(`Administrative notes explaining the business reason`),active:M().default(!0),events:L(H([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:j().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:L(k()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:H([`error`,`warning`,`info`]).default(`error`),message:k().describe(`Error message to display to the user`)}),Is=X.extend({type:U(`script`),condition:k().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),Ls=X.extend({type:U(`unique`),fields:L(k()).describe(`Fields that must be combined unique`),scope:k().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:M().default(!0)}),Rs=X.extend({type:U(`state_machine`),field:k().describe(`State field (e.g. status)`),transitions:V(k(),L(k())).describe(`Map of { OldState: [AllowedNewStates] }`)}),zs=X.extend({type:U(`format`),field:k(),regex:k().optional(),format:H([`email`,`url`,`phone`,`json`]).optional()}),Bs=X.extend({type:U(`cross_field`),condition:k().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:L(k()).describe(`Fields involved in the validation`)}),Vs=X.extend({type:U(`json_schema`),field:k().describe(`JSON field to validate`),schema:V(k(),P()).describe(`JSON Schema object definition`)}),Hs=X.extend({type:U(`async`),field:k().describe(`Field to validate`),validatorUrl:k().optional().describe(`External API endpoint for validation`),method:H([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:V(k(),k()).optional().describe(`Custom headers for the request`),validatorFunction:k().optional().describe(`Reference to custom validator function`),timeout:j().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:j().optional().describe(`Debounce delay in milliseconds`),params:V(k(),P()).optional().describe(`Additional parameters to pass to validator`)}),Us=X.extend({type:U(`custom`),handler:k().describe(`Name of the custom validation function registered in the system`),params:V(k(),P()).optional().describe(`Parameters passed to the custom handler`)}),Ws=W(()=>go(`type`,[Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Gs])),Gs=X.extend({type:U(`conditional`),when:k().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:Ws.describe(`Validation rule to apply when condition is true`),otherwise:Ws.optional().describe(`Validation rule to apply when condition is false`)}),Ks=z([k().describe(`Action Name`),R({type:k(),params:V(k(),P()).optional()})]),qs=z([k().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),R({type:k(),params:V(k(),P()).optional()})]),Js=R({target:k().optional().describe(`Target State ID`),cond:qs.optional().describe(`Condition (Guard) required to take this path`),actions:L(Ks).optional().describe(`Actions to execute during transition`),description:k().optional().describe(`Human readable description of this rule`)});R({type:k().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:V(k(),P()).optional().describe(`Expected event payload structure`)});var Ys=W(()=>R({type:H([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:L(Ks).optional().describe(`Actions to run when entering this state`),exit:L(Ks).optional().describe(`Actions to run when leaving this state`),on:V(k(),z([k(),Js,L(Js)])).optional().describe(`Map of Event Type -> Transition Definition`),always:L(Js).optional(),initial:k().optional().describe(`Initial child state (if compound)`),states:V(k(),Ys).optional(),meta:R({label:k().optional(),description:k().optional(),color:k().optional(),aiInstructions:k().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),Xs=R({id:bs.describe(`Unique Machine ID`),description:k().optional(),contextSchema:V(k(),P()).optional().describe(`Zod Schema for the machine context/memory`),initial:k().describe(`Initial State ID`),states:V(k(),Ys).describe(`State Nodes`),on:V(k(),z([k(),Js,L(Js)])).optional()});R({key:k().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:k().optional().describe(`Fallback value when translation key is not found`),params:V(k(),z([k(),j(),M()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var Zs=k().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),Qs=R({ariaLabel:Zs.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:k().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:k().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);R({key:k().describe(`Translation key`),zero:k().optional().describe(`Zero form (e.g., "No items")`),one:k().optional().describe(`Singular form (e.g., "{count} item")`),two:k().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:k().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:k().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:k().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var $s=R({style:H([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:k().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:k().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:j().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:j().optional().describe(`Maximum number of fraction digits`),useGrouping:M().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),ec=R({dateStyle:H([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:H([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:k().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:M().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);R({code:k().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:L(k()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:H([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:$s.optional().describe(`Default number formatting rules`),dateFormat:ec.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var tc=R({name:k(),label:Zs,type:Ds,required:M().default(!1),options:L(R({label:Zs,value:k()})).optional()}),nc=H([`script`,`url`,`modal`,`flow`,`api`]),rc=new Set(nc.options.filter(e=>e!==`script`)),ic=R({name:bs.describe(`Machine name (lowercase snake_case)`),label:Zs.describe(`Display label`),objectName:k().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:k().optional().describe(`Icon name`),locations:L(H([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:H([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:nc.default(`script`).describe(`Action functionality type`),target:k().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:k().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:L(tc).optional().describe(`Input parameters required from user`),variant:H([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:Zs.optional().describe(`Confirmation message before execution`),successMessage:Zs.optional().describe(`Success message to show after execution`),refreshAfter:M().default(!1).describe(`Refresh view after execution`),visible:k().optional().describe(`Formula returning boolean`),disabled:z([M(),k()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:k().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:M().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:j().optional().describe(`Maximum execution time in milliseconds for the action`),aria:Qs.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(rc.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),ac=H([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),oc=R({trackHistory:M().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:M().default(!0).describe(`Index records for global search`),apiEnabled:M().default(!0).describe(`Expose object via automatic APIs`),apiMethods:L(ac).optional().describe(`Whitelist of allowed API operations`),files:M().default(!1).describe(`Enable file attachments and document management`),feeds:M().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:M().default(!1).describe(`Enable standard tasks and events tracking`),trash:M().default(!0).describe(`Enable soft-delete with restore capability`),mru:M().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:M().default(!0).describe(`Allow record deep cloning`)}),sc=R({name:k().optional().describe(`Index name (auto-generated if not provided)`),fields:L(k()).describe(`Fields included in the index`),type:H([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:M().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:k().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),cc=R({fields:L(k()).describe(`Fields to index for full-text search weighting`),displayFields:L(k()).optional().describe(`Fields to display in search result cards`),filters:L(k()).optional().describe(`Default filters for search results`)}),lc=R({enabled:M().describe(`Enable multi-tenancy for this object`),strategy:H([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:k().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:M().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),uc=R({enabled:M().describe(`Enable soft delete (trash/recycle bin)`),field:k().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:M().default(!1).describe(`Cascade soft delete to related records`)}),dc=R({enabled:M().describe(`Enable record versioning`),strategy:H([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:j().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:k().default(`version`).describe(`Field name for version number/timestamp`)}),fc=R({enabled:M().describe(`Enable table partitioning`),strategy:H([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:k().describe(`Field name to partition by`),interval:k().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"`}),pc=R({enabled:M().describe(`Enable Change Data Capture`),events:L(H([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:k().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),mc=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:k().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:k().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:k().optional().describe(`Developer documentation / description`),icon:k().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:k().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:L(k()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:M().optional().default(!0).describe(`Is the object active and usable`),isSystem:M().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:M().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:k().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:k().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:V(k().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),Ps).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:L(sc).optional().describe(`Database performance indexes`),tenancy:lc.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:uc.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:dc.optional().describe(`Record versioning and history tracking configuration`),partitioning:fc.optional().describe(`Table partitioning configuration for performance`),cdc:pc.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:L(Ws).optional().describe(`Object-level validation rules`),stateMachines:V(k(),Xs).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:k().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:R({type:H([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:k().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:j().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:k().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:L(k()).optional().describe(`Primary fields for hover/cards/lookups`),search:cc.optional().describe(`Search engine configuration`),enable:oc.optional().describe(`Enabled system features modules`),recordTypes:L(k()).optional().describe(`Record type names for this object`),sharingModel:H([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:k().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:L(ic).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function hc(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var gc=Object.assign(mc,{create:e=>{let t={...e,label:e.label??hc(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return mc.parse(t)}});H([`own`,`extend`]),R({extend:k().describe(`Target object name (FQN) to extend`),fields:V(k(),Ps).optional().describe(`Fields to add/override`),label:k().optional().describe(`Override label for the extended object`),pluralLabel:k().optional().describe(`Override plural label for the extended object`),description:k().optional().describe(`Override description for the extended object`),validations:L(Ws).optional().describe(`Additional validation rules to merge into the target object`),indexes:L(sc).optional().describe(`Additional indexes to merge into the target object`),priority:j().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)});var _c=H([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]);R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:k().optional().describe(`Description of what this hook does`),object:z([k(),L(k())]).describe(`Target object(s)`),events:L(_c).describe(`Lifecycle events`),handler:z([k(),K()]).optional().describe(`Handler function name (string) or inline function reference`),priority:j().default(100).describe(`Execution priority`),async:M().default(!1).describe(`Run specifically as fire-and-forget`),condition:k().optional().describe(`Formula expression; hook runs only when TRUE (e.g., "status = 'closed' AND amount > 1000")`),description:k().optional().describe(`Human-readable description of what this hook does`),retryPolicy:R({maxRetries:j().default(3).describe(`Maximum retry attempts on failure`),backoffMs:j().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:j().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:H([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)}),R({id:k().optional().describe(`Unique execution ID for tracing`),object:k(),event:_c,input:V(k(),P()).describe(`Mutable input parameters`),result:P().optional().describe(`Operation result (After hooks only)`),previous:V(k(),P()).optional().describe(`Record state before operation`),session:R({userId:k().optional(),tenantId:k().optional(),roles:L(k()).optional(),accessToken:k().optional()}).optional().describe(`Current session context`),transaction:P().optional().describe(`Database transaction handle`),ql:P().describe(`ObjectQL Engine Reference`),api:P().optional().describe(`Cross-object data access (ScopedContext)`),user:R({id:k().optional(),name:k().optional(),email:k().optional()}).optional().describe(`Current user info shortcut`)});var vc=H([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),yc=R({source:z([k(),L(k())]).describe(`Source column header(s)`),target:z([k(),L(k())]).describe(`Target object field(s)`),transform:vc.default(`none`),params:R({value:P().optional(),object:k().optional(),fromField:k().optional(),toField:k().optional(),autoCreate:M().optional(),valueMap:V(k(),P()).optional(),separator:k().optional()}).optional()});R({name:bs.describe(`Mapping unique name (lowercase snake_case)`),label:k().optional(),sourceFormat:H([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:k().describe(`Target Object Name`),fieldMapping:L(yc),mode:H([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:L(k()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:Y.optional().describe(`Query to run for export only`),errorPolicy:H([`skip`,`abort`,`retry`]).default(`skip`),batchSize:j().default(1e3)});var bc=R({userId:k().optional(),tenantId:k().optional(),roles:L(k()).default([]),permissions:L(k()).default([]),isSystem:M().default(!1),accessToken:k().optional(),transaction:P().optional(),traceId:k().optional()}),Z=z([V(k(),P()),J]).describe(`Data Engine query filter conditions`),xc=z([V(k(),H([`asc`,`desc`])),V(k(),z([U(1),U(-1)])),L(cs)]).describe(`Sort order definition`),Q=R({context:bc.optional()}),Sc=Q.extend({where:z([V(k(),P()),J]).optional(),fields:L(_s).optional(),orderBy:L(cs).optional(),limit:j().optional(),offset:j().optional(),top:j().optional(),cursor:V(k(),P()).optional(),search:vs.optional(),expand:W(()=>V(k(),Y)).optional(),distinct:M().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`);Q.extend({filter:Z.optional(),select:L(k()).optional(),sort:xc.optional(),limit:j().int().min(1).optional(),skip:j().int().min(0).optional(),top:j().int().min(1).optional(),populate:L(k()).optional()}).describe(`Query options for IDataEngine.find() operations`);var Cc=Q.extend({returning:M().default(!0).optional()}).describe(`Options for DataEngine.insert operations`),wc=Q.extend({where:z([V(k(),P()),J]).optional(),upsert:M().default(!1).optional(),multi:M().default(!1).optional(),returning:M().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`);Q.extend({filter:Z.optional(),upsert:M().default(!1).optional(),multi:M().default(!1).optional(),returning:M().default(!1).optional()}).describe(`Options for DataEngine.update operations`);var Tc=Q.extend({where:z([V(k(),P()),J]).optional(),multi:M().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`);Q.extend({filter:Z.optional(),multi:M().default(!1).optional()}).describe(`Options for DataEngine.delete operations`);var Ec=Q.extend({where:z([V(k(),P()),J]).optional(),groupBy:L(k()).optional(),aggregations:L(us).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`);Q.extend({filter:Z.optional(),groupBy:L(k()).optional(),aggregations:L(R({field:k(),method:H([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:k().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`);var Dc=Q.extend({where:z([V(k(),P()),J]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`);Q.extend({filter:Z.optional()}).describe(`Options for DataEngine.count operations`),R({find:K().input(B([k(),Sc.optional()])).output(G(L(P()))),findOne:K().input(B([k(),Sc.optional()])).output(G(P())),insert:K().input(B([k(),z([V(k(),P()),L(V(k(),P()))]),Cc.optional()])).output(G(P())),update:K().input(B([k(),V(k(),P()),wc.optional()])).output(G(P())),delete:K().input(B([k(),Tc.optional()])).output(G(P())),count:K().input(B([k(),Dc.optional()])).output(G(j())),aggregate:K().input(B([k(),Ec])).output(G(L(P())))}).describe(`Standard Data Engine Contract`);var Oc={filter:Z.optional()},kc=Sc.extend({...Oc,select:L(k()).optional(),sort:xc.optional(),skip:j().int().min(0).optional(),populate:L(k()).optional()}),Ac=R({method:U(`find`),object:k(),query:kc.optional()}),jc=R({method:U(`findOne`),object:k(),query:kc.optional()}),Mc=R({method:U(`insert`),object:k(),data:z([V(k(),P()),L(V(k(),P()))]),options:Cc.optional()}),Nc=R({method:U(`update`),object:k(),data:V(k(),P()),id:z([k(),j()]).optional().describe(`ID for single update, or use where in options`),options:wc.extend(Oc).optional()}),Pc=R({method:U(`delete`),object:k(),id:z([k(),j()]).optional().describe(`ID for single delete, or use where in options`),options:Tc.extend(Oc).optional()}),Fc=R({method:U(`count`),object:k(),query:Dc.extend(Oc).optional()}),Ic=R({method:U(`aggregate`),object:k(),query:Ec.extend(Oc)}),Lc=R({method:U(`execute`),command:P(),options:V(k(),P()).optional()}),Rc=R({method:U(`vectorFind`),object:k(),vector:L(j()),where:z([V(k(),P()),J]).optional(),fields:L(k()).optional(),limit:j().int().default(5).optional(),threshold:j().optional()}),zc=R({method:U(`batch`),requests:L(go(`method`,[Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc])),transaction:M().default(!0).optional()});go(`method`,[Ac,jc,Mc,Nc,Pc,Fc,Ic,zc,Lc,Rc]).describe(`Virtual ObjectQL Request Protocol`),H([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var Bc=H([`asc`,`desc`]).describe(`Sort order direction`);R({field:k().describe(`Field name to sort by`),order:Bc.describe(`Sort direction`)}).describe(`Sort field and direction pair`),H([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`);var Vc=H([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`);H([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var $=R({transaction:P().optional().describe(`Transaction handle`),timeout:j().optional().describe(`Timeout in ms`),skipCache:M().optional().describe(`Bypass cache`),traceContext:V(k(),k()).optional().describe(`OpenTelemetry context or request ID`),tenantId:k().optional().describe(`Tenant Isolation identifier`)}),Hc=R({create:M().default(!0).describe(`Supports CREATE operations`),read:M().default(!0).describe(`Supports READ operations`),update:M().default(!0).describe(`Supports UPDATE operations`),delete:M().default(!0).describe(`Supports DELETE operations`),bulkCreate:M().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:M().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:M().default(!1).describe(`Supports bulk DELETE operations`),transactions:M().default(!1).describe(`Supports ACID transactions`),savepoints:M().default(!1).describe(`Supports transaction savepoints`),isolationLevels:L(Vc).optional().describe(`Supported isolation levels`),queryFilters:M().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:M().default(!1).describe(`Supports GROUP BY and aggregation functions`),querySorting:M().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:M().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:M().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:M().default(!1).describe(`Supports subqueries`),queryCTE:M().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:M().default(!1).describe(`Supports SQL joins`),fullTextSearch:M().default(!1).describe(`Supports full-text search`),jsonQuery:M().default(!1).describe(`Supports JSON field querying`),geospatialQuery:M().default(!1).describe(`Supports geospatial queries`),streaming:M().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:M().default(!1).describe(`Supports JSON field types`),arrayFields:M().default(!1).describe(`Supports array field types`),vectorSearch:M().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:M().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:M().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:M().default(!1).describe(`Supports database migrations`),indexes:M().default(!1).describe(`Supports index creation and management`),connectionPooling:M().default(!1).describe(`Supports connection pooling`),preparedStatements:M().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:M().default(!1).describe(`Supports query result caching`)});R({name:k().describe(`Driver unique name`),version:k().describe(`Driver version`),supports:Hc,connect:K().input(B([])).output(G(F())).describe(`Establish connection`),disconnect:K().input(B([])).output(G(F())).describe(`Close connection`),checkHealth:K().input(B([])).output(G(M())).describe(`Health check`),getPoolStats:K().input(B([])).output(R({total:j(),idle:j(),active:j(),waiting:j()}).optional()).optional().describe(`Get connection pool statistics`),execute:K().input(B([P(),L(P()).optional(),$.optional()])).output(G(P())).describe(`Execute raw command`),find:K().input(B([k(),Y,$.optional()])).output(G(L(V(k(),P())))).describe(`Find records`),findStream:K().input(B([k(),Y,$.optional()])).output(P()).describe(`Stream records (AsyncIterable)`),findOne:K().input(B([k(),Y,$.optional()])).output(G(V(k(),P()).nullable())).describe(`Find one record`),create:K().input(B([k(),V(k(),P()),$.optional()])).output(G(V(k(),P()))).describe(`Create record`),update:K().input(B([k(),k().or(j()),V(k(),P()),$.optional()])).output(G(V(k(),P()))).describe(`Update record`),upsert:K().input(B([k(),V(k(),P()),L(k()).optional(),$.optional()])).output(G(V(k(),P()))).describe(`Upsert record`),delete:K().input(B([k(),k().or(j()),$.optional()])).output(G(M())).describe(`Delete record`),count:K().input(B([k(),Y.optional(),$.optional()])).output(G(j())).describe(`Count records`),bulkCreate:K().input(B([k(),L(V(k(),P())),$.optional()])).output(G(L(V(k(),P())))),bulkUpdate:K().input(B([k(),L(R({id:k().or(j()),data:V(k(),P())})),$.optional()])).output(G(L(V(k(),P())))),bulkDelete:K().input(B([k(),L(k().or(j())),$.optional()])).output(G(F())),updateMany:K().input(B([k(),Y,V(k(),P()),$.optional()])).output(G(j())).optional(),deleteMany:K().input(B([k(),Y,$.optional()])).output(G(j())).optional(),beginTransaction:K().input(B([R({isolationLevel:Vc.optional()}).optional()])).output(G(P())).describe(`Start transaction`),commit:K().input(B([P()])).output(G(F())).describe(`Commit transaction`),rollback:K().input(B([P()])).output(G(F())).describe(`Rollback transaction`),syncSchema:K().input(B([k(),P(),$.optional()])).output(G(F())).describe(`Sync object schema to DB`),syncSchemasBatch:K().input(B([L(R({object:k(),schema:P()})),$.optional()])).output(G(F())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:K().input(B([k(),$.optional()])).output(G(F())),explain:K().input(B([k(),Y,$.optional()])).output(G(P())).optional()});var Uc=R({min:j().min(0).default(2).describe(`Minimum number of connections in pool`),max:j().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:j().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:j().min(0).default(5e3).describe(`Time in ms to wait for available connection`)}),Wc=R({name:k().describe(`Driver instance name`),type:H([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:Hc.describe(`Driver capability flags`),connectionString:k().optional().describe(`Database connection string (driver-specific format)`),poolConfig:Uc.optional().describe(`Connection pool configuration`)}),Gc=H([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`]),Kc=R({text:k().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:k().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:k().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:k().describe(`SQL type for date fields (e.g., DATE)`),datetime:k().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:k().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:k().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:k().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)}),qc=R({rejectUnauthorized:M().default(!0).describe(`Reject connections with invalid certificates`),ca:k().optional().describe(`CA certificate file path or content`),cert:k().optional().describe(`Client certificate file path or content`),key:k().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`});Wc.extend({type:U(`sql`).describe(`Driver type must be "sql"`),dialect:Gc.describe(`SQL database dialect`),dataTypeMapping:Kc.describe(`SQL data type mapping configuration`),ssl:M().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:qc.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`});var Jc=H([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]);H([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]);var Yc=H([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`]),Xc=H([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`]),Zc=R({enabled:M().default(!1).describe(`Enable sharding`),shardKey:k().optional().describe(`Field to use as shard key`),shardingStrategy:H([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:j().int().positive().optional().describe(`Number of shards`)}),Qc=R({enabled:M().default(!1).describe(`Enable replication`),replicaSetName:k().optional().describe(`Replica set name`),replicas:j().int().positive().optional().describe(`Number of replicas`),readPreference:H([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:H([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)}),$c=R({enabled:M().default(!1).describe(`Enable schema validation`),validationLevel:H([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:H([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:V(k(),P()).optional().describe(`JSON Schema for validation`)}),el=R({text:k().describe(`NoSQL type for text fields`),number:k().describe(`NoSQL type for number fields`),boolean:k().describe(`NoSQL type for boolean fields`),date:k().describe(`NoSQL type for date fields`),datetime:k().describe(`NoSQL type for datetime fields`),json:k().optional().describe(`NoSQL type for JSON/object fields`),uuid:k().optional().describe(`NoSQL type for UUID fields`),binary:k().optional().describe(`NoSQL type for binary fields`),array:k().optional().describe(`NoSQL type for array fields`),objectId:k().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:k().optional().describe(`NoSQL type for geospatial point fields`)});Wc.extend({type:U(`nosql`).describe(`Driver type must be "nosql"`),databaseType:Jc.describe(`Specific NoSQL database type`),dataTypeMapping:el.describe(`NoSQL data type mapping configuration`),consistency:Yc.optional().describe(`Consistency level for operations`),replication:Qc.optional().describe(`Replication configuration`),sharding:Zc.optional().describe(`Sharding configuration`),schemaValidation:$c.optional().describe(`Document schema validation`),region:k().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:k().optional().describe(`AWS access key ID`),secretAccessKey:k().optional().describe(`AWS secret access key`),ttlField:k().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:j().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:k().optional().describe(`Prefix for collection/table names`)});var tl=R({consistency:Yc.optional().describe(`Consistency level override`),readFromSecondary:M().optional().describe(`Allow reading from secondary replicas`),projection:V(k(),z([U(0),U(1)])).optional().describe(`Field projection`),timeout:j().int().positive().optional().describe(`Query timeout (ms)`),useCursor:M().optional().describe(`Use cursor instead of loading all results`),batchSize:j().int().positive().optional().describe(`Cursor batch size`),profile:M().optional().describe(`Enable query profiling`),hint:k().optional().describe(`Index hint for query optimization`)}),nl=R({operator:k().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:V(k(),P()).describe(`Stage-specific options`)});R({collection:k().describe(`Collection/table name`),stages:L(nl).describe(`Aggregation pipeline stages`),options:tl.optional().describe(`Query options`)}),R({name:k().describe(`Index name`),type:Xc.describe(`Index type`),fields:L(R({field:k().describe(`Field name`),order:H([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:M().default(!1).describe(`Enforce uniqueness`),sparse:M().default(!1).describe(`Sparse index`),expireAfterSeconds:j().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:V(k(),P()).optional().describe(`Partial index filter`),background:M().default(!1).describe(`Create index in background`)}),R({readConcern:H([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:H([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:H([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:j().int().positive().optional().describe(`Transaction commit timeout (ms)`)});var rl=H([`insert`,`update`,`upsert`,`replace`,`ignore`]),il=R({object:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:k().default(`name`).describe(`Field match for uniqueness check`),mode:rl.default(`upsert`).describe(`Conflict resolution strategy`),env:L(H([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:L(V(k(),P())).describe(`Data records`)}),al=R({field:k().describe(`Source field name containing the reference value`),targetObject:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:k().default(`name`).describe(`Field on target object used for matching`),fieldType:H([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`),ol=R({object:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:L(k()).describe(`Objects this object depends on`),references:L(al).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`),sl=R({nodes:L(ol).describe(`All objects in the dependency graph`),insertOrder:L(k()).describe(`Topologically sorted insert order`),circularDependencies:L(L(k())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`),cl=R({sourceObject:k().describe(`Object with the broken reference`),field:k().describe(`Field name with unresolved reference`),targetObject:k().describe(`Target object searched for the reference`),targetField:k().describe(`ExternalId field used for matching`),attemptedValue:P().describe(`Value that failed to resolve`),recordIndex:j().int().min(0).describe(`Index of the record in the dataset`),message:k().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`),ll=R({dryRun:M().default(!1).describe(`Validate references without writing data`),haltOnError:M().default(!1).describe(`Stop on first reference resolution error`),multiPass:M().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:rl.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:j().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:M().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:H([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`)}).describe(`Seed data loader configuration`),ul=R({object:k().describe(`Object that was loaded`),mode:rl.describe(`Import mode used`),inserted:j().int().min(0).describe(`Records inserted`),updated:j().int().min(0).describe(`Records updated`),skipped:j().int().min(0).describe(`Records skipped`),errored:j().int().min(0).describe(`Records with errors`),total:j().int().min(0).describe(`Total records in dataset`),referencesResolved:j().int().min(0).describe(`References resolved via externalId`),referencesDeferred:j().int().min(0).describe(`References deferred to second pass`),errors:L(cl).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`);R({success:M().describe(`Overall success status`),dryRun:M().describe(`Whether this was a dry-run`),dependencyGraph:sl.describe(`Object dependency graph`),results:L(ul).describe(`Per-object load results`),errors:L(cl).describe(`All reference resolution errors`),summary:R({objectsProcessed:j().int().min(0).describe(`Total objects processed`),totalRecords:j().int().min(0).describe(`Total records across all objects`),totalInserted:j().int().min(0).describe(`Total records inserted`),totalUpdated:j().int().min(0).describe(`Total records updated`),totalSkipped:j().int().min(0).describe(`Total records skipped`),totalErrored:j().int().min(0).describe(`Total records with errors`),totalReferencesResolved:j().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:j().int().min(0).describe(`Total references deferred`),circularDependencyCount:j().int().min(0).describe(`Circular dependency chains detected`),durationMs:j().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`);var dl=R({datasets:L(il).min(1).describe(`Datasets to load`),config:Zo(e=>e??{},ll).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`),fl=R({versionNumber:j().describe(`Version number`),createdAt:j().describe(`Creation timestamp`),createdBy:k().describe(`Creator user ID`),size:j().describe(`File size in bytes`),checksum:k().describe(`File checksum`),downloadUrl:k().url().describe(`Download URL`),isLatest:M().optional().default(!1).describe(`Is latest version`)}),pl=R({id:k().describe(`Template ID`),name:k().describe(`Template name`),description:k().optional().describe(`Template description`),fileUrl:k().url().describe(`Template file URL`),fileType:k().describe(`File MIME type`),placeholders:L(R({key:k().describe(`Placeholder key`),label:k().describe(`Placeholder label`),type:H([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:M().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)}),ml=R({provider:H([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:M().optional().default(!1).describe(`E-signature enabled`),signers:L(R({email:k().email().describe(`Signer email`),name:k().describe(`Signer name`),role:k().describe(`Signer role`),order:j().describe(`Signing order`)})).describe(`Document signers`),expirationDays:j().optional().default(30).describe(`Expiration days`),reminderDays:j().optional().default(7).describe(`Reminder interval days`)});R({id:k().describe(`Document ID`),name:k().describe(`Document name`),description:k().optional().describe(`Document description`),fileType:k().describe(`File MIME type`),fileSize:j().describe(`File size in bytes`),category:k().optional().describe(`Document category`),tags:L(k()).optional().describe(`Document tags`),versioning:R({enabled:M().describe(`Versioning enabled`),versions:L(fl).describe(`Version history`),majorVersion:j().describe(`Major version`),minorVersion:j().describe(`Minor version`)}).optional().describe(`Version control`),template:pl.optional().describe(`Document template`),eSignature:ml.optional().describe(`E-signature config`),access:R({isPublic:M().optional().default(!1).describe(`Public access`),sharedWith:L(k()).optional().describe(`Shared with`),expiresAt:j().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:V(k(),P()).optional().describe(`Custom metadata`)});var hl=go(`type`,[R({type:U(`constant`),value:P().describe(`Constant value to use`)}).describe(`Set a constant value`),R({type:U(`cast`),targetType:H([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),R({type:U(`lookup`),table:k().describe(`Lookup table name`),keyField:k().describe(`Field to match on`),valueField:k().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),R({type:U(`javascript`),expression:k().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),R({type:U(`map`),mappings:V(k(),P()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]),gl=R({source:k().describe(`Source field name`),target:k().describe(`Target field name`),transform:hl.optional().describe(`Transformation to apply`),defaultValue:P().optional().describe(`Default if source is null/undefined`)}),_l=R({id:k().describe(`Data source ID`),name:k().describe(`Data source name`),type:H([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:k().url().describe(`API endpoint URL`),authentication:R({type:H([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:V(k(),P()).describe(`Auth configuration`)}).describe(`Authentication`)}),vl=gl.extend({type:k().optional().describe(`Field type`),readonly:M().optional().default(!0).describe(`Read-only field`)});R({fieldName:k().describe(`Field name`),dataSource:_l.describe(`External data source`),query:R({endpoint:k().describe(`Query endpoint path`),method:H([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:V(k(),P()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:L(vl).describe(`Field mappings`),caching:R({enabled:M().optional().default(!0).describe(`Cache enabled`),ttl:j().optional().default(300).describe(`Cache TTL (seconds)`),strategy:H([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:R({enabled:M().optional().default(!0).describe(`Fallback enabled`),defaultValue:P().optional().describe(`Default fallback value`),showError:M().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:R({requestsPerSecond:j().describe(`Requests per second limit`),burstSize:j().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:R({maxRetries:j().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:j().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:j().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:j().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:L(j()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:R({request:R({headers:V(k(),k()).optional().describe(`Additional request headers`),queryParams:V(k(),k()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:R({dataPath:k().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:k().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:R({type:H([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:j().default(100).describe(`Items per page`),maxPages:j().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)});var yl=k().describe(`Underlying driver identifier`);R({id:k().describe(`Unique driver identifier (e.g. "postgres")`),label:k().describe(`Display label (e.g. "PostgreSQL")`),description:k().optional(),icon:k().optional(),configSchema:V(k(),P()).describe(`JSON Schema for connection configuration`),capabilities:W(()=>bl).optional()});var bl=R({transactions:M().default(!1),queryFilters:M().default(!1),queryAggregations:M().default(!1),querySorting:M().default(!1),queryPagination:M().default(!1),queryWindowFunctions:M().default(!1),querySubqueries:M().default(!1),joins:M().default(!1),fullTextSearch:M().default(!1),readOnly:M().default(!1),dynamicSchema:M().default(!1)});R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:k().optional().describe(`Display label`),driver:yl.describe(`Underlying driver type`),config:V(k(),P()).describe(`Driver specific configuration`),pool:R({min:j().default(0).describe(`Minimum connections`),max:j().default(10).describe(`Maximum connections`),idleTimeoutMillis:j().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:j().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:L(V(k(),P())).optional().describe(`Read-only replica configurations`),capabilities:bl.optional().describe(`Capability overrides`),healthCheck:R({enabled:M().default(!0).describe(`Enable health check endpoint`),intervalMs:j().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:j().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:R({enabled:M().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:M().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:k().optional().describe(`CA certificate (PEM format or path to file)`),cert:k().optional().describe(`Client certificate (PEM format or path to file)`),key:k().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:R({maxRetries:j().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:j().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:j().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:j().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:k().optional().describe(`Internal description`),active:M().default(!0).describe(`Is datasource enabled`)});var xl=H([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),Sl=H([`string`,`number`,`boolean`,`time`,`geo`]),Cl=H([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),wl=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:k().describe(`Human readable label`),description:k().optional(),type:xl,sql:k().describe(`SQL expression or field reference`),filters:L(R({sql:k()})).optional(),format:k().optional()}),Tl=R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:k().describe(`Human readable label`),description:k().optional(),type:Sl,sql:k().describe(`SQL expression or column reference`),granularities:L(Cl).optional()}),El=R({name:k().describe(`Target cube name`),relationship:H([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:k().describe(`Join condition (ON clause)`)});R({name:k().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:k().optional(),description:k().optional(),sql:k().describe(`Base SQL statement or Table Name`),measures:V(k(),wl).describe(`Quantitative metrics`),dimensions:V(k(),Tl).describe(`Qualitative attributes`),joins:V(k(),El).optional(),refreshKey:R({every:k().optional(),sql:k().optional()}).optional(),public:M().default(!1)}),R({cube:k().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:L(k()).describe(`List of metrics to calculate`),dimensions:L(k()).optional().describe(`List of dimensions to group by`),filters:L(R({member:k().describe(`Dimension or Measure`),operator:H([`equals`,`notEquals`,`contains`,`notContains`,`gt`,`gte`,`lt`,`lte`,`set`,`notSet`,`inDateRange`]),values:L(k()).optional()})).optional(),timeDimensions:L(R({dimension:k(),granularity:Cl.optional(),dateRange:z([k(),L(k())]).optional()})).optional(),order:V(k(),H([`asc`,`desc`])).optional(),limit:j().optional(),offset:j().optional(),timezone:k().optional().default(`UTC`)});var Dl=H([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Ol=R({type:H([`user`,`team`,`record`]).describe(`Mention target type`),id:k().describe(`Target ID`),name:k().describe(`Display name for rendering`),offset:j().int().min(0).describe(`Character offset in body text`),length:j().int().min(1).describe(`Length of mention token in body text`)}),kl=R({field:k().describe(`Field machine name`),fieldLabel:k().optional().describe(`Field display label`),oldValue:P().optional().describe(`Previous value`),newValue:P().optional().describe(`New value`),oldDisplayValue:k().optional().describe(`Human-readable old value`),newDisplayValue:k().optional().describe(`Human-readable new value`)}),Al=R({emoji:k().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:L(k()).describe(`Users who reacted`),count:j().int().min(1).describe(`Total reaction count`)}),jl=R({type:H([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:k().describe(`Actor ID`),name:k().optional().describe(`Actor display name`),avatarUrl:k().url().optional().describe(`Actor avatar URL`),source:k().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),Ml=H([`public`,`internal`,`private`]);R({id:k().describe(`Feed item ID`),type:Dl.describe(`Activity type`),object:k().describe(`Object name (e.g., "account")`),recordId:k().describe(`Record ID this feed item belongs to`),actor:jl.describe(`Who performed this action`),body:k().optional().describe(`Rich text body (Markdown supported)`),mentions:L(Ol).optional().describe(`Mentioned users/teams/records`),changes:L(kl).optional().describe(`Field-level changes`),reactions:L(Al).optional().describe(`Emoji reactions on this item`),parentId:k().optional().describe(`Parent feed item ID for threaded replies`),replyCount:j().int().min(0).default(0).describe(`Number of replies`),pinned:M().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:k().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:k().optional().describe(`User ID who pinned the item`),starred:M().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:k().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Ml.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:k().datetime().describe(`Creation timestamp`),updatedAt:k().datetime().optional().describe(`Last update timestamp`),editedAt:k().datetime().optional().describe(`When comment was last edited`),isEdited:M().default(!1).describe(`Whether comment has been edited`)}),H([`all`,`comments_only`,`changes_only`,`tasks_only`]);var Nl=H([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),Pl=H([`in_app`,`email`,`push`,`slack`]);R({object:k().describe(`Object name`),recordId:k().describe(`Record ID`),userId:k().describe(`Subscribing user ID`),events:L(Nl).default([`all`]).describe(`Event types to receive notifications for`),channels:L(Pl).default([`in_app`]).describe(`Notification delivery channels`),active:M().default(!0).describe(`Whether the subscription is active`),createdAt:k().datetime().describe(`Subscription creation timestamp`)});var Fl=H([`header`,`subdomain`,`path`,`token`,`lookup`]).describe(`Strategy for resolving tenant identity from request context`),Il=R({name:k().min(1).describe(`Turso database group name`),primaryLocation:k().min(2).describe(`Primary Turso region code (e.g., iad, lhr, nrt)`),replicaLocations:L(k().min(2)).default([]).describe(`Additional replica region codes`),schemaDatabase:k().optional().describe(`Schema database name for multi-db schemas`)}).describe(`Turso database group configuration`),Ll=R({onTenantCreate:R({autoCreate:M().default(!0).describe(`Auto-create database on tenant registration`),group:k().optional().describe(`Turso group for the new database`),applyGroupSchema:M().default(!0).describe(`Apply shared schema from group`),seedData:M().default(!1).describe(`Populate seed data on creation`)}).describe(`Tenant creation hook`),onTenantDelete:R({immediate:M().default(!1).describe(`Destroy database immediately`),gracePeriodHours:j().int().min(0).default(72).describe(`Grace period before permanent deletion`),createBackup:M().default(!0).describe(`Create backup before deletion`)}).describe(`Tenant deletion hook`),onTenantSuspend:R({revokeTokens:M().default(!0).describe(`Revoke auth tokens on suspension`),readOnly:M().default(!0).describe(`Set database to read-only on suspension`)}).describe(`Tenant suspension hook`)}).describe(`Tenant database lifecycle hooks`);R({organizationSlug:k().min(1).describe(`Turso organization slug`),urlTemplate:k().min(1).describe(`URL template with {tenant_id} placeholder`),groupAuthToken:k().min(1).describe(`Group-level auth token for platform operations`),tenantResolverStrategy:Fl.default(`token`),group:Il.optional().describe(`Database group configuration`),lifecycle:Ll.optional().describe(`Lifecycle hooks`),maxCachedConnections:j().int().min(1).default(100).describe(`Max cached tenant connections (LRU)`),connectionCacheTTL:j().int().min(0).default(300).describe(`Connection cache TTL in seconds`)}).describe(`Turso multi-tenant router configuration`);export{k as A,so as C,G as D,Zo as E,va as F,ca as I,zr as L,z as M,P as N,V as O,Sa as P,Ir as R,U as S,R as T,qo as _,ns as a,vo as b,Qa as c,Xo as d,ro as f,M as g,L as h,Qo as i,B as j,po as k,H as l,N as m,gc as n,as as o,F as p,ll as r,to as s,Fs as t,K as u,I as v,j as w,W as x,go as y}; \ No newline at end of file diff --git a/apps/server/public/assets/index-BqvyhY64.js b/apps/server/public/assets/index-BqvyhY64.js deleted file mode 100644 index 1fb137db5..000000000 --- a/apps/server/public/assets/index-BqvyhY64.js +++ /dev/null @@ -1,306 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./__vite-browser-external-BJgzPGy7.js","./chunk-DECur_0Z.js","./data-CGvg7kH3.js"])))=>i.map(i=>d[i]); -import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{A as r,D as i,E as a,F as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,_ as g,a as _,b as v,c as y,d as b,f as x,g as S,h as C,j as w,k as T,l as E,m as D,n as O,o as ee,p as te,r as k,s as A,t as j,u as M,v as N,w as P,x as F,y as I}from"./data-CGvg7kH3.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 ne=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 D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(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?ee(``+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&&(O(o)&&(o=D(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{t.exports=ne()})),ie=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(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,O());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()-Tt&&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?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,te=ee.port2;ee.port1.onmessage=D,O=function(){te.postMessage(null)}}else O=function(){_(D,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||125o?(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,O()))),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}}}})),ae=n(((e,t)=>{t.exports=ie()})),oe=n((e=>{var t=re();function n(e){var t=`https://react.dev/errors/`+e;if(1{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=oe()})),ce=n((e=>{var t=ae(),n=re(),r=se();function i(e){var t=`https://react.dev/errors/`+e;if(1F||(e.current=P[F],P[F]=null,F--)}function ie(e,t){F++,P[F]=e.current,e.current=t}var oe=I(null),ce=I(null),le=I(null),L=I(null);function ue(e,t){switch(ie(le,t),ie(ce,e),ie(oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ld(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ld(t),e=Rd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ne(oe),ie(oe,e)}function de(){ne(oe),ne(ce),ne(le)}function fe(e){e.memoizedState!==null&&ie(L,e);var t=oe.current,n=Rd(t,e.type);t!==n&&(ie(ce,e),ie(oe,n))}function pe(e){ce.current===e&&(ne(oe),ne(ce)),L.current===e&&(ne(L),Gf._currentValue=N)}var me,he;function ge(e){if(me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);me=t&&t[1]||``,he=-1)`:-1i||c[r]!==l[i]){var u=` -`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{_e=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ge(n):``}function ye(e,t){switch(e.tag){case 26:case 27:case 5:return ge(e.type);case 16:return ge(`Lazy`);case 13:return e.child!==t&&t!==null?ge(`Suspense Fallback`):ge(`Suspense`);case 19:return ge(`SuspenseList`);case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return ge(`Activity`);default:return``}}function be(e){try{var t=``,n=null;do t+=ye(e,n),n=e,e=e.return;while(e);return t}catch(e){return` -Error generating stack: `+e.message+` -`+e.stack}}var xe=Object.prototype.hasOwnProperty,Se=t.unstable_scheduleCallback,Ce=t.unstable_cancelCallback,we=t.unstable_shouldYield,Te=t.unstable_requestPaint,Ee=t.unstable_now,De=t.unstable_getCurrentPriorityLevel,Oe=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function Le(e){if(typeof Ne==`function`&&Pe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Re=Math.clz32?Math.clz32:Ve,ze=Math.log,Be=Math.LN2;function Ve(e){return e>>>=0,e===0?32:31-(ze(e)/Be|0)|0}var He=256,Ue=262144,We=4194304;function Ge(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ke(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ge(n))):i=Ge(o):i=Ge(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ge(n))):i=Ge(o)):i=Ge(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function eee(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Je(){var e=We;return We<<=1,!(We&62914560)&&(We=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),ln=!1;if(cn)try{var un={};Object.defineProperty(un,`passive`,{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,fn=null,pn=null;function mn(){if(pn)return pn;var e,t=fn,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e=Vn),Wn=` `,Gn=!1;function Kn(e,t){switch(e){case`keyup`:return oee.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Jn=!1;function Yn(e,t){switch(e){case`compositionend`:return qn(t);case`keypress`:return t.which===32?(Gn=!0,Wn):null;case`textInput`:return e=t.data,e===Wn&&Gn?null:e;default:return null}}function Xn(e,t){if(Jn)return e===`compositionend`||!Bn&&Kn(e,t)?(e=mn(),pn=fn=dn=null,Jn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=mr(n)}}function gr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _r(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=It(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=It(e.document)}return t}function vr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var yr=cn&&`documentMode`in document&&11>=document.documentMode,br=null,xr=null,Sr=null,Cr=!1;function wr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Cr||br==null||br!==It(r)||(r=br,`selectionStart`in r&&vr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Sr&&pr(Sr,r)||(Sr=r,r=xd(xr,`onSelect`),0>=o,i-=o,hi=1<<32-Re(t)+i|n<m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),wi&&_i(i,m),l;if(d===null){for(;mh?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),wi&&_i(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return wi&&_i(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),wi&&_i(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&ha(l)===r.type){n(e,r.sibling),c=a(r,o.props),Sa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=ni(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ti(o.type,o.key,o.props,null,e.mode,c),Sa(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ai(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=ha(o),x(e,r,o,c)}if(A(o))return v(e,r,o,c);if(ee(o)){if(l=ee(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,xa(o),c);if(o.$$typeof===b)return x(e,r,Gi(e,o),c);Ca(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ri(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ba=0;var i=x(e,t,n,r);return ya=null,i}catch(t){if(t===la||t===da)throw t;var a=Zr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ta=wa(!0),Ea=wa(!1),Da=!1;function Oa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ka(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Aa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ja(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ol&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Jr(e),qr(e,null,n),t}return Wr(e,r,t,n),Jr(e)}function Ma(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}function Na(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Pa=!1;function Fa(){if(Pa){var e=na;if(e!==null)throw e}}function Ia(e,t,n,r){Pa=!1;var i=e.updateQueue;Da=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(jl&p)===p:(r&p)===p){p!==0&&p===ta&&(Pa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Da=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),zl|=o,e.lanes=o,e.memoizedState=d}}function La(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ra(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=j.T,s={};j.T=s,Cs(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ss(e,t,pee(c,r),su(e)):Ss(e,t,r,su(e))}catch(n){Ss(e,t,{then:function(){},status:`rejected`,reason:n},su())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function mee(){}function ms(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=hs(e).queue;ps(e,a,t,N,n===null?mee:function(){return gs(e),n(r)})}function hs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:N,baseState:N,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:N},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function gs(e){var t=hs(e);t.next===null&&(t=e.alternate.memoizedState),Ss(e,t.next.queue,{},su())}function _s(){return Wi(Gf)}function vs(){return xo().memoizedState}function ys(){return xo().memoizedState}function hee(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=su();e=Aa(n);var r=ja(t,e,n);r!==null&&(lu(r,t,n),Ma(r,t,n)),t={cache:Zi()},e.payload=t;return}t=t.return}}function bs(e,t,n){var r=su();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ws(e)?Ts(t,n):(n=Gr(e,t,n,r),n!==null&&(lu(n,e,r),Es(n,t,r)))}function xs(e,t,n){Ss(e,t,n,su())}function Ss(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ws(e))Ts(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,fr(s,o))return Wr(e,t,i,0),kl===null&&Ur(),!1}catch{}if(n=Gr(e,t,i,r),n!==null)return lu(n,e,r),Es(n,t,r),!0}return!1}function Cs(e,t,n,r){if(r={lane:2,revertLane:ad(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ws(e)){if(t)throw Error(i(479))}else t=Gr(e,n,r,2),t!==null&&lu(t,e,2)}function ws(e){var t=e.alternate;return e===eo||t!==null&&t===eo}function Ts(e,t){io=ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Es(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}var Ds={readContext:Wi,use:wo,useCallback:uo,useContext:uo,useEffect:uo,useImperativeHandle:uo,useLayoutEffect:uo,useInsertionEffect:uo,useMemo:uo,useReducer:uo,useRef:uo,useState:uo,useDebugValue:uo,useDeferredValue:uo,useTransition:uo,useSyncExternalStore:uo,useId:uo,useHostTransitionStatus:uo,useFormState:uo,useActionState:uo,useOptimistic:uo,useMemoCache:uo,useCacheRefresh:uo};Ds.useEffectEvent=uo;var Os={readContext:Wi,use:wo,useCallback:function(e,t){return bo().memoizedState=[e,t===void 0?null:t],e},useContext:Wi,useEffect:es,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Qo(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qo(4194308,4,e,t)},useInsertionEffect:function(e,t){Qo(4,2,e,t)},useMemo:function(e,t){var n=bo();t=t===void 0?null:t;var r=e();if(ao){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=bo();if(n!==void 0){var i=n(t);if(ao){Le(!0);try{n(t)}finally{Le(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=bs.bind(null,eo,e),[r.memoizedState,e]},useRef:function(e){var t=bo();return e={current:e},t.memoizedState=e},useState:function(e){e=Io(e);var t=e.queue,n=xs.bind(null,eo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:cs,useDeferredValue:function(e,t){return ds(bo(),e,t)},useTransition:function(){var e=Io(!1);return e=ps.bind(null,eo,e.queue,!0,!1),bo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=eo,a=bo();if(wi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),kl===null)throw Error(i(349));jl&127||jo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,es(No.bind(null,r,o,e),[e]),r.flags|=2048,Xo(9,{destroy:void 0},Mo.bind(null,r,o,n,t),null),n},useId:function(){var e=bo(),t=kl.identifierPrefix;if(wi){var n=gi,r=hi;n=(r&~(1<<32-Re(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=oo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ot]=t,o[st]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Ad(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&xc(t)}}return Ec(t),Sc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&xc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=le.current,ji(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Si,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Dd(e.nodeValue,n)),e||Oi(t,!0)}else e=Id(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Ec(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ji(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ot]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ec(t),e=!1}else n=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Xa(t),t):(Xa(t),null);if(t.flags&128)throw Error(i(558))}return Ec(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ji(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ot]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ec(t),a=!1}else a=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Xa(t),t):(Xa(t),null)}return Xa(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),wc(t,t.updateQueue),Ec(t),null);case 4:return de(),e===null&&_d(t.stateNode.containerInfo),Ec(t),null;case 10:return zi(t.type),Ec(t),null;case 19:if(ne(Za),r=t.memoizedState,r===null)return Ec(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Tc(r,!1);else{if(Rl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Qa(e),o!==null){for(t.flags|=128,Tc(r,!1),e=o.updateQueue,t.updateQueue=e,wc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ei(n,e),n=n.sibling;return ie(Za,Za.current&1|2),wi&&_i(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ee()>Yl&&(t.flags|=128,a=!0,Tc(r,!1),t.lanes=4194304)}else{if(!a)if(e=Qa(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,wc(t,e),Tc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!wi)return Ec(t),null}else 2*Ee()-r.renderingStartTime>Yl&&n!==536870912&&(t.flags|=128,a=!0,Tc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Ec(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ee(),e.sibling=null,n=Za.current,ie(Za,a?n&1|2:n&1),wi&&_i(t,r.treeForkCount),e);case 22:case 23:return Xa(t),Ua(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ec(t),t.subtreeFlags&6&&(t.flags|=8192)):Ec(t),n=t.updateQueue,n!==null&&wc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ne(aa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),zi(Xi),Ec(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Oc(e,t){switch(bi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zi(Xi),de(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pe(t),null;case 31:if(t.memoizedState!==null){if(Xa(t),t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Xa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ne(Za),null;case 4:return de(),null;case 10:return zi(t.type),null;case 22:case 23:return Xa(t),Ua(),e!==null&&ne(aa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zi(Xi),null;case 25:return null;default:return null}}function kc(e,t){switch(bi(t),t.tag){case 3:zi(Xi),de();break;case 26:case 27:case 5:pe(t);break;case 4:de();break;case 31:t.memoizedState!==null&&Xa(t);break;case 13:Xa(t);break;case 19:ne(Za);break;case 10:zi(t.type);break;case 22:case 23:Xa(t),Ua(),e!==null&&ne(aa);break;case 24:zi(Xi)}}function Ac(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){zu(t,t.return,e)}}function jc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){zu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){zu(t,t.return,e)}}function Mc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ra(t,n)}catch(t){zu(e,e.return,t)}}}function Nc(e,t,n){n.props=Fs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){zu(e,t,n)}}function Pc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){zu(e,t,n)}}function Fc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){zu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){zu(e,t,n)}else n.current=null}function Ic(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){zu(e,e.return,t)}}function Lc(e,t,n){try{var r=e.stateNode;jd(r,e.type,n,t),r[st]=t}catch(t){zu(e,e.return,t)}}function Rc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qd(e.type)||e.tag===4}function zc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Rc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&qd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Bc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&qd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Bc(e,t,n),e=e.sibling;e!==null;)Bc(e,t,n),e=e.sibling}function Vc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&qd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Vc(e,t,n),e=e.sibling;e!==null;)Vc(e,t,n),e=e.sibling}function Hc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ad(t,r,n),t[ot]=e,t[st]=n}catch(t){zu(e,e.return,t)}}var Uc=!1,Wc=!1,Gc=!1,Kc=typeof WeakSet==`function`?WeakSet:Set,qc=null;function _ee(e,t){if(e=e.containerInfo,Pd=ep,e=_r(e),vr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Fd={focusedElem:e,selectionRange:n},ep=!1,qc=t;qc!==null;)if(t=qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,qc=e;else for(;qc!==null;){switch(t=qc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Ad(o,r,n),o[ot]=e,yt(o),r=o;break a;case`link`:var s=Pf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=hr(s,h),v=hr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,j.T=null,n=ru,ru=null;var o=$l,s=tu;if(Ql=0,eu=$l=null,tu=0,Ol&6)throw Error(i(331));var c=Ol;if(Ol|=4,Cl(o.current),hl(o,o.current,s,n),Ol=c,Qu(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,o)}catch{}return!0}finally{M.p=a,j.T=r,Fu(e,t)}}function Ru(e,t,n){t=si(n,t),t=Vs(e.stateNode,t,2),e=ja(e,t,2),e!==null&&(Xe(e,2),Zu(e))}function zu(e,t,n){if(e.tag===3)Ru(e,e,n);else for(;t!==null;){if(t.tag===3){Ru(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Zl===null||!Zl.has(r))){e=si(n,e),n=Hs(2),r=ja(t,n,2),r!==null&&(Us(n,r,t,e),Xe(r,2),Zu(r));break}}t=t.return}}function Bu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Dl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Il=!0,i.add(n),e=Vu.bind(null,e,t,n),t.then(e,e))}function Vu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,kl===e&&(jl&n)===n&&(Rl===4||Rl===3&&(jl&62914560)===jl&&300>Ee()-ql?!(Ol&2)&&gu(e,0):Vl|=n,Ul===jl&&(Ul=0)),Zu(e)}function Hu(e,t){t===0&&(t=Je()),e=Kr(e,t),e!==null&&(Xe(e,t),Zu(e))}function Uu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Hu(e,n)}function vee(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Hu(e,n)}function Wu(e,t){return Se(e,t)}var Gu=null,Ku=null,qu=!1,Ju=!1,Yu=!1,Xu=0;function Zu(e){e!==Ku&&e.next===null&&(Ku===null?Gu=Ku=e:Ku=Ku.next=e),Ju=!0,qu||(qu=!0,id())}function Qu(e,t){if(!Yu&&Ju){Yu=!0;do for(var n=!1,r=Gu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Re(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,rd(r,a))}else a=jl,a=Ke(r,r===kl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||qe(r,a)||(n=!0,rd(r,a));r=r.next}while(n);Yu=!1}}function $u(){ed()}function ed(){Ju=qu=!1;var e=0;Xu!==0&&Vd()&&(e=Xu);for(var t=Ee(),n=null,r=Gu;r!==null;){var i=r.next,a=td(r,t);a===0?(r.next=null,n===null?Gu=i:n.next=i,i===null&&(Ku=n)):(n=r,(e!==0||a&3)&&(Ju=!0)),r=i}Ql!==0&&Ql!==5||Qu(e,!1),Xu!==0&&(Xu=0)}function td(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Md(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function mf(e,t,n){var r=pf;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),lf.has(i)||(lf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ad(t,`link`,e),yt(t),r.head.appendChild(t)))}}function hf(e){df.D(e),mf(`dns-prefetch`,e,null)}function gf(e,t){df.C(e,t),mf(`preconnect`,e,t)}function _f(e,t,n){df.L(e,t,n);var r=pf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=Cf(e);break;case`script`:a=Df(e)}cf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),cf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(wf(a))||t===`script`&&r.querySelector(Of(a))||(t=r.createElement(`link`),Ad(t,`link`,e),yt(t),r.head.appendChild(t)))}}function vf(e,t){df.m(e,t);var n=pf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Rt(r)+`"][href="`+Rt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Df(e)}if(!cf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),cf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Of(a)))return}r=n.createElement(`link`),Ad(r,`link`,e),yt(r),n.head.appendChild(r)}}}function yf(e,t,n){df.S(e,t,n);var r=pf;if(r&&e){var i=vt(r).hoistableStyles,a=Cf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(wf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=cf.get(a))&&jf(e,n);var c=o=r.createElement(`link`);yt(c),Ad(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Af(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function bf(e,t){df.X(e,t);var n=pf;if(n&&e){var r=vt(n).hoistableScripts,i=Df(e),a=r.get(i);a||(a=n.querySelector(Of(i)),a||(e=f({src:e,async:!0},t),(t=cf.get(i))&&Mf(e,t),a=n.createElement(`script`),yt(a),Ad(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function xf(e,t){df.M(e,t);var n=pf;if(n&&e){var r=vt(n).hoistableScripts,i=Df(e),a=r.get(i);a||(a=n.querySelector(Of(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=cf.get(i))&&Mf(e,t),a=n.createElement(`script`),yt(a),Ad(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Sf(e,t,n,r){var a=(a=le.current)?uf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Cf(n.href),n=vt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Cf(n.href);var o=vt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(wf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),cf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},cf.set(e,n),o||Ef(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Df(n),n=vt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Cf(e){return`href="`+Rt(e)+`"`}function wf(e){return`link[rel="stylesheet"][`+e+`]`}function Tf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Ef(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ad(t,`link`,n),yt(t),e.head.appendChild(t))}function Df(e){return`[src="`+Rt(e)+`"]`}function Of(e){return`script[async]`+e}function kf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Ad(r,`style`,a),Af(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Cf(n.href);var o=e.querySelector(wf(a));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=Tf(n),(a=cf.get(a))&&jf(r,a),o=(e.ownerDocument||e).createElement(`link`),yt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ad(o,`link`,r),t.state.loading|=4,Af(o,n.precedence,e),t.instance=o;case`script`:return o=Df(n.src),(a=e.querySelector(Of(o)))?(t.instance=a,yt(a),a):(r=n,(a=cf.get(o))&&(r=f({},n),Mf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(a),Ad(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Af(r,n.precedence,e));return t.instance}function Af(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function If(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Lf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Rf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Cf(r.href),a=t.querySelector(wf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Vf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Tf(r),(i=cf.get(i))&&jf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ad(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Vf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var zf=0;function Bf(e,t){return e.stylesheets&&e.count===0&&Uf(e,e.stylesheets),0zf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Vf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Uf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Hf=null;function Uf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Hf=new Map,t.forEach(Wf,e),Hf=null,Vf.call(e))}function Wf(e,t){if(!(t.state.loading&4)){var n=Hf.get(e);if(n)var r=n.get(null);else{n=new Map,Hf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{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=ce()})),L=t(re(),1),ue=t(le(),1),de={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},fe;(function(e){})(fe||={});function pe(e){return p(y,e)}function me(e){return c(A,e)}var he=E([`lru`,`lfu`,`fifo`,`ttl`,`adaptive`]).describe(`Cache eviction strategy`),ge=h({name:r().describe(`Unique cache tier name`),type:E([`memory`,`redis`,`memcached`,`cdn`]).describe(`Cache backend type`),maxSize:P().optional().describe(`Max size in MB`),ttl:P().default(300).describe(`Default TTL in seconds`),strategy:he.default(`lru`).describe(`Eviction strategy`),warmup:S().default(!1).describe(`Pre-populate cache on startup`)}).describe(`Configuration for a single cache tier in the hierarchy`),_e=h({trigger:E([`create`,`update`,`delete`,`manual`]).describe(`Event that triggers invalidation`),scope:E([`key`,`pattern`,`tag`,`all`]).describe(`Invalidation scope`),pattern:r().optional().describe(`Key pattern for pattern-based invalidation`),tags:C(r()).optional().describe(`Cache tags to invalidate`)}).describe(`Rule defining when and how cached entries are invalidated`),ve=h({enabled:S().default(!1).describe(`Enable application-level caching`),tiers:C(ge).describe(`Ordered cache tier hierarchy`),invalidation:C(_e).describe(`Cache invalidation rules`),prefetch:S().default(!1).describe(`Enable cache prefetching`),compression:S().default(!1).describe(`Enable data compression in cache`),encryption:S().default(!1).describe(`Enable encryption for cached data`)}).describe(`Top-level application cache configuration`),ye=E([`write_through`,`write_behind`,`write_around`,`refresh_ahead`]).describe(`Distributed cache write consistency strategy`),be=h({jitterTtl:h({enabled:S().default(!1).describe(`Add random jitter to TTL values`),maxJitterSeconds:P().default(60).describe(`Maximum jitter added to TTL in seconds`)}).optional().describe(`TTL jitter to prevent simultaneous expiration`),circuitBreaker:h({enabled:S().default(!1).describe(`Enable circuit breaker for backend protection`),failureThreshold:P().default(5).describe(`Failures before circuit opens`),resetTimeout:P().default(30).describe(`Seconds before half-open state`)}).optional().describe(`Circuit breaker for backend protection`),lockout:h({enabled:S().default(!1).describe(`Enable cache locking for key regeneration`),lockTimeoutMs:P().default(5e3).describe(`Maximum lock wait time in milliseconds`)}).optional().describe(`Lock-based stampede prevention`)}).describe(`Cache avalanche/stampede prevention configuration`),xe=h({enabled:S().default(!1).describe(`Enable cache warmup`),strategy:E([`eager`,`lazy`,`scheduled`]).default(`lazy`).describe(`Warmup strategy: eager (at startup), lazy (on first access), scheduled (cron)`),schedule:r().optional().describe(`Cron expression for scheduled warmup`),patterns:C(r()).optional().describe(`Key patterns to warm up (e.g., "user:*", "config:*")`),concurrency:P().default(10).describe(`Maximum concurrent warmup operations`)}).describe(`Cache warmup strategy`);ve.extend({consistency:ye.optional().describe(`Distributed cache consistency strategy`),avalanchePrevention:be.optional().describe(`Cache avalanche and stampede prevention`),warmup:xe.optional().describe(`Cache warmup strategy`)}).describe(`Distributed cache configuration with consistency and avalanche prevention`);var Se=E([`full`,`incremental`,`differential`]).describe(`Backup strategy type`),Ce=h({days:P().min(1).describe(`Retention period in days`),minCopies:P().min(1).default(3).describe(`Minimum backup copies to retain`),maxCopies:P().optional().describe(`Maximum backup copies to store`)}).describe(`Backup retention policy`),we=h({strategy:Se.default(`incremental`).describe(`Backup strategy`),schedule:r().optional().describe(`Cron expression for backup schedule (e.g., "0 2 * * *")`),retention:Ce.describe(`Backup retention policy`),destination:h({type:E([`s3`,`gcs`,`azure_blob`,`local`]).describe(`Storage backend type`),bucket:r().optional().describe(`Cloud storage bucket/container name`),path:r().optional().describe(`Storage path prefix`),region:r().optional().describe(`Cloud storage region`)}).describe(`Backup storage destination`),encryption:h({enabled:S().default(!0).describe(`Enable backup encryption`),algorithm:E([`AES-256-GCM`,`AES-256-CBC`,`ChaCha20-Poly1305`]).default(`AES-256-GCM`).describe(`Encryption algorithm`),keyId:r().optional().describe(`KMS key ID for encryption`)}).optional().describe(`Backup encryption settings`),compression:h({enabled:S().default(!0).describe(`Enable backup compression`),algorithm:E([`gzip`,`zstd`,`lz4`,`snappy`]).default(`zstd`).describe(`Compression algorithm`)}).optional().describe(`Backup compression settings`),verifyAfterBackup:S().default(!0).describe(`Verify backup integrity after creation`)}).describe(`Backup configuration`),Te=h({mode:E([`active_passive`,`active_active`,`pilot_light`,`warm_standby`]).describe(`Failover mode`).default(`active_passive`).describe(`Failover mode`),autoFailover:S().default(!0).describe(`Enable automatic failover`),healthCheckInterval:P().default(30).describe(`Health check interval in seconds`),failureThreshold:P().default(3).describe(`Consecutive failures before failover`),regions:C(h({name:r().describe(`Region identifier (e.g., "us-east-1", "eu-west-1")`),role:E([`primary`,`secondary`,`witness`]).describe(`Region role`),endpoint:r().optional().describe(`Region endpoint URL`),priority:P().optional().describe(`Failover priority (lower = higher priority)`)})).min(2).describe(`Multi-region configuration (minimum 2 regions)`),dns:h({ttl:P().default(60).describe(`DNS TTL in seconds for failover`),provider:E([`route53`,`cloudflare`,`azure_dns`,`custom`]).optional().describe(`DNS provider for automatic failover`)}).optional().describe(`DNS failover settings`)}).describe(`Failover configuration`),Ee=h({value:P().min(0).describe(`RPO value`),unit:E([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RPO time unit`)}).describe(`Recovery Point Objective (maximum acceptable data loss)`),De=h({value:P().min(0).describe(`RTO value`),unit:E([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RTO time unit`)}).describe(`Recovery Time Objective (maximum acceptable downtime)`);h({enabled:S().default(!1).describe(`Enable disaster recovery plan`),rpo:Ee.describe(`Recovery Point Objective`),rto:De.describe(`Recovery Time Objective`),backup:we.describe(`Backup configuration`),failover:Te.optional().describe(`Multi-region failover configuration`),replication:h({mode:E([`synchronous`,`asynchronous`,`semi_synchronous`]).default(`asynchronous`).describe(`Data replication mode`),maxLagSeconds:P().optional().describe(`Maximum acceptable replication lag in seconds`),includeObjects:C(r()).optional().describe(`Objects to replicate (empty = all)`),excludeObjects:C(r()).optional().describe(`Objects to exclude from replication`)}).optional().describe(`Data replication settings`),testing:h({enabled:S().default(!1).describe(`Enable automated DR testing`),schedule:r().optional().describe(`Cron expression for DR test schedule`),notificationChannel:r().optional().describe(`Notification channel for DR test results`)}).optional().describe(`Automated disaster recovery testing`),runbookUrl:r().optional().describe(`URL to disaster recovery runbook/playbook`),contacts:C(h({name:r().describe(`Contact name`),role:r().describe(`Contact role (e.g., "DBA", "SRE Lead")`),email:r().optional().describe(`Contact email`),phone:r().optional().describe(`Contact phone`)})).optional().describe(`Emergency contact list for DR incidents`)}).describe(`Complete disaster recovery plan configuration`);var Oe=E([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Supported message queue backend provider`),ke=h({name:r().describe(`Topic name identifier`),partitions:P().default(1).describe(`Number of partitions for parallel consumption`),replicationFactor:P().default(1).describe(`Number of replicas for fault tolerance`),retentionMs:P().optional().describe(`Message retention period in milliseconds`),compressionType:E([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression algorithm`)}).describe(`Configuration for a message queue topic`),Ae=h({groupId:r().describe(`Consumer group identifier`),autoOffsetReset:E([`earliest`,`latest`]).default(`latest`).describe(`Where to start reading when no offset exists`),enableAutoCommit:S().default(!0).describe(`Automatically commit consumed offsets`),maxPollRecords:P().default(500).describe(`Maximum records returned per poll`)}).describe(`Consumer group configuration for topic consumption`),je=h({enabled:S().default(!1).describe(`Enable dead letter queue for failed messages`),maxRetries:P().default(3).describe(`Maximum delivery attempts before sending to DLQ`),queueName:r().describe(`Name of the dead letter queue`)}).describe(`Dead letter queue configuration for unprocessable messages`);h({provider:Oe.describe(`Message queue backend provider`),topics:C(ke).describe(`List of topic configurations`),consumers:C(Ae).optional().describe(`Consumer group configurations`),deadLetterQueue:je.optional().describe(`Dead letter queue for failed messages`),ssl:S().default(!1).describe(`Enable SSL/TLS for broker connections`),sasl:h({mechanism:E([`plain`,`scram-sha-256`,`scram-sha-512`]).describe(`SASL authentication mechanism`),username:r().describe(`SASL username`),password:r().describe(`SASL password`)}).optional().describe(`SASL authentication configuration`)}).describe(`Top-level message queue configuration`);var Me=r().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)`),Ne=r().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)`);r().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 Pe=E([`global`,`tenant`,`user`,`session`,`temp`,`cache`,`data`,`logs`,`config`,`public`]).describe(`Storage scope classification`);h({path:r().describe(`File path`),name:r().describe(`File name`),size:P().int().describe(`File size in bytes`),mimeType:r().describe(`MIME type`),lastModified:r().datetime().describe(`Last modified timestamp`),created:r().datetime().describe(`Creation timestamp`),etag:r().optional().describe(`Entity tag`)});var Fe=E([`s3`,`azure_blob`,`gcs`,`minio`,`r2`,`spaces`,`wasabi`,`backblaze`,`local`]).describe(`Storage provider type`),Ie=E([`private`,`public_read`,`public_read_write`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full_control`]).describe(`Storage access control level`),Le=E([`standard`,`intelligent`,`infrequent_access`,`glacier`,`deep_archive`]).describe(`Storage class/tier for cost optimization`),Re=E([`transition`,`delete`,`abort`]).describe(`Lifecycle policy action type`);h({contentType:r().describe(`MIME type (e.g., image/jpeg, application/pdf)`),contentLength:P().min(0).describe(`File size in bytes`),contentEncoding:r().optional().describe(`Content encoding (e.g., gzip)`),contentDisposition:r().optional().describe(`Content disposition header`),contentLanguage:r().optional().describe(`Content language`),cacheControl:r().optional().describe(`Cache control directives`),etag:r().optional().describe(`Entity tag for versioning/caching`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),versionId:r().optional().describe(`Object version identifier`),storageClass:Le.optional().describe(`Storage class/tier`),encryption:h({algorithm:r().describe(`Encryption algorithm (e.g., AES256, aws:kms)`),keyId:r().optional().describe(`KMS key ID if using managed encryption`)}).optional().describe(`Server-side encryption configuration`),custom:d(r(),r()).optional().describe(`Custom user-defined metadata`)}),h({operation:E([`get`,`put`,`delete`,`head`]).describe(`Allowed operation`),expiresIn:P().min(1).max(604800).describe(`Expiration time in seconds (max 7 days)`),contentType:r().optional().describe(`Required content type for PUT operations`),maxSize:P().min(0).optional().describe(`Maximum file size in bytes for PUT operations`),responseContentType:r().optional().describe(`Override content-type for GET operations`),responseContentDisposition:r().optional().describe(`Override content-disposition for GET operations`)});var ze=h({enabled:S().default(!0).describe(`Enable multipart uploads`),partSize:P().min(5*1024*1024).max(5*1024*1024*1024).default(10*1024*1024).describe(`Part size in bytes (min 5MB, max 5GB)`),maxParts:P().min(1).max(1e4).default(1e4).describe(`Maximum number of parts (max 10,000)`),threshold:P().min(0).default(100*1024*1024).describe(`File size threshold to trigger multipart upload (bytes)`),maxConcurrent:P().min(1).max(100).default(4).describe(`Maximum concurrent part uploads`),abortIncompleteAfterDays:P().min(1).optional().describe(`Auto-abort incomplete uploads after N days`)}),Be=h({acl:Ie.default(`private`).describe(`Default access control level`),allowedOrigins:C(r()).optional().describe(`CORS allowed origins`),allowedMethods:C(E([`GET`,`PUT`,`POST`,`DELETE`,`HEAD`])).optional().describe(`CORS allowed HTTP methods`),allowedHeaders:C(r()).optional().describe(`CORS allowed headers`),exposeHeaders:C(r()).optional().describe(`CORS exposed headers`),maxAge:P().min(0).optional().describe(`CORS preflight cache duration in seconds`),corsEnabled:S().default(!1).describe(`Enable CORS configuration`),publicAccess:h({allowPublicRead:S().default(!1).describe(`Allow public read access`),allowPublicWrite:S().default(!1).describe(`Allow public write access`),allowPublicList:S().default(!1).describe(`Allow public bucket listing`)}).optional().describe(`Public access control`),allowedIps:C(r()).optional().describe(`Allowed IP addresses/CIDR blocks`),blockedIps:C(r()).optional().describe(`Blocked IP addresses/CIDR blocks`)}),Ve=h({id:Me.describe(`Rule identifier`),enabled:S().default(!0).describe(`Enable this rule`),action:Re.describe(`Action to perform`),prefix:r().optional().describe(`Object key prefix filter (e.g., "uploads/")`),tags:d(r(),r()).optional().describe(`Object tag filters`),daysAfterCreation:P().min(0).optional().describe(`Days after object creation`),daysAfterModification:P().min(0).optional().describe(`Days after last modification`),targetStorageClass:Le.optional().describe(`Target storage class for transition action`)}).refine(e=>!(e.action===`transition`&&!e.targetStorageClass),{message:`targetStorageClass is required when action is "transition"`}),He=h({enabled:S().default(!1).describe(`Enable lifecycle policies`),rules:C(Ve).default([]).describe(`Lifecycle rules`)}),Ue=h({name:Me.describe(`Bucket identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),bucketName:r().describe(`Actual bucket/container name in storage provider`),region:r().optional().describe(`Storage region (e.g., us-east-1, westus)`),provider:Fe.describe(`Storage provider`),endpoint:r().optional().describe(`Custom endpoint URL (for S3-compatible providers)`),pathStyle:S().default(!1).describe(`Use path-style URLs (for S3-compatible providers)`),versioning:S().default(!1).describe(`Enable object versioning`),encryption:h({enabled:S().default(!1).describe(`Enable server-side encryption`),algorithm:E([`AES256`,`aws:kms`,`azure:kms`,`gcp:kms`]).default(`AES256`).describe(`Encryption algorithm`),kmsKeyId:r().optional().describe(`KMS key ID for managed encryption`)}).optional().describe(`Server-side encryption configuration`),accessControl:Be.optional().describe(`Access control configuration`),lifecyclePolicy:He.optional().describe(`Lifecycle policy configuration`),multipartConfig:ze.optional().describe(`Multipart upload configuration`),tags:d(r(),r()).optional().describe(`Bucket tags for organization`),description:r().optional().describe(`Bucket description`),enabled:S().default(!0).describe(`Enable this bucket`)}),We=h({accessKeyId:r().optional().describe(`AWS access key ID or MinIO access key`),secretAccessKey:r().optional().describe(`AWS secret access key or MinIO secret key`),sessionToken:r().optional().describe(`AWS session token for temporary credentials`),accountName:r().optional().describe(`Azure storage account name`),accountKey:r().optional().describe(`Azure storage account key`),sasToken:r().optional().describe(`Azure SAS token`),projectId:r().optional().describe(`GCP project ID`),credentials:r().optional().describe(`GCP service account credentials JSON`),endpoint:r().optional().describe(`Custom endpoint URL`),region:r().optional().describe(`Default region`),useSSL:S().default(!0).describe(`Use SSL/TLS for connections`),timeout:P().min(0).optional().describe(`Connection timeout in milliseconds`)}),Ge=h({name:Me.describe(`Storage configuration identifier`),label:r().describe(`Display label`),provider:Fe.describe(`Primary storage provider`),scope:Pe.optional().default(`global`).describe(`Storage scope`),connection:We.describe(`Connection credentials`),buckets:C(Ue).default([]).describe(`Configured buckets`),defaultBucket:r().optional().describe(`Default bucket name for operations`),location:r().optional().describe(`Root path (local) or base location`),quota:P().int().positive().optional().describe(`Max size in bytes`),options:d(r(),u()).optional().describe(`Provider-specific configuration options`),enabled:S().default(!0).describe(`Enable this storage configuration`),description:r().optional().describe(`Configuration description`)});Ge.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}),Ge.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}),Ge.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}),Ge.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});var Ke=E([`elasticsearch`,`algolia`,`meilisearch`,`typesense`,`opensearch`]).describe(`Supported full-text search engine provider`),qe=h({type:E([`standard`,`simple`,`whitespace`,`keyword`,`pattern`,`language`]).describe(`Text analyzer type`),language:r().optional().describe(`Language for language-specific analysis`),stopwords:C(r()).optional().describe(`Custom stopwords to filter during analysis`),customFilters:C(r()).optional().describe(`Additional token filter names to apply`)}).describe(`Text analyzer configuration for index tokenization and normalization`),eee=h({indexName:r().describe(`Name of the search index`),objectName:r().describe(`Source ObjectQL object`),fields:C(h({name:r().describe(`Field name to index`),type:E([`text`,`keyword`,`number`,`date`,`boolean`,`geo`]).describe(`Index field data type`),analyzer:r().optional().describe(`Named analyzer to use for this field`),searchable:S().default(!0).describe(`Include field in full-text search`),filterable:S().default(!1).describe(`Allow filtering on this field`),sortable:S().default(!1).describe(`Allow sorting by this field`),boost:P().default(1).describe(`Relevance boost factor for this field`)})).describe(`Fields to include in the search index`),replicas:P().default(1).describe(`Number of index replicas for availability`),shards:P().default(1).describe(`Number of index shards for distribution`)}).describe(`Search index definition mapping an ObjectQL object to a search engine index`),Je=h({field:r().describe(`Field name to generate facets from`),maxValues:P().default(10).describe(`Maximum number of facet values to return`),sort:E([`count`,`alpha`]).default(`count`).describe(`Facet value sort order`)}).describe(`Faceted search configuration for a single field`);h({provider:Ke.describe(`Search engine backend provider`),indexes:C(eee).describe(`Search index definitions`),analyzers:d(r(),qe).optional().describe(`Named text analyzer configurations`),facets:C(Je).optional().describe(`Faceted search configurations`),typoTolerance:S().default(!0).describe(`Enable typo-tolerant search`),synonyms:d(r(),C(r())).optional().describe(`Synonym mappings for search expansion`),ranking:C(E([`typo`,`geo`,`words`,`filters`,`proximity`,`attribute`,`exact`,`custom`])).optional().describe(`Custom ranking rule order`)}).describe(`Top-level full-text search engine configuration`);var Ye=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),Xe=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]);h({url:r().describe(`API endpoint URL`),method:Xe.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)});var Ze=h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(Ye).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),Qe=h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),$e=h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)}),et=h({port:P().int().min(1).max(65535).default(3e3).describe(`Port number to listen on`),host:r().default(`0.0.0.0`).describe(`Host address to bind to`),cors:Ze.optional().describe(`CORS configuration`),requestTimeout:P().int().default(3e4).describe(`Request timeout in milliseconds`),bodyLimit:r().default(`10mb`).describe(`Maximum request body size`),compression:S().default(!0).describe(`Enable response compression`),security:h({helmet:S().default(!0).describe(`Enable security headers via helmet`),rateLimit:Qe.optional().describe(`Global rate limiting configuration`)}).optional().describe(`Security configuration`),static:C($e).optional().describe(`Static file serving configuration`),trustProxy:S().default(!1).describe(`Trust X-Forwarded-* headers`)});h({method:Ye.describe(`HTTP method`),path:r().describe(`URL path pattern`),handler:r().describe(`Handler identifier or name`),metadata:h({summary:r().optional().describe(`Route summary for documentation`),description:r().optional().describe(`Route description`),tags:C(r()).optional().describe(`Tags for grouping`),operationId:r().optional().describe(`Unique operation identifier`)}).optional(),security:h({authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:r().optional().describe(`Rate limit policy override`)}).optional()});var tt=E([`authentication`,`authorization`,`logging`,`validation`,`transformation`,`error`,`custom`]),nt=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Middleware name (snake_case)`),type:tt.describe(`Middleware type`),enabled:S().default(!0).describe(`Whether middleware is enabled`),order:P().int().default(100).describe(`Execution order priority`),config:d(r(),u()).optional().describe(`Middleware configuration object`),paths:h({include:C(r()).optional().describe(`Include path patterns (glob)`),exclude:C(r()).optional().describe(`Exclude path patterns (glob)`)}).optional().describe(`Path filtering`)});h({type:E([`starting`,`started`,`stopping`,`stopped`,`request`,`response`,`error`]).describe(`Event type`),timestamp:r().datetime().describe(`Event timestamp (ISO 8601)`),data:d(r(),u()).optional().describe(`Event-specific data`)}),h({httpVersions:C(E([`1.0`,`1.1`,`2.0`,`3.0`])).default([`1.1`]).describe(`Supported HTTP versions`),websocket:S().default(!1).describe(`WebSocket support`),sse:S().default(!1).describe(`Server-Sent Events support`),serverPush:S().default(!1).describe(`HTTP/2 Server Push support`),streaming:S().default(!0).describe(`Response streaming support`),middleware:S().default(!0).describe(`Middleware chain support`),routeParams:S().default(!0).describe(`URL parameter support (/users/:id)`),compression:S().default(!0).describe(`Built-in compression support`)}),h({state:E([`stopped`,`starting`,`running`,`stopping`,`error`]).describe(`Current server state`),uptime:P().int().optional().describe(`Server uptime in milliseconds`),server:h({port:P().int().describe(`Listening port`),host:r().describe(`Bound host`),url:r().optional().describe(`Full server URL`)}).optional(),connections:h({active:P().int().describe(`Active connections`),total:P().int().describe(`Total connections handled`)}).optional(),requests:h({total:P().int().describe(`Total requests processed`),success:P().int().describe(`Successful requests`),errors:P().int().describe(`Failed requests`)}).optional()}),Object.assign(et,{create:e=>e}),Object.assign(nt,{create:e=>e});var rt=E(`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(`,`)),it=E([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),at=h({type:E([`user`,`system`,`service`,`api_client`,`integration`]).describe(`Actor type`),id:r().describe(`Actor identifier`),name:r().optional().describe(`Actor display name`),email:r().email().optional().describe(`Actor email address`),ipAddress:r().optional().describe(`Actor IP address`),userAgent:r().optional().describe(`User agent string`)}),ot=h({type:r().describe(`Target type`),id:r().describe(`Target identifier`),name:r().optional().describe(`Target display name`),metadata:d(r(),u()).optional().describe(`Target metadata`)}),st=h({field:r().describe(`Changed field name`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`)});h({id:r().describe(`Audit event ID`),eventType:rt.describe(`Event type`),severity:it.default(`info`).describe(`Event severity`),timestamp:r().datetime().describe(`Event timestamp`),actor:at.describe(`Event actor`),target:ot.optional().describe(`Event target`),description:r().describe(`Event description`),changes:C(st).optional().describe(`List of changes`),result:E([`success`,`failure`,`partial`]).default(`success`).describe(`Action result`),errorMessage:r().optional().describe(`Error message`),tenantId:r().optional().describe(`Tenant identifier`),requestId:r().optional().describe(`Request ID for tracing`),metadata:d(r(),u()).optional().describe(`Additional metadata`),location:h({country:r().optional(),region:r().optional(),city:r().optional()}).optional().describe(`Geographic location`)});var ct=h({retentionDays:P().int().min(1).default(180).describe(`Retention period in days`),archiveAfterRetention:S().default(!0).describe(`Archive logs after retention period`),archiveStorage:h({type:E([`s3`,`gcs`,`azure_blob`,`filesystem`]).describe(`Archive storage type`),endpoint:r().optional().describe(`Storage endpoint URL`),bucket:r().optional().describe(`Storage bucket/container name`),path:r().optional().describe(`Storage path prefix`),credentials:d(r(),u()).optional().describe(`Storage credentials`)}).optional().describe(`Archive storage configuration`),customRetention:d(r(),P().int().positive()).optional().describe(`Custom retention by event type`),minimumRetentionDays:P().int().positive().optional().describe(`Minimum retention for compliance`)}),lt=h({id:r().describe(`Rule identifier`),name:r().describe(`Rule name`),description:r().optional().describe(`Rule description`),enabled:S().default(!0).describe(`Rule enabled status`),eventTypes:C(rt).describe(`Event types to monitor`),condition:h({threshold:P().int().positive().describe(`Event threshold`),windowSeconds:P().int().positive().describe(`Time window in seconds`),groupBy:C(r()).optional().describe(`Grouping criteria`),filters:d(r(),u()).optional().describe(`Additional filters`)}).describe(`Detection condition`),actions:C(E([`alert`,`lock_account`,`block_ip`,`require_mfa`,`log_critical`,`webhook`])).describe(`Actions to take`),alertSeverity:it.default(`warning`).describe(`Alert severity`),notifications:h({email:C(r().email()).optional().describe(`Email recipients`),slack:r().url().optional().describe(`Slack webhook URL`),webhook:r().url().optional().describe(`Custom webhook URL`)}).optional().describe(`Notification configuration`)}),ut=h({type:E([`database`,`elasticsearch`,`mongodb`,`clickhouse`,`s3`,`gcs`,`azure_blob`,`custom`]).describe(`Storage backend type`),connectionString:r().optional().describe(`Connection string`),config:d(r(),u()).optional().describe(`Storage-specific configuration`),bufferEnabled:S().default(!0).describe(`Enable buffering`),bufferSize:P().int().positive().default(100).describe(`Buffer size`),flushIntervalSeconds:P().int().positive().default(5).describe(`Flush interval in seconds`),compression:S().default(!0).describe(`Enable compression`)});h({eventTypes:C(rt).optional().describe(`Event types to include`),severities:C(it).optional().describe(`Severity levels to include`),actorId:r().optional().describe(`Actor identifier`),tenantId:r().optional().describe(`Tenant identifier`),timeRange:h({from:r().datetime().describe(`Start time`),to:r().datetime().describe(`End time`)}).optional().describe(`Time range filter`),result:E([`success`,`failure`,`partial`]).optional().describe(`Result status`),searchQuery:r().optional().describe(`Search query`),customFilters:d(r(),u()).optional().describe(`Custom filters`)}),h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().default(!0).describe(`Enable audit logging`),eventTypes:C(rt).optional().describe(`Event types to audit`),excludeEventTypes:C(rt).optional().describe(`Event types to exclude`),minimumSeverity:it.default(`info`).describe(`Minimum severity level`),storage:ut.describe(`Storage configuration`),retentionPolicy:ct.optional().describe(`Retention policy`),suspiciousActivityRules:C(lt).default([]).describe(`Suspicious activity rules`),includeSensitiveData:S().default(!1).describe(`Include sensitive data`),redactFields:C(r()).default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`]).describe(`Fields to redact`),logReads:S().default(!1).describe(`Log read operations`),readSamplingRate:P().min(0).max(1).default(.1).describe(`Read sampling rate`),logSystemEvents:S().default(!0).describe(`Log system events`),customHandlers:C(h({eventType:rt.describe(`Event type to handle`),handlerId:r().describe(`Unique identifier for the handler`)})).optional().describe(`Custom event handler references`),compliance:h({standards:C(E([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),immutableLogs:S().default(!0).describe(`Enforce immutable logs`),requireSigning:S().default(!1).describe(`Require log signing`),signingKey:r().optional().describe(`Signing key`)}).optional().describe(`Compliance configuration`)});var dt=E([`debug`,`info`,`warn`,`error`,`fatal`,`silent`]).describe(`Log severity level`),ft=E([`json`,`text`,`pretty`]).describe(`Log output format`),pt=h({name:r().optional().describe(`Logger name identifier`),level:dt.optional().default(`info`),format:ft.optional().default(`json`),redact:C(r()).optional().default([`password`,`token`,`secret`,`key`]).describe(`Keys to redact from log context`),sourceLocation:S().optional().default(!1).describe(`Include file and line number`),file:r().optional().describe(`Path to log file`),rotation:h({maxSize:r().optional().default(`10m`),maxFiles:P().optional().default(5)}).optional()});h({timestamp:r().datetime().describe(`ISO 8601 timestamp`),level:dt,message:r().describe(`Log message`),context:d(r(),u()).optional().describe(`Structured context data`),error:d(r(),u()).optional().describe(`Error object if present`),traceId:r().optional().describe(`Distributed trace ID`),spanId:r().optional().describe(`Span ID`),service:r().optional().describe(`Service name`),component:r().optional().describe(`Component name (e.g. plugin id)`)});var mt=E([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]).describe(`Extended log severity level`),ht=E([`console`,`file`,`syslog`,`elasticsearch`,`cloudwatch`,`stackdriver`,`azure_monitor`,`datadog`,`splunk`,`loki`,`http`,`kafka`,`redis`,`custom`]).describe(`Log destination type`),gt=h({stream:E([`stdout`,`stderr`]).optional().default(`stdout`),colors:S().optional().default(!0),prettyPrint:S().optional().default(!1)}).describe(`Console destination configuration`),_t=h({path:r().describe(`Log file path`),rotation:h({maxSize:r().optional().default(`10m`),maxFiles:P().int().positive().optional().default(5),compress:S().optional().default(!0),interval:E([`hourly`,`daily`,`weekly`,`monthly`]).optional()}).optional(),encoding:r().optional().default(`utf8`),append:S().optional().default(!0)}).describe(`File destination configuration`),vt=h({url:r().url().describe(`HTTP endpoint URL`),method:E([`POST`,`PUT`]).optional().default(`POST`),headers:d(r(),r()).optional(),auth:h({type:E([`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional(),apiKeyHeader:r().optional().default(`X-API-Key`)}).optional(),batch:h({maxSize:P().int().positive().optional().default(100),flushInterval:P().int().positive().optional().default(5e3)}).optional(),retry:h({maxAttempts:P().int().positive().optional().default(3),initialDelay:P().int().positive().optional().default(1e3),backoffMultiplier:P().positive().optional().default(2)}).optional(),timeout:P().int().positive().optional().default(3e4)}).describe(`HTTP destination configuration`),yt=h({endpoint:r().url().optional(),region:r().optional(),credentials:h({accessKeyId:r().optional(),secretAccessKey:r().optional(),apiKey:r().optional(),projectId:r().optional()}).optional(),logGroup:r().optional(),logStream:r().optional(),index:r().optional(),config:d(r(),u()).optional()}).describe(`External service destination configuration`),bt=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Destination name (snake_case)`),type:ht.describe(`Destination type`),level:mt.optional().default(`info`),enabled:S().optional().default(!0),console:gt.optional(),file:_t.optional(),http:vt.optional(),externalService:yt.optional(),format:E([`json`,`text`,`pretty`]).optional().default(`json`),filterId:r().optional().describe(`Filter function identifier`)}).describe(`Log destination configuration`),xt=h({staticFields:d(r(),u()).optional().describe(`Static fields added to every log`),dynamicEnrichers:C(r()).optional().describe(`Dynamic enricher function IDs`),addHostname:S().optional().default(!0),addProcessId:S().optional().default(!0),addEnvironment:S().optional().default(!0),addTimestampFormats:h({unix:S().optional().default(!1),iso:S().optional().default(!0)}).optional(),addCaller:S().optional().default(!1),addCorrelationIds:S().optional().default(!0)}).describe(`Log enrichment configuration`);h({timestamp:r().datetime().describe(`ISO 8601 timestamp`),level:mt.describe(`Log severity level`),message:r().describe(`Log message`),context:d(r(),u()).optional().describe(`Structured context`),error:h({name:r().optional(),message:r().optional(),stack:r().optional(),code:r().optional(),details:d(r(),u()).optional()}).optional().describe(`Error details`),trace:h({traceId:r().describe(`Trace ID`),spanId:r().describe(`Span ID`),parentSpanId:r().optional().describe(`Parent span ID`),traceFlags:P().int().optional().describe(`Trace flags`)}).optional().describe(`Distributed tracing context`),source:h({service:r().optional().describe(`Service name`),component:r().optional().describe(`Component name`),file:r().optional().describe(`Source file`),line:P().int().optional().describe(`Line number`),function:r().optional().describe(`Function name`)}).optional().describe(`Source information`),host:h({hostname:r().optional(),pid:P().int().optional(),ip:r().optional()}).optional().describe(`Host information`),environment:r().optional().describe(`Environment (e.g., production, staging)`),user:h({id:r().optional(),username:r().optional(),email:r().optional()}).optional().describe(`User context`),request:h({id:r().optional(),method:r().optional(),path:r().optional(),userAgent:r().optional(),ip:r().optional()}).optional().describe(`Request context`),labels:d(r(),r()).optional().describe(`Custom labels`),metadata:d(r(),u()).optional().describe(`Additional metadata`)}).describe(`Structured log entry`),h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),level:mt.optional().default(`info`),default:pt.optional().describe(`Default logger configuration`),loggers:d(r(),pt).optional().describe(`Named logger configurations`),destinations:C(bt).describe(`Log destinations`),enrichment:xt.optional(),redact:C(r()).optional().default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`,`authorization`]).describe(`Fields to redact`),sampling:h({enabled:S().optional().default(!1),rate:P().min(0).max(1).optional().default(1),rateByLevel:d(r(),P().min(0).max(1)).optional()}).optional(),buffer:h({enabled:S().optional().default(!0),size:P().int().positive().optional().default(1e3),flushInterval:P().int().positive().optional().default(1e3),flushOnShutdown:S().optional().default(!0)}).optional(),performance:h({async:S().optional().default(!0),workers:P().int().positive().optional().default(1)}).optional()}).describe(`Logging configuration`);var St=E([`counter`,`gauge`,`histogram`,`summary`]).describe(`Metric type`),Ct=E([`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`),wt=E([`sum`,`avg`,`min`,`max`,`count`,`p50`,`p75`,`p90`,`p95`,`p99`,`p999`,`rate`,`stddev`]).describe(`Metric aggregation type`),Tt=h({type:E([`linear`,`exponential`,`explicit`]).describe(`Bucket type`),linear:h({start:P().describe(`Start value`),width:P().positive().describe(`Bucket width`),count:P().int().positive().describe(`Number of buckets`)}).optional(),exponential:h({start:P().positive().describe(`Start value`),factor:P().positive().describe(`Growth factor`),count:P().int().positive().describe(`Number of buckets`)}).optional(),explicit:h({boundaries:C(P()).describe(`Bucket boundaries`)}).optional()}).describe(`Histogram bucket configuration`),Et=d(r(),r()).describe(`Metric labels`),Dt=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Metric name (snake_case)`),label:r().optional().describe(`Display label`),type:St.describe(`Metric type`),unit:Ct.optional().describe(`Metric unit`),description:r().optional().describe(`Metric description`),labelNames:C(r()).optional().default([]).describe(`Label names`),histogram:Tt.optional(),summary:h({quantiles:C(P().min(0).max(1)).optional().default([.5,.9,.99]),maxAge:P().int().positive().optional().default(600),ageBuckets:P().int().positive().optional().default(5)}).optional(),enabled:S().optional().default(!0)}).describe(`Metric definition`);h({name:r().describe(`Metric name`),type:St.describe(`Metric type`),timestamp:r().datetime().describe(`Observation timestamp`),value:P().optional().describe(`Metric value`),labels:Et.optional().describe(`Metric labels`),histogram:h({count:P().int().nonnegative().describe(`Total count`),sum:P().describe(`Sum of all values`),buckets:C(h({upperBound:P().describe(`Upper bound of bucket`),count:P().int().nonnegative().describe(`Count in bucket`)})).describe(`Histogram buckets`)}).optional(),summary:h({count:P().int().nonnegative().describe(`Total count`),sum:P().describe(`Sum of all values`),quantiles:C(h({quantile:P().min(0).max(1).describe(`Quantile (0-1)`),value:P().describe(`Quantile value`)})).describe(`Summary quantiles`)}).optional()}).describe(`Metric data point`);var Ot=h({timestamp:r().datetime().describe(`Timestamp`),value:P().describe(`Value`),labels:d(r(),r()).optional().describe(`Labels`)}).describe(`Time series data point`);h({name:r().describe(`Series name`),labels:d(r(),r()).optional().describe(`Series labels`),dataPoints:C(Ot).describe(`Data points`),startTime:r().datetime().optional().describe(`Start time`),endTime:r().datetime().optional().describe(`End time`)}).describe(`Time series`);var kt=h({type:wt.describe(`Aggregation type`),window:h({size:P().int().positive().describe(`Window size in seconds`),sliding:S().optional().default(!1),slideInterval:P().int().positive().optional()}).optional(),groupBy:C(r()).optional().describe(`Group by label names`),filters:d(r(),u()).optional().describe(`Filter criteria`)}).describe(`Metric aggregation configuration`),At=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLI name (snake_case)`),label:r().describe(`Display label`),description:r().optional().describe(`SLI description`),metric:r().describe(`Base metric name`),type:E([`availability`,`latency`,`throughput`,`error_rate`,`saturation`,`custom`]).describe(`SLI type`),successCriteria:h({threshold:P().describe(`Threshold value`),operator:E([`lt`,`lte`,`gt`,`gte`,`eq`]).describe(`Comparison operator`),percentile:P().min(0).max(1).optional().describe(`Percentile (0-1)`)}).describe(`Success criteria`),window:h({size:P().int().positive().describe(`Window size in seconds`),rolling:S().optional().default(!0)}).describe(`Measurement window`),enabled:S().optional().default(!0)}).describe(`Service Level Indicator`),jt=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLO name (snake_case)`),label:r().describe(`Display label`),description:r().optional().describe(`SLO description`),sli:r().describe(`SLI name`),target:P().min(0).max(100).describe(`Target percentage`),period:h({type:E([`rolling`,`calendar`]).describe(`Period type`),duration:P().int().positive().optional().describe(`Duration in seconds`),calendar:E([`daily`,`weekly`,`monthly`,`quarterly`,`yearly`]).optional()}).describe(`Time period`),errorBudget:h({enabled:S().optional().default(!0),alertThreshold:P().min(0).max(100).optional().default(80),burnRateWindows:C(h({window:P().int().positive().describe(`Window size`),threshold:P().positive().describe(`Burn rate threshold`)})).optional()}).optional(),alerts:C(h({name:r().describe(`Alert name`),severity:E([`info`,`warning`,`critical`]).describe(`Alert severity`),condition:h({type:E([`slo_breach`,`error_budget`,`burn_rate`]).describe(`Condition type`),threshold:P().optional().describe(`Threshold value`)}).describe(`Alert condition`)})).optional().default([]),enabled:S().optional().default(!0)}).describe(`Service Level Objective`),Mt=h({type:E([`prometheus`,`openmetrics`,`graphite`,`statsd`,`influxdb`,`datadog`,`cloudwatch`,`stackdriver`,`azure_monitor`,`http`,`custom`]).describe(`Export type`),endpoint:r().optional().describe(`Export endpoint`),interval:P().int().positive().optional().default(60),batch:h({enabled:S().optional().default(!0),size:P().int().positive().optional().default(1e3)}).optional(),auth:h({type:E([`none`,`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional()}).optional(),config:d(r(),u()).optional().describe(`Additional configuration`)}).describe(`Metric export configuration`);h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),metrics:C(Dt).optional().default([]),defaultLabels:Et.optional().default({}),aggregations:C(kt).optional().default([]),slis:C(At).optional().default([]),slos:C(jt).optional().default([]),exports:C(Mt).optional().default([]),collectionInterval:P().int().positive().optional().default(15),retention:h({period:P().int().positive().optional().default(604800),downsampling:C(h({afterSeconds:P().int().positive().describe(`Downsample after seconds`),resolution:P().int().positive().describe(`Downsampled resolution`)})).optional()}).optional(),cardinalityLimits:h({maxLabelCombinations:P().int().positive().optional().default(1e4),onLimitExceeded:E([`drop`,`sample`,`alert`]).optional().default(`alert`)}).optional()}).describe(`Metrics configuration`);var Nt=h({entries:d(r(),r()).describe(`Trace state entries`)}).describe(`Trace state`),Pt=P().int().min(0).max(255).describe(`Trace flags bitmap`),Ft=h({traceId:r().regex(/^[0-9a-f]{32}$/).describe(`Trace ID (32 hex chars)`),spanId:r().regex(/^[0-9a-f]{16}$/).describe(`Span ID (16 hex chars)`),traceFlags:Pt.optional().default(1),traceState:Nt.optional(),parentSpanId:r().regex(/^[0-9a-f]{16}$/).optional().describe(`Parent span ID (16 hex chars)`),sampled:S().optional().default(!0),remote:S().optional().default(!1)}).describe(`Trace context (W3C Trace Context)`),It=E([`internal`,`server`,`client`,`producer`,`consumer`]).describe(`Span kind`),Lt=E([`unset`,`ok`,`error`]).describe(`Span status`),Rt=l([r(),P(),S(),C(r()),C(P()),C(S())]).describe(`Span attribute value`),zt=d(r(),Rt).describe(`Span attributes`),Bt=h({name:r().describe(`Event name`),timestamp:r().datetime().describe(`Event timestamp`),attributes:zt.optional().describe(`Event attributes`)}).describe(`Span event`),Vt=h({context:Ft.describe(`Linked trace context`),attributes:zt.optional().describe(`Link attributes`)}).describe(`Span link`);h({context:Ft.describe(`Trace context`),name:r().describe(`Span name`),kind:It.optional().default(`internal`),startTime:r().datetime().describe(`Span start time`),endTime:r().datetime().optional().describe(`Span end time`),duration:P().nonnegative().optional().describe(`Duration in milliseconds`),status:h({code:Lt.describe(`Status code`),message:r().optional().describe(`Status message`)}).optional(),attributes:zt.optional().default({}),events:C(Bt).optional().default([]),links:C(Vt).optional().default([]),resource:zt.optional().describe(`Resource attributes`),instrumentationLibrary:h({name:r().describe(`Library name`),version:r().optional().describe(`Library version`)}).optional()}).describe(`OpenTelemetry span`);var Ht=E([`drop`,`record_only`,`record_and_sample`]).describe(`Sampling decision`),Ut=E([`always_on`,`always_off`,`trace_id_ratio`,`rate_limiting`,`parent_based`,`probability`,`composite`,`custom`]).describe(`Sampling strategy type`),Wt=h({type:Ut.describe(`Sampling strategy`),ratio:P().min(0).max(1).optional().describe(`Sample ratio (0-1)`),rateLimit:P().positive().optional().describe(`Traces per second`),parentBased:h({whenParentSampled:Ut.optional().default(`always_on`),whenParentNotSampled:Ut.optional().default(`always_off`),root:Ut.optional().default(`trace_id_ratio`),rootRatio:P().min(0).max(1).optional().default(.1)}).optional(),composite:C(h({strategy:Ut.describe(`Strategy type`),ratio:P().min(0).max(1).optional(),condition:d(r(),u()).optional().describe(`Condition for this strategy`)})).optional(),rules:C(h({name:r().describe(`Rule name`),match:h({service:r().optional(),spanName:r().optional(),attributes:d(r(),u()).optional()}).optional(),decision:Ht.describe(`Sampling decision`),rate:P().min(0).max(1).optional()})).optional().default([]),customSamplerId:r().optional().describe(`Custom sampler identifier`)}).describe(`Trace sampling configuration`),Gt=h({formats:C(E([`w3c`,`b3`,`b3_multi`,`jaeger`,`xray`,`ottrace`,`custom`]).describe(`Trace propagation format`)).optional().default([`w3c`]),extract:S().optional().default(!0),inject:S().optional().default(!0),headers:h({traceId:r().optional(),spanId:r().optional(),traceFlags:r().optional(),traceState:r().optional()}).optional(),baggage:h({enabled:S().optional().default(!0),maxSize:P().int().positive().optional().default(8192),allowedKeys:C(r()).optional()}).optional()}).describe(`Trace context propagation`),Kt=E([`otlp_http`,`otlp_grpc`,`jaeger`,`zipkin`,`console`,`datadog`,`honeycomb`,`lightstep`,`newrelic`,`custom`]).describe(`OpenTelemetry exporter type`),qt=h({sdkVersion:r().optional().describe(`OTel SDK version`),exporter:h({type:Kt.describe(`Exporter type`),endpoint:r().url().optional().describe(`Exporter endpoint`),protocol:r().optional().describe(`Protocol version`),headers:d(r(),r()).optional().describe(`HTTP headers`),timeout:P().int().positive().optional().default(1e4),compression:E([`none`,`gzip`]).optional().default(`none`),batch:h({maxBatchSize:P().int().positive().optional().default(512),maxQueueSize:P().int().positive().optional().default(2048),exportTimeout:P().int().positive().optional().default(3e4),scheduledDelay:P().int().positive().optional().default(5e3)}).optional()}).describe(`Exporter configuration`),resource:h({serviceName:r().describe(`Service name`),serviceVersion:r().optional().describe(`Service version`),serviceInstanceId:r().optional().describe(`Service instance ID`),serviceNamespace:r().optional().describe(`Service namespace`),deploymentEnvironment:r().optional().describe(`Deployment environment`),attributes:zt.optional().describe(`Additional resource attributes`)}).describe(`Resource attributes`),instrumentation:h({autoInstrumentation:S().optional().default(!0),libraries:C(r()).optional().describe(`Enabled libraries`),disabledLibraries:C(r()).optional().describe(`Disabled libraries`)}).optional(),semanticConventionsVersion:r().optional().describe(`Semantic conventions version`)}).describe(`OpenTelemetry compatibility configuration`);h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),sampling:Wt.optional().default({type:`always_on`,rules:[]}),propagation:Gt.optional().default({formats:[`w3c`],extract:!0,inject:!0}),openTelemetry:qt.optional(),spanLimits:h({maxAttributes:P().int().positive().optional().default(128),maxEvents:P().int().positive().optional().default(128),maxLinks:P().int().positive().optional().default(128),maxAttributeValueLength:P().int().positive().optional().default(4096)}).optional(),traceIdGenerator:E([`random`,`uuid`,`custom`]).optional().default(`random`),customTraceIdGeneratorId:r().optional().describe(`Custom generator identifier`),performance:h({asyncExport:S().optional().default(!0),exportInterval:P().int().positive().optional().default(5e3)}).optional()}).describe(`Tracing configuration`);var Jt=E([`pii`,`phi`,`pci`,`financial`,`confidential`,`internal`,`public`]).describe(`Data classification level`),Yt=E([`gdpr`,`hipaa`,`sox`,`pci_dss`,`ccpa`,`iso27001`]).describe(`Compliance framework identifier`),tee=h({framework:Yt.describe(`Compliance framework identifier`),requiredEvents:C(r()).describe(`Audit event types required by this framework (e.g., "data.delete", "auth.login")`),retentionDays:P().min(1).describe(`Minimum audit log retention period required by this framework (in days)`),alertOnMissing:S().default(!0).describe(`Raise alert if a required audit event is not being captured`)}).describe(`Compliance framework audit event requirements`),Xt=h({framework:Yt.describe(`Compliance framework identifier`),dataClassifications:C(Jt).describe(`Data classifications that must be encrypted under this framework`),minimumAlgorithm:E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).default(`aes-256-gcm`).describe(`Minimum encryption algorithm strength required`),keyRotationMaxDays:P().min(1).default(90).describe(`Maximum key rotation interval required (in days)`)}).describe(`Compliance framework encryption requirements`),Zt=h({dataClassification:Jt.describe(`Data classification this rule applies to`),defaultMasked:S().default(!0).describe(`Whether data is masked by default`),unmaskRoles:C(r()).optional().describe(`Roles allowed to view unmasked data`),auditUnmask:S().default(!0).describe(`Log an audit event when data is unmasked`),requireApproval:S().default(!1).describe(`Require explicit approval before unmasking`),approvalRoles:C(r()).optional().describe(`Roles that can approve unmasking requests`)}).describe(`Masking visibility and audit rule per data classification`),Qt=h({enabled:S().default(!0).describe(`Enable cross-subsystem security event correlation`),correlationId:S().default(!0).describe(`Inject a shared correlation ID into audit, encryption, and masking events`),linkAuthToAudit:S().default(!0).describe(`Link authentication events to subsequent data operation audit trails`),linkEncryptionToAudit:S().default(!0).describe(`Log encryption/decryption operations in the audit trail`),linkMaskingToAudit:S().default(!0).describe(`Log masking/unmasking operations in the audit trail`)}).describe(`Cross-subsystem security event correlation configuration`),$t=h({classification:Jt.describe(`Data classification level`),requireEncryption:S().default(!1).describe(`Encryption required for this classification`),requireMasking:S().default(!1).describe(`Masking required for this classification`),requireAudit:S().default(!1).describe(`Audit trail required for access to this classification`),retentionDays:P().optional().describe(`Data retention limit in days (for compliance)`)}).describe(`Security policy for a specific data classification level`);h({enabled:S().default(!0).describe(`Enable unified security context governance`),complianceAuditRequirements:C(tee).optional().describe(`Compliance-driven audit event requirements`),complianceEncryptionRequirements:C(Xt).optional().describe(`Compliance-driven encryption requirements by data classification`),maskingVisibility:C(Zt).optional().describe(`Masking visibility rules per data classification`),dataClassifications:C($t).optional().describe(`Data classification policies for unified security enforcement`),eventCorrelation:Qt.optional().describe(`Cross-subsystem security event correlation settings`),enforceOnWrite:S().default(!0).describe(`Enforce encryption and masking requirements on data write operations`),enforceOnRead:S().default(!0).describe(`Enforce masking and audit requirements on data read operations`),failOpen:S().default(!1).describe(`When false (default), deny access if security context cannot be evaluated`)}).describe(`Unified security context governance configuration`);var en=E([`standard`,`normal`,`emergency`,`major`]),tn=E([`critical`,`high`,`medium`,`low`]),nn=E([`draft`,`submitted`,`in-review`,`approved`,`scheduled`,`in-progress`,`completed`,`failed`,`rolled-back`,`cancelled`]),rn=h({level:E([`low`,`medium`,`high`,`critical`]).describe(`Impact level`),affectedSystems:C(r()).describe(`Affected systems`),affectedUsers:P().optional().describe(`Affected user count`),downtime:h({required:S().describe(`Downtime required`),durationMinutes:P().optional().describe(`Downtime duration`)}).optional().describe(`Downtime information`)}),an=h({description:r().describe(`Rollback description`),steps:C(h({order:P().describe(`Step order`),description:r().describe(`Step description`),estimatedMinutes:P().describe(`Estimated duration`)})).describe(`Rollback steps`),testProcedure:r().optional().describe(`Test procedure`)});h({id:r().describe(`Change request ID`),title:r().describe(`Change title`),description:r().describe(`Change description`),type:en.describe(`Change type`),priority:tn.describe(`Change priority`),status:nn.describe(`Change status`),requestedBy:r().describe(`Requester user ID`),requestedAt:P().describe(`Request timestamp`),impact:rn.describe(`Impact assessment`),implementation:h({description:r().describe(`Implementation description`),steps:C(h({order:P().describe(`Step order`),description:r().describe(`Step description`),estimatedMinutes:P().describe(`Estimated duration`)})).describe(`Implementation steps`),testing:r().optional().describe(`Testing procedure`)}).describe(`Implementation plan`),rollbackPlan:an.describe(`Rollback plan`),schedule:h({plannedStart:P().describe(`Planned start time`),plannedEnd:P().describe(`Planned end time`),actualStart:P().optional().describe(`Actual start time`),actualEnd:P().optional().describe(`Actual end time`)}).optional().describe(`Schedule`),securityImpact:h({assessed:S().describe(`Whether security impact has been assessed`),riskLevel:E([`none`,`low`,`medium`,`high`,`critical`]).optional().describe(`Security risk level`),affectedDataClassifications:C(Jt).optional().describe(`Affected data classifications`),requiresSecurityApproval:S().default(!1).describe(`Whether security team approval is required`),reviewedBy:r().optional().describe(`Security reviewer user ID`),reviewedAt:P().optional().describe(`Security review timestamp`),reviewNotes:r().optional().describe(`Security review notes or conditions`)}).optional().describe(`Security impact assessment per ISO 27001:2022 A.8.32`),approval:h({required:S().describe(`Approval required`),approvers:C(h({userId:r().describe(`Approver user ID`),approvedAt:P().optional().describe(`Approval timestamp`),comments:r().optional().describe(`Approver comments`)})).describe(`Approvers`)}).optional().describe(`Approval workflow`),attachments:C(h({name:r().describe(`Attachment name`),url:r().url().describe(`Attachment URL`)})).optional().describe(`Attachments`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs for extensibility`)});var on=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),sn=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),cn=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),ln=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:on.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:sn.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:cn.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:ln.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var un=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),dn=h({field:r().describe(`Field name to apply masking to`),strategy:un.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(dn).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var fn=E(`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(`.`)),pn=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:Me.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var mn=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var hn=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),gn=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),_n=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),vn=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),yn=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:fn.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(pn).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:mn.optional().describe(`Configuration for currency field type`),vectorConfig:hn.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:gn.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:ln.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:dn.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:vn.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:_n.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),bn=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label for the rule listing`),description:r().optional().describe(`Administrative notes explaining the business reason`),active:S().default(!0),events:C(E([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:P().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:C(r()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:E([`error`,`warning`,`info`]).default(`error`),message:r().describe(`Error message to display to the user`)}),xn=bn.extend({type:m(`script`),condition:r().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),nee=bn.extend({type:m(`unique`),fields:C(r()).describe(`Fields that must be combined unique`),scope:r().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:S().default(!0)}),Sn=bn.extend({type:m(`state_machine`),field:r().describe(`State field (e.g. status)`),transitions:d(r(),C(r())).describe(`Map of { OldState: [AllowedNewStates] }`)}),Cn=bn.extend({type:m(`format`),field:r(),regex:r().optional(),format:E([`email`,`url`,`phone`,`json`]).optional()}),wn=bn.extend({type:m(`cross_field`),condition:r().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:C(r()).describe(`Fields involved in the validation`)}),Tn=bn.extend({type:m(`json_schema`),field:r().describe(`JSON field to validate`),schema:d(r(),u()).describe(`JSON Schema object definition`)}),En=bn.extend({type:m(`async`),field:r().describe(`Field to validate`),validatorUrl:r().optional().describe(`External API endpoint for validation`),method:E([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:d(r(),r()).optional().describe(`Custom headers for the request`),validatorFunction:r().optional().describe(`Reference to custom validator function`),timeout:P().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:P().optional().describe(`Debounce delay in milliseconds`),params:d(r(),u()).optional().describe(`Additional parameters to pass to validator`)}),Dn=bn.extend({type:m(`custom`),handler:r().describe(`Name of the custom validation function registered in the system`),params:d(r(),u()).optional().describe(`Parameters passed to the custom handler`)}),On=F(()=>I(`type`,[xn,nee,Sn,Cn,wn,Tn,En,Dn,kn])),kn=bn.extend({type:m(`conditional`),when:r().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:On.describe(`Validation rule to apply when condition is true`),otherwise:On.optional().describe(`Validation rule to apply when condition is false`)}),An=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),jn=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),Mn=h({target:r().optional().describe(`Target State ID`),cond:jn.optional().describe(`Condition (Guard) required to take this path`),actions:C(An).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)});h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)});var Nn=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(An).optional().describe(`Actions to run when entering this state`),exit:C(An).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),Mn,C(Mn)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(Mn).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),Nn).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),Pn=h({id:Ne.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),Nn).describe(`State Nodes`),on:d(r(),l([r(),Mn,C(Mn)])).optional()});h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var Fn=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),In=h({ariaLabel:Fn.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var Ln=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),Rn=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:Ln.optional().describe(`Default number formatting rules`),dateFormat:Rn.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var ree=h({name:r(),label:Fn,type:fn,required:S().default(!1),options:C(h({label:Fn,value:r()})).optional()}),zn=E([`script`,`url`,`modal`,`flow`,`api`]),iee=new Set(zn.options.filter(e=>e!==`script`)),aee=h({name:Ne.describe(`Machine name (lowercase snake_case)`),label:Fn.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:zn.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(ree).optional().describe(`Input parameters required from user`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:Fn.optional().describe(`Confirmation message before execution`),successMessage:Fn.optional().describe(`Success message to show after execution`),refreshAfter:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:In.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(iee.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),oee=E([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),Bn=h({trackHistory:S().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:S().default(!0).describe(`Index records for global search`),apiEnabled:S().default(!0).describe(`Expose object via automatic APIs`),apiMethods:C(oee).optional().describe(`Whitelist of allowed API operations`),files:S().default(!1).describe(`Enable file attachments and document management`),feeds:S().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:S().default(!1).describe(`Enable standard tasks and events tracking`),trash:S().default(!0).describe(`Enable soft-delete with restore capability`),mru:S().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:S().default(!0).describe(`Allow record deep cloning`)}),Vn=h({name:r().optional().describe(`Index name (auto-generated if not provided)`),fields:C(r()).describe(`Fields included in the index`),type:E([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:S().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:r().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),Hn=h({fields:C(r()).describe(`Fields to index for full-text search weighting`),displayFields:C(r()).optional().describe(`Fields to display in search result cards`),filters:C(r()).optional().describe(`Default filters for search results`)}),Un=h({enabled:S().describe(`Enable multi-tenancy for this object`),strategy:E([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:r().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:S().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),Wn=h({enabled:S().describe(`Enable soft delete (trash/recycle bin)`),field:r().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:S().default(!1).describe(`Cascade soft delete to related records`)}),Gn=h({enabled:S().describe(`Enable record versioning`),strategy:E([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:P().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:r().default(`version`).describe(`Field name for version number/timestamp`)}),Kn=h({enabled:S().describe(`Enable table partitioning`),strategy:E([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:r().describe(`Field name to partition by`),interval:r().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"`}),qn=h({enabled:S().describe(`Enable Change Data Capture`),events:C(E([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:r().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),Jn=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:r().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:r().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:r().optional().describe(`Developer documentation / description`),icon:r().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:r().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:C(r()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:S().optional().default(!0).describe(`Is the object active and usable`),isSystem:S().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:S().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:r().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:r().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:d(r().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),yn).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:C(Vn).optional().describe(`Database performance indexes`),tenancy:Un.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:Wn.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:Gn.optional().describe(`Record versioning and history tracking configuration`),partitioning:Kn.optional().describe(`Table partitioning configuration for performance`),cdc:qn.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:C(On).optional().describe(`Object-level validation rules`),stateMachines:d(r(),Pn).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:r().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:h({type:E([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:r().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:P().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:r().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:C(r()).optional().describe(`Primary fields for hover/cards/lookups`),search:Hn.optional().describe(`Search engine configuration`),enable:Bn.optional().describe(`Enabled system features modules`),recordTypes:C(r()).optional().describe(`Record type names for this object`),sharingModel:E([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:r().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:C(aee).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function Yn(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var Xn=Object.assign(Jn,{create:e=>{let t={...e,label:e.label??Yn(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return Jn.parse(t)}});E([`own`,`extend`]),h({extend:r().describe(`Target object name (FQN) to extend`),fields:d(r(),yn).optional().describe(`Fields to add/override`),label:r().optional().describe(`Override label for the extended object`),pluralLabel:r().optional().describe(`Override plural label for the extended object`),description:r().optional().describe(`Override description for the extended object`),validations:C(On).optional().describe(`Additional validation rules to merge into the target object`),indexes:C(Vn).optional().describe(`Additional indexes to merge into the target object`),priority:P().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)});var Zn=I(`type`,[h({type:m(`add_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to add`),field:yn.describe(`Full field definition to add`)}).describe(`Add a new field to an existing object`),h({type:m(`modify_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to modify`),changes:d(r(),u()).describe(`Partial field definition updates`)}).describe(`Modify properties of an existing field`),h({type:m(`remove_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to remove`)}).describe(`Remove a field from an existing object`),h({type:m(`create_object`),object:Xn.describe(`Full object definition to create`)}).describe(`Create a new object`),h({type:m(`rename_object`),oldName:r().describe(`Current object name`),newName:r().describe(`New object name`)}).describe(`Rename an existing object`),h({type:m(`delete_object`),objectName:r().describe(`Name of the object to delete`)}).describe(`Delete an existing object`),h({type:m(`execute_sql`),sql:r().describe(`Raw SQL statement to execute`),description:r().optional().describe(`Human-readable description of the SQL`)}).describe(`Execute a raw SQL statement`)]),Qn=h({migrationId:r().describe(`ID of the migration this depends on`),package:r().optional().describe(`Package that owns the dependency migration`)}).describe(`Dependency reference to another migration that must run first`);h({id:r().uuid().describe(`Unique identifier for this change set`),name:r().describe(`Human readable name for the migration`),description:r().optional().describe(`Detailed description of what this migration does`),author:r().optional().describe(`Author who created this migration`),createdAt:r().datetime().optional().describe(`ISO 8601 timestamp when the migration was created`),dependencies:C(Qn).optional().describe(`Migrations that must run before this one`),operations:C(Zn).describe(`Ordered list of atomic migration operations`),rollback:C(Zn).optional().describe(`Operations to reverse this migration`)}).describe(`A versioned set of atomic schema migration operations`);var $n=h({id:r().describe(`Provider ID (github, google)`),clientId:r().describe(`OAuth Client ID`),clientSecret:r().describe(`OAuth Client Secret`),scope:C(r()).optional().describe(`Requested permissions`)}),er=h({organization:S().default(!1).describe(`Enable Organization/Teams support`),twoFactor:S().default(!1).describe(`Enable 2FA`),passkeys:S().default(!1).describe(`Enable Passkey support`),magicLink:S().default(!1).describe(`Enable Magic Link login`)}),tr=h({enabled:S().default(!1).describe(`Enable mutual TLS authentication`),clientCertRequired:S().default(!1).describe(`Require client certificates for all connections`),trustedCAs:C(r()).describe(`PEM-encoded CA certificates or file paths`),crlUrl:r().optional().describe(`Certificate Revocation List (CRL) URL`),ocspUrl:r().optional().describe(`Online Certificate Status Protocol (OCSP) URL`),certificateValidation:E([`strict`,`relaxed`,`none`]).describe(`Certificate validation strictness level`),allowedCNs:C(r()).optional().describe(`Allowed Common Names (CN) on client certificates`),allowedOUs:C(r()).optional().describe(`Allowed Organizational Units (OU) on client certificates`),pinning:h({enabled:S().describe(`Enable certificate pinning`),pins:C(r()).describe(`Pinned certificate hashes`)}).optional().describe(`Certificate pinning configuration`)}),nr=d(r(),h({clientId:r().describe(`OAuth Client ID`),clientSecret:r().describe(`OAuth Client Secret`),enabled:S().optional().default(!0).describe(`Enable this provider`),scope:C(r()).optional().describe(`Additional OAuth scopes`)}).catchall(u())).optional().describe(`Social/OAuth provider map forwarded to better-auth socialProviders. Keys are provider ids (google, github, apple, …).`),rr=h({enabled:S().default(!0).describe(`Enable email/password auth`),disableSignUp:S().optional().describe(`Disable new user registration via email/password`),requireEmailVerification:S().optional().describe(`Require email verification before creating a session`),minPasswordLength:P().optional().describe(`Minimum password length (default 8)`),maxPasswordLength:P().optional().describe(`Maximum password length (default 128)`),resetPasswordTokenExpiresIn:P().optional().describe(`Reset-password token TTL in seconds (default 3600)`),autoSignIn:S().optional().describe(`Auto sign-in after sign-up (default true)`),revokeSessionsOnPasswordReset:S().optional().describe(`Revoke all other sessions on password reset`)}).optional().describe(`Email and password authentication options forwarded to better-auth`),ir=h({sendOnSignUp:S().optional().describe(`Automatically send verification email after sign-up`),sendOnSignIn:S().optional().describe(`Send verification email on sign-in when not yet verified`),autoSignInAfterVerification:S().optional().describe(`Auto sign-in the user after email verification`),expiresIn:P().optional().describe(`Verification token TTL in seconds (default 3600)`)}).optional().describe(`Email verification options forwarded to better-auth`),ar=h({crossSubDomainCookies:h({enabled:S().describe(`Enable cross-subdomain cookies`),additionalCookies:C(r()).optional().describe(`Extra cookies shared across subdomains`),domain:r().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:S().optional().describe(`Force Secure flag on cookies`),disableCSRFCheck:S().optional().describe(`⚠ Disable CSRF check — security risk, use with caution`),cookiePrefix:r().optional().describe(`Prefix for auth cookie names`)}).optional().describe(`Advanced / low-level Better-Auth options`);h({secret:r().optional().describe(`Encryption secret`),baseUrl:r().optional().describe(`Base URL for auth routes`),databaseUrl:r().optional().describe(`Database connection string`),providers:C($n).optional(),plugins:er.optional(),session:h({expiresIn:P().default(3600*24*7).describe(`Session duration in seconds`),updateAge:P().default(3600*24).describe(`Session update frequency`)}).optional(),trustedOrigins:C(r()).optional().describe(`Trusted origins for CSRF protection. Supports wildcards (e.g. "https://*.example.com"). The baseUrl origin is always trusted implicitly.`),socialProviders:nr,emailAndPassword:rr,emailVerification:ir,advanced:ar,mutualTls:tr.optional().describe(`Mutual TLS (mTLS) configuration`)}).catchall(u());var or=h({enabled:S().describe(`Enable GDPR compliance controls`),dataSubjectRights:h({rightToAccess:S().default(!0).describe(`Allow data subjects to access their data`),rightToRectification:S().default(!0).describe(`Allow data subjects to correct their data`),rightToErasure:S().default(!0).describe(`Allow data subjects to request deletion`),rightToRestriction:S().default(!0).describe(`Allow data subjects to restrict processing`),rightToPortability:S().default(!0).describe(`Allow data subjects to export their data`),rightToObjection:S().default(!0).describe(`Allow data subjects to object to processing`)}).describe(`Data subject rights configuration per GDPR Articles 15-21`),legalBasis:E([`consent`,`contract`,`legal-obligation`,`vital-interests`,`public-task`,`legitimate-interests`]).describe(`Legal basis for data processing under GDPR Article 6`),consentTracking:S().default(!0).describe(`Track and record user consent`),dataRetentionDays:P().optional().describe(`Maximum data retention period in days`),dataProcessingAgreement:r().optional().describe(`URL or reference to the data processing agreement`)}).describe(`GDPR (General Data Protection Regulation) compliance configuration`),sr=h({enabled:S().describe(`Enable HIPAA compliance controls`),phi:h({encryption:S().default(!0).describe(`Encrypt Protected Health Information at rest`),accessControl:S().default(!0).describe(`Enforce role-based access to PHI`),auditTrail:S().default(!0).describe(`Log all PHI access events`),backupAndRecovery:S().default(!0).describe(`Enable PHI backup and disaster recovery`)}).describe(`Protected Health Information safeguards`),businessAssociateAgreement:S().default(!1).describe(`BAA is in place with third-party processors`)}).describe(`HIPAA (Health Insurance Portability and Accountability Act) compliance configuration`),cr=h({enabled:S().describe(`Enable PCI-DSS compliance controls`),level:E([`1`,`2`,`3`,`4`]).describe(`PCI-DSS compliance level (1 = highest)`),cardDataFields:C(r()).describe(`Field names containing cardholder data`),tokenization:S().default(!0).describe(`Replace card data with secure tokens`),encryptionInTransit:S().default(!0).describe(`Encrypt cardholder data during transmission`),encryptionAtRest:S().default(!0).describe(`Encrypt stored cardholder data`)}).describe(`PCI-DSS (Payment Card Industry Data Security Standard) compliance configuration`),lr=h({enabled:S().default(!0).describe(`Enable audit logging`),retentionDays:P().default(365).describe(`Number of days to retain audit logs`),immutable:S().default(!0).describe(`Prevent modification or deletion of audit logs`),signLogs:S().default(!1).describe(`Cryptographically sign log entries for tamper detection`),events:C(E([`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`),ur=E([`critical`,`major`,`minor`,`observation`]),see=E([`open`,`in_remediation`,`remediated`,`verified`,`accepted_risk`,`closed`]),cee=h({id:r().describe(`Unique finding identifier`),title:r().describe(`Finding title`),description:r().describe(`Finding description`),severity:ur.describe(`Finding severity`),status:see.describe(`Finding status`),controlReference:r().optional().describe(`ISO 27001 control reference`),framework:Yt.optional().describe(`Related compliance framework`),identifiedAt:P().describe(`Identification timestamp`),identifiedBy:r().describe(`Identifier (auditor name or system)`),remediationPlan:r().optional().describe(`Remediation plan`),remediationDeadline:P().optional().describe(`Remediation deadline timestamp`),verifiedAt:P().optional().describe(`Verification timestamp`),verifiedBy:r().optional().describe(`Verifier name or role`),notes:r().optional().describe(`Additional notes`)}).describe(`Audit finding with remediation tracking per ISO 27001:2022 A.5.35`),lee=h({id:r().describe(`Unique audit schedule identifier`),title:r().describe(`Audit title`),scope:C(r()).describe(`Audit scope areas`),framework:Yt.describe(`Target compliance framework`),scheduledAt:P().describe(`Scheduled audit timestamp`),completedAt:P().optional().describe(`Completion timestamp`),assessor:r().describe(`Assessor or audit team`),isExternal:S().default(!1).describe(`Whether this is an external audit`),recurrenceMonths:P().default(0).describe(`Recurrence interval in months (0 = one-time)`),findings:C(cee).optional().describe(`Audit findings`)}).describe(`Audit schedule for independent security reviews per ISO 27001:2022 A.5.35`);h({gdpr:or.optional().describe(`GDPR compliance settings`),hipaa:sr.optional().describe(`HIPAA compliance settings`),pciDss:cr.optional().describe(`PCI-DSS compliance settings`),auditLog:lr.describe(`Audit log configuration`),auditSchedules:C(lee).optional().describe(`Scheduled compliance audits (A.5.35)`)}).describe(`Unified compliance configuration spanning GDPR, HIPAA, PCI-DSS, and audit governance`);var dr=E([`critical`,`high`,`medium`,`low`]),uee=E([`data_breach`,`malware`,`unauthorized_access`,`denial_of_service`,`social_engineering`,`insider_threat`,`physical_security`,`configuration_error`,`vulnerability_exploit`,`policy_violation`,`other`]),fr=E([`reported`,`triaged`,`investigating`,`containing`,`eradicating`,`recovering`,`resolved`,`closed`]),pr=h({phase:E([`identification`,`containment`,`eradication`,`recovery`,`lessons_learned`]).describe(`Response phase name`),description:r().describe(`Phase description and objectives`),assignedTo:r().describe(`Responsible team or role`),targetHours:P().min(0).describe(`Target completion time in hours`),completedAt:P().optional().describe(`Actual completion timestamp`),notes:r().optional().describe(`Phase notes and findings`)}).describe(`Incident response phase with timing and assignment`),mr=h({rules:C(h({severity:dr.describe(`Minimum severity to trigger notification`),channels:C(E([`email`,`sms`,`slack`,`pagerduty`,`webhook`])).describe(`Notification channels`),recipients:C(r()).describe(`Roles or teams to notify`),withinMinutes:P().min(1).describe(`Notification deadline in minutes from detection`),notifyRegulators:S().default(!1).describe(`Whether to notify regulatory authorities`),regulatorDeadlineHours:P().optional().describe(`Regulatory notification deadline in hours`)}).describe(`Incident notification rule per severity level`)).describe(`Notification rules by severity level`),escalationTimeoutMinutes:P().default(30).describe(`Auto-escalation timeout in minutes`),escalationChain:C(r()).default([]).describe(`Ordered escalation chain of roles`)}).describe(`Incident notification matrix with escalation policies`);h({id:r().describe(`Unique incident identifier`),title:r().describe(`Incident title`),description:r().describe(`Detailed incident description`),severity:dr.describe(`Incident severity level`),category:uee.describe(`Incident category`),status:fr.describe(`Current incident status`),reportedBy:r().describe(`Reporter user ID or system name`),reportedAt:P().describe(`Report timestamp`),detectedAt:P().optional().describe(`Detection timestamp`),resolvedAt:P().optional().describe(`Resolution timestamp`),affectedSystems:C(r()).describe(`Affected systems`),affectedDataClassifications:C(Jt).optional().describe(`Affected data classifications`),responsePhases:C(pr).optional().describe(`Incident response phases`),rootCause:r().optional().describe(`Root cause analysis`),correctiveActions:C(r()).optional().describe(`Corrective actions taken or planned`),lessonsLearned:r().optional().describe(`Lessons learned from the incident`),relatedChangeRequestIds:C(r()).optional().describe(`Related change request IDs`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Security incident record per ISO 27001:2022 A.5.24–A.5.28`),h({enabled:S().default(!0).describe(`Enable incident response management`),notificationMatrix:mr.describe(`Notification and escalation matrix`),defaultResponseTeam:r().describe(`Default incident response team or role`),triageDeadlineHours:P().default(1).describe(`Maximum hours to begin triage after detection`),requirePostIncidentReview:S().default(!0).describe(`Require post-incident review for all incidents`),regulatoryNotificationThreshold:dr.default(`high`).describe(`Minimum severity requiring regulatory notification`),retentionDays:P().default(2555).describe(`Incident record retention period in days (default ~7 years)`)}).describe(`Organization-level incident response policy per ISO 27001:2022`);var hr=E([`critical`,`high`,`medium`,`low`]),gr=E([`pending`,`in_progress`,`completed`,`expired`,`failed`]),_r=h({id:r().describe(`Requirement identifier`),description:r().describe(`Requirement description`),controlReference:r().optional().describe(`ISO 27001 control reference`),mandatory:S().default(!0).describe(`Whether this requirement is mandatory`),compliant:S().optional().describe(`Whether the supplier meets this requirement`),evidence:r().optional().describe(`Compliance evidence or assessment notes`)}).describe(`Individual supplier security requirement`);h({supplierId:r().describe(`Unique supplier identifier`),supplierName:r().describe(`Supplier display name`),riskLevel:hr.describe(`Supplier risk classification`),status:gr.describe(`Assessment status`),assessedBy:r().describe(`Assessor user ID or team`),assessedAt:P().describe(`Assessment timestamp`),validUntil:P().describe(`Assessment validity expiry timestamp`),requirements:C(_r).describe(`Security requirements and their compliance status`),overallCompliant:S().describe(`Whether supplier meets all mandatory requirements`),dataClassificationsShared:C(Jt).optional().describe(`Data classifications shared with supplier`),servicesProvided:C(r()).optional().describe(`Services provided by this supplier`),certifications:C(r()).optional().describe(`Supplier certifications (e.g., ISO 27001, SOC 2)`),remediationItems:C(h({requirementId:r().describe(`Non-compliant requirement ID`),action:r().describe(`Required remediation action`),deadline:P().describe(`Remediation deadline timestamp`),status:E([`pending`,`in_progress`,`completed`]).default(`pending`).describe(`Remediation status`)})).optional().describe(`Remediation items for non-compliant requirements`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Supplier security assessment record per ISO 27001:2022 A.5.19–A.5.21`),h({enabled:S().default(!0).describe(`Enable supplier security management`),reassessmentIntervalDays:P().default(365).describe(`Supplier reassessment interval in days`),requirePreOnboardingAssessment:S().default(!0).describe(`Require security assessment before supplier onboarding`),formalAssessmentThreshold:hr.default(`medium`).describe(`Minimum risk level requiring formal assessment`),monitorChanges:S().default(!0).describe(`Monitor supplier security posture changes`),requiredCertifications:C(r()).default([]).describe(`Required certifications for critical-risk suppliers`)}).describe(`Organization-level supplier security management policy per ISO 27001:2022`);var vr=E([`security_awareness`,`data_protection`,`incident_response`,`access_control`,`phishing_awareness`,`compliance`,`secure_development`,`physical_security`,`business_continuity`,`other`]),yr=E([`not_started`,`in_progress`,`completed`,`failed`,`expired`]),br=h({id:r().describe(`Unique course identifier`),title:r().describe(`Course title`),description:r().describe(`Course description and learning objectives`),category:vr.describe(`Training category`),durationMinutes:P().min(1).describe(`Estimated course duration in minutes`),mandatory:S().default(!1).describe(`Whether training is mandatory`),targetRoles:C(r()).describe(`Target roles or groups`),validityDays:P().optional().describe(`Certification validity period in days`),passingScore:P().min(0).max(100).optional().describe(`Minimum passing score percentage`),version:r().optional().describe(`Course content version`)}).describe(`Security training course definition`);h({courseId:r().describe(`Training course identifier`),userId:r().describe(`User identifier`),status:yr.describe(`Training completion status`),assignedAt:P().describe(`Assignment timestamp`),completedAt:P().optional().describe(`Completion timestamp`),score:P().min(0).max(100).optional().describe(`Assessment score percentage`),expiresAt:P().optional().describe(`Certification expiry timestamp`),notes:r().optional().describe(`Training notes or comments`)}).describe(`Individual training completion record`),h({enabled:S().default(!0).describe(`Enable training management`),courses:C(br).describe(`Training courses`),recertificationIntervalDays:P().default(365).describe(`Default recertification interval in days`),trackCompletion:S().default(!0).describe(`Track training completion for compliance`),gracePeriodDays:P().default(30).describe(`Grace period in days after certification expiry`),sendReminders:S().default(!0).describe(`Send reminders for upcoming training deadlines`),reminderDaysBefore:P().default(14).describe(`Days before deadline to send first reminder`)}).describe(`Organizational training plan per ISO 27001:2022 A.6.3`);var xr=I(`type`,[h({type:m(`cron`),expression:r().describe(`Cron expression (e.g., "0 0 * * *" for daily at midnight)`),timezone:r().optional().default(`UTC`).describe(`Timezone for cron execution (e.g., "America/New_York")`)}),h({type:m(`interval`),intervalMs:P().int().positive().describe(`Interval in milliseconds`)}),h({type:m(`once`),at:r().datetime().describe(`ISO 8601 datetime when to execute`)})]),Sr=h({maxRetries:P().int().min(0).default(3).describe(`Maximum number of retry attempts`),backoffMs:P().int().positive().default(1e3).describe(`Initial backoff delay in milliseconds`),backoffMultiplier:P().positive().default(2).describe(`Multiplier for exponential backoff`)});h({id:r().describe(`Unique job identifier`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Job name (snake_case)`),schedule:xr.describe(`Job schedule configuration`),handler:r().describe(`Handler path (e.g. "path/to/file:functionName") or script ID`),retryPolicy:Sr.optional().describe(`Retry policy configuration`),timeout:P().int().positive().optional().describe(`Timeout in milliseconds`),enabled:S().default(!0).describe(`Whether the job is enabled`)});var Cr=E([`running`,`success`,`failed`,`timeout`]);h({jobId:r().describe(`Job identifier`),startedAt:r().datetime().describe(`ISO 8601 datetime when execution started`),completedAt:r().datetime().optional().describe(`ISO 8601 datetime when execution completed`),status:Cr.describe(`Execution status`),error:r().optional().describe(`Error message if failed`),duration:P().int().optional().describe(`Execution duration in milliseconds`)});var wr=E([`critical`,`high`,`normal`,`low`,`background`]),Tr=E([`pending`,`queued`,`processing`,`completed`,`failed`,`cancelled`,`timeout`,`dead`]),Er=h({maxRetries:P().int().min(0).default(3).describe(`Maximum retry attempts`),backoffStrategy:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy between retries`),initialDelayMs:P().int().positive().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().int().positive().default(6e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:P().positive().default(2).describe(`Multiplier for exponential backoff`)}),Dr=h({id:r().describe(`Unique task identifier`),type:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),payload:u().describe(`Task payload data`),queue:r().default(`default`).describe(`Queue name`),priority:wr.default(`normal`).describe(`Task priority level`),retryPolicy:Er.optional().describe(`Retry policy configuration`),timeoutMs:P().int().positive().optional().describe(`Task timeout in milliseconds`),scheduledAt:r().datetime().optional().describe(`ISO 8601 datetime to execute task`),attempts:P().int().min(0).default(0).describe(`Number of execution attempts`),status:Tr.default(`pending`).describe(`Current task status`),metadata:h({createdAt:r().datetime().optional().describe(`When task was created`),updatedAt:r().datetime().optional().describe(`Last update time`),createdBy:r().optional().describe(`User who created task`),tags:C(r()).optional().describe(`Task tags for filtering`)}).optional().describe(`Task metadata`)});h({taskId:r().describe(`Task identifier`),status:Tr.describe(`Execution status`),result:u().optional().describe(`Execution result data`),error:h({message:r().describe(`Error message`),stack:r().optional().describe(`Error stack trace`),code:r().optional().describe(`Error code`)}).optional().describe(`Error details if failed`),durationMs:P().int().optional().describe(`Execution duration in milliseconds`),startedAt:r().datetime().describe(`When execution started`),completedAt:r().datetime().optional().describe(`When execution completed`),attempt:P().int().min(1).describe(`Attempt number (1-indexed)`),willRetry:S().describe(`Whether task will be retried`)});var Or=h({name:r().describe(`Queue name (snake_case)`),concurrency:P().int().min(1).default(5).describe(`Max concurrent task executions`),rateLimit:h({max:P().int().positive().describe(`Maximum tasks per duration`),duration:P().int().positive().describe(`Duration in milliseconds`)}).optional().describe(`Rate limit configuration`),defaultRetryPolicy:Er.optional().describe(`Default retry policy for tasks`),deadLetterQueue:r().optional().describe(`Dead letter queue name`),priority:P().int().min(0).default(0).describe(`Queue priority (lower = higher priority)`),autoScale:h({enabled:S().default(!1).describe(`Enable auto-scaling`),minWorkers:P().int().min(1).default(1).describe(`Minimum workers`),maxWorkers:P().int().min(1).default(10).describe(`Maximum workers`),scaleUpThreshold:P().int().positive().default(100).describe(`Queue size to scale up`),scaleDownThreshold:P().int().min(0).default(10).describe(`Queue size to scale down`)}).optional().describe(`Auto-scaling configuration`)}),kr=h({id:r().describe(`Unique batch job identifier`),type:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),items:C(u()).describe(`Array of items to process`),batchSize:P().int().min(1).default(100).describe(`Number of items per batch`),queue:r().default(`batch`).describe(`Queue for batch tasks`),priority:wr.default(`normal`).describe(`Batch task priority`),parallel:S().default(!0).describe(`Process batches in parallel`),stopOnError:S().default(!1).describe(`Stop batch if any item fails`),onProgress:M().input(w([h({processed:P(),total:P(),failed:P()})])).output(te()).optional().describe(`Progress callback function (called after each batch)`)});h({batchId:r().describe(`Batch job identifier`),total:P().int().min(0).describe(`Total number of items`),processed:P().int().min(0).default(0).describe(`Items processed`),succeeded:P().int().min(0).default(0).describe(`Items succeeded`),failed:P().int().min(0).default(0).describe(`Items failed`),percentage:P().min(0).max(100).describe(`Progress percentage`),status:E([`pending`,`running`,`completed`,`failed`,`cancelled`]).describe(`Batch status`),startedAt:r().datetime().optional().describe(`When batch started`),completedAt:r().datetime().optional().describe(`When batch completed`)});var Ar=h({name:r().describe(`Worker name`),queues:C(r()).min(1).describe(`Queue names to process`),queueConfigs:C(Or).optional().describe(`Queue configurations`),pollIntervalMs:P().int().positive().default(1e3).describe(`Queue polling interval in milliseconds`),visibilityTimeoutMs:P().int().positive().default(3e4).describe(`How long a task is invisible after being claimed`),defaultTimeoutMs:P().int().positive().default(3e5).describe(`Default task timeout in milliseconds`),shutdownTimeoutMs:P().int().positive().default(3e4).describe(`Graceful shutdown timeout in milliseconds`),handlers:d(r(),M()).optional().describe(`Task type handlers`)});h({workerName:r().describe(`Worker name`),totalProcessed:P().int().min(0).describe(`Total tasks processed`),succeeded:P().int().min(0).describe(`Successful tasks`),failed:P().int().min(0).describe(`Failed tasks`),active:P().int().min(0).describe(`Currently active tasks`),avgExecutionMs:P().min(0).optional().describe(`Average execution time in milliseconds`),uptimeMs:P().int().min(0).describe(`Worker uptime in milliseconds`),queues:d(r(),h({pending:P().int().min(0).describe(`Pending tasks`),active:P().int().min(0).describe(`Active tasks`),completed:P().int().min(0).describe(`Completed tasks`),failed:P().int().min(0).describe(`Failed tasks`)})).optional().describe(`Per-queue statistics`)}),Object.assign(Dr,{create:e=>e}),Object.assign(Or,{create:e=>e}),Object.assign(Ar,{create:e=>e}),Object.assign(kr,{create:e=>e});var jr=h({id:r().describe(`Template identifier`),subject:r().describe(`Email subject`),body:r().describe(`Email body content`),bodyType:E([`text`,`html`,`markdown`]).optional().default(`html`).describe(`Body content type`),variables:C(r()).optional().describe(`Template variables`),attachments:C(h({name:r().describe(`Attachment filename`),url:r().url().describe(`Attachment URL`)})).optional().describe(`Email attachments`)}),Mr=h({id:r().describe(`Template identifier`),message:r().describe(`SMS message content`),maxLength:P().optional().default(160).describe(`Maximum message length`),variables:C(r()).optional().describe(`Template variables`)}),Nr=h({title:r().describe(`Notification title`),body:r().describe(`Notification body`),icon:r().url().optional().describe(`Notification icon URL`),badge:P().optional().describe(`Badge count`),data:d(r(),u()).optional().describe(`Custom data`),actions:C(h({action:r().describe(`Action identifier`),title:r().describe(`Action button title`)})).optional().describe(`Notification actions`)}),Pr=h({title:r().describe(`Notification title`),message:r().describe(`Notification message`),type:E([`info`,`success`,`warning`,`error`]).describe(`Notification type`),actionUrl:r().optional().describe(`Action URL`),dismissible:S().optional().default(!0).describe(`User dismissible`),expiresAt:P().optional().describe(`Expiration timestamp`)}),dee=E([`email`,`sms`,`push`,`in-app`,`slack`,`teams`,`webhook`]);h({id:r().describe(`Notification ID`),name:r().describe(`Notification name`),channel:dee.describe(`Notification channel`),template:l([jr,Mr,Nr,Pr]).describe(`Notification template`),recipients:h({to:C(r()).describe(`Primary recipients`),cc:C(r()).optional().describe(`CC recipients`),bcc:C(r()).optional().describe(`BCC recipients`)}).describe(`Recipients`),schedule:h({type:E([`immediate`,`delayed`,`scheduled`]).describe(`Schedule type`),delay:P().optional().describe(`Delay in milliseconds`),scheduledAt:P().optional().describe(`Scheduled timestamp`)}).optional().describe(`Scheduling`),retryPolicy:h({enabled:S().optional().default(!0).describe(`Enable retries`),maxRetries:P().optional().default(3).describe(`Max retry attempts`),backoffStrategy:E([`exponential`,`linear`,`fixed`]).describe(`Backoff strategy`)}).optional().describe(`Retry policy`),tracking:h({trackOpens:S().optional().default(!1).describe(`Track opens`),trackClicks:S().optional().default(!1).describe(`Track clicks`),trackDelivery:S().optional().default(!0).describe(`Track delivery`)}).optional().describe(`Tracking configuration`)});var Fr=r().describe(`BCP-47 Language Tag (e.g. en-US, zh-CN)`),Ir=h({label:r().optional().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),placeholder:r().optional().describe(`Translated placeholder text for form inputs`),options:d(r(),r()).optional().describe(`Option value to translated label map`)}).describe(`Translation data for a single field`),Lr=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),fields:d(r(),Ir).optional().describe(`Field-level translations`)}).describe(`Translation data for a single object`);d(Fr,h({objects:d(r(),Lr).optional().describe(`Object translations keyed by object name`),apps:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID`),validationMessages:d(r(),r()).optional().describe(`Translatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})`)}).describe(`Translation data for objects, apps, and UI messages`)).describe(`Map of locale codes to translation data`);var Rr=E([`bundled`,`per_locale`,`per_namespace`]).describe(`Translation file organization strategy`),zr=E([`icu`,`simple`]).describe(`Message interpolation format: ICU MessageFormat or simple {variable} replacement`);h({defaultLocale:Fr.describe(`Default locale (e.g., "en")`),supportedLocales:C(Fr).describe(`Supported BCP-47 locale codes`),fallbackLocale:Fr.optional().describe(`Fallback locale code`),fileOrganization:Rr.default(`per_locale`).describe(`File organization strategy`),messageFormat:zr.default(`simple`).describe(`Message interpolation format (ICU MessageFormat or simple)`),lazyLoad:S().default(!1).describe(`Load translations on demand`),cache:S().default(!0).describe(`Cache loaded translations`)}).describe(`Internationalization configuration`);var Br=d(r(),r()).describe(`Option value to translated label map`),Vr=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),description:r().optional().describe(`Translated object description`),helpText:r().optional().describe(`Translated help text for the object`),fields:d(r(),Ir).optional().describe(`Field translations keyed by field name`),_options:d(r(),Br).optional().describe(`Object-scoped picklist option translations keyed by field name`),_views:d(r(),h({label:r().optional().describe(`Translated view label`),description:r().optional().describe(`Translated view description`)})).optional().describe(`View translations keyed by view name`),_sections:d(r(),h({label:r().optional().describe(`Translated section label`)})).optional().describe(`Section translations keyed by section name`),_actions:d(r(),h({label:r().optional().describe(`Translated action label`),confirmMessage:r().optional().describe(`Translated confirmation message`)})).optional().describe(`Action translations keyed by action name`),_notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Notification translations keyed by notification name`),_errors:d(r(),r()).optional().describe(`Error message translations keyed by error code`)}).describe(`Object-first aggregated translation node`);h({_meta:h({locale:r().optional().describe(`BCP-47 locale code for this bundle`),direction:E([`ltr`,`rtl`]).optional().describe(`Text direction: left-to-right or right-to-left`)}).optional().describe(`Bundle-level metadata (locale, bidi direction)`),namespace:r().optional().describe(`Namespace for plugin isolation to avoid translation key collisions`),o:d(r(),Vr).optional().describe(`Object-first translations keyed by object name`),_globalOptions:d(r(),Br).optional().describe(`Global picklist option translations keyed by option set name`),app:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),nav:d(r(),r()).optional().describe(`Navigation item translations keyed by nav item name`),dashboard:d(r(),h({label:r().optional().describe(`Translated dashboard label`),description:r().optional().describe(`Translated dashboard description`)})).optional().describe(`Dashboard translations keyed by dashboard name`),reports:d(r(),h({label:r().optional().describe(`Translated report label`),description:r().optional().describe(`Translated report description`)})).optional().describe(`Report translations keyed by report name`),pages:d(r(),h({title:r().optional().describe(`Translated page title`),description:r().optional().describe(`Translated page description`)})).optional().describe(`Page translations keyed by page name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID (supports ICU MessageFormat)`),validationMessages:d(r(),r()).optional().describe(`Validation error message translations keyed by rule name (supports ICU MessageFormat)`),notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Global notification translations keyed by notification name`),errors:d(r(),r()).optional().describe(`Global error message translations keyed by error code`)}).describe(`Object-first application translation bundle for a single locale`);var Hr=E([`missing`,`redundant`,`stale`]).describe(`Translation diff status: missing from bundle, redundant (no matching metadata), or stale (metadata changed)`),Ur=h({key:r().describe(`Dot-path translation key`),status:Hr.describe(`Diff status of this translation key`),objectName:r().optional().describe(`Associated object name (snake_case)`),locale:r().describe(`BCP-47 locale code`),sourceHash:r().optional().describe(`Hash of source metadata for precise stale detection`),aiSuggested:r().optional().describe(`AI-suggested translation for this key`),aiConfidence:P().min(0).max(1).optional().describe(`AI suggestion confidence score (0–1)`)}).describe(`A single translation diff item`),Wr=h({group:r().describe(`Translation group category`),totalKeys:P().int().nonnegative().describe(`Total keys in this group`),translatedKeys:P().int().nonnegative().describe(`Translated keys in this group`),coveragePercent:P().min(0).max(100).describe(`Coverage percentage for this group`)}).describe(`Coverage breakdown for a single translation group`);h({locale:r().describe(`BCP-47 locale code`),objectName:r().optional().describe(`Object name scope (omit for full bundle)`),totalKeys:P().int().nonnegative().describe(`Total translatable keys from metadata`),translatedKeys:P().int().nonnegative().describe(`Number of translated keys`),missingKeys:P().int().nonnegative().describe(`Number of missing translations`),redundantKeys:P().int().nonnegative().describe(`Number of redundant translations`),staleKeys:P().int().nonnegative().describe(`Number of stale translations`),coveragePercent:P().min(0).max(100).describe(`Translation coverage percentage`),items:C(Ur).describe(`Detailed diff items`),breakdown:C(Wr).optional().describe(`Per-group coverage breakdown`)}).describe(`Aggregated translation coverage result`),E([`insert`,`delete`,`retain`]);var Gr=I(`type`,[h({type:m(`insert`),text:r().describe(`Text to insert`),attributes:d(r(),u()).optional().describe(`Text formatting attributes (e.g., bold, italic)`)}),h({type:m(`delete`),count:P().int().positive().describe(`Number of characters to delete`)}),h({type:m(`retain`),count:P().int().positive().describe(`Number of characters to retain`),attributes:d(r(),u()).optional().describe(`Attribute changes to apply`)})]),Kr=h({operationId:r().uuid().describe(`Unique operation identifier`),documentId:r().describe(`Document identifier`),userId:r().describe(`User who created the operation`),sessionId:r().uuid().describe(`Session identifier`),components:C(Gr).describe(`Operation components`),baseVersion:P().int().nonnegative().describe(`Document version this operation is based on`),timestamp:r().datetime().describe(`ISO 8601 datetime when operation was created`),metadata:d(r(),u()).optional().describe(`Additional operation metadata`)});h({operation:Kr.describe(`Transformed operation`),transformed:S().describe(`Whether transformation was applied`),conflicts:C(r()).optional().describe(`Conflict descriptions if any`)}),E([`lww-register`,`g-counter`,`pn-counter`,`g-set`,`or-set`,`lww-map`,`text`,`tree`,`json`]);var qr=h({clock:d(r(),P().int().nonnegative()).describe(`Map of replica ID to logical timestamp`)}),Jr=h({type:m(`lww-register`),value:u().describe(`Current register value`),timestamp:r().datetime().describe(`ISO 8601 datetime of last write`),replicaId:r().describe(`ID of replica that performed last write`),vectorClock:qr.optional().describe(`Optional vector clock for causality tracking`)});h({replicaId:r().describe(`Replica identifier`),delta:P().int().describe(`Change amount (positive for increment, negative for decrement)`),timestamp:r().datetime().describe(`ISO 8601 datetime of operation`)});var Yr=h({type:m(`g-counter`),counts:d(r(),P().int().nonnegative()).describe(`Map of replica ID to count`)}),Xr=h({type:m(`pn-counter`),positive:d(r(),P().int().nonnegative()).describe(`Positive increments per replica`),negative:d(r(),P().int().nonnegative()).describe(`Negative increments per replica`)}),Zr=h({value:u().describe(`Element value`),timestamp:r().datetime().describe(`Addition timestamp`),replicaId:r().describe(`Replica that added the element`),uid:r().uuid().describe(`Unique identifier for this addition`),removed:S().optional().default(!1).describe(`Whether element has been removed`)}),Qr=h({type:m(`or-set`),elements:C(Zr).describe(`Set elements with metadata`)}),$r=h({operationId:r().uuid().describe(`Unique operation identifier`),replicaId:r().describe(`Replica identifier`),position:P().int().nonnegative().describe(`Position in document`),insert:r().optional().describe(`Text to insert`),delete:P().int().positive().optional().describe(`Number of characters to delete`),timestamp:r().datetime().describe(`ISO 8601 datetime of operation`),lamportTimestamp:P().int().nonnegative().describe(`Lamport timestamp for ordering`)});h({state:I(`type`,[Jr,Yr,Xr,Qr,h({type:m(`text`),documentId:r().describe(`Document identifier`),content:r().describe(`Current text content`),operations:C($r).describe(`History of operations`),lamportClock:P().int().nonnegative().describe(`Current Lamport clock value`),vectorClock:qr.describe(`Vector clock for causality`)})]).describe(`Merged CRDT state`),conflicts:C(h({type:r().describe(`Conflict type`),description:r().describe(`Conflict description`),resolved:S().describe(`Whether conflict was automatically resolved`)})).optional().describe(`Conflicts encountered during merge`)});var ei=h({color:l([E([`blue`,`green`,`red`,`yellow`,`purple`,`orange`,`pink`,`teal`,`indigo`,`cyan`]),r()]).describe(`Cursor color (preset or custom hex)`),opacity:P().min(0).max(1).optional().default(1).describe(`Cursor opacity (0-1)`),label:r().optional().describe(`Label to display with cursor (usually username)`),showLabel:S().optional().default(!0).describe(`Whether to show label`),pulseOnUpdate:S().optional().default(!0).describe(`Whether to pulse when cursor moves`)}),ti=h({anchor:h({line:P().int().nonnegative().describe(`Anchor line number`),column:P().int().nonnegative().describe(`Anchor column number`)}).describe(`Selection anchor (start point)`),focus:h({line:P().int().nonnegative().describe(`Focus line number`),column:P().int().nonnegative().describe(`Focus column number`)}).describe(`Selection focus (end point)`),direction:E([`forward`,`backward`]).optional().describe(`Selection direction`)}),ni=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier`),userName:r().describe(`Display name of user`),position:h({line:P().int().nonnegative().describe(`Cursor line number (0-indexed)`),column:P().int().nonnegative().describe(`Cursor column number (0-indexed)`)}).describe(`Current cursor position`),selection:ti.optional().describe(`Current text selection`),style:ei.describe(`Visual style for this cursor`),isTyping:S().optional().default(!1).describe(`Whether user is currently typing`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last cursor update`),metadata:d(r(),u()).optional().describe(`Additional cursor metadata`)});h({position:h({line:P().int().nonnegative(),column:P().int().nonnegative()}).optional().describe(`Updated cursor position`),selection:ti.optional().describe(`Updated selection`),isTyping:S().optional().describe(`Updated typing state`),metadata:d(r(),u()).optional().describe(`Updated metadata`)});var ri=E([`active`,`idle`,`viewing`,`disconnected`]),ii=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),userName:r().describe(`Display name`),userAvatar:r().optional().describe(`User avatar URL`),status:ri.describe(`Current activity status`),currentDocument:r().optional().describe(`Document ID user is currently editing`),currentView:r().optional().describe(`Current view/page user is on`),lastActivity:r().datetime().describe(`ISO 8601 datetime of last activity`),joinedAt:r().datetime().describe(`ISO 8601 datetime when user joined session`),permissions:C(r()).optional().describe(`User permissions in this session`),metadata:d(r(),u()).optional().describe(`Additional user state metadata`)});h({sessionId:r().uuid().describe(`Session identifier`),documentId:r().optional().describe(`Document ID this session is for`),users:C(ii).describe(`Active users in session`),startedAt:r().datetime().describe(`ISO 8601 datetime when session started`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last update`),metadata:d(r(),u()).optional().describe(`Session metadata`)}),h({status:ri.optional().describe(`Updated status`),currentDocument:r().optional().describe(`Updated current document`),currentView:r().optional().describe(`Updated current view`),metadata:d(r(),u()).optional().describe(`Updated metadata`)}),h({eventId:r().uuid().describe(`Event identifier`),sessionId:r().uuid().describe(`Session identifier`),eventType:E([`user.joined`,`user.left`,`user.updated`,`session.created`,`session.ended`]).describe(`Type of awareness event`),userId:r().optional().describe(`User involved in event`),timestamp:r().datetime().describe(`ISO 8601 datetime of event`),payload:u().describe(`Event payload`)});var ai=h({mode:E([`ot`,`crdt`,`lock`,`hybrid`]).describe(`Collaboration mode to use`),enableCursorSharing:S().optional().default(!0).describe(`Enable cursor sharing`),enablePresence:S().optional().default(!0).describe(`Enable presence tracking`),enableAwareness:S().optional().default(!0).describe(`Enable awareness state`),maxUsers:P().int().positive().optional().describe(`Maximum concurrent users`),idleTimeout:P().int().positive().optional().default(3e5).describe(`Idle timeout in milliseconds`),conflictResolution:E([`ot`,`crdt`,`manual`]).optional().default(`ot`).describe(`Conflict resolution strategy`),persistence:S().optional().default(!0).describe(`Enable operation persistence`),snapshot:h({enabled:S().describe(`Enable periodic snapshots`),interval:P().int().positive().describe(`Snapshot interval in milliseconds`)}).optional().describe(`Snapshot configuration`)});h({sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier`),config:ai.describe(`Session configuration`),users:C(ii).describe(`Active users`),cursors:C(ni).describe(`Active cursors`),version:P().int().nonnegative().describe(`Current document version`),operations:C(l([Kr,$r])).optional().describe(`Recent operations`),createdAt:r().datetime().describe(`ISO 8601 datetime when session was created`),lastActivity:r().datetime().describe(`ISO 8601 datetime of last activity`),status:E([`active`,`idle`,`ended`]).describe(`Session status`)});var oi=E([`system`,`platform`,`user`]),si=E([`draft`,`active`,`archived`,`deprecated`]);h({id:r(),name:r(),type:r(),namespace:r().default(`default`),packageId:r().optional().describe(`Package ID that owns/delivered this metadata`),managedBy:E([`package`,`platform`,`user`]).optional().describe(`Who manages this metadata record lifecycle`),scope:oi.default(`platform`),metadata:d(r(),u()),extends:r().optional().describe(`Name of the parent metadata to extend/override`),strategy:E([`merge`,`replace`]).default(`merge`),owner:r().optional(),state:si.default(`active`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant isolation`),version:P().default(1).describe(`Record version for optimistic concurrency control`),checksum:r().optional().describe(`Content checksum for change detection`),source:E([`filesystem`,`database`,`api`,`migration`]).optional().describe(`Origin of this metadata record`),tags:C(r()).optional().describe(`Classification tags for filtering and grouping`),publishedDefinition:u().optional().describe(`Snapshot of the last published definition`),publishedAt:r().datetime().optional().describe(`When this metadata was last published`),publishedBy:r().optional().describe(`Who published this version`),createdBy:r().optional(),createdAt:r().datetime().optional().describe(`Creation timestamp`),updatedBy:r().optional(),updatedAt:r().datetime().optional().describe(`Last update timestamp`)}),h({success:S().describe(`Whether the publish succeeded`),packageId:r().describe(`The package ID that was published`),version:P().int().describe(`New version number after publish`),publishedAt:r().datetime().describe(`Publish timestamp`),itemsPublished:P().int().describe(`Total metadata items published`),validationErrors:C(h({type:r().describe(`Metadata type that failed validation`),name:r().describe(`Item name that failed validation`),message:r().describe(`Validation error message`)})).optional().describe(`Validation errors if publish failed`)});var ci=E([`json`,`yaml`,`yml`,`ts`,`js`,`typescript`,`javascript`]),li=h({path:r().optional(),size:P().optional(),mtime:r().datetime().optional(),hash:r().optional(),etag:r().optional(),modifiedAt:r().datetime().optional(),format:ci.optional()});h({name:r(),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Loader protocol identifier`),description:r().optional(),supportedFormats:C(r()).optional(),supportsWatch:S().optional(),supportsWrite:S().optional(),supportsCache:S().optional(),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)})}),h({scope:oi.optional(),namespace:r().optional(),raw:S().optional().describe(`Return raw file content instead of parsed JSON`),cache:S().optional(),useCache:S().optional(),validate:S().optional(),ifNoneMatch:r().optional(),recursive:S().optional(),limit:P().optional(),patterns:C(r()).optional(),loader:r().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),h({data:u(),stats:li.optional(),format:ci.optional(),source:r().optional(),fromCache:S().optional(),etag:r().optional(),notModified:S().optional(),loadTime:P().optional()}),h({format:ci.optional(),create:S().default(!0),overwrite:S().default(!0),path:r().optional(),prettify:S().optional(),indent:P().optional(),sortKeys:S().optional(),backup:S().optional(),atomic:S().optional(),loader:r().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),h({success:S(),path:r().optional(),stats:li.optional(),etag:r().optional(),size:P().optional(),saveTime:P().optional(),backupPath:r().optional()}),h({type:E([`add`,`change`,`unlink`,`added`,`changed`,`deleted`]),path:r(),name:r().optional(),stats:li.optional(),metadataType:r().optional(),data:u().optional(),timestamp:r().datetime().optional()}),h({type:r(),count:P(),namespaces:C(r())}),h({types:C(r()).optional(),namespaces:C(r()).optional(),output:r().describe(`Output directory or file`),format:ci.default(`json`)}),h({source:r().describe(`Input directory or file`),strategy:E([`merge`,`replace`,`skip`]).default(`merge`),validate:S().default(!0)});var ui=E([`filesystem`,`memory`,`none`]);E([`filesystem`,`database`,`api`,`migration`]),h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:ui.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory for filesystem-based metadata`),formats:C(ci).optional().describe(`Enabled metadata formats`),watch:S().optional().describe(`Enable file watching for filesystem loaders`),cache:S().optional().describe(`Enable metadata caching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`)}).optional().describe(`File watcher options`)});var di=h({id:r(),metadataId:r().describe(`Foreign key to sys_metadata.id`),name:r(),type:r(),version:P().describe(`Version number at this snapshot`),operationType:E([`create`,`update`,`publish`,`revert`,`delete`]).describe(`Type of operation that created this history entry`),metadata:l([r(),d(r(),u())]).nullable().optional().describe(`Snapshot of metadata definition at this version (raw JSON string or parsed object)`),checksum:r().describe(`SHA-256 checksum of metadata content`),previousChecksum:r().optional().describe(`Checksum of the previous version`),changeNote:r().optional().describe(`Description of changes made in this version`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant isolation`),recordedBy:r().optional().describe(`User who made this change`),recordedAt:r().datetime().describe(`Timestamp when this version was recorded`)});h({limit:P().int().positive().optional().describe(`Maximum number of history records to return`),offset:P().int().nonnegative().optional().describe(`Number of records to skip`),since:r().datetime().optional().describe(`Only return history after this timestamp`),until:r().datetime().optional().describe(`Only return history before this timestamp`),operationType:E([`create`,`update`,`publish`,`revert`,`delete`]).optional().describe(`Filter by operation type`),includeMetadata:S().optional().default(!0).describe(`Include full metadata payload`)}),h({records:C(di),total:P().int().nonnegative(),hasMore:S()}),h({type:r(),name:r(),version1:P(),version2:P(),checksum1:r(),checksum2:r(),identical:S(),patch:C(u()).optional().describe(`JSON patch operations`),summary:r().optional().describe(`Human-readable summary of changes`)}),h({maxVersions:P().int().positive().optional().describe(`Maximum number of versions to retain`),maxAgeDays:P().int().positive().optional().describe(`Maximum age of history records in days`),autoCleanup:S().default(!1).describe(`Enable automatic cleanup of old history`),cleanupIntervalHours:P().int().positive().default(24).describe(`How often to run cleanup (in hours)`)});var fi=E([`metadata`,`data`,`auth`,`file-storage`,`search`,`cache`,`queue`,`automation`,`graphql`,`analytics`,`realtime`,`job`,`notification`,`ai`,`i18n`,`ui`,`workflow`]);E([`required`,`core`,`optional`]);var pi={data:`required`,metadata:`core`,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`};h({name:fi,enabled:S(),status:E([`running`,`stopped`,`degraded`,`initializing`]),version:r().optional(),provider:r().optional().describe(`Implementation provider (e.g. "s3" for storage)`),features:C(r()).optional().describe(`List of supported sub-features`)}),d(fi,u().describe(`Service Instance implementing the protocol interface`)),h({id:r(),name:fi,options:d(r(),u()).optional()});var mi=E([`shared_schema`,`isolated_schema`,`isolated_db`]),hi=E([`turso`,`postgres`,`memory`]).describe(`Database provider for tenant data`),gi=h({url:r().min(1).describe(`Database connection URL`),authToken:r().optional().describe(`Database auth token (encrypted at rest)`),group:r().optional().describe(`Turso database group name`)}).describe(`Tenant database connection configuration`),_i=h({maxUsers:P().int().positive().optional().describe(`Maximum number of users`),maxStorage:P().int().positive().optional().describe(`Maximum storage in bytes`),apiRateLimit:P().int().positive().optional().describe(`API requests per minute`),maxObjects:P().int().positive().optional().describe(`Maximum number of custom objects`),maxRecordsPerObject:P().int().positive().optional().describe(`Maximum records per object`),maxDeploymentsPerDay:P().int().positive().optional().describe(`Maximum deployments per day`),maxStorageBytes:P().int().positive().optional().describe(`Maximum storage in bytes`)});h({currentObjectCount:P().int().min(0).default(0).describe(`Current number of custom objects`),currentRecordCount:P().int().min(0).default(0).describe(`Total records across all objects`),currentStorageBytes:P().int().min(0).default(0).describe(`Current storage usage in bytes`),deploymentsToday:P().int().min(0).default(0).describe(`Deployments executed today`),currentUsers:P().int().min(0).default(0).describe(`Current number of active users`),apiRequestsThisMinute:P().int().min(0).default(0).describe(`API requests in the current minute`),lastUpdatedAt:r().datetime().optional().describe(`Last usage update time`)}).describe(`Current tenant resource usage`),h({allowed:S().describe(`Whether the operation is within quota`),exceededQuota:r().optional().describe(`Name of the exceeded quota`),currentUsage:P().optional().describe(`Current usage value`),limit:P().optional().describe(`Quota limit`),message:r().optional().describe(`Human-readable quota message`)}).describe(`Quota enforcement check result`),h({id:r().describe(`Unique tenant identifier`),name:r().describe(`Tenant display name`),isolationLevel:mi,databaseProvider:hi.optional().describe(`Database provider`),connectionConfig:gi.optional().describe(`Database connection config`),provisioningStatus:E([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).optional().describe(`Current provisioning lifecycle status`),plan:E([`free`,`pro`,`enterprise`]).optional().describe(`Subscription plan`),customizations:d(r(),u()).optional().describe(`Custom configuration values`),quotas:_i.optional()}),I(`strategy`,[h({strategy:m(`shared_schema`).describe(`Row-level isolation strategy`),database:h({enableRLS:S().default(!0).describe(`Enable PostgreSQL Row-Level Security`),contextMethod:E([`session_variable`,`search_path`,`application_name`]).default(`session_variable`).describe(`How to set tenant context`),contextVariable:r().default(`app.current_tenant`).describe(`Session variable name`),applicationValidation:S().default(!0).describe(`Application-level tenant validation`)}).optional().describe(`Database configuration`),performance:h({usePartialIndexes:S().default(!0).describe(`Use partial indexes per tenant`),usePartitioning:S().default(!1).describe(`Use table partitioning by tenant_id`),poolSizePerTenant:P().int().positive().optional().describe(`Connection pool size per tenant`)}).optional().describe(`Performance settings`)}),h({strategy:m(`isolated_schema`).describe(`Schema-level isolation strategy`),schema:h({namingPattern:r().default(`tenant_{tenant_id}`).describe(`Schema naming pattern`),includePublicSchema:S().default(!0).describe(`Include public schema`),sharedSchema:r().default(`public`).describe(`Schema for shared resources`),autoCreateSchema:S().default(!0).describe(`Auto-create schema`)}).optional().describe(`Schema configuration`),migrations:h({strategy:E([`parallel`,`sequential`,`on_demand`]).default(`parallel`).describe(`Migration strategy`),maxConcurrent:P().int().positive().default(10).describe(`Max concurrent migrations`),rollbackOnError:S().default(!0).describe(`Rollback on error`)}).optional().describe(`Migration configuration`),performance:h({poolPerSchema:S().default(!1).describe(`Separate pool per schema`),schemaCacheTTL:P().int().positive().default(3600).describe(`Schema cache TTL`)}).optional().describe(`Performance settings`)}),h({strategy:m(`isolated_db`).describe(`Database-level isolation strategy`),database:h({namingPattern:r().default(`tenant_{tenant_id}`).describe(`Database naming pattern`),serverStrategy:E([`shared`,`sharded`,`dedicated`]).default(`shared`).describe(`Server assignment strategy`),separateCredentials:S().default(!0).describe(`Separate credentials per tenant`),autoCreateDatabase:S().default(!0).describe(`Auto-create database`)}).optional().describe(`Database configuration`),connectionPool:h({poolSize:P().int().positive().default(10).describe(`Connection pool size`),maxActivePools:P().int().positive().default(100).describe(`Max active pools`),idleTimeout:P().int().positive().default(300).describe(`Idle pool timeout`),usePooler:S().default(!0).describe(`Use connection pooler`)}).optional().describe(`Connection pool configuration`),backup:h({strategy:E([`individual`,`consolidated`,`on_demand`]).default(`individual`).describe(`Backup strategy`),frequencyHours:P().int().positive().default(24).describe(`Backup frequency`),retentionDays:P().int().positive().default(30).describe(`Backup retention days`)}).optional().describe(`Backup configuration`),encryption:h({perTenantKeys:S().default(!1).describe(`Per-tenant encryption keys`),algorithm:r().default(`AES-256-GCM`).describe(`Encryption algorithm`),keyManagement:E([`aws_kms`,`azure_key_vault`,`gcp_kms`,`hashicorp_vault`,`custom`]).optional().describe(`Key management service`)}).optional().describe(`Encryption configuration`)})]),h({encryption:h({atRest:S().default(!0).describe(`Require encryption at rest`),inTransit:S().default(!0).describe(`Require encryption in transit`),fieldLevel:S().default(!1).describe(`Require field-level encryption`)}).optional().describe(`Encryption requirements`),accessControl:h({requireMFA:S().default(!1).describe(`Require MFA`),requireSSO:S().default(!1).describe(`Require SSO`),ipWhitelist:C(r()).optional().describe(`Allowed IP addresses`),sessionTimeout:P().int().positive().default(3600).describe(`Session timeout`)}).optional().describe(`Access control requirements`),compliance:h({standards:C(E([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),requireAuditLog:S().default(!0).describe(`Require audit logging`),auditRetentionDays:P().int().positive().default(365).describe(`Audit retention days`),dataResidency:h({region:r().optional().describe(`Required region (e.g., US, EU, APAC)`),excludeRegions:C(r()).optional().describe(`Prohibited regions`)}).optional().describe(`Data residency requirements`)}).optional().describe(`Compliance requirements`)});var vi=E([`boolean`,`counter`,`gauge`]).describe(`License metric type`);h({code:r().regex(/^[a-z_][a-z0-9_.]*$/).describe(`Feature code (e.g. core.api_access)`),label:r(),description:r().optional(),type:vi.default(`boolean`),unit:E([`count`,`bytes`,`seconds`,`percent`]).optional(),requires:C(r()).optional()}),h({code:r().describe(`Plan code (e.g. pro_v1)`),label:r(),active:S().default(!0),features:C(r()).describe(`List of enabled boolean features`),limits:d(r(),P()).describe(`Map of metric codes to limit values (e.g. { storage_gb: 10 })`),currency:r().default(`USD`).optional(),priceMonthly:P().optional(),priceYearly:P().optional()}),h({spaceId:r().describe(`Target Space ID`),planCode:r(),issuedAt:r().datetime(),expiresAt:r().datetime().optional(),status:E([`active`,`expired`,`suspended`,`trial`]),customFeatures:C(r()).optional(),customLimits:d(r(),P()).optional(),plugins:C(r()).optional().describe(`List of enabled plugin package IDs`),signature:r().optional().describe(`Cryptographic signature of the license`)});var yi=E([`manual`,`auto`,`proxy`]).describe(`Registry synchronization strategy`),bi=h({url:r().url().describe(`Upstream registry endpoint`),syncPolicy:yi.default(`auto`),syncInterval:P().int().min(60).optional().describe(`Auto-sync interval in seconds`),auth:h({type:E([`none`,`basic`,`bearer`,`api-key`,`oauth2`]).default(`none`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional()}).optional(),tls:h({enabled:S().default(!0),verifyCertificate:S().default(!0),certificate:r().optional(),privateKey:r().optional()}).optional(),timeout:P().int().min(1e3).default(3e4).describe(`Request timeout in milliseconds`),retry:h({maxAttempts:P().int().min(0).default(3),backoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`)}).optional()});h({type:E([`public`,`private`,`hybrid`]).describe(`Registry deployment type`),upstream:C(bi).optional().describe(`Upstream registries to sync from or proxy to`),scope:C(r()).optional().describe(`npm-style scopes managed by this registry (e.g., @my-corp, @enterprise)`),defaultScope:r().optional().describe(`Default scope prefix for new plugins`),storage:h({backend:E([`local`,`s3`,`gcs`,`azure-blob`,`oss`]).default(`local`),path:r().optional(),credentials:d(r(),u()).optional()}).optional(),visibility:E([`public`,`private`,`internal`]).default(`private`).describe(`Who can access this registry`),accessControl:h({requireAuthForRead:S().default(!1),requireAuthForWrite:S().default(!0),allowedPrincipals:C(r()).optional()}).optional(),cache:h({enabled:S().default(!0),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().optional().describe(`Maximum cache size in bytes`)}).optional(),mirrors:C(h({url:r().url(),priority:P().int().min(1).default(1)})).optional().describe(`Mirror registries for redundancy`)});var xi=E([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).describe(`Tenant provisioning lifecycle status`),Si=E([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),Ci=E([`us-east`,`us-west`,`eu-west`,`eu-central`,`ap-southeast`,`ap-northeast`]).describe(`Available deployment region`),wi=h({name:r().min(1).describe(`Step name (e.g., create_database, sync_schema)`),status:E([`pending`,`running`,`completed`,`failed`,`skipped`]).describe(`Step status`),startedAt:r().datetime().optional().describe(`Step start time`),completedAt:r().datetime().optional().describe(`Step completion time`),durationMs:P().int().min(0).optional().describe(`Step duration in ms`),error:r().optional().describe(`Error message on failure`)}).describe(`Individual provisioning step status`);h({orgId:r().min(1).describe(`Organization ID`),plan:Si.default(`free`),region:Ci.default(`us-east`),displayName:r().optional().describe(`Tenant display name`),adminEmail:r().email().optional().describe(`Initial admin user email`),metadata:d(r(),u()).optional().describe(`Additional metadata`)}).describe(`Tenant provisioning request`),h({tenantId:r().min(1).describe(`Provisioned tenant ID`),connectionUrl:r().min(1).describe(`Database connection URL`),status:xi,region:Ci,plan:Si,steps:C(wi).default([]).describe(`Pipeline step statuses`),totalDurationMs:P().int().min(0).optional().describe(`Total provisioning duration`),provisionedAt:r().datetime().optional().describe(`Provisioning completion time`),error:r().optional().describe(`Error message on failure`)}).describe(`Tenant provisioning result`),E([`validating`,`diffing`,`migrating`,`registering`,`ready`,`failed`,`rolling_back`]).describe(`Deployment lifecycle status`),h({changes:C(h({entityType:E([`object`,`field`,`index`,`view`,`flow`,`permission`]).describe(`Entity type`),entityName:r().min(1).describe(`Entity name`),parentEntity:r().optional().describe(`Parent entity name`),changeType:E([`added`,`modified`,`removed`]).describe(`Change type`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`)}).describe(`Individual schema change`)).default([]).describe(`List of schema changes`),summary:h({added:P().int().min(0).default(0).describe(`Number of added entities`),modified:P().int().min(0).default(0).describe(`Number of modified entities`),removed:P().int().min(0).default(0).describe(`Number of removed entities`)}).describe(`Change summary counts`),hasBreakingChanges:S().default(!1).describe(`Whether diff contains breaking changes`)}).describe(`Schema diff between current and desired state`),h({statements:C(h({sql:r().min(1).describe(`SQL DDL statement`),reversible:S().default(!0).describe(`Whether the statement can be reversed`),rollbackSql:r().optional().describe(`Reverse SQL for rollback`),order:P().int().min(0).describe(`Execution order`)}).describe(`Single DDL migration statement`)).default([]).describe(`Ordered DDL statements`),dialect:r().min(1).describe(`Target SQL dialect`),reversible:S().default(!0).describe(`Whether the plan can be fully rolled back`),estimatedDurationMs:P().int().min(0).optional().describe(`Estimated execution time`)}).describe(`Ordered migration plan`);var Ti=h({severity:E([`error`,`warning`,`info`]).describe(`Issue severity`),path:r().describe(`Entity path (e.g., objects.project_task.fields.name)`),message:r().describe(`Issue description`),code:r().optional().describe(`Validation error code`)}).describe(`Validation issue`);h({valid:S().describe(`Whether the bundle is valid`),issues:C(Ti).default([]).describe(`Validation issues`),errorCount:P().int().min(0).default(0).describe(`Number of errors`),warningCount:P().int().min(0).default(0).describe(`Number of warnings`)}).describe(`Bundle validation result`),h({manifest:h({version:r().min(1).describe(`Deployment version`),checksum:r().optional().describe(`SHA256 checksum`),objects:C(r()).default([]).describe(`Object names included`),views:C(r()).default([]).describe(`View names included`),flows:C(r()).default([]).describe(`Flow names included`),permissions:C(r()).default([]).describe(`Permission names included`),createdAt:r().datetime().optional().describe(`Bundle creation time`)}).describe(`Deployment manifest`),objects:C(d(r(),u())).default([]).describe(`Object definitions`),views:C(d(r(),u())).default([]).describe(`View definitions`),flows:C(d(r(),u())).default([]).describe(`Flow definitions`),permissions:C(d(r(),u())).default([]).describe(`Permission definitions`),seedData:C(d(r(),u())).default([]).describe(`Seed data records`)}).describe(`Deploy bundle containing all metadata for deployment`),h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`App identifier (snake_case)`),label:r().min(1).describe(`App display label`),version:r().min(1).describe(`App version (semver)`),description:r().optional().describe(`App description`),minKernelVersion:r().optional().describe(`Minimum required kernel version`),objects:C(r()).default([]).describe(`Object names provided`),views:C(r()).default([]).describe(`View names provided`),flows:C(r()).default([]).describe(`Flow names provided`),hasSeedData:S().default(!1).describe(`Whether app includes seed data`),seedData:C(d(r(),u())).default([]).describe(`Seed data records`),dependencies:C(r()).default([]).describe(`Required app dependencies`)}).describe(`App manifest for marketplace installation`),h({compatible:S().describe(`Whether the app is compatible`),issues:C(h({severity:E([`error`,`warning`]).describe(`Issue severity`),message:r().describe(`Issue description`),category:E([`kernel_version`,`object_conflict`,`dependency_missing`,`quota_exceeded`]).describe(`Issue category`)})).default([]).describe(`Compatibility issues`)}).describe(`App compatibility check result`),h({tenantId:r().min(1).describe(`Target tenant ID`),appId:r().min(1).describe(`App identifier`),configOverrides:d(r(),u()).optional().describe(`Configuration overrides`),skipSeedData:S().default(!1).describe(`Skip seed data population`)}).describe(`App install request`),h({success:S().describe(`Whether installation succeeded`),appId:r().describe(`Installed app identifier`),version:r().describe(`Installed app version`),installedObjects:C(r()).default([]).describe(`Objects created/updated`),createdTables:C(r()).default([]).describe(`Database tables created`),seededRecords:P().int().min(0).default(0).describe(`Seed records inserted`),durationMs:P().int().min(0).optional().describe(`Installation duration`),error:r().optional().describe(`Error message on failure`)}).describe(`App install result`);var Ei=h({$field:r().describe(`Field Reference/Column Name`)});h({$eq:D().optional(),$ne:D().optional()}),h({$gt:l([P(),N(),Ei]).optional(),$gte:l([P(),N(),Ei]).optional(),$lt:l([P(),N(),Ei]).optional(),$lte:l([P(),N(),Ei]).optional()}),h({$in:C(D()).optional(),$nin:C(D()).optional()}),h({$between:w([l([P(),N(),Ei]),l([P(),N(),Ei])]).optional()}),h({$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional()}),h({$null:S().optional(),$exists:S().optional()});var Di=h({$eq:D().optional(),$ne:D().optional(),$gt:l([P(),N(),Ei]).optional(),$gte:l([P(),N(),Ei]).optional(),$lt:l([P(),N(),Ei]).optional(),$lte:l([P(),N(),Ei]).optional(),$in:C(D()).optional(),$nin:C(D()).optional(),$between:w([l([P(),N(),Ei]),l([P(),N(),Ei])]).optional(),$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional(),$null:S().optional(),$exists:S().optional()}),Oi=F(()=>d(r(),u()).and(h({$and:C(Oi).optional(),$or:C(Oi).optional(),$not:Oi.optional()})));h({where:Oi.optional()});var ki=F(()=>h({$and:C(l([d(r(),Di),ki])).optional(),$or:C(l([d(r(),Di),ki])).optional(),$not:l([d(r(),Di),ki]).optional()})),Ai=h({field:r(),order:E([`asc`,`desc`]).default(`asc`)}),ji=h({function:E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]).describe(`Aggregation function`),field:r().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:r().describe(`Result column alias`),distinct:S().optional().describe(`Apply DISTINCT before aggregation`),filter:Oi.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)}),Mi=E([`inner`,`left`,`right`,`full`]),Ni=E([`auto`,`database`,`hash`,`loop`]),Pi=F(()=>h({type:Mi.describe(`Join type`),strategy:Ni.optional().describe(`Execution strategy hint`),object:r().describe(`Object/table to join`),alias:r().optional().describe(`Table alias`),on:Oi.describe(`Join condition`),subquery:F(()=>Bi).optional().describe(`Subquery instead of object`)})),Fi=E([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),Ii=h({partitionBy:C(r()).optional().describe(`PARTITION BY fields`),orderBy:C(Ai).optional().describe(`ORDER BY specification`),frame:h({type:E([`rows`,`range`]).optional(),start:r().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:r().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)}),Li=h({function:Fi.describe(`Window function name`),field:r().optional().describe(`Field to operate on (for aggregate window functions)`),alias:r().describe(`Result column alias`),over:Ii.describe(`Window specification (OVER clause)`)}),Ri=F(()=>l([r(),h({field:r(),fields:C(Ri).optional(),alias:r().optional()})])),zi=h({query:r().describe(`Search query text`),fields:C(r()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:S().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:E([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:d(r(),P()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:P().optional().describe(`Minimum relevance score threshold`),language:r().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:S().optional().default(!1).describe(`Enable search result highlighting`)}),Bi=h({object:r().describe(`Object name (e.g. account)`),fields:C(Ri).optional().describe(`Fields to retrieve`),where:Oi.optional().describe(`Filtering criteria (WHERE)`),search:zi.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:C(Ai).optional().describe(`Sorting instructions (ORDER BY)`),limit:P().optional().describe(`Max records to return (LIMIT)`),offset:P().optional().describe(`Records to skip (OFFSET)`),top:P().optional().describe(`Alias for limit (OData compatibility)`),cursor:d(r(),u()).optional().describe(`Cursor for keyset pagination`),joins:C(Pi).optional().describe(`Explicit Table Joins`),aggregations:C(ji).optional().describe(`Aggregation functions`),groupBy:C(r()).optional().describe(`GROUP BY fields`),having:Oi.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:C(Li).optional().describe(`Window functions with OVER clause`),distinct:S().optional().describe(`SELECT DISTINCT flag`)}).extend({expand:F(()=>d(r(),Bi)).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.`)}),Vi=h({code:r().describe(`Error code (e.g. validation_error)`),message:r().describe(`Readable error message`),category:r().optional().describe(`Error category (e.g. validation, authorization)`),details:u().optional().describe(`Additional error context (e.g. field validation errors)`),requestId:r().optional().describe(`Request ID for tracking`)}),R=h({success:S().describe(`Operation success status`),error:Vi.optional().describe(`Error details if success is false`),meta:h({timestamp:r(),duration:P().optional(),requestId:r().optional(),traceId:r().optional()}).optional().describe(`Response metadata`)}),Hi=d(r(),u()).describe(`Key-value map of record data`);h({data:Hi.describe(`Record data to insert`)}),h({data:Hi.describe(`Partial record data to update`)}),h({records:C(Hi).describe(`Array of records to process`),allOrNone:S().default(!0).describe(`If true, rollback entire transaction on any failure`)}),v(Bi,h({format:E([`csv`,`json`,`xlsx`]).default(`csv`)})),R.extend({data:Hi.describe(`The requested or modified record`)}),R.extend({data:C(Hi).describe(`Array of matching records`),pagination:h({total:P().optional().describe(`Total matching records count`),limit:P().optional().describe(`Page size`),offset:P().optional().describe(`Page offset`),cursor:r().optional().describe(`Cursor for next page`),nextCursor:r().optional().describe(`Next cursor for pagination`),hasMore:S().describe(`Are there more pages?`)}).describe(`Pagination info`)}),h({id:r().describe(`Record ID`)});var Ui=h({id:r().optional().describe(`Record ID if processed`),success:S(),errors:C(Vi).optional(),index:P().optional().describe(`Index in original request`),data:u().optional().describe(`Result data (e.g. created record)`)});R.extend({data:C(Ui).describe(`Results for each item in the batch`)}),R.extend({id:r().describe(`ID of the deleted record`)}),h({ids:C(r())});var Wi=h({maxBatchSize:P().int().default(100).describe(`Maximum number of keys per batch load`),batchScheduleFn:E([`microtask`,`timeout`,`manual`]).default(`microtask`).describe(`Scheduling strategy for collecting batch keys`),cacheEnabled:S().default(!0).describe(`Enable per-request result caching`),cacheKeyFn:r().optional().describe(`Name or identifier of the cache key function`),cacheTtl:P().min(0).optional().describe(`Cache time-to-live in seconds (0 = no expiration)`),coalesceRequests:S().default(!0).describe(`Deduplicate identical requests within a batch window`),maxConcurrency:P().int().optional().describe(`Maximum parallel batch requests`)}),Gi=h({strategy:E([`dataloader`,`windowed`,`prefetch`]).describe(`Batch loading strategy type`),windowMs:P().optional().describe(`Collection window duration in milliseconds (for windowed strategy)`),prefetchDepth:P().int().optional().describe(`Depth of relation prefetching (for prefetch strategy)`),associationLoading:E([`lazy`,`eager`,`batch`]).default(`batch`).describe(`How to load related associations`)});h({preventNPlusOne:S().describe(`Enable N+1 query detection and prevention`),dataLoader:Wi.optional().describe(`DataLoader batch loading configuration`),batchStrategy:Gi.optional().describe(`Batch loading strategy configuration`),maxQueryDepth:P().int().describe(`Maximum depth for nested relation queries`),queryComplexityLimit:P().optional().describe(`Maximum allowed query complexity score`),enableQueryPlan:S().default(!1).describe(`Log query execution plans for debugging`)});var Ki=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),qi=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),Ji=h({url:r().describe(`API endpoint URL`),method:qi.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)}),Yi=h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(Ki).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),Xi=h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),Zi=h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)}),Qi=h({source:r().describe(`Source field/path`),target:r().describe(`Target field/path`),transform:r().optional().describe(`Transformation function name`)}),$i=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique endpoint ID`),path:r().regex(/^\//).describe(`URL Path (e.g. /api/v1/customers)`),method:Ki.describe(`HTTP Method`),summary:r().optional(),description:r().optional(),type:E([`flow`,`script`,`object_operation`,`proxy`]).describe(`Implementation type`),target:r().describe(`Target Flow ID, Script Name, or Proxy URL`),objectParams:h({object:r().optional(),operation:E([`find`,`get`,`create`,`update`,`delete`]).optional()}).optional().describe(`For object_operation type`),inputMapping:C(Qi).optional().describe(`Map Request Body to Internal Params`),outputMapping:C(Qi).optional().describe(`Map Internal Result to Response Body`),authRequired:S().default(!0).describe(`Require authentication`),rateLimit:Xi.optional().describe(`Rate limiting policy`),cacheTtl:P().optional().describe(`Response cache TTL in seconds`)});Object.assign($i,{create:e=>e});var ea=E([`available`,`registered`,`unavailable`,`degraded`,`stub`]).describe(`available = fully operational, registered = route declared but handler unverified, unavailable = not installed, degraded = partial, stub = placeholder that returns 501`),ta=h({enabled:S(),status:ea,handlerReady:S().optional().describe(`Whether the HTTP handler is confirmed to be mounted. Omitted = readiness unknown/unverified; true = handler mounted; false = handler missing or stub (likely 501).`),route:r().optional().describe(`e.g. /api/v1/analytics`),provider:r().optional().describe(`e.g. "objectql", "plugin-redis", "driver-memory"`),version:r().optional().describe(`Semantic version of the service implementation (e.g. "3.0.6")`),message:r().optional().describe(`e.g. "Install plugin-workflow to enable"`),rateLimit:h({requestsPerMinute:P().int().optional().describe(`Maximum requests per minute`),requestsPerHour:P().int().optional().describe(`Maximum requests per hour`),burstLimit:P().int().optional().describe(`Maximum burst request count`),retryAfterMs:P().int().optional().describe(`Suggested retry-after delay in milliseconds when rate-limited`)}).optional().describe(`Rate limit and quota info for this service`)}),na=h({data:r().describe(`e.g. /api/v1/data`),metadata:r().describe(`e.g. /api/v1/meta`),discovery:r().optional().describe(`e.g. /api/v1/discovery`),ui:r().optional().describe(`e.g. /api/v1/ui`),auth:r().optional().describe(`e.g. /api/v1/auth`),automation:r().optional().describe(`e.g. /api/v1/automation`),storage:r().optional().describe(`e.g. /api/v1/storage`),analytics:r().optional().describe(`e.g. /api/v1/analytics`),graphql:r().optional().describe(`e.g. /graphql`),packages:r().optional().describe(`e.g. /api/v1/packages`),workflow:r().optional().describe(`e.g. /api/v1/workflow`),realtime:r().optional().describe(`e.g. /api/v1/realtime`),notifications:r().optional().describe(`e.g. /api/v1/notifications`),ai:r().optional().describe(`e.g. /api/v1/ai`),i18n:r().optional().describe(`e.g. /api/v1/i18n`),feed:r().optional().describe(`e.g. /api/v1/feed`)}),fee=h({name:r(),version:r(),environment:E([`production`,`sandbox`,`development`]),routes:na,locale:h({default:r(),supported:C(r()),timezone:r()}),services:d(r(),ta).describe(`Per-service availability map keyed by CoreServiceName`),capabilities:d(r(),h({enabled:S().describe(`Whether this capability is available`),features:d(r(),S()).optional().describe(`Sub-feature flags within this capability`),description:r().optional().describe(`Human-readable capability description`)})).optional().describe(`Hierarchical capability descriptors for frontend intelligent adaptation`),schemaDiscovery:h({openapi:r().optional().describe(`URL to OpenAPI (Swagger) specification (e.g., "/api/v1/openapi.json")`),graphql:r().optional().describe(`URL to GraphQL schema endpoint (e.g., "/graphql")`),jsonSchema:r().optional().describe(`URL to JSON Schema definitions`)}).optional().describe(`Schema discovery endpoints for API toolchain integration`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs for extensibility`)});h({feed:S().describe(`Whether the backend supports Feed / Chatter API`),comments:S().describe(`Whether the backend supports comments (a subset of Feed)`),automation:S().describe(`Whether the backend supports Automation CRUD (flows, triggers)`),cron:S().describe(`Whether the backend supports cron scheduling`),search:S().describe(`Whether the backend supports full-text search`),export:S().describe(`Whether the backend supports async export`),chunkedUpload:S().describe(`Whether the backend supports chunked (multipart) uploads`)}).describe(`Well-known capability flags for frontend intelligent adaptation`);var ra=h({route:r().describe(`Route path pattern`),method:Ki.describe(`HTTP method (GET, POST, etc.)`),service:r().describe(`Target service name`),declared:S().describe(`Whether the route is declared in discovery/metadata`),handlerRegistered:S().describe(`Whether the HTTP handler is registered`),healthStatus:E([`pass`,`fail`,`missing`,`skip`]).describe(`pass = handler responds, fail = 501/503, missing = no handler (404), skip = not checked`),message:r().optional().describe(`Diagnostic message`)});h({timestamp:r().describe(`ISO 8601 timestamp of report generation`),adapter:r().describe(`Adapter or runtime that produced this report`),totalDeclared:P().int().describe(`Total routes declared in discovery`),totalRegistered:P().int().describe(`Routes with confirmed handler`),totalMissing:P().int().describe(`Routes missing a handler`),routes:C(ra).describe(`Per-route health entries`)});var pee=E(`metadata.object.created,metadata.object.updated,metadata.object.deleted,metadata.field.created,metadata.field.updated,metadata.field.deleted,metadata.view.created,metadata.view.updated,metadata.view.deleted,metadata.app.created,metadata.app.updated,metadata.app.deleted,metadata.agent.created,metadata.agent.updated,metadata.agent.deleted,metadata.tool.created,metadata.tool.updated,metadata.tool.deleted,metadata.flow.created,metadata.flow.updated,metadata.flow.deleted,metadata.action.created,metadata.action.updated,metadata.action.deleted,metadata.workflow.created,metadata.workflow.updated,metadata.workflow.deleted,metadata.dashboard.created,metadata.dashboard.updated,metadata.dashboard.deleted,metadata.report.created,metadata.report.updated,metadata.report.deleted,metadata.role.created,metadata.role.updated,metadata.role.deleted,metadata.permission.created,metadata.permission.updated,metadata.permission.deleted`.split(`,`)),ia=E([`data.record.created`,`data.record.updated`,`data.record.deleted`,`data.field.changed`]);h({id:r().uuid().describe(`Unique event identifier`),type:pee.describe(`Event type`),metadataType:r().describe(`Metadata type (object, view, agent, etc.)`),name:r().describe(`Metadata item name`),packageId:r().optional().describe(`Package ID`),definition:u().optional().describe(`Full definition (create/update only)`),userId:r().optional().describe(`User who triggered the event`),timestamp:r().datetime().describe(`Event timestamp`)}),h({id:r().uuid().describe(`Unique event identifier`),type:ia.describe(`Event type`),object:r().describe(`Object name`),recordId:r().describe(`Record ID`),changes:d(r(),u()).optional().describe(`Changed fields`),before:d(r(),u()).optional().describe(`Before state`),after:d(r(),u()).optional().describe(`After state`),userId:r().optional().describe(`User who triggered the event`),timestamp:r().datetime().describe(`Event timestamp`)});var aa=E([`online`,`away`,`busy`,`offline`]),oa=E([`created`,`updated`,`deleted`]),sa=h({userId:r().describe(`User identifier`),status:aa.describe(`Current presence status`),lastSeen:r().datetime().describe(`ISO 8601 datetime of last activity`),metadata:d(r(),u()).optional().describe(`Custom presence data (e.g., current page, custom status)`)}),ca=E([`websocket`,`sse`,`polling`]),la=h({type:E([`record.created`,`record.updated`,`record.deleted`,`field.changed`]).describe(`Type of event to subscribe to`),object:r().optional().describe(`Object name to subscribe to`),filters:u().optional().describe(`Filter conditions`)}),ua=h({id:r().uuid().describe(`Unique subscription identifier`),events:C(la).describe(`Array of events to subscribe to`),transport:ca.describe(`Transport protocol to use`),channel:r().optional().describe(`Optional channel name for grouping subscriptions`)}),da=sa;h({id:r().uuid().describe(`Unique event identifier`),type:r().describe(`Event type (e.g., record.created, record.updated)`),object:r().optional().describe(`Object name the event relates to`),action:oa.optional().describe(`Action performed`),payload:d(r(),u()).describe(`Event payload data`),timestamp:r().datetime().describe(`ISO 8601 datetime when event occurred`),userId:r().optional().describe(`User who triggered the event`),sessionId:r().optional().describe(`Session identifier`)}),h({enabled:S().default(!0).describe(`Enable realtime synchronization`),transport:ca.default(`websocket`).describe(`Transport protocol`),subscriptions:C(ua).optional().describe(`Default subscriptions`)}).passthrough();var fa=r().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)`),pa=r().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)`),ma=r().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)`),ha=E([`subscribe`,`unsubscribe`,`event`,`ping`,`pong`,`ack`,`error`,`presence`,`cursor`,`edit`]),ga=E([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`,`contains`,`startsWith`,`endsWith`,`exists`,`regex`]),_a=h({conditions:C(h({field:r().describe(`Field path to filter on (supports dot notation, e.g., "user.email")`),operator:ga.describe(`Comparison operator`),value:u().optional().describe(`Value to compare against (not needed for "exists" operator)`)})).optional().describe(`Array of filter conditions`),and:F(()=>C(_a)).optional().describe(`AND logical combination of filters`),or:F(()=>C(_a)).optional().describe(`OR logical combination of filters`),not:F(()=>_a).optional().describe(`NOT logical negation of filter`)}),va=r().min(1).regex(/^[a-z*][a-z0-9_.*]*$/,{message:`Event pattern must be lowercase and may contain letters, numbers, underscores, dots, or wildcards (e.g., "record.*", "*.created", "user.login")`}).describe(`Event pattern (supports wildcards like "record.*" or "*.created")`),ya=h({subscriptionId:r().uuid().describe(`Unique subscription identifier`),events:C(va).describe(`Event patterns to subscribe to (supports wildcards, e.g., "record.*", "user.created")`),objects:C(r()).optional().describe(`Object names to filter events by (e.g., ["account", "contact"])`),filters:_a.optional().describe(`Advanced filter conditions for event payloads`),channels:C(r()).optional().describe(`Channel names for scoped subscriptions`)}),ba=h({subscriptionId:r().uuid().describe(`Subscription ID to unsubscribe from`)}),xa=aa,Sa=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Unique session identifier`),status:xa.describe(`Current presence status`),lastSeen:r().datetime().describe(`ISO 8601 datetime of last activity`),currentLocation:r().optional().describe(`Current page/route user is viewing`),device:E([`desktop`,`mobile`,`tablet`,`other`]).optional().describe(`Device type`),customStatus:r().optional().describe(`Custom user status message`),metadata:d(r(),u()).optional().describe(`Additional custom presence data`)});h({status:xa.optional().describe(`Updated presence status`),currentLocation:r().optional().describe(`Updated current location`),customStatus:r().optional().describe(`Updated custom status message`),metadata:d(r(),u()).optional().describe(`Updated metadata`)});var Ca=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier being edited`),position:h({line:P().int().nonnegative().describe(`Line number (0-indexed)`),column:P().int().nonnegative().describe(`Column number (0-indexed)`)}).optional().describe(`Cursor position in document`),selection:h({start:h({line:P().int().nonnegative(),column:P().int().nonnegative()}),end:h({line:P().int().nonnegative(),column:P().int().nonnegative()})}).optional().describe(`Selection range (if text is selected)`),color:r().optional().describe(`Cursor color for visual representation`),userName:r().optional().describe(`Display name of user`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last cursor update`)}),wa=E([`insert`,`delete`,`replace`]),Ta=h({operationId:r().uuid().describe(`Unique operation identifier`),documentId:r().describe(`Document identifier`),userId:r().describe(`User who performed the edit`),sessionId:r().uuid().describe(`Session identifier`),type:wa.describe(`Type of edit operation`),position:h({line:P().int().nonnegative().describe(`Line number (0-indexed)`),column:P().int().nonnegative().describe(`Column number (0-indexed)`)}).describe(`Starting position of the operation`),endPosition:h({line:P().int().nonnegative(),column:P().int().nonnegative()}).optional().describe(`Ending position (for delete/replace operations)`),content:r().optional().describe(`Content to insert/replace`),version:P().int().nonnegative().describe(`Document version before this operation`),timestamp:r().datetime().describe(`ISO 8601 datetime when operation was created`),baseOperationId:r().uuid().optional().describe(`Previous operation ID this builds upon (for OT)`)});h({documentId:r().describe(`Document identifier`),version:P().int().nonnegative().describe(`Current document version`),content:r().describe(`Current document content`),lastModified:r().datetime().describe(`ISO 8601 datetime of last modification`),activeSessions:C(r().uuid()).describe(`Active editing session IDs`),checksum:r().optional().describe(`Content checksum for integrity verification`)});var Ea=h({messageId:r().uuid().describe(`Unique message identifier`),type:ha.describe(`Message type`),timestamp:r().datetime().describe(`ISO 8601 datetime when message was sent`)});I(`type`,[Ea.extend({type:m(`subscribe`),subscription:ya.describe(`Subscription configuration`)}),Ea.extend({type:m(`unsubscribe`),request:ba.describe(`Unsubscribe request`)}),Ea.extend({type:m(`event`),subscriptionId:r().uuid().describe(`Subscription ID this event belongs to`),eventName:ma.describe(`Event name`),object:r().optional().describe(`Object name the event relates to`),payload:u().describe(`Event payload data`),userId:r().optional().describe(`User who triggered the event`)}),Ea.extend({type:m(`presence`),presence:Sa.describe(`Presence state`)}),Ea.extend({type:m(`cursor`),cursor:Ca.describe(`Cursor position`)}),Ea.extend({type:m(`edit`),operation:Ta.describe(`Edit operation`)}),Ea.extend({type:m(`ack`),ackMessageId:r().uuid().describe(`ID of the message being acknowledged`),success:S().describe(`Whether the operation was successful`),error:r().optional().describe(`Error message if operation failed`)}),Ea.extend({type:m(`error`),code:r().describe(`Error code`),message:r().describe(`Error message`),details:u().optional().describe(`Additional error details`)}),Ea.extend({type:m(`ping`)}),Ea.extend({type:m(`pong`),pingMessageId:r().uuid().optional().describe(`ID of ping message being responded to`)})]),h({url:r().url().describe(`WebSocket server URL`),protocols:C(r()).optional().describe(`WebSocket sub-protocols`),reconnect:S().optional().default(!0).describe(`Enable automatic reconnection`),reconnectInterval:P().int().positive().optional().default(1e3).describe(`Reconnection interval in milliseconds`),maxReconnectAttempts:P().int().positive().optional().default(5).describe(`Maximum reconnection attempts`),pingInterval:P().int().positive().optional().default(3e4).describe(`Ping interval in milliseconds`),timeout:P().int().positive().optional().default(5e3).describe(`Message timeout in milliseconds`),headers:d(r(),r()).optional().describe(`Custom headers for WebSocket handshake`)}),h({type:E([`subscribe`,`unsubscribe`,`data-change`,`presence-update`,`cursor-update`,`error`]).describe(`Event type`),channel:r().describe(`Channel identifier (e.g., "record.account.123", "user.456")`),payload:u().describe(`Event payload data`),timestamp:P().describe(`Unix timestamp in milliseconds`)}),h({userId:r().describe(`User identifier`),userName:r().describe(`User display name`),status:E([`online`,`away`,`offline`]).describe(`User presence status`),lastSeen:P().describe(`Unix timestamp of last activity in milliseconds`),metadata:d(r(),u()).optional().describe(`Additional presence metadata (e.g., current page, custom status)`)}),h({userId:r().describe(`User identifier`),recordId:r().describe(`Record identifier being edited`),fieldName:r().describe(`Field name being edited`),position:P().describe(`Cursor position (character offset from start)`),selection:h({start:P().describe(`Selection start position`),end:P().describe(`Selection end position`)}).optional().describe(`Text selection range (if text is selected)`)}),h({enabled:S().default(!1).describe(`Enable WebSocket server`),path:r().default(`/ws`).describe(`WebSocket endpoint path`),heartbeatInterval:P().default(3e4).describe(`Heartbeat interval in milliseconds`),reconnectAttempts:P().default(5).describe(`Maximum reconnection attempts for clients`),presence:S().default(!1).describe(`Enable presence tracking`),cursorSharing:S().default(!1).describe(`Enable collaborative cursor sharing`)});var Da=E([`system`,`api`,`auth`,`static`,`webhook`,`plugin`]);h({method:Ki,path:r().describe(`URL Path pattern`),category:Da.default(`api`),handler:r().describe(`Unique handler identifier`),summary:r().optional().describe(`OpenAPI summary`),description:r().optional().describe(`OpenAPI description`),public:S().default(!1).describe(`Is publicly accessible`),permissions:C(r()).optional().describe(`Required permissions`),timeout:P().int().optional().describe(`Execution timeout in ms`),rateLimit:r().optional().describe(`Rate limit policy name`)}),h({basePath:r().default(`/api`).describe(`Global API prefix`),mounts:h({data:r().default(`/data`).describe(`Data Protocol (CRUD)`),metadata:r().default(`/meta`).describe(`Metadata Protocol (Schemas)`),auth:r().default(`/auth`).describe(`Auth Protocol`),automation:r().default(`/automation`).describe(`Automation Protocol`),storage:r().default(`/storage`).describe(`Storage Protocol`),analytics:r().default(`/analytics`).describe(`Analytics Protocol`),graphql:r().default(`/graphql`).describe(`GraphQL Endpoint`),ui:r().default(`/ui`).describe(`UI Metadata Protocol (Views, Layouts)`),workflow:r().default(`/workflow`).describe(`Workflow Engine Protocol`),realtime:r().default(`/realtime`).describe(`Realtime/WebSocket Protocol`),notifications:r().default(`/notifications`).describe(`Notification Protocol`),ai:r().default(`/ai`).describe(`AI Engine Protocol (NLQ, Chat, Suggest)`),i18n:r().default(`/i18n`).describe(`Internationalization Protocol`),packages:r().default(`/packages`).describe(`Package Management Protocol`)}).default({data:`/data`,metadata:`/meta`,auth:`/auth`,automation:`/automation`,storage:`/storage`,analytics:`/analytics`,graphql:`/graphql`,ui:`/ui`,workflow:`/workflow`,realtime:`/realtime`,notifications:`/notifications`,ai:`/ai`,i18n:`/i18n`,packages:`/packages`}),cors:Yi.optional(),staticMounts:C(Zi).optional()}),h({$select:l([r(),C(r())]).optional().describe(`Fields to select`),$filter:r().optional().describe(`Filter expression (OData filter syntax)`),$orderby:l([r(),C(r())]).optional().describe(`Sort order`),$top:P().int().min(0).optional().describe(`Max results to return`),$skip:P().int().min(0).optional().describe(`Results to skip`),$expand:l([r(),C(r())]).optional().describe(`Navigation properties to expand (lookup/master_detail fields)`),$count:S().optional().describe(`Include total count`),$search:r().optional().describe(`Search expression`),$format:E([`json`,`xml`,`atom`]).optional().describe(`Response format`),$apply:r().optional().describe(`Aggregation expression`)}),E([`eq`,`ne`,`lt`,`le`,`gt`,`ge`,`and`,`or`,`not`,`(`,`)`,`in`,`has`]),E(`contains.startswith.endswith.length.indexof.substring.tolower.toupper.trim.concat.year.month.day.hour.minute.second.date.time.now.maxdatetime.mindatetime.round.floor.ceiling.cast.isof.any.all`.split(`.`)),h({"@odata.context":r().url().optional().describe(`Metadata context URL`),"@odata.count":P().int().optional().describe(`Total results count`),"@odata.nextLink":r().url().optional().describe(`Next page URL`),value:C(d(r(),u())).describe(`Results array`)}),h({error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),target:r().optional().describe(`Error target`),details:C(h({code:r(),message:r(),target:r().optional()})).optional().describe(`Error details`),innererror:d(r(),u()).optional().describe(`Inner error details`)})});var Oa=h({namespace:r().describe(`Service namespace`),entityTypes:C(h({name:r().describe(`Entity type name`),key:C(r()).describe(`Key fields`),properties:C(h({name:r(),type:r().describe(`OData type (Edm.String, Edm.Int32, etc.)`),nullable:S().default(!0)})),navigationProperties:C(h({name:r(),type:r(),partner:r().optional()})).optional()})).describe(`Entity types`),entitySets:C(h({name:r().describe(`Entity set name`),entityType:r().describe(`Entity type`)})).describe(`Entity sets`)});h({enabled:S().default(!0).describe(`Enable OData API`),path:r().default(`/odata`).describe(`OData endpoint path`),metadata:Oa.optional().describe(`OData metadata configuration`)}).passthrough(),E([`ID`,`String`,`Int`,`Float`,`Boolean`,`DateTime`,`Date`,`Time`,`JSON`,`JSONObject`,`Upload`,`URL`,`Email`,`PhoneNumber`,`Currency`,`Decimal`,`BigInt`,`Long`,`UUID`,`Base64`,`Void`]);var ka=h({name:r().describe(`GraphQL type name (PascalCase recommended)`),object:r().describe(`Source ObjectQL object name`),description:r().optional().describe(`Type description`),fields:h({include:C(r()).optional().describe(`Fields to include`),exclude:C(r()).optional().describe(`Fields to exclude (e.g., sensitive fields)`),mappings:d(r(),h({graphqlName:r().optional().describe(`Custom GraphQL field name`),graphqlType:r().optional().describe(`Override GraphQL type`),description:r().optional().describe(`Field description`),deprecationReason:r().optional().describe(`Why field is deprecated`),nullable:S().optional().describe(`Override nullable`)})).optional().describe(`Field-level customizations`)}).optional().describe(`Field configuration`),interfaces:C(r()).optional().describe(`GraphQL interface names`),isInterface:S().optional().default(!1).describe(`Define as GraphQL interface`),directives:C(h({name:r().describe(`Directive name`),args:d(r(),u()).optional().describe(`Directive arguments`)})).optional().describe(`GraphQL directives`)}),Aa=h({name:r().describe(`Query field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),type:E([`get`,`list`,`search`]).describe(`Query type`),description:r().optional().describe(`Query description`),args:d(r(),h({type:r().describe(`GraphQL type (e.g., "ID!", "String", "Int")`),description:r().optional().describe(`Argument description`),defaultValue:u().optional().describe(`Default value`)})).optional().describe(`Query arguments`),filtering:h({enabled:S().default(!0).describe(`Allow filtering`),fields:C(r()).optional().describe(`Filterable fields`),operators:C(E([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`notIn`,`contains`,`startsWith`,`endsWith`,`isNull`,`isNotNull`])).optional().describe(`Allowed filter operators`)}).optional().describe(`Filtering capabilities`),sorting:h({enabled:S().default(!0).describe(`Allow sorting`),fields:C(r()).optional().describe(`Sortable fields`),defaultSort:h({field:r(),direction:E([`ASC`,`DESC`])}).optional().describe(`Default sort order`)}).optional().describe(`Sorting capabilities`),pagination:h({enabled:S().default(!0).describe(`Enable pagination`),type:E([`offset`,`cursor`,`relay`]).default(`offset`).describe(`Pagination style`),defaultLimit:P().int().min(1).default(20).describe(`Default page size`),maxLimit:P().int().min(1).default(100).describe(`Maximum page size`),cursors:h({field:r().default(`id`).describe(`Field to use for cursor pagination`)}).optional()}).optional().describe(`Pagination configuration`),fields:h({required:C(r()).optional().describe(`Required fields (always returned)`),selectable:C(r()).optional().describe(`Selectable fields`)}).optional().describe(`Field selection configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),cache:h({enabled:S().default(!1).describe(`Enable caching`),ttl:P().int().min(0).optional().describe(`Cache TTL in seconds`),key:r().optional().describe(`Cache key template`)}).optional().describe(`Query caching`)}),ja=h({name:r().describe(`Mutation field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),type:E([`create`,`update`,`delete`,`upsert`,`custom`]).describe(`Mutation type`),description:r().optional().describe(`Mutation description`),input:h({typeName:r().optional().describe(`Custom input type name`),fields:h({include:C(r()).optional().describe(`Fields to include`),exclude:C(r()).optional().describe(`Fields to exclude`),required:C(r()).optional().describe(`Required input fields`)}).optional().describe(`Input field configuration`),validation:h({enabled:S().default(!0).describe(`Enable input validation`),rules:C(r()).optional().describe(`Custom validation rules`)}).optional().describe(`Input validation`)}).optional().describe(`Input configuration`),output:h({type:E([`object`,`payload`,`boolean`,`custom`]).default(`object`).describe(`Output type`),includeEnvelope:S().optional().default(!1).describe(`Wrap in success/error payload`),customType:r().optional().describe(`Custom output type name`)}).optional().describe(`Output configuration`),transaction:h({enabled:S().default(!0).describe(`Use database transaction`),isolationLevel:E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`]).optional().describe(`Transaction isolation level`)}).optional().describe(`Transaction configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),hooks:h({before:C(r()).optional().describe(`Pre-mutation hooks`),after:C(r()).optional().describe(`Post-mutation hooks`)}).optional().describe(`Lifecycle hooks`)}),Ma=h({name:r().describe(`Subscription field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),events:C(E([`created`,`updated`,`deleted`,`custom`])).describe(`Events to subscribe to`),description:r().optional().describe(`Subscription description`),filter:h({enabled:S().default(!0).describe(`Allow filtering subscriptions`),fields:C(r()).optional().describe(`Filterable fields`)}).optional().describe(`Subscription filtering`),payload:h({includeEntity:S().default(!0).describe(`Include entity in payload`),includePreviousValues:S().optional().default(!1).describe(`Include previous field values`),includeMeta:S().optional().default(!0).describe(`Include metadata (timestamp, user, etc.)`)}).optional().describe(`Payload configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:h({enabled:S().default(!0).describe(`Enable rate limiting`),maxSubscriptionsPerUser:P().int().min(1).default(10).describe(`Max concurrent subscriptions per user`),throttleMs:P().int().min(0).optional().describe(`Throttle interval in milliseconds`)}).optional().describe(`Subscription rate limiting`)}),Na=h({path:r().describe(`Resolver path (Type.field)`),type:E([`datasource`,`computed`,`script`,`proxy`]).describe(`Resolver implementation type`),implementation:h({datasource:r().optional().describe(`Datasource ID`),query:r().optional().describe(`Query/SQL to execute`),expression:r().optional().describe(`Computation expression`),dependencies:C(r()).optional().describe(`Dependent fields`),script:r().optional().describe(`Script ID or inline code`),url:r().optional().describe(`Proxy URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`]).optional().describe(`HTTP method`)}).optional().describe(`Implementation configuration`),cache:h({enabled:S().default(!1).describe(`Enable resolver caching`),ttl:P().int().min(0).optional().describe(`Cache TTL in seconds`),keyArgs:C(r()).optional().describe(`Arguments to include in cache key`)}).optional().describe(`Resolver caching`)}),Pa=h({name:r().describe(`DataLoader name`),source:r().describe(`Source object or datasource`),batchFunction:h({type:E([`findByIds`,`query`,`script`,`custom`]).describe(`Batch function type`),keyField:r().optional().describe(`Field to batch on (e.g., "id")`),query:r().optional().describe(`Query template`),script:r().optional().describe(`Script ID`),maxBatchSize:P().int().min(1).optional().default(100).describe(`Maximum batch size`)}).describe(`Batch function configuration`),cache:h({enabled:S().default(!0).describe(`Enable per-request caching`),keyFn:r().optional().describe(`Custom cache key function`)}).optional().describe(`DataLoader caching`),options:h({batch:S().default(!0).describe(`Enable batching`),cache:S().default(!0).describe(`Enable caching`),maxCacheSize:P().int().min(0).optional().describe(`Max cache entries`)}).optional().describe(`DataLoader options`)}),Fa=E([`QUERY`,`MUTATION`,`SUBSCRIPTION`,`FIELD`,`FRAGMENT_DEFINITION`,`FRAGMENT_SPREAD`,`INLINE_FRAGMENT`,`VARIABLE_DEFINITION`,`SCHEMA`,`SCALAR`,`OBJECT`,`FIELD_DEFINITION`,`ARGUMENT_DEFINITION`,`INTERFACE`,`UNION`,`ENUM`,`ENUM_VALUE`,`INPUT_OBJECT`,`INPUT_FIELD_DEFINITION`]),Ia=h({name:r().regex(/^[a-z][a-zA-Z0-9]*$/).describe(`Directive name (camelCase)`),description:r().optional().describe(`Directive description`),locations:C(Fa).describe(`Directive locations`),args:d(r(),h({type:r().describe(`Argument type`),description:r().optional().describe(`Argument description`),defaultValue:u().optional().describe(`Default value`)})).optional().describe(`Directive arguments`),repeatable:S().optional().default(!1).describe(`Can be applied multiple times`),implementation:h({type:E([`auth`,`validation`,`transform`,`cache`,`deprecation`,`custom`]).describe(`Directive type`),handler:r().optional().describe(`Handler function name or script`)}).optional().describe(`Directive implementation`)}),La=h({enabled:S().default(!0).describe(`Enable query depth limiting`),maxDepth:P().int().min(1).default(10).describe(`Maximum query depth`),ignoreFields:C(r()).optional().describe(`Fields excluded from depth calculation`),onDepthExceeded:E([`reject`,`log`,`warn`]).default(`reject`).describe(`Action when depth exceeded`),errorMessage:r().optional().describe(`Custom error message for depth violations`)}),Ra=h({enabled:S().default(!0).describe(`Enable query complexity limiting`),maxComplexity:P().int().min(1).default(1e3).describe(`Maximum query complexity`),defaultFieldComplexity:P().int().min(0).default(1).describe(`Default complexity per field`),fieldComplexity:d(r(),l([P().int().min(0),h({base:P().int().min(0).describe(`Base complexity`),multiplier:r().optional().describe(`Argument multiplier (e.g., "limit")`),calculator:r().optional().describe(`Custom calculator function`)})])).optional().describe(`Per-field complexity configuration`),listMultiplier:P().min(0).default(10).describe(`Multiplier for list fields`),onComplexityExceeded:E([`reject`,`log`,`warn`]).default(`reject`).describe(`Action when complexity exceeded`),errorMessage:r().optional().describe(`Custom error message for complexity violations`)}),za=h({enabled:S().default(!0).describe(`Enable rate limiting`),strategy:E([`token_bucket`,`fixed_window`,`sliding_window`,`cost_based`]).default(`token_bucket`).describe(`Rate limiting strategy`),global:h({maxRequests:P().int().min(1).default(1e3).describe(`Maximum requests per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`)}).optional().describe(`Global rate limits`),perUser:h({maxRequests:P().int().min(1).default(100).describe(`Maximum requests per user per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`)}).optional().describe(`Per-user rate limits`),costBased:h({enabled:S().default(!1).describe(`Enable cost-based rate limiting`),maxCost:P().int().min(1).default(1e4).describe(`Maximum cost per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`),useComplexityAsCost:S().default(!0).describe(`Use query complexity as cost`)}).optional().describe(`Cost-based rate limiting`),operations:d(r(),h({maxRequests:P().int().min(1).describe(`Max requests for this operation`),windowMs:P().int().min(1e3).describe(`Time window`)})).optional().describe(`Per-operation rate limits`),onLimitExceeded:E([`reject`,`queue`,`log`]).default(`reject`).describe(`Action when rate limit exceeded`),errorMessage:r().optional().describe(`Custom error message for rate limit violations`),includeHeaders:S().default(!0).describe(`Include rate limit headers in response`)}),Ba=h({enabled:S().default(!1).describe(`Enable persisted queries`),mode:E([`optional`,`required`]).default(`optional`).describe(`Persisted query mode (optional: allow both, required: only persisted)`),store:h({type:E([`memory`,`redis`,`database`,`file`]).default(`memory`).describe(`Query store type`),connection:r().optional().describe(`Store connection string or path`),ttl:P().int().min(0).optional().describe(`TTL in seconds for stored queries`)}).optional().describe(`Query store configuration`),apq:h({enabled:S().default(!0).describe(`Enable Automatic Persisted Queries`),hashAlgorithm:E([`sha256`,`sha1`,`md5`]).default(`sha256`).describe(`Hash algorithm for query IDs`),cache:h({ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(1).optional().describe(`Maximum number of cached queries`)}).optional().describe(`APQ cache configuration`)}).optional().describe(`Automatic Persisted Queries configuration`),allowlist:h({enabled:S().default(!1).describe(`Enable query allow list (reject queries not in list)`),queries:C(h({id:r().describe(`Query ID or hash`),operation:r().optional().describe(`Operation name`),query:r().optional().describe(`Query string`)})).optional().describe(`Allowed queries`),source:r().optional().describe(`External allow list source (file path or URL)`)}).optional().describe(`Query allow list configuration`),security:h({maxQuerySize:P().int().min(1).optional().describe(`Maximum query string size in bytes`),rejectIntrospection:S().default(!1).describe(`Reject introspection queries`)}).optional().describe(`Security configuration`)}),Va=h({fields:r().describe(`Selection set of fields composing the entity key`),resolvable:S().optional().default(!0).describe(`Whether entities can be resolved from this subgraph`)}),Ha=h({field:r().describe(`Field name marked as external`),ownerSubgraph:r().optional().describe(`Subgraph that owns this field`)}),Ua=h({field:r().describe(`Field with the requirement`),fields:r().describe(`Selection set of required fields (e.g., "price weight")`)}),Wa=h({field:r().describe(`Field that provides additional entity fields`),fields:r().describe(`Selection set of provided fields (e.g., "name price")`)}),Ga=h({typeName:r().describe(`GraphQL type name for this entity`),keys:C(Va).min(1).describe(`Entity key definitions`),externalFields:C(Ha).optional().describe(`Fields owned by other subgraphs`),requires:C(Ua).optional().describe(`Required external fields for computed fields`),provides:C(Wa).optional().describe(`Fields provided during resolution`),owner:S().optional().default(!1).describe(`Whether this subgraph is the owner of this entity`)}),Ka=h({name:r().describe(`Unique subgraph identifier`),url:r().describe(`Subgraph endpoint URL`),schemaSource:E([`introspection`,`file`,`registry`]).default(`introspection`).describe(`How to obtain the subgraph schema`),schemaPath:r().optional().describe(`Path to schema file (SDL format)`),entities:C(Ga).optional().describe(`Entity definitions for this subgraph`),healthCheck:h({enabled:S().default(!0).describe(`Enable health checking`),path:r().default(`/health`).describe(`Health check endpoint path`),intervalMs:P().int().min(1e3).default(3e4).describe(`Health check interval in milliseconds`)}).optional().describe(`Subgraph health check configuration`),forwardHeaders:C(r()).optional().describe(`HTTP headers to forward to this subgraph`)}),qa=h({enabled:S().default(!1).describe(`Enable GraphQL Federation gateway mode`),version:E([`v1`,`v2`]).default(`v2`).describe(`Federation specification version`),subgraphs:C(Ka).describe(`Subgraph configurations`),serviceDiscovery:h({type:E([`static`,`dns`,`consul`,`kubernetes`]).default(`static`).describe(`Service discovery method`),pollIntervalMs:P().int().min(1e3).optional().describe(`Discovery poll interval in milliseconds`),namespace:r().optional().describe(`Kubernetes namespace for subgraph discovery`)}).optional().describe(`Service discovery configuration`),queryPlanning:h({strategy:E([`parallel`,`sequential`,`adaptive`]).default(`parallel`).describe(`Query execution strategy across subgraphs`),maxDepth:P().int().min(1).optional().describe(`Max query depth in federated execution`),dryRun:S().optional().default(!1).describe(`Log query plans without executing`)}).optional().describe(`Query planning configuration`),composition:h({conflictResolution:E([`error`,`first_wins`,`last_wins`]).default(`error`).describe(`Strategy for resolving schema conflicts`),validate:S().default(!0).describe(`Validate composed supergraph schema`)}).optional().describe(`Schema composition configuration`),errorHandling:h({includeSubgraphName:S().default(!1).describe(`Include subgraph name in error responses`),partialErrors:E([`propagate`,`nullify`,`reject`]).default(`propagate`).describe(`Behavior when a subgraph returns partial errors`)}).optional().describe(`Error handling configuration`)}),Ja=h({enabled:S().default(!0).describe(`Enable GraphQL API`),path:r().default(`/graphql`).describe(`GraphQL endpoint path`),playground:h({enabled:S().default(!0).describe(`Enable GraphQL Playground`),path:r().default(`/playground`).describe(`Playground path`)}).optional().describe(`GraphQL Playground configuration`),schema:h({autoGenerateTypes:S().default(!0).describe(`Auto-generate types from Objects`),types:C(ka).optional().describe(`Type configurations`),queries:C(Aa).optional().describe(`Query configurations`),mutations:C(ja).optional().describe(`Mutation configurations`),subscriptions:C(Ma).optional().describe(`Subscription configurations`),resolvers:C(Na).optional().describe(`Custom resolver configurations`),directives:C(Ia).optional().describe(`Custom directive configurations`)}).optional().describe(`Schema generation configuration`),dataLoaders:C(Pa).optional().describe(`DataLoader configurations`),security:h({depthLimit:La.optional().describe(`Query depth limiting`),complexity:Ra.optional().describe(`Query complexity calculation`),rateLimit:za.optional().describe(`Rate limiting`),persistedQueries:Ba.optional().describe(`Persisted queries`)}).optional().describe(`Security configuration`),federation:qa.optional().describe(`GraphQL Federation gateway configuration`)});Object.assign(Ja,{create:e=>e});var Ya=E([`create`,`update`,`upsert`,`delete`]),Xa=h({id:r().optional().describe(`Record ID (required for update/delete)`),data:Hi.optional().describe(`Record data (required for create/update/upsert)`),externalId:r().optional().describe(`External ID for upsert matching`)}),Za=h({atomic:S().optional().default(!0).describe(`If true, rollback entire batch on any failure (transaction mode)`),returnRecords:S().optional().default(!1).describe(`If true, return full record data in response`),continueOnError:S().optional().default(!1).describe(`If true (and atomic=false), continue processing remaining records after errors`),validateOnly:S().optional().default(!1).describe(`If true, validate records without persisting changes (dry-run mode)`)}),Qa=h({operation:Ya.describe(`Type of batch operation`),records:C(Xa).min(1).max(200).describe(`Array of records to process (max 200 per batch)`),options:Za.optional().describe(`Batch operation options`)});h({records:C(Xa).min(1).max(200).describe(`Array of records to update (max 200 per batch)`),options:Za.optional().describe(`Update options`)});var $a=h({id:r().optional().describe(`Record ID if operation succeeded`),success:S().describe(`Whether this record was processed successfully`),errors:C(Vi).optional().describe(`Array of errors if operation failed`),data:Hi.optional().describe(`Full record data (if returnRecords=true)`),index:P().optional().describe(`Index of the record in the request array`)});R.extend({operation:Ya.optional().describe(`Operation type that was performed`),total:P().describe(`Total number of records in the batch`),succeeded:P().describe(`Number of records that succeeded`),failed:P().describe(`Number of records that failed`),results:C($a).describe(`Detailed results for each record`)}),h({ids:C(r()).min(1).max(200).describe(`Array of record IDs to delete (max 200)`),options:Za.optional().describe(`Delete options`)}),h({enabled:S().default(!0).describe(`Enable batch operations`),maxRecordsPerBatch:P().int().min(1).max(1e3).default(200).describe(`Maximum records per batch`),defaultOptions:Za.optional().describe(`Default batch options`)}).passthrough();var eo=h({directives:C(E([`public`,`private`,`no-cache`,`no-store`,`must-revalidate`,`max-age`])).describe(`Cache control directives`),maxAge:P().optional().describe(`Maximum cache age in seconds`),staleWhileRevalidate:P().optional().describe(`Allow serving stale content while revalidating (seconds)`),staleIfError:P().optional().describe(`Allow serving stale content on error (seconds)`)}),to=h({value:r().describe(`ETag value (hash or version identifier)`),weak:S().optional().default(!1).describe(`Whether this is a weak ETag`)}),no=h({ifNoneMatch:r().optional().describe(`ETag value for conditional request (If-None-Match header)`),ifModifiedSince:r().datetime().optional().describe(`Timestamp for conditional request (If-Modified-Since header)`),cacheControl:eo.optional().describe(`Client cache control preferences`)});h({data:u().optional().describe(`Metadata payload (omitted for 304 Not Modified)`),etag:to.optional().describe(`ETag for this resource version`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),cacheControl:eo.optional().describe(`Cache control directives`),notModified:S().optional().default(!1).describe(`True if resource has not been modified (304 response)`),version:r().optional().describe(`Metadata version identifier`)}),h({target:E([`all`,`object`,`field`,`permission`,`layout`,`custom`]).describe(`What to invalidate`),identifiers:C(r()).optional().describe(`Specific resources to invalidate (e.g., object names)`),cascade:S().optional().default(!1).describe(`If true, invalidate dependent resources`),pattern:r().optional().describe(`Pattern for custom invalidation (supports wildcards)`)}),h({success:S().describe(`Whether invalidation succeeded`),invalidated:P().describe(`Number of cache entries invalidated`),targets:C(r()).optional().describe(`List of invalidated resources`)});var ro=E([`validation`,`authentication`,`authorization`,`not_found`,`conflict`,`rate_limit`,`server`,`external`,`maintenance`]),io=E(`validation_error.invalid_field.missing_required_field.invalid_format.value_too_long.value_too_short.value_out_of_range.invalid_reference.duplicate_value.invalid_query.invalid_filter.invalid_sort.max_records_exceeded.unauthenticated.invalid_credentials.expired_token.invalid_token.session_expired.mfa_required.email_not_verified.permission_denied.insufficient_privileges.field_not_accessible.record_not_accessible.license_required.ip_restricted.time_restricted.resource_not_found.object_not_found.record_not_found.field_not_found.endpoint_not_found.resource_conflict.concurrent_modification.delete_restricted.duplicate_record.lock_conflict.rate_limit_exceeded.quota_exceeded.concurrent_limit_exceeded.internal_error.database_error.timeout.service_unavailable.not_implemented.external_service_error.integration_error.webhook_delivery_failed.batch_partial_failure.batch_complete_failure.transaction_failed`.split(`.`)),ao=E([`no_retry`,`retry_immediate`,`retry_backoff`,`retry_after`]),oo=h({field:r().describe(`Field path (supports dot notation)`),code:io.describe(`Error code for this field`),message:r().describe(`Human-readable error message`),value:u().optional().describe(`The invalid value that was provided`),constraint:u().optional().describe(`The constraint that was violated (e.g., max length)`)}),so=h({code:io.describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),category:ro.optional().describe(`Error category`),httpStatus:P().optional().describe(`HTTP status code`),retryable:S().default(!1).describe(`Whether the request can be retried`),retryStrategy:ao.optional().describe(`Recommended retry strategy`),retryAfter:P().optional().describe(`Seconds to wait before retrying`),details:u().optional().describe(`Additional error context`),fieldErrors:C(oo).optional().describe(`Field-specific validation errors`),timestamp:r().datetime().optional().describe(`When the error occurred`),requestId:r().optional().describe(`Request ID for tracking`),traceId:r().optional().describe(`Distributed trace ID`),documentation:r().url().optional().describe(`URL to error documentation`),helpText:r().optional().describe(`Suggested actions to resolve the error`)});h({success:m(!1).describe(`Always false for error responses`),error:so.describe(`Error details`),meta:h({timestamp:r().datetime().optional(),requestId:r().optional(),traceId:r().optional()}).optional().describe(`Response metadata`)}),h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var co=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),lo=h({ariaLabel:co.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var uo=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),fo=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:uo.optional().describe(`Default number formatting rules`),dateFormat:fo.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var po=h({enabled:S().default(!1).describe(`Enable public sharing`),publicLink:r().optional().describe(`Generated public share URL`),password:r().optional().describe(`Password required to access shared link`),allowedDomains:C(r()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:r().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:S().optional().default(!1).describe(`Allow access without authentication`)}),mo=h({enabled:S().default(!1).describe(`Enable iframe embedding`),allowedOrigins:C(r()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:r().optional().default(`100%`).describe(`Embed width (CSS value)`),height:r().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:S().optional().default(!0).describe(`Show interface header in embed`),showNavigation:S().optional().default(!1).describe(`Show navigation in embed`),responsive:S().optional().default(!0).describe(`Enable responsive resizing`)}),ho=E([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),go=h({xs:P().min(1).max(12).optional(),sm:P().min(1).max(12).optional(),md:P().min(1).max(12).optional(),lg:P().min(1).max(12).optional(),xl:P().min(1).max(12).optional(),"2xl":P().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),_o=h({xs:P().optional(),sm:P().optional(),md:P().optional(),lg:P().optional(),xl:P().optional(),"2xl":P().optional()}).describe(`Display order per breakpoint`),vo=h({breakpoint:ho.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:C(ho).optional().describe(`Hide on these breakpoints`),columns:go.optional().describe(`Grid columns per breakpoint`),order:_o.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),yo=h({lazyLoad:S().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:h({enabled:S().default(!1).describe(`Enable virtual scrolling`),itemHeight:P().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:P().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:E([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:S().optional().describe(`Prefetch data before component is visible`),pageSize:P().optional().describe(`Number of items per page for pagination`),debounceMs:P().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),bo=I(`provider`,[h({provider:m(`object`),object:r().describe(`Target object name`)}),h({provider:m(`api`),read:Ji.optional().describe(`Configuration for fetching data`),write:Ji.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),h({provider:m(`value`),items:C(u()).describe(`Static data array`)})]),xo=h({field:r().describe(`Field name to filter on`),operator:r().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),So=E([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),Co=h({field:r().describe(`Field name (snake_case)`),label:co.optional().describe(`Display label override`),width:P().positive().optional().describe(`Column width in pixels`),align:E([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:S().optional().describe(`Hide column by default`),sortable:S().optional().describe(`Allow sorting by this column`),resizable:S().optional().describe(`Allow resizing this column`),wrap:S().optional().describe(`Allow text wrapping`),type:r().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:E([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:So.optional().describe(`Footer aggregation function for this column`),link:S().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:r().optional().describe(`Registered Action ID to execute when clicked`)}),wo=h({type:E([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),To=h({pageSize:P().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:C(P().int().positive()).optional().describe(`Available page size options`)}),Eo=E([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),Do=h({fields:C(h({field:r().describe(`Field name to group by`),order:E([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:S().default(!1).describe(`Collapse groups by default`)})).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),Oo=h({coverField:r().optional().describe(`Attachment/image field to display as card cover`),coverFit:E([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:E([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:r().optional().describe(`Field to display as card title`),visibleFields:C(r()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),ko=h({startDateField:r().describe(`Field for timeline item start date`),endDateField:r().optional().describe(`Field for timeline item end date`),titleField:r().describe(`Field to display as timeline item title`),groupByField:r().optional().describe(`Field to group timeline rows`),colorField:r().optional().describe(`Field to determine item color`),scale:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),Ao=h({type:E([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:r().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),jo=h({field:r().describe(`Field to derive color from (typically a select/status field)`),colors:d(r(),r()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),Mo=E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),No=h({sort:S().default(!0).describe(`Allow users to sort records`),search:S().default(!0).describe(`Allow users to search records`),filter:S().default(!0).describe(`Allow users to filter records`),rowHeight:S().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:S().default(!1).describe(`Add records through a form instead of inline`),buttons:C(r()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),Po=h({showDescription:S().default(!0).describe(`Show the view description text`),allowedVisualizations:C(Mo).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),Fo=h({name:pa.describe(`Tab identifier (snake_case)`),label:co.optional().describe(`Display label`),icon:r().optional().describe(`Tab icon name`),view:r().optional().describe(`Referenced list view name from listViews`),filter:C(xo).optional().describe(`Tab-specific filter criteria`),order:P().int().min(0).optional().describe(`Tab display order`),pinned:S().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:S().default(!1).describe(`Set as the default active tab`),visible:S().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),Io=h({enabled:S().default(!0).describe(`Show the add record entry point`),position:E([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:E([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:r().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),Lo=h({groupByField:r().describe(`Field to group columns by (usually status/select)`),summarizeField:r().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:C(r()).describe(`Fields to show on cards`)}),Ro=h({startDateField:r(),endDateField:r().optional(),titleField:r(),colorField:r().optional()}),zo=h({startDateField:r(),endDateField:r(),titleField:r(),progressField:r().optional(),dependenciesField:r().optional()}),Bo=h({mode:E([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]).default(`page`),view:r().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:S().default(!1).describe(`Disable standard navigation entirely`),openNewTab:S().default(!1).describe(`Force open in new tab (applies to page mode)`),width:l([r(),P()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),Vo=h({name:pa.optional().describe(`Internal view name (lowercase snake_case)`),label:co.optional(),type:E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:bo.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:l([C(r()),C(Co)]).describe(`Fields to display as columns`),filter:C(xo).optional().describe(`Filter criteria (JSON Rules)`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional(),searchableFields:C(r()).optional().describe(`Fields enabled for search`),filterableFields:C(r()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:C(h({field:r().describe(`Field name to filter by`),label:r().optional().describe(`Display label for the chip`),operator:E([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:S().optional().describe(`Enable column resizing`),striped:S().optional().describe(`Striped row styling`),bordered:S().optional().describe(`Show borders`),selection:wo.optional().describe(`Row selection configuration`),navigation:Bo.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:To.optional().describe(`Pagination configuration`),kanban:Lo.optional(),calendar:Ro.optional(),gantt:zo.optional(),gallery:Oo.optional(),timeline:ko.optional(),description:co.optional().describe(`View description for documentation/tooltips`),sharing:Ao.optional().describe(`View sharing and access configuration`),rowHeight:Eo.optional().describe(`Row height / density setting`),grouping:Do.optional().describe(`Group records by one or more fields`),rowColor:jo.optional().describe(`Color rows based on field value`),hiddenFields:C(r()).optional().describe(`Fields to hide in this specific view`),fieldOrder:C(r()).optional().describe(`Explicit field display order for this view`),rowActions:C(r()).optional().describe(`Actions available for individual row items`),bulkActions:C(r()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:S().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:C(h({condition:r().describe(`Condition expression to evaluate`),style:d(r(),r()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:S().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:C(E([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:No.optional().describe(`User action toggles for the view toolbar`),appearance:Po.optional().describe(`Appearance and visualization configuration`),tabs:C(Fo).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:Io.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at the bottom of the list`),allowPrinting:S().optional().describe(`Allow users to print the view`),emptyState:h({title:co.optional(),message:co.optional(),icon:r().optional()}).optional().describe(`Empty state configuration when no records found`),aria:lo.optional().describe(`ARIA accessibility attributes for the list view`),responsive:vo.optional().describe(`Responsive layout configuration`),performance:yo.optional().describe(`Performance optimization settings`)}),Ho=h({field:r().describe(`Field name (snake_case)`),label:co.optional().describe(`Display label override`),placeholder:co.optional().describe(`Placeholder text`),helpText:co.optional().describe(`Help/hint text`),readonly:S().optional().describe(`Read-only override`),required:S().optional().describe(`Required override`),hidden:S().optional().describe(`Hidden override`),colSpan:P().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:r().optional().describe(`Custom widget/component name`),dependsOn:r().optional().describe(`Parent field name for cascading`),visibleOn:r().optional().describe(`Visibility condition expression`)}),Uo=h({label:co.optional(),collapsible:S().default(!1),collapsed:S().default(!1),columns:E([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:C(l([r(),Ho]))}),Wo=h({type:E([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:bo.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:C(Uo).optional(),groups:C(Uo).optional(),defaultSort:C(h({field:r().describe(`Field name to sort by`),order:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:po.optional().describe(`Public sharing configuration for this form`),aria:lo.optional().describe(`ARIA accessibility attributes for the form view`)}),Go=h({list:Vo.optional(),form:Wo.optional(),listViews:d(r(),Vo).optional().describe(`Additional named list views`),formViews:d(r(),Wo).optional().describe(`Additional named form views`)}),Ko=E([`select`,`insert`,`update`,`delete`,`all`]),qo=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy unique identifier (snake_case)`),label:r().optional().describe(`Human-readable policy label`),description:r().optional().describe(`Policy description and business justification`),object:r().describe(`Target object name`),operation:Ko.describe(`Database operation this policy applies to`),using:r().optional().describe(`Filter condition for SELECT/UPDATE/DELETE (PostgreSQL SQL WHERE clause syntax with parameterized context variables). Optional for INSERT-only policies.`),check:r().optional().describe(`Validation condition for INSERT/UPDATE (defaults to USING clause if not specified - enforced at application level)`),roles:C(r()).optional().describe(`Roles this policy applies to (omit for all roles)`),enabled:S().default(!0).describe(`Whether this policy is active`),priority:P().int().default(0).describe(`Policy evaluation priority (higher = evaluated first)`),tags:C(r()).optional().describe(`Policy categorization tags`)}).superRefine((e,t)=>{!e.using&&!e.check&&t.addIssue({code:de.custom,message:`At least one of "using" or "check" must be specified. For SELECT/UPDATE/DELETE operations, provide "using". For INSERT operations, provide "check".`})});h({timestamp:r().describe(`ISO 8601 timestamp of the evaluation`),userId:r().describe(`User ID whose access was evaluated`),operation:E([`select`,`insert`,`update`,`delete`]).describe(`Database operation being performed`),object:r().describe(`Target object name`),policyName:r().describe(`Name of the RLS policy evaluated`),granted:S().describe(`Whether access was granted`),evaluationDurationMs:P().describe(`Policy evaluation duration in milliseconds`),matchedCondition:r().optional().describe(`Which USING/CHECK clause matched`),rowCount:P().optional().describe(`Number of rows affected`),metadata:d(r(),u()).optional().describe(`Additional audit event metadata`)});var Jo=h({enabled:S().describe(`Enable RLS audit logging`),logLevel:E([`all`,`denied_only`,`granted_only`,`none`]).describe(`Which evaluations to log`),destination:E([`system_log`,`audit_trail`,`external`]).describe(`Audit log destination`),sampleRate:P().min(0).max(1).describe(`Sampling rate (0-1) for high-traffic environments`),retentionDays:P().int().default(90).describe(`Audit log retention period in days`),includeRowData:S().default(!1).describe(`Include row data in audit logs (security-sensitive)`),alertOnDenied:S().default(!0).describe(`Send alerts when access is denied`)});h({enabled:S().default(!0).describe(`Enable RLS enforcement globally`),defaultPolicy:E([`deny`,`allow`]).default(`deny`).describe(`Default action when no policies match`),allowSuperuserBypass:S().default(!0).describe(`Allow superusers to bypass RLS`),bypassRoles:C(r()).optional().describe(`Roles that bypass RLS (see all data)`),logEvaluations:S().default(!1).describe(`Log RLS policy evaluations for debugging`),cacheResults:S().default(!0).describe(`Cache RLS evaluation results`),cacheTtlSeconds:P().int().positive().default(300).describe(`Cache TTL in seconds`),prefetchUserContext:S().default(!0).describe(`Pre-fetch user context for performance`),audit:Jo.optional().describe(`RLS audit logging configuration`)}),h({id:r().describe(`User ID`),email:r().email().optional().describe(`User email`),tenantId:r().optional().describe(`Tenant/Organization ID`),role:l([r(),C(r())]).optional().describe(`User role(s)`),department:r().optional().describe(`User department`),attributes:d(r(),u()).optional().describe(`Additional custom user attributes`)}),h({policyName:r().describe(`Policy name`),granted:S().describe(`Whether access was granted`),durationMs:P().optional().describe(`Evaluation duration in milliseconds`),error:r().optional().describe(`Error message if evaluation failed`),usingResult:S().optional().describe(`USING clause evaluation result`),checkResult:S().optional().describe(`CHECK clause evaluation result`)});var Yo=h({allowCreate:S().default(!1).describe(`Create permission`),allowRead:S().default(!1).describe(`Read permission`),allowEdit:S().default(!1).describe(`Edit permission`),allowDelete:S().default(!1).describe(`Delete permission`),allowTransfer:S().default(!1).describe(`Change record ownership`),allowRestore:S().default(!1).describe(`Restore from trash (Undelete)`),allowPurge:S().default(!1).describe(`Permanently delete (Hard Delete/GDPR)`),viewAllRecords:S().default(!1).describe(`View All Data (Bypass Sharing)`),modifyAllRecords:S().default(!1).describe(`Modify All Data (Bypass Sharing)`)}),Xo=h({readable:S().default(!0).describe(`Field read access`),editable:S().default(!1).describe(`Field edit access`)});h({name:pa.describe(`Permission set unique name (lowercase snake_case)`),label:r().optional().describe(`Display label`),isProfile:S().default(!1).describe(`Whether this is a user profile`),objects:d(r(),Yo).describe(`Entity permissions`),fields:d(r(),Xo).optional().describe(`Field level security`),systemPermissions:C(r()).optional().describe(`System level capabilities`),tabPermissions:d(r(),E([`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:C(qo).optional().describe(`Row-level security policies (see rls.zod.ts for full spec)`),contextVariables:d(r(),u()).optional().describe(`Context variables for RLS evaluation`)});var Zo=E([`on_create`,`on_update`,`on_create_or_update`,`on_delete`,`schedule`]),Qo=h({name:r().describe(`Action name`),type:m(`field_update`),field:r().describe(`Field to update`),value:u().describe(`Value or Formula to set`)}),$o=h({name:r().describe(`Action name`),type:m(`email_alert`),template:r().describe(`Email template ID/DevName`),recipients:C(r()).describe(`List of recipient emails or user IDs`)}),es=h({name:r().describe(`Action name`),type:m(`connector_action`),connectorId:r().describe(`Target Connector ID (e.g. slack, twilio)`),actionId:r().describe(`Target Action ID (e.g. send_message)`),input:d(r(),u()).describe(`Input parameters matching the action schema`)}),ts=I(`type`,[Qo,$o,h({name:r().describe(`Action name`),type:m(`http_call`),url:r().describe(`Target URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`]).default(`POST`).describe(`HTTP Method`),headers:d(r(),r()).optional().describe(`HTTP Headers`),body:r().optional().describe(`Request body (JSON or text)`)}),es,h({name:r().describe(`Action name`),type:m(`task_creation`),taskObject:r().describe(`Task object name (e.g., "task", "project_task")`),subject:r().describe(`Task subject/title`),description:r().optional().describe(`Task description`),assignedTo:r().optional().describe(`User ID or field reference for assignee`),dueDate:r().optional().describe(`Due date (ISO string or formula)`),priority:r().optional().describe(`Task priority`),relatedTo:r().optional().describe(`Related record ID or field reference`),additionalFields:d(r(),u()).optional().describe(`Additional custom fields`)}),h({name:r().describe(`Action name`),type:m(`push_notification`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),recipients:C(r()).describe(`User IDs or device tokens`),data:d(r(),u()).optional().describe(`Additional data payload`),badge:P().optional().describe(`Badge count (iOS)`),sound:r().optional().describe(`Notification sound`),clickAction:r().optional().describe(`Action/URL when notification is clicked`)}),h({name:r().describe(`Action name`),type:m(`custom_script`),language:E([`javascript`,`typescript`,`python`]).default(`javascript`).describe(`Script language`),code:r().describe(`Script code to execute`),timeout:P().default(3e4).describe(`Execution timeout in milliseconds`),context:d(r(),u()).optional().describe(`Additional context variables`)})]),ns=h({id:r().optional().describe(`Unique identifier`),timeLength:P().int().describe(`Duration amount (e.g. 1, 30)`),timeUnit:E([`minutes`,`hours`,`days`]).describe(`Unit of time`),offsetDirection:E([`before`,`after`]).describe(`Before or After the reference date`),offsetFrom:E([`trigger_date`,`date_field`]).describe(`Basis for calculation`),dateField:r().optional().describe(`Date field to calculate from (required if offsetFrom is date_field)`),actions:C(ts).describe(`Actions to execute at the scheduled time`)}),rs=h({name:pa.describe(`Unique workflow name (lowercase snake_case)`),objectName:r().describe(`Target Object`),triggerType:Zo.describe(`When to evaluate`),criteria:r().optional().describe(`Formula condition. If TRUE, actions execute.`),actions:C(ts).optional().describe(`Immediate actions`),timeTriggers:C(ns).optional().describe(`Scheduled actions relative to trigger or date field`),active:S().default(!0).describe(`Whether this workflow is active`),executionOrder:P().int().min(0).default(100).describe(`Deterministic execution order when multiple workflows match (lower runs first)`),reevaluateOnChange:S().default(!1).describe(`Re-evaluate rule if field updates change the record validity`)}),is=r().describe(`BCP-47 Language Tag (e.g. en-US, zh-CN)`),as=h({label:r().optional().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),placeholder:r().optional().describe(`Translated placeholder text for form inputs`),options:d(r(),r()).optional().describe(`Option value to translated label map`)}).describe(`Translation data for a single field`),os=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),fields:d(r(),as).optional().describe(`Field-level translations`)}).describe(`Translation data for a single object`),ss=h({objects:d(r(),os).optional().describe(`Object translations keyed by object name`),apps:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID`),validationMessages:d(r(),r()).optional().describe(`Translatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})`)}).describe(`Translation data for objects, apps, and UI messages`);d(is,ss).describe(`Map of locale codes to translation data`);var cs=E([`bundled`,`per_locale`,`per_namespace`]).describe(`Translation file organization strategy`),ls=E([`icu`,`simple`]).describe(`Message interpolation format: ICU MessageFormat or simple {variable} replacement`);h({defaultLocale:is.describe(`Default locale (e.g., "en")`),supportedLocales:C(is).describe(`Supported BCP-47 locale codes`),fallbackLocale:is.optional().describe(`Fallback locale code`),fileOrganization:cs.default(`per_locale`).describe(`File organization strategy`),messageFormat:ls.default(`simple`).describe(`Message interpolation format (ICU MessageFormat or simple)`),lazyLoad:S().default(!1).describe(`Load translations on demand`),cache:S().default(!0).describe(`Cache loaded translations`)}).describe(`Internationalization configuration`);var us=d(r(),r()).describe(`Option value to translated label map`),ds=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),description:r().optional().describe(`Translated object description`),helpText:r().optional().describe(`Translated help text for the object`),fields:d(r(),as).optional().describe(`Field translations keyed by field name`),_options:d(r(),us).optional().describe(`Object-scoped picklist option translations keyed by field name`),_views:d(r(),h({label:r().optional().describe(`Translated view label`),description:r().optional().describe(`Translated view description`)})).optional().describe(`View translations keyed by view name`),_sections:d(r(),h({label:r().optional().describe(`Translated section label`)})).optional().describe(`Section translations keyed by section name`),_actions:d(r(),h({label:r().optional().describe(`Translated action label`),confirmMessage:r().optional().describe(`Translated confirmation message`)})).optional().describe(`Action translations keyed by action name`),_notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Notification translations keyed by notification name`),_errors:d(r(),r()).optional().describe(`Error message translations keyed by error code`)}).describe(`Object-first aggregated translation node`);h({_meta:h({locale:r().optional().describe(`BCP-47 locale code for this bundle`),direction:E([`ltr`,`rtl`]).optional().describe(`Text direction: left-to-right or right-to-left`)}).optional().describe(`Bundle-level metadata (locale, bidi direction)`),namespace:r().optional().describe(`Namespace for plugin isolation to avoid translation key collisions`),o:d(r(),ds).optional().describe(`Object-first translations keyed by object name`),_globalOptions:d(r(),us).optional().describe(`Global picklist option translations keyed by option set name`),app:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),nav:d(r(),r()).optional().describe(`Navigation item translations keyed by nav item name`),dashboard:d(r(),h({label:r().optional().describe(`Translated dashboard label`),description:r().optional().describe(`Translated dashboard description`)})).optional().describe(`Dashboard translations keyed by dashboard name`),reports:d(r(),h({label:r().optional().describe(`Translated report label`),description:r().optional().describe(`Translated report description`)})).optional().describe(`Report translations keyed by report name`),pages:d(r(),h({title:r().optional().describe(`Translated page title`),description:r().optional().describe(`Translated page description`)})).optional().describe(`Page translations keyed by page name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID (supports ICU MessageFormat)`),validationMessages:d(r(),r()).optional().describe(`Validation error message translations keyed by rule name (supports ICU MessageFormat)`),notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Global notification translations keyed by notification name`),errors:d(r(),r()).optional().describe(`Global error message translations keyed by error code`)}).describe(`Object-first application translation bundle for a single locale`);var fs=E([`missing`,`redundant`,`stale`]).describe(`Translation diff status: missing from bundle, redundant (no matching metadata), or stale (metadata changed)`),ps=h({key:r().describe(`Dot-path translation key`),status:fs.describe(`Diff status of this translation key`),objectName:r().optional().describe(`Associated object name (snake_case)`),locale:r().describe(`BCP-47 locale code`),sourceHash:r().optional().describe(`Hash of source metadata for precise stale detection`),aiSuggested:r().optional().describe(`AI-suggested translation for this key`),aiConfidence:P().min(0).max(1).optional().describe(`AI suggestion confidence score (0–1)`)}).describe(`A single translation diff item`),mee=h({group:r().describe(`Translation group category`),totalKeys:P().int().nonnegative().describe(`Total keys in this group`),translatedKeys:P().int().nonnegative().describe(`Translated keys in this group`),coveragePercent:P().min(0).max(100).describe(`Coverage percentage for this group`)}).describe(`Coverage breakdown for a single translation group`);h({locale:r().describe(`BCP-47 locale code`),objectName:r().optional().describe(`Object name scope (omit for full bundle)`),totalKeys:P().int().nonnegative().describe(`Total translatable keys from metadata`),translatedKeys:P().int().nonnegative().describe(`Number of translated keys`),missingKeys:P().int().nonnegative().describe(`Number of missing translations`),redundantKeys:P().int().nonnegative().describe(`Number of redundant translations`),staleKeys:P().int().nonnegative().describe(`Number of stale translations`),coveragePercent:P().min(0).max(100).describe(`Translation coverage percentage`),items:C(ps).describe(`Detailed diff items`),breakdown:C(mee).optional().describe(`Per-group coverage breakdown`)}).describe(`Aggregated translation coverage result`);var ms=E([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),hs=h({major:P().int().min(0),minor:P().int().min(0),patch:P().int().min(0)}).describe(`Semantic version of the protocol`),gs=h({id:r().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:r(),version:hs,specification:r().optional().describe(`URL or path to protocol specification`),description:r().optional()}),_s=h({name:r().describe(`Feature identifier within the protocol`),enabled:S().default(!0),description:r().optional(),sinceVersion:r().optional().describe(`Version when this feature was added`),deprecatedSince:r().optional().describe(`Version when deprecated`)}),vs=h({protocol:gs,conformance:ms.default(`full`),implementedFeatures:C(r()).optional().describe(`List of implemented feature names`),features:C(_s).optional(),metadata:d(r(),u()).optional(),certified:S().default(!1).describe(`Has passed official conformance tests`),certificationDate:r().datetime().optional()}),ys=h({id:r().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:r(),description:r().optional(),version:hs,methods:C(h({name:r().describe(`Method name`),description:r().optional(),parameters:C(h({name:r(),type:r().describe(`Type notation (e.g., string, number, User)`),required:S().default(!0),description:r().optional()})).optional(),returnType:r().optional().describe(`Return value type`),async:S().default(!1).describe(`Whether method returns a Promise`)})),events:C(h({name:r().describe(`Event name`),description:r().optional(),payload:r().optional().describe(`Event payload type`)})).optional(),stability:E([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),hee=h({pluginId:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:r().describe(`Semantic version constraint`),optional:S().default(!1),reason:r().optional(),requiredCapabilities:C(r()).optional().describe(`Protocol IDs the dependency must support`)}),bs=h({id:r().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:r(),description:r().optional(),type:E([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:h({input:r().optional().describe(`Input type/schema`),output:r().optional().describe(`Output type/schema`),signature:r().optional().describe(`Function signature if applicable`)}).optional(),cardinality:E([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),xs=h({implements:C(vs).optional().describe(`List of protocols this plugin conforms to`),provides:C(ys).optional().describe(`Services/APIs this plugin offers to others`),requires:C(hee).optional().describe(`Required plugins and their capabilities`),extensionPoints:C(bs).optional().describe(`Points where other plugins can extend this plugin`),extensions:C(h({targetPluginId:r().describe(`Plugin ID being extended`),extensionPointId:r().describe(`Extension point identifier`),implementation:r().describe(`Path to implementation module`),priority:P().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),Ss=E([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),Cs=h({enabled:S().default(!1),priority:P().int().min(0).default(100),resources:C(E([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:h({routes:C(r()).optional(),roles:C(r()).optional(),deviceType:C(E([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:E([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),ws=h({enabled:S().default(!0),strategy:E([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:E([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:P().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:h({enabled:S().default(!0),minChunks:P().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),Ts=h({enabled:S().default(!0),mode:E([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:S().default(!1).describe(`Prefetch module in idle time`),preload:S().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:r().optional().describe(`Custom chunk name for webpack`),timeout:P().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:h({enabled:S().default(!0),maxAttempts:P().int().min(1).max(10).default(3),backoffMs:P().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),Es=h({mode:E([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:P().int().min(100).default(3e4),priority:P().int().min(0).default(100),critical:S().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:h({enabled:S().default(!1),maxAttempts:P().int().min(1).max(5).default(3),backoffMs:P().int().min(0).default(1e3)}).optional(),healthCheckInterval:P().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),Ds=h({strategy:E([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:h({resolve:S().default(!0),onMissing:E([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:E([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:h({load:S().default(!0),onFailure:E([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:E([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:E([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),Os=h({enabled:S().default(!1),environment:E([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:E([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:C(r()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:C(r()).optional().describe(`Glob patterns for files to ignore`),debounceMs:P().int().min(0).default(300),preserveState:S().default(!1),stateSerialization:h({enabled:S().default(!1),handler:r().optional()}).optional(),hooks:h({beforeReload:r().optional().describe(`Function to call before reload`),afterReload:r().optional().describe(`Function to call after reload`),onError:r().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:h({healthValidation:S().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:S().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:P().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:S().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:P().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:P().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:P().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),ks=h({enabled:S().default(!0),storage:E([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:E([`version`,`hash`,`timestamp`]).default(`version`),ttl:P().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:P().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:C(E([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:h({enabled:S().default(!1),algorithm:E([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),As=h({enabled:S().default(!1),scope:E([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:E([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:C(r()).optional().describe(`List of allowed capability IDs`),resourceQuotas:h({maxMemoryMB:P().int().min(1).optional(),maxCpuTimeMs:P().int().min(100).optional(),maxFileDescriptors:P().int().min(1).optional(),maxNetworkKBps:P().int().min(1).optional()}).optional(),permissions:h({allowedAPIs:C(r()).optional(),allowedPaths:C(r()).optional(),allowedEndpoints:C(r()).optional(),allowedEnvVars:C(r()).optional()}).optional(),ipc:h({enabled:S().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:E([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:P().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:P().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:C(r()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),js=h({enabled:S().default(!1),metrics:C(E([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:P().min(0).max(1).default(1),reportingInterval:P().int().min(1).default(60),budgets:h({maxLoadTimeMs:P().int().min(0).optional(),maxInitTimeMs:P().int().min(0).optional(),maxMemoryMB:P().int().min(0).optional()}).optional(),onBudgetViolation:E([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),Ms=h({strategy:Ss.default(`lazy`),preload:Cs.optional(),codeSplitting:ws.optional(),dynamicImport:Ts.optional(),initialization:Es.optional(),dependencyResolution:Ds.optional(),hotReload:Os.optional(),caching:ks.optional(),sandboxing:As.optional(),monitoring:js.optional()}).describe(`Complete plugin loading configuration`);h({type:E([`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:r(),timestamp:P().int().min(0),durationMs:P().int().min(0).optional(),metadata:d(r(),u()).optional(),error:h({message:r(),code:r().optional(),stack:r().optional()}).optional()}).describe(`Plugin loading lifecycle event`),h({pluginId:r(),state:E([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:P().min(0).max(100).default(0),startedAt:P().int().min(0).optional(),completedAt:P().int().min(0).optional(),lastError:r().optional(),retryCount:P().int().min(0).default(0)}).describe(`Plugin loading state`),h({ql:h({object:M().describe(`Get object handle for method chaining`),query:M().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:h({getCurrentUser:M().describe(`Get the current authenticated user`),getConfig:M().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:h({debug:M().describe(`Log debug message`),info:M().describe(`Log info message`),warn:M().describe(`Log warning message`),error:M().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:h({get:M().describe(`Get a value from storage`),set:M().describe(`Set a value in storage`),delete:M().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:h({t:M().describe(`Translate a key`),getLocale:M().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:d(r(),u()),events:d(r(),u()),app:h({router:h({get:M().describe(`Register GET route handler`),post:M().describe(`Register POST route handler`),use:M().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:h({register:M().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),h({previousVersion:r().describe(`Version before upgrade`),newVersion:r().describe(`Version after upgrade`),isMajorUpgrade:S().describe(`Whether this is a major version bump`),previousMetadata:d(r(),u()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`);var Ns=h({onInstall:M().optional().describe(`Called when plugin is installed`),onEnable:M().optional().describe(`Called when plugin is enabled`),onDisable:M().optional().describe(`Called when plugin is disabled`),onUninstall:M().optional().describe(`Called when plugin is uninstalled`),onUpgrade:M().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),Ps=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`];Ns.extend({id:r().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:E([`standard`,...Ps]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:r().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:r().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:S().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:r().optional(),author:r().optional(),homepage:r().url().optional()});var Fs=E([`insert`,`update`,`upsert`,`replace`,`ignore`]),Is=h({object:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:r().default(`name`).describe(`Field match for uniqueness check`),mode:Fs.default(`upsert`).describe(`Conflict resolution strategy`),env:C(E([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:C(d(r(),u())).describe(`Data records`)}),Ls=h({id:r().describe(`Unique package identifier (reverse domain style)`),namespace:r().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")`),defaultDatasource:r().optional().default(`default`).describe(`Default datasource for all objects in this package`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:E([`plugin`,...Ps,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:r().describe(`Human-readable package name`),description:r().optional().describe(`Package description`),permissions:C(r()).optional().describe(`Array of required permission strings`),objects:C(r()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:C(r()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:d(r(),r()).optional().describe(`Package dependencies`),configuration:h({title:r().optional(),properties:d(r(),h({type:E([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:u().optional().describe(`Default value`),description:r().optional().describe(`Tooltip description`),required:S().optional().describe(`Is this setting required?`),secret:S().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:C(r()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:h({kinds:C(h({id:r().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:C(r()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:r().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:C(r()).optional().describe(`Events this plugin listens to`),menus:d(r(),C(h({id:r(),label:r(),command:r().optional()}))).optional().describe(`UI Menu contributions`),themes:C(h({id:r(),label:r(),path:r()})).optional().describe(`Theme contributions`),translations:C(h({locale:r(),path:r()})).optional().describe(`Translation resources`),actions:C(h({name:r().describe(`Unique action name`),label:r().optional(),description:r().optional(),input:u().optional().describe(`Input validation schema`),output:u().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:C(h({id:r().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:r().describe(`Human readable name`),description:r().optional()})).optional().describe(`Driver contributions`),fieldTypes:C(h({name:r().describe(`Unique field type name (e.g. "vector")`),label:r().describe(`Display label`),description:r().optional()})).optional().describe(`Field Type contributions`),functions:C(h({name:r().describe(`Function name (e.g. "distance")`),description:r().optional(),args:C(r()).optional().describe(`Argument types`),returnType:r().optional()})).optional().describe(`Query Function contributions`),routes:C(h({prefix:r().regex(/^\//).describe(`API path prefix`),service:r().describe(`Service name this plugin provides`),methods:C(r()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:C(h({name:r().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:r().optional().describe(`Command description for help text`),module:r().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:C(Is).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:xs.optional().describe(`Plugin capability declarations for interoperability`),extensions:d(r(),u()).optional().describe(`Extension points and contributions`),loading:Ms.optional().describe(`Plugin loading and runtime behavior configuration`),engine:h({objectstack:r().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)}),Rs=E([`satisfied`,`needs_install`,`needs_upgrade`,`conflict`]).describe(`Resolution status for a dependency`),zs=h({packageId:r().describe(`Dependency package identifier`),requiredRange:r().describe(`SemVer range required (e.g. "^2.0.0")`),resolvedVersion:r().optional().describe(`Actual version resolved from registry`),installedVersion:r().optional().describe(`Currently installed version`),status:Rs.describe(`Resolution status`),conflictReason:r().optional().describe(`Explanation of the conflict`)}).describe(`Resolution result for a single dependency`),Bs=h({type:E([`install`,`upgrade`,`confirm_conflict`]).describe(`Type of action required`),packageId:r().describe(`Target package identifier`),description:r().describe(`Human-readable action description`)}).describe(`Action required before installation can proceed`),Vs=h({dependencies:C(zs).describe(`Resolution result for each dependency`),canProceed:S().describe(`Whether installation can proceed`),requiredActions:C(Bs).describe(`Actions required before proceeding`),installOrder:C(r()).describe(`Topologically sorted package IDs for installation`),circularDependencies:C(C(r())).optional().describe(`Circular dependency chains detected (e.g. [["A", "B", "A"]])`)}).describe(`Complete dependency resolution result`),Hs=E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),Us=h({manifest:Ls.describe(`Full package manifest`),status:Hs.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:S().default(!0).describe(`Whether the package is currently enabled`),installedAt:r().datetime().optional().describe(`Installation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),installedVersion:r().optional().describe(`Currently installed version for quick access`),previousVersion:r().optional().describe(`Version before the last upgrade`),statusChangedAt:r().datetime().optional().describe(`Status change timestamp`),errorMessage:r().optional().describe(`Error message when status is error`),settings:d(r(),u()).optional().describe(`User-provided configuration settings`),upgradeHistory:C(h({fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Version after upgrade`),upgradedAt:r().datetime().describe(`Upgrade timestamp`),status:E([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:C(r()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:C(r()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`);h({namespace:r().describe(`Namespace prefix`),packageId:r().describe(`Owning package ID`),registeredAt:r().datetime().describe(`Registration timestamp`),status:E([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package display name`),suggestion:r().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),h({status:Hs.optional().describe(`Filter by package status`),type:Ls.shape.type.optional().describe(`Filter by package type`),enabled:S().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),h({packages:C(Us).describe(`List of installed packages`),total:P().describe(`Total package count`)}).describe(`List packages response`),h({id:r().describe(`Package identifier`)}).describe(`Get package request`),h({package:Us.describe(`Package details`)}).describe(`Get package response`),h({manifest:Ls.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),h({package:Us.describe(`Installed package details`),message:r().optional().describe(`Installation status message`),dependencyResolution:Vs.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),h({id:r().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),h({id:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),h({id:r().describe(`Package ID to enable`)}).describe(`Enable package request`),h({package:Us.describe(`Enabled package details`),message:r().optional().describe(`Enable status message`)}).describe(`Enable package response`),h({id:r().describe(`Package ID to disable`)}).describe(`Disable package request`),h({package:Us.describe(`Disabled package details`),message:r().optional().describe(`Disable status message`)}).describe(`Disable package response`),h({trigger:r(),payload:d(r(),u())}),h({success:S(),jobId:r().optional(),result:u().optional()}),h({}),fee.partial().required({version:!0}).extend({apiName:r().optional().describe(`API name (deprecated — use name)`)}),h({}),h({types:C(r()).describe(`Available metadata type names (e.g., "object", "plugin", "view")`)}),h({type:r().describe(`Metadata type name (e.g., "object", "plugin")`),packageId:r().optional().describe(`Optional package ID to filter items by`)}),h({type:r().describe(`Metadata type name`),items:C(u()).describe(`Array of metadata items`)}),h({type:r().describe(`Metadata type name`),name:r().describe(`Item name (snake_case identifier)`),packageId:r().optional().describe(`Optional package ID to filter items by`)}),h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),item:u().describe(`Metadata item definition`)}),h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),item:u().describe(`Metadata item definition`)}),h({success:S(),message:r().optional()}),h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),cacheRequest:no.optional().describe(`Cache validation parameters`)}),h({object:r().describe(`Object name (snake_case)`),type:E([`list`,`form`]).describe(`View type`)}),h({object:r().describe(`The unique machine name of the object to query (e.g. "account").`),query:Bi.optional().describe(`Structured query definition (filter, sort, select, pagination).`)}),h({object:r().describe(`The object name for the returned records.`),records:C(d(r(),u())).describe(`The list of matching records.`),total:P().optional().describe(`Total number of records matching the filter (if requested).`),nextCursor:r().optional().describe(`Cursor for the next page of results (cursor-based pagination).`),hasMore:S().optional().describe(`True if there are more records available (pagination).`)}),h({filter:r().optional().describe(`JSON-encoded filter expression (canonical, singular).`),filters:r().optional().describe(`JSON-encoded filter expression (deprecated plural alias).`),select:r().optional().describe(`Comma-separated list of fields to retrieve.`),sort:r().optional().describe(`Sort expression (e.g. "name asc,created_at desc" or "-created_at").`),orderBy:r().optional().describe(`Alias for sort (OData compatibility).`),top:pe().optional().describe(`Max records to return (limit).`),skip:pe().optional().describe(`Records to skip (offset).`),expand:r().optional().describe(`Comma-separated list of lookup/master_detail field names to expand. Resolved to populate array and passed to the engine for batch $in expansion.`),search:r().optional().describe(`Full-text search query.`),distinct:me().optional().describe(`SELECT DISTINCT flag.`),count:me().optional().describe(`Include total count in response.`)}),h({object:r().describe(`The object name.`),id:r().describe(`The unique record identifier (primary key).`),select:C(r()).optional().describe(`Fields to include in the response (allowlisted query param).`),expand:C(r()).optional().describe(`Lookup/master_detail field names to expand. The engine resolves these via batch $in queries, replacing foreign key IDs with full objects.`)}),h({object:r().describe(`The object name.`),id:r().describe(`The record ID.`),record:d(r(),u()).describe(`The complete record data.`)}),h({object:r().describe(`The object name.`),data:d(r(),u()).describe(`The dictionary of field values to insert.`)}),h({object:r().describe(`The object name.`),id:r().describe(`The ID of the newly created record.`),record:d(r(),u()).describe(`The created record, including server-generated fields (created_at, owner).`)}),h({object:r().describe(`The object name.`),id:r().describe(`The ID of the record to update.`),data:d(r(),u()).describe(`The fields to update (partial update).`)}),h({object:r().describe(`Object name`),id:r().describe(`Updated record ID`),record:d(r(),u()).describe(`Updated record`)}),h({object:r().describe(`Object name`),id:r().describe(`Record ID to delete`)}),h({object:r().describe(`Object name`),id:r().describe(`Deleted record ID`),success:S().describe(`Whether deletion succeeded`)}),h({object:r().describe(`Object name`),request:Qa.describe(`Batch operation request`)}),h({object:r().describe(`Object name`),records:C(d(r(),u())).describe(`Array of records to create`)}),h({object:r().describe(`Object name`),records:C(d(r(),u())).describe(`Created records`),count:P().describe(`Number of records created`)}),h({object:r().describe(`Object name`),records:C(h({id:r().describe(`Record ID`),data:d(r(),u()).describe(`Fields to update`)})).describe(`Array of updates`),options:Za.optional().describe(`Update options`)}),h({object:r().describe(`Object name`),ids:C(r()).describe(`Array of record IDs to delete`),options:Za.optional().describe(`Delete options`)}),h({object:r().describe(`Object name (snake_case)`),type:E([`list`,`form`]).optional().describe(`Filter by view type`)}),h({object:r().describe(`Object name`),views:C(Go).describe(`Array of view definitions`)}),h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier`)}),h({object:r().describe(`Object name`),view:Go.describe(`View definition`)}),h({object:r().describe(`Object name (snake_case)`),data:Go.describe(`View definition to create`)}),h({object:r().describe(`Object name`),viewId:r().describe(`Created view identifier`),view:Go.describe(`Created view definition`)}),h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier`),data:Go.partial().describe(`Partial view data to update`)}),h({object:r().describe(`Object name`),viewId:r().describe(`Updated view identifier`),view:Go.describe(`Updated view definition`)}),h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier to delete`)}),h({object:r().describe(`Object name`),viewId:r().describe(`Deleted view identifier`),success:S().describe(`Whether deletion succeeded`)}),h({object:r().describe(`Object name to check permissions for`),action:E([`create`,`read`,`edit`,`delete`,`transfer`,`restore`,`purge`]).describe(`Action to check`),recordId:r().optional().describe(`Specific record ID (for record-level checks)`),field:r().optional().describe(`Specific field name (for field-level checks)`)}),h({allowed:S().describe(`Whether the action is permitted`),reason:r().optional().describe(`Reason if denied`)}),h({object:r().describe(`Object name to get permissions for`)}),h({object:r().describe(`Object name`),permissions:Yo.describe(`Object-level permissions`),fieldPermissions:d(r(),Xo).optional().describe(`Field-level permissions keyed by field name`)}),h({}),h({objects:d(r(),Yo).describe(`Effective object permissions keyed by object name`),systemPermissions:C(r()).describe(`Effective system-level permissions`)}),h({object:r().describe(`Object name to get workflow config for`)}),h({object:r().describe(`Object name`),workflows:C(rs).describe(`Active workflow rules for this object`)});var Ws=h({currentState:r().describe(`Current workflow state name`),availableTransitions:C(h({name:r().describe(`Transition name`),targetState:r().describe(`Target state after transition`),label:r().optional().describe(`Display label`),requiresApproval:S().default(!1).describe(`Whether transition requires approval`)})).describe(`Available transitions from current state`),history:C(h({fromState:r().describe(`Previous state`),toState:r().describe(`New state`),action:r().describe(`Action that triggered the transition`),userId:r().describe(`User who performed the action`),timestamp:r().datetime().describe(`When the transition occurred`),comment:r().optional().describe(`Optional comment`)})).optional().describe(`State transition history`)});h({object:r().describe(`Object name`),recordId:r().describe(`Record ID to get workflow state for`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),state:Ws.describe(`Current workflow state and available transitions`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),transition:r().describe(`Transition name to execute`),comment:r().optional().describe(`Optional comment for the transition`),data:d(r(),u()).optional().describe(`Additional data for the transition`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the transition succeeded`),state:Ws.describe(`New workflow state after transition`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),comment:r().optional().describe(`Approval comment`),data:d(r(),u()).optional().describe(`Additional data`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the approval succeeded`),state:Ws.describe(`New workflow state after approval`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),reason:r().describe(`Rejection reason`),comment:r().optional().describe(`Additional comment`)}),h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the rejection succeeded`),state:Ws.describe(`New workflow state after rejection`)}),h({transport:ca.optional().describe(`Preferred transport protocol`),channels:C(r()).optional().describe(`Channels to subscribe to on connect`),token:r().optional().describe(`Authentication token`)}),h({connectionId:r().describe(`Unique connection identifier`),transport:ca.describe(`Negotiated transport protocol`),url:r().optional().describe(`WebSocket/SSE endpoint URL`)}),h({connectionId:r().optional().describe(`Connection ID to disconnect`)}),h({success:S().describe(`Whether disconnection succeeded`)}),h({channel:r().describe(`Channel name to subscribe to`),events:C(r()).optional().describe(`Specific event types to listen for`),filter:d(r(),u()).optional().describe(`Event filter criteria`)}),h({subscriptionId:r().describe(`Unique subscription identifier`),channel:r().describe(`Subscribed channel name`)}),h({subscriptionId:r().describe(`Subscription ID to cancel`)}),h({success:S().describe(`Whether unsubscription succeeded`)}),h({channel:r().describe(`Channel to set presence in`),state:da.describe(`Presence state to set`)}),h({success:S().describe(`Whether presence was set`)}),h({channel:r().describe(`Channel to get presence for`)}),h({channel:r().describe(`Channel name`),members:C(da).describe(`Active members and their presence state`)}),h({token:r().describe(`Device push notification token`),platform:E([`ios`,`android`,`web`]).describe(`Device platform`),deviceId:r().optional().describe(`Unique device identifier`),name:r().optional().describe(`Device friendly name`)}),h({deviceId:r().describe(`Registered device ID`),success:S().describe(`Whether registration succeeded`)}),h({deviceId:r().describe(`Device ID to unregister`)}),h({success:S().describe(`Whether unregistration succeeded`)});var Gs=h({email:S().default(!0).describe(`Receive email notifications`),push:S().default(!0).describe(`Receive push notifications`),inApp:S().default(!0).describe(`Receive in-app notifications`),digest:E([`none`,`daily`,`weekly`]).default(`none`).describe(`Email digest frequency`),channels:d(r(),h({enabled:S().default(!0).describe(`Whether this channel is enabled`),email:S().optional().describe(`Override email setting`),push:S().optional().describe(`Override push setting`)})).optional().describe(`Per-channel notification preferences`)});h({}),h({preferences:Gs.describe(`Current notification preferences`)}),h({preferences:Gs.partial().describe(`Preferences to update`)}),h({preferences:Gs.describe(`Updated notification preferences`)});var Ks=h({id:r().describe(`Notification ID`),type:r().describe(`Notification type`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),read:S().default(!1).describe(`Whether notification has been read`),data:d(r(),u()).optional().describe(`Additional notification data`),actionUrl:r().optional().describe(`URL to navigate to when clicked`),createdAt:r().datetime().describe(`When notification was created`)});h({read:S().optional().describe(`Filter by read status`),type:r().optional().describe(`Filter by notification type`),limit:P().default(20).describe(`Maximum number of notifications to return`),cursor:r().optional().describe(`Pagination cursor`)}),h({notifications:C(Ks).describe(`List of notifications`),unreadCount:P().describe(`Total number of unread notifications`),cursor:r().optional().describe(`Next page cursor`)}),h({ids:C(r()).describe(`Notification IDs to mark as read`)}),h({success:S().describe(`Whether the operation succeeded`),readCount:P().describe(`Number of notifications marked as read`)}),h({}),h({success:S().describe(`Whether the operation succeeded`),readCount:P().describe(`Number of notifications marked as read`)}),h({query:r().describe(`Natural language query string`),object:r().optional().describe(`Target object context`),conversationId:r().optional().describe(`Conversation ID for multi-turn queries`)}),h({query:u().describe(`Generated structured query (AST)`),explanation:r().optional().describe(`Human-readable explanation of the query`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),suggestions:C(r()).optional().describe(`Suggested follow-up queries`)}),h({object:r().describe(`Object name for context`),field:r().optional().describe(`Field to suggest values for`),recordId:r().optional().describe(`Record ID for context`),partial:r().optional().describe(`Partial input for completion`)}),h({suggestions:C(h({value:u().describe(`Suggested value`),label:r().describe(`Display label`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),reason:r().optional().describe(`Reason for this suggestion`)})).describe(`Suggested values`)}),h({object:r().describe(`Object name to analyze`),recordId:r().optional().describe(`Specific record to analyze`),type:E([`summary`,`trends`,`anomalies`,`recommendations`]).optional().describe(`Type of insight`)}),h({insights:C(h({type:r().describe(`Insight type`),title:r().describe(`Insight title`),description:r().describe(`Detailed description`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),data:d(r(),u()).optional().describe(`Supporting data`)})).describe(`Generated insights`)}),h({}),h({locales:C(h({code:r().describe(`BCP-47 locale code (e.g., en-US, zh-CN)`),label:r().describe(`Display name of the locale`),isDefault:S().default(!1).describe(`Whether this is the default locale`)})).describe(`Available locales`)}),h({locale:r().describe(`BCP-47 locale code`),namespace:r().optional().describe(`Translation namespace (e.g., objects, apps, messages)`),keys:C(r()).optional().describe(`Specific translation keys to fetch`)}),h({locale:r().describe(`Locale code`),translations:ss.describe(`Translation data`)}),h({object:r().describe(`Object name`),locale:r().describe(`BCP-47 locale code`)}),h({object:r().describe(`Object name`),locale:r().describe(`Locale code`),labels:d(r(),h({label:r().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),options:d(r(),r()).optional().describe(`Translated option labels`)})).describe(`Field labels keyed by field name`)}),h({getDiscovery:M().describe(`Get API discovery information`),getMetaTypes:M().describe(`Get available metadata types`),getMetaItems:M().describe(`Get all items of a metadata type`),getMetaItem:M().describe(`Get a specific metadata item`),saveMetaItem:M().describe(`Save metadata item`),getMetaItemCached:M().describe(`Get a metadata item with cache validation`),getUiView:M().describe(`Get UI view definition`),analyticsQuery:M().describe(`Execute analytics query`),getAnalyticsMeta:M().describe(`Get analytics metadata (cubes)`),triggerAutomation:M().describe(`Trigger an automation flow or script`),listPackages:M().describe(`List installed packages with optional filters`),getPackage:M().describe(`Get a specific installed package by ID`),installPackage:M().describe(`Install a new package from manifest`),uninstallPackage:M().describe(`Uninstall a package by ID`),enablePackage:M().describe(`Enable a disabled package`),disablePackage:M().describe(`Disable an installed package`),findData:M().describe(`Find data records`),getData:M().describe(`Get single data record`),createData:M().describe(`Create a data record`),updateData:M().describe(`Update a data record`),deleteData:M().describe(`Delete a data record`),batchData:M().describe(`Perform batch operations`),createManyData:M().describe(`Create multiple records`),updateManyData:M().describe(`Update multiple records`),deleteManyData:M().describe(`Delete multiple records`),listViews:M().describe(`List views for an object`),getView:M().describe(`Get a specific view`),createView:M().describe(`Create a new view`),updateView:M().describe(`Update an existing view`),deleteView:M().describe(`Delete a view`),checkPermission:M().describe(`Check if an action is permitted`),getObjectPermissions:M().describe(`Get permissions for an object`),getEffectivePermissions:M().describe(`Get effective permissions for current user`),getWorkflowConfig:M().describe(`Get workflow configuration for an object`),getWorkflowState:M().describe(`Get workflow state for a record`),workflowTransition:M().describe(`Execute a workflow state transition`),workflowApprove:M().describe(`Approve a workflow step`),workflowReject:M().describe(`Reject a workflow step`),realtimeConnect:M().describe(`Establish realtime connection`),realtimeDisconnect:M().describe(`Close realtime connection`),realtimeSubscribe:M().describe(`Subscribe to a realtime channel`),realtimeUnsubscribe:M().describe(`Unsubscribe from a realtime channel`),setPresence:M().describe(`Set user presence state`),getPresence:M().describe(`Get channel presence information`),registerDevice:M().describe(`Register a device for push notifications`),unregisterDevice:M().describe(`Unregister a device`),getNotificationPreferences:M().describe(`Get notification preferences`),updateNotificationPreferences:M().describe(`Update notification preferences`),listNotifications:M().describe(`List notifications`),markNotificationsRead:M().describe(`Mark specific notifications as read`),markAllNotificationsRead:M().describe(`Mark all notifications as read`),aiNlq:M().describe(`Natural language query`),aiChat:M().describe(`AI chat interaction`),aiSuggest:M().describe(`Get AI-powered suggestions`),aiInsights:M().describe(`Get AI-generated insights`),getLocales:M().describe(`Get available locales`),getTranslations:M().describe(`Get translations for a locale`),getFieldLabels:M().describe(`Get translated field labels for an object`),listFeed:M().describe(`List feed items for a record`),createFeedItem:M().describe(`Create a new feed item`),updateFeedItem:M().describe(`Update an existing feed item`),deleteFeedItem:M().describe(`Delete a feed item`),addReaction:M().describe(`Add an emoji reaction to a feed item`),removeReaction:M().describe(`Remove an emoji reaction from a feed item`),pinFeedItem:M().describe(`Pin a feed item`),unpinFeedItem:M().describe(`Unpin a feed item`),starFeedItem:M().describe(`Star a feed item`),unstarFeedItem:M().describe(`Unstar a feed item`),searchFeed:M().describe(`Search feed items`),getChangelog:M().describe(`Get field-level changelog for a record`),feedSubscribe:M().describe(`Subscribe to record notifications`),feedUnsubscribe:M().describe(`Unsubscribe from record notifications`)});var qs=h({version:r().regex(/^[a-zA-Z0-9_\-\.]+$/).default(`v1`).describe(`API version (e.g., v1, v2, 2024-01)`),basePath:r().default(`/api`).describe(`Base URL path for API`),apiPath:r().optional().describe(`Full API path (defaults to {basePath}/{version})`),enableCrud:S().default(!0).describe(`Enable automatic CRUD endpoint generation`),enableMetadata:S().default(!0).describe(`Enable metadata API endpoints`),enableUi:S().default(!0).describe(`Enable UI API endpoints (Views, Menus, Layouts)`),enableBatch:S().default(!0).describe(`Enable batch operation endpoints`),enableDiscovery:S().default(!0).describe(`Enable API discovery endpoint`),documentation:h({enabled:S().default(!0).describe(`Enable API documentation`),title:r().default(`ObjectStack API`).describe(`API documentation title`),description:r().optional().describe(`API description`),version:r().optional().describe(`Documentation version`),termsOfService:r().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().optional(),email:r().optional()}).optional(),license:h({name:r(),url:r().optional()}).optional()}).optional().describe(`OpenAPI/Swagger documentation config`),responseFormat:h({envelope:S().default(!0).describe(`Wrap responses in standard envelope`),includeMetadata:S().default(!0).describe(`Include response metadata (timestamp, requestId)`),includePagination:S().default(!0).describe(`Include pagination info in list responses`)}).optional().describe(`Response format options`)}),Js=E([`create`,`read`,`update`,`delete`,`list`]),Ys=h({method:Ki.describe(`HTTP method`),path:r().describe(`URL path pattern`),summary:r().optional().describe(`Operation summary`),description:r().optional().describe(`Operation description`)}),Xs=h({operations:h({create:S().default(!0).describe(`Enable create operation`),read:S().default(!0).describe(`Enable read operation`),update:S().default(!0).describe(`Enable update operation`),delete:S().default(!0).describe(`Enable delete operation`),list:S().default(!0).describe(`Enable list operation`)}).optional().describe(`Enable/disable operations`),patterns:d(Js,Ys.optional()).optional().describe(`Custom URL patterns for operations`),dataPrefix:r().default(`/data`).describe(`URL prefix for data endpoints`),objectParamStyle:E([`path`,`query`]).default(`path`).describe(`How object name is passed (path param or query param)`)}),Zs=h({prefix:r().default(`/meta`).describe(`URL prefix for metadata endpoints`),enableCache:S().default(!0).describe(`Enable HTTP cache headers (ETag, Last-Modified)`),cacheTtl:P().int().default(3600).describe(`Cache TTL in seconds`),endpoints:h({types:S().default(!0).describe(`GET /meta - List all metadata types`),items:S().default(!0).describe(`GET /meta/:type - List items of type`),item:S().default(!0).describe(`GET /meta/:type/:name - Get specific item`),schema:S().default(!0).describe(`GET /meta/:type/:name/schema - Get JSON schema`)}).optional().describe(`Enable/disable specific endpoints`)}),Qs=h({maxBatchSize:P().int().min(1).max(1e3).default(200).describe(`Maximum records per batch operation`),enableBatchEndpoint:S().default(!0).describe(`Enable POST /data/:object/batch endpoint`),operations:h({createMany:S().default(!0).describe(`Enable POST /data/:object/createMany`),updateMany:S().default(!0).describe(`Enable POST /data/:object/updateMany`),deleteMany:S().default(!0).describe(`Enable POST /data/:object/deleteMany`),upsertMany:S().default(!0).describe(`Enable POST /data/:object/upsertMany`)}).optional().describe(`Enable/disable specific batch operations`),defaultAtomic:S().default(!0).describe(`Default atomic/transaction mode for batch operations`)}),$s=h({includeObjects:C(r()).optional().describe(`Specific objects to generate routes for (empty = all)`),excludeObjects:C(r()).optional().describe(`Objects to exclude from route generation`),nameTransform:E([`none`,`plural`,`kebab-case`,`camelCase`]).default(`none`).describe(`Transform object names in URLs`),overrides:d(r(),h({enabled:S().optional().describe(`Enable/disable routes for this object`),basePath:r().optional().describe(`Custom base path`),operations:d(Js,S()).optional().describe(`Enable/disable specific operations`)})).optional().describe(`Per-object route customization`)}),ec=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Webhook event identifier (snake_case)`),description:r().describe(`Human-readable event description`),method:Ki.default(`POST`).describe(`HTTP method for webhook delivery`),payloadSchema:r().describe(`JSON Schema $ref for the webhook payload`),headers:d(r(),r()).optional().describe(`Custom headers to include in webhook delivery`),security:C(E([`hmac_sha256`,`basic`,`bearer`,`api_key`])).describe(`Supported authentication methods for webhook verification`)});h({enabled:S().default(!1).describe(`Enable webhook support`),events:C(ec).describe(`Registered webhook events`),deliveryConfig:h({maxRetries:P().int().default(3).describe(`Maximum delivery retry attempts`),retryIntervalMs:P().int().default(5e3).describe(`Milliseconds between retry attempts`),timeoutMs:P().int().default(3e4).describe(`Delivery request timeout in milliseconds`),signatureHeader:r().default(`X-Signature-256`).describe(`Header name for webhook signature`)}).describe(`Webhook delivery configuration`),registrationEndpoint:r().default(`/webhooks`).describe(`URL path for webhook registration`)});var tc=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Callback identifier (snake_case)`),expression:r().describe(`Runtime expression (e.g., {$request.body#/callbackUrl})`),method:Ki.describe(`HTTP method for callback request`),url:r().describe(`Callback URL template with runtime expressions`)}),gee=h({webhooks:d(r(),ec).optional().describe(`OpenAPI 3.1 webhooks (top-level webhook definitions)`),callbacks:d(r(),C(tc)).optional().describe(`OpenAPI 3.1 callbacks (async response definitions)`),jsonSchemaDialect:r().default(`https://json-schema.org/draft/2020-12/schema`).describe(`JSON Schema dialect for schema definitions`),pathItemReferences:S().default(!1).describe(`Allow $ref in path items (OpenAPI 3.1 feature)`)}),nc=h({api:qs.optional().describe(`REST API configuration`),crud:Xs.optional().describe(`CRUD endpoints configuration`),metadata:Zs.optional().describe(`Metadata endpoints configuration`),batch:Qs.optional().describe(`Batch endpoints configuration`),routes:$s.optional().describe(`Route generation configuration`),openApi31:gee.optional().describe(`OpenAPI 3.1 extensions configuration`)}),rc=h({id:r().describe(`Unique endpoint identifier`),method:Ki.describe(`HTTP method`),path:r().describe(`Full URL path`),object:r().describe(`Object name (snake_case)`),operation:l([Js,r()]).describe(`Operation type`),handler:r().describe(`Handler function identifier`),metadata:h({summary:r().optional(),description:r().optional(),tags:C(r()).optional(),deprecated:S().optional()}).optional()});h({endpoints:C(rc).describe(`All generated endpoints`),total:P().int().describe(`Total number of endpoints`),byObject:d(r(),C(rc)).optional().describe(`Endpoints grouped by object`),byOperation:d(r(),C(rc)).optional().describe(`Endpoints grouped by operation`)}),Object.assign(qs,{create:e=>e}),Object.assign(nc,{create:e=>e});var ic=E([`rest`,`graphql`,`odata`,`websocket`,`file`,`auth`,`metadata`,`plugin`,`webhook`,`rpc`]),ac=l([P().int().min(100).max(599),E([`2xx`,`3xx`,`4xx`,`5xx`])]),oc=h({objectId:pa.describe(`Object name to reference`),includeFields:C(r()).optional().describe(`Include only these fields in the schema`),excludeFields:C(r()).optional().describe(`Exclude these fields from the schema`),includeRelated:C(r()).optional().describe(`Include related objects via lookup fields`)});l([u().describe(`Static JSON Schema definition`),h({$ref:oc.describe(`Dynamic reference to ObjectQL object`)}).describe(`Dynamic ObjectQL reference`)]);var sc=h({name:r().describe(`Parameter name`),in:E([`path`,`query`,`header`,`body`,`cookie`]).describe(`Parameter location`),description:r().optional().describe(`Parameter description`),required:S().default(!1).describe(`Whether parameter is required`),schema:l([h({type:E([`string`,`number`,`integer`,`boolean`,`array`,`object`]).describe(`Parameter type`),format:r().optional().describe(`Format (e.g., date-time, email, uuid)`),enum:C(u()).optional().describe(`Allowed values`),default:u().optional().describe(`Default value`),items:u().optional().describe(`Array item schema`),properties:d(r(),u()).optional().describe(`Object properties`)}).describe(`Static JSON Schema`),h({$ref:oc}).describe(`Dynamic ObjectQL reference`)]).describe(`Parameter schema definition`),example:u().optional().describe(`Example value`)}),cc=h({statusCode:ac.describe(`HTTP status code`),description:r().describe(`Response description`),contentType:r().default(`application/json`).describe(`Response content type`),schema:l([u().describe(`Static JSON Schema`),h({$ref:oc}).describe(`Dynamic ObjectQL reference`)]).optional().describe(`Response body schema`),headers:d(r(),h({description:r().optional(),schema:u()})).optional().describe(`Response headers`),example:u().optional().describe(`Example response`)}),lc=h({id:r().describe(`Unique endpoint identifier`),method:Ki.optional().describe(`HTTP method`),path:r().describe(`URL path pattern`),summary:r().optional().describe(`Short endpoint summary`),description:r().optional().describe(`Detailed endpoint description`),operationId:r().optional().describe(`Unique operation identifier`),tags:C(r()).optional().default([]).describe(`Tags for categorization`),parameters:C(sc).optional().default([]).describe(`Endpoint parameters`),requestBody:h({description:r().optional(),required:S().default(!1),contentType:r().default(`application/json`),schema:u().optional(),example:u().optional()}).optional().describe(`Request body specification`),responses:C(cc).optional().default([]).describe(`Possible responses`),rateLimit:Xi.optional().describe(`Endpoint specific rate limiting`),security:C(d(r(),C(r()))).optional().describe(`Security requirements (e.g. [{"bearerAuth": []}])`),requiredPermissions:C(r()).optional().default([]).describe(`Required RBAC permissions (e.g., "customer.read", "manage_users")`),priority:P().int().min(0).max(1e3).optional().default(100).describe(`Route priority for conflict resolution (0-1000, higher = more important)`),protocolConfig:d(r(),u()).optional().describe(`Protocol-specific configuration for custom protocols (gRPC, tRPC, etc.)`),deprecated:S().default(!1).describe(`Whether endpoint is deprecated`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation link`)}),uc=h({owner:r().optional().describe(`Owner team or person`),status:E([`active`,`deprecated`,`experimental`,`beta`]).default(`active`).describe(`API lifecycle status`),tags:C(r()).optional().default([]).describe(`Classification tags`),pluginSource:r().optional().describe(`Source plugin name`),custom:d(r(),u()).optional().describe(`Custom metadata fields`)}),dc=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique API identifier (snake_case)`),name:r().describe(`API display name`),type:ic.describe(`API protocol type`),version:r().describe(`API version (e.g., v1, 2024-01)`),basePath:r().describe(`Base URL path for this API`),description:r().optional().describe(`API description`),endpoints:C(lc).describe(`Registered endpoints`),config:d(r(),u()).optional().describe(`Protocol-specific configuration`),metadata:uc.optional().describe(`Additional metadata`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`Contact information`),license:h({name:r(),url:r().url().optional()}).optional().describe(`License information`)}),fc=E([`error`,`priority`,`first-wins`,`last-wins`]),pc=h({version:r().describe(`Registry version`),conflictResolution:fc.optional().default(`error`).describe(`Strategy for handling route conflicts`),apis:C(dc).describe(`All registered APIs`),totalApis:P().int().describe(`Total number of registered APIs`),totalEndpoints:P().int().describe(`Total number of endpoints`),byType:d(ic,C(dc)).optional().describe(`APIs grouped by protocol type`),byStatus:d(r(),C(dc)).optional().describe(`APIs grouped by status`),updatedAt:r().datetime().optional().describe(`Last registry update time`)}),mc=h({type:ic.optional().describe(`Filter by API protocol type`),tags:C(r()).optional().describe(`Filter by tags (ANY match)`),status:E([`active`,`deprecated`,`experimental`,`beta`]).optional().describe(`Filter by lifecycle status`),pluginSource:r().optional().describe(`Filter by plugin name`),search:r().optional().describe(`Full-text search in name/description`),version:r().optional().describe(`Filter by specific version`)});h({apis:C(dc).describe(`Matching API entries`),total:P().int().describe(`Total matching APIs`),filters:mc.optional().describe(`Applied query filters`)}),Object.assign(lc,{create:e=>e}),Object.assign(dc,{create:e=>e}),Object.assign(pc,{create:e=>e});var hc=h({url:r().url().describe(`Server base URL`),description:r().optional().describe(`Server description`),variables:d(r(),h({default:r(),description:r().optional(),enum:C(r()).optional()})).optional().describe(`URL template variables`)}),gc=h({type:E([`apiKey`,`http`,`oauth2`,`openIdConnect`]).describe(`Security type`),scheme:r().optional().describe(`HTTP auth scheme (bearer, basic, etc.)`),bearerFormat:r().optional().describe(`Bearer token format (e.g., JWT)`),name:r().optional().describe(`API key parameter name`),in:E([`header`,`query`,`cookie`]).optional().describe(`API key location`),flows:h({implicit:u().optional(),password:u().optional(),clientCredentials:u().optional(),authorizationCode:u().optional()}).optional().describe(`OAuth2 flows`),openIdConnectUrl:r().url().optional().describe(`OpenID Connect discovery URL`),description:r().optional().describe(`Security scheme description`)}),_c=h({openapi:r().default(`3.0.0`).describe(`OpenAPI specification version`),info:h({title:r().describe(`API title`),version:r().describe(`API version`),description:r().optional().describe(`API description`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional(),license:h({name:r(),url:r().url().optional()}).optional()}).describe(`API metadata`),servers:C(hc).optional().default([]).describe(`API servers`),paths:d(r(),u()).describe(`API paths and operations`),components:h({schemas:d(r(),u()).optional(),responses:d(r(),u()).optional(),parameters:d(r(),u()).optional(),examples:d(r(),u()).optional(),requestBodies:d(r(),u()).optional(),headers:d(r(),u()).optional(),securitySchemes:d(r(),gc).optional(),links:d(r(),u()).optional(),callbacks:d(r(),u()).optional()}).optional().describe(`Reusable components`),security:C(d(r(),C(r()))).optional().describe(`Global security requirements`),tags:C(h({name:r(),description:r().optional(),externalDocs:h({description:r().optional(),url:r().url()}).optional()})).optional().describe(`Tag definitions`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation`)}),vc=h({type:E([`swagger-ui`,`redoc`,`rapidoc`,`stoplight`,`scalar`,`graphql-playground`,`graphiql`,`postman`,`custom`]).describe(`Testing UI implementation`),path:r().default(`/api-docs`).describe(`URL path for documentation UI`),theme:E([`light`,`dark`,`auto`]).default(`light`).describe(`UI color theme`),enableTryItOut:S().default(!0).describe(`Enable interactive API testing`),enableFilter:S().default(!0).describe(`Enable endpoint filtering`),enableCors:S().default(!0).describe(`Enable CORS for browser testing`),defaultModelsExpandDepth:P().int().min(-1).default(1).describe(`Default expand depth for schemas (-1 = fully expand)`),displayRequestDuration:S().default(!0).describe(`Show request duration`),syntaxHighlighting:S().default(!0).describe(`Enable syntax highlighting`),customCssUrl:r().url().optional().describe(`Custom CSS stylesheet URL`),customJsUrl:r().url().optional().describe(`Custom JavaScript URL`),layout:h({showExtensions:S().default(!1).describe(`Show vendor extensions`),showCommonExtensions:S().default(!1).describe(`Show common extensions`),deepLinking:S().default(!0).describe(`Enable deep linking`),displayOperationId:S().default(!1).describe(`Display operation IDs`),defaultModelRendering:E([`example`,`model`]).default(`example`).describe(`Default model rendering mode`),defaultModelsExpandDepth:P().int().default(1).describe(`Models expand depth`),defaultModelExpandDepth:P().int().default(1).describe(`Single model expand depth`),docExpansion:E([`list`,`full`,`none`]).default(`list`).describe(`Documentation expansion mode`)}).optional().describe(`Layout configuration`)}),yc=h({name:r().describe(`Test request name`),description:r().optional().describe(`Request description`),method:E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`HEAD`,`OPTIONS`]).describe(`HTTP method`),url:r().describe(`Request URL (can include variables)`),headers:d(r(),r()).optional().default({}).describe(`Request headers`),queryParams:d(r(),l([r(),P(),S()])).optional().default({}).describe(`Query parameters`),body:u().optional().describe(`Request body`),variables:d(r(),u()).optional().default({}).describe(`Template variables`),expectedResponse:h({statusCode:P().int(),body:u().optional()}).optional().describe(`Expected response for validation`)}),bc=h({name:r().describe(`Collection name`),description:r().optional().describe(`Collection description`),variables:d(r(),u()).optional().default({}).describe(`Shared variables`),requests:C(yc).describe(`Test requests in this collection`),folders:C(h({name:r(),description:r().optional(),requests:C(yc)})).optional().describe(`Request folders for organization`)}),xc=h({version:r().describe(`API version`),date:r().date().describe(`Release date`),changes:h({added:C(r()).optional().default([]).describe(`New features`),changed:C(r()).optional().default([]).describe(`Changes`),deprecated:C(r()).optional().default([]).describe(`Deprecations`),removed:C(r()).optional().default([]).describe(`Removed features`),fixed:C(r()).optional().default([]).describe(`Bug fixes`),security:C(r()).optional().default([]).describe(`Security fixes`)}).describe(`Version changes`),migrationGuide:r().optional().describe(`Migration guide URL or text`)}),Sc=h({language:r().describe(`Target language/framework (e.g., typescript, python, curl)`),name:r().describe(`Template name`),template:r().describe(`Code template with placeholders`),variables:C(r()).optional().describe(`Required template variables`)}),Cc=h({enabled:S().default(!0).describe(`Enable API documentation`),title:r().default(`API Documentation`).describe(`Documentation title`),version:r().describe(`API version`),description:r().optional().describe(`API description`),servers:C(hc).optional().default([]).describe(`API server URLs`),ui:vc.optional().describe(`Testing UI configuration`),generateOpenApi:S().default(!0).describe(`Generate OpenAPI 3.0 specification`),generateTestCollections:S().default(!0).describe(`Generate API test collections`),testCollections:C(bc).optional().default([]).describe(`Predefined test collections`),changelog:C(xc).optional().default([]).describe(`API version changelog`),codeTemplates:C(Sc).optional().default([]).describe(`Code generation templates`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`Contact information`),license:h({name:r(),url:r().url().optional()}).optional().describe(`API license`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation link`),securitySchemes:d(r(),gc).optional().describe(`Security scheme definitions`),tags:C(h({name:r(),description:r().optional(),externalDocs:h({description:r().optional(),url:r().url()}).optional()})).optional().describe(`Global tag definitions`)});h({openApiSpec:_c.optional().describe(`Generated OpenAPI specification`),testCollections:C(bc).optional().describe(`Generated test collections`),markdown:r().optional().describe(`Generated markdown documentation`),html:r().optional().describe(`Generated HTML documentation`),generatedAt:r().datetime().describe(`Generation timestamp`),sourceApis:C(r()).describe(`Source API IDs used for generation`)}),Object.assign(Cc,{create:e=>e}),Object.assign(bc,{create:e=>e}),Object.assign(_c,{create:e=>e});var wc=E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),Tc=E([`string`,`number`,`boolean`,`time`,`geo`]),Ec=E([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),Dc=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:r().describe(`Human readable label`),description:r().optional(),type:wc,sql:r().describe(`SQL expression or field reference`),filters:C(h({sql:r()})).optional(),format:r().optional()}),Oc=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:r().describe(`Human readable label`),description:r().optional(),type:Tc,sql:r().describe(`SQL expression or column reference`),granularities:C(Ec).optional()}),kc=h({name:r().describe(`Target cube name`),relationship:E([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:r().describe(`Join condition (ON clause)`)}),Ac=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:r().optional(),description:r().optional(),sql:r().describe(`Base SQL statement or Table Name`),measures:d(r(),Dc).describe(`Quantitative metrics`),dimensions:d(r(),Oc).describe(`Qualitative attributes`),joins:d(r(),kc).optional(),refreshKey:h({every:r().optional(),sql:r().optional()}).optional(),public:S().default(!1)}),jc=h({cube:r().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:C(r()).describe(`List of metrics to calculate`),dimensions:C(r()).optional().describe(`List of dimensions to group by`),filters:C(h({member:r().describe(`Dimension or Measure`),operator:E([`equals`,`notEquals`,`contains`,`notContains`,`gt`,`gte`,`lt`,`lte`,`set`,`notSet`,`inDateRange`]),values:C(r()).optional()})).optional(),timeDimensions:C(h({dimension:r(),granularity:Ec.optional(),dateRange:l([r(),C(r())]).optional()})).optional(),order:d(r(),E([`asc`,`desc`])).optional(),limit:P().optional(),offset:P().optional(),timezone:r().optional().default(`UTC`)});E([`/api/v1/analytics/query`,`/api/v1/analytics/meta`,`/api/v1/analytics/sql`]),h({query:jc.describe(`The analytic query definition`),cube:r().describe(`Target cube name`),format:E([`json`,`csv`,`xlsx`]).default(`json`).describe(`Response format`)}),R.extend({data:h({rows:C(d(r(),u())).describe(`Result rows`),fields:C(h({name:r(),type:r()})).describe(`Column metadata`),sql:r().optional().describe(`Executed SQL (if debug enabled)`)})}),h({cube:r().optional().describe(`Optional cube name to filter`)}),R.extend({data:h({cubes:C(Ac).describe(`Available cubes`)})}),R.extend({data:h({sql:r(),params:C(u())})});var Mc=E([`urlPath`,`header`,`queryParam`,`dateBased`]),Nc=E([`preview`,`current`,`supported`,`deprecated`,`retired`]),Pc=h({version:r().describe(`Version identifier (e.g., "v1", "v2beta1", "2025-01-01")`),status:Nc.describe(`Lifecycle status of this version`),releasedAt:r().describe(`Release date (ISO 8601, e.g., "2025-01-15")`),deprecatedAt:r().optional().describe(`Deprecation date (ISO 8601). Only set for deprecated/retired versions`),sunsetAt:r().optional().describe(`Sunset date (ISO 8601). After this date, the version returns 410 Gone`),migrationGuide:r().url().optional().describe(`URL to migration guide for upgrading from this version`),description:r().optional().describe(`Human-readable description or release notes summary`),breakingChanges:C(r()).optional().describe(`List of breaking changes (for preview/new versions)`)});h({strategy:Mc.default(`urlPath`).describe(`How the API version is specified by clients`),current:r().describe(`The current/recommended API version identifier`),default:r().describe(`Fallback version when client does not specify one`),versions:C(Pc).min(1).describe(`All available API versions with lifecycle metadata`),headerName:r().default(`ObjectStack-Version`).describe(`HTTP header name for version negotiation (header/dateBased strategies)`),queryParamName:r().default(`version`).describe(`Query parameter name for version specification (queryParam strategy)`),urlPrefix:r().default(`/api`).describe(`URL prefix before version segment (urlPath strategy)`),deprecation:h({warnHeader:S().default(!0).describe(`Include Deprecation header (RFC 8594) in responses`),sunsetHeader:S().default(!0).describe(`Include Sunset header (RFC 8594) with retirement date`),linkHeader:S().default(!0).describe(`Include Link header pointing to migration guide URL`),rejectRetired:S().default(!0).describe(`Return 410 Gone for retired API versions`),warningMessage:r().optional().describe(`Custom warning message for deprecated version responses`)}).optional().describe(`Deprecation lifecycle behavior`),includeInDiscovery:S().default(!0).describe(`Include version information in the API discovery endpoint`)}),h({current:r().describe(`Current recommended API version`),requested:r().optional().describe(`Version requested by the client`),resolved:r().describe(`Resolved API version for this request`),supported:C(r()).describe(`All supported version identifiers`),deprecated:C(r()).optional().describe(`Deprecated version identifiers`),versions:C(Pc).optional().describe(`Full version definitions with lifecycle metadata`)}),E([`local`,`google`,`github`,`microsoft`,`ldap`,`saml`]);var Fc=h({id:r().describe(`User ID`),email:r().email().describe(`Email address`),emailVerified:S().default(!1).describe(`Is email verified?`),name:r().describe(`Display name`),image:r().optional().describe(`Avatar URL`),username:r().optional().describe(`Username (optional)`),roles:C(r()).optional().default([]).describe(`Assigned role IDs`),tenantId:r().optional().describe(`Current tenant ID`),language:r().default(`en`).describe(`Preferred language`),timezone:r().optional().describe(`Preferred timezone`),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional()}),Ic=h({id:r(),expiresAt:r().datetime(),token:r().optional(),ipAddress:r().optional(),userAgent:r().optional(),userId:r()});h({type:E([`email`,`username`,`phone`,`magic-link`,`social`]).default(`email`).describe(`Login method`),email:r().email().optional().describe(`Required for email/magic-link`),username:r().optional().describe(`Required for username login`),password:r().optional().describe(`Required for password login`),provider:r().optional().describe(`Required for social (google, github)`),redirectTo:r().optional().describe(`Redirect URL after successful login`)}),h({email:r().email(),password:r(),name:r(),image:r().optional()}),h({refreshToken:r().describe(`Refresh token`)}),R.extend({data:h({session:Ic.describe(`Active Session Info`),user:Fc.describe(`Current User Details`),token:r().optional().describe(`Bearer token if not using cookies`)})}),R.extend({data:Fc});var Lc={signInEmail:`/sign-in/email`,signUpEmail:`/sign-up/email`,signOut:`/sign-out`,getSession:`/get-session`,forgetPassword:`/forget-password`,resetPassword:`/reset-password`,sendVerificationEmail:`/send-verification-email`,verifyEmail:`/verify-email`,twoFactorEnable:`/two-factor/enable`,twoFactorVerify:`/two-factor/verify`,passkeyRegister:`/passkey/register`,passkeyAuthenticate:`/passkey/authenticate`,magicLinkSend:`/magic-link/send`,magicLinkVerify:`/magic-link/verify`};h({signInEmail:h({method:m(`POST`),path:m(Lc.signInEmail),description:m(`Sign in with email and password`)}),signUpEmail:h({method:m(`POST`),path:m(Lc.signUpEmail),description:m(`Register new user with email and password`)}),signOut:h({method:m(`POST`),path:m(Lc.signOut),description:m(`Sign out current user`)}),getSession:h({method:m(`GET`),path:m(Lc.getSession),description:m(`Get current user session`)}),forgetPassword:h({method:m(`POST`),path:m(Lc.forgetPassword),description:m(`Request password reset email`)}),resetPassword:h({method:m(`POST`),path:m(Lc.resetPassword),description:m(`Reset password with token`)}),sendVerificationEmail:h({method:m(`POST`),path:m(Lc.sendVerificationEmail),description:m(`Send email verification link`)}),verifyEmail:h({method:m(`GET`),path:m(Lc.verifyEmail),description:m(`Verify email with token`)})}),Lc.signInEmail,Lc.signUpEmail,Lc.signOut,Lc.getSession,Lc.signInEmail,Lc.signUpEmail,Lc.signOut,Lc.getSession,Lc.getSession;var Rc=h({id:r().describe(`Provider ID (e.g., google, github, microsoft)`),name:r().describe(`Display name (e.g., Google, GitHub)`),enabled:S().describe(`Whether this provider is enabled`)}),zc=h({enabled:S().describe(`Whether email/password auth is enabled`),disableSignUp:S().optional().describe(`Whether new user registration is disabled`),requireEmailVerification:S().optional().describe(`Whether email verification is required`)}),Bc=h({twoFactor:S().default(!1).describe(`Two-factor authentication enabled`),passkeys:S().default(!1).describe(`Passkey/WebAuthn support enabled`),magicLink:S().default(!1).describe(`Magic link login enabled`),organization:S().default(!1).describe(`Multi-tenant organization support enabled`)});h({emailPassword:zc.describe(`Email/password authentication config`),socialProviders:C(Rc).describe(`Available social/OAuth providers`),features:Bc.describe(`Enabled authentication features`)});var Vc=E([`global`,`tenant`,`user`,`session`,`temp`,`cache`,`data`,`logs`,`config`,`public`]).describe(`Storage scope classification`),Hc=h({path:r().describe(`File path`),name:r().describe(`File name`),size:P().int().describe(`File size in bytes`),mimeType:r().describe(`MIME type`),lastModified:r().datetime().describe(`Last modified timestamp`),created:r().datetime().describe(`Creation timestamp`),etag:r().optional().describe(`Entity tag`)}),Uc=E([`s3`,`azure_blob`,`gcs`,`minio`,`r2`,`spaces`,`wasabi`,`backblaze`,`local`]).describe(`Storage provider type`),Wc=E([`private`,`public_read`,`public_read_write`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full_control`]).describe(`Storage access control level`),Gc=E([`standard`,`intelligent`,`infrequent_access`,`glacier`,`deep_archive`]).describe(`Storage class/tier for cost optimization`),Kc=E([`transition`,`delete`,`abort`]).describe(`Lifecycle policy action type`);h({contentType:r().describe(`MIME type (e.g., image/jpeg, application/pdf)`),contentLength:P().min(0).describe(`File size in bytes`),contentEncoding:r().optional().describe(`Content encoding (e.g., gzip)`),contentDisposition:r().optional().describe(`Content disposition header`),contentLanguage:r().optional().describe(`Content language`),cacheControl:r().optional().describe(`Cache control directives`),etag:r().optional().describe(`Entity tag for versioning/caching`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),versionId:r().optional().describe(`Object version identifier`),storageClass:Gc.optional().describe(`Storage class/tier`),encryption:h({algorithm:r().describe(`Encryption algorithm (e.g., AES256, aws:kms)`),keyId:r().optional().describe(`KMS key ID if using managed encryption`)}).optional().describe(`Server-side encryption configuration`),custom:d(r(),r()).optional().describe(`Custom user-defined metadata`)}),h({operation:E([`get`,`put`,`delete`,`head`]).describe(`Allowed operation`),expiresIn:P().min(1).max(604800).describe(`Expiration time in seconds (max 7 days)`),contentType:r().optional().describe(`Required content type for PUT operations`),maxSize:P().min(0).optional().describe(`Maximum file size in bytes for PUT operations`),responseContentType:r().optional().describe(`Override content-type for GET operations`),responseContentDisposition:r().optional().describe(`Override content-disposition for GET operations`)});var qc=h({enabled:S().default(!0).describe(`Enable multipart uploads`),partSize:P().min(5*1024*1024).max(5*1024*1024*1024).default(10*1024*1024).describe(`Part size in bytes (min 5MB, max 5GB)`),maxParts:P().min(1).max(1e4).default(1e4).describe(`Maximum number of parts (max 10,000)`),threshold:P().min(0).default(100*1024*1024).describe(`File size threshold to trigger multipart upload (bytes)`),maxConcurrent:P().min(1).max(100).default(4).describe(`Maximum concurrent part uploads`),abortIncompleteAfterDays:P().min(1).optional().describe(`Auto-abort incomplete uploads after N days`)}),_ee=h({acl:Wc.default(`private`).describe(`Default access control level`),allowedOrigins:C(r()).optional().describe(`CORS allowed origins`),allowedMethods:C(E([`GET`,`PUT`,`POST`,`DELETE`,`HEAD`])).optional().describe(`CORS allowed HTTP methods`),allowedHeaders:C(r()).optional().describe(`CORS allowed headers`),exposeHeaders:C(r()).optional().describe(`CORS exposed headers`),maxAge:P().min(0).optional().describe(`CORS preflight cache duration in seconds`),corsEnabled:S().default(!1).describe(`Enable CORS configuration`),publicAccess:h({allowPublicRead:S().default(!1).describe(`Allow public read access`),allowPublicWrite:S().default(!1).describe(`Allow public write access`),allowPublicList:S().default(!1).describe(`Allow public bucket listing`)}).optional().describe(`Public access control`),allowedIps:C(r()).optional().describe(`Allowed IP addresses/CIDR blocks`),blockedIps:C(r()).optional().describe(`Blocked IP addresses/CIDR blocks`)}),Jc=h({id:fa.describe(`Rule identifier`),enabled:S().default(!0).describe(`Enable this rule`),action:Kc.describe(`Action to perform`),prefix:r().optional().describe(`Object key prefix filter (e.g., "uploads/")`),tags:d(r(),r()).optional().describe(`Object tag filters`),daysAfterCreation:P().min(0).optional().describe(`Days after object creation`),daysAfterModification:P().min(0).optional().describe(`Days after last modification`),targetStorageClass:Gc.optional().describe(`Target storage class for transition action`)}).refine(e=>!(e.action===`transition`&&!e.targetStorageClass),{message:`targetStorageClass is required when action is "transition"`}),Yc=h({enabled:S().default(!1).describe(`Enable lifecycle policies`),rules:C(Jc).default([]).describe(`Lifecycle rules`)}),Xc=h({name:fa.describe(`Bucket identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),bucketName:r().describe(`Actual bucket/container name in storage provider`),region:r().optional().describe(`Storage region (e.g., us-east-1, westus)`),provider:Uc.describe(`Storage provider`),endpoint:r().optional().describe(`Custom endpoint URL (for S3-compatible providers)`),pathStyle:S().default(!1).describe(`Use path-style URLs (for S3-compatible providers)`),versioning:S().default(!1).describe(`Enable object versioning`),encryption:h({enabled:S().default(!1).describe(`Enable server-side encryption`),algorithm:E([`AES256`,`aws:kms`,`azure:kms`,`gcp:kms`]).default(`AES256`).describe(`Encryption algorithm`),kmsKeyId:r().optional().describe(`KMS key ID for managed encryption`)}).optional().describe(`Server-side encryption configuration`),accessControl:_ee.optional().describe(`Access control configuration`),lifecyclePolicy:Yc.optional().describe(`Lifecycle policy configuration`),multipartConfig:qc.optional().describe(`Multipart upload configuration`),tags:d(r(),r()).optional().describe(`Bucket tags for organization`),description:r().optional().describe(`Bucket description`),enabled:S().default(!0).describe(`Enable this bucket`)}),Zc=h({accessKeyId:r().optional().describe(`AWS access key ID or MinIO access key`),secretAccessKey:r().optional().describe(`AWS secret access key or MinIO secret key`),sessionToken:r().optional().describe(`AWS session token for temporary credentials`),accountName:r().optional().describe(`Azure storage account name`),accountKey:r().optional().describe(`Azure storage account key`),sasToken:r().optional().describe(`Azure SAS token`),projectId:r().optional().describe(`GCP project ID`),credentials:r().optional().describe(`GCP service account credentials JSON`),endpoint:r().optional().describe(`Custom endpoint URL`),region:r().optional().describe(`Default region`),useSSL:S().default(!0).describe(`Use SSL/TLS for connections`),timeout:P().min(0).optional().describe(`Connection timeout in milliseconds`)}),Qc=h({name:fa.describe(`Storage configuration identifier`),label:r().describe(`Display label`),provider:Uc.describe(`Primary storage provider`),scope:Vc.optional().default(`global`).describe(`Storage scope`),connection:Zc.describe(`Connection credentials`),buckets:C(Xc).default([]).describe(`Configured buckets`),defaultBucket:r().optional().describe(`Default bucket name for operations`),location:r().optional().describe(`Root path (local) or base location`),quota:P().int().positive().optional().describe(`Max size in bytes`),options:d(r(),u()).optional().describe(`Provider-specific configuration options`),enabled:S().default(!0).describe(`Enable this storage configuration`),description:r().optional().describe(`Configuration description`)});Qc.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}),Qc.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}),Qc.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}),Qc.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}),h({filename:r().describe(`Original filename`),mimeType:r().describe(`File MIME type`),size:P().describe(`File size in bytes`),scope:r().default(`user`).describe(`Target storage scope (e.g. user, private, public)`),bucket:r().optional().describe(`Specific bucket override (admin only)`)}),h({fileId:r().describe(`File ID returned from presigned request`),eTag:r().optional().describe(`S3 ETag verification`)}),R.extend({data:h({uploadUrl:r().describe(`PUT/POST URL for direct upload`),downloadUrl:r().optional().describe(`Public/Private preview URL`),fileId:r().describe(`Temporary File ID`),method:E([`PUT`,`POST`]).describe(`HTTP Method to use`),headers:d(r(),r()).optional().describe(`Required headers for upload`),expiresIn:P().describe(`URL expiry in seconds`)})}),R.extend({data:Hc.describe(`Uploaded file metadata`)}),h({mode:E([`whitelist`,`blacklist`]).describe(`whitelist = only allow listed types, blacklist = block listed types`),mimeTypes:C(r()).min(1).describe(`List of MIME types to allow or block (e.g., "image/jpeg", "application/pdf")`),extensions:C(r()).optional().describe(`List of file extensions to allow or block (e.g., ".jpg", ".pdf")`),maxFileSize:P().int().min(1).optional().describe(`Maximum file size in bytes`),minFileSize:P().int().min(0).optional().describe(`Minimum file size in bytes (e.g., reject empty files)`)}),h({filename:r().describe(`Original filename`),mimeType:r().describe(`File MIME type`),totalSize:P().int().min(1).describe(`Total file size in bytes`),chunkSize:P().int().min(5242880).default(5242880).describe(`Size of each chunk in bytes (minimum 5MB per S3 spec)`),scope:r().default(`user`).describe(`Target storage scope`),bucket:r().optional().describe(`Specific bucket override (admin only)`),metadata:d(r(),r()).optional().describe(`Custom metadata key-value pairs`)}),R.extend({data:h({uploadId:r().describe(`Multipart upload session ID`),resumeToken:r().describe(`Opaque token for resuming interrupted uploads`),fileId:r().describe(`Assigned file ID`),totalChunks:P().int().min(1).describe(`Expected number of chunks`),chunkSize:P().int().describe(`Chunk size in bytes`),expiresAt:r().datetime().describe(`Upload session expiration timestamp`)})}),h({uploadId:r().describe(`Multipart upload session ID`),chunkIndex:P().int().min(0).describe(`Zero-based chunk index`),resumeToken:r().describe(`Resume token from initiate response`)}),R.extend({data:h({chunkIndex:P().int().describe(`Chunk index that was uploaded`),eTag:r().describe(`Chunk ETag for multipart completion`),bytesReceived:P().int().describe(`Bytes received for this chunk`)})}),h({uploadId:r().describe(`Multipart upload session ID`),parts:C(h({chunkIndex:P().int().describe(`Chunk index`),eTag:r().describe(`ETag returned from chunk upload`)})).min(1).describe(`Ordered list of uploaded parts for assembly`)}),R.extend({data:h({fileId:r().describe(`Final file ID`),key:r().describe(`Storage key/path of the assembled file`),size:P().int().describe(`Total file size in bytes`),mimeType:r().describe(`File MIME type`),eTag:r().optional().describe(`Final ETag of the assembled file`),url:r().optional().describe(`Download URL for the assembled file`)})}),R.extend({data:h({uploadId:r().describe(`Multipart upload session ID`),fileId:r().describe(`Assigned file ID`),filename:r().describe(`Original filename`),totalSize:P().int().describe(`Total file size in bytes`),uploadedSize:P().int().describe(`Bytes uploaded so far`),totalChunks:P().int().describe(`Total expected chunks`),uploadedChunks:P().int().describe(`Number of chunks uploaded`),percentComplete:P().min(0).max(100).describe(`Upload progress percentage`),status:E([`in_progress`,`completing`,`completed`,`failed`,`expired`]).describe(`Current upload session status`),startedAt:r().datetime().describe(`Upload session start timestamp`),expiresAt:r().datetime().describe(`Session expiration timestamp`)})});var $c=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),el=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),tl=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),nl=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:$c.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:el.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:tl.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:nl.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var rl=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),il=h({field:r().describe(`Field name to apply masking to`),strategy:rl.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(il).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var al=E(`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(`.`)),ol=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:fa.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var sl=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var cl=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),ll=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),ul=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),dl=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),fl=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:al.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(ol).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:sl.optional().describe(`Configuration for currency field type`),vectorConfig:cl.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:ll.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:nl.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:il.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:dl.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:ul.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),pl=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label for the rule listing`),description:r().optional().describe(`Administrative notes explaining the business reason`),active:S().default(!0),events:C(E([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:P().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:C(r()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:E([`error`,`warning`,`info`]).default(`error`),message:r().describe(`Error message to display to the user`)}),ml=pl.extend({type:m(`script`),condition:r().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),hl=pl.extend({type:m(`unique`),fields:C(r()).describe(`Fields that must be combined unique`),scope:r().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:S().default(!0)}),gl=pl.extend({type:m(`state_machine`),field:r().describe(`State field (e.g. status)`),transitions:d(r(),C(r())).describe(`Map of { OldState: [AllowedNewStates] }`)}),_l=pl.extend({type:m(`format`),field:r(),regex:r().optional(),format:E([`email`,`url`,`phone`,`json`]).optional()}),vl=pl.extend({type:m(`cross_field`),condition:r().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:C(r()).describe(`Fields involved in the validation`)}),yl=pl.extend({type:m(`json_schema`),field:r().describe(`JSON field to validate`),schema:d(r(),u()).describe(`JSON Schema object definition`)}),bl=pl.extend({type:m(`async`),field:r().describe(`Field to validate`),validatorUrl:r().optional().describe(`External API endpoint for validation`),method:E([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:d(r(),r()).optional().describe(`Custom headers for the request`),validatorFunction:r().optional().describe(`Reference to custom validator function`),timeout:P().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:P().optional().describe(`Debounce delay in milliseconds`),params:d(r(),u()).optional().describe(`Additional parameters to pass to validator`)}),xl=pl.extend({type:m(`custom`),handler:r().describe(`Name of the custom validation function registered in the system`),params:d(r(),u()).optional().describe(`Parameters passed to the custom handler`)}),Sl=F(()=>I(`type`,[ml,hl,gl,_l,vl,yl,bl,xl,Cl])),Cl=pl.extend({type:m(`conditional`),when:r().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:Sl.describe(`Validation rule to apply when condition is true`),otherwise:Sl.optional().describe(`Validation rule to apply when condition is false`)}),wl=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),Tl=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),El=h({target:r().optional().describe(`Target State ID`),cond:Tl.optional().describe(`Condition (Guard) required to take this path`),actions:C(wl).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)});h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)});var Dl=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(wl).optional().describe(`Actions to run when entering this state`),exit:C(wl).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),El,C(El)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(El).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),Dl).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),Ol=h({id:pa.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),Dl).describe(`State Nodes`),on:d(r(),l([r(),El,C(El)])).optional()}),kl=h({name:r(),label:co,type:al,required:S().default(!1),options:C(h({label:co,value:r()})).optional()}),Al=E([`script`,`url`,`modal`,`flow`,`api`]),jl=new Set(Al.options.filter(e=>e!==`script`)),Ml=h({name:pa.describe(`Machine name (lowercase snake_case)`),label:co.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:Al.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(kl).optional().describe(`Input parameters required from user`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:co.optional().describe(`Confirmation message before execution`),successMessage:co.optional().describe(`Success message to show after execution`),refreshAfter:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:lo.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(jl.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),Nl=E([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),Pl=h({trackHistory:S().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:S().default(!0).describe(`Index records for global search`),apiEnabled:S().default(!0).describe(`Expose object via automatic APIs`),apiMethods:C(Nl).optional().describe(`Whitelist of allowed API operations`),files:S().default(!1).describe(`Enable file attachments and document management`),feeds:S().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:S().default(!1).describe(`Enable standard tasks and events tracking`),trash:S().default(!0).describe(`Enable soft-delete with restore capability`),mru:S().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:S().default(!0).describe(`Allow record deep cloning`)}),Fl=h({name:r().optional().describe(`Index name (auto-generated if not provided)`),fields:C(r()).describe(`Fields included in the index`),type:E([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:S().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:r().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),Il=h({fields:C(r()).describe(`Fields to index for full-text search weighting`),displayFields:C(r()).optional().describe(`Fields to display in search result cards`),filters:C(r()).optional().describe(`Default filters for search results`)}),Ll=h({enabled:S().describe(`Enable multi-tenancy for this object`),strategy:E([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:r().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:S().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),Rl=h({enabled:S().describe(`Enable soft delete (trash/recycle bin)`),field:r().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:S().default(!1).describe(`Cascade soft delete to related records`)}),zl=h({enabled:S().describe(`Enable record versioning`),strategy:E([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:P().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:r().default(`version`).describe(`Field name for version number/timestamp`)}),Bl=h({enabled:S().describe(`Enable table partitioning`),strategy:E([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:r().describe(`Field name to partition by`),interval:r().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"`}),Vl=h({enabled:S().describe(`Enable Change Data Capture`),events:C(E([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:r().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),Hl=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:r().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:r().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:r().optional().describe(`Developer documentation / description`),icon:r().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:r().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:C(r()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:S().optional().default(!0).describe(`Is the object active and usable`),isSystem:S().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:S().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:r().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:r().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:d(r().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),fl).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:C(Fl).optional().describe(`Database performance indexes`),tenancy:Ll.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:Rl.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:zl.optional().describe(`Record versioning and history tracking configuration`),partitioning:Bl.optional().describe(`Table partitioning configuration for performance`),cdc:Vl.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:C(Sl).optional().describe(`Object-level validation rules`),stateMachines:d(r(),Ol).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:r().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:h({type:E([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:r().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:P().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:r().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:C(r()).optional().describe(`Primary fields for hover/cards/lookups`),search:Il.optional().describe(`Search engine configuration`),enable:Pl.optional().describe(`Enabled system features modules`),recordTypes:C(r()).optional().describe(`Record type names for this object`),sharingModel:E([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:r().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:C(Ml).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function Ul(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var Wl=Object.assign(Hl,{create:e=>{let t={...e,label:e.label??Ul(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return Hl.parse(t)}});E([`own`,`extend`]),h({extend:r().describe(`Target object name (FQN) to extend`),fields:d(r(),fl).optional().describe(`Fields to add/override`),label:r().optional().describe(`Override label for the extended object`),pluralLabel:r().optional().describe(`Override plural label for the extended object`),description:r().optional().describe(`Override description for the extended object`),validations:C(Sl).optional().describe(`Additional validation rules to merge into the target object`),indexes:C(Fl).optional().describe(`Additional indexes to merge into the target object`),priority:P().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)});var Gl=h({id:pa.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:co.describe(`Display proper label`),icon:r().optional().describe(`Icon name`),order:P().optional().describe(`Sort order within the same level (lower = first)`),badge:l([r(),P()]).optional().describe(`Badge text or count displayed on the item`),visible:r().optional().describe(`Visibility formula condition`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this item`)}),Kl=Gl.extend({type:m(`object`),objectName:r().describe(`Target object name`),viewName:r().optional().describe(`Default list view to open. Defaults to "all"`)}),ql=Gl.extend({type:m(`dashboard`),dashboardName:r().describe(`Target dashboard name`)}),Jl=Gl.extend({type:m(`page`),pageName:r().describe(`Target custom page component name`),params:d(r(),u()).optional().describe(`Parameters passed to the page context`)}),Yl=Gl.extend({type:m(`url`),url:r().describe(`Target external URL`),target:E([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),Xl=Gl.extend({type:m(`report`),reportName:r().describe(`Target report name`)}),Zl=Gl.extend({type:m(`action`),actionDef:h({actionName:r().describe(`Action machine name to execute`),params:d(r(),u()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),Ql=Gl.extend({type:m(`group`),expanded:S().default(!1).describe(`Default expansion state in sidebar`)}),$l=F(()=>l([Kl.extend({children:C($l).optional().describe(`Child navigation items (e.g. specific views)`)}),ql,Jl,Yl,Xl,Zl,Ql.extend({children:C($l).describe(`Child navigation items`)})])),eu=h({primaryColor:r().optional().describe(`Primary theme color hex code`),logo:r().optional().describe(`Custom logo URL for this app`),favicon:r().optional().describe(`Custom favicon URL for this app`)}),tu=h({id:pa.describe(`Unique area identifier (lowercase snake_case)`),label:co.describe(`Area display label`),icon:r().optional().describe(`Area icon name`),order:P().optional().describe(`Sort order among areas (lower = first)`),description:co.optional().describe(`Area description`),visible:r().optional().describe(`Visibility formula condition for this area`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this area`),navigation:C($l).describe(`Navigation items within this area`)}),nu=h({name:pa.describe(`App unique machine name (lowercase snake_case)`),label:co.describe(`App display label`),version:r().optional().describe(`App version`),description:co.optional().describe(`App description`),icon:r().optional().describe(`App icon used in the App Launcher`),branding:eu.optional().describe(`App-specific branding`),active:S().optional().default(!0).describe(`Whether the app is enabled`),isDefault:S().optional().default(!1).describe(`Is default app`),navigation:C($l).optional().describe(`Full navigation tree for the app sidebar`),areas:C(tu).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:r().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this app`),objects:C(u()).optional().describe(`Objects belonging to this app`),apis:C(u()).optional().describe(`Custom APIs belonging to this app`),sharing:po.optional().describe(`Public sharing configuration`),embed:mo.optional().describe(`Iframe embedding configuration`),mobileNavigation:h({mode:E([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:C(r()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:lo.optional().describe(`ARIA accessibility attributes for the application`)}),ru=E([`json`,`yaml`,`typescript`,`javascript`]),iu=h({size:P().int().min(0).describe(`File size in bytes`),modifiedAt:r().datetime().describe(`Last modified date`),etag:r().describe(`Entity tag for cache validation`),format:ru.describe(`Serialization format`),path:r().optional().describe(`File system path`),metadata:d(r(),u()).optional().describe(`Provider-specific metadata`)});h({patterns:C(r()).optional().describe(`File glob patterns`),ifNoneMatch:r().optional().describe(`ETag for conditional request`),ifModifiedSince:r().datetime().optional().describe(`Only load if modified after this date`),validate:S().default(!0).describe(`Validate against schema`),useCache:S().default(!0).describe(`Enable caching`),filter:r().optional().describe(`Filter predicate as string`),limit:P().int().min(1).optional().describe(`Maximum items to load`),recursive:S().default(!0).describe(`Search subdirectories`)}),h({format:ru.default(`typescript`).describe(`Output format`),prettify:S().default(!0).describe(`Format with indentation`),indent:P().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:S().default(!1).describe(`Sort object keys`),includeDefaults:S().default(!1).describe(`Include default values`),backup:S().default(!1).describe(`Create backup file`),overwrite:S().default(!0).describe(`Overwrite existing file`),atomic:S().default(!0).describe(`Use atomic write operation`),path:r().optional().describe(`Custom output path`)}),h({output:r().describe(`Output file path`),format:ru.default(`json`).describe(`Export format`),filter:r().optional().describe(`Filter items to export`),includeStats:S().default(!1).describe(`Include metadata statistics`),compress:S().default(!1).describe(`Compress output (gzip)`),prettify:S().default(!0).describe(`Pretty print output`)}),h({conflictResolution:E([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Simulate import without saving`),continueOnError:S().default(!1).describe(`Continue if validation fails`),transform:r().optional().describe(`Transform items before import`)}),h({data:u().nullable().describe(`Loaded metadata`),fromCache:S().default(!1).describe(`Loaded from cache`),notModified:S().default(!1).describe(`Not modified since last request`),etag:r().optional().describe(`Entity tag`),stats:iu.optional().describe(`Metadata statistics`),loadTime:P().min(0).optional().describe(`Load duration in ms`)}),h({success:S().describe(`Save successful`),path:r().describe(`Output path`),etag:r().optional().describe(`Generated entity tag`),size:P().int().min(0).optional().describe(`File size`),saveTime:P().min(0).optional().describe(`Save duration in ms`),backupPath:r().optional().describe(`Backup file path`)}),h({type:E([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:r().describe(`Type of metadata`),name:r().describe(`Item identifier`),path:r().describe(`File path`),data:u().optional().describe(`Item data`),timestamp:r().datetime().describe(`Event timestamp`)}),h({type:r().describe(`Collection type`),count:P().int().min(0).describe(`Number of items`),formats:C(ru).describe(`Formats in collection`),totalSize:P().int().min(0).optional().describe(`Total size in bytes`),lastModified:r().datetime().optional().describe(`Last modification date`),location:r().optional().describe(`Collection location`)}),h({name:r().describe(`Loader identifier`),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)}).describe(`Loader capabilities`),supportedFormats:C(ru).describe(`Supported formats`),supportsWatch:S().default(!1).describe(`Supports file watching`),supportsWrite:S().default(!0).describe(`Supports write operations`),supportsCache:S().default(!0).describe(`Supports caching`)});var au=E([`filesystem`,`memory`,`none`]),ou=h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:au.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory path`),formats:C(ru).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:h({enabled:S().default(!0).describe(`Enable caching`),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:S().default(!1).describe(`Enable file watching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`),ignoreInitial:S().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:h({strict:S().default(!0).describe(`Strict validation`),throwOnError:S().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:d(r(),u()).optional().describe(`Loader-specific configuration`)});E([`package`,`admin`,`user`,`migration`,`api`]);var su=h({path:r().describe(`JSON path to the changed field`),originalValue:u().optional().describe(`Original value from the package`),currentValue:u().describe(`Current customized value`),changedBy:r().optional().describe(`User or admin who made this change`),changedAt:r().datetime().optional().describe(`Timestamp of the change`)}),cu=h({id:r().describe(`Overlay record ID (UUID)`),baseType:r().describe(`Metadata type being customized`),baseName:r().describe(`Metadata name being customized`),packageId:r().optional().describe(`Package ID that delivered the base metadata`),packageVersion:r().optional().describe(`Package version when overlay was created`),scope:E([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:r().optional().describe(`Tenant identifier`),owner:r().optional().describe(`Owner user ID for user-scope overlays`),patch:d(r(),u()).describe(`JSON Merge Patch payload (changed fields only)`),changes:C(su).optional().describe(`Field-level change tracking for conflict detection`),active:S().default(!0).describe(`Whether this overlay is active`),createdAt:r().datetime().optional(),createdBy:r().optional(),updatedAt:r().datetime().optional(),updatedBy:r().optional()}),lu=h({path:r().describe(`JSON path to the conflicting field`),baseValue:u().describe(`Value in the old package version`),incomingValue:u().describe(`Value in the new package version`),customValue:u().describe(`Customer customized value`),suggestedResolution:E([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:r().optional().describe(`Explanation for the suggested resolution`)}),uu=h({defaultStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:C(r()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:C(r()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:S().default(!0).describe(`Auto-resolve changes that do not conflict`)});h({success:S().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:d(r(),u()).optional().describe(`Merged metadata result`),updatedOverlay:d(r(),u()).optional().describe(`Updated overlay after merge`),conflicts:C(lu).optional().describe(`Unresolved merge conflicts`),autoResolved:C(h({path:r(),resolution:r(),description:r().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:h({totalFields:P().int().min(0).describe(`Total fields evaluated`),unchanged:P().int().min(0).describe(`Fields with no changes`),autoResolved:P().int().min(0).describe(`Fields auto-resolved`),conflicts:P().int().min(0).describe(`Fields with conflicts`)}).optional()});var du=h({metadataType:r().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:S().default(!0),lockedFields:C(r()).optional().describe(`Field paths that cannot be customized`),customizableFields:C(r()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:S().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:S().default(!1).describe(`Whether admins can delete package-delivered fields`)}),fu=E([`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`]),pu=h({type:fu.describe(`Metadata type identifier`),label:r().describe(`Display label for the metadata type`),description:r().optional().describe(`Description of the metadata type`),filePatterns:C(r()).describe(`Glob patterns to discover files of this type`),supportsOverlay:S().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:S().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:S().default(!1).describe(`Whether version history is tracked`),loadOrder:P().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:E([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)}),mu=h({types:C(fu).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),packageId:r().optional().describe(`Filter by owning package`),search:r().optional().describe(`Full-text search query`),scope:E([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:E([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:C(r()).optional().describe(`Filter by tags`),sortBy:E([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(500).default(50).describe(`Items per page`)}),hu=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),namespace:r().optional().describe(`Namespace`),label:r().optional().describe(`Display label`),scope:E([`system`,`platform`,`user`]).optional(),state:E([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:r().optional(),updatedAt:r().datetime().optional()})).describe(`Matched metadata items`),total:P().int().min(0).describe(`Total matching items`),page:P().int().min(1).describe(`Current page`),pageSize:P().int().min(1).describe(`Page size`)});h({event:E([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:fu.describe(`Metadata type`),name:r().describe(`Metadata item name`),namespace:r().optional().describe(`Namespace`),packageId:r().optional().describe(`Owning package ID`),timestamp:r().datetime().describe(`Event timestamp`),actor:r().optional().describe(`User or system that triggered the event`),payload:d(r(),u()).optional().describe(`Event-specific payload`)});var gu=h({valid:S().describe(`Whether the metadata is valid`),errors:C(h({path:r().describe(`JSON path to the invalid field`),message:r().describe(`Error description`),code:r().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:C(h({path:r().describe(`JSON path to the field`),message:r().describe(`Warning description`)})).optional().describe(`Validation warnings`)}),_u=h({storage:ou.describe(`Storage backend configuration`),customizationPolicies:C(du).optional().describe(`Default customization policies per type`),mergeStrategy:uu.optional().describe(`Merge strategy for package upgrades`),additionalTypes:C(pu.omit({type:!0}).extend({type:r().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:S().default(!0).describe(`Emit metadata change events`),validateOnWrite:S().default(!0).describe(`Validate metadata on write`),enableVersioning:S().default(!1).describe(`Track metadata version history`),cacheMaxItems:P().int().min(0).default(1e4).describe(`Max items in memory cache`)});h({id:m(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:m(`ObjectStack Metadata Service`).describe(`Plugin name`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:m(`standard`).describe(`Plugin type`),description:r().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:h({crud:S().default(!0).describe(`Supports metadata CRUD`),query:S().default(!0).describe(`Supports metadata query`),overlay:S().default(!0).describe(`Supports customization overlays`),watch:S().default(!1).describe(`Supports file watching`),importExport:S().default(!0).describe(`Supports import/export`),validation:S().default(!0).describe(`Supports schema validation`),versioning:S().default(!1).describe(`Supports version history`),events:S().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:_u.optional().describe(`Plugin configuration`)}),h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue if individual item fails`),validate:S().default(!0).describe(`Validate before register`)});var vu=h({total:P().int().min(0).describe(`Total items processed`),succeeded:P().int().min(0).describe(`Successfully processed`),failed:P().int().min(0).describe(`Failed items`),errors:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),error:r().describe(`Error message`)})).optional().describe(`Per-item errors`)}),yu=h({sourceType:r().describe(`Dependent metadata type`),sourceName:r().describe(`Dependent metadata name`),targetType:r().describe(`Referenced metadata type`),targetName:r().describe(`Referenced metadata name`),kind:E([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)});R.extend({data:Wl.describe(`Full Object Schema`)}),R.extend({data:nu.describe(`Full App Configuration`)}),R.extend({data:C(h({name:r(),label:r(),icon:r().optional(),description:r().optional()})).describe(`List of available concepts (Objects, Apps, Flows)`)}),h({type:fu.describe(`Metadata type`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Item name (snake_case)`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Optional namespace`)}),R.extend({data:h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),definition:d(r(),u()).describe(`Metadata definition payload`)}).describe(`Metadata item`)}),R.extend({data:C(d(r(),u())).describe(`Array of metadata definitions`)}),R.extend({data:C(r()).describe(`Array of metadata item names`)}),R.extend({data:h({exists:S().describe(`Whether the item exists`)})}),R.extend({data:h({type:r().describe(`Metadata type`),name:r().describe(`Deleted item name`)})}),mu.describe(`Metadata query with filtering, sorting, and pagination`),R.extend({data:hu.describe(`Paginated query result`)}),h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue on individual failure`),validate:S().default(!0).describe(`Validate before registering`)}),h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`)})).min(1).describe(`Items to unregister`)}),R.extend({data:vu.describe(`Bulk operation result`)}),R.extend({data:cu.optional().describe(`Overlay definition, undefined if none`)}),cu.describe(`Overlay to save`),R.extend({data:d(r(),u()).optional().describe(`Effective metadata with all overlays applied`)}),h({types:C(r()).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),format:E([`json`,`yaml`]).default(`json`).describe(`Export format`)}),R.extend({data:u().describe(`Exported metadata bundle`)}),h({data:u().describe(`Metadata bundle to import`),conflictResolution:E([`skip`,`overwrite`,`merge`]).default(`skip`).describe(`Conflict resolution strategy`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Dry run (no save)`)}),R.extend({data:h({total:P().int().min(0),imported:P().int().min(0),skipped:P().int().min(0),failed:P().int().min(0),errors:C(h({type:r(),name:r(),error:r()})).optional()}).describe(`Import result`)}),h({type:r().describe(`Metadata type to validate against`),data:u().describe(`Metadata payload to validate`)}),R.extend({data:gu.describe(`Validation result`)}),R.extend({data:C(r()).describe(`Registered metadata type identifiers`)}),R.extend({data:h({type:r().describe(`Metadata type identifier`),label:r().describe(`Display label`),description:r().optional().describe(`Description`),filePatterns:C(r()).describe(`File glob patterns`),supportsOverlay:S().describe(`Overlay support`),domain:r().describe(`Protocol domain`)}).optional().describe(`Type info`)}),R.extend({data:C(yu).describe(`Items this item depends on`)}),R.extend({data:C(yu).describe(`Items that depend on this item`)});var bu=E([`metadata`,`data`,`auth`,`file-storage`,`search`,`cache`,`queue`,`automation`,`graphql`,`analytics`,`realtime`,`job`,`notification`,`ai`,`i18n`,`ui`,`workflow`]),xu=E([`required`,`core`,`optional`]);h({name:bu,enabled:S(),status:E([`running`,`stopped`,`degraded`,`initializing`]),version:r().optional(),provider:r().optional().describe(`Implementation provider (e.g. "s3" for storage)`),features:C(r()).optional().describe(`List of supported sub-features`)}),d(bu,u().describe(`Service Instance implementing the protocol interface`)),h({id:r(),name:bu,options:d(r(),u()).optional()}),h({routes:C(h({prefix:r().regex(/^\//).describe(`URL path prefix for routing (e.g. /api/v1/data)`),service:bu.describe(`Target core service name`),authRequired:S().default(!0).describe(`Whether authentication is required`),criticality:xu.default(`optional`).describe(`Service criticality level for unavailability handling`),permissions:C(r()).optional().describe(`Required permissions for this route namespace`)})).describe(`Route-to-service mappings`),fallback:E([`404`,`proxy`,`custom`]).default(`404`).describe(`Behavior when no route matches`),proxyTarget:r().url().optional().describe(`Proxy target URL when fallback is "proxy"`)}),E([`404`,`405`,`501`,`503`]).describe(`404 = route not found, 405 = method not allowed, 501 = not implemented (stub), 503 = service unavailable`),h({success:m(!1),error:h({code:P().int().describe(`HTTP status code (404, 405, 501, 503, …)`),message:r().describe(`Human-readable error message`),type:E([`ROUTE_NOT_FOUND`,`METHOD_NOT_ALLOWED`,`NOT_IMPLEMENTED`,`SERVICE_UNAVAILABLE`]).optional().describe(`Machine-readable error type`),route:r().optional().describe(`Requested route path`),service:r().optional().describe(`Target service name, if resolvable`),hint:r().optional().describe(`Actionable hint for the developer (e.g., "Install plugin-workflow")`)})});var Su=h({port:P().int().min(1).max(65535).default(3e3).describe(`Port number to listen on`),host:r().default(`0.0.0.0`).describe(`Host address to bind to`),cors:Yi.optional().describe(`CORS configuration`),requestTimeout:P().int().default(3e4).describe(`Request timeout in milliseconds`),bodyLimit:r().default(`10mb`).describe(`Maximum request body size`),compression:S().default(!0).describe(`Enable response compression`),security:h({helmet:S().default(!0).describe(`Enable security headers via helmet`),rateLimit:Xi.optional().describe(`Global rate limiting configuration`)}).optional().describe(`Security configuration`),static:C(Zi).optional().describe(`Static file serving configuration`),trustProxy:S().default(!1).describe(`Trust X-Forwarded-* headers`)});h({method:Ki.describe(`HTTP method`),path:r().describe(`URL path pattern`),handler:r().describe(`Handler identifier or name`),metadata:h({summary:r().optional().describe(`Route summary for documentation`),description:r().optional().describe(`Route description`),tags:C(r()).optional().describe(`Tags for grouping`),operationId:r().optional().describe(`Unique operation identifier`)}).optional(),security:h({authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:r().optional().describe(`Rate limit policy override`)}).optional()});var Cu=E([`authentication`,`authorization`,`logging`,`validation`,`transformation`,`error`,`custom`]),wu=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Middleware name (snake_case)`),type:Cu.describe(`Middleware type`),enabled:S().default(!0).describe(`Whether middleware is enabled`),order:P().int().default(100).describe(`Execution order priority`),config:d(r(),u()).optional().describe(`Middleware configuration object`),paths:h({include:C(r()).optional().describe(`Include path patterns (glob)`),exclude:C(r()).optional().describe(`Exclude path patterns (glob)`)}).optional().describe(`Path filtering`)});h({type:E([`starting`,`started`,`stopping`,`stopped`,`request`,`response`,`error`]).describe(`Event type`),timestamp:r().datetime().describe(`Event timestamp (ISO 8601)`),data:d(r(),u()).optional().describe(`Event-specific data`)}),h({httpVersions:C(E([`1.0`,`1.1`,`2.0`,`3.0`])).default([`1.1`]).describe(`Supported HTTP versions`),websocket:S().default(!1).describe(`WebSocket support`),sse:S().default(!1).describe(`Server-Sent Events support`),serverPush:S().default(!1).describe(`HTTP/2 Server Push support`),streaming:S().default(!0).describe(`Response streaming support`),middleware:S().default(!0).describe(`Middleware chain support`),routeParams:S().default(!0).describe(`URL parameter support (/users/:id)`),compression:S().default(!0).describe(`Built-in compression support`)}),h({state:E([`stopped`,`starting`,`running`,`stopping`,`error`]).describe(`Current server state`),uptime:P().int().optional().describe(`Server uptime in milliseconds`),server:h({port:P().int().describe(`Listening port`),host:r().describe(`Bound host`),url:r().optional().describe(`Full server URL`)}).optional(),connections:h({active:P().int().describe(`Active connections`),total:P().int().describe(`Total connections handled`)}).optional(),requests:h({total:P().int().describe(`Total requests processed`),success:P().int().describe(`Successful requests`),errors:P().int().describe(`Failed requests`)}).optional()}),Object.assign(Su,{create:e=>e}),Object.assign(wu,{create:e=>e});var Tu=E([`discovery`,`metadata`,`data`,`batch`,`permission`,`analytics`,`automation`,`workflow`,`ui`,`realtime`,`notification`,`ai`,`i18n`]),Eu=E([`implemented`,`stub`,`planned`]),Du=h({method:Ki.describe(`HTTP method for this endpoint`),path:r().describe(`URL path pattern (e.g., /api/v1/data/:object/:id)`),handler:r().describe(`Protocol method name or handler identifier`),category:Tu.describe(`Route category`),public:S().default(!1).describe(`Is publicly accessible without authentication`),permissions:C(r()).optional().describe(`Required permissions (e.g., ["data.read", "object.account.read"])`),summary:r().optional().describe(`Short description for OpenAPI`),description:r().optional().describe(`Detailed description for OpenAPI`),tags:C(r()).optional().describe(`OpenAPI tags for grouping`),requestSchema:r().optional().describe(`Request schema name (for validation)`),responseSchema:r().optional().describe(`Response schema name (for documentation)`),timeout:P().int().optional().describe(`Request timeout in milliseconds`),rateLimit:r().optional().describe(`Rate limit policy name`),cacheable:S().default(!1).describe(`Whether response can be cached`),cacheTtl:P().int().optional().describe(`Cache TTL in seconds`),handlerStatus:Eu.optional().describe(`Handler implementation status: implemented (default if omitted), stub, or planned`)}),Ou=h({prefix:r().regex(/^\//).describe(`URL path prefix for this route group`),service:r().describe(`Core service name (metadata, data, auth, etc.)`),category:Tu.describe(`Primary category for this route group`),methods:C(r()).optional().describe(`Protocol method names implemented`),endpoints:C(Du).optional().describe(`Endpoint definitions`),middleware:C(wu).optional().describe(`Middleware stack for this route group`),authRequired:S().default(!0).describe(`Whether authentication is required by default`),documentation:h({title:r().optional().describe(`Route group title`),description:r().optional().describe(`Route group description`),tags:C(r()).optional().describe(`OpenAPI tags`)}).optional().describe(`Documentation metadata for this route group`)}),ku=E([`strict`,`permissive`,`strip`]),Au=h({enabled:S().default(!0).describe(`Enable automatic request validation`),mode:ku.default(`strict`).describe(`How to handle validation errors`),validateBody:S().default(!0).describe(`Validate request body against schema`),validateQuery:S().default(!0).describe(`Validate query string parameters`),validateParams:S().default(!0).describe(`Validate URL path parameters`),validateHeaders:S().default(!1).describe(`Validate request headers`),includeFieldErrors:S().default(!0).describe(`Include field-level error details in response`),errorPrefix:r().optional().describe(`Custom prefix for validation error messages`),schemaRegistry:r().optional().describe(`Schema registry name to use for validation`)}),ju=h({enabled:S().default(!0).describe(`Enable automatic response envelope wrapping`),includeMetadata:S().default(!0).describe(`Include meta object in responses`),includeTimestamp:S().default(!0).describe(`Include timestamp in response metadata`),includeRequestId:S().default(!0).describe(`Include requestId in response metadata`),includeDuration:S().default(!1).describe(`Include request duration in ms`),includeTraceId:S().default(!1).describe(`Include distributed traceId`),customMetadata:d(r(),u()).optional().describe(`Additional metadata fields to include`),skipIfWrapped:S().default(!0).describe(`Skip wrapping if response already has success field`)}),Mu=h({enabled:S().default(!0).describe(`Enable standardized error handling`),includeStackTrace:S().default(!1).describe(`Include stack traces in error responses`),logErrors:S().default(!0).describe(`Log errors to system logger`),exposeInternalErrors:S().default(!1).describe(`Expose internal error details in responses`),includeRequestId:S().default(!0).describe(`Include requestId in error responses`),includeTimestamp:S().default(!0).describe(`Include timestamp in error responses`),includeDocumentation:S().default(!0).describe(`Include documentation URLs for errors`),documentationBaseUrl:r().url().optional().describe(`Base URL for error documentation`),customErrorMessages:d(r(),r()).optional().describe(`Custom error messages by error code`),redactFields:C(r()).optional().describe(`Field names to redact from error details`)}),Nu=h({enabled:S().default(!0).describe(`Enable automatic OpenAPI documentation generation`),version:E([`3.0.0`,`3.0.1`,`3.0.2`,`3.0.3`,`3.1.0`]).default(`3.0.3`).describe(`OpenAPI specification version`),title:r().default(`ObjectStack API`).describe(`API title`),description:r().optional().describe(`API description`),apiVersion:r().default(`1.0.0`).describe(`API version`),outputPath:r().default(`/api/docs/openapi.json`).describe(`URL path to serve OpenAPI JSON`),uiPath:r().default(`/api/docs`).describe(`URL path to serve documentation UI`),uiFramework:E([`swagger-ui`,`redoc`,`rapidoc`,`elements`]).default(`swagger-ui`).describe(`Documentation UI framework`),includeInternal:S().default(!1).describe(`Include internal endpoints in documentation`),generateSchemas:S().default(!0).describe(`Auto-generate schemas from Zod definitions`),includeExamples:S().default(!0).describe(`Include request/response examples`),servers:C(h({url:r().describe(`Server URL`),description:r().optional().describe(`Server description`)})).optional().describe(`Server URLs for API`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`API contact information`),license:h({name:r().describe(`License name`),url:r().url().optional().describe(`License URL`)}).optional().describe(`API license information`),securitySchemes:d(r(),h({type:E([`apiKey`,`http`,`oauth2`,`openIdConnect`]),scheme:r().optional(),bearerFormat:r().optional()})).optional().describe(`Security scheme definitions`)}),Pu=h({enabled:S().default(!0).describe(`Enable REST API plugin`),basePath:r().default(`/api`).describe(`Base path for all API routes`),version:r().default(`v1`).describe(`API version identifier`),routes:C(Ou).describe(`Route registrations`),validation:Au.optional().describe(`Request validation configuration`),responseEnvelope:ju.optional().describe(`Response envelope configuration`),errorHandling:Mu.optional().describe(`Error handling configuration`),openApi:Nu.optional().describe(`OpenAPI documentation configuration`),globalMiddleware:C(wu).optional().describe(`Global middleware stack`),cors:h({enabled:S().default(!0),origins:C(r()).optional(),methods:C(Ki).optional(),credentials:S().default(!0)}).optional().describe(`CORS configuration`),performance:h({enableCompression:S().default(!0).describe(`Enable response compression`),enableETag:S().default(!0).describe(`Enable ETag generation`),enableCaching:S().default(!0).describe(`Enable HTTP caching`),defaultCacheTtl:P().int().default(300).describe(`Default cache TTL in seconds`)}).optional().describe(`Performance optimization settings`)});Object.assign(Pu,{create:e=>e}),Object.assign(Ou,{create:e=>e});var Fu=h({path:r().describe(`Full URL path (e.g. /api/v1/analytics/query)`),method:Ki.describe(`HTTP method (GET, POST, etc.)`),category:Tu.describe(`Route category`),handlerStatus:Eu.describe(`Handler status`),service:r().describe(`Target service name`),healthCheckPassed:S().optional().describe(`Whether the health check probe succeeded`)});h({timestamp:r().describe(`ISO 8601 timestamp`),adapter:r().describe(`Adapter name (e.g. "hono", "express", "nextjs")`),summary:h({total:P().int().describe(`Total declared endpoints`),implemented:P().int().describe(`Endpoints with real handlers`),stub:P().int().describe(`Endpoints with stub handlers (501)`),planned:P().int().describe(`Endpoints not yet implemented`)}),entries:C(Fu).describe(`Per-endpoint coverage entries`)}),E([`rest`,`graphql`,`odata`]);var Iu=h({operator:r().describe(`Unified DSL operator`),rest:r().optional().describe(`REST query parameter template`),graphql:r().optional().describe(`GraphQL where clause template`),odata:r().optional().describe(`OData $filter expression template`)}),Lu=h({filterStyle:E([`bracket`,`dot`,`flat`,`rsql`]).default(`bracket`).describe(`REST filter parameter encoding style`),pagination:h({limitParam:r().default(`limit`).describe(`Page size parameter name`),offsetParam:r().default(`offset`).describe(`Offset parameter name`),cursorParam:r().default(`cursor`).describe(`Cursor parameter name`),pageParam:r().default(`page`).describe(`Page number parameter name`)}).optional().describe(`Pagination parameter name mappings`),sorting:h({param:r().default(`sort`).describe(`Sort parameter name`),format:E([`comma`,`array`,`pipe`]).default(`comma`).describe(`Sort parameter encoding format`)}).optional().describe(`Sort parameter mapping`),fieldsParam:r().default(`fields`).describe(`Field selection parameter name`)}),Ru=h({filterArgName:r().default(`where`).describe(`GraphQL filter argument name`),filterStyle:E([`nested`,`flat`,`array`]).default(`nested`).describe(`GraphQL filter nesting style`),pagination:h({limitArg:r().default(`limit`).describe(`Page size argument name`),offsetArg:r().default(`offset`).describe(`Offset argument name`),firstArg:r().default(`first`).describe(`Relay "first" argument name`),afterArg:r().default(`after`).describe(`Relay "after" cursor argument name`)}).optional().describe(`Pagination argument name mappings`),sorting:h({argName:r().default(`orderBy`).describe(`Sort argument name`),format:E([`enum`,`array`]).default(`enum`).describe(`Sort argument format`)}).optional().describe(`Sort argument mapping`)}),zu=h({version:E([`v2`,`v4`]).default(`v4`).describe(`OData version`),usePrefix:S().default(!0).describe(`Use $ prefix for system query options ($filter vs filter)`),stringFunctions:C(E([`contains`,`startswith`,`endswith`,`tolower`,`toupper`,`trim`,`concat`,`substring`,`length`])).optional().describe(`Supported OData string functions`),expand:h({enabled:S().default(!0).describe(`Enable $expand support`),maxDepth:P().int().min(1).default(3).describe(`Maximum expand depth`)}).optional().describe(`$expand configuration`)});h({operatorMappings:C(Iu).optional().describe(`Custom operator mappings`),rest:Lu.optional().describe(`REST query adapter configuration`),graphql:Ru.optional().describe(`GraphQL query adapter configuration`),odata:zu.optional().describe(`OData query adapter configuration`)});var Bu=E([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Vu=h({type:E([`user`,`team`,`record`]).describe(`Mention target type`),id:r().describe(`Target ID`),name:r().describe(`Display name for rendering`),offset:P().int().min(0).describe(`Character offset in body text`),length:P().int().min(1).describe(`Length of mention token in body text`)}),Hu=h({field:r().describe(`Field machine name`),fieldLabel:r().optional().describe(`Field display label`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`),oldDisplayValue:r().optional().describe(`Human-readable old value`),newDisplayValue:r().optional().describe(`Human-readable new value`)}),Uu=h({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:C(r()).describe(`Users who reacted`),count:P().int().min(1).describe(`Total reaction count`)}),vee=h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`),avatarUrl:r().url().optional().describe(`Actor avatar URL`),source:r().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),Wu=E([`public`,`internal`,`private`]),Gu=h({id:r().describe(`Feed item ID`),type:Bu.describe(`Activity type`),object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID this feed item belongs to`),actor:vee.describe(`Who performed this action`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(Vu).optional().describe(`Mentioned users/teams/records`),changes:C(Hu).optional().describe(`Field-level changes`),reactions:C(Uu).optional().describe(`Emoji reactions on this item`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),replyCount:P().int().min(0).default(0).describe(`Number of replies`),pinned:S().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:r().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:r().optional().describe(`User ID who pinned the item`),starred:S().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:r().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Wu.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:r().datetime().describe(`Creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),editedAt:r().datetime().optional().describe(`When comment was last edited`),isEdited:S().default(!1).describe(`Whether comment has been edited`)});E([`all`,`comments_only`,`changes_only`,`tasks_only`]);var Ku=E([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),qu=E([`in_app`,`email`,`push`,`slack`]),Ju=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),userId:r().describe(`Subscribing user ID`),events:C(Ku).default([`all`]).describe(`Event types to receive notifications for`),channels:C(qu).default([`in_app`]).describe(`Notification delivery channels`),active:S().default(!0).describe(`Whether the subscription is active`),createdAt:r().datetime().describe(`Subscription creation timestamp`)}),Yu=h({object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID`)}),Xu=Yu.extend({feedId:r().describe(`Feed item ID`)}),Zu=E([`all`,`comments_only`,`changes_only`,`tasks_only`]);Yu.extend({type:Zu.default(`all`).describe(`Filter by feed item category`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of items to return`),cursor:r().optional().describe(`Cursor for pagination (opaque string from previous response)`)}),R.extend({data:h({items:C(Gu).describe(`Feed items in reverse chronological order`),total:P().int().optional().describe(`Total feed items matching filter`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more items are available`)})}),Yu.extend({type:Bu.describe(`Type of feed item to create`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(Vu).optional().describe(`Mentioned users, teams, or records`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),visibility:Wu.default(`public`).describe(`Visibility: public, internal, or private`)}),R.extend({data:Gu.describe(`The created feed item`)}),Xu.extend({body:r().optional().describe(`Updated rich text body`),mentions:C(Vu).optional().describe(`Updated mentions`),visibility:Wu.optional().describe(`Updated visibility`)}),R.extend({data:Gu.describe(`The updated feed item`)}),R.extend({data:h({feedId:r().describe(`ID of the deleted feed item`)})}),Xu.extend({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`)}),R.extend({data:h({reactions:C(Uu).describe(`Updated reaction list for the feed item`)})}),Xu.extend({emoji:r().describe(`Emoji character or shortcode to remove`)}),R.extend({data:h({reactions:C(Uu).describe(`Updated reaction list for the feed item`)})}),R.extend({data:h({feedId:r().describe(`ID of the pinned feed item`),pinned:S().describe(`Whether the item is now pinned`),pinnedAt:r().datetime().describe(`Timestamp when pinned`)})}),R.extend({data:h({feedId:r().describe(`ID of the unpinned feed item`),pinned:S().describe(`Whether the item is now pinned (should be false)`)})}),R.extend({data:h({feedId:r().describe(`ID of the starred feed item`),starred:S().describe(`Whether the item is now starred`),starredAt:r().datetime().describe(`Timestamp when starred`)})}),R.extend({data:h({feedId:r().describe(`ID of the unstarred feed item`),starred:S().describe(`Whether the item is now starred (should be false)`)})}),Yu.extend({query:r().min(1).describe(`Full-text search query against feed body content`),type:Zu.optional().describe(`Filter by feed item category`),actorId:r().optional().describe(`Filter by actor user ID`),dateFrom:r().datetime().optional().describe(`Filter feed items created after this timestamp`),dateTo:r().datetime().optional().describe(`Filter feed items created before this timestamp`),hasAttachments:S().optional().describe(`Filter for items with file attachments`),pinnedOnly:S().optional().describe(`Return only pinned items`),starredOnly:S().optional().describe(`Return only starred items`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of items to return`),cursor:r().optional().describe(`Cursor for pagination`)}),R.extend({data:h({items:C(Gu).describe(`Matching feed items sorted by relevance`),total:P().int().optional().describe(`Total matching items`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more items are available`)})}),Yu.extend({field:r().optional().describe(`Filter changelog to a specific field name`),actorId:r().optional().describe(`Filter changelog by actor user ID`),dateFrom:r().datetime().optional().describe(`Filter changes after this timestamp`),dateTo:r().datetime().optional().describe(`Filter changes before this timestamp`),limit:P().int().min(1).max(200).default(50).describe(`Maximum number of changelog entries to return`),cursor:r().optional().describe(`Cursor for pagination`)});var Qu=h({id:r().describe(`Changelog entry ID`),object:r().describe(`Object name`),recordId:r().describe(`Record ID`),actor:h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`)}).describe(`Who made the change`),changes:C(Hu).min(1).describe(`Field-level changes`),timestamp:r().datetime().describe(`When the change occurred`),source:r().optional().describe(`Change source (e.g., "API", "UI", "automation")`)});R.extend({data:h({entries:C(Qu).describe(`Changelog entries in reverse chronological order`),total:P().int().optional().describe(`Total changelog entries matching filter`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more entries are available`)})}),Yu.extend({events:C(Ku).default([`all`]).describe(`Event types to subscribe to`),channels:C(qu).default([`in_app`]).describe(`Notification delivery channels`)}),R.extend({data:Ju.describe(`The created or updated subscription`)}),R.extend({data:h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),unsubscribed:S().describe(`Whether the user was unsubscribed`)})}),E([`feed_item_not_found`,`feed_permission_denied`,`feed_item_not_editable`,`feed_invalid_parent`,`reaction_already_exists`,`reaction_not_found`,`subscription_already_exists`,`subscription_not_found`,`invalid_feed_type`,`feed_already_pinned`,`feed_not_pinned`,`feed_already_starred`,`feed_not_starred`,`feed_search_query_too_short`]);var $u=E([`csv`,`json`,`jsonl`,`xlsx`,`parquet`]),ed=E([`pending`,`processing`,`completed`,`failed`,`cancelled`,`expired`]);h({object:r().describe(`Object name to export`),format:$u.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Specific fields to include (omit for all fields)`),filter:d(r(),u()).optional().describe(`Filter criteria for records to export`),sort:C(h({field:r().describe(`Field name to sort by`),direction:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`)})).optional().describe(`Sort order for exported records`),limit:P().int().min(1).optional().describe(`Maximum number of records to export`),includeHeaders:S().default(!0).describe(`Include header row (CSV/XLSX)`),encoding:r().default(`utf-8`).describe(`Character encoding for the export file`),templateId:r().optional().describe(`Export template ID for predefined field mappings`)}),R.extend({data:h({jobId:r().describe(`Export job ID`),status:ed.describe(`Initial job status`),estimatedRecords:P().int().optional().describe(`Estimated total records`),createdAt:r().datetime().describe(`Job creation timestamp`)})}),R.extend({data:h({jobId:r().describe(`Export job ID`),status:ed.describe(`Current job status`),format:$u.describe(`Export format`),totalRecords:P().int().optional().describe(`Total records to export`),processedRecords:P().int().describe(`Records processed so far`),percentComplete:P().min(0).max(100).describe(`Export progress percentage`),fileSize:P().int().optional().describe(`Current file size in bytes`),downloadUrl:r().optional().describe(`Presigned download URL (available when status is "completed")`),downloadExpiresAt:r().datetime().optional().describe(`Download URL expiration timestamp`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`)}).optional().describe(`Error details if job failed`),startedAt:r().datetime().optional().describe(`Processing start timestamp`),completedAt:r().datetime().optional().describe(`Completion timestamp`)})});var td=E([`strict`,`lenient`,`dry_run`]),nd=E([`skip`,`update`,`create_new`,`fail`]);h({mode:td.default(`strict`).describe(`Validation mode for the import`),deduplication:h({strategy:nd.default(`skip`).describe(`How to handle duplicate records`),matchFields:C(r()).min(1).describe(`Fields used to identify duplicates (e.g., "email", "external_id")`)}).optional().describe(`Deduplication configuration`),maxErrors:P().int().min(1).default(100).describe(`Maximum validation errors before aborting`),trimWhitespace:S().default(!0).describe(`Trim leading/trailing whitespace from string fields`),dateFormat:r().optional().describe(`Expected date format in import data (e.g., "YYYY-MM-DD")`),nullValues:C(r()).optional().describe(`Strings to treat as null (e.g., ["", "N/A", "null"])`)}),R.extend({data:h({totalRecords:P().int().describe(`Total records in import file`),validRecords:P().int().describe(`Records that passed validation`),invalidRecords:P().int().describe(`Records that failed validation`),duplicateRecords:P().int().describe(`Duplicate records detected`),errors:C(h({row:P().int().describe(`Row number in the import file`),field:r().optional().describe(`Field that failed validation`),code:r().describe(`Validation error code`),message:r().describe(`Validation error message`)})).describe(`List of validation errors`),preview:C(d(r(),u())).optional().describe(`Preview of first N valid records (for dry_run mode)`)})});var rd=h({sourceField:r().describe(`Field name in the source data (import) or object (export)`),targetField:r().describe(`Field name in the target object (import) or file column (export)`),targetLabel:r().optional().describe(`Display label for the target column (export)`),transform:E([`none`,`uppercase`,`lowercase`,`trim`,`date_format`,`lookup`]).default(`none`).describe(`Transformation to apply during mapping`),defaultValue:u().optional().describe(`Default value if source field is null/empty`),required:S().default(!1).describe(`Whether this field is required (import validation)`)});h({id:r().optional().describe(`Template ID (generated on save)`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template machine name (snake_case)`),label:r().describe(`Human-readable template label`),description:r().optional().describe(`Template description`),object:r().describe(`Target object name`),direction:E([`import`,`export`,`bidirectional`]).describe(`Template direction`),format:$u.optional().describe(`Default file format for this template`),mappings:C(rd).min(1).describe(`Field mapping entries`),createdAt:r().datetime().optional().describe(`Template creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the template`)}),h({id:r().optional().describe(`Scheduled export ID`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Schedule name (snake_case)`),label:r().optional().describe(`Human-readable label`),object:r().describe(`Object name to export`),format:$u.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Fields to include`),filter:d(r(),u()).optional().describe(`Record filter criteria`),templateId:r().optional().describe(`Export template ID for field mappings`),schedule:h({cronExpression:r().describe(`Cron expression for schedule`),timezone:r().default(`UTC`).describe(`IANA timezone`)}).describe(`Schedule timing configuration`),delivery:h({method:E([`email`,`storage`,`webhook`]).describe(`How to deliver the export file`),recipients:C(r()).optional().describe(`Email recipients (for email delivery)`),storagePath:r().optional().describe(`Storage path (for storage delivery)`),webhookUrl:r().optional().describe(`Webhook URL (for webhook delivery)`)}).describe(`Export delivery configuration`),enabled:S().default(!0).describe(`Whether the scheduled export is active`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution`),createdAt:r().datetime().optional().describe(`Creation timestamp`),createdBy:r().optional().describe(`User who created the schedule`)}),h({jobId:r().describe(`Export job ID`)}),R.extend({data:h({jobId:r().describe(`Export job ID`),downloadUrl:r().describe(`Presigned download URL`),fileName:r().describe(`Suggested file name`),fileSize:P().int().describe(`File size in bytes`),format:$u.describe(`Export file format`),expiresAt:r().datetime().describe(`Download URL expiration timestamp`),checksum:r().optional().describe(`File checksum (SHA-256)`)})}),h({object:r().optional().describe(`Filter by object name`),status:ed.optional().describe(`Filter by job status`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of jobs to return`),cursor:r().optional().describe(`Pagination cursor from a previous response`)});var id=h({jobId:r().describe(`Export job ID`),object:r().describe(`Object name that was exported`),status:ed.describe(`Current job status`),format:$u.describe(`Export file format`),totalRecords:P().int().optional().describe(`Total records exported`),fileSize:P().int().optional().describe(`File size in bytes`),createdAt:r().datetime().describe(`Job creation timestamp`),completedAt:r().datetime().optional().describe(`Completion timestamp`),createdBy:r().optional().describe(`User who initiated the export`)});R.extend({data:h({jobs:C(id).describe(`List of export jobs`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more jobs are available`)})}),h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Schedule name (snake_case)`),label:r().optional().describe(`Human-readable label`),object:r().describe(`Object name to export`),format:$u.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Fields to include`),filter:d(r(),u()).optional().describe(`Record filter criteria`),templateId:r().optional().describe(`Export template ID for field mappings`),schedule:h({cronExpression:r().describe(`Cron expression for schedule`),timezone:r().default(`UTC`).describe(`IANA timezone`)}).describe(`Schedule timing configuration`),delivery:h({method:E([`email`,`storage`,`webhook`]).describe(`How to deliver the export file`),recipients:C(r()).optional().describe(`Email recipients (for email delivery)`),storagePath:r().optional().describe(`Storage path (for storage delivery)`),webhookUrl:r().optional().describe(`Webhook URL (for webhook delivery)`)}).describe(`Export delivery configuration`)}),R.extend({data:h({id:r().describe(`Scheduled export ID`),name:r().describe(`Schedule name`),enabled:S().describe(`Whether the schedule is active`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution`),createdAt:r().datetime().describe(`Creation timestamp`)})}),h({jobId:r()}),h({jobId:r()});var ad=E([`start`,`end`,`decision`,`assignment`,`loop`,`create_record`,`update_record`,`delete_record`,`get_record`,`http_request`,`script`,`screen`,`wait`,`subflow`,`connector_action`,`parallel_gateway`,`join_gateway`,`boundary_event`]),od=h({name:r().describe(`Variable name`),type:r().describe(`Data type (text, number, boolean, object, list)`),isInput:S().default(!1).describe(`Is input parameter`),isOutput:S().default(!1).describe(`Is output parameter`)}),sd=h({id:r().describe(`Node unique ID`),type:ad.describe(`Action type`),label:r().describe(`Node label`),config:d(r(),u()).optional().describe(`Node configuration`),connectorConfig:h({connectorId:r(),actionId:r(),input:d(r(),u()).describe(`Mapped inputs for the action`)}).optional(),position:h({x:P(),y:P()}).optional(),timeoutMs:P().int().min(0).optional().describe(`Maximum execution time for this node in milliseconds`),inputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Parameter type`),required:S().default(!1).describe(`Whether the parameter is required`),description:r().optional().describe(`Parameter description`)})).optional().describe(`Input parameter schema for this node`),outputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Output type`),description:r().optional().describe(`Output description`)})).optional().describe(`Output schema declaration for this node`),waitEventConfig:h({eventType:E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`What kind of event resumes the execution`),timerDuration:r().optional().describe(`ISO 8601 duration (e.g., "PT1H") or wait time for timer events`),signalName:r().optional().describe(`Named signal or webhook event to wait for`),timeoutMs:P().int().min(0).optional().describe(`Maximum wait time before timeout (ms)`),onTimeout:E([`fail`,`continue`]).default(`fail`).describe(`Behavior when the wait times out`)}).optional().describe(`Configuration for wait node event resumption`),boundaryConfig:h({attachedToNodeId:r().describe(`Host node ID this boundary event monitors`),eventType:E([`error`,`timer`,`signal`,`cancel`]).describe(`Boundary event trigger type`),interrupting:S().default(!0).describe(`If true, the host activity is cancelled when this event fires`),errorCode:r().optional().describe(`Specific error code to catch (empty = catch all errors)`),timerDuration:r().optional().describe(`ISO 8601 duration for timer boundary events`),signalName:r().optional().describe(`Named signal to catch`)}).optional().describe(`Configuration for boundary events attached to host nodes`)}),cd=h({id:r().describe(`Edge unique ID`),source:r().describe(`Source Node ID`),target:r().describe(`Target Node ID`),condition:r().optional().describe(`Expression returning boolean used for branching`),type:E([`default`,`fault`,`conditional`]).default(`default`).describe(`Connection type: default (normal flow), fault (error path), or conditional (expression-guarded)`),label:r().optional().describe(`Label on the connector`),isDefault:S().default(!1).describe(`Marks this edge as the default path when no other conditions match`)}),ld=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name`),label:r().describe(`Flow label`),description:r().optional(),version:P().int().default(1).describe(`Version number`),status:E([`draft`,`active`,`obsolete`,`invalid`]).default(`draft`).describe(`Deployment status`),template:S().default(!1).describe(`Is logic template (Subflow)`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).describe(`Flow type`),variables:C(od).optional().describe(`Flow variables`),nodes:C(sd).describe(`Flow nodes`),edges:C(cd).describe(`Flow connections`),active:S().default(!1).describe(`Is active (Deprecated: use status)`),runAs:E([`system`,`user`]).default(`user`).describe(`Execution context`),errorHandling:h({strategy:E([`fail`,`retry`,`continue`]).default(`fail`).describe(`How to handle node execution errors`),maxRetries:P().int().min(0).max(10).default(0).describe(`Number of retry attempts (only for retry strategy)`),retryDelayMs:P().int().min(0).default(1e3).describe(`Delay between retries in milliseconds`),backoffMultiplier:P().min(1).default(1).describe(`Multiplier for exponential backoff between retries`),maxRetryDelayMs:P().int().min(0).default(3e4).describe(`Maximum delay between retries in milliseconds`),jitter:S().default(!1).describe(`Add random jitter to retry delay to avoid thundering herd`),fallbackNodeId:r().optional().describe(`Node ID to jump to on unrecoverable error`)}).optional().describe(`Flow-level error handling configuration`)});h({flowName:r().describe(`Flow machine name`),version:P().int().min(1).describe(`Version number`),definition:ld.describe(`Complete flow definition snapshot`),createdAt:r().datetime().describe(`When this version was created`),createdBy:r().optional().describe(`User who created this version`),changeNote:r().optional().describe(`Description of what changed in this version`)});var ud=E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]),dd=h({nodeId:r().describe(`Node ID that was executed`),nodeType:r().describe(`Node action type (e.g., "decision", "http_request")`),nodeLabel:r().optional().describe(`Human-readable node label`),status:E([`success`,`failure`,`skipped`]).describe(`Step execution result`),startedAt:r().datetime().describe(`When the step started`),completedAt:r().datetime().optional().describe(`When the step completed`),durationMs:P().int().min(0).optional().describe(`Step execution duration in milliseconds`),input:d(r(),u()).optional().describe(`Input data passed to the node`),output:d(r(),u()).optional().describe(`Output data produced by the node`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`)}).optional().describe(`Error details if step failed`),retryAttempt:P().int().min(0).optional().describe(`Retry attempt number (0 = first try)`)}),fd=h({id:r().describe(`Execution instance ID`),flowName:r().describe(`Machine name of the executed flow`),flowVersion:P().int().optional().describe(`Version of the flow that was executed`),status:ud.describe(`Current execution status`),trigger:h({type:r().describe(`Trigger type (e.g., "record_change", "schedule", "api", "manual")`),recordId:r().optional().describe(`Triggering record ID`),object:r().optional().describe(`Triggering object name`),userId:r().optional().describe(`User who triggered the execution`),metadata:d(r(),u()).optional().describe(`Additional trigger context`)}).describe(`What triggered this execution`),steps:C(dd).describe(`Ordered list of executed steps`),variables:d(r(),u()).optional().describe(`Final state of flow variables`),startedAt:r().datetime().describe(`Execution start timestamp`),completedAt:r().datetime().optional().describe(`Execution completion timestamp`),durationMs:P().int().min(0).optional().describe(`Total execution duration in milliseconds`),runAs:E([`system`,`user`]).optional().describe(`Execution context identity`),tenantId:r().optional().describe(`Tenant ID for multi-tenant isolation`)}),pd=E([`warning`,`error`,`critical`]);h({id:r().describe(`Error record ID`),executionId:r().describe(`Parent execution ID`),nodeId:r().optional().describe(`Node where the error occurred`),severity:pd.describe(`Error severity level`),code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),stack:r().optional().describe(`Stack trace for debugging`),context:d(r(),u()).optional().describe(`Additional diagnostic context (input data, config snapshot)`),timestamp:r().datetime().describe(`When the error occurred`),retryable:S().default(!1).describe(`Whether this error can be retried`),resolvedAt:r().datetime().optional().describe(`When the error was resolved (e.g., after successful retry)`)}),h({id:r().describe(`Checkpoint ID`),executionId:r().describe(`Parent execution ID`),flowName:r().describe(`Flow machine name`),currentNodeId:r().describe(`Node ID where execution is paused`),variables:d(r(),u()).describe(`Flow variable state at checkpoint`),completedNodeIds:C(r()).describe(`List of node IDs already executed`),createdAt:r().datetime().describe(`Checkpoint creation timestamp`),expiresAt:r().datetime().optional().describe(`Checkpoint expiration (auto-cleanup)`),reason:E([`wait`,`screen_input`,`approval`,`error`,`manual_pause`,`parallel_join`,`boundary_event`]).describe(`Why the execution was checkpointed`)}),h({maxConcurrent:P().int().min(1).default(1).describe(`Maximum number of concurrent executions allowed`),onConflict:E([`queue`,`reject`,`cancel_existing`]).default(`queue`).describe(`queue = enqueue for later, reject = fail immediately, cancel_existing = stop running instance`),lockScope:E([`global`,`per_record`,`per_user`]).default(`global`).describe(`Scope of the concurrency lock`),queueTimeoutMs:P().int().min(0).optional().describe(`Maximum time to wait in queue before timing out (ms)`)}),h({id:r().describe(`Schedule instance ID`),flowName:r().describe(`Flow machine name`),cronExpression:r().describe(`Cron expression (e.g., "0 9 * * MON-FRI")`),timezone:r().default(`UTC`).describe(`IANA timezone for cron evaluation`),status:E([`active`,`paused`,`disabled`,`expired`]).default(`active`).describe(`Current schedule status`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution timestamp`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),lastExecutionId:r().optional().describe(`Execution ID of the last run`),lastRunStatus:ud.optional().describe(`Status of the last run`),totalRuns:P().int().min(0).default(0).describe(`Total number of executions`),consecutiveFailures:P().int().min(0).default(0).describe(`Consecutive failed executions`),startDate:r().datetime().optional().describe(`Schedule effective start date`),endDate:r().datetime().optional().describe(`Schedule expiration date`),maxRuns:P().int().min(1).optional().describe(`Maximum total executions before auto-disable`),createdAt:r().datetime().describe(`Schedule creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the schedule`)});var md=h({name:r().describe(`Flow machine name (snake_case)`)});md.extend({runId:r().describe(`Execution run ID`)}),h({status:E([`draft`,`active`,`obsolete`,`invalid`]).optional().describe(`Filter by flow status`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).optional().describe(`Filter by flow type`),limit:P().int().min(1).max(100).default(50).describe(`Maximum number of flows to return`),cursor:r().optional().describe(`Cursor for pagination`)});var hd=h({name:r().describe(`Flow machine name`),label:r().describe(`Flow display label`),type:r().describe(`Flow type`),status:r().describe(`Flow deployment status`),version:P().int().describe(`Flow version number`),enabled:S().describe(`Whether the flow is enabled for execution`),nodeCount:P().int().optional().describe(`Number of nodes in the flow`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`)});R.extend({data:h({flows:C(hd).describe(`Flow summaries`),total:P().int().optional().describe(`Total matching flows`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more flows are available`)})}),R.extend({data:ld.describe(`Full flow definition`)}),R.extend({data:ld.describe(`The created flow definition`)}),md.extend({definition:ld.partial().describe(`Partial flow definition to update`)}),R.extend({data:ld.describe(`The updated flow definition`)}),R.extend({data:h({name:r().describe(`Name of the deleted flow`),deleted:S().describe(`Whether the flow was deleted`)})}),md.extend({record:d(r(),u()).optional().describe(`Record that triggered the automation`),object:r().optional().describe(`Object name the record belongs to`),event:r().optional().describe(`Trigger event type`),userId:r().optional().describe(`User who triggered the automation`),params:d(r(),u()).optional().describe(`Additional contextual data`)}),R.extend({data:h({success:S().describe(`Whether the automation completed successfully`),output:u().optional().describe(`Output data from the automation`),error:r().optional().describe(`Error message if execution failed`),durationMs:P().optional().describe(`Execution duration in milliseconds`)})}),md.extend({enabled:S().describe(`Whether to enable (true) or disable (false) the flow`)}),R.extend({data:h({name:r().describe(`Flow name`),enabled:S().describe(`New enabled state`)})}),md.extend({status:E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]).optional().describe(`Filter by execution status`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of runs to return`),cursor:r().optional().describe(`Cursor for pagination`)}),R.extend({data:h({runs:C(fd).describe(`Execution run logs`),total:P().int().optional().describe(`Total matching runs`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more runs are available`)})}),R.extend({data:fd.describe(`Full execution log with step details`)}),E([`flow_not_found`,`flow_already_exists`,`flow_validation_failed`,`flow_disabled`,`execution_not_found`,`execution_failed`,`execution_timeout`,`node_executor_not_found`,`concurrent_execution_limit`]);var gd=E([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),_d=h({type:r().describe(`Metadata type`),name:r().describe(`Metadata name`),changeType:gd.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:S().default(!1).describe(`Whether this change may conflict with customizations`),summary:r().optional().describe(`Human-readable change summary`),previousName:r().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),vd=E([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),yd=h({packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Currently installed version`),toVersion:r().describe(`Target upgrade version`),impactLevel:vd.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:C(_d).describe(`All metadata changes`),affectedCustomizations:P().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:S().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:C(r()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:C(h({packageId:r(),fromVersion:r(),toVersion:r()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:P().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:r().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`);h({id:r().describe(`Snapshot identifier`),packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Target upgrade version`),tenantId:r().optional().describe(`Tenant identifier`),previousManifest:Ls.describe(`Complete manifest of the previous package version`),metadataSnapshot:C(h({type:r(),name:r(),metadata:d(r(),u())})).describe(`Snapshot of all package metadata`),customizationSnapshot:C(d(r(),u())).optional().describe(`Snapshot of customer customizations`),createdAt:r().datetime().describe(`Snapshot creation timestamp`),expiresAt:r().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:Ls.optional().describe(`New manifest (if installing from local)`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`);var bd=E([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`);h({success:S().describe(`Whether the upgrade succeeded`),phase:bd.describe(`Current upgrade phase`),plan:yd.optional().describe(`Upgrade plan`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r(),baseValue:u(),incomingValue:u(),customValue:u()})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if upgrade failed`),message:r().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),h({packageId:r().describe(`Package ID to rollback`),snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Version restored to`),message:r().optional().describe(`Rollback status message`)}).describe(`Rollback package response`);var xd=E([`objects`,`views`,`pages`,`flows`,`dashboards`,`permissions`,`agents`,`reports`,`actions`,`translations`,`themes`,`datasets`,`apis`,`triggers`,`workflows`]).describe(`Metadata category within the artifact`),Sd=h({path:r().describe(`Relative file path within the artifact`),size:P().int().nonnegative().describe(`File size in bytes`),category:xd.optional().describe(`Metadata category this file belongs to`)}).describe(`A single file entry within the artifact`),Cd=h({algorithm:E([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm used for checksums`),files:d(r(),r().regex(/^[a-f0-9]+$/)).describe(`File path to hash value mapping`)}).describe(`Checksum manifest for artifact integrity verification`),wd=h({algorithm:E([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).default(`RSA-SHA256`).describe(`Signing algorithm used`),publicKeyRef:r().describe(`Public key reference (URL or fingerprint) for signature verification`),signature:r().describe(`Base64-encoded digital signature`),signedAt:r().datetime().optional().describe(`ISO 8601 timestamp of when the artifact was signed`),signedBy:r().optional().describe(`Identity of the signer (publisher ID or email)`)}).describe(`Digital signature for artifact authenticity verification`),Td=h({formatVersion:r().regex(/^\d+\.\d+$/).default(`1.0`).describe(`Artifact format version (e.g. "1.0")`),packageId:r().describe(`Package identifier from manifest`),version:r().describe(`Package version from manifest`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Archive format of the artifact`),size:P().int().positive().optional().describe(`Total artifact file size in bytes`),builtAt:r().datetime().describe(`ISO 8601 timestamp of when the artifact was built`),builtWith:r().optional().describe(`Build tool identifier (e.g. "os-cli@3.2.0")`),files:C(Sd).optional().describe(`List of files contained in the artifact`),metadataCategories:C(xd).optional().describe(`Metadata categories included in this artifact`),checksums:Cd.optional().describe(`SHA256 checksums for artifact integrity verification`),signature:wd.optional().describe(`Digital signature for artifact authenticity verification`)}).describe(`Package artifact structure and metadata`),Ed=E([`unverified`,`pending`,`verified`,`trusted`,`partner`]).describe(`Publisher verification status`);h({id:r().describe(`Publisher ID`),name:r().describe(`Publisher display name`),type:E([`individual`,`organization`]).describe(`Publisher type`),verification:Ed.default(`unverified`).describe(`Publisher verification status`),email:r().email().optional().describe(`Contact email`),website:r().url().optional().describe(`Publisher website`),logoUrl:r().url().optional().describe(`Publisher logo URL`),description:r().optional().describe(`Publisher description`),registeredAt:r().datetime().optional().describe(`Publisher registration timestamp`)}).describe(`Developer or organization that publishes packages`);var Dd=h({url:r().url().describe(`Artifact download URL`),sha256:r().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum`),size:P().int().positive().describe(`Artifact size in bytes`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Artifact format`),uploadedAt:r().datetime().describe(`Upload timestamp`)}).describe(`Reference to a downloadable package artifact`);h({downloadUrl:r().url().describe(`Artifact download URL (may be pre-signed)`),sha256:r().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum for verification`),size:P().int().positive().describe(`Artifact size in bytes`),format:E([`tgz`,`zip`]).describe(`Artifact format`),expiresAt:r().datetime().optional().describe(`URL expiration timestamp for pre-signed URLs`)}).describe(`Artifact download response with integrity metadata`);var Od=E([`crm`,`erp`,`hr`,`finance`,`project`,`collaboration`,`analytics`,`integration`,`automation`,`ai`,`security`,`developer-tools`,`ui-theme`,`storage`,`other`]).describe(`Marketplace package category`),kd=E([`draft`,`submitted`,`in-review`,`approved`,`published`,`rejected`,`suspended`,`deprecated`,`unlisted`]).describe(`Marketplace listing status`),Ad=E([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).describe(`Package pricing model`),jd=h({id:r().describe(`Listing ID (matches package manifest ID)`),packageId:r().describe(`Package identifier`),publisherId:r().describe(`Publisher ID`),status:kd.default(`draft`).describe(`Publication state: draft, published, under-review, suspended, deprecated, or unlisted`),name:r().describe(`Display name`),tagline:r().max(120).optional().describe(`Short tagline (max 120 chars)`),description:r().optional().describe(`Full description (Markdown)`),category:Od.describe(`Package category`),tags:C(r()).optional().describe(`Search tags`),iconUrl:r().url().optional().describe(`Package icon URL`),screenshots:C(h({url:r().url(),caption:r().optional()})).optional().describe(`Screenshots`),documentationUrl:r().url().optional().describe(`Documentation URL`),supportUrl:r().url().optional().describe(`Support URL`),repositoryUrl:r().url().optional().describe(`Source repository URL`),pricing:Ad.default(`free`).describe(`Pricing model`),priceInCents:P().int().min(0).optional().describe(`Price in cents (e.g. 999 = $9.99)`),latestVersion:r().describe(`Latest published version`),minPlatformVersion:r().optional().describe(`Minimum ObjectStack platform version`),versions:C(h({version:r().describe(`Version string`),releaseDate:r().datetime().describe(`Release date`),releaseNotes:r().optional().describe(`Release notes`),minPlatformVersion:r().optional().describe(`Minimum platform version`),deprecated:S().default(!1).describe(`Whether this version is deprecated`),artifact:Dd.optional().describe(`Downloadable artifact for this version`)})).optional().describe(`Published versions`),stats:h({totalInstalls:P().int().min(0).default(0).describe(`Total installs`),activeInstalls:P().int().min(0).default(0).describe(`Active installs`),averageRating:P().min(0).max(5).optional().describe(`Average user rating (0-5)`),totalRatings:P().int().min(0).default(0).describe(`Total ratings count`),totalReviews:P().int().min(0).default(0).describe(`Total reviews count`)}).optional().describe(`Aggregate marketplace statistics`),publishedAt:r().datetime().optional().describe(`First published timestamp`),updatedAt:r().datetime().optional().describe(`Last updated timestamp`)}).describe(`Public-facing package listing on the marketplace`);h({id:r().describe(`Submission ID`),packageId:r().describe(`Package identifier`),version:r().describe(`Version being submitted`),publisherId:r().describe(`Publisher submitting`),status:E([`pending`,`scanning`,`in-review`,`changes-requested`,`approved`,`rejected`]).default(`pending`).describe(`Review status`),artifactUrl:r().describe(`Package artifact URL for review`),releaseNotes:r().optional().describe(`Release notes for this version`),isNewListing:S().default(!1).describe(`Whether this is a new listing submission`),scanResults:h({passed:S(),securityScore:P().min(0).max(100).optional(),compatibilityCheck:S().optional(),issues:C(h({severity:E([`critical`,`high`,`medium`,`low`,`info`]),message:r(),file:r().optional(),line:P().optional()})).optional()}).optional().describe(`Automated scan results`),reviewerNotes:r().optional().describe(`Notes from the platform reviewer`),submittedAt:r().datetime().optional().describe(`Submission timestamp`),reviewedAt:r().datetime().optional().describe(`Review completion timestamp`)}).describe(`Developer submission of a package version for review`),h({query:r().optional().describe(`Full-text search query`),category:Od.optional().describe(`Filter by category`),tags:C(r()).optional().describe(`Filter by tags`),pricing:Ad.optional().describe(`Filter by pricing model`),publisherVerification:Ed.optional().describe(`Filter by publisher verification level`),sortBy:E([`relevance`,`popularity`,`rating`,`newest`,`updated`,`name`]).default(`relevance`).describe(`Sort field`),sortDirection:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(100).default(20).describe(`Items per page`),platformVersion:r().optional().describe(`Filter by platform version compatibility`)}).describe(`Marketplace search request`),h({items:C(jd).describe(`Search result listings`),total:P().int().min(0).describe(`Total matching results`),page:P().int().min(1).describe(`Current page number`),pageSize:P().int().min(1).describe(`Items per page`),facets:h({categories:C(h({category:Od,count:P().int().min(0)})).optional(),pricing:C(h({model:Ad,count:P().int().min(0)})).optional()}).optional().describe(`Aggregation facets for refining search`)}).describe(`Marketplace search response`),h({listingId:r().describe(`Marketplace listing ID`),version:r().optional().describe(`Version to install`),licenseKey:r().optional().describe(`License key for paid packages`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),artifactRef:Dd.optional().describe(`Artifact reference for direct installation`),tenantId:r().optional().describe(`Tenant identifier`)}).describe(`Install from marketplace request`),h({success:S().describe(`Whether installation succeeded`),packageId:r().optional().describe(`Installed package identifier`),version:r().optional().describe(`Installed version`),message:r().optional().describe(`Installation status message`)}).describe(`Install from marketplace response`);var Md=h({packageId:r().describe(`Package identifier`)});h({status:E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).optional().describe(`Filter by package status`),enabled:S().optional().describe(`Filter by enabled state`),limit:P().int().min(1).max(100).default(50).describe(`Maximum number of packages to return`),cursor:r().optional().describe(`Cursor for pagination`)}).describe(`List installed packages request`),R.extend({data:h({packages:C(Us).describe(`Installed packages`),total:P().int().optional().describe(`Total matching packages`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more packages are available`)})}).describe(`List installed packages response`),R.extend({data:Us.describe(`Installed package details`)}).describe(`Get installed package response`),h({manifest:Ls.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`),artifactRef:Dd.optional().describe(`Artifact reference for marketplace installation`)}).describe(`Install package request`),R.extend({data:h({package:Us.describe(`Installed package details`),dependencyResolution:Vs.optional().describe(`Dependency resolution result`),namespaceConflicts:C(h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package name`),suggestion:r().optional().describe(`Suggested alternative`)})).optional().describe(`Namespace conflicts detected`),message:r().optional().describe(`Installation status message`)})}).describe(`Install package response`),h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:Ls.optional().describe(`New manifest for the target version`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`),R.extend({data:h({success:S().describe(`Whether the upgrade succeeded`),phase:r().describe(`Current upgrade phase`),plan:yd.optional().describe(`Upgrade plan that was executed`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r().describe(`Conflict path`),baseValue:u().describe(`Base value`),incomingValue:u().describe(`Incoming value`),customValue:u().describe(`Custom value`)})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if failed`),message:r().optional().describe(`Human-readable status message`)})}).describe(`Upgrade package response`),h({manifest:Ls.describe(`Package manifest to resolve dependencies for`),platformVersion:r().optional().describe(`Current platform version for compatibility filtering`)}).describe(`Resolve dependencies request`),R.extend({data:Vs.describe(`Dependency resolution result with topological sort`)}).describe(`Resolve dependencies response`),h({artifact:Td.describe(`Package artifact metadata`),sha256:r().regex(/^[a-f0-9]{64}$/).optional().describe(`SHA256 checksum of the uploaded file`),token:r().optional().describe(`Publisher authentication token`),releaseNotes:r().optional().describe(`Release notes for this version`)}).describe(`Upload artifact request`),R.extend({data:h({success:S().describe(`Whether the upload succeeded`),artifactRef:Dd.optional().describe(`Artifact reference in the registry`),submissionId:r().optional().describe(`Marketplace submission ID for review tracking`),message:r().optional().describe(`Upload status message`)})}).describe(`Upload artifact response`),Md.extend({snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),R.extend({data:h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Restored version`),message:r().optional().describe(`Rollback status message`)})}).describe(`Rollback package response`),R.extend({data:h({packageId:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)})}).describe(`Uninstall package response`),E([`package_not_found`,`package_already_installed`,`version_not_found`,`dependency_conflict`,`namespace_conflict`,`platform_incompatible`,`artifact_invalid`,`checksum_mismatch`,`signature_invalid`,`upgrade_failed`,`rollback_failed`,`snapshot_not_found`,`upload_failed`]);var Nd=e({EOL:()=>` -`,EventEmitter:()=>Pd,Readable:()=>Ld,Stats:()=>uf,Stream:()=>Id,StringDecoder:()=>Bd,Transform:()=>zd,Writable:()=>Rd,access:()=>Cf,accessSync:()=>wf,arch:()=>Jd,basename:()=>tf,constants:()=>bf,copyFile:()=>jf,copyFileSync:()=>Mf,createHash:()=>Bf,createReadStream:()=>Nf,createWriteStream:()=>Pf,default:()=>Fd,dirname:()=>bee,endianness:()=>qd,existsSync:()=>Qd,extname:()=>nf,fileURLToPath:()=>ff,homedir:()=>Kd,isAbsolute:()=>af,join:()=>$d,lstat:()=>xf,lstatSync:()=>Zd,mkdir:()=>Tf,mkdirSync:()=>Ef,normalize:()=>of,open:()=>lf,pathToFileURL:()=>pf,platform:()=>Ud,posix:()=>sf,promises:()=>Vd,randomUUID:()=>Vf,readFile:()=>If,readFileSync:()=>Yd,readdir:()=>mf,readdirSync:()=>hf,readlink:()=>gf,readlinkSync:()=>_f,realpath:()=>vf,realpathSync:()=>yf,relative:()=>rf,release:()=>Wd,rename:()=>Rf,renameSync:()=>zf,resolve:()=>ef,rmdir:()=>Df,rmdirSync:()=>Of,sep:()=>`/`,stat:()=>Sf,statSync:()=>yee,tmpdir:()=>Gd,type:()=>Hd,unlink:()=>kf,unlinkSync:()=>Af,unwatchFile:()=>xee,watch:()=>Ff,watchFile:()=>df,win32:()=>cf,writeFile:()=>Lf,writeFileSync:()=>Xd}),Pd=class{on(){return this}off(){return this}emit(){return!0}once(){return this}addListener(){return this}removeListener(){return this}removeAllListeners(){return this}},Fd={EventEmitter:Pd},Id=class extends Pd{pipe(){return this}},Ld=class extends Id{},Rd=class extends Id{},zd=class extends Id{},Bd=class{write(){return``}end(){return``}},Vd={readFile:async()=>``,writeFile:async()=>{},stat:async()=>({isDirectory:()=>!1,isFile:()=>!1}),mkdir:async()=>{},rm:async()=>{},access:async()=>{throw Error(`ENOENT: no such file or directory (polyfill)`)}},Hd=()=>`Browser`,Ud=()=>`browser`,Wd=()=>`1.0.0`,Gd=()=>`/tmp`,Kd=()=>`/`,qd=()=>`LE`,Jd=()=>`javascript`,Yd=()=>``,Xd=()=>{},yee=()=>({isDirectory:()=>!1,isFile:()=>!1,isSymbolicLink:()=>!1}),Zd=()=>({isDirectory:()=>!1,isFile:()=>!1,isSymbolicLink:()=>!1}),Qd=()=>!1,$d=(...e)=>e.join(`/`),ef=(...e)=>e.join(`/`),bee=e=>e,tf=e=>e,nf=e=>``,rf=()=>``,af=()=>!1,of=e=>e,sf={},cf={},lf=async()=>({close:async()=>{}}),uf=class{isDirectory(){return!1}isFile(){return!1}isSymbolicLink(){return!1}},df=()=>{},xee=()=>{},ff=()=>``,pf=()=>``,mf=()=>{},hf=()=>[],gf=()=>{},_f=()=>``,vf=async()=>``,yf=()=>``;yf.native=()=>``;var bf={},xf=async()=>({isDirectory:()=>!1,isFile:()=>!1,isSymbolicLink:()=>!1}),Sf=async()=>({isDirectory:()=>!1,isFile:()=>!1,isSymbolicLink:()=>!1}),Cf=async()=>{throw Error(`ENOENT: no such file or directory (polyfill)`)},wf=()=>{throw Error(`ENOENT: no such file or directory (polyfill)`)},Tf=()=>{},Ef=()=>{},Df=()=>{},Of=()=>{},kf=()=>{},Af=()=>{},jf=()=>{},Mf=()=>{},Nf=()=>new Ld,Pf=()=>new Rd,Ff=()=>new Pd,If=async()=>``,Lf=async()=>{},Rf=async()=>{},zf=()=>{},Bf=()=>({update:()=>({digest:()=>``})}),Vf=()=>`00000000-0000-0000-0000-000000000000`,Hf=`modulepreload`,Uf=function(e,t){return new URL(e,t).href},Wf={},Gf=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Uf(t,n),t in Wf)return;Wf[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Hf,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Kf=Object.defineProperty,qf=(e,t)=>{for(var n in t)Kf(e,n,{get:t[n],enumerable:!0})},Jf=typeof process<`u`&&process.versions!=null&&process.versions.node!=null;function Yf(e,t){if(typeof process<`u`)return{}[e]||t;try{if(typeof globalThis<`u`)return{}[e]||t}catch{}return t}function Xf(e=0){Jf&&process.exit(e)}function Zf(){return Jf?process.memoryUsage():{heapUsed:0,heapTotal:0}}var Qf=class e{constructor(e={}){this.isNode=Jf,this.config={name:e.name,level:e.level??`info`,format:e.format??(this.isNode?`json`:`pretty`),redact:e.redact??[`password`,`token`,`secret`,`key`],sourceLocation:e.sourceLocation??!1,file:e.file,rotation:e.rotation??{maxSize:`10m`,maxFiles:5}},this.isNode&&this.initPinoLogger()}async initPinoLogger(){if(this.isNode)try{let{createRequire:e}=await Gf(async()=>{let{createRequire:e}=await import(`./__vite-browser-external-BJgzPGy7.js`).then(e=>t(e.default,1));return{createRequire:e}},__vite__mapDeps([0,1]),import.meta.url);this.require=e(import.meta.url);let n=this.require(`pino`),r={level:this.config.level,redact:{paths:this.config.redact,censor:`***REDACTED***`}};this.config.name&&(r.name=this.config.name);let i=[];if(this.config.format===`pretty`){let e=!1;try{this.require.resolve(`pino-pretty`),e=!0}catch{}e?i.push({target:`pino-pretty`,options:{colorize:!0,translateTime:`SYS:standard`,ignore:`pid,hostname`},level:this.config.level}):(console.warn(`[Logger] pino-pretty not found. Install it for pretty logging: pnpm add -D pino-pretty`),i.push({target:`pino/file`,options:{destination:1},level:this.config.level}))}else this.config.format,i.push({target:`pino/file`,options:{destination:1},level:this.config.level});this.config.file&&i.push({target:`pino/file`,options:{destination:this.config.file,mkdir:!0},level:this.config.level}),i.length>0&&(r.transport=i.length===1?i[0]:{targets:i}),this.pinoInstance=n(r),this.pinoLogger=this.pinoInstance}catch(e){console.warn(`[Logger] Pino not available, falling back to console:`,e),this.pinoLogger=null}}redactSensitive(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?[...e]:{...e};for(let e in t){let n=e.toLowerCase();this.config.redact.some(e=>n.includes(e.toLowerCase()))?t[e]=`***REDACTED***`:typeof t[e]==`object`&&t[e]!==null&&(t[e]=this.redactSensitive(t[e]))}return t}formatBrowserLog(e,t,n){if(this.config.format===`json`)return JSON.stringify({timestamp:new Date().toISOString(),level:e,message:t,...n});if(this.config.format===`text`){let r=[new Date().toISOString(),e.toUpperCase(),t];return n&&Object.keys(n).length>0&&r.push(JSON.stringify(n)),r.join(` | `)}let r=`${{debug:`\x1B[36m`,info:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`,fatal:`\x1B[35m`,silent:``}[e]||``}[${e.toUpperCase()}] ${t}`;return n&&Object.keys(n).length>0&&(r+=` ${JSON.stringify(n,null,2)}`),r}logBrowser(e,t,n,r){let i=n?this.redactSensitive(n):void 0,a=r?{...i,error:{message:r.message,stack:r.stack}}:i,o=this.formatBrowserLog(e,t,a);console[e===`debug`?`debug`:e===`info`?`log`:e===`warn`?`warn`:e===`error`||e===`fatal`?`error`:`log`](o)}debug(e,t){this.isNode&&this.pinoLogger?this.pinoLogger.debug(t||{},e):this.logBrowser(`debug`,e,t)}info(e,t){this.isNode&&this.pinoLogger?this.pinoLogger.info(t||{},e):this.logBrowser(`info`,e,t)}warn(e,t){this.isNode&&this.pinoLogger?this.pinoLogger.warn(t||{},e):this.logBrowser(`warn`,e,t)}error(e,t,n){let r,i={};if(t instanceof Error?(r=t,i=n||{}):i=t||{},this.isNode&&this.pinoLogger){let t=r?{err:r,...i}:i;this.pinoLogger.error(t,e)}else this.logBrowser(`error`,e,i,r)}fatal(e,t,n){let r,i={};if(t instanceof Error?(r=t,i=n||{}):i=t||{},this.isNode&&this.pinoLogger){let t=r?{err:r,...i}:i;this.pinoLogger.fatal(t,e)}else this.logBrowser(`fatal`,e,i,r)}child(t){let n=new e(this.config);return this.isNode&&this.pinoInstance&&(n.pinoLogger=this.pinoInstance.child(t),n.pinoInstance=this.pinoInstance),n}withTrace(e,t){return this.child({traceId:e,spanId:t})}async destroy(){this.pinoLogger&&this.pinoLogger.flush&&await new Promise(e=>{this.pinoLogger.flush(()=>e())})}log(e,...t){this.info(e,t.length>0?{args:t}:void 0)}};function $f(e){return new Qf(e)}var ep=class{constructor(e){this.logger=e}validatePluginConfig(e,t){if(!e.configSchema)return this.logger.debug(`Plugin ${e.name} has no config schema - skipping validation`),t;try{let n=e.configSchema.parse(t);return this.logger.debug(`\u2705 Plugin config validated: ${e.name}`,{plugin:e.name,configKeys:Object.keys(t||{}).length}),n}catch(t){if(t instanceof o){let n=this.formatZodErrors(t),r=[`Plugin ${e.name} configuration validation failed:`,...n.map(e=>` - ${e.path}: ${e.message}`)].join(` -`);throw this.logger.error(r,void 0,{plugin:e.name,errors:n}),Error(r)}throw t}}validatePartialConfig(e,t){if(!e.configSchema)return t;try{let n=e.configSchema.partial().parse(t);return this.logger.debug(`\u2705 Partial config validated: ${e.name}`),n}catch(t){if(t instanceof o){let n=this.formatZodErrors(t),r=[`Plugin ${e.name} partial configuration validation failed:`,...n.map(e=>` - ${e.path}: ${e.message}`)].join(` -`);throw Error(r)}throw t}}getDefaultConfig(e){if(e.configSchema)try{let t=e.configSchema.parse({});return this.logger.debug(`Default config extracted: ${e.name}`),t}catch{this.logger.debug(`No default config available: ${e.name}`);return}}isConfigValid(e,t){return e.configSchema?e.configSchema.safeParse(t).success:!0}getConfigErrors(e,t){if(!e.configSchema)return[];let n=e.configSchema.safeParse(t);return n.success?[]:this.formatZodErrors(n.error)}formatZodErrors(e){return e.issues.map(e=>({path:e.path.join(`.`)||`root`,message:e.message}))}},tp=class{constructor(e){this.loadedPlugins=new Map,this.serviceFactories=new Map,this.serviceInstances=new Map,this.scopedServices=new Map,this.creating=new Set,this.logger=e,this.configValidator=new ep(e)}setContext(e){this.context=e}getServiceInstance(e){return this.serviceInstances.get(e)}async loadPlugin(e){let t=Date.now();try{this.logger.info(`Loading plugin: ${e.name}`);let n=this.toPluginMetadata(e);this.validatePluginStructure(n);let r=this.checkVersionCompatibility(n);if(!r.compatible)throw Error(`Version incompatible: ${r.message}`);n.configSchema&&this.validatePluginConfig(n),n.signature&&await this.verifyPluginSignature(n),this.loadedPlugins.set(n.name,n);let i=Date.now()-t;return this.logger.info(`Plugin loaded: ${e.name} (${i}ms)`),{success:!0,plugin:n,loadTime:i}}catch(n){return this.logger.error(`Failed to load plugin: ${e.name}`,n),{success:!1,error:n,loadTime:Date.now()-t}}}registerServiceFactory(e){if(this.serviceFactories.has(e.name))throw Error(`Service factory '${e.name}' already registered`);this.serviceFactories.set(e.name,e),this.logger.debug(`Service factory registered: ${e.name} (${e.lifecycle})`)}async getService(e,t){let n=this.serviceFactories.get(e);if(!n){let t=this.serviceInstances.get(e);if(!t)throw Error(`Service '${e}' not found`);return t}switch(n.lifecycle){case`singleton`:return await this.getSingletonService(n);case`transient`:return await this.createTransientService(n);case`scoped`:if(!t)throw Error(`Scope ID required for scoped service '${e}'`);return await this.getScopedService(n,t);default:throw Error(`Unknown service lifecycle: ${n.lifecycle}`)}}registerService(e,t){if(this.serviceInstances.has(e))throw Error(`Service '${e}' already registered`);this.serviceInstances.set(e,t)}replaceService(e,t){if(!this.hasService(e))throw Error(`Service '${e}' not found`);this.serviceInstances.set(e,t)}hasService(e){return this.serviceInstances.has(e)||this.serviceFactories.has(e)}detectCircularDependencies(){let e=[],t=new Set,n=new Set,r=(i,a=[])=>{if(n.has(i)){let t=[...a,i].join(` -> `);e.push(t);return}if(t.has(i))return;n.add(i);let o=this.serviceFactories.get(i);if(o?.dependencies)for(let e of o.dependencies)r(e,[...a,i]);n.delete(i),t.add(i)};for(let e of this.serviceFactories.keys())r(e);return e}async checkPluginHealth(e){let t=this.loadedPlugins.get(e);if(!t)return{healthy:!1,message:`Plugin not found`,lastCheck:new Date};if(!t.healthCheck)return{healthy:!0,message:`No health check defined`,lastCheck:new Date};try{return{...await t.healthCheck(),lastCheck:new Date}}catch(e){return{healthy:!1,message:`Health check failed: ${e.message}`,lastCheck:new Date}}}clearScope(e){this.scopedServices.delete(e),this.logger.debug(`Cleared scope: ${e}`)}getLoadedPlugins(){return new Map(this.loadedPlugins)}toPluginMetadata(e){let t=e;return t.version||=`0.0.0`,t}validatePluginStructure(e){if(!e.name)throw Error(`Plugin name is required`);if(!e.init)throw Error(`Plugin init function is required`);if(!this.isValidSemanticVersion(e.version))throw Error(`Invalid semantic version: ${e.version}`)}checkVersionCompatibility(e){let t=e.version;return this.isValidSemanticVersion(t)?{compatible:!0,pluginVersion:t}:{compatible:!1,pluginVersion:t,message:`Invalid semantic version format`}}isValidSemanticVersion(e){return/^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$/.test(e)}validatePluginConfig(e,t){if(e.configSchema){if(t===void 0){this.logger.debug(`Plugin ${e.name} has configuration schema (config validation postponed)`);return}this.configValidator.validatePluginConfig(e,t)}}async verifyPluginSignature(e){e.signature&&this.logger.debug(`Plugin ${e.name} has signature (use PluginSignatureVerifier for verification)`)}async getSingletonService(e){let t=this.serviceInstances.get(e.name);return t||(t=await this.createServiceInstance(e),this.serviceInstances.set(e.name,t),this.logger.debug(`Singleton service created: ${e.name}`)),t}async createTransientService(e){let t=await this.createServiceInstance(e);return this.logger.debug(`Transient service created: ${e.name}`),t}async getScopedService(e,t){this.scopedServices.has(t)||this.scopedServices.set(t,new Map);let n=this.scopedServices.get(t),r=n.get(e.name);return r||(r=await this.createServiceInstance(e),n.set(e.name,r),this.logger.debug(`Scoped service created: ${e.name} (scope: ${t})`)),r}async createServiceInstance(e){if(!this.context)throw Error(`[PluginLoader] Context not set - cannot create service '${e.name}'`);if(this.creating.has(e.name))throw Error(`Circular dependency detected: ${Array.from(this.creating).join(` -> `)} -> ${e.name}`);this.creating.add(e.name);try{return await e.factory(this.context)}finally{this.creating.delete(e.name)}}};function np(){let e=new Map,t=0,n=0;return{_fallback:!0,_serviceName:`cache`,async get(r){let i=e.get(r);if(!i||i.expires&&Date.now()>i.expires){e.delete(r),n++;return}return t++,i.value},async set(t,n,r){e.set(t,{value:n,expires:r?Date.now()+r*1e3:void 0})},async delete(t){return e.delete(t)},async has(t){return e.has(t)},async clear(){e.clear()},async stats(){return{hits:t,misses:n,keyCount:e.size}}}}function rp(){let e=new Map,t=0;return{_fallback:!0,_serviceName:`queue`,async publish(n,r){let i=`fallback-msg-${++t}`,a=e.get(n)??[];for(let e of a)e({id:i,data:r,attempts:1,timestamp:Date.now()});return i},async subscribe(t,n){e.set(t,[...e.get(t)??[],n])},async unsubscribe(t){e.delete(t)},async getQueueSize(){return 0},async purge(t){e.delete(t)}}}function ip(){let e=new Map;return{_fallback:!0,_serviceName:`job`,async schedule(t,n,r){e.set(t,{schedule:n,handler:r})},async cancel(t){e.delete(t)},async trigger(t,n){let r=e.get(t);r?.handler&&await r.handler({jobId:t,data:n})},async getExecutions(){return[]},async listJobs(){return[...e.keys()]}}}function ap(e,t){if(t.length===0)return;if(t.includes(e))return e;let n=e.toLowerCase(),r=t.find(e=>e.toLowerCase()===n);if(r)return r;let i=e.split(`-`)[0].toLowerCase(),a=t.find(e=>e.toLowerCase()===i);if(a)return a;let o=t.find(e=>e.split(`-`)[0].toLowerCase()===i);if(o)return o}function op(){let e=new Map,t=`en`;function n(e,t){let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=r[e]}return typeof r==`string`?r:void 0}function r(t){if(e.has(t))return e.get(t);let n=ap(t,[...e.keys()]);if(n)return e.get(n)}return{_fallback:!0,_serviceName:`i18n`,t(i,a,o){let s=r(a)??e.get(t),c=s?n(s,i):void 0;return c==null?i:o?c.replace(/\{\{(\w+)\}\}/g,(e,t)=>String(o[t]??`{{${t}}}`)):c},getTranslations(e){return r(e)??{}},loadTranslations(t,n){let r=e.get(t)??{};e.set(t,{...r,...n})},getLocales(){return[...e.keys()]},getDefaultLocale(){return t},setDefaultLocale(e){t=e}}}function sp(){let e=new Map;function t(t){let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}return{_fallback:!0,_serviceName:`metadata`,async register(e,n,r){t(e).set(n,r)},async get(e,n){return t(e).get(n)},async list(e){return Array.from(t(e).values())},async unregister(e,n){t(e).delete(n)},async exists(e,n){return t(e).has(n)},async listNames(e){return Array.from(t(e).keys())},async getObject(e){return t(`object`).get(e)},async listObjects(){return Array.from(t(`object`).values())}}}var cp={metadata:sp,cache:np,queue:rp,job:ip,i18n:op},lp=class{constructor(e={}){this.plugins=new Map,this.services=new Map,this.hooks=new Map,this.state=`idle`,this.startedPlugins=new Set,this.pluginStartTimes=new Map,this.shutdownHandlers=[],this.config={defaultStartupTimeout:3e4,gracefulShutdown:!0,shutdownTimeout:6e4,rollbackOnFailure:!0,...e},this.logger=$f(e.logger),this.pluginLoader=new tp(this.logger),this.context={registerService:(e,t)=>{this.registerService(e,t)},getService:e=>{let t=this.services.get(e);if(t)return t;let n=this.pluginLoader.getServiceInstance(e);if(n)return this.services.set(e,n),n;try{let t=this.pluginLoader.getService(e);if(t instanceof Promise)throw t.catch(()=>{}),Error(`Service '${e}' is async - use await`);return t}catch(t){throw t.message?.includes(`is async`)||t.message!==`Service '${e}' not found`?t:Error(`[Kernel] Service '${e}' not found`)}},replaceService:(e,t)=>{if(!(this.services.has(e)||this.pluginLoader.hasService(e)))throw Error(`[Kernel] Service '${e}' not found. Use registerService() to add new services.`);this.services.set(e,t),this.pluginLoader.replaceService(e,t),this.logger.info(`Service '${e}' replaced`,{service:e})},hook:(e,t)=>{this.hooks.has(e)||this.hooks.set(e,[]),this.hooks.get(e).push(t)},trigger:async(e,...t)=>{let n=this.hooks.get(e)||[];for(let e of n)await e(...t)},getServices:()=>new Map(this.services),logger:this.logger,getKernel:()=>this},this.pluginLoader.setContext(this.context),this.config.gracefulShutdown&&this.registerShutdownSignals()}async use(e){if(this.state!==`idle`)throw Error(`[Kernel] Cannot register plugins after bootstrap has started`);let t=await this.pluginLoader.loadPlugin(e);if(!t.success||!t.plugin)throw Error(`Failed to load plugin: ${e.name} - ${t.error?.message}`);let n=t.plugin;return this.plugins.set(n.name,n),this.logger.info(`Plugin registered: ${n.name}@${n.version}`,{plugin:n.name,version:n.version}),this}registerService(e,t){if(this.services.has(e))throw Error(`[Kernel] Service '${e}' already registered`);return this.services.set(e,t),this.pluginLoader.registerService(e,t),this.logger.info(`Service '${e}' registered`,{service:e}),this}registerServiceFactory(e,t,n=`singleton`,r){return this.pluginLoader.registerServiceFactory({name:e,factory:t,lifecycle:n,dependencies:r}),this}preInjectCoreFallbacks(){if(!this.config.skipSystemValidation){for(let[e,t]of Object.entries(pi))if(t===`core`&&!(this.services.has(e)||this.pluginLoader.hasService(e))){let t=cp[e];if(t){let n=t();this.registerService(e,n),this.logger.debug(`[Kernel] Pre-injected in-memory fallback for '${e}' before Phase 2`)}}}}validateSystemRequirements(){if(this.config.skipSystemValidation){this.logger.debug(`System requirement validation skipped`);return}this.logger.debug(`Validating system service requirements...`);let e=[],t=[];for(let[n,r]of Object.entries(pi))if(!(this.services.has(n)||this.pluginLoader.hasService(n)))if(r===`required`)this.logger.error(`CRITICAL: Required service missing: ${n}`),e.push(n);else if(r===`core`){let e=cp[n];if(e){let t=e();this.registerService(n,t),this.logger.warn(`Service '${n}' not provided \u2014 using in-memory fallback`)}else this.logger.warn(`CORE: Core service missing, functionality may be degraded: ${n}`),t.push(n)}else this.logger.info(`Info: Optional service not present: ${n}`);if(e.length>0){let t=`System failed to start. Missing critical services: ${e.join(`, `)}`;throw this.logger.error(t),Error(t)}t.length>0&&this.logger.warn(`System started with degraded capabilities. Missing core services: ${t.join(`, `)}`),this.logger.info(`System requirement check passed`)}async bootstrap(){if(this.state!==`idle`)throw Error(`[Kernel] Kernel already bootstrapped`);this.state=`initializing`,this.logger.info(`Bootstrap started`);try{let e=this.pluginLoader.detectCircularDependencies();e.length>0&&this.logger.warn(`Circular service dependencies detected:`,{cycles:e});let t=this.resolveDependencies();this.logger.info(`Phase 1: Init plugins`);for(let e of t)await this.initPluginWithTimeout(e);this.preInjectCoreFallbacks(),this.logger.info(`Phase 2: Start plugins`),this.state=`running`;for(let e of t){let t=await this.startPluginWithTimeout(e);if(!t.success&&(this.logger.error(`Plugin startup failed: ${e.name}`,t.error),this.config.rollbackOnFailure))throw this.logger.warn(`Rolling back started plugins...`),await this.rollbackStartedPlugins(),Error(`Plugin ${e.name} failed to start - rollback complete`)}this.validateSystemRequirements(),this.logger.debug(`Triggering kernel:ready hook`),await this.context.trigger(`kernel:ready`),this.logger.info(`✅ Bootstrap complete`)}catch(e){throw this.state=`stopped`,e}}async shutdown(){if(this.state===`stopped`||this.state===`stopping`){this.logger.warn(`Kernel already stopped or stopping`);return}if(this.state!==`running`)throw Error(`[Kernel] Kernel not running`);this.state=`stopping`,this.logger.info(`Graceful shutdown started`);try{let e=this.performShutdown(),t=new Promise((e,t)=>{setTimeout(()=>{t(Error(`Shutdown timeout exceeded`))},this.config.shutdownTimeout)});await Promise.race([e,t]),this.state=`stopped`,this.logger.info(`✅ Graceful shutdown complete`)}catch(e){throw this.logger.error(`Shutdown error - forcing stop`,e),this.state=`stopped`,e}finally{await this.logger.destroy()}}async checkPluginHealth(e){return await this.pluginLoader.checkPluginHealth(e)}async checkAllPluginsHealth(){let e=new Map;for(let t of this.plugins.keys()){let n=await this.checkPluginHealth(t);e.set(t,n)}return e}getPluginMetrics(){return new Map(this.pluginStartTimes)}getService(e){return this.context.getService(e)}async getServiceAsync(e,t){return await this.pluginLoader.getService(e,t)}isRunning(){return this.state===`running`}getState(){return this.state}async initPluginWithTimeout(e){let t=e.startupTimeout||this.config.defaultStartupTimeout;this.logger.debug(`Init: ${e.name}`,{plugin:e.name});let n=e.init(this.context),r=new Promise((n,r)=>{setTimeout(()=>{r(Error(`Plugin ${e.name} init timeout after ${t}ms`))},t)});await Promise.race([n,r])}async startPluginWithTimeout(e){if(!e.start)return{success:!0,pluginName:e.name};let t=e.startupTimeout||this.config.defaultStartupTimeout,n=Date.now();this.logger.debug(`Start: ${e.name}`,{plugin:e.name});try{let r=e.start(this.context),i=new Promise((n,r)=>{setTimeout(()=>{r(Error(`Plugin ${e.name} start timeout after ${t}ms`))},t)});await Promise.race([r,i]);let a=Date.now()-n;return this.startedPlugins.add(e.name),this.pluginStartTimes.set(e.name,a),this.logger.debug(`Plugin started: ${e.name} (${a}ms)`),{success:!0,pluginName:e.name,startTime:a}}catch(t){let r=Date.now()-n,i=t.message.includes(`timeout`);return{success:!1,pluginName:e.name,error:t,startTime:r,timedOut:i}}}async rollbackStartedPlugins(){let e=Array.from(this.startedPlugins).reverse();for(let t of e){let e=this.plugins.get(t);if(e?.destroy)try{this.logger.debug(`Rollback: ${t}`),await e.destroy()}catch(e){this.logger.error(`Rollback failed for ${t}`,e)}}this.startedPlugins.clear()}async performShutdown(){await this.context.trigger(`kernel:shutdown`);let e=Array.from(this.plugins.values()).reverse();for(let t of e)if(t.destroy){this.logger.debug(`Destroy: ${t.name}`,{plugin:t.name});try{await t.destroy()}catch(e){this.logger.error(`Error destroying plugin ${t.name}`,e)}}for(let e of this.shutdownHandlers)try{await e()}catch(e){this.logger.error(`Shutdown handler error`,e)}}resolveDependencies(){let e=[],t=new Set,n=new Set,r=i=>{if(t.has(i))return;if(n.has(i))throw Error(`[Kernel] Circular dependency detected: ${i}`);let a=this.plugins.get(i);if(!a)throw Error(`[Kernel] Plugin '${i}' not found`);n.add(i);let o=a.dependencies||[];for(let e of o){if(!this.plugins.has(e))throw Error(`[Kernel] Dependency '${e}' not found for plugin '${i}'`);r(e)}n.delete(i),t.add(i),e.push(a)};for(let e of this.plugins.keys())r(e);return e}registerShutdownSignals(){let e=[`SIGINT`,`SIGTERM`,`SIGQUIT`],t=!1,n=async e=>{if(t){this.logger.warn(`Shutdown already in progress, ignoring ${e}`);return}t=!0,this.logger.info(`Received ${e} - initiating graceful shutdown`);try{await this.shutdown(),Xf(0)}catch(e){this.logger.error(`Shutdown failed`,e),Xf(1)}};if(Jf)for(let t of e)process.on(t,()=>n(t))}onShutdown(e){this.shutdownHandlers.push(e)}};qf({},{HttpTestAdapter:()=>dp,TestRunner:()=>up});var up=class{constructor(e){this.adapter=e}async runSuite(e){let t=[];for(let n of e.scenarios)t.push(await this.runScenario(n));return t}async runScenario(e){let t=Date.now(),n={};if(e.setup)for(let r of e.setup)try{await this.runStep(r,n)}catch(n){return{scenarioId:e.id,passed:!1,steps:[],error:`Setup failed: ${n instanceof Error?n.message:String(n)}`,duration:Date.now()-t}}let r=[],i=!0,a;for(let t of e.steps){let e=Date.now();try{let i=await this.runStep(t,n);r.push({stepName:t.name,passed:!0,output:i,duration:Date.now()-e})}catch(n){i=!1,a=n,r.push({stepName:t.name,passed:!1,error:n,duration:Date.now()-e});break}}if(e.teardown)for(let t of e.teardown)try{await this.runStep(t,n)}catch(e){i&&(i=!1,a=`Teardown failed: ${e instanceof Error?e.message:String(e)}`)}return{scenarioId:e.id,passed:i,steps:r,error:a,duration:Date.now()-t}}async runStep(e,t){let n=this.resolveVariables(e.action,t),r=await this.adapter.execute(n,t);if(e.capture)for(let[n,i]of Object.entries(e.capture))t[n]=this.getValueByPath(r,i);if(e.assertions)for(let n of e.assertions)this.assert(r,n,t);return r}resolveVariables(e,t){let n=JSON.stringify(e).replace(/\{\{([^}]+)\}\}/g,(e,n)=>{let r=this.getValueByPath(t,n.trim());return r===void 0?e:typeof r==`string`?r:JSON.stringify(r)});try{return JSON.parse(n)}catch{return e}}getValueByPath(e,t){if(!t)return e;let n=t.split(`.`),r=e;for(let e of n){if(r==null)return;r=r[e]}return r}assert(e,t,n){let r=this.getValueByPath(e,t.field),i=t.expectedValue;switch(t.operator){case`equals`:if(r!==i)throw Error(`Assertion failed: ${t.field} expected ${i}, got ${r}`);break;case`not_equals`:if(r===i)throw Error(`Assertion failed: ${t.field} expected not ${i}, got ${r}`);break;case`contains`:if(Array.isArray(r)){if(!r.includes(i))throw Error(`Assertion failed: ${t.field} array does not contain ${i}`)}else if(typeof r==`string`&&!r.includes(String(i)))throw Error(`Assertion failed: ${t.field} string does not contain ${i}`);break;case`not_null`:if(r==null)throw Error(`Assertion failed: ${t.field} is null`);break;case`is_null`:if(r!=null)throw Error(`Assertion failed: ${t.field} is not null`);break;default:throw Error(`Unknown assertion operator: ${t.operator}`)}}},dp=class{constructor(e,t){this.baseUrl=e,this.authToken=t}async execute(e,t){let n={"Content-Type":`application/json`};switch(this.authToken&&(n.Authorization=`Bearer ${this.authToken}`),e.user&&(n[`X-Run-As`]=e.user),e.type){case`create_record`:return this.createRecord(e.target,e.payload||{},n);case`update_record`:return this.updateRecord(e.target,e.payload||{},n);case`delete_record`:return this.deleteRecord(e.target,e.payload||{},n);case`read_record`:return this.readRecord(e.target,e.payload||{},n);case`query_records`:return this.queryRecords(e.target,e.payload||{},n);case`api_call`:return this.rawApiCall(e.target,e.payload||{},n);case`wait`:let t=Number(e.payload?.duration||1e3);return new Promise(e=>setTimeout(()=>e({waited:t}),t));default:throw Error(`Unsupported action type in HttpAdapter: ${e.type}`)}}async createRecord(e,t,n){let r=await fetch(`${this.baseUrl}/api/data/${e}`,{method:`POST`,headers:n,body:JSON.stringify(t)});return this.handleResponse(r)}async updateRecord(e,t,n){let r=t.id;if(!r)throw Error(`Update record requires id in payload`);let i=await fetch(`${this.baseUrl}/api/data/${e}/${r}`,{method:`PUT`,headers:n,body:JSON.stringify(t)});return this.handleResponse(i)}async deleteRecord(e,t,n){let r=t.id;if(!r)throw Error(`Delete record requires id in payload`);let i=await fetch(`${this.baseUrl}/api/data/${e}/${r}`,{method:`DELETE`,headers:n});return this.handleResponse(i)}async readRecord(e,t,n){let r=t.id;if(!r)throw Error(`Read record requires id in payload`);let i=await fetch(`${this.baseUrl}/api/data/${e}/${r}`,{method:`GET`,headers:n});return this.handleResponse(i)}async queryRecords(e,t,n){let r=await fetch(`${this.baseUrl}/api/data/${e}/query`,{method:`POST`,headers:n,body:JSON.stringify(t)});return this.handleResponse(r)}async rawApiCall(e,t,n){let r=t.method||`GET`,i=t.body?JSON.stringify(t.body):void 0,a=e.startsWith(`http`)?e:`${this.baseUrl}${e}`,o=await fetch(a,{method:r,headers:n,body:i});return this.handleResponse(o)}async handleResponse(e){if(!e.ok){let t=await e.text();throw Error(`HTTP Error ${e.status}: ${t}`)}let t=e.headers.get(`content-type`);return t&&t.includes(`application/json`)?e.json():e.text()}},fp=class e{constructor(e){this.sandboxes=new Map,this.monitoringIntervals=new Map,this.memoryBaselines=new Map,this.cpuBaselines=new Map,this.logger=e.child({component:`SandboxRuntime`})}createSandbox(e,t){if(this.sandboxes.has(e))throw Error(`Sandbox already exists for plugin: ${e}`);let n={pluginId:e,config:t,startTime:new Date,resourceUsage:{memory:{current:0,peak:0,limit:t.memory?.maxHeap},cpu:{current:0,average:0,limit:t.cpu?.maxCpuPercent},connections:{current:0,limit:t.network?.maxConnections}}};this.sandboxes.set(e,n);let r=Zf();return this.memoryBaselines.set(e,r.heapUsed),this.cpuBaselines.set(e,process.cpuUsage()),this.startResourceMonitoring(e),this.logger.info(`Sandbox created`,{pluginId:e,level:t.level,memoryLimit:t.memory?.maxHeap,cpuLimit:t.cpu?.maxCpuPercent}),n}destroySandbox(e){this.sandboxes.get(e)&&(this.stopResourceMonitoring(e),this.memoryBaselines.delete(e),this.cpuBaselines.delete(e),this.sandboxes.delete(e),this.logger.info(`Sandbox destroyed`,{pluginId:e}))}checkResourceAccess(e,t,n){let r=this.sandboxes.get(e);if(!r)return{allowed:!1,reason:`Sandbox not found`};let{config:i}=r;switch(t){case`file`:return this.checkFileAccess(i,n);case`network`:return this.checkNetworkAccess(i,n);case`process`:return this.checkProcessAccess(i);case`env`:return this.checkEnvAccess(i,n);default:return{allowed:!1,reason:`Unknown resource type`}}}checkFileAccess(e,t){if(e.level===`none`)return{allowed:!0};if(!e.filesystem)return{allowed:!1,reason:`File system access not configured`};if(!t)return{allowed:e.filesystem.mode!==`none`};let n=e.filesystem.allowedPaths||[],r=Fd.normalize(Fd.resolve(t)),i=n.some(e=>{let t=Fd.normalize(Fd.resolve(e));return r.startsWith(t)});return n.length>0&&!i?{allowed:!1,reason:`Path not in allowed list: ${t}`}:(e.filesystem.deniedPaths||[]).some(e=>{let t=Fd.normalize(Fd.resolve(e));return r.startsWith(t)})?{allowed:!1,reason:`Path is explicitly denied: ${t}`}:{allowed:!0}}checkNetworkAccess(e,t){if(e.level===`none`)return{allowed:!0};if(!e.network)return{allowed:!1,reason:`Network access not configured`};if(e.network.mode===`none`)return{allowed:!1,reason:`Network access disabled`};if(!t)return{allowed:e.network.mode!==`none`};let n;try{n=new URL(t).hostname}catch{return{allowed:!1,reason:`Invalid URL: ${t}`}}let r=e.network.allowedHosts||[];return r.length>0&&!r.some(e=>n===e)?{allowed:!1,reason:`Host not in allowed list: ${t}`}:(e.network.deniedHosts||[]).some(e=>n===e)?{allowed:!1,reason:`Host is blocked: ${t}`}:{allowed:!0}}checkProcessAccess(e){return e.level===`none`?{allowed:!0}:e.process?e.process.allowSpawn?{allowed:!0}:{allowed:!1,reason:`Process spawning not allowed`}:{allowed:!1,reason:`Process access not configured`}}checkEnvAccess(e,t){return e.level===`none`||e.process?{allowed:!0}:{allowed:!1,reason:`Environment access not configured`}}checkResourceLimits(e){let t=this.sandboxes.get(e);if(!t)return{withinLimits:!0,violations:[]};let n=[],{resourceUsage:r,config:i}=t;return i.memory?.maxHeap&&r.memory.current>i.memory.maxHeap&&n.push(`Memory limit exceeded: ${r.memory.current} > ${i.memory.maxHeap}`),i.runtime?.resourceLimits?.maxCpu&&r.cpu.current>i.runtime.resourceLimits.maxCpu&&n.push(`CPU limit exceeded: ${r.cpu.current}% > ${i.runtime.resourceLimits.maxCpu}%`),i.network?.maxConnections&&r.connections.current>i.network.maxConnections&&n.push(`Connection limit exceeded: ${r.connections.current} > ${i.network.maxConnections}`),{withinLimits:n.length===0,violations:n}}getResourceUsage(e){return this.sandboxes.get(e)?.resourceUsage}startResourceMonitoring(t){let n=setInterval(()=>{this.updateResourceUsage(t)},e.MONITORING_INTERVAL_MS);this.monitoringIntervals.set(t,n)}stopResourceMonitoring(e){let t=this.monitoringIntervals.get(e);t&&(clearInterval(t),this.monitoringIntervals.delete(e))}updateResourceUsage(t){let n=this.sandboxes.get(t);if(!n)return;let r=Zf(),i=this.memoryBaselines.get(t)??0,a=Math.max(0,r.heapUsed-i);n.resourceUsage.memory.current=a,n.resourceUsage.memory.peak=Math.max(n.resourceUsage.memory.peak,a);let o=this.cpuBaselines.get(t)??{user:0,system:0},s=process.cpuUsage(),c=s.user-o.user+(s.system-o.system),l=e.MONITORING_INTERVAL_MS*1e3;n.resourceUsage.cpu.current=c/l*100,this.cpuBaselines.set(t,s);let{withinLimits:u,violations:d}=this.checkResourceLimits(t);u||this.logger.warn(`Resource limit violations detected`,{pluginId:t,violations:d})}getAllSandboxes(){return new Map(this.sandboxes)}shutdown(){for(let e of this.monitoringIntervals.keys())this.stopResourceMonitoring(e);this.sandboxes.clear(),this.memoryBaselines.clear(),this.cpuBaselines.clear(),this.logger.info(`Sandbox runtime shutdown complete`)}};fp.MONITORING_INTERVAL_MS=5e3;var pp=class{constructor(e,t){this.subscriptions=new Map,this.eventBuffer=[],this._baseUrl=e,this._token=t}subscribeMetadata(e,t,n){let r=`metadata-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,packageId:n?.packageId,eventTypes:[`metadata.${e}.created`,`metadata.${e}.updated`,`metadata.${e}.deleted`]},handler:e=>{e.type.startsWith(`metadata.`)&&t(e)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}subscribeData(e,t,n){let r=`data-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,recordId:n?.recordId,eventTypes:[`data.record.created`,`data.record.updated`,`data.record.deleted`]},handler:r=>{r.type.startsWith(`data.`)&&r.object===e&&(!n?.recordId||r.payload?.recordId===n.recordId)&&t(r)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}emitEvent(e){for(let t of this.subscriptions.values()){let n=!t.filter.type||e.type.includes(t.filter.type)||e.object===t.filter.type,r=!t.filter.eventTypes?.length||t.filter.eventTypes.includes(e.type),i=!t.filter.packageId||e.payload?.packageId===t.filter.packageId;if(n&&r&&i)try{t.handler(e)}catch(e){console.error(`Error in realtime event handler:`,e)}}}startPolling(){this.pollInterval||=setInterval(()=>{for(;this.eventBuffer.length>0;){let e=this.eventBuffer.shift();e&&this.emitEvent(e)}},2e3)}stopPolling(){this.pollInterval&&=(clearInterval(this.pollInterval),void 0)}_bufferEvent(e){this.eventBuffer.push(e)}disconnect(){this.stopPolling(),this.subscriptions.clear(),this.eventBuffer=[]}},mp=class{constructor(e){this.meta={getTypes:async()=>{let e=this.getRoute(`metadata`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},getItems:async(e,t)=>{let n=this.getRoute(`metadata`),r=new URLSearchParams;t?.packageId&&r.set(`package`,t.packageId);let i=r.toString(),a=`${this.baseUrl}${n}/${e}${i?`?${i}`:``}`,o=await this.fetch(a);return this.unwrapResponse(o)},getItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.packageId&&i.set(`package`,n.packageId);let a=i.toString(),o=`${this.baseUrl}${r}/${e}/${t}${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},saveItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`PUT`,body:JSON.stringify(n)});return this.unwrapResponse(i)},deleteItem:async(e,t)=>{let n=this.getRoute(`metadata`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)},getCached:async(e,t)=>{let n=this.getRoute(`metadata`),r={};t?.ifNoneMatch&&(r[`If-None-Match`]=t.ifNoneMatch),t?.ifModifiedSince&&(r[`If-Modified-Since`]=t.ifModifiedSince);let i=await this.fetch(`${this.baseUrl}${n}/object/${e}`,{headers:r});if(i.status===304)return{notModified:!0,etag:t?.ifNoneMatch?{value:t.ifNoneMatch.replace(/^W\/|"/g,``),weak:t.ifNoneMatch.startsWith(`W/`)}:void 0};let a=await i.json(),o=i.headers.get(`ETag`),s=i.headers.get(`Last-Modified`);return{data:a,etag:o?{value:o.replace(/^W\/|"/g,``),weak:o.startsWith(`W/`)}:void 0,lastModified:s||void 0,notModified:!1}},getView:async(e,t=`list`)=>{let n=this.getRoute(`ui`),r=await this.fetch(`${this.baseUrl}${n}/view/${e}?type=${t}`);return this.unwrapResponse(r)}},this.analytics={query:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/query`,{method:`POST`,body:JSON.stringify(e)})).json()},meta:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/meta/${e}`)).json()},explain:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/explain`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.packages={list:async e=>{let t=this.getRoute(`packages`),n=new URLSearchParams;e?.status&&n.set(`status`,e.status),e?.type&&n.set(`type`,e.type),e?.enabled!==void 0&&n.set(`enabled`,String(e.enabled));let r=n.toString(),i=`${this.baseUrl}${t}${r?`?`+r:``}`,a=await this.fetch(i);return this.unwrapResponse(a)},get:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},install:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({manifest:e,settings:t?.settings,enableOnInstall:t?.enableOnInstall})});return this.unwrapResponse(r)},uninstall:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},enable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)}},this.auth={getConfig:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/config`);return this.unwrapResponse(t)},login:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-in/email`,{method:`POST`,body:JSON.stringify(e)})).json();return n.data?.token&&(this.token=n.data.token),n},logout:async()=>{let e=this.getRoute(`auth`);await this.fetch(`${this.baseUrl}${e}/sign-out`,{method:`POST`}),this.token=void 0},me:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/get-session`)).json()},register:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-up/email`,{method:`POST`,body:JSON.stringify(e)})).json();return n.data?.token&&(this.token=n.data.token),n},refreshToken:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/get-session`,{method:`GET`})).json();return n.data?.token&&(this.token=n.data.token),n}},this.storage={upload:async(e,t=`user`)=>{let n={filename:e.name,mimeType:e.type,size:e.size,scope:t},r=this.getRoute(`storage`),{data:i}=await(await this.fetch(`${this.baseUrl}${r}/upload/presigned`,{method:`POST`,body:JSON.stringify(n)})).json(),a=await this.fetchImpl(i.uploadUrl,{method:i.method,headers:i.headers,body:e});if(!a.ok)throw Error(`Storage Upload Failed: ${a.statusText}`);let o={fileId:i.fileId};return(await this.fetch(`${this.baseUrl}${r}/upload/complete`,{method:`POST`,body:JSON.stringify(o)})).json()},getDownloadUrl:async e=>{let t=this.getRoute(`storage`);return(await(await this.fetch(`${this.baseUrl}${t}/files/${e}/url`)).json()).url},getPresignedUrl:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/presigned`,{method:`POST`,body:JSON.stringify(e)})).json()},initChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked`,{method:`POST`,body:JSON.stringify(e)})).json()},uploadPart:async(e,t,n,r)=>{let i=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/chunk/${t}`,{method:`PUT`,headers:{"x-resume-token":n},body:r})).json()},completeChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked/${e.uploadId}/complete`,{method:`POST`,body:JSON.stringify(e)})).json()},resumeUpload:async(e,t,n,r)=>{let i=this.getRoute(`storage`),{totalChunks:a,uploadedChunks:o}=(await(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/progress`)).json()).data,s=[],c=t instanceof ArrayBuffer?t:await t.arrayBuffer();for(let t=o;t{let n=this.getRoute(`automation`);return(await this.fetch(`${this.baseUrl}${n}/trigger/${e}`,{method:`POST`,body:JSON.stringify(t)})).json()},list:async()=>{let e=this.getRoute(`automation`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},get:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`);return this.unwrapResponse(n)},create:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({name:e,...t})});return this.unwrapResponse(r)},update:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`PUT`,body:JSON.stringify({definition:t})});return this.unwrapResponse(r)},delete:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`,{method:`DELETE`});return this.unwrapResponse(n)},toggle:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/toggle`,{method:`POST`,body:JSON.stringify({enabled:t})});return this.unwrapResponse(r)},runs:{list:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${e}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/runs/${t}`);return this.unwrapResponse(r)}}},this.permissions={check:async e=>{let t=this.getRoute(`permissions`),n=new URLSearchParams({object:e.object,action:e.action});e.recordId!==void 0&&n.set(`recordId`,e.recordId),e.field!==void 0&&n.set(`field`,e.field);let r=await this.fetch(`${this.baseUrl}${t}/check?${n.toString()}`);return this.unwrapResponse(r)},getObjectPermissions:async e=>{let t=this.getRoute(`permissions`),n=await this.fetch(`${this.baseUrl}${t}/objects/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},getEffectivePermissions:async()=>{let e=this.getRoute(`permissions`),t=await this.fetch(`${this.baseUrl}${e}/effective`);return this.unwrapResponse(t)}},this.realtime={connect:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/connect`,{method:`POST`,body:JSON.stringify(e||{})});return this.unwrapResponse(n)},disconnect:async()=>{let e=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${e}/disconnect`,{method:`POST`})},subscribe:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/subscribe`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unsubscribe:async e=>{let t=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${t}/unsubscribe`,{method:`POST`,body:JSON.stringify({subscriptionId:e})})},setPresence:async(e,t)=>{let n=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${n}/presence`,{method:`PUT`,body:JSON.stringify({channel:e,state:t})})},getPresence:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/presence/${encodeURIComponent(e)}`);return this.unwrapResponse(n)}},this.workflow={getConfig:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/config`);return this.unwrapResponse(n)},getState:async(e,t)=>{let n=this.getRoute(`workflow`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/state`);return this.unwrapResponse(r)},transition:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/transition`,{method:`POST`,body:JSON.stringify({transition:e.transition,comment:e.comment,data:e.data})});return this.unwrapResponse(n)},approve:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/approve`,{method:`POST`,body:JSON.stringify({comment:e.comment,data:e.data})});return this.unwrapResponse(n)},reject:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/reject`,{method:`POST`,body:JSON.stringify({reason:e.reason,comment:e.comment})});return this.unwrapResponse(n)}},this.views={list:async(e,t)=>{let n=this.getRoute(`views`),r=new URLSearchParams;t&&r.set(`type`,t);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({object:e,data:t})});return this.unwrapResponse(r)},update:async(e,t,n)=>{let r=this.getRoute(`views`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`PUT`,body:JSON.stringify({object:e,viewId:t,data:n})});return this.unwrapResponse(i)},delete:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)}},this.notifications={registerDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unregisterDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},getPreferences:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/preferences`);return this.unwrapResponse(t)},updatePreferences:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/preferences`,{method:`PUT`,body:JSON.stringify({preferences:e})});return this.unwrapResponse(n)},list:async e=>{let t=this.getRoute(`notifications`),n=new URLSearchParams;e?.read!==void 0&&n.set(`read`,String(e.read)),e?.type&&n.set(`type`,e.type),e?.limit&&n.set(`limit`,String(e.limit)),e?.cursor&&n.set(`cursor`,e.cursor);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}${r?`?${r}`:``}`);return this.unwrapResponse(i)},markRead:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/read`,{method:`POST`,body:JSON.stringify({ids:e})});return this.unwrapResponse(n)},markAllRead:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/read/all`,{method:`POST`});return this.unwrapResponse(t)}},this.ai={nlq:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/nlq`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},suggest:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/suggest`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},insights:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/insights`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)}},this.i18n={getLocales:async()=>{let e=this.getRoute(`i18n`),t=await this.fetch(`${this.baseUrl}${e}/locales`);return this.unwrapResponse(t)},getTranslations:async(e,t)=>{let n=this.getRoute(`i18n`),r=new URLSearchParams;r.set(`locale`,e),t?.namespace&&r.set(`namespace`,t.namespace),t?.keys&&r.set(`keys`,t.keys.join(`,`));let i=await this.fetch(`${this.baseUrl}${n}/translations?${r.toString()}`);return this.unwrapResponse(i)},getFieldLabels:async(e,t)=>{let n=this.getRoute(`i18n`),r=await this.fetch(`${this.baseUrl}${n}/labels/${encodeURIComponent(e)}?locale=${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.feed={list:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.type&&i.set(`type`,n.type),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed${a?`?${a}`:``}`);return this.unwrapResponse(o)},create:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed`,{method:`POST`,body:JSON.stringify(n)});return this.unwrapResponse(i)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`PUT`,body:JSON.stringify(r)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`DELETE`});return this.unwrapResponse(i)},addReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions`,{method:`POST`,body:JSON.stringify({emoji:r})});return this.unwrapResponse(a)},removeReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions/${encodeURIComponent(r)}`,{method:`DELETE`});return this.unwrapResponse(a)},pin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`POST`});return this.unwrapResponse(i)},unpin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`DELETE`});return this.unwrapResponse(i)},star:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`POST`});return this.unwrapResponse(i)},unstar:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`DELETE`});return this.unwrapResponse(i)},search:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=new URLSearchParams;a.set(`query`,n),r?.type&&a.set(`type`,r.type),r?.actorId&&a.set(`actorId`,r.actorId),r?.dateFrom&&a.set(`dateFrom`,r.dateFrom),r?.dateTo&&a.set(`dateTo`,r.dateTo),r?.limit&&a.set(`limit`,String(r.limit)),r?.cursor&&a.set(`cursor`,r.cursor);let o=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/search?${a.toString()}`);return this.unwrapResponse(o)},getChangelog:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.field&&i.set(`field`,n.field),n?.actorId&&i.set(`actorId`,n.actorId),n?.dateFrom&&i.set(`dateFrom`,n.dateFrom),n?.dateTo&&i.set(`dateTo`,n.dateTo),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/changelog${a?`?${a}`:``}`);return this.unwrapResponse(o)},subscribe:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`POST`,body:JSON.stringify(n||{})});return this.unwrapResponse(i)},unsubscribe:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`DELETE`});return this.unwrapResponse(r)}},this.data={query:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/query`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},find:async(e,t={})=>{let n=this.getRoute(`data`),r=new URLSearchParams,i=t,a={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(i.where&&(a.filter=i.where),i.fields&&(a.select=i.fields),i.orderBy&&(a.sort=i.orderBy),i.limit!=null&&(a.top=i.limit),i.offset!=null&&(a.skip=i.offset),i.aggregations&&(a.aggregations=i.aggregations),i.groupBy&&(a.groupBy=i.groupBy)):Object.assign(a,t),a.top&&r.set(`top`,a.top.toString()),a.skip&&r.set(`skip`,a.skip.toString()),a.sort)if(Array.isArray(a.sort)&&typeof a.sort[0]==`object`)r.set(`sort`,JSON.stringify(a.sort));else{let e=Array.isArray(a.sort)?a.sort.join(`,`):a.sort;r.set(`sort`,e)}a.select&&r.set(`select`,a.select.join(`,`));let o=a.filter??a.filters;o&&(this.isFilterAST(o)||Array.isArray(o)?r.set(`filter`,JSON.stringify(o)):typeof o==`object`&&o&&Object.entries(o).forEach(([e,t])=>{t!=null&&r.append(e,String(t))})),a.aggregations&&r.set(`aggregations`,JSON.stringify(a.aggregations)),a.groupBy&&r.set(`groupBy`,a.groupBy.join(`,`));let s=await this.fetch(`${this.baseUrl}${n}/${e}?${r.toString()}`);return this.unwrapResponse(s)},get:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},createMany:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/createMany`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},update:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`PATCH`,body:JSON.stringify(n)});return this.unwrapResponse(i)},batch:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/batch`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},updateMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={records:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/updateMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)},delete:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`,{method:`DELETE`});return this.unwrapResponse(r)},deleteMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={ids:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/deleteMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)}},this.baseUrl=e.baseUrl.replace(/\/$/,``),this.token=e.token,this.fetchImpl=e.fetch||globalThis.fetch.bind(globalThis),this.logger=e.logger||$f({level:e.debug?`debug`:`info`,format:`pretty`}),this.realtimeAPI=new pp(this.baseUrl,this.token),this.logger.debug(`ObjectStack client created`,{baseUrl:this.baseUrl})}async connect(){this.logger.debug(`Connecting to ObjectStack server`,{baseUrl:this.baseUrl});try{let e;try{let t;try{t=`${new URL(this.baseUrl).origin}/.well-known/objectstack`}catch{t=`/.well-known/objectstack`}this.logger.debug(`Probing .well-known discovery`,{url:t});let n=await this.fetchImpl(t);if(n.ok){let t=await n.json();e=t.data||t,this.logger.debug(`Discovered via .well-known`)}}catch(e){this.logger.debug(`Standard discovery probe failed`,{error:e.message})}if(!e){let t=`${this.baseUrl}/api/v1/discovery`;this.logger.debug(`Falling back to standard discovery endpoint`,{url:t});let n=await this.fetchImpl(t);if(!n.ok)throw Error(`Failed to connect to ${t}: ${n.statusText}`);let r=await n.json();e=r.data||r}if(!e)throw Error(`Connection failed: No discovery data returned`);return this.discoveryInfo=e,this.logger.info(`Connected to ObjectStack server`,{version:e.version,apiName:e.apiName,services:e.services}),e}catch(e){throw this.logger.error(`Failed to connect to ObjectStack server`,e,{baseUrl:this.baseUrl}),e}}get capabilities(){let e=this.discoveryInfo?.capabilities;if(!e)return;let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r?!!r.enabled:!!r;return t}get events(){return this.realtimeAPI}isFilterAST(e){return _(e)}async unwrapResponse(e){let t=await e.json();return t&&typeof t.success==`boolean`&&`data`in t?t.data:t}async fetch(e,t={}){this.logger.debug(`HTTP request`,{method:t.method||`GET`,url:e,hasBody:!!t.body});let n={"Content-Type":`application/json`,...t.headers||{}};this.token&&(n.Authorization=`Bearer ${this.token}`);let r=await this.fetchImpl(e,{...t,headers:n});if(this.logger.debug(`HTTP response`,{method:t.method||`GET`,url:e,status:r.status,ok:r.ok}),!r.ok){let n;try{n=await r.json()}catch{n={message:r.statusText}}this.logger.error(`HTTP request failed`,void 0,{method:t.method||`GET`,url:e,status:r.status,error:n});let i=n?.message||n?.error?.message||r.statusText,a=n?.code||n?.error?.code,o=Error(`[ObjectStack] ${a?`${a}: `:``}${i}`);throw o.code=a,o.category=n?.category,o.httpStatus=r.status,o.retryable=n?.retryable,o.details=n?.details||n,o}return r}getRoute(e){let t=this.discoveryInfo?.routes;if(t){let n=t[e];if(n)return n}return{data:`/api/v1/data`,metadata:`/api/v1/meta`,discovery:`/api/v1/discovery`,ui:`/api/v1/ui`,auth:`/api/v1/auth`,analytics:`/api/v1/analytics`,storage:`/api/v1/storage`,automation:`/api/v1/automation`,packages:`/api/v1/packages`,permissions:`/api/v1/permissions`,realtime:`/api/v1/realtime`,workflow:`/api/v1/workflow`,views:`/api/v1/ui/views`,notifications:`/api/v1/notifications`,ai:`/api/v1/ai`,i18n:`/api/v1/i18n`,feed:`/api/v1/feed`,graphql:`/graphql`}[e]||`/api/v1/${e}`}},hp=(0,L.createContext)(null);function gp({client:e,children:t}){return L.createElement(hp.Provider,{value:e},t)}function _p(){let e=(0,L.useContext)(hp);if(!e)throw Error(`useClient must be used within an ObjectStackProvider. Make sure your component is wrapped with .`);return e}function vp(e,t,n){let r=_p();(0,L.useEffect)(()=>{if(!r)return;let i=r.events.subscribeMetadata(e,t,n);return()=>{i()}},[r,e,t,n?.packageId])}var yp=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),bp=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),xp=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Sp=e=>{let t=xp(e);return t.charAt(0).toUpperCase()+t.slice(1)},Cp={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},wp=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Tp=(0,L.createContext)({}),Ep=()=>(0,L.useContext)(Tp),See=(0,L.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ep()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,L.createElement)(`svg`,{ref:c,...Cp,width:t??l??Cp.width,height:t??l??Cp.height,stroke:e??f,strokeWidth:m,className:yp(`lucide`,p,i),...!a&&!wp(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,L.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),z=(e,t)=>{let n=(0,L.forwardRef)(({className:n,...r},i)=>(0,L.createElement)(See,{ref:i,iconNode:t,className:yp(`lucide-${bp(Sp(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Sp(e),n},Dp=z(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Op=z(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),Cee=z(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),kp=z(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ap=z(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),jp=z(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),wee=z(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),Tee=z(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Eee=z(`calculator`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]),Dee=z(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Mp=z(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Oee=z(`chart-pie`,[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]]),Np=z(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Pp=z(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Fp=z(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),kee=z(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Aee=z(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Ip=z(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Lp=z(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),jee=z(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Rp=z(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Mee=z(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),zp=z(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Bp=z(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Vp=z(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Hp=z(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Up=z(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Nee=z(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Pee=z(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Fee=z(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Iee=z(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Wp=z(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Gp=z(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Kp=z(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),qp=z(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Jp=z(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Lee=z(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Yp=z(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Ree=z(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Xp=z(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Zp=z(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),zee=z(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Qp=z(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),$p=z(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),em=z(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),tm=z(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),nm=z(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),rm=z(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Bee=z(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Vee=z(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),Hee=z(`pen-tool`,[[`path`,{d:`M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z`,key:`nt11vn`}],[`path`,{d:`m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18`,key:`15qc1e`}],[`path`,{d:`m2.3 2.3 7.286 7.286`,key:`1wuzzi`}],[`circle`,{cx:`11`,cy:`11`,r:`2`,key:`xmgehs`}]]),im=z(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),am=z(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Uee=z(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Wee=z(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),om=z(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Gee=z(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),sm=z(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),cm=z(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Kee=z(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),lm=z(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),um=z(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),dm=z(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),fm=z(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),qee=z(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),pm=z(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),mm=z(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),hm=z(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Jee=z(`toggle-left`,[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]),gm=z(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Yee=z(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),_m=z(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),vm=z(`webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),ym=z(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),bm=z(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),xm=z(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Sm=z(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Xee=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),B=n(((e,t)=>{t.exports=Xee()}))(),Zee=class extends L.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary] Uncaught error:`,e,t.componentStack)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,B.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-6`,children:(0,B.jsxs)(`div`,{className:`max-w-md w-full space-y-4 text-center`,children:[(0,B.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10`,children:(0,B.jsx)(Ip,{className:`h-6 w-6 text-destructive`})}),(0,B.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Something went wrong`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:this.state.error?.message||`An unexpected error occurred.`}),(0,B.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-auto rounded-lg bg-muted p-3 text-left text-xs font-mono text-muted-foreground`,children:this.state.error?.stack?.split(` -`).slice(0,6).join(` -`)}),(0,B.jsxs)(`button`,{onClick:this.handleReset,className:`inline-flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors`,children:[(0,B.jsx)(om,{className:`h-4 w-4`}),`Try Again`]})]})}):this.props.children}};function Cm(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function wm(...e){return t=>{let n=!1,r=e.map(e=>{let r=Cm(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:r,...i}=e;Dm(r)&&typeof Em==`function`&&(r=Em(r._payload));let a=L.Children.toArray(r),o=a.find(nte);if(o){let e=o.props.children,r=a.map(t=>t===o?L.Children.count(e)>1?L.Children.only(null):L.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:L.isValidElement(e)?L.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var km=Om(`Slot`);function ete(e){let t=L.forwardRef((e,t)=>{let{children:n,...r}=e;if(Dm(n)&&typeof Em==`function`&&(n=Em(n._payload)),L.isValidElement(n)){let e=ite(n),i=rte(r,n.props);return n.type!==L.Fragment&&(i.ref=t?wm(t,e):e),L.cloneElement(n,i)}return L.Children.count(n)>1?L.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tte=Symbol(`radix.slottable`);function nte(e){return L.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===tte}function rte(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function ite(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Am(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,Nm=jm,Pm=(e,t)=>n=>{if(t?.variants==null)return Nm(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Mm(t)||Mm(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Nm(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Fm=768;function ate(){let[e,t]=L.useState(void 0);return L.useEffect(()=>{let e=window.matchMedia(`(max-width: ${Fm-1}px)`),n=()=>{t(window.innerWidthe.removeEventListener(`change`,n)},[]),!!e}var ote=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),Im=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Lm=`-`,Rm=[],cte=`arbitrary..`,lte=e=>{let t=dte(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return ute(e);let n=e.split(Lm);return zm(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ote(i,t):t:i||Rm}return n[e]||Rm}}},zm=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=zm(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Lm):e.slice(t).join(Lm),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?cte+r:void 0})(),dte=e=>{let{theme:t,classGroups:n}=e;return fte(n,t)},fte=(e,t)=>{let n=Im();for(let r in e){let i=e[r];Bm(i,n,r,t)}return n},Bm=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){mte(e,t,n);return}if(typeof e==`function`){hte(e,t,n,r);return}gte(e,t,n,r)},mte=(e,t,n)=>{let r=e===``?t:Vm(t,e);r.classGroupId=n},hte=(e,t,n,r)=>{if(_te(e)){Bm(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ste(n,e))},gte=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(Lm),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,vte=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Hm=`!`,Um=`:`,yte=[],Wm=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),bte=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return Wm(t,l,c,u)};if(t){let e=t+Um,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Wm(yte,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},xte=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ste=e=>({cache:vte(e.cacheSize),parseClassName:bte(e),sortModifiers:xte(e),...lte(e)}),Cte=/\s+/,wte=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Cte),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Hm:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e0?` `+c:c)}return c},Tte=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=Ste(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=wte(e,n);return i(e,a),a};return a=o,(...e)=>a(Tte(...e))},Dte=[],Km=e=>{let t=t=>t[e]||Dte;return t.isThemeGetter=!0,t},qm=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Jm=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ote=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,kte=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ate=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jte=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mte=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Nte=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ym=e=>Ote.test(e),Xm=e=>!!e&&!Number.isNaN(Number(e)),Zm=e=>!!e&&Number.isInteger(Number(e)),Qm=e=>e.endsWith(`%`)&&Xm(e.slice(0,-1)),$m=e=>kte.test(e),eh=()=>!0,Pte=e=>Ate.test(e)&&!jte.test(e),th=()=>!1,Fte=e=>Mte.test(e),Ite=e=>Nte.test(e),Lte=e=>!nh(e)&&!sh(e),Rte=e=>dh(e,hh,th),nh=e=>qm.test(e),rh=e=>dh(e,gh,Pte),ih=e=>dh(e,Kte,Xm),zte=e=>dh(e,Jte,eh),Bte=e=>dh(e,qte,th),ah=e=>dh(e,ph,th),Vte=e=>dh(e,mh,Ite),oh=e=>dh(e,Yte,Fte),sh=e=>Jm.test(e),ch=e=>fh(e,gh),Hte=e=>fh(e,qte),lh=e=>fh(e,ph),Ute=e=>fh(e,hh),Wte=e=>fh(e,mh),uh=e=>fh(e,Yte,!0),Gte=e=>fh(e,Jte,!0),dh=(e,t,n)=>{let r=qm.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},fh=(e,t,n=!1)=>{let r=Jm.exec(e);return r?r[1]?t(r[1]):n:!1},ph=e=>e===`position`||e===`percentage`,mh=e=>e===`image`||e===`url`,hh=e=>e===`length`||e===`size`||e===`bg-size`,gh=e=>e===`length`,Kte=e=>e===`number`,qte=e=>e===`family-name`,Jte=e=>e===`number`||e===`weight`,Yte=e=>e===`shadow`,Xte=Ete(()=>{let e=Km(`color`),t=Km(`font`),n=Km(`text`),r=Km(`font-weight`),i=Km(`tracking`),a=Km(`leading`),o=Km(`breakpoint`),s=Km(`container`),c=Km(`spacing`),l=Km(`radius`),u=Km(`shadow`),d=Km(`inset-shadow`),f=Km(`text-shadow`),p=Km(`drop-shadow`),m=Km(`blur`),h=Km(`perspective`),g=Km(`aspect`),_=Km(`ease`),v=Km(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),sh,nh],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[sh,nh,c],T=()=>[Ym,`full`,`auto`,...w()],E=()=>[Zm,`none`,`subgrid`,sh,nh],D=()=>[`auto`,{span:[`full`,Zm,sh,nh]},Zm,sh,nh],O=()=>[Zm,`auto`,sh,nh],ee=()=>[`auto`,`min`,`max`,`fr`,sh,nh],te=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],k=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],j=()=>[Ym,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[Ym,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],N=()=>[Ym,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,sh,nh],F=()=>[...b(),lh,ah,{position:[sh,nh]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,Ute,Rte,{size:[sh,nh]}],re=()=>[Qm,ch,rh],ie=()=>[``,`none`,`full`,l,sh,nh],ae=()=>[``,Xm,ch,rh],oe=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ce=()=>[Xm,Qm,lh,ah],le=()=>[``,`none`,m,sh,nh],L=()=>[`none`,Xm,sh,nh],ue=()=>[`none`,Xm,sh,nh],de=()=>[Xm,sh,nh],fe=()=>[Ym,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[$m],breakpoint:[$m],color:[eh],container:[$m],"drop-shadow":[$m],ease:[`in`,`out`,`in-out`],font:[Lte],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[$m],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[$m],shadow:[$m],spacing:[`px`,Xm],text:[$m],"text-shadow":[$m],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Ym,nh,sh,g]}],container:[`container`],columns:[{columns:[Xm,nh,sh,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Zm,`auto`,sh,nh]}],basis:[{basis:[Ym,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Xm,Ym,`auto`,`initial`,`none`,nh]}],grow:[{grow:[``,Xm,sh,nh]}],shrink:[{shrink:[``,Xm,sh,nh]}],order:[{order:[Zm,`first`,`last`,`none`,sh,nh]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...te(),`normal`]}],"justify-items":[{"justify-items":[...k(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...k()]}],"align-content":[{content:[`normal`,...te()]}],"align-items":[{items:[...k(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...k(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...k(),`baseline`]}],"place-self":[{"place-self":[`auto`,...k()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...M()]}],"min-inline-size":[{"min-inline":[`auto`,...M()]}],"max-inline-size":[{"max-inline":[`none`,...M()]}],"block-size":[{block:[`auto`,...N()]}],"min-block-size":[{"min-block":[`auto`,...N()]}],"max-block-size":[{"max-block":[`none`,...N()]}],w:[{w:[s,`screen`,...j()]}],"min-w":[{"min-w":[s,`screen`,`none`,...j()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,ch,rh]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Gte,zte]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Qm,nh]}],"font-family":[{font:[Hte,Bte,t]}],"font-features":[{"font-features":[nh]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,sh,nh]}],"line-clamp":[{"line-clamp":[Xm,`none`,sh,ih]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,sh,nh]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,sh,nh]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...oe(),`wavy`]}],"text-decoration-thickness":[{decoration:[Xm,`from-font`,`auto`,sh,rh]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Xm,`auto`,sh,nh]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,sh,nh]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,sh,nh]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Zm,sh,nh],radial:[``,sh,nh],conic:[Zm,sh,nh]},Wte,Vte]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...oe(),`hidden`,`none`]}],"divide-style":[{divide:[...oe(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...oe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Xm,sh,nh]}],"outline-w":[{outline:[``,Xm,ch,rh]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,uh,oh]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,uh,oh]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:ae()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Xm,rh]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,uh,oh]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Xm,sh,nh]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Xm]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[sh,nh]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Xm]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,sh,nh]}],filter:[{filter:[``,`none`,sh,nh]}],blur:[{blur:le()}],brightness:[{brightness:[Xm,sh,nh]}],contrast:[{contrast:[Xm,sh,nh]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,uh,oh]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,Xm,sh,nh]}],"hue-rotate":[{"hue-rotate":[Xm,sh,nh]}],invert:[{invert:[``,Xm,sh,nh]}],saturate:[{saturate:[Xm,sh,nh]}],sepia:[{sepia:[``,Xm,sh,nh]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,sh,nh]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[Xm,sh,nh]}],"backdrop-contrast":[{"backdrop-contrast":[Xm,sh,nh]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Xm,sh,nh]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xm,sh,nh]}],"backdrop-invert":[{"backdrop-invert":[``,Xm,sh,nh]}],"backdrop-opacity":[{"backdrop-opacity":[Xm,sh,nh]}],"backdrop-saturate":[{"backdrop-saturate":[Xm,sh,nh]}],"backdrop-sepia":[{"backdrop-sepia":[``,Xm,sh,nh]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,sh,nh]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Xm,`initial`,sh,nh]}],ease:[{ease:[`linear`,`initial`,_,sh,nh]}],delay:[{delay:[Xm,sh,nh]}],animate:[{animate:[`none`,v,sh,nh]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,sh,nh]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:L()}],"rotate-x":[{"rotate-x":L()}],"rotate-y":[{"rotate-y":L()}],"rotate-z":[{"rotate-z":L()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":[`scale-3d`],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[sh,nh,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,sh,nh]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,sh,nh]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[Xm,ch,rh,ih]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function V(...e){return Xte(jm(e))}var Zte=Pm(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`,outline:`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),_h=L.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,B.jsx)(r?km:`button`,{className:V(Zte({variant:t,size:n,className:e})),ref:a,...i}));_h.displayName=`Button`;var vh=L.forwardRef(({className:e,type:t,...n},r)=>(0,B.jsx)(`input`,{type:t,className:V(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium 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:r,...n}));vh.displayName=`Input`;var yh=t(se(),1),Qte=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Om(`Primitive.${t}`),r=L.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),$te=`Separator`,ene=`horizontal`,tne=[`horizontal`,`vertical`],nne=L.forwardRef((e,t)=>{let{decorative:n,orientation:r=ene,...i}=e,a=rne(r)?r:ene,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,B.jsx)(Qte.div,{"data-orientation":a,...o,...i,ref:t})});nne.displayName=$te;function rne(e){return tne.includes(e)}var ine=nne,bh=L.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,B.jsx)(ine,{ref:i,decorative:n,orientation:t,className:V(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));bh.displayName=ine.displayName,typeof window<`u`&&window.document&&window.document.createElement;function H(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function ane(e,t){let n=L.createContext(t),r=e=>{let{children:t,...r}=e,i=L.useMemo(()=>r,Object.values(r));return(0,B.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=L.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function xh(e,t=[]){let n=[];function r(t,r){let i=L.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=L.useMemo(()=>o,Object.values(o));return(0,B.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=L.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>L.createContext(e));return function(n){let r=n?.[e]||t;return L.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,one(i,...t)]}function one(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return L.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Sh=globalThis?.document?L.useLayoutEffect:()=>{},sne=L.useId||(()=>void 0),cne=0;function Ch(e){let[t,n]=L.useState(sne());return Sh(()=>{e||n(e=>e??String(cne++))},[e]),e||(t?`radix-${t}`:``)}var lne=L.useInsertionEffect||Sh;function wh({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=une({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=L.useRef(e!==void 0);L.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,L.useCallback(t=>{if(s){let n=dne(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function une({defaultProp:e,onChange:t}){let[n,r]=L.useState(e),i=L.useRef(n),a=L.useRef(t);return lne(()=>{a.current=t},[t]),L.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function dne(e){return typeof e==`function`}function Th(e){let t=fne(e),n=L.forwardRef((e,n)=>{let{children:r,...i}=e,a=L.Children.toArray(r),o=a.find(hne);if(o){let e=o.props.children,r=a.map(t=>t===o?L.Children.count(e)>1?L.Children.only(null):L.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:L.isValidElement(e)?L.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function fne(e){let t=L.forwardRef((e,t)=>{let{children:n,...r}=e;if(L.isValidElement(n)){let e=_ne(n),i=gne(r,n.props);return n.type!==L.Fragment&&(i.ref=t?wm(t,e):e),L.cloneElement(n,i)}return L.Children.count(n)>1?L.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pne=Symbol(`radix.slottable`);function mne(e){let t=({children:e})=>(0,B.jsx)(B.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=pne,t}function hne(e){return L.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===pne}function gne(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function _ne(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Eh=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Th(`Primitive.${t}`),r=L.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Dh(e,t){e&&yh.flushSync(()=>e.dispatchEvent(t))}function Oh(e){let t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>(...e)=>t.current?.(...e),[])}function vne(e,t=globalThis?.document){let n=Oh(e);L.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var yne=`DismissableLayer`,kh=`dismissableLayer.update`,bne=`dismissableLayer.pointerDownOutside`,xne=`dismissableLayer.focusOutside`,Sne,Cne=L.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ah=L.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=L.useContext(Cne),[u,d]=L.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=L.useState({}),m=Tm(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Ene(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Dne(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return vne(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),L.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Sne=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),One(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Sne)}},[u,f,n,l]),L.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),One())},[u,l]),L.useEffect(()=>{let e=()=>p({});return document.addEventListener(kh,e),()=>document.removeEventListener(kh,e)},[]),(0,B.jsx)(Eh.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:H(e.onFocusCapture,S.onFocusCapture),onBlurCapture:H(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:H(e.onPointerDownCapture,x.onPointerDownCapture)})});Ah.displayName=yne;var wne=`DismissableLayerBranch`,Tne=L.forwardRef((e,t)=>{let n=L.useContext(Cne),r=L.useRef(null),i=Tm(t,r);return L.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,B.jsx)(Eh.div,{...e,ref:i})});Tne.displayName=wne;function Ene(e,t=globalThis?.document){let n=Oh(e),r=L.useRef(!1),i=L.useRef(()=>{});return L.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){kne(bne,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Dne(e,t=globalThis?.document){let n=Oh(e),r=L.useRef(!1);return L.useEffect(()=>{let e=e=>{e.target&&!r.current&&kne(xne,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function One(){let e=new CustomEvent(kh);document.dispatchEvent(e)}function kne(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Dh(i,a):i.dispatchEvent(a)}var Ane=Ah,jne=Tne,jh=`focusScope.autoFocusOnMount`,Mh=`focusScope.autoFocusOnUnmount`,Mne={bubbles:!1,cancelable:!0},Nne=`FocusScope`,Nh=L.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=L.useState(null),l=Oh(i),u=Oh(a),d=L.useRef(null),f=Tm(t,e=>c(e)),p=L.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;L.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Ph(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Ph(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Ph(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),L.useEffect(()=>{if(s){Bne.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(jh,Mne);s.addEventListener(jh,l),s.dispatchEvent(t),t.defaultPrevented||(Pne(Une(Ine(s)),{select:!0}),document.activeElement===e&&Ph(s))}return()=>{s.removeEventListener(jh,l),setTimeout(()=>{let t=new CustomEvent(Mh,Mne);s.addEventListener(Mh,u),s.dispatchEvent(t),t.defaultPrevented||Ph(e??document.body,{select:!0}),s.removeEventListener(Mh,u),Bne.remove(p)},0)}}},[s,l,u,p]);let m=L.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Fne(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Ph(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Ph(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,B.jsx)(Eh.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Nh.displayName=Nne;function Pne(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Ph(r,{select:t}),document.activeElement!==n)return}function Fne(e){let t=Ine(e);return[Lne(t,e),Lne(t.reverse(),e)]}function Ine(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Lne(e,t){for(let n of e)if(!Rne(n,{upTo:t}))return n}function Rne(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function zne(e){return e instanceof HTMLInputElement&&`select`in e}function Ph(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&zne(e)&&t&&e.select()}}var Bne=Vne();function Vne(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Hne(e,t),e.unshift(t)},remove(t){e=Hne(e,t),e[0]?.resume()}}}function Hne(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Une(e){return e.filter(e=>e.tagName!==`A`)}var Wne=`Portal`,Fh=L.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=L.useState(!1);Sh(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?yh.createPortal((0,B.jsx)(Eh.div,{...r,ref:t}),o):null});Fh.displayName=Wne;function Gne(e,t){return L.useReducer((e,n)=>t[e][n]??e,e)}var Ih=e=>{let{present:t,children:n}=e,r=Kne(t),i=typeof n==`function`?n({present:r.isPresent}):L.Children.only(n),a=Tm(r.ref,qne(i));return typeof n==`function`||r.isPresent?L.cloneElement(i,{ref:a}):null};Ih.displayName=`Presence`;function Kne(e){let[t,n]=L.useState(),r=L.useRef(null),i=L.useRef(e),a=L.useRef(`none`),[o,s]=Gne(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return L.useEffect(()=>{let e=Lh(r.current);a.current=o===`mounted`?e:`none`},[o]),Sh(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Lh(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Sh(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Lh(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Lh(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:L.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Lh(e){return e?.animationName||`none`}function qne(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rh=0;function zh(){L.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Jne()),document.body.insertAdjacentElement(`beforeend`,e[1]??Jne()),Rh++,()=>{Rh===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Rh--}},[])}function Jne(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Bh=function(){return Bh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return fre;var t=pre(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hre=Xh(),Qh=`data-scroll-locked`,gre=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` - .${Zne} { - overflow: hidden ${r}; - padding-right: ${s}px ${r}; - } - body[${Qh}] { - overflow: hidden ${r}; - overscroll-behavior: contain; - ${[t&&`position: relative ${r};`,n===`margin`&&` - padding-left: ${i}px; - padding-top: ${a}px; - padding-right: ${o}px; - margin-left:0; - margin-top:0; - margin-right: ${s}px ${r}; - `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} - } - - .${Vh} { - right: ${s}px ${r}; - } - - .${Hh} { - margin-right: ${s}px ${r}; - } - - .${Vh} .${Vh} { - right: 0 ${r}; - } - - .${Hh} .${Hh} { - margin-right: 0 ${r}; - } - - body[${Qh}] { - ${Qne}: ${s}px; - } -`},$h=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},_re=function(){L.useEffect(function(){return document.body.setAttribute(Qh,($h()+1).toString()),function(){var e=$h()-1;e<=0?document.body.removeAttribute(Qh):document.body.setAttribute(Qh,e.toString())}},[])},vre=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;_re();var a=L.useMemo(function(){return mre(i)},[i]);return L.createElement(hre,{styles:gre(a,!t,i,n?``:`!important`)})},eg=!1;if(typeof window<`u`)try{var tg=Object.defineProperty({},`passive`,{get:function(){return eg=!0,!0}});window.addEventListener(`test`,tg,tg),window.removeEventListener(`test`,tg,tg)}catch{eg=!1}var ng=eg?{passive:!1}:!1,yre=function(e){return e.tagName===`TEXTAREA`},rg=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!yre(e)&&n[t]===`visible`)},bre=function(e){return rg(e,`overflowY`)},xre=function(e){return rg(e,`overflowX`)},ig=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),ag(e,r)){var i=og(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Sre=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Cre=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},ag=function(e,t){return e===`v`?bre(t):xre(t)},og=function(e,t){return e===`v`?Sre(t):Cre(t)},wre=function(e,t){return e===`h`&&t===`rtl`?-1:1},Tre=function(e,t,n,r,i){var a=wre(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=og(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&ag(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},sg=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cg=function(e){return[e.deltaX,e.deltaY]},lg=function(e){return e&&`current`in e?e.current:e},Ere=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Dre=function(e){return` - .block-interactivity-${e} {pointer-events: none;} - .allow-interactivity-${e} {pointer-events: all;} -`},Ore=0,ug=[];function kre(e){var t=L.useRef([]),n=L.useRef([0,0]),r=L.useRef(),i=L.useState(Ore++)[0],a=L.useState(Xh)[0],o=L.useRef(e);L.useEffect(function(){o.current=e},[e]),L.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Xne([e.lockRef.current],(e.shards||[]).map(lg),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=L.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=sg(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ig(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ig(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Tre(h,t,e,h===`h`?s:c,!0)},[]),c=L.useCallback(function(e){var n=e;if(!(!ug.length||ug[ug.length-1]!==a)){var r=`deltaY`in n?cg(n):sg(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Ere(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(lg).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=L.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Are(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=L.useCallback(function(e){n.current=sg(e),r.current=void 0},[]),d=L.useCallback(function(t){l(t.type,cg(t),t.target,s(t,e.lockRef.current))},[]),f=L.useCallback(function(t){l(t.type,sg(t),t.target,s(t,e.lockRef.current))},[]);L.useEffect(function(){return ug.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ng),document.addEventListener(`touchmove`,c,ng),document.addEventListener(`touchstart`,u,ng),function(){ug=ug.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ng),document.removeEventListener(`touchmove`,c,ng),document.removeEventListener(`touchstart`,u,ng)}},[]);var p=e.removeScrollBar,m=e.inert;return L.createElement(L.Fragment,null,m?L.createElement(a,{styles:Dre(i)}):null,p?L.createElement(vre,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Are(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var jre=are(Kh,kre),dg=L.forwardRef(function(e,t){return L.createElement(Jh,Bh({},e,{ref:t,sideCar:jre}))});dg.classNames=Jh.classNames;var Mre=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},fg=new WeakMap,pg=new WeakMap,mg={},hg=0,gg=function(e){return e&&(e.host||gg(e.parentNode))},Nre=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=gg(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Pre=function(e,t,n,r){var i=Nre(t,Array.isArray(e)?e:[e]);mg[n]||(mg[n]=new WeakMap);var a=mg[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(fg.get(e)||0)+1,l=(a.get(e)||0)+1;fg.set(e,c),a.set(e,l),o.push(e),c===1&&i&&pg.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),hg++,function(){o.forEach(function(e){var t=fg.get(e)-1,i=a.get(e)-1;fg.set(e,t),a.set(e,i),t||(pg.has(e)||e.removeAttribute(r),pg.delete(e)),i||e.removeAttribute(n)}),hg--,hg||(fg=new WeakMap,fg=new WeakMap,pg=new WeakMap,mg={})}},_g=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Mre(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Pre(r,i,n,`aria-hidden`)):function(){return null}},vg=`Dialog`,[yg,Fre]=xh(vg),[Ire,bg]=yg(vg),xg=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=L.useRef(null),c=L.useRef(null),[l,u]=wh({prop:r,defaultProp:i??!1,onChange:a,caller:vg});return(0,B.jsx)(Ire,{scope:t,triggerRef:s,contentRef:c,contentId:Ch(),titleId:Ch(),descriptionId:Ch(),open:l,onOpenChange:u,onOpenToggle:L.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};xg.displayName=vg;var Sg=`DialogTrigger`,Lre=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(Sg,n),a=Tm(t,i.triggerRef);return(0,B.jsx)(Eh.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Lg(i.open),...r,ref:a,onClick:H(e.onClick,i.onOpenToggle)})});Lre.displayName=Sg;var Cg=`DialogPortal`,[Rre,wg]=yg(Cg,{forceMount:void 0}),Tg=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=bg(Cg,t);return(0,B.jsx)(Rre,{scope:t,forceMount:n,children:L.Children.map(r,e=>(0,B.jsx)(Ih,{present:n||a.open,children:(0,B.jsx)(Fh,{asChild:!0,container:i,children:e})}))})};Tg.displayName=Cg;var Eg=`DialogOverlay`,Dg=L.forwardRef((e,t)=>{let n=wg(Eg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=bg(Eg,e.__scopeDialog);return a.modal?(0,B.jsx)(Ih,{present:r||a.open,children:(0,B.jsx)(Bre,{...i,ref:t})}):null});Dg.displayName=Eg;var zre=Th(`DialogOverlay.RemoveScroll`),Bre=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(Eg,n);return(0,B.jsx)(dg,{as:zre,allowPinchZoom:!0,shards:[i.contentRef],children:(0,B.jsx)(Eh.div,{"data-state":Lg(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Og=`DialogContent`,kg=L.forwardRef((e,t)=>{let n=wg(Og,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=bg(Og,e.__scopeDialog);return(0,B.jsx)(Ih,{present:r||a.open,children:a.modal?(0,B.jsx)(Vre,{...i,ref:t}):(0,B.jsx)(Hre,{...i,ref:t})})});kg.displayName=Og;var Vre=L.forwardRef((e,t)=>{let n=bg(Og,e.__scopeDialog),r=L.useRef(null),i=Tm(t,n.contentRef,r);return L.useEffect(()=>{let e=r.current;if(e)return _g(e)},[]),(0,B.jsx)(Ag,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault())})}),Hre=L.forwardRef((e,t)=>{let n=bg(Og,e.__scopeDialog),r=L.useRef(!1),i=L.useRef(!1);return(0,B.jsx)(Ag,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Ag=L.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=bg(Og,n),c=L.useRef(null),l=Tm(t,c);return zh(),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Nh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(Ah,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Lg(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Wre,{titleId:s.titleId}),(0,B.jsx)(Kre,{contentRef:c,descriptionId:s.descriptionId})]})]})}),jg=`DialogTitle`,Mg=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(jg,n);return(0,B.jsx)(Eh.h2,{id:i.titleId,...r,ref:t})});Mg.displayName=jg;var Ng=`DialogDescription`,Pg=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(Ng,n);return(0,B.jsx)(Eh.p,{id:i.descriptionId,...r,ref:t})});Pg.displayName=Ng;var Fg=`DialogClose`,Ig=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=bg(Fg,n);return(0,B.jsx)(Eh.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});Ig.displayName=Fg;function Lg(e){return e?`open`:`closed`}var Rg=`DialogTitleWarning`,[Ure,zg]=ane(Rg,{contentName:Og,titleName:jg,docsSlug:`dialog`}),Wre=({titleId:e})=>{let t=zg(Rg),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return L.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Gre=`DialogDescriptionWarning`,Kre=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zg(Gre).contentName}}.`;return L.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Bg=xg,Vg=Tg,Hg=Dg,Ug=kg,Wg=Mg,Gg=Pg,Kg=Ig,qre=Bg,Jre=Vg,qg=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Hg,{className:V(`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,ref:n}));qg.displayName=Hg.displayName;var Yre=Pm(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Jg=L.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,B.jsxs)(Jre,{children:[(0,B.jsx)(qg,{}),(0,B.jsxs)(Ug,{ref:i,className:V(Yre({side:e}),t),...r,children:[n,(0,B.jsxs)(Kg,{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-secondary`,children:[(0,B.jsx)(xm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Jg.displayName=Ug.displayName;var Xre=({className:e,...t})=>(0,B.jsx)(`div`,{className:V(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Xre.displayName=`SheetHeader`;var Zre=({className:e,...t})=>(0,B.jsx)(`div`,{className:V(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Zre.displayName=`SheetFooter`;var Qre=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Wg,{ref:n,className:V(`text-lg font-semibold text-foreground`,e),...t}));Qre.displayName=Wg.displayName;var $re=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Gg,{ref:n,className:V(`text-sm text-muted-foreground`,e),...t}));$re.displayName=Gg.displayName;function Yg({className:e,...t}){return(0,B.jsx)(`div`,{className:V(`bg-muted animate-pulse rounded-md`,e),...t})}var eie=[`top`,`right`,`bottom`,`left`],Xg=Math.min,Zg=Math.max,Qg=Math.round,$g=Math.floor,e_=e=>({x:e,y:e}),tie={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function t_(e,t,n){return Zg(e,Xg(t,n))}function n_(e,t){return typeof e==`function`?e(t):e}function r_(e){return e.split(`-`)[0]}function i_(e){return e.split(`-`)[1]}function a_(e){return e===`x`?`y`:`x`}function o_(e){return e===`y`?`height`:`width`}function s_(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function c_(e){return a_(s_(e))}function nie(e,t,n){n===void 0&&(n=!1);let r=i_(e),i=c_(e),a=o_(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=f_(o)),[o,f_(o)]}function rie(e){let t=f_(e);return[l_(e),t,l_(t)]}function l_(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var u_=[`left`,`right`],d_=[`right`,`left`],iie=[`top`,`bottom`],aie=[`bottom`,`top`];function oie(e,t,n){switch(e){case`top`:case`bottom`:return n?t?d_:u_:t?u_:d_;case`left`:case`right`:return t?iie:aie;default:return[]}}function sie(e,t,n,r){let i=i_(e),a=oie(r_(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(l_)))),a}function f_(e){let t=r_(e);return tie[t]+e.slice(t.length)}function cie(e){return{top:0,right:0,bottom:0,left:0,...e}}function p_(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:cie(e)}function m_(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function h_(e,t,n){let{reference:r,floating:i}=e,a=s_(t),o=c_(t),s=o_(o),c=r_(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(i_(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function lie(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=n_(t,e),p=p_(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=m_(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=m_(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var uie=50,die=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:lie},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=h_(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=n_(e,t)||{};if(l==null)return{};let d=p_(u),f={x:n,y:r},p=c_(i),m=o_(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Xg(d[_],T),D=Xg(d[v],T),O=E,ee=C-h[m]-D,te=C/2-h[m]/2+w,k=t_(O,te,ee),A=!c.arrow&&i_(i)!=null&&te!==k&&a.reference[m]/2-(tee<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==s_(t))||T.every(e=>s_(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=s_(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function g_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function __(e){return eie.some(t=>e[t]>=0)}var mie=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=n_(e,t);switch(i){case`referenceHidden`:{let e=g_(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:__(e)}}}case`escaped`:{let e=g_(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:__(e)}}}default:return{}}}}},v_=new Set([`left`,`top`]);async function hie(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=r_(n),s=i_(n),c=s_(n)===`y`,l=v_.has(o)?-1:1,u=a&&c?-1:1,d=n_(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var gie=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await hie(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},_ie=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=n_(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=s_(r_(i)),p=a_(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=t_(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=t_(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},vie=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=n_(e,t),u={x:n,y:r},d=s_(i),f=a_(d),p=u[f],m=u[d],h=n_(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=v_.has(r_(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},yie=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=n_(e,t),u=await o.detectOverflow(t,l),d=r_(i),f=i_(i),p=s_(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Xg(h-u[g],v),x=Xg(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Zg(u.left,0),t=Zg(u.right,0),n=Zg(u.top,0),r=Zg(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Zg(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Zg(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function y_(){return typeof window<`u`}function b_(e){return C_(e)?(e.nodeName||``).toLowerCase():`#document`}function x_(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function S_(e){return((C_(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function C_(e){return y_()?e instanceof Node||e instanceof x_(e).Node:!1}function w_(e){return y_()?e instanceof Element||e instanceof x_(e).Element:!1}function T_(e){return y_()?e instanceof HTMLElement||e instanceof x_(e).HTMLElement:!1}function E_(e){return!y_()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof x_(e).ShadowRoot}function D_(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=P_(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function bie(e){return/^(table|td|th)$/.test(b_(e))}function O_(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var xie=/transform|translate|scale|rotate|perspective|filter/,Sie=/paint|layout|strict|content/,k_=e=>!!e&&e!==`none`,A_;function j_(e){let t=w_(e)?P_(e):e;return k_(t.transform)||k_(t.translate)||k_(t.scale)||k_(t.rotate)||k_(t.perspective)||!M_()&&(k_(t.backdropFilter)||k_(t.filter))||xie.test(t.willChange||``)||Sie.test(t.contain||``)}function Cie(e){let t=I_(e);for(;T_(t)&&!N_(t);){if(j_(t))return t;if(O_(t))return null;t=I_(t)}return null}function M_(){return A_??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),A_}function N_(e){return/^(html|body|#document)$/.test(b_(e))}function P_(e){return x_(e).getComputedStyle(e)}function F_(e){return w_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function I_(e){if(b_(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||E_(e)&&e.host||S_(e);return E_(t)?t.host:t}function L_(e){let t=I_(e);return N_(t)?e.ownerDocument?e.ownerDocument.body:e.body:T_(t)&&D_(t)?t:L_(t)}function R_(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=L_(e),i=r===e.ownerDocument?.body,a=x_(r);if(i){let e=z_(a);return t.concat(a,a.visualViewport||[],D_(r)?r:[],e&&n?R_(e):[])}else return t.concat(r,R_(r,[],n))}function z_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function B_(e){let t=P_(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=T_(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Qg(n)!==a||Qg(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function V_(e){return w_(e)?e:e.contextElement}function H_(e){let t=V_(e);if(!T_(t))return e_(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=B_(t),o=(a?Qg(n.width):n.width)/r,s=(a?Qg(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var wie=e_(0);function U_(e){let t=x_(e);return!M_()||!t.visualViewport?wie:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Tie(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==x_(e)?!1:t}function W_(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=V_(e),o=e_(1);t&&(r?w_(r)&&(o=H_(r)):o=H_(e));let s=Tie(a,n,r)?U_(a):e_(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=x_(a),t=r&&w_(r)?x_(r):r,n=e,i=z_(n);for(;i&&r&&t!==n;){let e=H_(i),t=i.getBoundingClientRect(),r=P_(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=x_(i),i=z_(n)}}return m_({width:u,height:d,x:c,y:l})}function G_(e,t){let n=F_(e).scrollLeft;return t?t.left+n:W_(S_(e)).left+n}function K_(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-G_(e,n),y:n.top+t.scrollTop}}function Eie(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=S_(r),s=t?O_(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=e_(1),u=e_(0),d=T_(r);if((d||!d&&!a)&&((b_(r)!==`body`||D_(o))&&(c=F_(r)),d)){let e=W_(r);l=H_(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?K_(o,c):e_(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Die(e){return Array.from(e.getClientRects())}function Oie(e){let t=S_(e),n=F_(e),r=e.ownerDocument.body,i=Zg(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Zg(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+G_(e),s=-n.scrollTop;return P_(r).direction===`rtl`&&(o+=Zg(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var q_=25;function kie(e,t){let n=x_(e),r=S_(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=M_();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=G_(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=q_&&(a-=o)}else l<=q_&&(a+=l);return{width:a,height:o,x:s,y:c}}function Aie(e,t){let n=W_(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=T_(e)?H_(e):e_(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function J_(e,t,n){let r;if(t===`viewport`)r=kie(e,n);else if(t===`document`)r=Oie(S_(e));else if(w_(t))r=Aie(t,n);else{let n=U_(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return m_(r)}function Y_(e,t){let n=I_(e);return n===t||!w_(n)||N_(n)?!1:P_(n).position===`fixed`||Y_(n,t)}function jie(e,t){let n=t.get(e);if(n)return n;let r=R_(e,[],!1).filter(e=>w_(e)&&b_(e)!==`body`),i=null,a=P_(e).position===`fixed`,o=a?I_(e):e;for(;w_(o)&&!N_(o);){let t=P_(o),n=j_(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||D_(o)&&!n&&Y_(e,o))?r=r.filter(e=>e!==o):i=t,o=I_(o)}return t.set(e,r),r}function Mie(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?O_(t)?[]:jie(t,this._c):[].concat(n),r],o=J_(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!$_(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function zie(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=V_(e),u=i||a?[...l?R_(l):[],...t?R_(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Rie(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?W_(e):null;c&&g();function g(){let t=W_(e);h&&!$_(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Bie=gie,Vie=_ie,Hie=pie,Uie=yie,Wie=mie,ev=fie,Gie=vie,Kie=(e,t,n)=>{let r=new Map,i={platform:Lie,...n},a={...i.platform,_c:r};return die(e,t,{...i,platform:a})},tv=typeof document<`u`?L.useLayoutEffect:function(){};function nv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!nv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!nv(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function rv(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iv(e,t){let n=rv(e);return Math.round(t*n)/n}function av(e){let t=L.useRef(e);return tv(()=>{t.current=e}),t}function qie(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=L.useState(r);nv(f,r)||p(r);let[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=L.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=L.useRef(null),C=L.useRef(null),w=L.useRef(u),T=c!=null,E=av(c),D=av(i),O=av(l),ee=L.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Kie(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};te.current&&!nv(w.current,t)&&(w.current=t,yh.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);tv(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=L.useRef(!1);tv(()=>(te.current=!0,()=>{te.current=!1}),[]),tv(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let k=L.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),A=L.useMemo(()=>({reference:b,floating:x}),[b,x]),j=L.useMemo(()=>{let e={position:n,left:0,top:0};if(!A.floating)return e;let t=iv(A.floating,u.x),r=iv(A.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...rv(A.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,A.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:ee,refs:k,elements:A,floatingStyles:j}),[u,ee,k,A,j])}var Jie=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ev({element:r.current,padding:i}).fn(n):r?ev({element:r,padding:i}).fn(n):{}}}},Yie=(e,t)=>{let n=Bie(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xie=(e,t)=>{let n=Vie(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zie=(e,t)=>({fn:Gie(e).fn,options:[e,t]}),Qie=(e,t)=>{let n=Hie(e);return{name:n.name,fn:n.fn,options:[e,t]}},$ie=(e,t)=>{let n=Uie(e);return{name:n.name,fn:n.fn,options:[e,t]}},eae=(e,t)=>{let n=Wie(e);return{name:n.name,fn:n.fn,options:[e,t]}},tae=(e,t)=>{let n=Jie(e);return{name:n.name,fn:n.fn,options:[e,t]}},nae=`Arrow`,ov=L.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,B.jsx)(Eh.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,B.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});ov.displayName=nae;var rae=ov;function sv(e){let[t,n]=L.useState(void 0);return Sh(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var cv=`Popper`,[lv,uv]=xh(cv),[iae,dv]=lv(cv),fv=e=>{let{__scopePopper:t,children:n}=e,[r,i]=L.useState(null);return(0,B.jsx)(iae,{scope:t,anchor:r,onAnchorChange:i,children:n})};fv.displayName=cv;var pv=`PopperAnchor`,mv=L.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=dv(pv,n),o=L.useRef(null),s=Tm(t,o),c=L.useRef(null);return L.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,B.jsx)(Eh.div,{...i,ref:s})});mv.displayName=pv;var hv=`PopperContent`,[aae,oae]=lv(hv),gv=L.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=dv(hv,n),[_,v]=L.useState(null),y=Tm(t,e=>v(e)),[b,x]=L.useState(null),S=sv(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(cae),altBoundary:O},{refs:te,floatingStyles:k,placement:A,isPositioned:j,middlewareData:M}=qie({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>zie(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Yie({mainAxis:i+w,alignmentAxis:o}),c&&Xie({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Zie():void 0,...ee}),c&&Qie({...ee}),$ie({...ee,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&tae({element:b,padding:s}),lae({arrowWidth:C,arrowHeight:w}),f&&eae({strategy:`referenceHidden`,...ee})]}),[N,P]=yv(A),F=Oh(m);Sh(()=>{j&&F?.()},[j,F]);let I=M.arrow?.x,ne=M.arrow?.y,re=M.arrow?.centerOffset!==0,[ie,ae]=L.useState();return Sh(()=>{_&&ae(window.getComputedStyle(_).zIndex)},[_]),(0,B.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...k,transform:j?k.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ie,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,B.jsx)(aae,{scope:n,placedSide:N,onArrowChange:x,arrowX:I,arrowY:ne,shouldHideArrow:re,children:(0,B.jsx)(Eh.div,{"data-side":N,"data-align":P,...h,ref:y,style:{...h.style,animation:j?void 0:`none`}})})})});gv.displayName=hv;var _v=`PopperArrow`,sae={top:`bottom`,right:`left`,bottom:`top`,left:`right`},vv=L.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=oae(_v,n),a=sae[i.placedSide];return(0,B.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,B.jsx)(rae,{...r,ref:t,style:{...r.style,display:`block`}})})});vv.displayName=_v;function cae(e){return e!==null}var lae=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=yv(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function yv(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var bv=fv,xv=mv,Sv=gv,Cv=vv,wv=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),uae=`VisuallyHidden`,Tv=L.forwardRef((e,t)=>(0,B.jsx)(Eh.span,{...e,ref:t,style:{...wv,...e.style}}));Tv.displayName=uae;var dae=Tv,[Ev,fae]=xh(`Tooltip`,[uv]),Dv=uv(),Ov=`TooltipProvider`,pae=700,kv=`tooltip.open`,[mae,Av]=Ev(Ov),jv=e=>{let{__scopeTooltip:t,delayDuration:n=pae,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=L.useRef(!0),s=L.useRef(!1),c=L.useRef(0);return L.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(mae,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:L.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:L.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:L.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};jv.displayName=Ov;var Mv=`Tooltip`,[hae,Nv]=Ev(Mv),Pv=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Av(Mv,e.__scopeTooltip),l=Dv(t),[u,d]=L.useState(null),f=Ch(),p=L.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=L.useRef(!1),[_,v]=wh({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(kv))):c.onClose(),a?.(e)},caller:Mv}),y=L.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=L.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=L.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=L.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return L.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(bv,{...l,children:(0,B.jsx)(hae,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:L.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:L.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};Pv.displayName=Mv;var Fv=`TooltipTrigger`,Iv=L.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Nv(Fv,n),a=Av(Fv,n),o=Dv(n),s=Tm(t,L.useRef(null),i.onTriggerChange),c=L.useRef(!1),l=L.useRef(!1),u=L.useCallback(()=>c.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(xv,{asChild:!0,...o,children:(0,B.jsx)(Eh.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:H(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:H(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:H(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:H(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:H(e.onBlur,i.onClose),onClick:H(e.onClick,i.onClose)})})});Iv.displayName=Fv;var Lv=`TooltipPortal`,[gae,_ae]=Ev(Lv,{forceMount:void 0}),vae=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Nv(Lv,t);return(0,B.jsx)(gae,{scope:t,forceMount:n,children:(0,B.jsx)(Ih,{present:n||a.open,children:(0,B.jsx)(Fh,{asChild:!0,container:i,children:r})})})};vae.displayName=Lv;var Rv=`TooltipContent`,zv=L.forwardRef((e,t)=>{let n=_ae(Rv,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Nv(Rv,e.__scopeTooltip);return(0,B.jsx)(Ih,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(Bv,{side:i,...a,ref:t}):(0,B.jsx)(yae,{side:i,...a,ref:t})})}),yae=L.forwardRef((e,t)=>{let n=Nv(Rv,e.__scopeTooltip),r=Av(Rv,e.__scopeTooltip),i=L.useRef(null),a=Tm(t,i),[o,s]=L.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=L.useCallback(()=>{s(null),d(!1)},[d]),p=L.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Tae(r,wae(r,n.getBoundingClientRect())),a=Eae(t.getBoundingClientRect());s(Oae([...i,...a])),d(!0)},[d]);return L.useEffect(()=>()=>f(),[f]),L.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),L.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Dae(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(Bv,{...e,ref:a})}),[bae,xae]=Ev(Mv,{isInside:!1}),Sae=mne(`TooltipContent`),Bv=L.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Nv(Rv,n),l=Dv(n),{onClose:u}=c;return L.useEffect(()=>(document.addEventListener(kv,u),()=>document.removeEventListener(kv,u)),[u]),L.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(Ah,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Sv,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(Sae,{children:r}),(0,B.jsx)(bae,{scope:n,isInside:!0,children:(0,B.jsx)(dae,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});zv.displayName=Rv;var Vv=`TooltipArrow`,Cae=L.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Dv(n);return xae(Vv,n).isInside?null:(0,B.jsx)(Cv,{...i,...r,ref:t})});Cae.displayName=Vv;function wae(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Tae(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Eae(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Dae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Oae(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y)),kae(t)}function kae(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Aae=jv,jae=Pv,Mae=Iv,Hv=zv,Uv=Aae,Wv=jae,Gv=Mae,Kv=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,B.jsx)(Hv,{ref:r,sideOffset:t,className:V(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));Kv.displayName=Hv.displayName;var Nae=`sidebar_state`,Pae=3600*24*7,Fae=`16rem`,Iae=`18rem`,Lae=`3rem`,Rae=`b`,qv=L.createContext(null);function Jv(){let e=L.useContext(qv);if(!e)throw Error(`useSidebar must be used within a SidebarProvider`);return e}var Yv=L.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=ate(),[l,u]=L.useState(!1),[d,f]=L.useState(e),p=t??d,m=L.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${Nae}=${t}; path=/; max-age=${Pae}`},[n,p]),h=L.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);L.useEffect(()=>{let e=e=>{e.key===Rae&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=L.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,B.jsx)(qv.Provider,{value:_,children:(0,B.jsx)(Uv,{delayDuration:0,children:(0,B.jsx)(`div`,{style:{"--sidebar-width":Fae,"--sidebar-width-icon":Lae,...i},className:V(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-svh w-full overflow-hidden`,r),ref:s,...o,children:a})})})});Yv.displayName=`SidebarProvider`;var Xv=L.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},o)=>{let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=Jv();return n===`none`?(0,B.jsx)(`div`,{className:V(`bg-sidebar text-sidebar-foreground flex h-full w-[--sidebar-width] flex-col`,r),ref:o,...a,children:i}):s?(0,B.jsx)(qre,{open:l,onOpenChange:u,...a,children:(0,B.jsx)(Jg,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-[--sidebar-width] p-0 [&>button]:hidden`,style:{"--sidebar-width":Iae},side:e,children:(0,B.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})})}):(0,B.jsx)(`div`,{ref:o,className:V(`bg-sidebar text-sidebar-foreground hidden md:flex h-svh w-[--sidebar-width] shrink-0 flex-col border-r transition-[width] duration-200 ease-linear overflow-hidden`,c===`collapsed`&&n===`offcanvas`&&`w-0 border-0`,c===`collapsed`&&n===`icon`&&`w-[--sidebar-width-icon]`,r),"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,...a,children:i})});Xv.displayName=`Sidebar`;var Zv=L.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=Jv();return(0,B.jsxs)(_h,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:V(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,B.jsx)(Bee,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});Zv.displayName=`SidebarTrigger`;var zae=L.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=Jv();return(0,B.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:V(`hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});zae.displayName=`SidebarRail`;var Bae=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`main`,{ref:n,className:V(`relative flex min-h-svh flex-1 flex-col bg-background`,`peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));Bae.displayName=`SidebarInset`;var Qv=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(vh,{ref:n,"data-sidebar":`input`,className:V(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));Qv.displayName=`SidebarInput`;var $v=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:V(`flex flex-col gap-2 p-2`,e),...t}));$v.displayName=`SidebarHeader`;var Vae=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:V(`flex flex-col gap-2 p-2`,e),...t}));Vae.displayName=`SidebarFooter`;var ey=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(bh,{ref:n,"data-sidebar":`separator`,className:V(`mx-2 w-auto bg-sidebar-border`,e),...t}));ey.displayName=`SidebarSeparator`;var ty=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:V(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,e),...t}));ty.displayName=`SidebarContent`;var ny=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:V(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));ny.displayName=`SidebarGroup`;var ry=L.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,B.jsx)(t?km:`div`,{ref:r,"data-sidebar":`group-label`,className:V(`text-xs/6 font-medium text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 outline-none transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e),...n}));ry.displayName=`SidebarGroupLabel`;var Hae=L.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,B.jsx)(t?km:`button`,{ref:r,"data-sidebar":`group-action`,className:V(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));Hae.displayName=`SidebarGroupAction`;var iy=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:V(`w-full text-sm`,e),...t}));iy.displayName=`SidebarGroupContent`;var ay=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:V(`flex w-full min-w-0 flex-col gap-1`,e),...t}));ay.displayName=`SidebarMenu`;var oy=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:V(`group/menu-item relative`,e),...t}));oy.displayName=`SidebarMenuItem`;var sy=L.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?km:`button`,{isMobile:l,state:u}=Jv(),d=(0,B.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:V(Uae({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:d}),(0,B.jsx)(Kv,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});sy.displayName=`SidebarMenuButton`;var Uae=Pm(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),Wae=L.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,B.jsx)(t?km:`button`,{ref:i,"data-sidebar":`menu-action`,className:V(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));Wae.displayName=`SidebarMenuAction`;var Gae=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:V(`text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));Gae.displayName=`SidebarMenuBadge`;var cy=L.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=L.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,B.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:V(`rounded-md h-8 flex gap-2 px-2 items-center`,e),...n,children:[t&&(0,B.jsx)(Yg,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,B.jsx)(Yg,{className:`h-4 flex-1 max-w-[--skeleton-width]`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});cy.displayName=`SidebarMenuSkeleton`;var ly=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:V(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));ly.displayName=`SidebarMenuSub`;var uy=L.forwardRef(({...e},t)=>(0,B.jsx)(`li`,{ref:t,...e}));uy.displayName=`SidebarMenuSubItem`;var dy=L.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,B.jsx)(e?km:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:V(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,r),...i}));dy.displayName=`SidebarMenuSubButton`;var fy=`Collapsible`,[Kae,qae]=xh(fy),[Jae,py]=Kae(fy),my=L.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=wh({prop:r,defaultProp:i??!1,onChange:o,caller:fy});return(0,B.jsx)(Jae,{scope:n,disabled:a,contentId:Ch(),open:c,onOpenToggle:L.useCallback(()=>l(e=>!e),[l]),children:(0,B.jsx)(Eh.div,{"data-state":yy(c),"data-disabled":a?``:void 0,...s,ref:t})})});my.displayName=fy;var hy=`CollapsibleTrigger`,gy=L.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=py(hy,n);return(0,B.jsx)(Eh.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":yy(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:H(e.onClick,i.onOpenToggle)})});gy.displayName=hy;var _y=`CollapsibleContent`,vy=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=py(_y,e.__scopeCollapsible);return(0,B.jsx)(Ih,{present:n||i.open,children:({present:e})=>(0,B.jsx)(Yae,{...r,ref:t,present:e})})});vy.displayName=_y;var Yae=L.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=py(_y,n),[s,c]=L.useState(r),l=L.useRef(null),u=Tm(t,l),d=L.useRef(0),f=d.current,p=L.useRef(0),m=p.current,h=o.open||s,g=L.useRef(h),_=L.useRef(void 0);return L.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),Sh(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,B.jsx)(Eh.div,{"data-state":yy(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function yy(e){return e?`open`:`closed`}var by=my,xy=gy,Sy=vy;function Cy(e){let t=e+`CollectionProvider`,[n,r]=xh(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=L.useRef(null),a=L.useRef(new Map).current;return(0,B.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Th(s),l=L.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,B.jsx)(c,{ref:Tm(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Th(u),p=L.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=L.useRef(null),s=Tm(t,o),c=a(u,n);return L.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,B.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return L.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var Xae=L.createContext(void 0);function wy(e){let t=L.useContext(Xae);return e||t||`ltr`}var Ty=`rovingFocusGroup.onEntryFocus`,Zae={bubbles:!1,cancelable:!0},Ey=`RovingFocusGroup`,[Dy,Oy,Qae]=Cy(Ey),[$ae,ky]=xh(Ey,[Qae]),[eoe,toe]=$ae(Ey),Ay=L.forwardRef((e,t)=>(0,B.jsx)(Dy.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Dy.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(noe,{...e,ref:t})})}));Ay.displayName=Ey;var noe=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=L.useRef(null),p=Tm(t,f),m=wy(a),[h,g]=wh({prop:o,defaultProp:s??null,onChange:c,caller:Ey}),[_,v]=L.useState(!1),y=Oh(l),b=Oy(n),x=L.useRef(!1),[S,C]=L.useState(0);return L.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Ty,y),()=>e.removeEventListener(Ty,y)},[y]),(0,B.jsx)(eoe,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:L.useCallback(e=>g(e),[g]),onItemShiftTab:L.useCallback(()=>v(!0),[]),onFocusableItemAdd:L.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:L.useCallback(()=>C(e=>e-1),[]),children:(0,B.jsx)(Eh.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:H(e.onMouseDown,()=>{x.current=!0}),onFocus:H(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Ty,Zae);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Ny([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:H(e.onBlur,()=>v(!1))})})}),jy=`RovingFocusGroupItem`,My=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ch(),l=a||c,u=toe(jy,n),d=u.currentTabStopId===l,f=Oy(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return L.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(Dy.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(Eh.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:H(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:H(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:H(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=aoe(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ooe(n,r+1):n.slice(r+1)}setTimeout(()=>Ny(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});My.displayName=jy;var roe={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function ioe(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function aoe(e,t,n){let r=ioe(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return roe[r]}function Ny(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ooe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Py=Ay,Fy=My,Iy=[`Enter`,` `],soe=[`ArrowDown`,`PageUp`,`Home`],Ly=[`ArrowUp`,`PageDown`,`End`],coe=[...soe,...Ly],loe={ltr:[...Iy,`ArrowRight`],rtl:[...Iy,`ArrowLeft`]},uoe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Ry=`Menu`,[zy,doe,foe]=Cy(Ry),[By,Vy]=xh(Ry,[foe,uv,ky]),Hy=uv(),Uy=ky(),[Wy,Gy]=By(Ry),[poe,Ky]=By(Ry),qy=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Hy(t),[c,l]=L.useState(null),u=L.useRef(!1),d=Oh(a),f=wy(i);return L.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,B.jsx)(bv,{...s,children:(0,B.jsx)(Wy,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,B.jsx)(poe,{scope:t,onClose:L.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};qy.displayName=Ry;var moe=`MenuAnchor`,Jy=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Hy(n);return(0,B.jsx)(xv,{...i,...r,ref:t})});Jy.displayName=moe;var Yy=`MenuPortal`,[hoe,Xy]=By(Yy,{forceMount:void 0}),Zy=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Gy(Yy,t);return(0,B.jsx)(hoe,{scope:t,forceMount:n,children:(0,B.jsx)(Ih,{present:n||a.open,children:(0,B.jsx)(Fh,{asChild:!0,container:i,children:r})})})};Zy.displayName=Yy;var Qy=`MenuContent`,[goe,$y]=By(Qy),eb=L.forwardRef((e,t)=>{let n=Xy(Qy,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Gy(Qy,e.__scopeMenu),o=Ky(Qy,e.__scopeMenu);return(0,B.jsx)(zy.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(Ih,{present:r||a.open,children:(0,B.jsx)(zy.Slot,{scope:e.__scopeMenu,children:o.modal?(0,B.jsx)(_oe,{...i,ref:t}):(0,B.jsx)(voe,{...i,ref:t})})})})}),_oe=L.forwardRef((e,t)=>{let n=Gy(Qy,e.__scopeMenu),r=L.useRef(null),i=Tm(t,r);return L.useEffect(()=>{let e=r.current;if(e)return _g(e)},[]),(0,B.jsx)(tb,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),voe=L.forwardRef((e,t)=>{let n=Gy(Qy,e.__scopeMenu);return(0,B.jsx)(tb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),yoe=Th(`MenuContent.ScrollLock`),tb=L.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Gy(Qy,n),_=Ky(Qy,n),v=Hy(n),y=Uy(n),b=doe(n),[x,S]=L.useState(null),C=L.useRef(null),w=Tm(t,C,g.onContentChange),T=L.useRef(0),E=L.useRef(``),D=L.useRef(0),O=L.useRef(null),ee=L.useRef(`right`),te=L.useRef(0),k=m?dg:L.Fragment,A=m?{as:yoe,allowPinchZoom:!0}:void 0,j=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Moe(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};L.useEffect(()=>()=>window.clearTimeout(T.current),[]),zh();let M=L.useCallback(e=>ee.current===O.current?.side&&Poe(e,O.current?.area),[]);return(0,B.jsx)(goe,{scope:n,searchRef:E,onItemEnter:L.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:L.useCallback(e=>{M(e)||(C.current?.focus(),S(null))},[M]),onTriggerLeave:L.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:D,onPointerGraceIntentChange:L.useCallback(e=>{O.current=e},[]),children:(0,B.jsx)(k,{...A,children:(0,B.jsx)(Nh,{asChild:!0,trapped:i,onMountAutoFocus:H(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,B.jsx)(Ah,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,B.jsx)(Py,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:H(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,B.jsx)(Sv,{role:`menu`,"aria-orientation":`vertical`,"data-state":wb(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:H(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&j(e.key));let i=C.current;if(e.target!==i||!coe.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Ly.includes(e.key)&&a.reverse(),Aoe(a)}),onBlur:H(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:H(e.onPointerMove,Db(e=>{let t=e.target,n=te.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ee.current=e.clientX>te.current?`right`:`left`,te.current=e.clientX)}))})})})})})})});eb.displayName=Qy;var boe=`MenuGroup`,nb=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(Eh.div,{role:`group`,...r,ref:t})});nb.displayName=boe;var xoe=`MenuLabel`,rb=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(Eh.div,{...r,ref:t})});rb.displayName=xoe;var ib=`MenuItem`,ab=`menu.itemSelect`,ob=L.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=L.useRef(null),o=Ky(ib,e.__scopeMenu),s=$y(ib,e.__scopeMenu),c=Tm(t,a),l=L.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(ab,{bubbles:!0,cancelable:!0});e.addEventListener(ab,e=>r?.(e),{once:!0}),Dh(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,B.jsx)(sb,{...i,ref:c,disabled:n,onClick:H(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:H(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:H(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Iy.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});ob.displayName=ib;var sb=L.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=$y(ib,n),s=Uy(n),c=L.useRef(null),l=Tm(t,c),[u,d]=L.useState(!1),[f,p]=L.useState(``);return L.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,B.jsx)(zy.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,B.jsx)(Fy,{asChild:!0,...s,focusable:!r,children:(0,B.jsx)(Eh.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:H(e.onPointerMove,Db(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:H(e.onPointerLeave,Db(e=>o.onItemLeave(e))),onFocus:H(e.onFocus,()=>d(!0)),onBlur:H(e.onBlur,()=>d(!1))})})})}),Soe=`MenuCheckboxItem`,cb=L.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,B.jsx)(mb,{scope:e.__scopeMenu,checked:n,children:(0,B.jsx)(ob,{role:`menuitemcheckbox`,"aria-checked":Tb(n)?`mixed`:n,...i,ref:t,"data-state":Eb(n),onSelect:H(i.onSelect,()=>r?.(Tb(n)?!0:!n),{checkForDefaultPrevented:!1})})})});cb.displayName=Soe;var lb=`MenuRadioGroup`,[Coe,woe]=By(lb,{value:void 0,onValueChange:()=>{}}),ub=L.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Oh(r);return(0,B.jsx)(Coe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,B.jsx)(nb,{...i,ref:t})})});ub.displayName=lb;var db=`MenuRadioItem`,fb=L.forwardRef((e,t)=>{let{value:n,...r}=e,i=woe(db,e.__scopeMenu),a=n===i.value;return(0,B.jsx)(mb,{scope:e.__scopeMenu,checked:a,children:(0,B.jsx)(ob,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Eb(a),onSelect:H(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});fb.displayName=db;var pb=`MenuItemIndicator`,[mb,Toe]=By(pb,{checked:!1}),hb=L.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Toe(pb,n);return(0,B.jsx)(Ih,{present:r||Tb(a.checked)||a.checked===!0,children:(0,B.jsx)(Eh.span,{...i,ref:t,"data-state":Eb(a.checked)})})});hb.displayName=pb;var Eoe=`MenuSeparator`,gb=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(Eh.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});gb.displayName=Eoe;var Doe=`MenuArrow`,_b=L.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Hy(n);return(0,B.jsx)(Cv,{...i,...r,ref:t})});_b.displayName=Doe;var vb=`MenuSub`,[Ooe,yb]=By(vb),koe=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Gy(vb,t),o=Hy(t),[s,c]=L.useState(null),[l,u]=L.useState(null),d=Oh(i);return L.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,B.jsx)(bv,{...o,children:(0,B.jsx)(Wy,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,B.jsx)(Ooe,{scope:t,contentId:Ch(),triggerId:Ch(),trigger:s,onTriggerChange:c,children:n})})})};koe.displayName=vb;var bb=`MenuSubTrigger`,xb=L.forwardRef((e,t)=>{let n=Gy(bb,e.__scopeMenu),r=Ky(bb,e.__scopeMenu),i=yb(bb,e.__scopeMenu),a=$y(bb,e.__scopeMenu),o=L.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=L.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return L.useEffect(()=>u,[u]),L.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,B.jsx)(Jy,{asChild:!0,...l,children:(0,B.jsx)(sb,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":wb(n.open),...e,ref:wm(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:H(e.onPointerMove,Db(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:H(e.onPointerLeave,Db(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:H(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||loe[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});xb.displayName=bb;var Sb=`MenuSubContent`,Cb=L.forwardRef((e,t)=>{let n=Xy(Qy,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Gy(Qy,e.__scopeMenu),o=Ky(Qy,e.__scopeMenu),s=yb(Sb,e.__scopeMenu),c=L.useRef(null),l=Tm(t,c);return(0,B.jsx)(zy.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(Ih,{present:r||a.open,children:(0,B.jsx)(zy.Slot,{scope:e.__scopeMenu,children:(0,B.jsx)(tb,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:H(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:H(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:H(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=uoe[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Cb.displayName=Sb;function wb(e){return e?`open`:`closed`}function Tb(e){return e===`indeterminate`}function Eb(e){return Tb(e)?`indeterminate`:e?`checked`:`unchecked`}function Aoe(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function joe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Moe(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=joe(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Noe(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Poe(e,t){return t?Noe({x:e.clientX,y:e.clientY},t):!1}function Db(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Foe=qy,Ioe=Jy,Loe=Zy,Roe=eb,zoe=nb,Boe=rb,Voe=ob,Hoe=cb,Uoe=ub,Woe=fb,Goe=hb,Koe=gb,qoe=_b,Joe=xb,Yoe=Cb,Ob=`DropdownMenu`,[Xoe,Zoe]=xh(Ob,[Vy]),kb=Vy(),[Qoe,Ab]=Xoe(Ob),jb=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=kb(t),l=L.useRef(null),[u,d]=wh({prop:i,defaultProp:a??!1,onChange:o,caller:Ob});return(0,B.jsx)(Qoe,{scope:t,triggerId:Ch(),triggerRef:l,contentId:Ch(),open:u,onOpenChange:d,onOpenToggle:L.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,B.jsx)(Foe,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};jb.displayName=Ob;var Mb=`DropdownMenuTrigger`,Nb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Ab(Mb,n),o=kb(n);return(0,B.jsx)(Ioe,{asChild:!0,...o,children:(0,B.jsx)(Eh.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:wm(t,a.triggerRef),onPointerDown:H(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:H(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Nb.displayName=Mb;var $oe=`DropdownMenuPortal`,Pb=e=>{let{__scopeDropdownMenu:t,...n}=e,r=kb(t);return(0,B.jsx)(Loe,{...r,...n})};Pb.displayName=$oe;var Fb=`DropdownMenuContent`,Ib=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ab(Fb,n),a=kb(n),o=L.useRef(!1);return(0,B.jsx)(Roe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:H(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Ib.displayName=Fb;var ese=`DropdownMenuGroup`,tse=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(zoe,{...i,...r,ref:t})});tse.displayName=ese;var nse=`DropdownMenuLabel`,Lb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Boe,{...i,...r,ref:t})});Lb.displayName=nse;var rse=`DropdownMenuItem`,Rb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Voe,{...i,...r,ref:t})});Rb.displayName=rse;var ise=`DropdownMenuCheckboxItem`,zb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Hoe,{...i,...r,ref:t})});zb.displayName=ise;var ase=`DropdownMenuRadioGroup`,ose=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Uoe,{...i,...r,ref:t})});ose.displayName=ase;var sse=`DropdownMenuRadioItem`,Bb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Woe,{...i,...r,ref:t})});Bb.displayName=sse;var cse=`DropdownMenuItemIndicator`,Vb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Goe,{...i,...r,ref:t})});Vb.displayName=cse;var lse=`DropdownMenuSeparator`,Hb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Koe,{...i,...r,ref:t})});Hb.displayName=lse;var use=`DropdownMenuArrow`,dse=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(qoe,{...i,...r,ref:t})});dse.displayName=use;var fse=`DropdownMenuSubTrigger`,Ub=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Joe,{...i,...r,ref:t})});Ub.displayName=fse;var pse=`DropdownMenuSubContent`,Wb=L.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kb(n);return(0,B.jsx)(Yoe,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Wb.displayName=pse;var mse=jb,hse=Nb,gse=Pb,Gb=Ib,Kb=Lb,qb=Rb,Jb=zb,Yb=Bb,Xb=Vb,Zb=Hb,Qb=Ub,$b=Wb,ex=mse,tx=hse,_se=L.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,B.jsxs)(Qb,{ref:i,className:V(`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,B.jsx)(Fp,{className:`ml-auto`})]}));_se.displayName=Qb.displayName;var vse=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)($b,{ref:n,className:V(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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`,e),...t}));vse.displayName=$b.displayName;var nx=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,B.jsx)(gse,{children:(0,B.jsx)(Gb,{ref:r,sideOffset:t,className:V(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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`,e),...n})}));nx.displayName=Gb.displayName;var rx=L.forwardRef(({className:e,inset:t,...n},r)=>(0,B.jsx)(qb,{ref:r,className:V(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));rx.displayName=qb.displayName;var yse=L.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,B.jsxs)(Jb,{ref:i,className:V(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(Xb,{children:(0,B.jsx)(Np,{className:`h-4 w-4`})})}),t]}));yse.displayName=Jb.displayName;var bse=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(Yb,{ref:r,className:V(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(Xb,{children:(0,B.jsx)(Mee,{className:`h-2 w-2 fill-current`})})}),t]}));bse.displayName=Yb.displayName;var ix=L.forwardRef(({className:e,inset:t,...n},r)=>(0,B.jsx)(Kb,{ref:r,className:V(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));ix.displayName=Kb.displayName;var ax=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Zb,{ref:n,className:V(`-mx-1 my-1 h-px bg-muted`,e),...t}));ax.displayName=Zb.displayName;var xse=({className:e,...t})=>(0,B.jsx)(`span`,{className:V(`ml-auto text-xs tracking-widest opacity-60`,e),...t});xse.displayName=`DropdownMenuShortcut`;var ox={object:{label:`Objects`,icon:nm},hook:{label:`Hooks`,icon:Dp},mapping:{label:`Mappings`,icon:em},analyticsCube:{label:`Analytics Cubes`,icon:Oee},data:{label:`Seed Data`,icon:Up},app:{label:`Apps`,icon:Op},action:{label:`Actions`,icon:Sm},view:{label:`Views`,icon:Wp},page:{label:`Pages`,icon:Gp},dashboard:{label:`Dashboards`,icon:Mp},report:{label:`Reports`,icon:Kp},theme:{label:`Themes`,icon:rm},flow:{label:`Flows`,icon:ym},workflow:{label:`Workflows`,icon:ym},approval:{label:`Approvals`,icon:fm},webhook:{label:`Webhooks`,icon:vm},role:{label:`Roles`,icon:_m},permission:{label:`Permissions`,icon:$p},profile:{label:`Profiles`,icon:um},sharingRule:{label:`Sharing Rules`,icon:um},policy:{label:`Policies`,icon:um},agent:{label:`Agents`,icon:jp},tool:{label:`Tools`,icon:bm},ragPipeline:{label:`RAG Pipelines`,icon:Ap},api:{label:`APIs`,icon:qp},connector:{label:`Connectors`,icon:Xp},plugin:{label:`Plugins`,icon:Yp},kind:{label:`Kinds`,icon:Up}};function Sse(e){return ox[e]?.label||e.charAt(0).toUpperCase()+e.slice(1)}function Cse(e){return ox[e]?.icon||Yp}var sx=[{key:`data`,label:`Data`,icon:Up,types:[`object`,`hook`,`mapping`,`analyticsCube`,`data`]},{key:`ui`,label:`UI`,icon:Op,types:[`app`,`action`,`view`,`page`,`dashboard`,`report`,`theme`]},{key:`automation`,label:`Automation`,icon:ym,types:[`flow`,`workflow`,`approval`,`webhook`]},{key:`security`,label:`Security`,icon:um,types:[`role`,`permission`,`profile`,`sharingRule`,`policy`]},{key:`ai`,label:`AI`,icon:jp,types:[`agent`,`tool`,`ragPipeline`]},{key:`api`,label:`API`,icon:qp,types:[`api`,`connector`]}],cx=new Set([`plugin`,`kind`]),lx=`sys`,wse=`${lx}__`,Tse=`${lx}_`;function ux(e){return typeof e==`string`?e:e&&typeof e==`object`&&`defaultValue`in e?String(e.defaultValue):e&&typeof e==`object`&&`key`in e?String(e.key):``}function dx(e){if(e.isSystem===!0||e.namespace===lx)return!0;let t=e.name||e.id||``;return t.startsWith(wse)||t.startsWith(Tse)}var fx={app:Op,plugin:Yp,driver:Up,server:qp,ui:dm,theme:dm,agent:jp,module:nm,objectql:Up,adapter:Sm};function Ese({selectedObject:e,onSelectObject:t,selectedMeta:n,onSelectMeta:r,packages:i,selectedPackage:a,onSelectPackage:o,onSelectView:s,selectedView:c,...l}){let u=_p(),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(``),[h,g]=(0,L.useState)([]),[_,v]=(0,L.useState)({}),[y,b]=(0,L.useState)(new Set([`object`])),[x,S]=(0,L.useState)(!0),C=e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},w=(0,L.useCallback)(async()=>{f(!0);try{let e=await u.meta.getTypes(),t=[];e&&Array.isArray(e.types)?t=e.types:Array.isArray(e)&&(t=e);let n=new Set(sx.flatMap(e=>e.types).filter(e=>!e.endsWith(`s`))),r=t.map(e=>e.endsWith(`s`)&&n.has(e.slice(0,-1))?e.slice(0,-1):e),i=sx.flatMap(e=>e.types),o=new Set(r),s=i.filter(e=>{if(o.has(e))return!1;let t=e.endsWith(`s`)?e.slice(0,-1):e+`s`;return!o.has(t)}),c=Array.from(new Set([...r,...s]));g(c);let l=a?.manifest?.id,d=await Promise.all(c.filter(e=>!cx.has(e)).map(async e=>{try{let t=await u.meta.getItems(e,l?{packageId:l}:void 0),n=[];return Array.isArray(t)?n=t:t&&Array.isArray(t.items)?n=t.items:t&&Array.isArray(t.value)&&(n=t.value),[e,n]}catch{return[e,[]]}}));v(Object.fromEntries(d))}catch(e){console.error(`Failed to load metadata types`,e)}finally{f(!1)}},[u,a]);(0,L.useEffect)(()=>{w()},[w]),vp(`object`,w),vp(`view`,w),vp(`app`,w),vp(`agent`,w),vp(`tool`,w),vp(`flow`,w),vp(`dashboard`,w),vp(`report`,w);let T=(e,t)=>!p||e.toLowerCase().includes(p.toLowerCase())||t.toLowerCase().includes(p.toLowerCase()),E=(0,L.useMemo)(()=>(_.object||[]).filter(dx),[_]),D=(0,L.useMemo)(()=>{if(x)return _;let e={..._};return e.object&&=e.object.filter(e=>!dx(e)),e},[_,x]),O=sx.map(e=>{let t=e.types.filter(e=>h.includes(e)&&!cx.has(e)&&(D[e]?.length??0)>0),n=t.reduce((e,t)=>e+(D[t]?.length??0),0);return{...e,visibleTypes:t,totalItems:n}}).filter(e=>e.totalItems>0),ee=a?fx[a.manifest?.type]||nm:dm;return(0,B.jsxs)(Xv,{...l,children:[(0,B.jsx)($v,{className:`border-b`,children:(0,B.jsxs)(ex,{children:[(0,B.jsx)(tx,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-sidebar-accent transition-colors`,children:[(0,B.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:(0,B.jsx)(ee,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{className:`flex flex-1 min-w-0 flex-col gap-0.5 leading-none overflow-hidden`,children:[(0,B.jsx)(`span`,{className:`truncate font-semibold text-sm`,children:a?a.manifest?.name||a.manifest?.id:`ObjectStack`}),(0,B.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:a?`v${a.manifest?.version} · ${a.manifest?.type}`:`Loading packages...`})]}),(0,B.jsx)(Aee,{className:`ml-auto h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,B.jsxs)(nx,{className:`w-[--radix-dropdown-menu-trigger-width] min-w-64`,align:`start`,sideOffset:4,children:[(0,B.jsx)(ix,{children:`Installed Packages`}),(0,B.jsx)(ax,{}),i.map(e=>{let t=fx[e.manifest?.type]||nm,n=a?.manifest?.id===e.manifest?.id;return(0,B.jsxs)(rx,{onClick:()=>o(e),className:`gap-2 py-2`,children:[(0,B.jsx)(`div`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded bg-primary/10 text-primary`,children:(0,B.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col leading-tight`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium`,children:e.manifest?.name||e.manifest?.id}),(0,B.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,e.manifest?.version,` · `,e.manifest?.type,!e.enabled&&` · disabled`]})]}),n&&(0,B.jsx)(Np,{className:`h-4 w-4 text-primary`})]},e.manifest?.id)}),i.length===0&&(0,B.jsx)(`div`,{className:`px-2 py-4 text-center text-xs text-muted-foreground`,children:`No packages installed`})]})]})}),(0,B.jsxs)(ty,{children:[(0,B.jsx)(ny,{children:(0,B.jsx)(iy,{children:(0,B.jsx)(ay,{children:(0,B.jsx)(oy,{children:(0,B.jsxs)(sy,{isActive:c===`overview`&&!e,onClick:()=>{t(``),s?.(`overview`)},children:[(0,B.jsx)(Ree,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:`Overview`})]})})})})}),(0,B.jsx)(`div`,{className:`px-4 pb-2`,children:(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(sm,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(Qv,{placeholder:`Search metadata...`,value:p,onChange:e=>m(e.target.value),className:`pl-8`})]})}),(0,B.jsx)(ey,{}),d?(0,B.jsxs)(ny,{children:[(0,B.jsx)(ry,{children:`Loading...`}),(0,B.jsx)(iy,{children:(0,B.jsx)(ay,{children:[1,2,3].map(e=>(0,B.jsx)(oy,{children:(0,B.jsx)(cy,{showIcon:!0})},e))})})]}):O.map(i=>(0,B.jsxs)(ny,{children:[(0,B.jsxs)(ry,{children:[(0,B.jsx)(i.icon,{className:`mr-1.5 h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:i.label}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-sidebar-foreground/50`,children:i.totalItems}),i.key===`data`&&E.length>0&&(0,B.jsx)(`button`,{type:`button`,title:x?`Hide system objects`:`Show system objects`,"aria-label":x?`Hide system objects`:`Show system objects`,onClick:e=>{e.stopPropagation(),S(!x)},className:`ml-1 shrink-0 rounded p-0.5 text-sidebar-foreground/50 hover:text-sidebar-foreground hover:bg-sidebar-accent transition-colors`,children:x?(0,B.jsx)(Wp,{className:`h-3 w-3`}):(0,B.jsx)(Iee,{className:`h-3 w-3`})})]}),(0,B.jsx)(iy,{children:(0,B.jsx)(ay,{children:i.visibleTypes.map(i=>{let a=D[i]||[],o=Cse(i),s=Sse(i),c=i===`object`,l=y.has(i)||!!p,u=a.filter(e=>T(ux(e.label)||e.name||``,e.name||``));return u.length===0&&p?null:(0,B.jsx)(by,{open:l,onOpenChange:()=>C(i),asChild:!0,children:(0,B.jsxs)(oy,{children:[(0,B.jsx)(xy,{asChild:!0,children:(0,B.jsxs)(sy,{tooltip:`${s} (${a.length})`,children:[(0,B.jsx)(o,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:s}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:a.length}),(0,B.jsx)(Fp,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ${l?`rotate-90`:``}`})]})}),(0,B.jsx)(Sy,{children:(0,B.jsx)(ly,{children:u.map(a=>{let o=a.name||a.id||`unknown`,s=ux(a.label)||a.name||`Untitled`,l=o.includes(`__`)?o.split(`__`):[null,o],u=l.length===2&&l[0]?l[0]:null;return(0,B.jsx)(uy,{children:(0,B.jsx)(dy,{isActive:c?e===o:n?.type===i&&n?.name===o,onClick:c?()=>t(o):()=>r?.(i,o),children:(0,B.jsxs)(`span`,{className:`truncate`,children:[u&&(0,B.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[u,`__`]}),s]})})},o)})})})]})},i)})})})]},i.key)),!d&&O.length===0&&(0,B.jsxs)(`div`,{className:`px-4 py-8 text-xs text-muted-foreground flex flex-col items-center gap-2`,children:[(0,B.jsx)(Up,{className:`h-5 w-5 opacity-40`}),(0,B.jsx)(`span`,{children:`No metadata registered`})]}),(0,B.jsx)(ey,{}),(0,B.jsxs)(ny,{children:[(0,B.jsxs)(ry,{children:[(0,B.jsx)(Kee,{className:`mr-1.5 h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`System`}),E.length>0&&(0,B.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-sidebar-foreground/50`,children:E.length})]}),(0,B.jsx)(iy,{children:(0,B.jsxs)(ay,{children:[E.length>0&&(0,B.jsx)(by,{open:y.has(`_system_objects`)||!!p,onOpenChange:e=>{let t=y.has(`_system_objects`);e&&!t&&C(`_system_objects`),!e&&t&&C(`_system_objects`)},asChild:!0,children:(0,B.jsxs)(oy,{children:[(0,B.jsx)(xy,{asChild:!0,children:(0,B.jsxs)(sy,{tooltip:`System Objects (${E.length})`,children:[(0,B.jsx)(Up,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`System Objects`}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:E.length}),(0,B.jsx)(Fp,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ${y.has(`_system_objects`)||p?`rotate-90`:``}`})]})}),(0,B.jsx)(Sy,{children:(0,B.jsx)(ly,{children:E.filter(e=>T(ux(e.label)||e.name||``,e.name||``)).map(n=>{let r=n.name||n.id||`unknown`,i=ux(n.label)||n.name||`Untitled`;return(0,B.jsx)(uy,{children:(0,B.jsx)(dy,{isActive:e===r,onClick:()=>t(r),children:(0,B.jsxs)(`span`,{className:`truncate`,children:[dx(n)&&(0,B.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[lx,`:`]}),i]})})},r)})})})]})}),(0,B.jsx)(oy,{children:(0,B.jsxs)(sy,{tooltip:`API Console`,isActive:c===`api-console`,onClick:()=>s?.(`api-console`),children:[(0,B.jsx)(qp,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:`API Console`})]})}),(0,B.jsx)(oy,{children:(0,B.jsxs)(sy,{tooltip:`Packages`,isActive:c===`packages`,onClick:()=>s?.(`packages`),children:[(0,B.jsx)(nm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:`Packages`})]})})]})})]})]})]})}var Dse=Pm(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`),px=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`nav`,{ref:n,"aria-label":`breadcrumb`,className:V(Dse(),e),...t}));px.displayName=`Breadcrumb`;var mx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`ol`,{ref:n,className:V(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`,e),...t}));mx.displayName=`BreadcrumbList`;var hx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`li`,{ref:n,className:V(`inline-flex items-center gap-1.5`,e),...t}));hx.displayName=`BreadcrumbItem`;var gx=L.forwardRef(({asChild:e,className:t,...n},r)=>(0,B.jsx)(e?km:`a`,{ref:r,className:V(`hover:text-foreground transition-colors`,t),...n}));gx.displayName=`BreadcrumbLink`;var _x=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:V(`text-foreground font-normal`,e),...t}));_x.displayName=`BreadcrumbPage`;var vx=({children:e,className:t,...n})=>(0,B.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:V(`[&>svg]:size-3.5`,t),...n,children:e??(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:(0,B.jsx)(`path`,{d:`m9 18 6-6-6-6`})})});vx.displayName=`BreadcrumbSeparator`;var Ose=({className:e,...t})=>(0,B.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:V(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,B.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`}),(0,B.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`})]}),(0,B.jsx)(`span`,{className:`sr-only`,children:`More`})]});Ose.displayName=`BreadcrumbElipssis`;function kse(){let[e,t]=(0,L.useState)(`light`);(0,L.useEffect)(()=>{let e=localStorage.getItem(`theme`);if(e)t(e),n(e);else{let e=window.matchMedia(`(prefers-color-scheme: dark)`).matches;t(`system`),n(e?`dark`:`light`)}},[]);function n(e){let t=document.documentElement;e===`dark`?t.classList.add(`dark`):t.classList.remove(`dark`)}function r(e){if(t(e),localStorage.setItem(`theme`,e),e===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`).matches;n(e?`dark`:`light`)}else n(e)}return(0,B.jsxs)(ex,{children:[(0,B.jsx)(tx,{asChild:!0,children:(0,B.jsxs)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:[(0,B.jsx)(pm,{className:`h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,B.jsx)(tm,{className:`absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Toggle theme`})]})}),(0,B.jsxs)(nx,{align:`end`,children:[(0,B.jsxs)(rx,{onClick:()=>r(`light`),children:[(0,B.jsx)(pm,{className:`mr-2 h-4 w-4`}),`Light`]}),(0,B.jsxs)(rx,{onClick:()=>r(`dark`),children:[(0,B.jsx)(tm,{className:`mr-2 h-4 w-4`}),`Dark`]}),(0,B.jsx)(rx,{onClick:()=>r(`system`),children:`System`})]})]})}var Ase=Pm(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function yx({className:e,variant:t,...n}){return(0,B.jsx)(`div`,{className:V(Ase({variant:t}),e),...n})}function jse(){if(typeof window<`u`){let e=new URLSearchParams(window.location.search).get(`mode`);if(e===`msw`||e===`server`)return e}return`server`}function Mse(){return``}var bx={mode:jse(),serverUrl:Mse(),mswBasePath:``};function Nse(){return bx.mode===`msw`}function Pse(){return bx.mode===`server`}function xx(){return Pse()?bx.serverUrl:bx.mswBasePath}function Fse(){console.log(`[Console Config]`,{mode:bx.mode,apiBaseUrl:xx(),serverUrl:bx.serverUrl})}var Ise={actions:`Actions`,dashboards:`Dashboards`,reports:`Reports`,flows:`Flows`,agents:`Agents`,apis:`APIs`,ragPipelines:`RAG Pipelines`,profiles:`Profiles`,sharingRules:`Sharing Rules`,data:`Seed Data`};function Lse({selectedObject:e,selectedMeta:t,selectedView:n,packageLabel:r}){let i={overview:`Overview`,packages:`Package Manager`,"api-console":`API Console`,object:e||`Object`,metadata:t?Ise[t.type]||t.type:`Metadata`};return(0,B.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between gap-2 border-b px-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Zv,{className:`-ml-1`}),(0,B.jsx)(bh,{orientation:`vertical`,className:`mr-2 h-4`}),(0,B.jsx)(px,{children:(0,B.jsxs)(mx,{children:[(0,B.jsx)(hx,{className:`hidden md:block`,children:(0,B.jsxs)(gx,{href:`#`,className:`flex items-center gap-1.5`,children:[(0,B.jsx)(hm,{className:`h-3.5 w-3.5`}),r||`ObjectStack`]})}),(0,B.jsx)(vx,{className:`hidden md:block`}),(0,B.jsx)(hx,{children:(0,B.jsx)(_x,{className:`font-medium`,children:i[n]||`Overview`})}),n===`object`&&e&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(vx,{}),(0,B.jsx)(hx,{children:(0,B.jsx)(_x,{children:(0,B.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:e})})})]}),n===`metadata`&&t&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(vx,{}),(0,B.jsx)(hx,{children:(0,B.jsx)(_x,{children:(0,B.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:t.name})})})]})]})})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n===`object`&&e&&(0,B.jsxs)(yx,{variant:`outline`,className:`font-mono text-[10px] gap-1 hidden sm:flex`,children:[`/api/v1/data/`,e]}),n===`metadata`&&t&&(0,B.jsxs)(yx,{variant:`outline`,className:`font-mono text-[10px] gap-1 hidden sm:flex`,children:[`/api/v1/meta/`,t.type,`/`,t.name]}),(0,B.jsxs)(yx,{variant:`secondary`,className:`text-[10px] gap-1 font-mono`,children:[(0,B.jsx)(Hp,{className:`h-2.5 w-2.5`}),bx.mode.toUpperCase()]}),(0,B.jsx)(kse,{})]})]})}var Sx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:V(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));Sx.displayName=`Card`;var Cx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:V(`flex flex-col space-y-1.5 p-6`,e),...t}));Cx.displayName=`CardHeader`;var wx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`h3`,{ref:n,className:V(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));wx.displayName=`CardTitle`;var Tx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`p`,{ref:n,className:V(`text-sm text-muted-foreground`,e),...t}));Tx.displayName=`CardDescription`;var Ex=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:V(`p-6 pt-0`,e),...t}));Ex.displayName=`CardContent`;var Dx=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:V(`flex items-center p-6 pt-0`,e),...t}));Dx.displayName=`CardFooter`;function Rse({packages:e,selectedPackage:t,onNavigate:n}){let r=_p(),[i,a]=(0,L.useState)({packages:{total:0,enabled:0,disabled:0,byType:{}},metadata:{types:[],counts:{}},loading:!0}),o=(0,L.useCallback)(async()=>{a(e=>({...e,loading:!0}));try{let n=await r.meta.getTypes(),i=n?.types||(Array.isArray(n)?n:[]),o=t?.manifest?.id,s=await Promise.all(i.map(async e=>{try{let t=await r.meta.getItems(e,o?{packageId:o}:void 0);return[e,(t?.items||(Array.isArray(t)?t:[])).length]}catch{return[e,0]}})),c=Object.fromEntries(s),l=e.filter(e=>e.enabled).length,u={};e.forEach(e=>{let t=e.manifest?.type||`unknown`;u[t]=(u[t]||0)+1}),a({packages:{total:e.length,enabled:l,disabled:e.length-l,byType:u},metadata:{types:i,counts:c},loading:!1})}catch(e){console.error(`[DeveloperOverview] Failed to load stats:`,e),a(e=>({...e,loading:!1}))}},[r,e,t]);(0,L.useEffect)(()=>{o()},[o]);let s=i.metadata.counts.object||0,c=Object.values(i.metadata.counts).reduce((e,t)=>e+t,0);return(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col gap-6 p-6 overflow-auto`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h1`,{className:`text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,B.jsx)(hm,{className:`h-6 w-6`}),`Developer Console`]}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Inspect metadata, manage packages, and explore the ObjectStack runtime.`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(yx,{variant:`outline`,className:`font-mono text-xs gap-1`,children:[(0,B.jsx)(Hp,{className:`h-3 w-3`}),bx.mode.toUpperCase()]}),(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,onClick:o,disabled:i.loading,children:[(0,B.jsx)(om,{className:`h-3.5 w-3.5 mr-1.5 ${i.loading?`animate-spin`:``}`}),`Refresh`]})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,B.jsxs)(Sx,{className:`cursor-pointer hover:border-primary/50 transition-colors`,onClick:()=>n(`packages`),children:[(0,B.jsxs)(Cx,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,B.jsx)(wx,{className:`text-sm font-medium`,children:`Packages`}),(0,B.jsx)(nm,{className:`h-4 w-4 text-muted-foreground`})]}),(0,B.jsxs)(Ex,{children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:i.packages.total}),(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[i.packages.enabled,` enabled · `,i.packages.disabled,` disabled`]})]})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,B.jsx)(wx,{className:`text-sm font-medium`,children:`Objects`}),(0,B.jsx)(Up,{className:`h-4 w-4 text-muted-foreground`})]}),(0,B.jsxs)(Ex,{children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:s}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Data model definitions`})]})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,B.jsx)(wx,{className:`text-sm font-medium`,children:`Metadata Types`}),(0,B.jsx)(Yp,{className:`h-4 w-4 text-muted-foreground`})]}),(0,B.jsxs)(Ex,{children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:i.metadata.types.length}),(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[c,` total items registered`]})]})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,B.jsx)(wx,{className:`text-sm font-medium`,children:`API Endpoints`}),(0,B.jsx)(qp,{className:`h-4 w-4 text-muted-foreground`})]}),(0,B.jsxs)(Ex,{children:[(0,B.jsx)(`div`,{className:`text-2xl font-bold font-mono text-sm pt-1`,children:`/api/v1`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`REST · data · meta · packages`})]})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(wx,{className:`text-base`,children:`Installed Packages`}),(0,B.jsxs)(_h,{variant:`ghost`,size:`sm`,className:`text-xs gap-1`,onClick:()=>n(`packages`),children:[`View all `,(0,B.jsx)(Fee,{className:`h-3 w-3`})]})]}),(0,B.jsx)(Tx,{children:`Runtime package registry`})]}),(0,B.jsx)(Ex,{className:`space-y-2`,children:e.length===0?(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`No packages installed`}):e.slice(0,6).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-2 px-3 rounded-md hover:bg-muted/50 transition-colors`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,B.jsx)(wee,{className:`h-4 w-4 shrink-0 ${e.enabled?`text-primary`:`text-muted-foreground`}`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.manifest?.name}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground font-mono truncate`,children:e.manifest?.id})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] font-mono`,children:e.manifest?.version}),(0,B.jsx)(yx,{variant:e.enabled?`default`:`secondary`,className:`text-[10px]`,children:e.manifest?.type})]})]},e.manifest?.id))})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsx)(wx,{className:`text-base`,children:`Metadata Registry`}),(0,B.jsx)(Tx,{children:t?`Metadata from ${t.manifest?.name||t.manifest?.id}`:`All registered metadata types and item counts`})]}),(0,B.jsx)(Ex,{children:(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[i.metadata.types.length===0?(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading...`}):i.metadata.types.filter(e=>(i.metadata.counts[e]||0)>0).sort((e,t)=>(i.metadata.counts[t]||0)-(i.metadata.counts[e]||0)).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between py-2 px-3 rounded-md hover:bg-muted/50 transition-colors cursor-default`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Bp,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-sm font-mono`,children:e})]}),(0,B.jsx)(yx,{variant:`secondary`,className:`text-xs font-mono`,children:i.metadata.counts[e]})]},e)),i.metadata.types.filter(e=>(i.metadata.counts[e]||0)===0).length>0&&(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-2 px-3`,children:[`+ `,i.metadata.types.filter(e=>(i.metadata.counts[e]||0)===0).length,` empty types`]})]})})]})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsx)(wx,{className:`text-base`,children:`Quick Reference`}),(0,B.jsx)(Tx,{children:`Common API endpoints for this runtime`})]}),(0,B.jsx)(Ex,{children:(0,B.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2 lg:grid-cols-3`,children:[{method:`GET`,path:`/api/v1/meta/types`,desc:`List metadata types`},{method:`GET`,path:`/api/v1/meta/objects`,desc:`List object definitions`},{method:`GET`,path:`/api/v1/data/{object}`,desc:`Query records`},{method:`POST`,path:`/api/v1/data/{object}`,desc:`Create record`},{method:`GET`,path:`/api/v1/packages`,desc:`List packages`},{method:`GET`,path:`/api/v1/discovery`,desc:`API discovery`}].map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-start gap-2 py-2 px-3 rounded-md bg-muted/30 border border-transparent hover:border-border transition-colors`,children:[(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] font-mono shrink-0 mt-0.5 ${e.method===`GET`?`text-emerald-600 border-emerald-300 dark:text-emerald-400`:e.method===`POST`?`text-blue-600 border-blue-300 dark:text-blue-400`:`text-amber-600 border-amber-300`}`,children:e.method}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs font-mono`,children:e.path}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:e.desc})]})]},t))})})]})]})}var zse=1,Bse=1e6,Ox=0;function Vse(){return Ox=(Ox+1)%(2**53-1),Ox.toString()}var kx=new Map,Ax=e=>{if(kx.has(e))return;let t=setTimeout(()=>{kx.delete(e),Nx({type:`REMOVE_TOAST`,toastId:e})},Bse);kx.set(e,t)},Hse=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,zse)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?Ax(n):e.toasts.forEach(e=>{Ax(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},jx=[],Mx={toasts:[]};function Nx(e){Mx=Hse(Mx,e),jx.forEach(e=>{e(Mx)})}function Px({...e}){let t=Vse(),n=e=>Nx({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>Nx({type:`DISMISS_TOAST`,toastId:t});return Nx({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function Use(){let[e,t]=L.useState(Mx);return L.useEffect(()=>(jx.push(t),()=>{let e=jx.indexOf(t);e>-1&&jx.splice(e,1)}),[e]),{...e,toast:Px,dismiss:e=>Nx({type:`DISMISS_TOAST`,toastId:e})}}function Wse(){let e=_p(),[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)(!0),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),p=(0,L.useCallback)(async()=>{i(!0),o(null);try{n((await e.packages.list())?.packages||[])}catch(e){console.error(`[PackageManager] Failed to load packages:`,e),o(e.message||`Failed to load packages`)}finally{i(!1)}},[e]);(0,L.useEffect)(()=>{p()},[p]);let m=[`objectstack.json`,`dist/objectstack.json`];function h(e){if(!e)return e;if(e.bundle)return h(e.bundle);if(!(e.id||e.name)&&e.manifest&&(e.manifest.id||e.manifest.name)){let{manifest:t,...n}=e;return{...t,...n}}return e}async function g(e){let t=await fetch(e,{headers:{Accept:`application/json`}});if(!t.ok)throw Error(`Failed to fetch ${e} (${t.status})`);return t.json()}async function _(e){let t=e.trim();if(!t)throw Error(`Please enter a package or URL.`);if(/^https?:\/\//i.test(t))return h(await g(t));let n=`https://unpkg.com/${t.replace(/\/$/,``)}`,r=null;for(let e of m)try{return h(await g(`${n}/${e}`))}catch(e){r=e instanceof Error?e:Error(`Failed to fetch manifest`)}throw r||Error(`Failed to resolve manifest from unpkg.`)}async function v(){f(null),u(!0);try{let t=await _(s);if(!t||!t.id)throw Error(`Manifest missing required id field.`);let n=await e.packages.install(t,{enableOnInstall:!0});Px({title:`Package installed`,description:n?.package?.manifest?.name||n?.package?.manifest?.id||t.id}),c(``),await p()}catch(e){f(e?.message||`Failed to install package`),console.error(`[PackageManager] Install failed:`,e)}finally{u(!1)}}async function y(t){try{t.enabled?await e.packages.disable(t.manifest?.id):await e.packages.enable(t.manifest?.id),await p()}catch(e){console.error(`[PackageManager] Toggle failed:`,e)}}async function b(t){if(confirm(`Uninstall "${t.manifest?.name}"? This cannot be undone.`))try{await e.packages.uninstall(t.manifest?.id),await p()}catch(e){console.error(`[PackageManager] Uninstall failed:`,e)}}let x={app:`bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200`,plugin:`bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200`,driver:`bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200`,server:`bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200`,module:`bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200`};return(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col gap-6 p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`h1`,{className:`text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,B.jsx)(nm,{className:`h-6 w-6`}),`Package Manager`]}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage installed packages. A package may contain apps, objects, actions, and other metadata.`})]}),(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,onClick:p,disabled:r,children:[(0,B.jsx)(om,{className:`h-4 w-4 mr-1.5 ${r?`animate-spin`:``}`}),`Refresh`]})]}),a&&(0,B.jsx)(Sx,{className:`border-destructive`,children:(0,B.jsx)(Ex,{className:`py-4 text-destructive text-sm`,children:a})}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{children:[(0,B.jsx)(wx,{className:`text-base`,children:`Install from unpkg`}),(0,B.jsx)(Tx,{className:`text-xs`,children:`Enter a package spec (for example: @objectstack/app-crm@1.0.0) or a direct URL to objectstack.json.`})]}),(0,B.jsxs)(Ex,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,B.jsx)(vh,{value:s,onChange:e=>c(e.target.value),placeholder:`@objectstack/app-crm@1.0.0`}),(0,B.jsx)(_h,{onClick:v,disabled:l||!s.trim(),className:`sm:w-28`,children:l?`Installing...`:`Install`})]}),d&&(0,B.jsx)(`div`,{className:`text-xs text-destructive`,children:d})]})]}),r?(0,B.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[1,2].map(e=>(0,B.jsx)(Sx,{className:`animate-pulse`,children:(0,B.jsxs)(Cx,{children:[(0,B.jsx)(`div`,{className:`h-5 w-40 bg-muted rounded`}),(0,B.jsx)(`div`,{className:`h-3 w-60 bg-muted rounded mt-2`})]})},e))}):t.length===0?(0,B.jsx)(Sx,{className:`border-dashed`,children:(0,B.jsxs)(Ex,{className:`py-12 text-center`,children:[(0,B.jsx)(Yp,{className:`h-10 w-10 mx-auto mb-3 text-muted-foreground/40`}),(0,B.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No packages installed`})]})}):(0,B.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:t.map(e=>(0,B.jsxs)(Sx,{className:e.enabled?``:`opacity-60`,children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[e.manifest?.type===`app`?(0,B.jsx)(Op,{className:`h-5 w-5 shrink-0 text-blue-500`}):(0,B.jsx)(nm,{className:`h-5 w-5 shrink-0 text-purple-500`}),(0,B.jsx)(wx,{className:`text-base truncate`,children:e.manifest?.name||e.manifest?.id||`Unknown`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,B.jsxs)(yx,{variant:`outline`,className:`text-xs font-mono`,children:[`v`,e.manifest?.version||`?`]}),(0,B.jsx)(yx,{className:`text-xs ${x[e.manifest?.type||`module`]||x.module}`,children:e.manifest?.type||`unknown`})]})]}),(0,B.jsx)(Tx,{className:`text-xs mt-1`,children:e.manifest?.description||e.manifest?.id||`No description`})]}),(0,B.jsx)(Ex,{className:`pt-0`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(yx,{variant:e.enabled?`default`:`secondary`,className:`text-xs`,children:e.enabled?`Enabled`:`Disabled`}),e.installedAt&&(0,B.jsxs)(`span`,{children:[`Installed `,new Date(e.installedAt).toLocaleDateString()]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>y(e),title:e.enabled?`Disable`:`Enable`,children:e.enabled?(0,B.jsx)(Uee,{className:`h-3.5 w-3.5`}):(0,B.jsx)(Wee,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-7 w-7 text-destructive hover:text-destructive`,onClick:()=>b(e),title:`Uninstall`,children:(0,B.jsx)(gm,{className:`h-3.5 w-3.5`})})]})]})})]},e.manifest?.id||String(Math.random())))})]})}var Gse=[`plugin`,`plugins`,`kind`,`package`],Kse=[{method:`GET`,path:`/api/v1/discovery`,desc:`API Discovery`,group:`System`},{method:`GET`,path:`/api/v1/meta/types`,desc:`List metadata types`,group:`Metadata`},{method:`GET`,path:`/api/v1/packages`,desc:`List packages`,group:`System`},{method:`GET`,path:`/api/v1/health`,desc:`Health check`,group:`System`}];function qse(e){return[{method:`POST`,path:`${e}/sign-in/email`,desc:`Sign in (email)`,group:`Auth`,bodyTemplate:{email:`user@example.com`,password:``}},{method:`POST`,path:`${e}/sign-up/email`,desc:`Sign up (email)`,group:`Auth`,bodyTemplate:{email:``,password:``,name:``}},{method:`POST`,path:`${e}/sign-out`,desc:`Sign out`,group:`Auth`},{method:`GET`,path:`${e}/get-session`,desc:`Get session`,group:`Auth`}]}var Fx={ai:{group:`AI`,defaultRoute:`/api/v1/ai`,endpoints:[{method:`POST`,path:`/chat`,desc:`Chat completion`,bodyTemplate:{messages:[{role:`user`,content:``}]}},{method:`POST`,path:`/chat/stream`,desc:`Streaming chat (SSE)`,bodyTemplate:{messages:[{role:`user`,content:``}]}},{method:`POST`,path:`/complete`,desc:`Text completion`,bodyTemplate:{prompt:``}},{method:`GET`,path:`/models`,desc:`List available models`},{method:`POST`,path:`/nlq`,desc:`Natural language query`,bodyTemplate:{query:``}},{method:`POST`,path:`/suggest`,desc:`AI-powered suggestions`,bodyTemplate:{object:``,field:``,context:{}}},{method:`POST`,path:`/insights`,desc:`AI-generated insights`,bodyTemplate:{object:``,recordIds:[]}},{method:`POST`,path:`/conversations`,desc:`Create conversation`,bodyTemplate:{}},{method:`GET`,path:`/conversations`,desc:`List conversations`},{method:`POST`,path:`/conversations/:id/messages`,desc:`Add message to conversation`,bodyTemplate:{role:`user`,content:``}},{method:`DELETE`,path:`/conversations/:id`,desc:`Delete conversation`}]},workflow:{group:`Workflow`,defaultRoute:`/api/v1/workflow`,endpoints:[{method:`GET`,path:`/:object/config`,desc:`Get workflow configuration`},{method:`GET`,path:`/:object/:recordId/state`,desc:`Get workflow state`},{method:`POST`,path:`/:object/:recordId/transition`,desc:`Execute workflow transition`,bodyTemplate:{targetState:``}},{method:`POST`,path:`/:object/:recordId/approve`,desc:`Approve workflow step`,bodyTemplate:{comment:``}},{method:`POST`,path:`/:object/:recordId/reject`,desc:`Reject workflow step`,bodyTemplate:{comment:``}}]},realtime:{group:`Realtime`,defaultRoute:`/api/v1/realtime`,endpoints:[{method:`POST`,path:`/connect`,desc:`Establish realtime connection`,bodyTemplate:{transport:`websocket`}},{method:`POST`,path:`/disconnect`,desc:`Close realtime connection`,bodyTemplate:{connectionId:``}},{method:`POST`,path:`/subscribe`,desc:`Subscribe to channel`,bodyTemplate:{channel:``}},{method:`POST`,path:`/unsubscribe`,desc:`Unsubscribe from channel`,bodyTemplate:{channel:``}},{method:`PUT`,path:`/presence/:channel`,desc:`Set presence state`,bodyTemplate:{status:`online`}},{method:`GET`,path:`/presence/:channel`,desc:`Get channel presence`}]},notification:{group:`Notifications`,defaultRoute:`/api/v1/notifications`,endpoints:[{method:`GET`,path:``,desc:`List notifications`},{method:`POST`,path:`/devices`,desc:`Register device for push`,bodyTemplate:{token:``,platform:`web`}},{method:`DELETE`,path:`/devices/:deviceId`,desc:`Unregister device`},{method:`GET`,path:`/preferences`,desc:`Get notification preferences`},{method:`PATCH`,path:`/preferences`,desc:`Update notification preferences`,bodyTemplate:{email:!0,push:!0}},{method:`POST`,path:`/read`,desc:`Mark notifications as read`,bodyTemplate:{ids:[]}},{method:`POST`,path:`/read/all`,desc:`Mark all as read`}]},analytics:{group:`Analytics`,defaultRoute:`/api/v1/analytics`,endpoints:[{method:`POST`,path:`/query`,desc:`Execute analytics query`,bodyTemplate:{measures:[],dimensions:[]}},{method:`GET`,path:`/meta`,desc:`Get analytics metadata`}]},automation:{group:`Automation`,defaultRoute:`/api/v1/automation`,endpoints:[{method:`POST`,path:`/trigger`,desc:`Trigger automation`,bodyTemplate:{name:``,params:{}}}]},i18n:{group:`i18n`,defaultRoute:`/api/v1/i18n`,endpoints:[{method:`GET`,path:`/locales`,desc:`Get available locales`},{method:`GET`,path:`/translations/:locale`,desc:`Get translations for locale`},{method:`GET`,path:`/labels/:object/:locale`,desc:`Get translated field labels`}]},ui:{group:`UI`,defaultRoute:`/api/v1/ui`,endpoints:[{method:`GET`,path:`/views`,desc:`List views`},{method:`GET`,path:`/views/:id`,desc:`Get view by ID`},{method:`POST`,path:`/views`,desc:`Create view`,bodyTemplate:{name:``,object:``,type:`list`}},{method:`PATCH`,path:`/views/:id`,desc:`Update view`,bodyTemplate:{name:``}},{method:`DELETE`,path:`/views/:id`,desc:`Delete view`}]},feed:{group:`Feed`,defaultRoute:`/api/v1/feed`,endpoints:[{method:`GET`,path:`/:object/:recordId`,desc:`Get feed items`},{method:`POST`,path:`/:object/:recordId`,desc:`Post feed item`,bodyTemplate:{body:``}}]},storage:{group:`Storage`,defaultRoute:`/api/v1/storage`,endpoints:[{method:`POST`,path:`/upload`,desc:`Upload file (multipart/form-data)`},{method:`GET`,path:`/:fileId`,desc:`Download file`},{method:`DELETE`,path:`/:fileId`,desc:`Delete file`}]}};function Jse(e,t){let n=Fx[e];return n?n.endpoints.map(e=>({method:e.method,path:`${t}${e.path}`,desc:e.desc,group:n.group,...e.bodyTemplate?{bodyTemplate:e.bodyTemplate}:{}})):[]}function Yse(){let e=_p(),[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)([]),[a,o]=(0,L.useState)(!0),[s,c]=(0,L.useState)(null),l=(0,L.useCallback)(async()=>{o(!0),c(null);try{let t=`/api/v1/auth`,r={},a={};try{let e=await fetch(`/api/v1/discovery`);if(e.ok){let n=await e.json(),i=n?.data??n;a=i?.routes??{},r=i?.services??{},a.auth&&(t=a.auth)}}catch{}let o=[];for(let[e,t]of Object.entries(Fx)){let n=r[e],i=n?.enabled??!1,s=n?.handlerReady??(n?.status===`available`||n?.status===`degraded`),c=n?.route??a[e]??t.defaultRoute;i&&s&&o.push(...Jse(e,c))}let s=[];try{let t=await e.meta.getTypes();t&&Array.isArray(t.types)?s=t.types:Array.isArray(t)&&(s=t)}catch{}let c=[];try{let t=s.includes(`object`)?`object`:null;if(t){let n=await e.meta.getItems(t),r=[];Array.isArray(n)?r=n:n&&Array.isArray(n.items)?r=n.items:n&&Array.isArray(n.value)&&(r=n.value),c=r.map(e=>e.name||e.id).filter(Boolean)}}catch{}let l=c.flatMap(e=>[{method:`GET`,path:`/api/v1/data/${e}`,desc:`List ${e}`,group:`Data: ${e}`},{method:`POST`,path:`/api/v1/data/${e}`,desc:`Create ${e}`,group:`Data: ${e}`,bodyTemplate:{name:`example`}},{method:`GET`,path:`/api/v1/data/${e}/:id`,desc:`Get ${e} by ID`,group:`Data: ${e}`},{method:`PATCH`,path:`/api/v1/data/${e}/:id`,desc:`Update ${e}`,group:`Data: ${e}`,bodyTemplate:{name:`updated`}},{method:`DELETE`,path:`/api/v1/data/${e}/:id`,desc:`Delete ${e}`,group:`Data: ${e}`}]),u=s.filter(e=>!Gse.includes(e)).map(e=>({method:`GET`,path:`/api/v1/meta/${e}`,desc:`List ${e} metadata`,group:`Metadata`})),d=c.map(e=>({method:`GET`,path:`/api/v1/meta/object/${e}`,desc:`${e} schema`,group:`Metadata`})),f=[...Kse,...qse(t),...o,...u,...d,...l],p=new Map;for(let e of f){let t=p.get(e.group)||[];t.push(e),p.set(e.group,t)}let m=[`System`,`Auth`,`AI`,`Workflow`,`Realtime`,`Notifications`,`Analytics`,`Automation`,`i18n`,`UI`,`Feed`,`Storage`,`Metadata`];n(Array.from(p.entries()).sort(([e],[t])=>{let n=m.indexOf(e),r=m.indexOf(t);return n!==-1&&r!==-1?n-r:n===-1?r===-1?e.localeCompare(t):1:-1}).map(([e,t])=>({key:e,label:e,endpoints:t}))),i(f)}catch(e){c(e.message||`Failed to discover APIs`)}finally{o(!1)}},[e]);return(0,L.useEffect)(()=>{l()},[l]),{groups:t,allEndpoints:r,loading:a,error:s,refresh:l}}var Ix={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`,PUT:`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`},Xse={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`},Zse=[{key:`$top`,placeholder:`10`,hint:`limit`},{key:`$skip`,placeholder:`0`,hint:`offset`},{key:`$sort`,placeholder:`name`,hint:`sort field`},{key:`$select`,placeholder:`name,email`,hint:`fields`},{key:`$count`,placeholder:`true`,hint:`total count`},{key:`$filter`,placeholder:`status eq 'active'`,hint:`OData filter`}],Lx=1;function Qse(){let e=_p(),{groups:t,loading:n,refresh:r}=Yse(),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(new Set),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)(``),[g,_]=(0,L.useState)([]),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)([]),[w,T]=(0,L.useState)(null),[E,D]=(0,L.useState)(!1),O=(0,L.useMemo)(()=>{if(!i)return t;let e=i.toLowerCase();return t.map(t=>({...t,endpoints:t.endpoints.filter(t=>t.desc.toLowerCase().includes(e)||t.path.toLowerCase().includes(e)||t.method.toLowerCase().includes(e))})).filter(e=>e.endpoints.length>0)},[t,i]),ee=(0,L.useCallback)(e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),te=(0,L.useCallback)(e=>{l(e),d(e.method),p(e.path),h(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),_([]),x(null)},[]),k=u||c?.method||`GET`,A=f||c?.path||``,j=(0,L.useMemo)(()=>{let e=g.filter(e=>e.enabled&&e.key.trim());return e.length===0?A:`${A}?${e.map(e=>`${encodeURIComponent(e.key)}=${encodeURIComponent(e.value)}`).join(`&`)}`},[A,g]),M=(0,L.useCallback)((e=``,t=``)=>{_(n=>[...n,{id:Lx++,key:e,value:t,enabled:!0}])},[]),N=(0,L.useCallback)(e=>{_(t=>t.filter(t=>t.id!==e))},[]),P=(0,L.useCallback)((e,t,n)=>{_(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),F=(0,L.useCallback)(e=>{_(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t))},[]),I=(0,L.useCallback)(async()=>{if(v||!j)return;let t=`${e?.baseUrl??``}${j}`;y(!0);let n=performance.now();try{let e={method:k,headers:{"Content-Type":`application/json`}};[`POST`,`PATCH`,`PUT`].includes(k)&&m.trim()&&(e.body=m);let r=await fetch(t,e),i=Math.round(performance.now()-n),a;if((r.headers.get(`content-type`)??``).includes(`json`)){let e=await r.json();a=JSON.stringify(e,null,2)}else a=await r.text();x({status:r.status,body:a,duration:i}),C(e=>[{id:Date.now(),method:k,url:j,body:m||void 0,status:r.status,duration:i,response:a,timestamp:new Date},...e].slice(0,50))}catch(e){let t=Math.round(performance.now()-n);x({status:0,body:`Network Error: ${e.message}`,duration:t})}finally{y(!1)}},[e,j,k,m,v]),ne=(0,L.useCallback)(e=>{d(e.method);let[t,n]=e.url.split(`?`);if(p(t),h(e.body||``),n){let e=new URLSearchParams(n),t=[];e.forEach((e,n)=>{t.push({id:Lx++,key:n,value:e,enabled:!0})}),_(t)}else _([]);x(null),l(null)},[]),re=(0,L.useCallback)(()=>{b?.body&&(navigator.clipboard.writeText(b.body),D(!0),setTimeout(()=>D(!1),1500))},[b]),ie=e=>Xse[String(e)[0]]??`text-muted-foreground`;return(0,B.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`w-72 shrink-0 border-r flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`p-3 border-b space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-foreground flex-1`,children:`API Endpoints`}),(0,B.jsx)(`button`,{onClick:r,disabled:n,className:`p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,title:`Refresh endpoints`,children:(0,B.jsx)(om,{className:`h-3.5 w-3.5 ${n?`animate-spin`:``}`})})]}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(sm,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`Search endpoints...`,className:`w-full rounded-md border bg-background pl-8 pr-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-ring`})]})]}),(0,B.jsx)(`div`,{className:`flex-1 overflow-auto p-2 space-y-1`,children:n?(0,B.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin mr-2`}),`Discovering APIs...`]}):O.length===0?(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,B.jsx)(qp,{className:`h-6 w-6 opacity-30 mb-2`}),(0,B.jsx)(`span`,{children:i?`No matching endpoints`:`No endpoints found`})]}):O.map(e=>{let t=o.has(e.key)||!!i;return(0,B.jsxs)(by,{open:t,onOpenChange:()=>ee(e.key),children:[(0,B.jsx)(xy,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`w-full flex items-center gap-1.5 px-2 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground transition-colors`,children:[(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0 transition-transform duration-200 ${t?`rotate-90`:``}`}),(0,B.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.label}),(0,B.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums opacity-60`,children:e.endpoints.length})]})}),(0,B.jsx)(Sy,{children:(0,B.jsx)(`div`,{className:`ml-3 space-y-0.5 mt-0.5`,children:e.endpoints.map((e,t)=>(0,B.jsxs)(`button`,{onClick:()=>te(e),className:`w-full text-left flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${c===e?`bg-accent text-accent-foreground`:`hover:bg-muted/50 text-muted-foreground hover:text-foreground`}`,children:[(0,B.jsx)(yx,{variant:`outline`,className:`font-mono text-[9px] shrink-0 px-1 py-0 ${Ix[e.method]||``}`,children:e.method}),(0,B.jsx)(`span`,{className:`truncate`,children:e.desc})]},`${e.method}-${e.path}-${t}`))})})]},e.key)})}),(0,B.jsxs)(`div`,{className:`p-3 border-t space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h4`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:`Query Parameters`}),(0,B.jsxs)(`button`,{onClick:()=>M(),className:`inline-flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,B.jsx)(am,{className:`h-3 w-3`}),`Add`]})]}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Zse.map(e=>(0,B.jsx)(`button`,{onClick:()=>M(e.key,``),className:`text-[10px] px-1.5 py-0.5 rounded border bg-muted/30 text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors font-mono`,title:e.hint,children:e.key},e.key))}),g.length>0&&(0,B.jsx)(`div`,{className:`space-y-1`,children:g.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>F(e.id),className:`h-3 w-3 shrink-0 rounded border accent-primary`}),(0,B.jsx)(`input`,{type:`text`,value:e.key,onChange:t=>P(e.id,`key`,t.target.value),placeholder:`key`,className:`flex-1 min-w-0 rounded border bg-background px-1.5 py-0.5 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-ring`}),(0,B.jsx)(`input`,{type:`text`,value:e.value,onChange:t=>P(e.id,`value`,t.target.value),placeholder:`value`,className:`flex-1 min-w-0 rounded border bg-background px-1.5 py-0.5 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-ring`}),(0,B.jsx)(`button`,{onClick:()=>N(e.id),className:`shrink-0 p-0.5 rounded text-muted-foreground hover:text-destructive transition-colors`,children:(0,B.jsx)(xm,{className:`h-3 w-3`})})]},e.id))})]})]}),(0,B.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`select`,{value:k,onChange:e=>d(e.target.value),className:`rounded-md border bg-background px-2 py-1.5 font-mono text-xs font-semibold focus:outline-none focus:ring-1 focus:ring-ring ${Ix[k]||``}`,children:[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`].map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))}),(0,B.jsx)(`input`,{type:`text`,value:A,onChange:e=>p(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:`/api/v1/...`,onKeyDown:e=>{e.key===`Enter`&&I()}}),(0,B.jsxs)(`button`,{onClick:I,disabled:v||!j,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:[v?(0,B.jsx)(Qp,{className:`h-3.5 w-3.5 animate-spin`}):(0,B.jsx)(im,{className:`h-3.5 w-3.5`}),`Send`]})]}),g.some(e=>e.enabled&&e.key.trim())&&(0,B.jsxs)(`div`,{className:`text-[10px] font-mono text-muted-foreground truncate pl-1`,children:[`→ `,j]})]}),(0,B.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-auto`,children:[[`POST`,`PATCH`,`PUT`].includes(k)&&(0,B.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,B.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,B.jsx)(`textarea`,{value:m,onChange:e=>h(e.target.value),rows:5,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:`{ "key": "value" }`})]}),v&&(0,B.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin mr-2`}),`Sending request...`]}),b&&!v&&(0,B.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-mono font-semibold ${ie(b.status)}`,children:b.status||`ERR`}),(0,B.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,B.jsx)(zp,{className:`h-3 w-3`}),b.duration,`ms`]})]}),(0,B.jsxs)(`button`,{onClick:re,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[E?(0,B.jsx)(Np,{className:`h-3 w-3`}):(0,B.jsx)(Vp,{className:`h-3 w-3`}),E?`Copied`:`Copy`]})]}),(0,B.jsx)(`pre`,{className:`flex-1 overflow-auto p-3 text-xs font-mono bg-muted/10 whitespace-pre-wrap break-all`,children:b.body})]}),!b&&!v&&(0,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,B.jsx)(qp,{className:`h-10 w-10 mx-auto opacity-20`}),(0,B.jsxs)(`p`,{children:[`Select an endpoint or type a URL and click `,(0,B.jsx)(`strong`,{children:`Send`})]}),(0,B.jsx)(`p`,{className:`text-xs opacity-60`,children:`All registered APIs are auto-discovered from the platform`})]})}),S.length>0&&(0,B.jsxs)(`div`,{className:`border-t`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,B.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:[`History (`,S.length,`)`]}),(0,B.jsxs)(`button`,{onClick:()=>C([]),className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,B.jsx)(gm,{className:`h-3 w-3`}),`Clear`]})]}),(0,B.jsx)(`div`,{className:`space-y-0.5 px-2 pb-2 max-h-60 overflow-auto`,children:S.map(e=>(0,B.jsxs)(`div`,{className:`rounded border`,children:[(0,B.jsxs)(`button`,{onClick:()=>T(w===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:[w===e.id?(0,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(yx,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${Ix[e.method]||``}`,children:e.method}),(0,B.jsx)(`span`,{className:`font-mono truncate text-left flex-1`,children:e.url}),(0,B.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${ie(e.status)}`,children:e.status}),(0,B.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]}),(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),ne(e)},className:`shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,title:`Replay request`,children:(0,B.jsx)(im,{className:`h-2.5 w-2.5`})})]}),w===e.id&&(0,B.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))})]})]})]})]})}var Rx=`ToastProvider`,[zx,$se,ece]=Cy(`Toast`),[Bx,tce]=xh(`Toast`,[ece]),[nce,Vx]=Bx(Rx),rce=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=L.useState(null),[l,u]=L.useState(0),d=L.useRef(!1),f=L.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Rx}\`. Expected non-empty \`string\`.`),(0,B.jsx)(zx.Provider,{scope:t,children:(0,B.jsx)(nce,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:L.useCallback(()=>u(e=>e+1),[]),onToastRemove:L.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};rce.displayName=Rx;var ice=`ToastViewport`,ace=[`F8`],Hx=`toast.viewportPause`,Ux=`toast.viewportResume`,oce=L.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=ace,label:i=`Notifications ({hotkey})`,...a}=e,o=Vx(ice,n),s=$se(n),c=L.useRef(null),l=L.useRef(null),u=L.useRef(null),d=L.useRef(null),f=Tm(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;L.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),L.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(Hx);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(Ux);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=L.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...kce(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return L.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Jx(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,B.jsxs)(jne,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,B.jsx)(Wx,{ref:l,onFocusFromOutsideViewport:()=>{Jx(h({tabbingDirection:`forwards`}))}}),(0,B.jsx)(zx.Slot,{scope:n,children:(0,B.jsx)(Eh.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,B.jsx)(Wx,{ref:u,onFocusFromOutsideViewport:()=>{Jx(h({tabbingDirection:`backwards`}))}})]})});oce.displayName=ice;var sce=`ToastFocusProxy`,Wx=L.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=Vx(sce,n);return(0,B.jsx)(Tv,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});Wx.displayName=sce;var Gx=`Toast`,cce=`toast.swipeStart`,lce=`toast.swipeMove`,uce=`toast.swipeCancel`,dce=`toast.swipeEnd`,fce=L.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=wh({prop:r,defaultProp:i??!0,onChange:a,caller:Gx});return(0,B.jsx)(Ih,{present:n||s,children:(0,B.jsx)(hce,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:Oh(e.onPause),onResume:Oh(e.onResume),onSwipeStart:H(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:H(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:H(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:H(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});fce.displayName=Gx;var[pce,mce]=Bx(Gx,{onClose(){}}),hce=L.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=Vx(Gx,n),[g,_]=L.useState(null),v=Tm(t,e=>_(e)),y=L.useRef(null),b=L.useRef(null),x=i||h.duration,S=L.useRef(0),C=L.useRef(x),w=L.useRef(0),{onToastAdd:T,onToastRemove:E}=h,D=Oh(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),O=L.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),S.current=new Date().getTime(),w.current=window.setTimeout(D,e))},[D]);L.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{O(C.current),l?.()},n=()=>{let e=new Date().getTime()-S.current;C.current-=e,window.clearTimeout(w.current),c?.()};return e.addEventListener(Hx,n),e.addEventListener(Ux,t),()=>{e.removeEventListener(Hx,n),e.removeEventListener(Ux,t)}}},[h.viewport,x,c,l,O]),L.useEffect(()=>{a&&!h.isClosePausedRef.current&&O(x)},[a,x,h.isClosePausedRef,O]),L.useEffect(()=>(T(),()=>E()),[T,E]);let ee=L.useMemo(()=>g?Tce(g):null,[g]);return h.viewport?(0,B.jsxs)(B.Fragment,{children:[ee&&(0,B.jsx)(gce,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:ee}),(0,B.jsx)(pce,{scope:n,onClose:D,children:yh.createPortal((0,B.jsx)(zx.ItemSlot,{scope:n,children:(0,B.jsx)(Ane,{asChild:!0,onEscapeKeyDown:H(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||D(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,B.jsx)(Eh.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:H(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:H(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:H(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!b.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(b.current=l,qx(lce,d,f,{discrete:!1})):Ece(l,h.swipeDirection,c)?(b.current=l,qx(cce,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:H(e.onPointerUp,e=>{let t=b.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),b.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};Ece(t,h.swipeDirection,h.swipeThreshold)?qx(dce,p,r,{discrete:!0}):qx(uce,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),gce=e=>{let{__scopeToast:t,children:n,...r}=e,i=Vx(Gx,t),[a,o]=L.useState(!1),[s,c]=L.useState(!1);return Dce(()=>o(!0)),L.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,B.jsx)(Fh,{asChild:!0,children:(0,B.jsx)(Tv,{...r,children:a&&(0,B.jsxs)(B.Fragment,{children:[i.label,` `,n]})})})},_ce=`ToastTitle`,vce=L.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,B.jsx)(Eh.div,{...r,ref:t})});vce.displayName=_ce;var yce=`ToastDescription`,bce=L.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,B.jsx)(Eh.div,{...r,ref:t})});bce.displayName=yce;var xce=`ToastAction`,Sce=L.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,B.jsx)(wce,{altText:n,asChild:!0,children:(0,B.jsx)(Kx,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${xce}\`. Expected non-empty \`string\`.`),null)});Sce.displayName=xce;var Cce=`ToastClose`,Kx=L.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=mce(Cce,n);return(0,B.jsx)(wce,{asChild:!0,children:(0,B.jsx)(Eh.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,i.onClose)})})});Kx.displayName=Cce;var wce=L.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,B.jsx)(Eh.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Tce(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Oce(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Tce(e))}}),t}function qx(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Dh(i,a):i.dispatchEvent(a)}var Ece=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function Dce(e=()=>{}){let t=Oh(e);Sh(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function Oce(e){return e.nodeType===e.ELEMENT_NODE}function kce(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Jx(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var Ace=rce,jce=oce,Mce=fce,Nce=vce,Pce=bce,Fce=Sce,Ice=Kx,Lce=Ace,Rce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(jce,{ref:n,className:V(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));Rce.displayName=jce.displayName;var zce=Pm(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),Bce=L.forwardRef(({className:e,variant:t,...n},r)=>(0,B.jsx)(Mce,{ref:r,className:V(zce({variant:t}),e),...n}));Bce.displayName=Mce.displayName;var Vce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Fce,{ref:n,className:V(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));Vce.displayName=Fce.displayName;var Hce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Ice,{ref:n,className:V(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,B.jsx)(xm,{className:`h-4 w-4`})}));Hce.displayName=Ice.displayName;var Uce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Nce,{ref:n,className:V(`text-sm font-semibold`,e),...t}));Uce.displayName=Nce.displayName;var Wce=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Pce,{ref:n,className:V(`text-sm opacity-90`,e),...t}));Wce.displayName=Pce.displayName;function Gce(){let{toasts:e}=Use();return(0,B.jsxs)(Lce,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,B.jsxs)(Bce,{...i,children:[(0,B.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,B.jsx)(Uce,{children:t}),n&&(0,B.jsx)(Wce,{children:n})]}),r,(0,B.jsx)(Hce,{})]},e)}),(0,B.jsx)(Rce,{})]})}var Kce=`vercel.ai.error`,qce=Symbol.for(Kce),Jce,Yce,Yx=class e extends (Yce=Error,Jce=qce,Yce){constructor({name:e,message:t,cause:n}){super(t),this[Jce]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Kce)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},Xce=`AI_APICallError`,Zce=`vercel.ai.error.${Xce}`,Qce=Symbol.for(Zce),$ce,ele,Xx=class extends (ele=Yx,$ce=Qce,ele){constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=r!=null&&(r===408||r===409||r===429||r>=500),data:c}){super({name:Xce,message:e,cause:o}),this[$ce]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=c}static isInstance(e){return Yx.hasMarker(e,Zce)}},tle=`AI_EmptyResponseBodyError`,nle=`vercel.ai.error.${tle}`,rle=Symbol.for(nle),ile,ale,ole=class extends (ale=Yx,ile=rle,ale){constructor({message:e=`Empty response body`}={}){super({name:tle,message:e}),this[ile]=!0}static isInstance(e){return Yx.hasMarker(e,nle)}};function Zx(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var sle=`AI_InvalidArgumentError`,cle=`vercel.ai.error.${sle}`,lle=Symbol.for(cle),ule,dle,fle=class extends (dle=Yx,ule=lle,dle){constructor({message:e,cause:t,argument:n}){super({name:sle,message:e,cause:t}),this[ule]=!0,this.argument=n}static isInstance(e){return Yx.hasMarker(e,cle)}},ple=`AI_InvalidPromptError`,mle=`vercel.ai.error.${ple}`,hle=Symbol.for(mle),gle,_le,Qx=class extends (_le=Yx,gle=hle,_le){constructor({prompt:e,message:t,cause:n}){super({name:ple,message:`Invalid prompt: ${t}`,cause:n}),this[gle]=!0,this.prompt=e}static isInstance(e){return Yx.hasMarker(e,mle)}},vle=`AI_JSONParseError`,yle=`vercel.ai.error.${vle}`,ble=Symbol.for(yle),xle,Sle,$x=class extends (Sle=Yx,xle=ble,Sle){constructor({text:e,cause:t}){super({name:vle,message:`JSON parsing failed: Text: ${e}. -Error message: ${Zx(t)}`,cause:t}),this[xle]=!0,this.text=e}static isInstance(e){return Yx.hasMarker(e,yle)}},Cle=`AI_TypeValidationError`,wle=`vercel.ai.error.${Cle}`,Tle=Symbol.for(wle),Ele,Dle,eS=class e extends (Dle=Yx,Ele=Tle,Dle){constructor({value:e,cause:t,context:n}){let r=`Type validation failed`;if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=` (`;let e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(`, `),r+=`)`}super({name:Cle,message:`${r}: Value: ${JSON.stringify(e)}. -Error message: ${Zx(t)}`,cause:t}),this[Ele]=!0,this.value=e,this.context=n}static isInstance(e){return Yx.hasMarker(e,wle)}static wrap({value:t,cause:n,context:r}){return e.isInstance(n)&&n.value===t&&n.context?.field===r?.field&&n.context?.entityName===r?.entityName&&n.context?.entityId===r?.entityId?n:new e({value:t,cause:n,context:r})}},Ole=`AI_UnsupportedFunctionalityError`,kle=`vercel.ai.error.${Ole}`,Ale=Symbol.for(kle),jle,Mle,Nle=class extends (Mle=Yx,jle=Ale,Mle){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:Ole,message:t}),this[jle]=!0,this.functionality=e}static isInstance(e){return Yx.hasMarker(e,kle)}},tS;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(tS||={});var Ple;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Ple||={});var U=tS.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),nS=e=>{switch(typeof e){case`undefined`:return U.undefined;case`string`:return U.string;case`number`:return Number.isNaN(e)?U.nan:U.number;case`boolean`:return U.boolean;case`function`:return U.function;case`bigint`:return U.bigint;case`symbol`:return U.symbol;case`object`:return Array.isArray(e)?U.array:e===null?U.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?U.promise:typeof Map<`u`&&e instanceof Map?U.map:typeof Set<`u`&&e instanceof Set?U.set:typeof Date<`u`&&e instanceof Date?U.date:U.object;default:return U.unknown}},W=tS.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),rS=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;re.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};rS.create=e=>new rS(e);var iS=(e,t)=>{let n;switch(e.code){case W.invalid_type:n=e.received===U.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,tS.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${tS.joinValues(e.keys,`, `)}`;break;case W.invalid_union:n=`Invalid input`;break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tS.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${tS.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n=`Invalid function arguments`;break;case W.invalid_return_type:n=`Invalid function return type`;break;case W.invalid_date:n=`Invalid date`;break;case W.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:tS.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case W.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case W.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case W.custom:n=`Invalid input`;break;case W.invalid_intersection_types:n=`Intersection results could not be merged`;break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,tS.assertNever(e)}return{message:n}},Fle=iS;function aS(){return Fle}var oS=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function G(e,t){let n=aS(),r=oS({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===iS?void 0:iS].filter(e=>!!e)});e.common.issues.push(r)}var sS=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return cS;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return cS;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},cS=Object.freeze({status:`aborted`}),lS=e=>({status:`dirty`,value:e}),uS=e=>({status:`valid`,value:e}),Ile=e=>e.status===`aborted`,Lle=e=>e.status===`dirty`,dS=e=>e.status===`valid`,fS=e=>typeof Promise<`u`&&e instanceof Promise,pS;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(pS||={});var mS=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Rle=(e,t)=>{if(dS(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new rS(e.common.issues),this._error}}};function hS(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var gS=class{get description(){return this._def.description}_getType(e){return nS(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sS,ctx:{common:e.parent.common,data:e.data,parsedType:nS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(fS(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nS(e)};return Rle(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nS(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return dS(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>dS(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nS(e)},r=this._parse({data:e,path:n.path,parent:n});return Rle(n,await(fS(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:W.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new WS({schema:this,typeName:K.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return GS.create(this,this._def)}nullable(){return KS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return kS.create(this)}promise(){return US.create(this,this._def)}or(e){return MS.create([this,e],this._def)}and(e){return FS.create(this,e,this._def)}transform(e){return new WS({...hS(this._def),schema:this,typeName:K.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new qS({...hS(this._def),innerType:this,defaultValue:t,typeName:K.ZodDefault})}brand(){return new mue({typeName:K.ZodBranded,type:this,...hS(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new JS({...hS(this._def),innerType:this,catchValue:t,typeName:K.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return hue.create(this,e)}readonly(){return XS.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zle=/^c[^\s-]{8,}$/i,Ble=/^[0-9a-z]+$/,Vle=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Hle=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ule=/^[a-z0-9_-]{21}$/i,Wle=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gle=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Kle=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qle=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Jle,Yle=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xle=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Zle=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Qle=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$le=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eue=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tue=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,nue=RegExp(`^${tue}$`);function rue(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function iue(e){return RegExp(`^${rue(e)}$`)}function aue(e){let t=`${tue}T${rue(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function oue(e,t){return!!((t===`v4`||!t)&&Yle.test(e)||(t===`v6`||!t)&&Zle.test(e))}function sue(e,t){if(!Wle.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function cue(e,t){return!!((t===`v4`||!t)&&Xle.test(e)||(t===`v6`||!t)&&Qle.test(e))}var _S=class e extends gS{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==U.string){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.string,received:t.parsedType}),cS}let t=new sS,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.lengthr.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.lengthe.test(t),{validation:t,code:W.invalid_string,...pS.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...pS.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...pS.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...pS.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...pS.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...pS.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...pS.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...pS.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...pS.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...pS.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...pS.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...pS.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...pS.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...pS.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...pS.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...pS.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...pS.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...pS.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...pS.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...pS.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...pS.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...pS.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...pS.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...pS.errToObj(t)})}nonempty(e){return this.min(1,pS.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew _S({checks:[],typeName:K.ZodString,coerce:e?.coerce??!1,...hS(e)});function lue(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var vS=class e extends gS{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==U.number){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.number,received:t.parsedType}),cS}let t,n=new sS;for(let r of this._def.checks)r.kind===`int`?tS.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?lue(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_finite,message:r.message}),n.dirty()):tS.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,pS.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,pS.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,pS.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,pS.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pS.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:pS.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:pS.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:pS.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:pS.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:pS.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:pS.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:pS.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:pS.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:pS.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuee.kind===`int`||e.kind===`multipleOf`&&tS.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.valuenew vS({checks:[],typeName:K.ZodNumber,coerce:e?.coerce||!1,...hS(e)});var yS=class e extends gS{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==U.bigint)return this._getInvalidInput(e);let t,n=new sS;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):tS.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.bigint,received:t.parsedType}),cS}gte(e,t){return this.setLimit(`min`,e,!0,pS.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,pS.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,pS.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,pS.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pS.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:pS.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:pS.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:pS.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:pS.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:pS.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew yS({checks:[],typeName:K.ZodBigInt,coerce:e?.coerce??!1,...hS(e)});var bS=class extends gS{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==U.boolean){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.boolean,received:t.parsedType}),cS}return uS(e.data)}};bS.create=e=>new bS({typeName:K.ZodBoolean,coerce:e?.coerce||!1,...hS(e)});var xS=class e extends gS{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==U.date){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.date,received:t.parsedType}),cS}if(Number.isNaN(e.data.getTime()))return G(this._getOrReturnCtx(e),{code:W.invalid_date}),cS;let t=new sS,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):tS.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:pS.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:pS.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew xS({checks:[],coerce:e?.coerce||!1,typeName:K.ZodDate,...hS(e)});var SS=class extends gS{_parse(e){if(this._getType(e)!==U.symbol){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.symbol,received:t.parsedType}),cS}return uS(e.data)}};SS.create=e=>new SS({typeName:K.ZodSymbol,...hS(e)});var CS=class extends gS{_parse(e){if(this._getType(e)!==U.undefined){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.undefined,received:t.parsedType}),cS}return uS(e.data)}};CS.create=e=>new CS({typeName:K.ZodUndefined,...hS(e)});var wS=class extends gS{_parse(e){if(this._getType(e)!==U.null){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.null,received:t.parsedType}),cS}return uS(e.data)}};wS.create=e=>new wS({typeName:K.ZodNull,...hS(e)});var TS=class extends gS{constructor(){super(...arguments),this._any=!0}_parse(e){return uS(e.data)}};TS.create=e=>new TS({typeName:K.ZodAny,...hS(e)});var ES=class extends gS{constructor(){super(...arguments),this._unknown=!0}_parse(e){return uS(e.data)}};ES.create=e=>new ES({typeName:K.ZodUnknown,...hS(e)});var DS=class extends gS{_parse(e){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.never,received:t.parsedType}),cS}};DS.create=e=>new DS({typeName:K.ZodNever,...hS(e)});var OS=class extends gS{_parse(e){if(this._getType(e)!==U.undefined){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.void,received:t.parsedType}),cS}return uS(e.data)}};OS.create=e=>new OS({typeName:K.ZodVoid,...hS(e)});var kS=class e extends gS{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==U.array)return G(t,{code:W.invalid_type,expected:U.array,received:t.parsedType}),cS;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(G(t,{code:W.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new mS(t,e,t.path,n)))).then(e=>sS.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new mS(t,e,t.path,n)));return sS.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:pS.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:pS.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:pS.toString(n)}})}nonempty(e){return this.min(1,e)}};kS.create=(e,t)=>new kS({type:e,minLength:null,maxLength:null,exactLength:null,typeName:K.ZodArray,...hS(t)});function AS(e){if(e instanceof jS){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=GS.create(AS(r))}return new jS({...e._def,shape:()=>t})}else if(e instanceof kS)return new kS({...e._def,type:AS(e.element)});else if(e instanceof GS)return GS.create(AS(e.unwrap()));else if(e instanceof KS)return KS.create(AS(e.unwrap()));else if(e instanceof IS)return IS.create(e.items.map(e=>AS(e)));else return e}var jS=class e extends gS{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:tS.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==U.object){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.object,received:t.parsedType}),cS}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof DS&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new mS(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof DS){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(G(n,{code:W.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new mS(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>sS.mergeObjectSync(t,e)):sS.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return pS.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:pS.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:K.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of tS.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of tS.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return AS(this)}partial(t){let n={};for(let e of tS.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of tS.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof GS;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return pue(tS.objectKeys(this.shape))}};jS.create=(e,t)=>new jS({shape:()=>e,unknownKeys:`strip`,catchall:DS.create(),typeName:K.ZodObject,...hS(t)}),jS.strictCreate=(e,t)=>new jS({shape:()=>e,unknownKeys:`strict`,catchall:DS.create(),typeName:K.ZodObject,...hS(t)}),jS.lazycreate=(e,t)=>new jS({shape:e,unknownKeys:`strip`,catchall:DS.create(),typeName:K.ZodObject,...hS(t)});var MS=class extends gS{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new rS(e.ctx.common.issues));return G(t,{code:W.invalid_union,unionErrors:n}),cS}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new rS(e));return G(t,{code:W.invalid_union,unionErrors:i}),cS}}get options(){return this._def.options}};MS.create=(e,t)=>new MS({options:e,typeName:K.ZodUnion,...hS(t)});var NS=e=>e instanceof zS?NS(e.schema):e instanceof WS?NS(e.innerType()):e instanceof BS?[e.value]:e instanceof VS?e.options:e instanceof HS?tS.objectValues(e.enum):e instanceof qS?NS(e._def.innerType):e instanceof CS?[void 0]:e instanceof wS?[null]:e instanceof GS?[void 0,...NS(e.unwrap())]:e instanceof KS?[null,...NS(e.unwrap())]:e instanceof mue||e instanceof XS?NS(e.unwrap()):e instanceof JS?NS(e._def.innerType):[],uue=class e extends gS{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.object)return G(t,{code:W.invalid_type,expected:U.object,received:t.parsedType}),cS;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(G(t,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),cS)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=NS(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:K.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...hS(r)})}};function PS(e,t){let n=nS(e),r=nS(t);if(e===t)return{valid:!0,data:e};if(n===U.object&&r===U.object){let n=tS.objectKeys(t),r=tS.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=PS(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===U.array&&r===U.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r{if(Ile(e)||Ile(r))return cS;let i=PS(e.value,r.value);return i.valid?((Lle(e)||Lle(r))&&t.dirty(),{status:t.value,value:i.data}):(G(n,{code:W.invalid_intersection_types}),cS)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};FS.create=(e,t,n)=>new FS({left:e,right:t,typeName:K.ZodIntersection,...hS(n)});var IS=class e extends gS{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.array)return G(n,{code:W.invalid_type,expected:U.array,received:n.parsedType}),cS;if(n.data.lengththis._def.items.length&&(G(n,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new mS(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>sS.mergeArray(t,e)):sS.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};IS.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new IS({items:e,typeName:K.ZodTuple,rest:null,...hS(t)})};var due=class e extends gS{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.object)return G(n,{code:W.invalid_type,expected:U.object,received:n.parsedType}),cS;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new mS(n,e,n.path,e)),value:a._parse(new mS(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?sS.mergeObjectAsync(t,r):sS.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof gS?new e({keyType:t,valueType:n,typeName:K.ZodRecord,...hS(r)}):new e({keyType:_S.create(),valueType:t,typeName:K.ZodRecord,...hS(n)})}},LS=class extends gS{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.map)return G(n,{code:W.invalid_type,expected:U.map,received:n.parsedType}),cS;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new mS(n,e,n.path,[a,`key`])),value:i._parse(new mS(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return cS;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return cS;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};LS.create=(e,t,n)=>new LS({valueType:t,keyType:e,typeName:K.ZodMap,...hS(n)});var RS=class e extends gS{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.set)return G(n,{code:W.invalid_type,expected:U.set,received:n.parsedType}),cS;let r=this._def;r.minSize!==null&&n.data.sizer.maxSize.value&&(G(n,{code:W.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return cS;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new mS(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:pS.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:pS.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};RS.create=(e,t)=>new RS({valueType:e,minSize:null,maxSize:null,typeName:K.ZodSet,...hS(t)});var fue=class e extends gS{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.function)return G(t,{code:W.invalid_type,expected:U.function,received:t.parsedType}),cS;function n(e,n){return oS({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,aS(),iS].filter(e=>!!e),issueData:{code:W.invalid_arguments,argumentsError:n}})}function r(e,n){return oS({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,aS(),iS].filter(e=>!!e),issueData:{code:W.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof US){let e=this;return uS(async function(...t){let o=new rS([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return uS(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new rS([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new rS([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:IS.create(t).rest(ES.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||IS.create([]).rest(ES.create()),returns:n||ES.create(),typeName:K.ZodFunction,...hS(r)})}},zS=class extends gS{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};zS.create=(e,t)=>new zS({getter:e,typeName:K.ZodLazy,...hS(t)});var BS=class extends gS{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return G(t,{received:t.data,code:W.invalid_literal,expected:this._def.value}),cS}return{status:`valid`,value:e.data}}get value(){return this._def.value}};BS.create=(e,t)=>new BS({value:e,typeName:K.ZodLiteral,...hS(t)});function pue(e,t){return new VS({values:e,typeName:K.ZodEnum,...hS(t)})}var VS=class e extends gS{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{expected:tS.joinValues(n),received:t.parsedType,code:W.invalid_type}),cS}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{received:t.data,code:W.invalid_enum_value,options:n}),cS}return uS(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};VS.create=pue;var HS=class extends gS{_parse(e){let t=tS.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==U.string&&n.parsedType!==U.number){let e=tS.objectValues(t);return G(n,{expected:tS.joinValues(e),received:n.parsedType,code:W.invalid_type}),cS}if(this._cache||=new Set(tS.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=tS.objectValues(t);return G(n,{received:n.data,code:W.invalid_enum_value,options:e}),cS}return uS(e.data)}get enum(){return this._def.values}};HS.create=(e,t)=>new HS({values:e,typeName:K.ZodNativeEnum,...hS(t)});var US=class extends gS{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==U.promise&&t.common.async===!1?(G(t,{code:W.invalid_type,expected:U.promise,received:t.parsedType}),cS):uS((t.parsedType===U.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};US.create=(e,t)=>new US({type:e,typeName:K.ZodPromise,...hS(t)});var WS=class extends gS{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===K.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{G(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return cS;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?cS:r.status===`dirty`||t.value===`dirty`?lS(r.value):r});{if(t.value===`aborted`)return cS;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?cS:r.status===`dirty`||t.value===`dirty`?lS(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?cS:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?cS:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!dS(e))return cS;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>dS(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):cS);tS.assertNever(r)}};WS.create=(e,t,n)=>new WS({schema:e,typeName:K.ZodEffects,effect:t,...hS(n)}),WS.createWithPreprocess=(e,t,n)=>new WS({schema:t,effect:{type:`preprocess`,transform:e},typeName:K.ZodEffects,...hS(n)});var GS=class extends gS{_parse(e){return this._getType(e)===U.undefined?uS(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};GS.create=(e,t)=>new GS({innerType:e,typeName:K.ZodOptional,...hS(t)});var KS=class extends gS{_parse(e){return this._getType(e)===U.null?uS(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};KS.create=(e,t)=>new KS({innerType:e,typeName:K.ZodNullable,...hS(t)});var qS=class extends gS{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===U.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};qS.create=(e,t)=>new qS({innerType:e,typeName:K.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...hS(t)});var JS=class extends gS{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return fS(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new rS(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new rS(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};JS.create=(e,t)=>new JS({innerType:e,typeName:K.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...hS(t)});var YS=class extends gS{_parse(e){if(this._getType(e)!==U.nan){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.nan,received:t.parsedType}),cS}return{status:`valid`,value:e.data}}};YS.create=e=>new YS({typeName:K.ZodNaN,...hS(e)});var mue=class extends gS{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},hue=class e extends gS{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?cS:e.status===`dirty`?(t.dirty(),lS(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?cS:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:K.ZodPipeline})}},XS=class extends gS{_parse(e){let t=this._def.innerType._parse(e),n=e=>(dS(e)&&(e.value=Object.freeze(e.value)),e);return fS(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};XS.create=(e,t)=>new XS({innerType:e,typeName:K.ZodReadonly,...hS(t)}),jS.lazycreate;var K;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(K||={}),_S.create,vS.create,YS.create,yS.create,bS.create,xS.create,SS.create,CS.create,wS.create,TS.create,ES.create,DS.create,OS.create,kS.create,jS.create,jS.strictCreate,MS.create,uue.create,FS.create,IS.create,due.create,LS.create,RS.create,fue.create,zS.create,BS.create,VS.create,HS.create,US.create,WS.create,GS.create,KS.create,WS.createWithPreprocess,hue.create;var gue=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function ZS(e){}function _ue(e){if(typeof e==`function`)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=ZS,onError:n=ZS,onRetry:r=ZS,onComment:i}=e,a=``,o=!0,s,c=``,l=``;function u(e){let t=o?e.replace(/^\xEF\xBB\xBF/,``):e,[n,r]=vue(`${a}${t}`);for(let e of n)d(e);a=r,o=!1}function d(e){if(e===``){p();return}if(e.startsWith(`:`)){i&&i(e.slice(e.startsWith(`: `)?2:1));return}let t=e.indexOf(`:`);if(t!==-1){let n=e.slice(0,t),r=e[t+1]===` `?2:1;f(n,e.slice(t+r),e);return}f(e,``,e)}function f(e,t,i){switch(e){case`event`:l=t;break;case`data`:c=`${c}${t} -`;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new gue(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new gue(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function p(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(` -`)?c.slice(0,-1):c}),s=void 0,c=``,l=``}function m(e={}){a&&e.consume&&d(a),o=!0,s=void 0,c=``,l=``,a=``}return{feed:u,reset:m}}function vue(e){let t=[],n=``,r=0;for(;r{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};function QS(...e){return e.reduce((e,t)=>({...e,...t??{}}),{})}async function bue(e,t){if(e==null)return Promise.resolve();let n=t?.abortSignal;return new Promise((t,r)=>{if(n?.aborted){r(xue());return}let i=setTimeout(()=>{a(),t()},e),a=()=>{clearTimeout(i),n?.removeEventListener(`abort`,o)},o=()=>{a(),r(xue())};n?.addEventListener(`abort`,o)})}function xue(){return new DOMException(`Delay was aborted`,`AbortError`)}var $S=class{constructor(){this.status={type:`pending`},this._resolve=void 0,this._reject=void 0}get promise(){return this._promise||=new Promise((e,t)=>{this.status.type===`resolved`?e(this.status.value):this.status.type===`rejected`&&t(this.status.error),this._resolve=e,this._reject=t}),this._promise}resolve(e){var t;this.status={type:`resolved`,value:e},this._promise&&((t=this._resolve)==null||t.call(this,e))}reject(e){var t;this.status={type:`rejected`,error:e},this._promise&&((t=this._reject)==null||t.call(this,e))}isResolved(){return this.status.type===`resolved`}isRejected(){return this.status.type===`rejected`}isPending(){return this.status.type===`pending`}};function eC(e){return Object.fromEntries([...e.headers])}var{btoa:Sue,atob:Cue}=globalThis;function tC(e){let t=Cue(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.codePointAt(0))}function nC(e){let t=``;for(let n=0;nn)throw new rC({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes (Content-Length: ${e}).`})}let i=e.body;if(i==null)return new Uint8Array;let a=i.getReader(),o=[],s=0;try{for(;;){let{done:e,value:r}=await a.read();if(e)break;if(s+=r.length,s>n)throw new rC({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes.`});o.push(r)}}finally{try{await a.cancel()}finally{a.releaseLock()}}let c=new Uint8Array(s),l=0;for(let e of o)c.set(e,l),l+=e.length;return c}function jue(e){let t;try{t=new URL(e)}catch{throw new rC({url:e,message:`Invalid URL: ${e}`})}if(t.protocol===`data:`)return;if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new rC({url:e,message:`URL scheme must be http, https, or data, got ${t.protocol}`});let n=t.hostname;if(!n)throw new rC({url:e,message:`URL must have a hostname`});if(n===`localhost`||n.endsWith(`.local`)||n.endsWith(`.localhost`))throw new rC({url:e,message:`URL with hostname ${n} is not allowed`});if(n.startsWith(`[`)&&n.endsWith(`]`)){if(Nue(n.slice(1,-1)))throw new rC({url:e,message:`URL with IPv6 address ${n} is not allowed`});return}if(Mue(n)){if(iC(n))throw new rC({url:e,message:`URL with IP address ${n} is not allowed`});return}}function Mue(e){let t=e.split(`.`);return t.length===4?t.every(e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255&&String(t)===e}):!1}function iC(e){let[t,n]=e.split(`.`).map(Number);return t===0||t===10||t===127||t===169&&n===254||t===172&&n>=16&&n<=31||t===192&&n===168}function Nue(e){let t=e.toLowerCase();if(t===`::1`||t===`::`)return!0;if(t.startsWith(`::ffff:`)){let e=t.slice(7);if(Mue(e))return iC(e);let n=e.split(`:`);if(n.length===2){let e=parseInt(n[0],16),t=parseInt(n[1],16);if(!isNaN(e)&&!isNaN(t))return iC(`${e>>8&255}.${e&255}.${t>>8&255}.${t&255}`)}}return!!(t.startsWith(`fc`)||t.startsWith(`fd`)||t.startsWith(`fe80`))}var aC=({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i`${e}${r}${i()}`},Pue=aC();function oC(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}function sC(e){return(e instanceof Error||e instanceof DOMException)&&(e.name===`AbortError`||e.name===`ResponseAborted`||e.name===`TimeoutError`)}var Fue=[`fetch failed`,`failed to fetch`],Iue=[`ConnectionRefused`,`ConnectionClosed`,`FailedToOpenSocket`,`ECONNRESET`,`ECONNREFUSED`,`ETIMEDOUT`,`EPIPE`];function Lue(e){if(!(e instanceof Error))return!1;let t=e.code;return!!(typeof t==`string`&&Iue.includes(t))}function Rue({error:e,url:t,requestBodyValues:n}){if(sC(e))return e;if(e instanceof TypeError&&Fue.includes(e.message.toLowerCase())){let r=e.cause;if(r!=null)return new Xx({message:`Cannot connect to API: ${r.message}`,cause:r,url:t,requestBodyValues:n,isRetryable:!0})}return Lue(e)?new Xx({message:`Cannot connect to API: ${e.message}`,cause:e,url:t,requestBodyValues:n,isRetryable:!0}):e}function cC(e=globalThis){return e.window?`runtime/browser`:e.navigator?.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:e.process?.versions?.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?`runtime/vercel-edge`:`runtime/unknown`}function lC(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}function uC(e,...t){let n=new Headers(lC(e)),r=n.get(`user-agent`)||``;return n.set(`user-agent`,[r,...t].filter(Boolean).join(` `)),Object.fromEntries(n.entries())}var zue=`4.0.23`,Bue=()=>globalThis.fetch,dC=async({url:e,headers:t={},successfulResponseHandler:n,failedResponseHandler:r,abortSignal:i,fetch:a=Bue()})=>{try{let o=await a(e,{method:`GET`,headers:uC(t,`ai-sdk/provider-utils/${zue}`,cC()),signal:i}),s=eC(o);if(!o.ok){let t;try{t=await r({response:o,url:e,requestBodyValues:{}})}catch(t){throw sC(t)||Xx.isInstance(t)?t:new Xx({message:`Failed to process error response`,cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}throw t.value}try{return await n({response:o,url:e,requestBodyValues:{}})}catch(t){throw t instanceof Error&&(sC(t)||Xx.isInstance(t))?t:new Xx({message:`Failed to process successful response`,cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}}catch(t){throw Rue({error:t,url:e,requestBodyValues:{}})}};function Vue({mediaType:e,url:t,supportedUrls:n}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(n).map(([e,t])=>{let n=e.toLowerCase();return n===`*`||n===`*/*`?{mediaTypePrefix:``,regexes:t}:{mediaTypePrefix:n.replace(/\*/,``),regexes:t}}).filter(({mediaTypePrefix:t})=>e.startsWith(t)).flatMap(({regexes:e})=>e).some(e=>e.test(t))}function fC({settingValue:e,environmentVariableName:t}){if(typeof e==`string`||!(e!=null||typeof process>`u`)&&(e={}[t],!(e==null||typeof e!=`string`)))return e}var Hue=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Uue=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Wue(e){let t=JSON.parse(e);return typeof t!=`object`||!t||Hue.test(e)===!1&&Uue.test(e)===!1?t:Gue(t)}function Gue(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&n.constructor!==null&&typeof n.constructor==`object`&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function Kue(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return Wue(e)}try{return Wue(e)}finally{Error.stackTraceLimit=t}}function pC(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){e.additionalProperties=!1;let{properties:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=mC(t[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(mC):mC(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(mC)),e.allOf!=null&&(e.allOf=e.allOf.map(mC)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(mC));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=mC(t[e]);return e}function mC(e){return typeof e==`boolean`?e:pC(e)}var que=Symbol(`Let zodToJsonSchema decide on which parser to use`),Jue={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`},Yue=e=>typeof e==`string`?{...Jue,name:e}:{...Jue,...e};function hC(){return{}}function Xue(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==K.ZodAny&&(n.items=wC(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}function Zue(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function Que(){return{type:`boolean`}}function $ue(e,t){return wC(e.type._def,t)}var ede=(e,t)=>wC(e.innerType._def,t);function tde(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>tde(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return nde(e)}}var nde=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value;break}return t};function rde(e,t){return{...wC(e.innerType._def,t),default:e.defaultValue()}}function ide(e,t){return t.effectStrategy===`input`?wC(e.schema._def,t):hC()}function ade(e){return{type:`string`,enum:Array.from(e.values)}}var ode=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function sde(e,t){let n=[wC(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),wC(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(ode(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}r.push(t)}}),r.length?{allOf:r}:void 0}function cde(e){let t=typeof e.value;return t!==`bigint`&&t!==`number`&&t!==`boolean`&&t!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:{type:t===`bigint`?`integer`:t,const:e.value}}var gC=void 0,_C={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(gC===void 0&&(gC=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),gC),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function lde(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value;break;case`max`:n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`email`:switch(t.emailStrategy){case`format:email`:yC(n,`email`,r.message,t);break;case`format:idn-email`:yC(n,`idn-email`,r.message,t);break;case`pattern:zod`:bC(n,_C.email,r.message,t);break}break;case`url`:yC(n,`uri`,r.message,t);break;case`uuid`:yC(n,`uuid`,r.message,t);break;case`regex`:bC(n,r.regex,r.message,t);break;case`cuid`:bC(n,_C.cuid,r.message,t);break;case`cuid2`:bC(n,_C.cuid2,r.message,t);break;case`startsWith`:bC(n,RegExp(`^${vC(r.value,t)}`),r.message,t);break;case`endsWith`:bC(n,RegExp(`${vC(r.value,t)}$`),r.message,t);break;case`datetime`:yC(n,`date-time`,r.message,t);break;case`date`:yC(n,`date`,r.message,t);break;case`time`:yC(n,`time`,r.message,t);break;case`duration`:yC(n,`duration`,r.message,t);break;case`length`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`includes`:bC(n,RegExp(vC(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&yC(n,`ipv4`,r.message,t),r.version!==`v4`&&yC(n,`ipv6`,r.message,t);break;case`base64url`:bC(n,_C.base64url,r.message,t);break;case`jwt`:bC(n,_C.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&bC(n,_C.ipv4Cidr,r.message,t),r.version!==`v4`&&bC(n,_C.ipv6Cidr,r.message,t);break;case`emoji`:bC(n,_C.emoji(),r.message,t);break;case`ulid`:bC(n,_C.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:yC(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:bC(n,_C.base64,r.message,t);break}break;case`nanoid`:bC(n,_C.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:}return n}function vC(e,t){return t.patternStrategy===`escape`?dde(e):e}var ude=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function dde(e){let t=``;for(let n=0;ne.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function bC(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:xC(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=xC(t,r)}function xC(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;etypeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function mde(){return{not:hC()}}function hde(){return{type:`null`}}var CC={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function gde(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in CC&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=CC[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return _de(e,t)}var _de=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>wC(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function vde(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[CC[e.innerType._def.typeName],`null`]};let n=wC(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function yde(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function bde(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=Sde(a),s=wC(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=xde(e,t);return a!==void 0&&(n.additionalProperties=a),n}function xde(e,t){if(e.catchall._def.typeName!==`ZodNever`)return wC(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Sde(e){try{return e.isOptional()}catch{return!0}}var Cde=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return wC(e.innerType._def,t);let n=wC(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:hC()},n]}:hC()},wde=(e,t)=>{if(t.pipeStrategy===`input`)return wC(e.in._def,t);if(t.pipeStrategy===`output`)return wC(e.out._def,t);let n=wC(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,wC(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function Tde(e,t){return wC(e.type._def,t)}function Ede(e,t){let n={type:`array`,uniqueItems:!0,items:wC(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function Dde(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>wC(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:wC(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>wC(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function Ode(){return{not:hC()}}function kde(){return hC()}var Ade=(e,t)=>wC(e.innerType._def,t),jde=(e,t,n)=>{switch(t){case K.ZodString:return lde(e,n);case K.ZodNumber:return yde(e);case K.ZodObject:return bde(e,n);case K.ZodBigInt:return Zue(e);case K.ZodBoolean:return Que();case K.ZodDate:return tde(e,n);case K.ZodUndefined:return Ode();case K.ZodNull:return hde();case K.ZodArray:return Xue(e,n);case K.ZodUnion:case K.ZodDiscriminatedUnion:return gde(e,n);case K.ZodIntersection:return sde(e,n);case K.ZodTuple:return Dde(e,n);case K.ZodRecord:return SC(e,n);case K.ZodLiteral:return cde(e);case K.ZodEnum:return ade(e);case K.ZodNativeEnum:return pde(e);case K.ZodNullable:return vde(e,n);case K.ZodOptional:return Cde(e,n);case K.ZodMap:return fde(e,n);case K.ZodSet:return Ede(e,n);case K.ZodLazy:return()=>e.getter()._def;case K.ZodPromise:return Tde(e,n);case K.ZodNaN:case K.ZodNever:return mde();case K.ZodEffects:return ide(e,n);case K.ZodAny:return hC();case K.ZodUnknown:return kde();case K.ZodDefault:return rde(e,n);case K.ZodBranded:return $ue(e,n);case K.ZodReadonly:return Ade(e,n);case K.ZodCatch:return ede(e,n);case K.ZodPipeline:return wde(e,n);case K.ZodFunction:case K.ZodVoid:case K.ZodSymbol:return;default:return(e=>void 0)(t)}},Mde=(e,t)=>{let n=0;for(;n{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:Mde(t.currentPath,e.path)};case`none`:case`seen`:return e.path.lengtht.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),hC()):t.$refStrategy===`seen`?hC():void 0}},Pde=(e,t,n)=>(e.description&&(n.description=e.description),n),Fde=e=>{let t=Yue(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},Ide=(e,t)=>{let n=Fde(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:wC(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??hC()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=wC(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??hC(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},TC=Symbol.for(`vercel.ai.schema`);function EC(e){let t;return()=>(t??=e(),t)}function DC(e,{validate:t}={}){return{[TC]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function Lde(e){return typeof e==`object`&&!!e&&TC in e&&e[TC]===!0&&`jsonSchema`in e&&`validate`in e}function OC(e){return e==null?DC({properties:{},additionalProperties:!1}):Lde(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?kC(e):Rde(e):e()}function Rde(e){return DC(()=>pC(e[`~standard`].jsonSchema.input({target:`draft-07`})),{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new eS({value:t,cause:n.issues})}}})}function zde(e,t){let n=t?.useReferences??!1;return DC(()=>Ide(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Bde(e,t){let n=t?.useReferences??!1;return DC(()=>pC(s(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await f(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Vde(e){return`_zod`in e}function kC(e,t){return Vde(e)?Bde(e,t):zde(e,t)}async function AC({value:e,schema:t,context:n}){let r=await jC({value:e,schema:t,context:n});if(!r.success)throw eS.wrap({value:e,cause:r.error,context:n});return r.value}async function jC({value:e,schema:t,context:n}){let r=OC(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:eS.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:eS.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function Hde({text:e,schema:t}){try{let n=Kue(e);return t==null?n:AC({value:n,schema:t})}catch(t){throw $x.isInstance(t)||eS.isInstance(t)?t:new $x({text:e,cause:t})}}async function MC({text:e,schema:t}){try{let n=Kue(e);return t==null?{success:!0,value:n,rawValue:n}:await jC({value:n,schema:t})}catch(t){return{success:!1,error:$x.isInstance(t)?t:new $x({text:e,cause:t}),rawValue:void 0}}}function NC({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new yue).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await MC({text:e,schema:t}))}}))}var Ude=()=>globalThis.fetch,PC=async({url:e,headers:t,body:n,failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o})=>Wde({url:e,headers:{"Content-Type":`application/json`,...t},body:{content:JSON.stringify(n),values:n},failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o}),Wde=async({url:e,headers:t={},body:n,successfulResponseHandler:r,failedResponseHandler:i,abortSignal:a,fetch:o=Ude()})=>{try{let s=await o(e,{method:`POST`,headers:uC(t,`ai-sdk/provider-utils/${zue}`,cC()),body:n.content,signal:a}),c=eC(s);if(!s.ok){let t;try{t=await i({response:s,url:e,requestBodyValues:n.values})}catch(t){throw sC(t)||Xx.isInstance(t)?t:new Xx({message:`Failed to process error response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}throw t.value}try{return await r({response:s,url:e,requestBodyValues:n.values})}catch(t){throw t instanceof Error&&(sC(t)||Xx.isInstance(t))?t:new Xx({message:`Failed to process successful response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}}catch(t){throw Rue({error:t,url:e,requestBodyValues:n.values})}};function FC(e){return e}function IC({id:e,inputSchema:t,outputSchema:n,supportsDeferredResults:r}){return({execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:c,onInputAvailable:l,...u})=>FC({type:`provider`,id:e,args:u,inputSchema:t,outputSchema:n,execute:i,needsApproval:a,toModelOutput:o,onInputStart:s,onInputDelta:c,onInputAvailable:l,supportsDeferredResults:r})}async function LC(e){return typeof e==`function`&&(e=e()),Promise.resolve(e)}var RC=({errorSchema:e,errorToMessage:t,isRetryable:n})=>async({response:r,url:i,requestBodyValues:a})=>{let o=await r.text(),s=eC(r);if(o.trim()===``)return{responseHeaders:s,value:new Xx({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})};try{let c=await Hde({text:o,schema:e});return{responseHeaders:s,value:new Xx({message:t(c),url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,data:c,isRetryable:n?.(r,c)})}}catch{return{responseHeaders:s,value:new Xx({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})}}},Gde=e=>async({response:t})=>{let n=eC(t);if(t.body==null)throw new ole({});return{responseHeaders:n,value:NC({stream:t.body,schema:e})}},zC=e=>async({response:t,url:n,requestBodyValues:r})=>{let i=await t.text(),a=await MC({text:i,schema:e}),o=eC(t);if(!a.success)throw new Xx({message:`Invalid JSON response`,cause:a.error,statusCode:t.status,responseHeaders:o,responseBody:i,url:n,requestBodyValues:r});return{responseHeaders:o,value:a.value,rawValue:a.rawValue}};function Kde(e){return e?.replace(/\/$/,``)}function qde(e){return e!=null&&typeof e[Symbol.asyncIterator]==`function`}async function*Jde({execute:e,input:t,options:n}){let r=e(t,n);if(qde(r)){let e;for await(let t of r)e=t,yield{type:`preliminary`,output:t};yield{type:`final`,output:e}}else yield{type:`final`,output:await r}}var Yde=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);var u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}})),BC=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getContext:()=>u.getContext,getVercelOidcToken:()=>d,getVercelOidcTokenSync:()=>f}),t.exports=c(l);var u=Yde();async function d(){return``}function f(){return``}}))(),VC=Symbol.for(`vercel.ai.gateway.error`),HC,UC,WC=class e extends (UC=Error,HC=VC,UC){constructor({message:e,statusCode:t=500,cause:n,generationId:r}){super(r?`${e} [${r}]`:e),this[HC]=!0,this.statusCode=t,this.cause=n,this.generationId=r}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return typeof e==`object`&&!!e&&VC in e&&e[VC]===!0}},GC=`GatewayAuthenticationError`,Xde=`vercel.ai.gateway.error.${GC}`,KC=Symbol.for(Xde),qC,JC,YC=class e extends (JC=WC,qC=KC,JC){constructor({message:e=`Authentication failed`,statusCode:t=401,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[qC]=!0,this.name=GC,this.type=`authentication_error`}static isInstance(e){return WC.hasMarker(e)&&KC in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,message:r=`Authentication failed`,statusCode:i=401,cause:a,generationId:o}){let s;return s=t?`AI Gateway authentication failed: Invalid API key. - -Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys - -Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:n?`AI Gateway authentication failed: Invalid OIDC token. - -Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token. - -Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`:`AI Gateway authentication failed: No authentication provided. - -Option 1 - API key: -Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys -Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable. - -Option 2 - OIDC token: -Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,new e({message:s,statusCode:i,cause:a,generationId:o})}},XC=`GatewayInvalidRequestError`,Zde=`vercel.ai.gateway.error.${XC}`,ZC=Symbol.for(Zde),QC,$C,Qde=class extends ($C=WC,QC=ZC,$C){constructor({message:e=`Invalid request`,statusCode:t=400,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[QC]=!0,this.name=XC,this.type=`invalid_request_error`}static isInstance(e){return WC.hasMarker(e)&&ZC in e}},ew=`GatewayRateLimitError`,$de=`vercel.ai.gateway.error.${ew}`,tw=Symbol.for($de),nw,rw,efe=class extends (rw=WC,nw=tw,rw){constructor({message:e=`Rate limit exceeded`,statusCode:t=429,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[nw]=!0,this.name=ew,this.type=`rate_limit_exceeded`}static isInstance(e){return WC.hasMarker(e)&&tw in e}},iw=`GatewayModelNotFoundError`,tfe=`vercel.ai.gateway.error.${iw}`,aw=Symbol.for(tfe),nfe=EC(()=>kC(h({modelId:r()}))),ow,sw,rfe=class extends (sw=WC,ow=aw,sw){constructor({message:e=`Model not found`,statusCode:t=404,modelId:n,cause:r,generationId:i}={}){super({message:e,statusCode:t,cause:r,generationId:i}),this[ow]=!0,this.name=iw,this.type=`model_not_found`,this.modelId=n}static isInstance(e){return WC.hasMarker(e)&&aw in e}},cw=`GatewayInternalServerError`,ife=`vercel.ai.gateway.error.${cw}`,lw=Symbol.for(ife),uw,dw,fw=class extends (dw=WC,uw=lw,dw){constructor({message:e=`Internal server error`,statusCode:t=500,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[uw]=!0,this.name=cw,this.type=`internal_server_error`}static isInstance(e){return WC.hasMarker(e)&&lw in e}},pw=`GatewayResponseError`,afe=`vercel.ai.gateway.error.${pw}`,mw=Symbol.for(afe),hw,gw,ofe=class extends (gw=WC,hw=mw,gw){constructor({message:e=`Invalid response from Gateway`,statusCode:t=502,response:n,validationError:r,cause:i,generationId:a}={}){super({message:e,statusCode:t,cause:i,generationId:a}),this[hw]=!0,this.name=pw,this.type=`response_error`,this.response=n,this.validationError=r}static isInstance(e){return WC.hasMarker(e)&&mw in e}};async function _w({response:e,statusCode:t,defaultMessage:n=`Gateway request failed`,cause:r,authMethod:i}){let a=await jC({value:e,schema:sfe});if(!a.success){let i=typeof e==`object`&&e&&`generationId`in e?e.generationId:void 0;return new ofe({message:`Invalid error response format: ${n}`,statusCode:t,response:e,validationError:a.error,cause:r,generationId:i})}let o=a.value,s=o.error.type,c=o.error.message,l=o.generationId??void 0;switch(s){case`authentication_error`:return YC.createContextualError({apiKeyProvided:i===`api-key`,oidcTokenProvided:i===`oidc`,statusCode:t,cause:r,generationId:l});case`invalid_request_error`:return new Qde({message:c,statusCode:t,cause:r,generationId:l});case`rate_limit_exceeded`:return new efe({message:c,statusCode:t,cause:r,generationId:l});case`model_not_found`:{let e=await jC({value:o.error.param,schema:nfe});return new rfe({message:c,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:r,generationId:l})}case`internal_server_error`:return new fw({message:c,statusCode:t,cause:r,generationId:l});default:return new fw({message:c,statusCode:t,cause:r,generationId:l})}}var sfe=EC(()=>kC(h({error:h({message:r(),type:r().nullish(),param:u().nullish(),code:l([r(),P()]).nullish()}),generationId:r().nullish()}))),vw=`GatewayTimeoutError`,cfe=`vercel.ai.gateway.error.${vw}`,yw=Symbol.for(cfe),bw,xw,Sw=class e extends (xw=WC,bw=yw,xw){constructor({message:e=`Request timed out`,statusCode:t=408,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[bw]=!0,this.name=vw,this.type=`timeout_error`}static isInstance(e){return WC.hasMarker(e)&&yw in e}static createTimeoutError({originalMessage:t,statusCode:n=408,cause:r,generationId:i}){return new e({message:`Gateway request timed out: ${t} - - This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`,statusCode:n,cause:r,generationId:i})}};function Cw(e){if(!(e instanceof Error))return!1;let t=e.code;return typeof t==`string`?[`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CONNECT_TIMEOUT`].includes(t):!1}async function ww(e,t){return WC.isInstance(e)?e:Cw(e)?Sw.createTimeoutError({originalMessage:e instanceof Error?e.message:`Unknown error`,cause:e}):Xx.isInstance(e)?e.cause&&Cw(e.cause)?Sw.createTimeoutError({originalMessage:e.message,cause:e}):await _w({response:lfe(e),statusCode:e.statusCode??500,defaultMessage:`Gateway request failed`,cause:e,authMethod:t}):await _w({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:`Unknown Gateway error`,cause:e,authMethod:t})}function lfe(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return JSON.parse(e.responseBody)}catch{return e.responseBody}return{}}var Tw=`ai-gateway-auth-method`;async function Ew(e){let t=await jC({value:e[Tw],schema:ufe});return t.success?t.value:void 0}var ufe=EC(()=>kC(l([m(`api-key`),m(`oidc`)]))),Dw=class{constructor(e){this.config=e}async getAvailableModels(){try{let{value:e}=await dC({url:`${this.config.baseURL}/config`,headers:await LC(this.config.headers()),successfulResponseHandler:zC(dfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await ww(e)}}async getCredits(){try{let{value:e}=await dC({url:`${new URL(this.config.baseURL).origin}/v1/credits`,headers:await LC(this.config.headers()),successfulResponseHandler:zC(ffe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await ww(e)}}},dfe=EC(()=>kC(h({models:C(h({id:r(),name:r(),description:r().nullish(),pricing:h({input:r(),output:r(),input_cache_read:r().nullish(),input_cache_write:r().nullish()}).transform(({input:e,output:t,input_cache_read:n,input_cache_write:r})=>({input:e,output:t,...n?{cachedInputTokens:n}:{},...r?{cacheCreationInputTokens:r}:{}})).nullish(),specification:h({specificationVersion:m(`v3`),provider:r(),modelId:r()}),modelType:E([`embedding`,`image`,`language`,`video`]).nullish()}))}))),ffe=EC(()=>kC(h({balance:r(),total_used:r()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),pfe=class{constructor(e){this.config=e}async getSpendReport(e){try{let t=new URL(this.config.baseURL),n=new URLSearchParams;n.set(`start_date`,e.startDate),n.set(`end_date`,e.endDate),e.groupBy&&n.set(`group_by`,e.groupBy),e.datePart&&n.set(`date_part`,e.datePart),e.userId&&n.set(`user_id`,e.userId),e.model&&n.set(`model`,e.model),e.provider&&n.set(`provider`,e.provider),e.credentialType&&n.set(`credential_type`,e.credentialType),e.tags&&e.tags.length>0&&n.set(`tags`,e.tags.join(`,`));let{value:r}=await dC({url:`${t.origin}/v1/report?${n.toString()}`,headers:await LC(this.config.headers()),successfulResponseHandler:zC(mfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),fetch:this.config.fetch});return r}catch(e){throw await ww(e)}}},mfe=EC(()=>kC(h({results:C(h({day:r().optional(),hour:r().optional(),user:r().optional(),model:r().optional(),tag:r().optional(),provider:r().optional(),credential_type:E([`byok`,`system`]).optional(),total_cost:P(),market_cost:P().optional(),input_tokens:P().optional(),output_tokens:P().optional(),cached_input_tokens:P().optional(),cache_creation_input_tokens:P().optional(),reasoning_tokens:P().optional(),request_count:P().optional()}).transform(({credential_type:e,total_cost:t,market_cost:n,input_tokens:r,output_tokens:i,cached_input_tokens:a,cache_creation_input_tokens:o,reasoning_tokens:s,request_count:c,...l})=>({...l,...e===void 0?{}:{credentialType:e},totalCost:t,...n===void 0?{}:{marketCost:n},...r===void 0?{}:{inputTokens:r},...i===void 0?{}:{outputTokens:i},...a===void 0?{}:{cachedInputTokens:a},...o===void 0?{}:{cacheCreationInputTokens:o},...s===void 0?{}:{reasoningTokens:s},...c===void 0?{}:{requestCount:c}})))}))),hfe=class{constructor(e){this.config=e}async getGenerationInfo(e){try{let{value:t}=await dC({url:`${new URL(this.config.baseURL).origin}/v1/generation?id=${encodeURIComponent(e.id)}`,headers:await LC(this.config.headers()),successfulResponseHandler:zC(gfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await ww(e)}}},gfe=EC(()=>kC(h({data:h({id:r(),total_cost:P(),upstream_inference_cost:P(),usage:P(),created_at:r(),model:r(),is_byok:S(),provider_name:r(),streamed:S(),finish_reason:r(),latency:P(),generation_time:P(),native_tokens_prompt:P(),native_tokens_completion:P(),native_tokens_reasoning:P(),native_tokens_cached:P(),native_tokens_cache_creation:P(),billable_web_search_calls:P()}).transform(({total_cost:e,upstream_inference_cost:t,created_at:n,is_byok:r,provider_name:i,finish_reason:a,generation_time:o,native_tokens_prompt:s,native_tokens_completion:c,native_tokens_reasoning:l,native_tokens_cached:u,native_tokens_cache_creation:d,billable_web_search_calls:f,...p})=>({...p,totalCost:e,upstreamInferenceCost:t,createdAt:n,isByok:r,providerName:i,finishReason:a,generationTime:o,promptTokens:s,completionTokens:c,reasoningTokens:l,cachedTokens:u,cacheCreationTokens:d,billableWebSearchCalls:f}))}).transform(({data:e})=>e))),_fe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`,this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(e){let{abortSignal:t,...n}=e;return{args:this.maybeEncodeFileParts(n),warnings:[]}}async doGenerate(e){let{args:t,warnings:n}=await this.getArgs(e),{abortSignal:r}=e,i=await LC(this.config.headers());try{let{responseHeaders:a,value:o,rawValue:s}=await PC({url:this.getUrl(),headers:QS(i,e.headers,this.getModelConfigHeaders(this.modelId,!1),await LC(this.config.o11yHeaders)),body:t,successfulResponseHandler:zC(D()),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{...o,request:{body:t},response:{headers:a,body:s},warnings:n}}catch(e){throw await ww(e,await Ew(i))}}async doStream(e){let{args:t,warnings:n}=await this.getArgs(e),{abortSignal:r}=e,i=await LC(this.config.headers());try{let{value:a,responseHeaders:o}=await PC({url:this.getUrl(),headers:QS(i,e.headers,this.getModelConfigHeaders(this.modelId,!0),await LC(this.config.o11yHeaders)),body:t,successfulResponseHandler:Gde(D()),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{stream:a.pipeThrough(new TransformStream({start(e){n.length>0&&e.enqueue({type:`stream-start`,warnings:n})},transform(t,n){if(t.success){let r=t.value;if(r.type===`raw`&&!e.includeRawChunks)return;r.type===`response-metadata`&&r.timestamp&&typeof r.timestamp==`string`&&(r.timestamp=new Date(r.timestamp)),n.enqueue(r)}else n.error(t.error)}})),request:{body:t},response:{headers:o}}}catch(e){throw await ww(e,await Ew(i))}}isFilePart(e){return e&&typeof e==`object`&&`type`in e&&e.type===`file`}maybeEncodeFileParts(e){for(let t of e.prompt)for(let e of t.content)if(this.isFilePart(e)){let t=e;if(t.data instanceof Uint8Array){let e=Uint8Array.from(t.data),n=Buffer.from(e).toString(`base64`);t.data=new URL(`data:${t.mediaType||`application/octet-stream`};base64,${n}`)}}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":`3`,"ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},vfe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`,this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:r}){let i=await LC(this.config.headers());try{let{responseHeaders:a,value:o,rawValue:s}=await PC({url:this.getUrl(),headers:QS(i,t??{},this.getModelConfigHeaders(),await LC(this.config.o11yHeaders)),body:{values:e,...r?{providerOptions:r}:{}},successfulResponseHandler:zC(yfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{embeddings:o.embeddings,usage:o.usage??void 0,providerMetadata:o.providerMetadata,response:{headers:a,body:s},warnings:[]}}catch(e){throw await ww(e,await Ew(i))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":`3`,"ai-model-id":this.modelId}}},yfe=EC(()=>kC(h({embeddings:C(C(P())),usage:h({tokens:P()}).nullish(),providerMetadata:d(r(),d(r(),u())).optional()}))),bfe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`,this.maxImagesPerCall=2**53-1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:n,aspectRatio:r,seed:i,files:a,mask:o,providerOptions:s,headers:c,abortSignal:l}){let u=await LC(this.config.headers());try{let{responseHeaders:d,value:f,rawValue:p}=await PC({url:this.getUrl(),headers:QS(u,c??{},this.getModelConfigHeaders(),await LC(this.config.o11yHeaders)),body:{prompt:e,n:t,...n&&{size:n},...r&&{aspectRatio:r},...i&&{seed:i},...s&&{providerOptions:s},...a&&{files:a.map(e=>Ow(e))},...o&&{mask:Ow(o)}},successfulResponseHandler:zC(wfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...l&&{abortSignal:l},fetch:this.config.fetch});return{images:f.images,warnings:f.warnings??[],providerMetadata:f.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:d},...f.usage!=null&&{usage:{inputTokens:f.usage.inputTokens??void 0,outputTokens:f.usage.outputTokens??void 0,totalTokens:f.usage.totalTokens??void 0}}}}catch(e){throw await ww(e,await Ew(u))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":`3`,"ai-model-id":this.modelId}}};function Ow(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:nC(e.data)}:e}var xfe=h({images:C(u()).optional()}).catchall(u()),Sfe=I(`type`,[h({type:m(`unsupported`),feature:r(),details:r().optional()}),h({type:m(`compatibility`),feature:r(),details:r().optional()}),h({type:m(`other`),message:r()})]),Cfe=h({inputTokens:P().nullish(),outputTokens:P().nullish(),totalTokens:P().nullish()}),wfe=h({images:C(r()),warnings:C(Sfe).optional(),providerMetadata:d(r(),xfe).optional(),usage:Cfe.optional()}),Tfe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`,this.maxVideosPerCall=2**53-1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,aspectRatio:n,resolution:r,duration:i,fps:a,seed:o,image:s,providerOptions:c,headers:l,abortSignal:u}){let d=await LC(this.config.headers());try{let{responseHeaders:f,value:p}=await PC({url:this.getUrl(),headers:QS(d,l??{},this.getModelConfigHeaders(),await LC(this.config.o11yHeaders),{accept:`text/event-stream`}),body:{prompt:e,n:t,...n&&{aspectRatio:n},...r&&{resolution:r},...i&&{duration:i},...a&&{fps:a},...o&&{seed:o},...c&&{providerOptions:c},...s&&{image:Efe(s)}},successfulResponseHandler:async({response:e,url:t,requestBodyValues:n})=>{if(e.body==null)throw new Xx({message:`SSE response body is empty`,url:t,requestBodyValues:n,statusCode:e.status});let r=NC({stream:e.body,schema:Afe}).getReader(),{done:i,value:a}=await r.read();if(r.releaseLock(),i||!a)throw new Xx({message:`SSE stream ended without a data event`,url:t,requestBodyValues:n,statusCode:e.status});if(!a.success)throw new Xx({message:`Failed to parse video SSE event`,cause:a.error,url:t,requestBodyValues:n,statusCode:e.status});let o=a.value;if(o.type===`error`)throw new Xx({message:o.message,statusCode:o.statusCode,url:t,requestBodyValues:n,responseHeaders:Object.fromEntries([...e.headers]),responseBody:JSON.stringify(o),data:{error:{message:o.message,type:o.errorType,param:o.param}}});return{value:{videos:o.videos,warnings:o.warnings,providerMetadata:o.providerMetadata},responseHeaders:Object.fromEntries([...e.headers])}},failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...u&&{abortSignal:u},fetch:this.config.fetch});return{videos:p.videos,warnings:p.warnings??[],providerMetadata:p.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:f}}}catch(e){throw await ww(e,await Ew(d))}}getUrl(){return`${this.config.baseURL}/video-model`}getModelConfigHeaders(){return{"ai-video-model-specification-version":`3`,"ai-model-id":this.modelId}}};function Efe(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:nC(e.data)}:e}var Dfe=h({videos:C(u()).optional()}).catchall(u()),Ofe=l([h({type:m(`url`),url:r(),mediaType:r()}),h({type:m(`base64`),data:r(),mediaType:r()})]),kfe=I(`type`,[h({type:m(`unsupported`),feature:r(),details:r().optional()}),h({type:m(`compatibility`),feature:r(),details:r().optional()}),h({type:m(`other`),message:r()})]),Afe=I(`type`,[h({type:m(`result`),videos:C(Ofe),warnings:C(kfe).optional(),providerMetadata:d(r(),Dfe).optional()}),h({type:m(`error`),message:r(),errorType:r(),statusCode:P(),param:u().nullable()})]),jfe=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v3`}get provider(){return this.config.provider}async doRerank({documents:e,query:t,topN:n,headers:r,abortSignal:i,providerOptions:a}){let o=await LC(this.config.headers());try{let{responseHeaders:s,value:c,rawValue:l}=await PC({url:this.getUrl(),headers:QS(o,r??{},this.getModelConfigHeaders(),await LC(this.config.o11yHeaders)),body:{documents:e,query:t,...n==null?{}:{topN:n},...a?{providerOptions:a}:{}},successfulResponseHandler:zC(Mfe),failedResponseHandler:RC({errorSchema:D(),errorToMessage:e=>e}),...i&&{abortSignal:i},fetch:this.config.fetch});return{ranking:c.ranking,providerMetadata:c.providerMetadata,response:{headers:s,body:l},warnings:[]}}catch(e){throw await ww(e,await Ew(o))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":`3`,"ai-model-id":this.modelId}}},Mfe=EC(()=>kC(h({ranking:C(h({index:P(),relevanceScore:P()})),providerMetadata:d(r(),d(r(),u())).optional()}))),Nfe=IC({id:`gateway.parallel_search`,inputSchema:EC(()=>kC(h({objective:r().describe(`Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters.`),search_queries:C(r()).optional().describe(`Optional search queries to supplement the objective. Maximum 200 characters per query.`),mode:E([`one-shot`,`agentic`]).optional().describe(`Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.`),max_results:P().optional().describe(`Maximum number of results to return (1-20). Defaults to 10 if not specified.`),source_policy:h({include_domains:C(r()).optional().describe(`List of domains to include in search results.`),exclude_domains:C(r()).optional().describe(`List of domains to exclude from search results.`),after_date:r().optional().describe(`Only include results published after this date (ISO 8601 format).`)}).optional().describe(`Source policy for controlling which domains to include/exclude and freshness.`),excerpts:h({max_chars_per_result:P().optional().describe(`Maximum characters per result.`),max_chars_total:P().optional().describe(`Maximum total characters across all results.`)}).optional().describe(`Excerpt configuration for controlling result length.`),fetch_policy:h({max_age_seconds:P().optional().describe(`Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.`)}).optional().describe(`Fetch policy for controlling content freshness.`)}))),outputSchema:EC(()=>kC(l([h({searchId:r(),results:C(h({url:r(),title:r(),excerpt:r(),publishDate:r().nullable().optional(),relevanceScore:P().optional()}))}),h({error:E([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`configuration_error`,`unknown`]),statusCode:P().optional(),message:r()})])))}),Pfe=(e={})=>Nfe(e),Ffe=IC({id:`gateway.perplexity_search`,inputSchema:EC(()=>kC(h({query:l([r(),C(r())]).describe(`Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries.`),max_results:P().optional().describe(`Maximum number of search results to return (1-20, default: 10)`),max_tokens_per_page:P().optional().describe(`Maximum number of tokens to extract per search result page (256-2048, default: 2048)`),max_tokens:P().optional().describe(`Maximum total tokens across all search results (default: 25000, max: 1000000)`),country:r().optional().describe(`Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')`),search_domain_filter:C(r()).optional().describe(`List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']`),search_language_filter:C(r()).optional().describe(`List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']`),search_after_date:r().optional().describe(`Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter.`),search_before_date:r().optional().describe(`Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter.`),last_updated_after_filter:r().optional().describe(`Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter.`),last_updated_before_filter:r().optional().describe(`Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter.`),search_recency_filter:E([`day`,`week`,`month`,`year`]).optional().describe(`Filter results by relative time period. Cannot be used with search_after_date or search_before_date.`)}))),outputSchema:EC(()=>kC(l([h({results:C(h({title:r(),url:r(),snippet:r(),date:r().optional(),lastUpdated:r().optional()})),id:r()}),h({error:E([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`unknown`]),statusCode:P().optional(),message:r()})])))}),Ife={parallelSearch:Pfe,perplexitySearch:(e={})=>Ffe(e)};async function Lfe(){return(0,BC.getContext)().headers?.[`x-vercel-id`]}var Rfe=`3.0.96`,zfe=`0.0.1`;function Bfe(e={}){let t=null,n=null,r=e.metadataCacheRefreshMillis??1e3*60*5,i=0,a=Kde(e.baseURL)??`https://ai-gateway.vercel.sh/v3/ai`,o=async()=>{try{let t=await Hfe(e);return uC({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":zfe,[Tw]:t.authMethod,...e.headers},`ai-sdk/gateway/${Rfe}`)}catch(e){throw YC.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},s=()=>{let e=fC({settingValue:void 0,environmentVariableName:`VERCEL_DEPLOYMENT_ID`}),t=fC({settingValue:void 0,environmentVariableName:`VERCEL_ENV`}),n=fC({settingValue:void 0,environmentVariableName:`VERCEL_REGION`}),r=fC({settingValue:void 0,environmentVariableName:`VERCEL_PROJECT_ID`});return async()=>{let i=await Lfe();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...n&&{"ai-o11y-region":n},...i&&{"ai-o11y-request-id":i},...r&&{"ai-o11y-project-id":r}}}},c=t=>new _fe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()}),l=async()=>{var s;let c=((s=e._internal)?.currentDate)?.call(s).getTime()??Date.now();return(!t||c-i>r)&&(i=c,t=new Dw({baseURL:a,headers:o,fetch:e.fetch}).getAvailableModels().then(e=>(n=e,e)).catch(async e=>{throw await ww(e,await Ew(await o()))})),n?Promise.resolve(n):t},u=async()=>new Dw({baseURL:a,headers:o,fetch:e.fetch}).getCredits().catch(async e=>{throw await ww(e,await Ew(await o()))}),d=async t=>new pfe({baseURL:a,headers:o,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await ww(e,await Ew(await o()))}),f=async t=>new hfe({baseURL:a,headers:o,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await ww(e,await Ew(await o()))}),p=function(e){if(new.target)throw Error(`The Gateway Provider model function cannot be called with the new keyword.`);return c(e)};p.specificationVersion=`v3`,p.getAvailableModels=l,p.getCredits=u,p.getSpendReport=d,p.getGenerationInfo=f,p.imageModel=t=>new bfe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()}),p.languageModel=c;let m=t=>new vfe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()});p.embeddingModel=m,p.textEmbeddingModel=m,p.videoModel=t=>new Tfe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()});let h=t=>new jfe(t,{provider:`gateway`,baseURL:a,headers:o,fetch:e.fetch,o11yHeaders:s()});return p.rerankingModel=h,p.reranking=h,p.chat=p.languageModel,p.embedding=p.embeddingModel,p.image=p.imageModel,p.video=p.videoModel,p.tools=Ife,p}var Vfe=Bfe();async function Hfe(e){let t=fC({settingValue:e.apiKey,environmentVariableName:`AI_GATEWAY_API_KEY`});return t?{token:t,authMethod:`api-key`}:{token:await(0,BC.getVercelOidcToken)(),authMethod:`oidc`}}var Ufe=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},kw=`1.9.0`,Aw=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Wfe(e){var t=new Set([e]),n=new Set,r=e.match(Aw);if(!r)return function(){return!1};var i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;var r=e.match(Aw);if(!r)return a(e);var s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var Gfe=Wfe(kw),Kfe=kw.split(`.`)[0],jw=Symbol.for(`opentelemetry.js.api.`+Kfe),Mw=Ufe;function Nw(e,t,n,r){r===void 0&&(r=!1);var i=Mw[jw]=Mw[jw]??{version:kw};if(!r&&i[e]){var a=Error(`@opentelemetry/api: Attempted duplicate registration of API: `+e);return n.error(a.stack||a.message),!1}if(i.version!==`1.9.0`){var a=Error(`@opentelemetry/api: Registration of version v`+i.version+` for `+e+` does not match previously registered API v`+kw);return n.error(a.stack||a.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for `+e+` v`+kw+`.`),!0}function Pw(e){var t=Mw[jw]?.version;if(!(!t||!Gfe(t)))return Mw[jw]?.[e]}function Fw(e,t){t.debug(`@opentelemetry/api: Unregistering a global for `+e+` v`+kw+`.`);var n=Mw[jw];n&&delete n[e]}var qfe=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Jfe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;rLw.ALL&&(e=Lw.ALL),t||={};function n(n,r){var i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,Lw.ERROR),warn:n(`warn`,Lw.WARN),info:n(`info`,Lw.INFO),debug:n(`debug`,Lw.DEBUG),verbose:n(`verbose`,Lw.VERBOSE)}}var Zfe=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Qfe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r`;i.warn(`Current logger will be overwritten from `+o),a.warn(`Current logger will overwrite one already registered from `+o)}return Nw(`diag`,a,t,!0)},t.disable=function(){Fw($fe,t)},t.createComponentLogger=function(e){return new Yfe(e)},t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}return e.instance=function(){return this._instance||=new e,this._instance},e}();function epe(e){return Symbol.for(e)}var tpe=new(function(){function e(t){var n=this;n._currentContext=t?new Map(t):new Map,n.getValue=function(e){return n._currentContext.get(e)},n.setValue=function(t,r){var i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=function(t){var r=new e(n._currentContext);return r._currentContext.delete(t),r}}return e}()),npe=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},rpe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},ope=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r{for(var n in t)Spe(e,n,{get:t[n],enumerable:!0})},eT=`AI_InvalidArgumentError`,tT=`vercel.ai.error.${eT}`,wpe=Symbol.for(tT),nT,rT=class extends Yx{constructor({parameter:e,value:t,message:n}){super({name:eT,message:`Invalid argument for parameter ${e}: ${n}`}),this[nT]=!0,this.parameter=e,this.value=t}static isInstance(e){return Yx.hasMarker(e,tT)}};nT=wpe;var iT=`AI_InvalidToolApprovalError`,aT=`vercel.ai.error.${iT}`,Tpe=Symbol.for(aT),oT,Epe=class extends Yx{constructor({approvalId:e}){super({name:iT,message:`Tool approval response references unknown approvalId: "${e}". No matching tool-approval-request found in message history.`}),this[oT]=!0,this.approvalId=e}static isInstance(e){return Yx.hasMarker(e,aT)}};oT=Tpe;var sT=`AI_InvalidToolInputError`,cT=`vercel.ai.error.${sT}`,Dpe=Symbol.for(cT),lT,uT=class extends Yx{constructor({toolInput:e,toolName:t,cause:n,message:r=`Invalid input for tool ${t}: ${Zx(n)}`}){super({name:sT,message:r,cause:n}),this[lT]=!0,this.toolInput=e,this.toolName=t}static isInstance(e){return Yx.hasMarker(e,cT)}};lT=Dpe;var dT=`AI_ToolCallNotFoundForApprovalError`,fT=`vercel.ai.error.${dT}`,Ope=Symbol.for(fT),pT,mT=class extends Yx{constructor({toolCallId:e,approvalId:t}){super({name:dT,message:`Tool call "${e}" not found for approval request "${t}".`}),this[pT]=!0,this.toolCallId=e,this.approvalId=t}static isInstance(e){return Yx.hasMarker(e,fT)}};pT=Ope;var hT=`AI_MissingToolResultsError`,gT=`vercel.ai.error.${hT}`,kpe=Symbol.for(gT),_T,vT=class extends Yx{constructor({toolCallIds:e}){super({name:hT,message:`Tool result${e.length>1?`s are`:` is`} missing for tool call${e.length>1?`s`:``} ${e.join(`, `)}.`}),this[_T]=!0,this.toolCallIds=e}static isInstance(e){return Yx.hasMarker(e,gT)}};_T=kpe;var yT=`AI_NoObjectGeneratedError`,bT=`vercel.ai.error.${yT}`,Ape=Symbol.for(bT),xT,ST=class extends Yx{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:yT,message:e,cause:t}),this[xT]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return Yx.hasMarker(e,bT)}};xT=Ape;var CT=`AI_NoOutputGeneratedError`,wT=`vercel.ai.error.${CT}`,jpe=Symbol.for(wT),TT,ET=class extends Yx{constructor({message:e=`No output generated.`,cause:t}={}){super({name:CT,message:e,cause:t}),this[TT]=!0}static isInstance(e){return Yx.hasMarker(e,wT)}};TT=jpe;var DT=`AI_NoSuchToolError`,OT=`vercel.ai.error.${DT}`,Mpe=Symbol.for(OT),kT,AT=class extends Yx{constructor({toolName:e,availableTools:t=void 0,message:n=`Model tried to call unavailable tool '${e}'. ${t===void 0?`No tools are available.`:`Available tools: ${t.join(`, `)}.`}`}){super({name:DT,message:n}),this[kT]=!0,this.toolName=e,this.availableTools=t}static isInstance(e){return Yx.hasMarker(e,OT)}};kT=Mpe;var jT=`AI_ToolCallRepairError`,MT=`vercel.ai.error.${jT}`,Npe=Symbol.for(MT),NT,Ppe=class extends Yx{constructor({cause:e,originalError:t,message:n=`Error repairing tool call: ${Zx(e)}`}){super({name:jT,message:n,cause:e}),this[NT]=!0,this.originalError=t}static isInstance(e){return Yx.hasMarker(e,MT)}};NT=Npe;var Fpe=class extends Yx{constructor(e){super({name:`AI_UnsupportedModelVersionError`,message:`Unsupported model version ${e.version} for provider "${e.provider}" and model "${e.modelId}". AI SDK 5 only supports models that implement specification version "v2".`}),this.version=e.version,this.provider=e.provider,this.modelId=e.modelId}},PT=`AI_UIMessageStreamError`,FT=`vercel.ai.error.${PT}`,Ipe=Symbol.for(FT),IT,LT=class extends Yx{constructor({chunkType:e,chunkId:t,message:n}){super({name:PT,message:n}),this[IT]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Yx.hasMarker(e,FT)}};IT=Ipe;var RT=`AI_InvalidMessageRoleError`,zT=`vercel.ai.error.${RT}`,Lpe=Symbol.for(zT),BT,Rpe=class extends Yx{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:RT,message:t}),this[BT]=!0,this.role=e}static isInstance(e){return Yx.hasMarker(e,zT)}};BT=Lpe;var VT=`AI_RetryError`,HT=`vercel.ai.error.${VT}`,zpe=Symbol.for(HT),UT,WT=class extends Yx{constructor({message:e,reason:t,errors:n}){super({name:VT,message:e}),this[UT]=!0,this.reason=t,this.errors=n,this.lastError=n[n.length-1]}static isInstance(e){return Yx.hasMarker(e,HT)}};UT=zpe;function GT(e){return e===void 0?[]:Array.isArray(e)?e:[e]}async function KT(e){for(let t of GT(e.callbacks))if(t!=null)try{await t(e.event)}catch{}}function Bpe({warning:e,provider:t,model:n}){let r=`AI SDK Warning (${t} / ${n}):`;switch(e.type){case`unsupported`:{let t=`${r} The feature "${e.feature}" is not supported.`;return e.details&&(t+=` ${e.details}`),t}case`compatibility`:{let t=`${r} The feature "${e.feature}" is used in a compatibility mode.`;return e.details&&(t+=` ${e.details}`),t}case`other`:return`${r} ${e.message}`;default:return`${r} ${JSON.stringify(e,null,2)}`}}var Vpe=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,qT=!1,JT=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}qT||(qT=!0,console.info(Vpe));for(let t of e.warnings)console.warn(Bpe({warning:t,provider:e.provider,model:e.model}))}};function Hpe({provider:e,modelId:t}){JT({warnings:[{type:`compatibility`,feature:`specificationVersion`,details:`Using v2 specification compatibility mode. Some features may not be available.`}],provider:e,model:t})}function Upe(e){return e.specificationVersion===`v3`?e:(Hpe({provider:e.provider,modelId:e.modelId}),new Proxy(e,{get(e,t){switch(t){case`specificationVersion`:return`v3`;case`doGenerate`:return async(...t)=>{let n=await e.doGenerate(...t);return{...n,finishReason:YT(n.finishReason),usage:XT(n.usage)}};case`doStream`:return async(...t)=>{let n=await e.doStream(...t);return{...n,stream:Wpe(n.stream)}};default:return e[t]}}}))}function Wpe(e){return e.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`finish`:t.enqueue({...e,finishReason:YT(e.finishReason),usage:XT(e.usage)});break;default:t.enqueue(e);break}}}))}function YT(e){return{unified:e===`unknown`?`other`:e,raw:void 0}}function XT(e){return{inputTokens:{total:e.inputTokens,noCache:void 0,cacheRead:e.cachedInputTokens,cacheWrite:void 0},outputTokens:{total:e.outputTokens,text:void 0,reasoning:e.reasoningTokens}}}function ZT(e){if(typeof e!=`string`){if(e.specificationVersion!==`v3`&&e.specificationVersion!==`v2`){let t=e;throw new Fpe({version:t.specificationVersion,provider:t.provider,modelId:t.modelId})}return Upe(e)}return Gpe().languageModel(e)}function Gpe(){return globalThis.AI_SDK_DEFAULT_PROVIDER??Vfe}function QT(e){if(e!=null)return typeof e==`number`?e:e.totalMs}function $T(e){if(!(e==null||typeof e==`number`))return e.stepMs}function Kpe(e){if(!(e==null||typeof e==`number`))return e.chunkMs}var qpe=[{mediaType:`image/gif`,bytesPrefix:[71,73,70]},{mediaType:`image/png`,bytesPrefix:[137,80,78,71]},{mediaType:`image/jpeg`,bytesPrefix:[255,216]},{mediaType:`image/webp`,bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:`image/bmp`,bytesPrefix:[66,77]},{mediaType:`image/tiff`,bytesPrefix:[73,73,42,0]},{mediaType:`image/tiff`,bytesPrefix:[77,77,0,42]},{mediaType:`image/avif`,bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:`image/heic`,bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}],Jpe=e=>{let t=typeof e==`string`?tC(e):e,n=(t[6]&127)<<21|(t[7]&127)<<14|(t[8]&127)<<7|t[9]&127;return t.slice(n+10)};function Ype(e){return typeof e==`string`&&e.startsWith(`SUQz`)||typeof e!=`string`&&e.length>10&&e[0]===73&&e[1]===68&&e[2]===51?Jpe(e):e}function Xpe({data:e,signatures:t}){let n=Ype(e),r=typeof n==`string`?tC(n.substring(0,Math.min(n.length,24))):n;for(let e of t)if(r.length>=e.bytesPrefix.length&&e.bytesPrefix.every((e,t)=>e===null||r[t]===e))return e.mediaType}var eE=`6.0.159`,Zpe=async({url:e,maxBytes:t,abortSignal:n})=>{let r=e.toString();jue(r);try{let e=await fetch(r,{headers:uC({},`ai-sdk/${eE}`,cC()),signal:n});if(e.redirected&&jue(e.url),!e.ok)throw new rC({url:r,statusCode:e.status,statusText:e.statusText});return{data:await Aue({response:e,url:r,maxBytes:t??kue}),mediaType:e.headers.get(`content-type`)??void 0}}catch(e){throw rC.isInstance(e)?e:new rC({url:r,cause:e})}},Qpe=(e=Zpe)=>t=>Promise.all(t.map(async t=>t.isUrlSupportedByModel?null:e(t)));function $pe(e){try{let[t,n]=e.split(`,`);return{mediaType:t.split(`;`)[0].split(`:`)[1],base64Content:n}}catch{return{mediaType:void 0,base64Content:void 0}}}var tE=l([r(),b(Uint8Array),b(ArrayBuffer),g(e=>globalThis.Buffer?.isBuffer(e)??!1,{message:`Must be a Buffer`})]);function nE(e){if(e instanceof Uint8Array)return{data:e,mediaType:void 0};if(e instanceof ArrayBuffer)return{data:new Uint8Array(e),mediaType:void 0};if(typeof e==`string`)try{e=new URL(e)}catch{}if(e instanceof URL&&e.protocol===`data:`){let{mediaType:t,base64Content:n}=$pe(e.toString());if(t==null||n==null)throw new Yx({name:`InvalidDataContentError`,message:`Invalid data URL format in content ${e.toString()}`});return{data:n,mediaType:t}}return{data:e,mediaType:void 0}}function eme(e){return typeof e==`string`?e:e instanceof ArrayBuffer?nC(new Uint8Array(e)):nC(e)}async function rE({prompt:e,supportedUrls:t,download:n=Qpe()}){let r=await nme(e.messages,n,t),i=new Map;for(let t of e.messages)if(t.role===`assistant`&&Array.isArray(t.content))for(let e of t.content)e.type===`tool-approval-request`&&`approvalId`in e&&`toolCallId`in e&&i.set(e.approvalId,e.toolCallId);let a=new Set;for(let t of e.messages)if(t.role===`tool`){for(let e of t.content)if(e.type===`tool-approval-response`){let t=i.get(e.approvalId);t&&a.add(t)}}let o=[...e.system==null?[]:typeof e.system==`string`?[{role:`system`,content:e.system}]:GT(e.system).map(e=>({role:`system`,content:e.content,providerOptions:e.providerOptions})),...e.messages.map(e=>tme({message:e,downloadedAssets:r}))],s=[];for(let e of o){if(e.role!==`tool`){s.push(e);continue}let t=s.at(-1);t?.role===`tool`?t.content.push(...e.content):s.push(e)}let c=new Set;for(let e of s)switch(e.role){case`assistant`:for(let t of e.content)t.type===`tool-call`&&!t.providerExecuted&&c.add(t.toolCallId);break;case`tool`:for(let t of e.content)t.type===`tool-result`&&c.delete(t.toolCallId);break;case`user`:case`system`:for(let e of a)c.delete(e);if(c.size>0)throw new vT({toolCallIds:Array.from(c)});break}for(let e of a)c.delete(e);if(c.size>0)throw new vT({toolCallIds:Array.from(c)});return s.filter(e=>e.role!==`tool`||e.content.length>0)}function tme({message:e,downloadedAssets:t}){let n=e.role;switch(n){case`system`:return{role:`system`,content:e.content,providerOptions:e.providerOptions};case`user`:return typeof e.content==`string`?{role:`user`,content:[{type:`text`,text:e.content}],providerOptions:e.providerOptions}:{role:`user`,content:e.content.map(e=>rme(e,t)).filter(e=>e.type!==`text`||e.text!==``),providerOptions:e.providerOptions};case`assistant`:return typeof e.content==`string`?{role:`assistant`,content:[{type:`text`,text:e.content}],providerOptions:e.providerOptions}:{role:`assistant`,content:e.content.filter(e=>e.type!==`text`||e.text!==``||e.providerOptions!=null).filter(e=>e.type!==`tool-approval-request`).map(e=>{let t=e.providerOptions;switch(e.type){case`file`:{let{data:n,mediaType:r}=nE(e.data);return{type:`file`,data:n,filename:e.filename,mediaType:r??e.mediaType,providerOptions:t}}case`reasoning`:return{type:`reasoning`,text:e.text,providerOptions:t};case`text`:return{type:`text`,text:e.text,providerOptions:t};case`tool-call`:return{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,providerExecuted:e.providerExecuted,providerOptions:t};case`tool-result`:return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:iE(e.output),providerOptions:t}}}),providerOptions:e.providerOptions};case`tool`:return{role:`tool`,content:e.content.filter(e=>e.type!==`tool-approval-response`||e.providerExecuted).map(e=>{switch(e.type){case`tool-result`:return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:iE(e.output),providerOptions:e.providerOptions};case`tool-approval-response`:return{type:`tool-approval-response`,approvalId:e.approvalId,approved:e.approved,reason:e.reason}}}),providerOptions:e.providerOptions};default:throw new Rpe({role:n})}}async function nme(e,t,n){let r=e.filter(e=>e.role===`user`).map(e=>e.content).filter(e=>Array.isArray(e)).flat().filter(e=>e.type===`image`||e.type===`file`).map(e=>{let t=e.mediaType??(e.type===`image`?`image/*`:void 0),n=e.type===`image`?e.image:e.data;if(typeof n==`string`)try{n=new URL(n)}catch{}return{mediaType:t,data:n}}).filter(e=>e.data instanceof URL).map(e=>({url:e.data,isUrlSupportedByModel:e.mediaType!=null&&Vue({url:e.data.toString(),mediaType:e.mediaType,supportedUrls:n})})),i=await t(r);return Object.fromEntries(i.map((e,t)=>e==null?null:[r[t].url.toString(),{data:e.data,mediaType:e.mediaType}]).filter(e=>e!=null))}function rme(e,t){if(e.type===`text`)return{type:`text`,text:e.text,providerOptions:e.providerOptions};let n,r=e.type;switch(r){case`image`:n=e.image;break;case`file`:n=e.data;break;default:throw Error(`Unsupported part type: ${r}`)}let{data:i,mediaType:a}=nE(n),o=a??e.mediaType,s=i;if(s instanceof URL){let e=t[s.toString()];e&&(s=e.data,o??=e.mediaType)}switch(r){case`image`:return(s instanceof Uint8Array||typeof s==`string`)&&(o=Xpe({data:s,signatures:qpe})??o),{type:`file`,mediaType:o??`image/*`,filename:void 0,data:s,providerOptions:e.providerOptions};case`file`:if(o==null)throw Error(`Media type is missing for file part`);return{type:`file`,mediaType:o,filename:e.filename,data:s,providerOptions:e.providerOptions}}}function iE(e){return e.type===`content`?{type:`content`,value:e.value.map(e=>e.type===`media`?e.mediaType.startsWith(`image/`)?{type:`image-data`,data:e.data,mediaType:e.mediaType}:{type:`file-data`,data:e.data,mediaType:e.mediaType}:e)}:e}async function aE({toolCallId:e,input:t,output:n,tool:r,errorMode:i}){return i===`text`?{type:`error-text`,value:Zx(n)}:i===`json`?{type:`error-json`,value:oE(n)}:r?.toModelOutput?await r.toModelOutput({toolCallId:e,input:t,output:n}):typeof n==`string`?{type:`text`,value:n}:{type:`json`,value:oE(n)}}function oE(e){return e===void 0?null:e}function sE({maxOutputTokens:e,temperature:t,topP:n,topK:r,presencePenalty:i,frequencyPenalty:a,seed:o,stopSequences:s}){if(e!=null){if(!Number.isInteger(e))throw new rT({parameter:`maxOutputTokens`,value:e,message:`maxOutputTokens must be an integer`});if(e<1)throw new rT({parameter:`maxOutputTokens`,value:e,message:`maxOutputTokens must be >= 1`})}if(t!=null&&typeof t!=`number`)throw new rT({parameter:`temperature`,value:t,message:`temperature must be a number`});if(n!=null&&typeof n!=`number`)throw new rT({parameter:`topP`,value:n,message:`topP must be a number`});if(r!=null&&typeof r!=`number`)throw new rT({parameter:`topK`,value:r,message:`topK must be a number`});if(i!=null&&typeof i!=`number`)throw new rT({parameter:`presencePenalty`,value:i,message:`presencePenalty must be a number`});if(a!=null&&typeof a!=`number`)throw new rT({parameter:`frequencyPenalty`,value:a,message:`frequencyPenalty must be a number`});if(o!=null&&!Number.isInteger(o))throw new rT({parameter:`seed`,value:o,message:`seed must be an integer`});return{maxOutputTokens:e,temperature:t,topP:n,topK:r,presencePenalty:i,frequencyPenalty:a,stopSequences:s,seed:o}}function ime(e){return e!=null&&Object.keys(e).length>0}async function cE({tools:e,toolChoice:t,activeTools:n}){if(!ime(e))return{tools:void 0,toolChoice:void 0};let r=n==null?Object.entries(e):Object.entries(e).filter(([e])=>n.includes(e)),i=[];for(let[e,t]of r){let n=t.type;switch(n){case void 0:case`dynamic`:case`function`:i.push({type:`function`,name:e,description:t.description,inputSchema:await OC(t.inputSchema).jsonSchema,...t.inputExamples==null?{}:{inputExamples:t.inputExamples},providerOptions:t.providerOptions,...t.strict==null?{}:{strict:t.strict}});break;case`provider`:i.push({type:`provider`,name:e,id:t.id,args:t.args});break;default:throw Error(`Unsupported tool type: ${n}`)}}return{tools:i,toolChoice:t==null?{type:`auto`}:typeof t==`string`?{type:t}:{type:`tool`,toolName:t.toolName}}}var lE=F(()=>l([x(),r(),P(),S(),d(r(),lE.optional()),C(lE)])),uE=d(r(),d(r(),lE.optional())),dE=h({type:m(`text`),text:r(),providerOptions:uE.optional()}),ame=h({type:m(`image`),image:l([tE,b(URL)]),mediaType:r().optional(),providerOptions:uE.optional()}),fE=h({type:m(`file`),data:l([tE,b(URL)]),filename:r().optional(),mediaType:r(),providerOptions:uE.optional()}),ome=h({type:m(`reasoning`),text:r(),providerOptions:uE.optional()}),sme=h({type:m(`tool-call`),toolCallId:r(),toolName:r(),input:u(),providerOptions:uE.optional(),providerExecuted:S().optional()}),cme=I(`type`,[h({type:m(`text`),value:r(),providerOptions:uE.optional()}),h({type:m(`json`),value:lE,providerOptions:uE.optional()}),h({type:m(`execution-denied`),reason:r().optional(),providerOptions:uE.optional()}),h({type:m(`error-text`),value:r(),providerOptions:uE.optional()}),h({type:m(`error-json`),value:lE,providerOptions:uE.optional()}),h({type:m(`content`),value:C(l([h({type:m(`text`),text:r(),providerOptions:uE.optional()}),h({type:m(`media`),data:r(),mediaType:r()}),h({type:m(`file-data`),data:r(),mediaType:r(),filename:r().optional(),providerOptions:uE.optional()}),h({type:m(`file-url`),url:r(),providerOptions:uE.optional()}),h({type:m(`file-id`),fileId:l([r(),d(r(),r())]),providerOptions:uE.optional()}),h({type:m(`image-data`),data:r(),mediaType:r(),providerOptions:uE.optional()}),h({type:m(`image-url`),url:r(),providerOptions:uE.optional()}),h({type:m(`image-file-id`),fileId:l([r(),d(r(),r())]),providerOptions:uE.optional()}),h({type:m(`custom`),providerOptions:uE.optional()})]))})]),pE=h({type:m(`tool-result`),toolCallId:r(),toolName:r(),output:cme,providerOptions:uE.optional()}),lme=h({type:m(`tool-approval-request`),approvalId:r(),toolCallId:r()}),ume=h({type:m(`tool-approval-response`),approvalId:r(),approved:S(),reason:r().optional()}),dme=l([h({role:m(`system`),content:r(),providerOptions:uE.optional()}),h({role:m(`user`),content:l([r(),C(l([dE,ame,fE]))]),providerOptions:uE.optional()}),h({role:m(`assistant`),content:l([r(),C(l([dE,fE,ome,sme,pE,lme]))]),providerOptions:uE.optional()}),h({role:m(`tool`),content:C(l([pE,ume])),providerOptions:uE.optional()})]);async function mE(e){if(e.prompt==null&&e.messages==null)throw new Qx({prompt:e,message:`prompt or messages must be defined`});if(e.prompt!=null&&e.messages!=null)throw new Qx({prompt:e,message:`prompt and messages cannot be defined at the same time`});if(e.system!=null&&typeof e.system!=`string`&&!GT(e.system).every(e=>typeof e==`object`&&!!e&&`role`in e&&e.role===`system`))throw new Qx({prompt:e,message:`system must be a string, SystemModelMessage, or array of SystemModelMessage`});let t;if(e.prompt!=null&&typeof e.prompt==`string`)t=[{role:`user`,content:e.prompt}];else if(e.prompt!=null&&Array.isArray(e.prompt))t=e.prompt;else if(e.messages!=null)t=e.messages;else throw new Qx({prompt:e,message:`prompt or messages must be defined`});if(t.length===0)throw new Qx({prompt:e,message:`messages must not be empty`});let n=await jC({value:t,schema:C(dme)});if(!n.success)throw new Qx({prompt:e,message:`The messages do not match the ModelMessage[] schema.`,cause:n.error});return{messages:t,system:e.system}}function hE(e){if(!YC.isInstance(e))return e;let t=(process==null?void 0:`production`)===`production`,n=`https://ai-sdk.dev/unauthenticated-ai-gateway`;return t?new Yx({name:`GatewayError`,message:`Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${n}`}):Object.assign(Error(`\x1B[1m\x1B[31mUnauthenticated request to AI Gateway.\x1B[0m - -To authenticate, set the \x1B[33mAI_GATEWAY_API_KEY\x1B[0m environment variable with your API key. - -Alternatively, you can use a provider module instead of the AI Gateway. - -Learn more: \x1B[34m${n}\x1B[0m - -`),{name:`GatewayAuthenticationError`})}function gE({operationId:e,telemetry:t}){return{"operation.name":`${e}${t?.functionId==null?``:` ${t.functionId}`}`,"resource.name":t?.functionId,"ai.operationId":e,"ai.telemetry.functionId":t?.functionId}}function _E({model:e,settings:t,telemetry:n,headers:r}){return{"ai.model.provider":e.provider,"ai.model.id":e.modelId,...Object.entries(t).reduce((e,[t,n])=>{if(t===`timeout`){let r=QT(n);r!=null&&(e[`ai.settings.${t}`]=r)}else e[`ai.settings.${t}`]=n;return e},{}),...Object.entries(n?.metadata??{}).reduce((e,[t,n])=>(e[`ai.telemetry.metadata.${t}`]=n,e),{}),...Object.entries(r??{}).reduce((e,[t,n])=>(n!==void 0&&(e[`ai.request.headers.${t}`]=n),e),{})}}var fme={startSpan(){return vE},startActiveSpan(e,t,n,r){if(typeof t==`function`)return t(vE);if(typeof n==`function`)return n(vE);if(typeof r==`function`)return r(vE)}},vE={spanContext(){return pme},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},addLink(){return this},addLinks(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this}},pme={traceId:``,spanId:``,traceFlags:0};function yE({isEnabled:e=!1,tracer:t}={}){return e?t||xpe.getTracer(`ai`):fme}async function bE({name:e,tracer:t,attributes:n,fn:r,endWhenDone:i=!0}){return t.startActiveSpan(e,{attributes:await n},async e=>{let t=Qw.active();try{let n=await Qw.with(t,()=>r(e));return i&&e.end(),n}catch(t){try{xE(e,t)}finally{e.end()}throw t}})}function xE(e,t){t instanceof Error?(e.recordException({name:t.name,message:t.message,stack:t.stack}),e.setStatus({code:Zw.ERROR,message:t.message})):e.setStatus({code:Zw.ERROR})}async function SE({telemetry:e,attributes:t}){if(e?.isEnabled!==!0)return{};let n={};for(let[r,i]of Object.entries(t))if(i!=null){if(typeof i==`object`&&`input`in i&&typeof i.input==`function`){if(e?.recordInputs===!1)continue;let t=await i.input();t!=null&&(n[r]=t);continue}if(typeof i==`object`&&`output`in i&&typeof i.output==`function`){if(e?.recordOutputs===!1)continue;let t=await i.output();t!=null&&(n[r]=t);continue}n[r]=i}return n}function CE(e){return JSON.stringify(e.map(e=>({...e,content:typeof e.content==`string`?e.content:e.content.map(e=>e.type===`file`?{...e,data:e.data instanceof Uint8Array?eme(e.data):e.data}:e)})))}function mme(){return globalThis.AI_SDK_TELEMETRY_INTEGRATIONS??[]}function wE(){let e=mme();return t=>{let n=GT(t),r=[...e,...n];function i(e){let t=r.map(e).filter(Boolean);return async e=>{for(let n of t)try{await n(e)}catch{}}}return{onStart:i(e=>e.onStart),onStepStart:i(e=>e.onStepStart),onToolCallStart:i(e=>e.onToolCallStart),onToolCallFinish:i(e=>e.onToolCallFinish),onStepFinish:i(e=>e.onStepFinish),onFinish:i(e=>e.onFinish)}}}function TE(e){return{inputTokens:e.inputTokens.total,inputTokenDetails:{noCacheTokens:e.inputTokens.noCache,cacheReadTokens:e.inputTokens.cacheRead,cacheWriteTokens:e.inputTokens.cacheWrite},outputTokens:e.outputTokens.total,outputTokenDetails:{textTokens:e.outputTokens.text,reasoningTokens:e.outputTokens.reasoning},totalTokens:OE(e.inputTokens.total,e.outputTokens.total),raw:e.raw,reasoningTokens:e.outputTokens.reasoning,cachedInputTokens:e.inputTokens.cacheRead}}function EE(){return{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}}function DE(e,t){return{inputTokens:OE(e.inputTokens,t.inputTokens),inputTokenDetails:{noCacheTokens:OE(e.inputTokenDetails?.noCacheTokens,t.inputTokenDetails?.noCacheTokens),cacheReadTokens:OE(e.inputTokenDetails?.cacheReadTokens,t.inputTokenDetails?.cacheReadTokens),cacheWriteTokens:OE(e.inputTokenDetails?.cacheWriteTokens,t.inputTokenDetails?.cacheWriteTokens)},outputTokens:OE(e.outputTokens,t.outputTokens),outputTokenDetails:{textTokens:OE(e.outputTokenDetails?.textTokens,t.outputTokenDetails?.textTokens),reasoningTokens:OE(e.outputTokenDetails?.reasoningTokens,t.outputTokenDetails?.reasoningTokens)},totalTokens:OE(e.totalTokens,t.totalTokens),reasoningTokens:OE(e.reasoningTokens,t.reasoningTokens),cachedInputTokens:OE(e.cachedInputTokens,t.cachedInputTokens)}}function OE(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function kE(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);o&&s?n[r]=kE(a,i):n[r]=i}return n}function hme({error:e,exponentialBackoffDelay:t}){let n=e.responseHeaders;if(!n)return t;let r,i=n[`retry-after-ms`];if(i){let e=parseFloat(i);Number.isNaN(e)||(r=e)}let a=n[`retry-after`];if(a&&r===void 0){let e=parseFloat(a);r=Number.isNaN(e)?Date.parse(a)-Date.now():e*1e3}return r!=null&&!Number.isNaN(r)&&0<=r&&(r<60*1e3||rasync i=>AE(i,{maxRetries:e,delayInMs:t,backoffFactor:n,abortSignal:r});async function AE(e,{maxRetries:t,delayInMs:n,backoffFactor:r,abortSignal:i},a=[]){try{return await e()}catch(o){if(sC(o)||t===0)throw o;let s=oC(o),c=[...a,o],l=c.length;if(l>t)throw new WT({message:`Failed after ${l} attempts. Last error: ${s}`,reason:`maxRetriesExceeded`,errors:c});if(o instanceof Error&&Xx.isInstance(o)&&o.isRetryable===!0&&l<=t)return await bue(hme({error:o,exponentialBackoffDelay:n}),{abortSignal:i}),AE(e,{maxRetries:t,delayInMs:r*n,backoffFactor:r,abortSignal:i},c);throw l===1?o:new WT({message:`Failed after ${l} attempts with non-retryable error: '${s}'`,reason:`errorNotRetryable`,errors:c})}}function jE({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new rT({parameter:`maxRetries`,value:e,message:`maxRetries must be an integer`});if(e<0)throw new rT({parameter:`maxRetries`,value:e,message:`maxRetries must be >= 0`})}let n=e??2;return{maxRetries:n,retry:gme({maxRetries:n,abortSignal:t})}}function ME({messages:e}){let t=e.at(-1);if(t?.role!=`tool`)return{approvedToolApprovals:[],deniedToolApprovals:[]};let n={};for(let t of e)if(t.role===`assistant`&&typeof t.content!=`string`){let e=t.content;for(let t of e)t.type===`tool-call`&&(n[t.toolCallId]=t)}let r={};for(let t of e)if(t.role===`assistant`&&typeof t.content!=`string`){let e=t.content;for(let t of e)t.type===`tool-approval-request`&&(r[t.approvalId]=t)}let i={};for(let e of t.content)e.type===`tool-result`&&(i[e.toolCallId]=e);let a=[],o=[],s=t.content.filter(e=>e.type===`tool-approval-response`);for(let e of s){let t=r[e.approvalId];if(t==null)throw new Epe({approvalId:e.approvalId});if(i[t.toolCallId]!=null)continue;let s=n[t.toolCallId];if(s==null)throw new mT({toolCallId:t.toolCallId,approvalId:t.approvalId});let c={approvalRequest:t,approvalResponse:e,toolCall:s};e.approved?a.push(c):o.push(c)}return{approvedToolApprovals:a,deniedToolApprovals:o}}function NE(){return(globalThis==null?void 0:globalThis.performance)?.now()??Date.now()}async function PE({toolCall:e,tools:t,tracer:n,telemetry:r,messages:i,abortSignal:a,experimental_context:o,stepNumber:s,model:c,onPreliminaryToolResult:l,onToolCallStart:u,onToolCallFinish:d}){let{toolName:f,toolCallId:p,input:m}=e,h=t?.[f];if(h?.execute==null)return;let g={stepNumber:s,model:c,toolCall:e,messages:i,abortSignal:a,functionId:r?.functionId,metadata:r?.metadata,experimental_context:o};return bE({name:`ai.toolCall`,attributes:SE({telemetry:r,attributes:{...gE({operationId:`ai.toolCall`,telemetry:r}),"ai.toolCall.name":f,"ai.toolCall.id":p,"ai.toolCall.args":{output:()=>JSON.stringify(m)}}}),tracer:n,fn:async t=>{let n;await KT({event:g,callbacks:u});let s=NE();try{let t=Jde({execute:h.execute.bind(h),input:m,options:{toolCallId:p,messages:i,abortSignal:a,experimental_context:o}});for await(let r of t)r.type===`preliminary`?l?.({...e,type:`tool-result`,output:r.output,preliminary:!0}):n=r.output}catch(n){let r=NE()-s;return await KT({event:{...g,success:!1,error:n,durationMs:r},callbacks:d}),xE(t,n),{type:`tool-error`,toolCallId:p,toolName:f,input:m,error:n,dynamic:h.type===`dynamic`,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}}let c=NE()-s;await KT({event:{...g,success:!0,output:n,durationMs:c},callbacks:d});try{t.setAttributes(await SE({telemetry:r,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(n)}}}))}catch{}return{type:`tool-result`,toolCallId:p,toolName:f,input:m,output:n,dynamic:h.type===`dynamic`,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}}})}function FE(e){let t=e.filter(e=>e.type===`reasoning`);return t.length===0?void 0:t.map(e=>e.text).join(` -`)}function IE(e){let t=e.filter(e=>e.type===`text`);if(t.length!==0)return t.map(e=>e.text).join(``)}var LE=class{constructor({data:e,mediaType:t}){let n=e instanceof Uint8Array;this.base64Data=n?void 0:e,this.uint8ArrayData=n?e:void 0,this.mediaType=t}get base64(){return this.base64Data??=nC(this.uint8ArrayData),this.base64Data}get uint8Array(){return this.uint8ArrayData??=tC(this.base64Data),this.uint8ArrayData}},_me=class extends LE{constructor(e){super(e),this.type=`file`}};async function RE({tool:e,toolCall:t,messages:n,experimental_context:r}){return e.needsApproval==null?!1:typeof e.needsApproval==`boolean`?e.needsApproval:await e.needsApproval(t.input,{toolCallId:t.toolCallId,messages:n,experimental_context:r})}Cpe({},{array:()=>bme,choice:()=>xme,json:()=>Sme,object:()=>yme,text:()=>BE});function vme(e){let t=[`ROOT`],n=-1,r=null;function i(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function a(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function o(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let s=0;s=0;n--)switch(t[n]){case`INSIDE_STRING`:s+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:s+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:s+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?s+=`true`.slice(t.length):`false`.startsWith(t)?s+=`false`.slice(t.length):`null`.startsWith(t)&&(s+=`null`.slice(t.length))}}return s}async function zE(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await MC({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await MC({text:vme(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}var BE=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),yme=({schema:e,name:t,description:n})=>{let r=OC(e);return{name:`object`,responseFormat:LC(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await MC({text:e});if(!n.success)throw new ST({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await jC({value:n.value,schema:r});if(!i.success)throw new ST({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await zE(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},bme=({element:e,name:t,description:n})=>{let r=OC(e);return{name:`array`,responseFormat:LC(r.jsonSchema).then(e=>{let{$schema:r,...i}=e;return{type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:i}},required:[`elements`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:e},t){let n=await MC({text:e});if(!n.success)throw new ST({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=n.value;if(typeof i!=`object`||!i||!(`elements`in i)||!Array.isArray(i.elements))throw new ST({message:`No object generated: response did not match schema.`,cause:new eS({value:i,cause:`response must be an object with an elements array`}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(let n of i.elements){let i=await jC({value:n,schema:r});if(!i.success)throw new ST({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return i.elements},async parsePartialOutput({text:e}){let t=await zE(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let e=t.value;if(typeof e!=`object`||!e||!(`elements`in e)||!Array.isArray(e.elements))return;let n=t.state===`repaired-parse`&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of n){let t=await jC({value:e,schema:r});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(t!=null)for(;e({name:`choice`,responseFormat:Promise.resolve({type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:t},n){let r=await MC({text:t});if(!r.success)throw new ST({message:`No object generated: could not parse the response.`,cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=r.value;if(typeof i!=`object`||!i||!(`result`in i)||typeof i.result!=`string`||!e.includes(i.result))throw new ST({message:`No object generated: response did not match schema.`,cause:new eS({value:i,cause:`response must be an object that contains a choice value.`}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.result},async parsePartialOutput({text:t}){let n=await zE(t);switch(n.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let t=n.value;if(typeof t!=`object`||!t||!(`result`in t)||typeof t.result!=`string`)return;let r=e.filter(e=>e.startsWith(t.result));return n.state===`successful-parse`?r.includes(t.result)?{partial:t.result}:void 0:r.length===1?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),Sme=({name:e,description:t}={})=>({name:`json`,responseFormat:Promise.resolve({type:`json`,...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:e},t){let n=await MC({text:e});if(!n.success)throw new ST({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await zE(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return t.value===void 0?void 0:{partial:t.value}}},createElementStreamTransform(){}});async function VE({toolCall:e,tools:t,repairToolCall:n,system:r,messages:i}){try{if(t==null){if(e.providerExecuted&&e.dynamic)return await HE(e);throw new AT({toolName:e.toolName})}try{return await UE({toolCall:e,tools:t})}catch(a){if(n==null||!(AT.isInstance(a)||uT.isInstance(a)))throw a;let o=null;try{o=await n({toolCall:e,tools:t,inputSchema:async({toolName:e})=>{let{inputSchema:n}=t[e];return await OC(n).jsonSchema},system:r,messages:i,error:a})}catch(e){throw new Ppe({cause:e,originalError:a})}if(o==null)throw a;return await UE({toolCall:o,tools:t})}}catch(n){let r=await MC({text:e.input}),i=r.success?r.value:e.input;return{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:i,dynamic:!0,invalid:!0,error:n,title:t?.[e.toolName]?.title,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}}}async function HE(e){let t=e.input.trim()===``?{success:!0,value:{}}:await MC({text:e.input});if(t.success===!1)throw new uT({toolName:e.toolName,toolInput:e.input,cause:t.error});return{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:t.value,providerExecuted:!0,dynamic:!0,providerMetadata:e.providerMetadata}}async function UE({toolCall:e,tools:t}){let n=e.toolName,r=t[n];if(r==null){if(e.providerExecuted&&e.dynamic)return await HE(e);throw new AT({toolName:e.toolName,availableTools:Object.keys(t)})}let i=OC(r.inputSchema),a=e.input.trim()===``?await jC({value:{},schema:i}):await MC({text:e.input,schema:i});if(a.success===!1)throw new uT({toolName:n,toolInput:e.input,cause:a.error});return r.type===`dynamic`?{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:a.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,dynamic:!0,title:r.title}:{type:`tool-call`,toolCallId:e.toolCallId,toolName:n,input:a.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:r.title}}var WE=class{constructor({stepNumber:e,model:t,functionId:n,metadata:r,experimental_context:i,content:a,finishReason:o,rawFinishReason:s,usage:c,warnings:l,request:u,response:d,providerMetadata:f}){this.stepNumber=e,this.model=t,this.functionId=n,this.metadata=r,this.experimental_context=i,this.content=a,this.finishReason=o,this.rawFinishReason=s,this.usage=c,this.warnings=l,this.request=u,this.response=d,this.providerMetadata=f}get text(){return this.content.filter(e=>e.type===`text`).map(e=>e.text).join(``)}get reasoning(){return this.content.filter(e=>e.type===`reasoning`)}get reasoningText(){return this.reasoning.length===0?void 0:this.reasoning.map(e=>e.text).join(``)}get files(){return this.content.filter(e=>e.type===`file`).map(e=>e.file)}get sources(){return this.content.filter(e=>e.type===`source`)}get toolCalls(){return this.content.filter(e=>e.type===`tool-call`)}get staticToolCalls(){return this.toolCalls.filter(e=>e.dynamic!==!0)}get dynamicToolCalls(){return this.toolCalls.filter(e=>e.dynamic===!0)}get toolResults(){return this.content.filter(e=>e.type===`tool-result`)}get staticToolResults(){return this.toolResults.filter(e=>e.dynamic!==!0)}get dynamicToolResults(){return this.toolResults.filter(e=>e.dynamic===!0)}};function GE(e){return({steps:t})=>t.length===e}async function KE({stopConditions:e,steps:t}){return(await Promise.all(e.map(e=>e({steps:t})))).some(e=>e)}async function qE({content:e,tools:t}){let n=[],r=[];for(let n of e)if(n.type!==`source`&&!((n.type===`tool-result`||n.type===`tool-error`)&&!n.providerExecuted)&&!(n.type===`text`&&n.text.length===0))switch(n.type){case`text`:r.push({type:`text`,text:n.text,providerOptions:n.providerMetadata});break;case`reasoning`:r.push({type:`reasoning`,text:n.text,providerOptions:n.providerMetadata});break;case`file`:r.push({type:`file`,data:n.file.base64,mediaType:n.file.mediaType,providerOptions:n.providerMetadata});break;case`tool-call`:r.push({type:`tool-call`,toolCallId:n.toolCallId,toolName:n.toolName,input:n.invalid&&typeof n.input!=`object`?{}:n.input,providerExecuted:n.providerExecuted,providerOptions:n.providerMetadata});break;case`tool-result`:{let e=await aE({toolCallId:n.toolCallId,input:n.input,tool:t?.[n.toolName],output:n.output,errorMode:`none`});r.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,output:e,providerOptions:n.providerMetadata});break}case`tool-error`:{let e=await aE({toolCallId:n.toolCallId,input:n.input,tool:t?.[n.toolName],output:n.error,errorMode:`json`});r.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,output:e,providerOptions:n.providerMetadata});break}case`tool-approval-request`:r.push({type:`tool-approval-request`,approvalId:n.approvalId,toolCallId:n.toolCall.toolCallId});break}r.length>0&&n.push({role:`assistant`,content:r});let i=[];for(let n of e){if(!(n.type===`tool-result`||n.type===`tool-error`)||n.providerExecuted)continue;let e=await aE({toolCallId:n.toolCallId,input:n.input,tool:t?.[n.toolName],output:n.type===`tool-result`?n.output:n.error,errorMode:n.type===`tool-error`?`text`:`none`});i.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,output:e,...n.providerMetadata==null?{}:{providerOptions:n.providerMetadata}})}return i.length>0&&n.push({role:`tool`,content:i}),n}function JE(...e){let t=e.filter(e=>e!=null);if(t.length===0)return;if(t.length===1)return t[0];let n=new AbortController;for(let e of t){if(e.aborted)return n.abort(e.reason),n.signal;e.addEventListener(`abort`,()=>{n.abort(e.reason)},{once:!0})}return n.signal}var Cme=aC({prefix:`aitxt`,size:24});async function YE({model:e,tools:t,toolChoice:n,system:r,prompt:i,messages:a,maxRetries:o,abortSignal:s,timeout:c,headers:l,stopWhen:u=GE(1),experimental_output:d,output:f=d,experimental_telemetry:p,providerOptions:m,experimental_activeTools:h,activeTools:g=h,experimental_prepareStep:_,prepareStep:v=_,experimental_repairToolCall:y,experimental_download:b,experimental_context:x,experimental_include:S,_internal:{generateId:C=Cme}={},experimental_onStart:w,experimental_onStepStart:T,experimental_onToolCallStart:E,experimental_onToolCallFinish:D,onStepFinish:O,onFinish:ee,...te}){let k=ZT(e),A=wE(),j=GT(u),M=QT(c),N=$T(c),P=N==null?void 0:new AbortController,F=JE(s,M==null?void 0:AbortSignal.timeout(M),P?.signal),{maxRetries:I,retry:ne}=jE({maxRetries:o,abortSignal:F}),re=sE(te),ie=uC(l??{},`ai/${eE}`),ae=_E({model:k,telemetry:p,headers:ie,settings:{...re,maxRetries:I}}),oe={provider:k.provider,modelId:k.modelId},se=await mE({system:r,prompt:i,messages:a}),ce=A(p?.integrations);await KT({event:{model:oe,system:r,prompt:i,messages:a,tools:t,toolChoice:n,activeTools:g,maxOutputTokens:re.maxOutputTokens,temperature:re.temperature,topP:re.topP,topK:re.topK,presencePenalty:re.presencePenalty,frequencyPenalty:re.frequencyPenalty,stopSequences:re.stopSequences,seed:re.seed,maxRetries:I,timeout:c,headers:l,providerOptions:m,stopWhen:u,output:f,abortSignal:s,include:S,functionId:p?.functionId,metadata:p?.metadata,experimental_context:x},callbacks:[w,ce.onStart]});let le=yE(p);try{return await bE({name:`ai.generateText`,attributes:SE({telemetry:p,attributes:{...gE({operationId:`ai.generateText`,telemetry:p}),...ae,"ai.model.provider":k.provider,"ai.model.id":k.modelId,"ai.prompt":{input:()=>JSON.stringify({system:r,prompt:i,messages:a})}}}),tracer:le,fn:async e=>{let i=se.messages,a=[],{approvedToolApprovals:o,deniedToolApprovals:d}=ME({messages:i}),h=o.filter(e=>!e.toolCall.providerExecuted);if(d.length>0||h.length>0){let e=await XE({toolCalls:h.map(e=>e.toolCall),tools:t,tracer:le,telemetry:p,messages:i,abortSignal:F,experimental_context:x,stepNumber:0,model:oe,onToolCallStart:[E,ce.onToolCallStart],onToolCallFinish:[D,ce.onToolCallFinish]}),n=[];for(let r of e){let e=await aE({toolCallId:r.toolCallId,input:r.input,tool:t?.[r.toolName],output:r.type===`tool-result`?r.output:r.error,errorMode:r.type===`tool-error`?`text`:`none`});n.push({type:`tool-result`,toolCallId:r.toolCallId,toolName:r.toolName,output:e})}for(let e of d)n.push({type:`tool-result`,toolCallId:e.toolCall.toolCallId,toolName:e.toolCall.toolName,output:{type:`execution-denied`,reason:e.approvalResponse.reason,...e.toolCall.providerExecuted&&{providerOptions:{openai:{approvalId:e.approvalResponse.approvalId}}}}});a.push({role:`tool`,content:n})}let _=sE(te),w,A=[],M=[],I=[],re=new Map;do{let e=N==null?void 0:setTimeout(()=>P.abort(),N);try{let e=[...i,...a],o=await v?.({model:k,steps:I,stepNumber:I.length,messages:e,experimental_context:x}),d=ZT(o?.model??k),h={provider:d.provider,modelId:d.modelId},ee=await rE({prompt:{system:o?.system??se.system,messages:o?.messages??e},supportedUrls:await d.supportedUrls,download:b});x=o?.experimental_context??x;let j=o?.activeTools??g,{toolChoice:N,tools:P}=await cE({tools:t,toolChoice:o?.toolChoice??n,activeTools:j}),oe=o?.messages??e,L=o?.system??se.system,ue=kE(m,o?.providerOptions);await KT({event:{stepNumber:I.length,model:h,system:L,messages:oe,tools:t,toolChoice:N,activeTools:j,steps:[...I],providerOptions:ue,timeout:c,headers:l,stopWhen:u,output:f,abortSignal:s,include:S,functionId:p?.functionId,metadata:p?.metadata,experimental_context:x},callbacks:[T,ce.onStepStart]}),w=await ne(()=>bE({name:`ai.generateText.doGenerate`,attributes:SE({telemetry:p,attributes:{...gE({operationId:`ai.generateText.doGenerate`,telemetry:p}),...ae,"ai.model.provider":d.provider,"ai.model.id":d.modelId,"ai.prompt.messages":{input:()=>CE(ee)},"ai.prompt.tools":{input:()=>P?.map(e=>JSON.stringify(e))},"ai.prompt.toolChoice":{input:()=>N==null?void 0:JSON.stringify(N)},"gen_ai.system":d.provider,"gen_ai.request.model":d.modelId,"gen_ai.request.frequency_penalty":te.frequencyPenalty,"gen_ai.request.max_tokens":te.maxOutputTokens,"gen_ai.request.presence_penalty":te.presencePenalty,"gen_ai.request.stop_sequences":te.stopSequences,"gen_ai.request.temperature":te.temperature??void 0,"gen_ai.request.top_k":te.topK,"gen_ai.request.top_p":te.topP}}),tracer:le,fn:async e=>{let t=await d.doGenerate({..._,tools:P,toolChoice:N,responseFormat:await f?.responseFormat,prompt:ee,providerOptions:ue,abortSignal:F,headers:ie}),n={id:t.response?.id??C(),timestamp:t.response?.timestamp??new Date,modelId:t.response?.modelId??d.modelId,headers:t.response?.headers,body:t.response?.body},r=TE(t.usage);return e.setAttributes(await SE({telemetry:p,attributes:{"ai.response.finishReason":t.finishReason.unified,"ai.response.text":{output:()=>IE(t.content)},"ai.response.reasoning":{output:()=>FE(t.content)},"ai.response.toolCalls":{output:()=>{let e=ZE(t.content);return e==null?void 0:JSON.stringify(e)}},"ai.response.id":n.id,"ai.response.model":n.modelId,"ai.response.timestamp":n.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(t.providerMetadata),"ai.usage.inputTokens":t.usage.inputTokens.total,"ai.usage.inputTokenDetails.noCacheTokens":t.usage.inputTokens.noCache,"ai.usage.inputTokenDetails.cacheReadTokens":t.usage.inputTokens.cacheRead,"ai.usage.inputTokenDetails.cacheWriteTokens":t.usage.inputTokens.cacheWrite,"ai.usage.outputTokens":t.usage.outputTokens.total,"ai.usage.outputTokenDetails.textTokens":t.usage.outputTokens.text,"ai.usage.outputTokenDetails.reasoningTokens":t.usage.outputTokens.reasoning,"ai.usage.totalTokens":r.totalTokens,"ai.usage.reasoningTokens":t.usage.outputTokens.reasoning,"ai.usage.cachedInputTokens":t.usage.inputTokens.cacheRead,"gen_ai.response.finish_reasons":[t.finishReason.unified],"gen_ai.response.id":n.id,"gen_ai.response.model":n.modelId,"gen_ai.usage.input_tokens":t.usage.inputTokens.total,"gen_ai.usage.output_tokens":t.usage.outputTokens.total}})),{...t,response:n}}}));let de=await Promise.all(w.content.filter(e=>e.type===`tool-call`).map(n=>VE({toolCall:n,tools:t,repairToolCall:y,system:r,messages:e}))),fe={};for(let n of de){if(n.invalid)continue;let r=t?.[n.toolName];r!=null&&(r?.onInputAvailable!=null&&await r.onInputAvailable({input:n.input,toolCallId:n.toolCallId,messages:e,abortSignal:F,experimental_context:x}),await RE({tool:r,toolCall:n,messages:e,experimental_context:x})&&(fe[n.toolCallId]={type:`tool-approval-request`,approvalId:C(),toolCall:n}))}let pe=de.filter(e=>e.invalid&&e.dynamic);M=[];for(let e of pe)M.push({type:`tool-error`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,error:oC(e.error),dynamic:!0});A=de.filter(e=>!e.providerExecuted),t!=null&&M.push(...await XE({toolCalls:A.filter(e=>!e.invalid&&fe[e.toolCallId]==null),tools:t,tracer:le,telemetry:p,messages:e,abortSignal:F,experimental_context:x,stepNumber:I.length,model:h,onToolCallStart:[E,ce.onToolCallStart],onToolCallFinish:[D,ce.onToolCallFinish]}));for(let e of de){if(!e.providerExecuted)continue;let n=t?.[e.toolName];n?.type===`provider`&&n.supportsDeferredResults&&(w.content.some(t=>t.type===`tool-result`&&t.toolCallId===e.toolCallId)||re.set(e.toolCallId,{toolName:e.toolName}))}for(let e of w.content)e.type===`tool-result`&&re.delete(e.toolCallId);let me=Tme({content:w.content,toolCalls:de,toolOutputs:M,toolApprovalRequests:Object.values(fe),tools:t});a.push(...await qE({content:me,tools:t}));let he=S?.requestBody??!0?w.request??{}:{...w.request,body:void 0},ge={...w.response,messages:structuredClone(a),body:S?.responseBody??!0?w.response?.body:void 0},_e=I.length,ve=new WE({stepNumber:_e,model:h,functionId:p?.functionId,metadata:p?.metadata,experimental_context:x,content:me,finishReason:w.finishReason.unified,rawFinishReason:w.finishReason.raw,usage:TE(w.usage),warnings:w.warnings,providerMetadata:w.providerMetadata,request:he,response:ge});JT({warnings:w.warnings??[],provider:h.provider,model:h.modelId}),I.push(ve),await KT({event:ve,callbacks:[O,ce.onStepFinish]})}finally{e!=null&&clearTimeout(e)}}while((A.length>0&&M.length===A.length||re.size>0)&&!await KE({stopConditions:j,steps:I}));e.setAttributes(await SE({telemetry:p,attributes:{"ai.response.finishReason":w.finishReason.unified,"ai.response.text":{output:()=>IE(w.content)},"ai.response.reasoning":{output:()=>FE(w.content)},"ai.response.toolCalls":{output:()=>{let e=ZE(w.content);return e==null?void 0:JSON.stringify(e)}},"ai.response.providerMetadata":JSON.stringify(w.providerMetadata)}}));let L=I[I.length-1],ue=I.reduce((e,t)=>DE(e,t.usage),{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0});e.setAttributes(await SE({telemetry:p,attributes:{"ai.usage.inputTokens":ue.inputTokens,"ai.usage.inputTokenDetails.noCacheTokens":ue.inputTokenDetails?.noCacheTokens,"ai.usage.inputTokenDetails.cacheReadTokens":ue.inputTokenDetails?.cacheReadTokens,"ai.usage.inputTokenDetails.cacheWriteTokens":ue.inputTokenDetails?.cacheWriteTokens,"ai.usage.outputTokens":ue.outputTokens,"ai.usage.outputTokenDetails.textTokens":ue.outputTokenDetails?.textTokens,"ai.usage.outputTokenDetails.reasoningTokens":ue.outputTokenDetails?.reasoningTokens,"ai.usage.totalTokens":ue.totalTokens,"ai.usage.reasoningTokens":ue.outputTokenDetails?.reasoningTokens,"ai.usage.cachedInputTokens":ue.inputTokenDetails?.cacheReadTokens}})),await KT({event:{stepNumber:L.stepNumber,model:L.model,functionId:L.functionId,metadata:L.metadata,experimental_context:L.experimental_context,finishReason:L.finishReason,rawFinishReason:L.rawFinishReason,usage:L.usage,content:L.content,text:L.text,reasoningText:L.reasoningText,reasoning:L.reasoning,files:L.files,sources:L.sources,toolCalls:L.toolCalls,staticToolCalls:L.staticToolCalls,dynamicToolCalls:L.dynamicToolCalls,toolResults:L.toolResults,staticToolResults:L.staticToolResults,dynamicToolResults:L.dynamicToolResults,request:L.request,response:L.response,warnings:L.warnings,providerMetadata:L.providerMetadata,steps:I,totalUsage:ue},callbacks:[ee,ce.onFinish]});let de;return L.finishReason===`stop`&&(de=await(f??BE()).parseCompleteOutput({text:L.text},{response:L.response,usage:L.usage,finishReason:L.finishReason})),new wme({steps:I,totalUsage:ue,output:de})}})}catch(e){throw hE(e)}}async function XE({toolCalls:e,tools:t,tracer:n,telemetry:r,messages:i,abortSignal:a,experimental_context:o,stepNumber:s,model:c,onToolCallStart:l,onToolCallFinish:u}){return(await Promise.all(e.map(async e=>PE({toolCall:e,tools:t,tracer:n,telemetry:r,messages:i,abortSignal:a,experimental_context:o,stepNumber:s,model:c,onToolCallStart:l,onToolCallFinish:u})))).filter(e=>e!=null)}var wme=class{constructor(e){this.steps=e.steps,this._output=e.output,this.totalUsage=e.totalUsage}get finalStep(){return this.steps[this.steps.length-1]}get content(){return this.finalStep.content}get text(){return this.finalStep.text}get files(){return this.finalStep.files}get reasoningText(){return this.finalStep.reasoningText}get reasoning(){return this.finalStep.reasoning}get toolCalls(){return this.finalStep.toolCalls}get staticToolCalls(){return this.finalStep.staticToolCalls}get dynamicToolCalls(){return this.finalStep.dynamicToolCalls}get toolResults(){return this.finalStep.toolResults}get staticToolResults(){return this.finalStep.staticToolResults}get dynamicToolResults(){return this.finalStep.dynamicToolResults}get sources(){return this.finalStep.sources}get finishReason(){return this.finalStep.finishReason}get rawFinishReason(){return this.finalStep.rawFinishReason}get warnings(){return this.finalStep.warnings}get providerMetadata(){return this.finalStep.providerMetadata}get response(){return this.finalStep.response}get request(){return this.finalStep.request}get usage(){return this.finalStep.usage}get experimental_output(){return this.output}get output(){if(this._output==null)throw new ET;return this._output}};function ZE(e){let t=e.filter(e=>e.type===`tool-call`);if(t.length!==0)return t.map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,input:e.input}))}function Tme({content:e,toolCalls:t,toolOutputs:n,toolApprovalRequests:r,tools:i}){let a=[];for(let n of e)switch(n.type){case`text`:case`reasoning`:case`source`:a.push(n);break;case`file`:a.push({type:`file`,file:new LE(n),...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}});break;case`tool-call`:a.push(t.find(e=>e.toolCallId===n.toolCallId));break;case`tool-result`:{let e=t.find(e=>e.toolCallId===n.toolCallId);if(e==null){let e=i?.[n.toolName];if(!(e?.type===`provider`&&e.supportsDeferredResults))throw Error(`Tool call ${n.toolCallId} not found.`);n.isError?a.push({type:`tool-error`,toolCallId:n.toolCallId,toolName:n.toolName,input:void 0,error:n.result,providerExecuted:!0,dynamic:n.dynamic,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}}):a.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,input:void 0,output:n.result,providerExecuted:!0,dynamic:n.dynamic,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}});break}n.isError?a.push({type:`tool-error`,toolCallId:n.toolCallId,toolName:n.toolName,input:e.input,error:n.result,providerExecuted:!0,dynamic:e.dynamic,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}}):a.push({type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,input:e.input,output:n.result,providerExecuted:!0,dynamic:e.dynamic,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}});break}case`tool-approval-request`:{let e=t.find(e=>e.toolCallId===n.toolCallId);if(e==null)throw new mT({toolCallId:n.toolCallId,approvalId:n.approvalId});a.push({type:`tool-approval-request`,approvalId:n.approvalId,toolCall:e});break}}return[...a,...n,...r]}function QE(e,t){let n=new Headers(e??{});for(let[e,r]of Object.entries(t))n.has(e)||n.set(e,r);return n}function Eme({status:e,statusText:t,headers:n,textStream:r}){return new Response(r.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:QE(n,{"content-type":`text/plain; charset=utf-8`})})}function $E({response:e,status:t,statusText:n,headers:r,stream:i}){let a=t??200;n===void 0?e.writeHead(a,r):e.writeHead(a,n,r);let o=i.getReader();(async()=>{try{for(;;){let{done:t,value:n}=await o.read();if(t)break;e.write(n)||await new Promise(t=>{e.once(`drain`,t)})}}catch(e){throw e}finally{e.end()}})()}function Dme({response:e,status:t,statusText:n,headers:r,textStream:i}){$E({response:e,status:t,statusText:n,headers:Object.fromEntries(QE(r,{"content-type":`text/plain; charset=utf-8`}).entries()),stream:i.pipeThrough(new TextEncoderStream)})}var eD=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)} - -`)},flush(e){e.enqueue(`data: [DONE] - -`)}})}},tD={"content-type":`text/event-stream`,"cache-control":`no-cache`,connection:`keep-alive`,"x-vercel-ai-ui-message-stream":`v1`,"x-accel-buffering":`no`};function Ome({status:e,statusText:t,headers:n,stream:r,consumeSseStream:i}){let a=r.pipeThrough(new eD);if(i){let[e,t]=a.tee();a=e,i({stream:t})}return new Response(a.pipeThrough(new TextEncoderStream),{status:e,statusText:t,headers:QE(n,tD)})}function kme({originalMessages:e,responseMessageId:t}){if(e==null)return;let n=e[e.length-1];return n?.role===`assistant`?n.id:typeof t==`function`?t():t}var Ame=EC(()=>kC(l([T({type:m(`text-start`),id:r(),providerMetadata:uE.optional()}),T({type:m(`text-delta`),id:r(),delta:r(),providerMetadata:uE.optional()}),T({type:m(`text-end`),id:r(),providerMetadata:uE.optional()}),T({type:m(`error`),errorText:r()}),T({type:m(`tool-input-start`),toolCallId:r(),toolName:r(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional(),title:r().optional()}),T({type:m(`tool-input-delta`),toolCallId:r(),inputTextDelta:r()}),T({type:m(`tool-input-available`),toolCallId:r(),toolName:r(),input:u(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional(),title:r().optional()}),T({type:m(`tool-input-error`),toolCallId:r(),toolName:r(),input:u(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional(),errorText:r(),title:r().optional()}),T({type:m(`tool-approval-request`),approvalId:r(),toolCallId:r()}),T({type:m(`tool-output-available`),toolCallId:r(),output:u(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional(),preliminary:S().optional()}),T({type:m(`tool-output-error`),toolCallId:r(),errorText:r(),providerExecuted:S().optional(),providerMetadata:uE.optional(),dynamic:S().optional()}),T({type:m(`tool-output-denied`),toolCallId:r()}),T({type:m(`reasoning-start`),id:r(),providerMetadata:uE.optional()}),T({type:m(`reasoning-delta`),id:r(),delta:r(),providerMetadata:uE.optional()}),T({type:m(`reasoning-end`),id:r(),providerMetadata:uE.optional()}),T({type:m(`source-url`),sourceId:r(),url:r(),title:r().optional(),providerMetadata:uE.optional()}),T({type:m(`source-document`),sourceId:r(),mediaType:r(),title:r(),filename:r().optional(),providerMetadata:uE.optional()}),T({type:m(`file`),url:r(),mediaType:r(),providerMetadata:uE.optional()}),T({type:g(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:r().optional(),data:u(),transient:S().optional()}),T({type:m(`start-step`)}),T({type:m(`finish-step`)}),T({type:m(`start`),messageId:r().optional(),messageMetadata:u().optional()}),T({type:m(`finish`),finishReason:E([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`other`]).optional(),messageMetadata:u().optional()}),T({type:m(`abort`),reason:r().optional()}),T({type:m(`message-metadata`),messageMetadata:u()})])));function jme(e){return e.type.startsWith(`data-`)}function nD(e){return e.type.startsWith(`tool-`)}function Mme(e){return e.type===`dynamic-tool`}function rD(e){return nD(e)||Mme(e)}function iD(e){return e.type.split(`-`).slice(1).join(`-`)}function aD({lastMessage:e,messageId:t}){return{message:e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function oD({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await r(async({state:r,write:c})=>{function l(e){let t=r.message.parts.filter(rD).find(t=>t.toolCallId===e);if(t==null)throw new LT({chunkType:`tool-invocation`,chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function u(e){let t=r.message.parts.find(t=>nD(t)&&t.toolCallId===e.toolCallId),n=e,i=t;if(t!=null){t.state=e.state,i.input=n.input,i.output=n.output,i.errorText=n.errorText,i.rawInput=n.rawInput,i.preliminary=n.preliminary,e.title!==void 0&&(i.title=e.title),i.providerExecuted=n.providerExecuted??t.providerExecuted;let r=n.providerMetadata;if(r!=null)if(e.state===`output-available`||e.state===`output-error`){let e=t;e.resultProviderMetadata=r}else t.callProviderMetadata=r}else r.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,input:n.input,output:n.output,rawInput:n.rawInput,errorText:n.errorText,providerExecuted:n.providerExecuted,preliminary:n.preliminary,...n.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:n.providerMetadata}:{},...n.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:n.providerMetadata}:{}})}function d(e){let t=r.message.parts.find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),n=e,i=t;if(t!=null){t.state=e.state,i.toolName=e.toolName,i.input=n.input,i.output=n.output,i.errorText=n.errorText,i.rawInput=n.rawInput??i.rawInput,i.preliminary=n.preliminary,e.title!==void 0&&(i.title=e.title),i.providerExecuted=n.providerExecuted??t.providerExecuted;let r=n.providerMetadata;if(r!=null)if(e.state===`output-available`||e.state===`output-error`){let e=t;e.resultProviderMetadata=r}else t.callProviderMetadata=r}else r.message.parts.push({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:n.input,output:n.output,errorText:n.errorText,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:e.title,...n.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:n.providerMetadata}:{},...n.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:n.providerMetadata}:{}})}async function f(e){if(e!=null){let n=r.message.metadata==null?e:kE(r.message.metadata,e);t!=null&&await AC({value:n,schema:t,context:{field:`message.metadata`,entityId:r.message.id}}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),c();break}case`text-delta`:{let t=r.activeTextParts[e.id];if(t==null)throw new LT({chunkType:`text-delta`,chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,c();break}case`text-end`:{let t=r.activeTextParts[e.id];if(t==null)throw new LT({chunkType:`text-end`,chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state=`done`,t.providerMetadata=e.providerMetadata??t.providerMetadata,delete r.activeTextParts[e.id],c();break}case`reasoning-start`:{let t={type:`reasoning`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),c();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new LT({chunkType:`reasoning-delta`,chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,c();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new LT({chunkType:`reasoning-end`,chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=e.providerMetadata??t.providerMetadata,t.state=`done`,delete r.activeReasoningParts[e.id],c();break}case`file`:r.message.parts.push({type:`file`,mediaType:e.mediaType,url:e.url,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}),c();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),c();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),c();break;case`tool-input-start`:{let t=r.message.parts.filter(nD);r.partialToolCalls[e.toolCallId]={text:``,toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title},e.dynamic?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}),c();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];if(t==null)throw new LT({chunkType:`tool-input-delta`,chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let{value:n}=await zE(t.text);t.dynamic?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n,title:t.title}):u({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n,title:t.title}),c();break}case`tool-input-available`:e.dynamic?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}),c(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:{let t=r.message.parts.filter(rD).find(t=>t.toolCallId===e.toolCallId);(t==null?e.dynamic:t.type===`dynamic-tool`)?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c();break}case`tool-approval-request`:{let t=l(e.toolCallId);t.state=`approval-requested`,t.approval={id:e.approvalId},c();break}case`tool-output-denied`:{let t=l(e.toolCallId);t.state=`output-denied`,c();break}case`tool-output-available`:{let t=l(e.toolCallId);t.type===`dynamic-tool`?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}):u({toolCallId:e.toolCallId,toolName:iD(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title}),c();break}case`tool-output-error`:{let t=l(e.toolCallId);t.type===`dynamic-tool`?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}):u({toolCallId:e.toolCallId,toolName:iD(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}),c();break}case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:r.activeTextParts={},r.activeReasoningParts={};break;case`start`:e.messageId!=null&&(r.message.id=e.messageId),await f(e.messageMetadata),(e.messageId!=null||e.messageMetadata!=null)&&c();break;case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await f(e.messageMetadata),e.messageMetadata!=null&&c();break;case`message-metadata`:await f(e.messageMetadata),e.messageMetadata!=null&&c();break;case`error`:i?.(Error(e.errorText));break;default:if(jme(e)){if(n?.[e.type]!=null){let t=r.message.parts.findIndex(t=>`id`in t&&`data`in t&&t.id===e.id&&t.type===e.type),i=t>=0?t:r.message.parts.length;await AC({value:e.data,schema:n[e.type],context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}let t=e;if(t.transient){o?.(t);break}let i=t.id==null?void 0:r.message.parts.find(e=>t.type===e.type&&t.id===e.id);i==null?r.message.parts.push(t):i.data=t.data,o?.(t),c()}}s.enqueue(e)})}}))}function Nme({messageId:e,originalMessages:t=[],onStepFinish:n,onFinish:r,onError:i,stream:a}){let o=t?.[t.length-1];o?.role===`assistant`?e=o.id:o=void 0;let s=!1,c=a.pipeThrough(new TransformStream({transform(t,n){if(t.type===`start`){let n=t;n.messageId==null&&e!=null&&(n.messageId=e)}t.type===`abort`&&(s=!0),n.enqueue(t)}}));if(r==null&&n==null)return c;let l=aD({lastMessage:o?structuredClone(o):void 0,messageId:e??``}),u=async e=>{await e({state:l,write:()=>{}})},d=!1,f=async()=>{if(d||!r)return;d=!0;let e=l.message.id===o?.id;await r({isAborted:s,isContinuation:e,responseMessage:l.message,messages:[...e?t.slice(0,-1):t,l.message],finishReason:l.finishReason})},p=async()=>{if(!n)return;let e=l.message.id===o?.id;try{await n({isContinuation:e,responseMessage:structuredClone(l.message),messages:[...e?t.slice(0,-1):t,structuredClone(l.message)]})}catch(e){i(e)}};return oD({stream:c,runUpdateMessageJob:u,onError:i}).pipeThrough(new TransformStream({async transform(e,t){e.type===`finish-step`&&await p(),t.enqueue(e)},async cancel(){await f()},async flush(){await f()}}))}function Pme({response:e,status:t,statusText:n,headers:r,stream:i,consumeSseStream:a}){let o=i.pipeThrough(new eD);if(a){let[e,t]=o.tee();o=e,a({stream:t})}$E({response:e,status:t,statusText:n,headers:Object.fromEntries(QE(r,tD).entries()),stream:o.pipeThrough(new TextEncoderStream)})}function sD(e){let t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){let e=this.getReader(),t=!1;async function n(n){if(!t){t=!0;try{n&&await e.cancel?.call(e)}finally{try{e.releaseLock()}catch{}}}}return{async next(){if(t)return{done:!0,value:void 0};let{done:r,value:i}=await e.read();return r?(await n(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(e){throw await n(!0),e}}},t}async function cD({stream:e,onError:t}){let n=e.getReader();try{for(;;){let{done:e}=await n.read();if(e)break}}catch(e){t?.(e)}finally{n.releaseLock()}}function lD(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Fme(){let e=[],t=null,n=!1,r=lD(),i=()=>{n=!0,r.resolve(),e.forEach(e=>e.cancel()),e=[],t?.close()},a=async()=>{if(n&&e.length===0){t?.close();return}if(e.length===0)return r=lD(),await r.promise,a();try{let{value:r,done:i}=await e[0].read();i?(e.shift(),e.length===0&&n?t?.close():await a()):t?.enqueue(r)}catch(n){t?.error(n),e.shift(),i()}};return{stream:new ReadableStream({start(e){t=e},pull:a,async cancel(){for(let t of e)await t.cancel();e=[],n=!0}}),addStream:t=>{if(n)throw Error(`Cannot add inner stream: outer stream is closed`);e.push(t.getReader()),r.resolve()},close:()=>{n=!0,r.resolve(),e.length===0&&t?.close()},terminate:i}}function Ime({tools:e,generatorStream:t,tracer:n,telemetry:r,system:i,messages:a,abortSignal:o,repairToolCall:s,experimental_context:c,generateId:l,stepNumber:u,model:d,onToolCallStart:f,onToolCallFinish:p}){let m=null,h=new ReadableStream({start(e){m=e}}),g=new Set,_=new Map,v=new Map,y=!1,b;function x(){y&&g.size===0&&(b!=null&&m.enqueue(b),m.close())}let S=new TransformStream({async transform(t,h){let y=t.type;switch(y){case`stream-start`:case`text-start`:case`text-delta`:case`text-end`:case`reasoning-start`:case`reasoning-delta`:case`reasoning-end`:case`tool-input-start`:case`tool-input-delta`:case`tool-input-end`:case`source`:case`response-metadata`:case`error`:case`raw`:h.enqueue(t);break;case`file`:h.enqueue({type:`file`,file:new _me({data:t.data,mediaType:t.mediaType}),...t.providerMetadata==null?{}:{providerMetadata:t.providerMetadata}});break;case`finish`:b={type:`finish`,finishReason:t.finishReason.unified,rawFinishReason:t.finishReason.raw,usage:TE(t.usage),providerMetadata:t.providerMetadata};break;case`tool-approval-request`:{let e=v.get(t.toolCallId);if(e==null){m.enqueue({type:`error`,error:new mT({toolCallId:t.toolCallId,approvalId:t.approvalId})});break}h.enqueue({type:`tool-approval-request`,approvalId:t.approvalId,toolCall:e});break}case`tool-call`:try{let y=await VE({toolCall:t,tools:e,repairToolCall:s,system:i,messages:a});if(v.set(y.toolCallId,y),h.enqueue(y),y.invalid){m.enqueue({type:`tool-error`,toolCallId:y.toolCallId,toolName:y.toolName,input:y.input,error:oC(y.error),dynamic:!0,title:y.title});break}let b=e?.[y.toolName];if(b==null)break;if(b.onInputAvailable!=null&&await b.onInputAvailable({input:y.input,toolCallId:y.toolCallId,messages:a,abortSignal:o,experimental_context:c}),await RE({tool:b,toolCall:y,messages:a,experimental_context:c})){m.enqueue({type:`tool-approval-request`,approvalId:l(),toolCall:y});break}if(_.set(y.toolCallId,y.input),b.execute!=null&&y.providerExecuted!==!0){let t=l();g.add(t),PE({toolCall:y,tools:e,tracer:n,telemetry:r,messages:a,abortSignal:o,experimental_context:c,stepNumber:u,model:d,onToolCallStart:f,onToolCallFinish:p,onPreliminaryToolResult:e=>{m.enqueue(e)}}).then(e=>{m.enqueue(e)}).catch(e=>{m.enqueue({type:`error`,error:e})}).finally(()=>{g.delete(t),x()})}}catch(e){m.enqueue({type:`error`,error:e})}break;case`tool-result`:{let e=t.toolName;t.isError?m.enqueue({type:`tool-error`,toolCallId:t.toolCallId,toolName:e,input:_.get(t.toolCallId),providerExecuted:!0,error:t.result,dynamic:t.dynamic,...t.providerMetadata==null?{}:{providerMetadata:t.providerMetadata}}):h.enqueue({type:`tool-result`,toolCallId:t.toolCallId,toolName:e,input:_.get(t.toolCallId),output:t.result,providerExecuted:!0,dynamic:t.dynamic,...t.providerMetadata==null?{}:{providerMetadata:t.providerMetadata}});break}default:throw Error(`Unhandled chunk type: ${y}`)}},flush(){y=!0,x()}});return new ReadableStream({async start(e){return Promise.all([t.pipeThrough(S).pipeTo(new WritableStream({write(t){e.enqueue(t)},close(){}})),h.pipeTo(new WritableStream({write(t){e.enqueue(t)},close(){e.close()}}))])}})}var Lme=aC({prefix:`aitxt`,size:24});function Rme({model:e,tools:t,toolChoice:n,system:r,prompt:i,messages:a,maxRetries:o,abortSignal:s,timeout:c,headers:l,stopWhen:u=GE(1),experimental_output:d,output:f=d,experimental_telemetry:p,prepareStep:m,providerOptions:h,experimental_activeTools:g,activeTools:_=g,experimental_repairToolCall:v,experimental_transform:y,experimental_download:b,includeRawChunks:x=!1,onChunk:S,onError:C=({error:e})=>{console.error(e)},onFinish:w,onAbort:T,onStepFinish:E,experimental_onStart:D,experimental_onStepStart:O,experimental_onToolCallStart:ee,experimental_onToolCallFinish:te,experimental_context:k,experimental_include:A,_internal:{now:j=NE,generateId:M=Lme}={},...N}){let P=QT(c),F=$T(c),I=Kpe(c),ne=F==null?void 0:new AbortController,re=I==null?void 0:new AbortController;return new Bme({model:ZT(e),telemetry:p,headers:l,settings:N,maxRetries:o,abortSignal:JE(s,P==null?void 0:AbortSignal.timeout(P),ne?.signal,re?.signal),stepTimeoutMs:F,stepAbortController:ne,chunkTimeoutMs:I,chunkAbortController:re,system:r,prompt:i,messages:a,tools:t,toolChoice:n,transforms:GT(y),activeTools:_,repairToolCall:v,stopConditions:GT(u),output:f,providerOptions:h,prepareStep:m,includeRawChunks:x,timeout:c,stopWhen:u,originalAbortSignal:s,onChunk:S,onError:C,onFinish:w,onAbort:T,onStepFinish:E,onStart:D,onStepStart:O,onToolCallStart:ee,onToolCallFinish:te,now:j,generateId:M,experimental_context:k,download:b,include:A})}function zme(e){let t,n=``,r=``,i,a=``;function o({controller:e,partialOutput:n=void 0}){e.enqueue({part:{type:`text-delta`,id:t,text:r,providerMetadata:i},partialOutput:n}),r=``}return new TransformStream({async transform(s,c){if(s.type===`finish-step`&&r.length>0&&o({controller:c}),s.type!==`text-delta`&&s.type!==`text-start`&&s.type!==`text-end`){c.enqueue({part:s,partialOutput:void 0});return}if(t==null)t=s.id;else if(s.id!==t){c.enqueue({part:s,partialOutput:void 0});return}if(s.type===`text-start`){c.enqueue({part:s,partialOutput:void 0});return}if(s.type===`text-end`){r.length>0&&o({controller:c}),c.enqueue({part:s,partialOutput:void 0});return}n+=s.text,r+=s.text,i=s.providerMetadata??i;let l=await e.parsePartialOutput({text:n});if(l!==void 0){let e=typeof l.partial==`string`?l.partial:JSON.stringify(l.partial);e!==a&&(o({controller:c,partialOutput:l.partial}),a=e)}}})}var Bme=class{constructor({model:e,telemetry:t,headers:n,settings:r,maxRetries:i,abortSignal:a,stepTimeoutMs:o,stepAbortController:s,chunkTimeoutMs:c,chunkAbortController:l,system:u,prompt:d,messages:f,tools:p,toolChoice:m,transforms:h,activeTools:g,repairToolCall:_,stopConditions:v,output:y,providerOptions:b,prepareStep:x,includeRawChunks:S,now:C,generateId:w,timeout:T,stopWhen:E,originalAbortSignal:D,onChunk:O,onError:ee,onFinish:te,onAbort:k,onStepFinish:A,onStart:j,onStepStart:M,onToolCallStart:N,onToolCallFinish:P,experimental_context:F,download:I,include:ne}){this._totalUsage=new $S,this._finishReason=new $S,this._rawFinishReason=new $S,this._steps=new $S,this.outputSpecification=y,this.includeRawChunks=S,this.tools=p;let re=wE()(t?.integrations),ie,ae=[],oe=[],se,ce,le,L={},ue=[],de=[],fe=new Map,pe,me={},he={},ge=new TransformStream({async transform(e,t){t.enqueue(e);let{part:n}=e;if((n.type===`text-delta`||n.type===`reasoning-delta`||n.type===`source`||n.type===`tool-call`||n.type===`tool-result`||n.type===`tool-input-start`||n.type===`tool-input-delta`||n.type===`raw`)&&await O?.({chunk:n}),n.type===`error`&&await ee({error:hE(n.error)}),n.type===`text-start`&&(me[n.id]={type:`text`,text:``,providerMetadata:n.providerMetadata},ae.push(me[n.id])),n.type===`text-delta`){let e=me[n.id];if(e==null){t.enqueue({part:{type:`error`,error:`text part ${n.id} not found`},partialOutput:void 0});return}e.text+=n.text,e.providerMetadata=n.providerMetadata??e.providerMetadata}if(n.type===`text-end`){let e=me[n.id];if(e==null){t.enqueue({part:{type:`error`,error:`text part ${n.id} not found`},partialOutput:void 0});return}e.providerMetadata=n.providerMetadata??e.providerMetadata,delete me[n.id]}if(n.type===`reasoning-start`&&(he[n.id]={type:`reasoning`,text:``,providerMetadata:n.providerMetadata},ae.push(he[n.id])),n.type===`reasoning-delta`){let e=he[n.id];if(e==null){t.enqueue({part:{type:`error`,error:`reasoning part ${n.id} not found`},partialOutput:void 0});return}e.text+=n.text,e.providerMetadata=n.providerMetadata??e.providerMetadata}if(n.type===`reasoning-end`){let e=he[n.id];if(e==null){t.enqueue({part:{type:`error`,error:`reasoning part ${n.id} not found`},partialOutput:void 0});return}e.providerMetadata=n.providerMetadata??e.providerMetadata,delete he[n.id]}if(n.type===`file`&&ae.push({type:`file`,file:n.file,...n.providerMetadata==null?{}:{providerMetadata:n.providerMetadata}}),n.type===`source`&&ae.push(n),n.type===`tool-call`&&ae.push(n),n.type===`tool-result`&&!n.preliminary&&ae.push(n),n.type===`tool-approval-request`&&ae.push(n),n.type===`tool-error`&&ae.push(n),n.type===`start-step`&&(ae=[],he={},me={},L=n.request,ue=n.warnings),n.type===`finish-step`){let e=await qE({content:ae,tools:p}),t=new WE({stepNumber:de.length,model:Ee,...De,experimental_context:F,content:ae,finishReason:n.finishReason,rawFinishReason:n.rawFinishReason,usage:n.usage,warnings:ue,request:L,response:{...n.response,messages:[...oe,...e]},providerMetadata:n.providerMetadata});await KT({event:t,callbacks:[A,re.onStepFinish]}),JT({warnings:ue,provider:Ee.provider,model:Ee.modelId}),de.push(t),oe.push(...e),ie.resolve()}n.type===`finish`&&(le=n.totalUsage,se=n.finishReason,ce=n.rawFinishReason)},async flush(e){try{if(de.length===0){let e=a?.aborted?a.reason:new ET({message:`No output generated. Check the stream for errors.`});Te._finishReason.reject(e),Te._rawFinishReason.reject(e),Te._totalUsage.reject(e),Te._steps.reject(e);return}let e=se??`other`,n=le??EE();Te._finishReason.resolve(e),Te._rawFinishReason.resolve(ce),Te._totalUsage.resolve(n),Te._steps.resolve(de);let r=de[de.length-1];await KT({event:{stepNumber:r.stepNumber,model:r.model,functionId:r.functionId,metadata:r.metadata,experimental_context:r.experimental_context,finishReason:r.finishReason,rawFinishReason:r.rawFinishReason,totalUsage:n,usage:r.usage,content:r.content,text:r.text,reasoningText:r.reasoningText,reasoning:r.reasoning,files:r.files,sources:r.sources,toolCalls:r.toolCalls,staticToolCalls:r.staticToolCalls,dynamicToolCalls:r.dynamicToolCalls,toolResults:r.toolResults,staticToolResults:r.staticToolResults,dynamicToolResults:r.dynamicToolResults,request:r.request,response:r.response,warnings:r.warnings,providerMetadata:r.providerMetadata,steps:de},callbacks:[te,re.onFinish]}),pe.setAttributes(await SE({telemetry:t,attributes:{"ai.response.finishReason":e,"ai.response.text":{output:()=>r.text},"ai.response.reasoning":{output:()=>r.reasoningText},"ai.response.toolCalls":{output:()=>r.toolCalls?.length?JSON.stringify(r.toolCalls):void 0},"ai.response.providerMetadata":JSON.stringify(r.providerMetadata),"ai.usage.inputTokens":n.inputTokens,"ai.usage.inputTokenDetails.noCacheTokens":n.inputTokenDetails?.noCacheTokens,"ai.usage.inputTokenDetails.cacheReadTokens":n.inputTokenDetails?.cacheReadTokens,"ai.usage.inputTokenDetails.cacheWriteTokens":n.inputTokenDetails?.cacheWriteTokens,"ai.usage.outputTokens":n.outputTokens,"ai.usage.outputTokenDetails.textTokens":n.outputTokenDetails?.textTokens,"ai.usage.outputTokenDetails.reasoningTokens":n.outputTokenDetails?.reasoningTokens,"ai.usage.totalTokens":n.totalTokens,"ai.usage.reasoningTokens":n.outputTokenDetails?.reasoningTokens,"ai.usage.cachedInputTokens":n.inputTokenDetails?.cacheReadTokens}}))}catch(t){e.error(t)}finally{pe.end()}}}),_e=Fme();this.addStream=_e.addStream,this.closeStream=_e.close;let ve=_e.stream.getReader(),ye=new ReadableStream({async start(e){e.enqueue({type:`start`})},async pull(e){function t(){k?.({steps:de}),e.enqueue({type:`abort`,...a?.reason===void 0?{}:{reason:Zx(a.reason)}}),e.close()}try{let{done:n,value:r}=await ve.read();if(n){e.close();return}if(a?.aborted){t();return}e.enqueue(r)}catch(n){sC(n)&&a?.aborted?t():e.error(n)}},cancel(e){return _e.stream.cancel(e)}});for(let e of h)ye=ye.pipeThrough(e({tools:p,stopStream(){_e.terminate()}}));this.baseStream=ye.pipeThrough(zme(y??BE())).pipeThrough(ge);let{maxRetries:be,retry:xe}=jE({maxRetries:i,abortSignal:a}),Se=yE(t),Ce=sE(r),we=_E({model:e,telemetry:t,headers:n,settings:{...Ce,maxRetries:be}}),Te=this,Ee={provider:e.provider,modelId:e.modelId},De={functionId:t?.functionId,metadata:t?.metadata};bE({name:`ai.streamText`,attributes:SE({telemetry:t,attributes:{...gE({operationId:`ai.streamText`,telemetry:t}),...we,"ai.prompt":{input:()=>JSON.stringify({system:u,prompt:d,messages:f})}}}),tracer:Se,endWhenDone:!1,fn:async r=>{pe=r;let i=await mE({system:u,prompt:d,messages:f});await KT({event:{model:Ee,system:u,prompt:d,messages:f,tools:p,toolChoice:m,activeTools:g,maxOutputTokens:Ce.maxOutputTokens,temperature:Ce.temperature,topP:Ce.topP,topK:Ce.topK,presencePenalty:Ce.presencePenalty,frequencyPenalty:Ce.frequencyPenalty,stopSequences:Ce.stopSequences,seed:Ce.seed,maxRetries:be,timeout:T,headers:n,providerOptions:b,stopWhen:E,output:y,abortSignal:D,include:ne,...De,experimental_context:F},callbacks:[j,re.onStart]});let h=i.messages,S=[],{approvedToolApprovals:O,deniedToolApprovals:ee}=ME({messages:h});if(ee.length>0||O.length>0){let e=O.filter(e=>!e.toolCall.providerExecuted),n=ee.filter(e=>!e.toolCall.providerExecuted),r=ee.filter(e=>e.toolCall.providerExecuted),i,o=new ReadableStream({start(e){i=e}});Te.addStream(o);try{for(let e of[...n,...r])i?.enqueue({type:`tool-output-denied`,toolCallId:e.toolCall.toolCallId,toolName:e.toolCall.toolName});let o=[];if(await Promise.all(e.map(async e=>{let n=await PE({toolCall:e.toolCall,tools:p,tracer:Se,telemetry:t,messages:h,abortSignal:a,experimental_context:F,stepNumber:de.length,model:Ee,onToolCallStart:[N,re.onToolCallStart],onToolCallFinish:[P,re.onToolCallFinish],onPreliminaryToolResult:e=>{i?.enqueue(e)}});n!=null&&(i?.enqueue(n),o.push(n))})),o.length>0||n.length>0){let e=[];for(let t of o)e.push({type:`tool-result`,toolCallId:t.toolCallId,toolName:t.toolName,output:await aE({toolCallId:t.toolCallId,input:t.input,tool:p?.[t.toolName],output:t.type===`tool-result`?t.output:t.error,errorMode:t.type===`tool-error`?`text`:`none`})});for(let t of n)e.push({type:`tool-result`,toolCallId:t.toolCall.toolCallId,toolName:t.toolCall.toolName,output:{type:`execution-denied`,reason:t.approvalResponse.reason}});S.push({role:`tool`,content:e})}}finally{i?.close()}}oe.push(...S);async function te({currentStep:r,responseMessages:d,usage:f}){let S=Te.includeRawChunks,O=o==null?void 0:setTimeout(()=>s.abort(),o),ee;function k(){c!=null&&(ee!=null&&clearTimeout(ee),ee=setTimeout(()=>l.abort(),c))}function A(){ee!=null&&(clearTimeout(ee),ee=void 0)}function j(){O!=null&&clearTimeout(O)}try{ie=new $S;let o=[...h,...d],s=await x?.({model:e,steps:de,stepNumber:de.length,messages:o,experimental_context:F}),c=ZT(s?.model??e),l={provider:c.provider,modelId:c.modelId},O=await rE({prompt:{system:s?.system??i.system,messages:s?.messages??o},supportedUrls:await c.supportedUrls,download:I}),ee=s?.activeTools??g,{toolChoice:ae,tools:oe}=await cE({tools:p,toolChoice:s?.toolChoice??m,activeTools:ee});F=s?.experimental_context??F;let se=s?.messages??o,ce=s?.system??i.system,le=kE(b,s?.providerOptions);await KT({event:{stepNumber:de.length,model:l,system:ce,messages:se,tools:p,toolChoice:ae,activeTools:ee,steps:[...de],providerOptions:le,timeout:T,headers:n,stopWhen:E,output:y,abortSignal:D,include:ne,...De,experimental_context:F},callbacks:[M,re.onStepStart]});let{result:{stream:L,response:ue,request:pe},doStreamSpan:me,startTimestampMs:he}=await xe(()=>bE({name:`ai.streamText.doStream`,attributes:SE({telemetry:t,attributes:{...gE({operationId:`ai.streamText.doStream`,telemetry:t}),...we,"ai.model.provider":c.provider,"ai.model.id":c.modelId,"ai.prompt.messages":{input:()=>CE(O)},"ai.prompt.tools":{input:()=>oe?.map(e=>JSON.stringify(e))},"ai.prompt.toolChoice":{input:()=>ae==null?void 0:JSON.stringify(ae)},"gen_ai.system":c.provider,"gen_ai.request.model":c.modelId,"gen_ai.request.frequency_penalty":Ce.frequencyPenalty,"gen_ai.request.max_tokens":Ce.maxOutputTokens,"gen_ai.request.presence_penalty":Ce.presencePenalty,"gen_ai.request.stop_sequences":Ce.stopSequences,"gen_ai.request.temperature":Ce.temperature,"gen_ai.request.top_k":Ce.topK,"gen_ai.request.top_p":Ce.topP}}),tracer:Se,endWhenDone:!1,fn:async e=>({startTimestampMs:C(),doStreamSpan:e,result:await c.doStream({...Ce,tools:oe,toolChoice:ae,responseFormat:await y?.responseFormat,prompt:O,providerOptions:le,abortSignal:a,headers:n,includeRawChunks:S})})})),ge=Ime({tools:p,generatorStream:L,tracer:Se,telemetry:t,system:u,messages:o,repairToolCall:_,abortSignal:a,experimental_context:F,generateId:w,stepNumber:de.length,model:l,onToolCallStart:[N,re.onToolCallStart],onToolCallFinish:[P,re.onToolCallFinish]}),_e=ne?.requestBody??!0?pe??{}:{...pe,body:void 0},ve=[],ye=[],be,Oe={},ke=`other`,Ae,je=EE(),Me,Ne=!0,Pe={id:w(),timestamp:new Date,modelId:Ee.modelId},Fe=``;Te.addStream(ge.pipeThrough(new TransformStream({async transform(e,t){if(k(),e.type===`stream-start`){be=e.warnings;return}if(Ne){let e=C()-he;Ne=!1,me.addEvent(`ai.stream.firstChunk`,{"ai.response.msToFirstChunk":e}),me.setAttributes({"ai.response.msToFirstChunk":e}),t.enqueue({type:`start-step`,request:_e,warnings:be??[]})}let n=e.type;switch(n){case`tool-approval-request`:case`text-start`:case`text-end`:t.enqueue(e);break;case`text-delta`:e.delta.length>0&&(t.enqueue({type:`text-delta`,id:e.id,text:e.delta,providerMetadata:e.providerMetadata}),Fe+=e.delta);break;case`reasoning-start`:case`reasoning-end`:t.enqueue(e);break;case`reasoning-delta`:t.enqueue({type:`reasoning-delta`,id:e.id,text:e.delta,providerMetadata:e.providerMetadata});break;case`tool-call`:t.enqueue(e),ve.push(e);break;case`tool-result`:t.enqueue(e),e.preliminary||ye.push(e);break;case`tool-error`:t.enqueue(e),ye.push(e);break;case`response-metadata`:Pe={id:e.id??Pe.id,timestamp:e.timestamp??Pe.timestamp,modelId:e.modelId??Pe.modelId};break;case`finish`:{je=e.usage,ke=e.finishReason,Ae=e.rawFinishReason,Me=e.providerMetadata;let t=C()-he;me.addEvent(`ai.stream.finish`),me.setAttributes({"ai.response.msToFinish":t,"ai.response.avgOutputTokensPerSecond":1e3*(je.outputTokens??0)/t});break}case`file`:t.enqueue(e);break;case`source`:t.enqueue(e);break;case`tool-input-start`:{Oe[e.id]=e.toolName;let n=p?.[e.toolName];n?.onInputStart!=null&&await n.onInputStart({toolCallId:e.id,messages:o,abortSignal:a,experimental_context:F}),t.enqueue({...e,dynamic:e.dynamic??n?.type===`dynamic`,title:n?.title});break}case`tool-input-end`:delete Oe[e.id],t.enqueue(e);break;case`tool-input-delta`:{let n=Oe[e.id],r=p?.[n];r?.onInputDelta!=null&&await r.onInputDelta({inputTextDelta:e.delta,toolCallId:e.id,messages:o,abortSignal:a,experimental_context:F}),t.enqueue(e);break}case`error`:t.enqueue(e),ke=`error`;break;case`raw`:S&&t.enqueue(e);break;default:throw Error(`Unknown chunk type: ${n}`)}},async flush(e){let n=ve.length>0?JSON.stringify(ve):void 0;try{me.setAttributes(await SE({telemetry:t,attributes:{"ai.response.finishReason":ke,"ai.response.toolCalls":{output:()=>n},"ai.response.id":Pe.id,"ai.response.model":Pe.modelId,"ai.response.timestamp":Pe.timestamp.toISOString(),"ai.usage.inputTokens":je.inputTokens,"ai.usage.inputTokenDetails.noCacheTokens":je.inputTokenDetails?.noCacheTokens,"ai.usage.inputTokenDetails.cacheReadTokens":je.inputTokenDetails?.cacheReadTokens,"ai.usage.inputTokenDetails.cacheWriteTokens":je.inputTokenDetails?.cacheWriteTokens,"ai.usage.outputTokens":je.outputTokens,"ai.usage.outputTokenDetails.textTokens":je.outputTokenDetails?.textTokens,"ai.usage.outputTokenDetails.reasoningTokens":je.outputTokenDetails?.reasoningTokens,"ai.usage.totalTokens":je.totalTokens,"ai.usage.reasoningTokens":je.outputTokenDetails?.reasoningTokens,"ai.usage.cachedInputTokens":je.inputTokenDetails?.cacheReadTokens,"gen_ai.response.finish_reasons":[ke],"gen_ai.response.id":Pe.id,"gen_ai.response.model":Pe.modelId,"gen_ai.usage.input_tokens":je.inputTokens,"gen_ai.usage.output_tokens":je.outputTokens}}))}catch{}e.enqueue({type:`finish-step`,finishReason:ke,rawFinishReason:Ae,usage:je,providerMetadata:Me,response:{...Pe,headers:ue?.headers}});let i=DE(f,je);await ie.promise;let a=de[de.length-1];try{me.setAttributes(await SE({telemetry:t,attributes:{"ai.response.text":{output:()=>a.text},"ai.response.reasoning":{output:()=>a.reasoningText},"ai.response.providerMetadata":JSON.stringify(a.providerMetadata)}}))}catch{}finally{me.end()}let o=ve.filter(e=>e.providerExecuted!==!0),s=ye.filter(e=>e.providerExecuted!==!0);for(let e of ve){if(e.providerExecuted!==!0)continue;let t=p?.[e.toolName];t?.type===`provider`&&t.supportsDeferredResults&&(ye.some(t=>(t.type===`tool-result`||t.type===`tool-error`)&&t.toolCallId===e.toolCallId)||fe.set(e.toolCallId,{toolName:e.toolName}))}for(let e of ye)(e.type===`tool-result`||e.type===`tool-error`)&&fe.delete(e.toolCallId);if(j(),A(),(o.length>0&&s.length===o.length||fe.size>0)&&!await KE({stopConditions:v,steps:de})){d.push(...await qE({content:de[de.length-1].content,tools:p}));try{await te({currentStep:r+1,responseMessages:d,usage:i})}catch(t){e.enqueue({type:`error`,error:t}),Te.closeStream()}}else e.enqueue({type:`finish`,finishReason:ke,rawFinishReason:Ae,totalUsage:i}),Te.closeStream()}})))}finally{j(),A()}}await te({currentStep:0,responseMessages:S,usage:EE()})}}).catch(e=>{Te.addStream(new ReadableStream({start(t){t.enqueue({type:`error`,error:e}),t.close()}})),Te.closeStream()})}get steps(){return this.consumeStream(),this._steps.promise}get finalStep(){return this.steps.then(e=>e[e.length-1])}get content(){return this.finalStep.then(e=>e.content)}get warnings(){return this.finalStep.then(e=>e.warnings)}get providerMetadata(){return this.finalStep.then(e=>e.providerMetadata)}get text(){return this.finalStep.then(e=>e.text)}get reasoningText(){return this.finalStep.then(e=>e.reasoningText)}get reasoning(){return this.finalStep.then(e=>e.reasoning)}get sources(){return this.finalStep.then(e=>e.sources)}get files(){return this.finalStep.then(e=>e.files)}get toolCalls(){return this.finalStep.then(e=>e.toolCalls)}get staticToolCalls(){return this.finalStep.then(e=>e.staticToolCalls)}get dynamicToolCalls(){return this.finalStep.then(e=>e.dynamicToolCalls)}get toolResults(){return this.finalStep.then(e=>e.toolResults)}get staticToolResults(){return this.finalStep.then(e=>e.staticToolResults)}get dynamicToolResults(){return this.finalStep.then(e=>e.dynamicToolResults)}get usage(){return this.finalStep.then(e=>e.usage)}get request(){return this.finalStep.then(e=>e.request)}get response(){return this.finalStep.then(e=>e.response)}get totalUsage(){return this.consumeStream(),this._totalUsage.promise}get finishReason(){return this.consumeStream(),this._finishReason.promise}get rawFinishReason(){return this.consumeStream(),this._rawFinishReason.promise}teeStream(){let[e,t]=this.baseStream.tee();return this.baseStream=t,e}get textStream(){return sD(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){e.type===`text-delta`&&t.enqueue(e.text)}})))}get fullStream(){return sD(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){t.enqueue(e)}})))}async consumeStream(e){var t;try{await cD({stream:this.fullStream,onError:e?.onError})}catch(n){(t=e?.onError)==null||t.call(e,n)}}get experimental_partialOutputStream(){return this.partialOutputStream}get partialOutputStream(){return sD(this.teeStream().pipeThrough(new TransformStream({transform({partialOutput:e},t){e!=null&&t.enqueue(e)}})))}get elementStream(){let e=this.outputSpecification?.createElementStreamTransform();if(e==null)throw new Nle({functionality:`element streams in ${this.outputSpecification?.name??`text`} mode`});return sD(this.teeStream().pipeThrough(e))}get output(){return this.finalStep.then(e=>(this.outputSpecification??BE()).parseCompleteOutput({text:e.text},{response:e.response,usage:e.usage,finishReason:e.finishReason}))}toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:n,messageMetadata:r,sendReasoning:i=!0,sendSources:a=!1,sendStart:o=!0,sendFinish:s=!0,onError:c=Zx}={}){let l=t==null?void 0:kme({originalMessages:e,responseMessageId:t}),u=e=>{let t=this.tools?.[e.toolName];return t==null?e.dynamic:t?.type===`dynamic`?!0:void 0};return sD(Nme({stream:this.fullStream.pipeThrough(new TransformStream({transform:async(e,t)=>{let n=r?.({part:e}),d=e.type;switch(d){case`text-start`:t.enqueue({type:`text-start`,id:e.id,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`text-delta`:t.enqueue({type:`text-delta`,id:e.id,delta:e.text,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`text-end`:t.enqueue({type:`text-end`,id:e.id,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`reasoning-start`:t.enqueue({type:`reasoning-start`,id:e.id,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`reasoning-delta`:i&&t.enqueue({type:`reasoning-delta`,id:e.id,delta:e.text,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`reasoning-end`:t.enqueue({type:`reasoning-end`,id:e.id,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`file`:t.enqueue({type:`file`,mediaType:e.file.mediaType,url:`data:${e.file.mediaType};base64,${e.file.base64}`,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`source`:a&&e.sourceType===`url`&&t.enqueue({type:`source-url`,sourceId:e.id,url:e.url,title:e.title,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}),a&&e.sourceType===`document`&&t.enqueue({type:`source-document`,sourceId:e.id,mediaType:e.mediaType,title:e.title,filename:e.filename,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}});break;case`tool-input-start`:{let n=u(e);t.enqueue({type:`tool-input-start`,toolCallId:e.id,toolName:e.toolName,...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...n==null?{}:{dynamic:n},...e.title==null?{}:{title:e.title}});break}case`tool-input-delta`:t.enqueue({type:`tool-input-delta`,toolCallId:e.id,inputTextDelta:e.delta});break;case`tool-call`:{let n=u(e);e.invalid?t.enqueue({type:`tool-input-error`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...n==null?{}:{dynamic:n},errorText:c(e.error),...e.title==null?{}:{title:e.title}}):t.enqueue({type:`tool-input-available`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...n==null?{}:{dynamic:n},...e.title==null?{}:{title:e.title}});break}case`tool-approval-request`:t.enqueue({type:`tool-approval-request`,approvalId:e.approvalId,toolCallId:e.toolCall.toolCallId});break;case`tool-result`:{let n=u(e);t.enqueue({type:`tool-output-available`,toolCallId:e.toolCallId,output:e.output,...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...e.preliminary==null?{}:{preliminary:e.preliminary},...n==null?{}:{dynamic:n}});break}case`tool-error`:{let n=u(e);t.enqueue({type:`tool-output-error`,toolCallId:e.toolCallId,errorText:e.providerExecuted?typeof e.error==`string`?e.error:JSON.stringify(e.error):c(e.error),...e.providerExecuted==null?{}:{providerExecuted:e.providerExecuted},...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata},...n==null?{}:{dynamic:n}});break}case`tool-output-denied`:t.enqueue({type:`tool-output-denied`,toolCallId:e.toolCallId});break;case`error`:t.enqueue({type:`error`,errorText:c(e.error)});break;case`start-step`:t.enqueue({type:`start-step`});break;case`finish-step`:t.enqueue({type:`finish-step`});break;case`start`:o&&t.enqueue({type:`start`,...n==null?{}:{messageMetadata:n},...l==null?{}:{messageId:l}});break;case`finish`:s&&t.enqueue({type:`finish`,finishReason:e.finishReason,...n==null?{}:{messageMetadata:n}});break;case`abort`:t.enqueue(e);break;case`tool-input-end`:break;case`raw`:break;default:throw Error(`Unknown chunk type: ${d}`)}n!=null&&d!==`start`&&d!==`finish`&&t.enqueue({type:`message-metadata`,messageMetadata:n})}})),messageId:l??t?.(),originalMessages:e,onFinish:n,onError:c}))}pipeUIMessageStreamToResponse(e,{originalMessages:t,generateMessageId:n,onFinish:r,messageMetadata:i,sendReasoning:a,sendSources:o,sendFinish:s,sendStart:c,onError:l,...u}={}){Pme({response:e,stream:this.toUIMessageStream({originalMessages:t,generateMessageId:n,onFinish:r,messageMetadata:i,sendReasoning:a,sendSources:o,sendFinish:s,sendStart:c,onError:l}),...u})}pipeTextStreamToResponse(e,t){Dme({response:e,textStream:this.textStream,...t})}toUIMessageStreamResponse({originalMessages:e,generateMessageId:t,onFinish:n,messageMetadata:r,sendReasoning:i,sendSources:a,sendFinish:o,sendStart:s,onError:c,...l}={}){return Ome({stream:this.toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:n,messageMetadata:r,sendReasoning:i,sendSources:a,sendFinish:o,sendStart:s,onError:c}),...l})}toTextStreamResponse(e){return Eme({textStream:this.textStream,...e})}};aC({prefix:`aiobj`,size:24});var Vme=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){n(e)}}),this.processQueue()})}};aC({prefix:`aiobj`,size:24});async function Hme(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error(`FileList is not supported in the current environment`);return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e;return{type:`file`,mediaType:n,filename:t,url:await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{t(e.target?.result)},r.onerror=e=>n(e),r.readAsDataURL(e)})}}))}var Ume=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){let n=await LC(this.body),r=await LC(this.headers),i=await LC(this.credentials),a={...lC(r),...lC(t.headers)},o=await this.prepareSendMessagesRequest?.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...n,...t.body},headers:a,credentials:i,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId}),s=o?.api??this.api,c=o?.headers===void 0?a:lC(o.headers),l=o?.body===void 0?{...n,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId}:o.body,u=o?.credentials??i,d=await(this.fetch??globalThis.fetch)(s,{method:`POST`,headers:{"Content-Type":`application/json`,...c},body:JSON.stringify(l),credentials:u,signal:e});if(!d.ok)throw Error(await d.text()??`Failed to fetch the chat response.`);if(!d.body)throw Error(`The response body is empty.`);return this.processResponseStream(d.body)}async reconnectToStream(e){let t=await LC(this.body),n=await LC(this.headers),r=await LC(this.credentials),i={...lC(n),...lC(e.headers)},a=await this.prepareReconnectToStreamRequest?.call(this,{api:this.api,id:e.chatId,body:{...t,...e.body},headers:i,credentials:r,requestMetadata:e.metadata}),o=a?.api??`${this.api}/${e.chatId}/stream`,s=a?.headers===void 0?i:lC(a.headers),c=a?.credentials??r,l=await(this.fetch??globalThis.fetch)(o,{method:`GET`,headers:s,credentials:c});if(l.status===204)return null;if(!l.ok)throw Error(await l.text()??`Failed to fetch the chat response.`);if(!l.body)throw Error(`The response body is empty.`);return this.processResponseStream(l.body)}},uD=class extends Ume{constructor(e={}){super(e)}processResponseStream(e){return NC({stream:e,schema:Ame}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},Wme=class{constructor({generateId:e=Pue,id:t=e(),transport:n=new uD,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new Vme,this.sendMessage=async(e,t)=>{if(e==null){await this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...t});return}let n;if(n=`text`in e||`files`in e?{parts:[...Array.isArray(e.files)?e.files:await Hme(e.files),...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}:e,e.messageId!=null){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw Error(`message with id ${e.messageId} not found`);if(this.state.messages[t].role!==`user`)throw Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...n,id:e.messageId,role:n.role??`user`,metadata:e.metadata})}else this.state.pushMessage({...n,id:n.id??this.generateId(),role:n.role??`user`,metadata:e.metadata});await this.makeRequest({trigger:`submit-message`,messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let n=e==null?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(n===-1)throw Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,this.messages[n].role===`assistant`?n:n+1),await this.makeRequest({trigger:`regenerate-message`,messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:`resume-stream`,...e})},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n,options:r})=>this.jobExecutor.run(async()=>{let i=this.state.messages,a=i[i.length-1],o=r=>rD(r)&&r.state===`approval-requested`&&r.approval.id===e?{...r,state:`approval-responded`,approval:{id:e,approved:t,reason:n}}:r;this.state.replaceMessage(i.length-1,{...a,parts:a.parts.map(o)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{e&&this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...r})})}),this.addToolOutput=async({state:e=`output-available`,toolCallId:t,output:n,errorText:r,options:i})=>this.jobExecutor.run(async()=>{let a=this.state.messages,o=a[a.length-1],s=i=>rD(i)&&i.toolCallId===t?{...i,state:e,output:n,errorText:r}:i;this.state.replaceMessage(a.length-1,{...o,parts:o.parts.map(s)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(s)),this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{e&&this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...i})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{this.status!==`streaming`&&this.status!==`submitted`||this.activeResponse?.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e==`object`&&`then`in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:i}){var a;let o;if(e===`resume-stream`)try{let e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:r});if(e==null)return;o=e}catch(e){this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e});return}this.setStatus({status:`submitted`,error:void 0});let s=this.lastMessage,c=!1,l=!1,u=!1;try{let a={state:aD({lastMessage:this.state.snapshot(s),messageId:this.generateId()}),abortController:new AbortController};a.abortController.signal.addEventListener(`abort`,()=>{c=!0}),this.activeResponse=a;let l;l=e===`resume-stream`?o:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:a.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i}),await cD({stream:oD({stream:l,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:e=>this.jobExecutor.run(()=>e({state:a.state,write:()=>{this.setStatus({status:`streaming`}),a.state.message.id===this.lastMessage?.id?this.state.replaceMessage(this.state.messages.length-1,a.state.message):this.state.pushMessage(a.state.message)}})),onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:`ready`})}catch(e){if(c||e.name===`AbortError`)return c=!0,this.setStatus({status:`ready`}),null;u=!0,e instanceof TypeError&&(e.message.toLowerCase().includes(`fetch`)||e.message.toLowerCase().includes(`network`))&&(l=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e})}finally{try{(a=this.onFinish)==null||a.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:l,isError:u,finishReason:this.activeResponse?.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}!u&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,metadata:t,headers:n,body:r})}},Gme=t(n(((e,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=t-(a-r);o<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},o)}}t.exports=n}))(),1),dD=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},fD=(e,t,n)=>(dD(e,t,`read from private field`),n?n.call(e):t.get(e)),pD=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},mD=(e,t,n,r)=>(dD(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n);function Kme(e,t){return t==null?e:(0,Gme.default)(e,t)}var hD,gD,_D,vD,yD,bD,xD,SD,CD,qme=class{constructor(e=[]){pD(this,hD,void 0),pD(this,gD,`ready`),pD(this,_D,void 0),pD(this,vD,new Set),pD(this,yD,new Set),pD(this,bD,new Set),this.pushMessage=e=>{mD(this,hD,fD(this,hD).concat(e)),fD(this,xD).call(this)},this.popMessage=()=>{mD(this,hD,fD(this,hD).slice(0,-1)),fD(this,xD).call(this)},this.replaceMessage=(e,t)=>{mD(this,hD,[...fD(this,hD).slice(0,e),this.snapshot(t),...fD(this,hD).slice(e+1)]),fD(this,xD).call(this)},this.snapshot=e=>structuredClone(e),this[`~registerMessagesCallback`]=(e,t)=>{let n=t?Kme(e,t):e;return fD(this,vD).add(n),()=>{fD(this,vD).delete(n)}},this[`~registerStatusCallback`]=e=>(fD(this,yD).add(e),()=>{fD(this,yD).delete(e)}),this[`~registerErrorCallback`]=e=>(fD(this,bD).add(e),()=>{fD(this,bD).delete(e)}),pD(this,xD,()=>{fD(this,vD).forEach(e=>e())}),pD(this,SD,()=>{fD(this,yD).forEach(e=>e())}),pD(this,CD,()=>{fD(this,bD).forEach(e=>e())}),mD(this,hD,e)}get status(){return fD(this,gD)}set status(e){mD(this,gD,e),fD(this,SD).call(this)}get error(){return fD(this,_D)}set error(e){mD(this,_D,e),fD(this,CD).call(this)}get messages(){return fD(this,hD)}set messages(e){mD(this,hD,[...e]),fD(this,xD).call(this)}};hD=new WeakMap,gD=new WeakMap,_D=new WeakMap,vD=new WeakMap,yD=new WeakMap,bD=new WeakMap,xD=new WeakMap,SD=new WeakMap,CD=new WeakMap;var wD,TD=class extends Wme{constructor({messages:e,...t}){let n=new qme(e);super({...t,state:n}),pD(this,wD,void 0),this[`~registerMessagesCallback`]=(e,t)=>fD(this,wD)[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>fD(this,wD)[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>fD(this,wD)[`~registerErrorCallback`](e),mD(this,wD,n)}};wD=new WeakMap;function ED({experimental_throttle:e,resume:t=!1,...n}={}){let r=(0,L.useRef)(`chat`in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});`chat`in n||(r.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});let i={...n,onToolCall:e=>{var t;return(t=r.current).onToolCall?.call(t,e)},onData:e=>{var t;return(t=r.current).onData?.call(t,e)},onFinish:e=>{var t;return(t=r.current).onFinish?.call(t,e)},onError:e=>{var t;return(t=r.current).onError?.call(t,e)},sendAutomaticallyWhen:e=>{var t;return(t=r.current).sendAutomaticallyWhen?.call(t,e)??!1}},a=(0,L.useRef)(`chat`in n?n.chat:new TD(i));(`chat`in n&&n.chat!==a.current||`id`in n&&a.current.id!==n.id)&&(a.current=`chat`in n?n.chat:new TD(i));let o=(0,L.useSyncExternalStore)((0,L.useCallback)(t=>a.current[`~registerMessagesCallback`](t,e),[e,a.current.id]),()=>a.current.messages,()=>a.current.messages),s=(0,L.useSyncExternalStore)(a.current[`~registerStatusCallback`],()=>a.current.status,()=>a.current.status),c=(0,L.useSyncExternalStore)(a.current[`~registerErrorCallback`],()=>a.current.error,()=>a.current.error),l=(0,L.useCallback)(e=>{typeof e==`function`&&(e=e(a.current.messages)),a.current.messages=e},[a]);return(0,L.useEffect)(()=>{t&&a.current.resumeStream()},[t,a]),{id:a.current.id,messages:o,setMessages:l,sendMessage:a.current.sendMessage,regenerate:a.current.regenerate,clearError:a.current.clearError,stop:a.current.stop,error:c,resumeStream:a.current.resumeStream,status:s,addToolResult:a.current.addToolOutput,addToolOutput:a.current.addToolOutput,addToolApprovalResponse:a.current.addToolApprovalResponse}}function DD(e,[t,n]){return Math.min(n,Math.max(t,e))}function Jme(e,t){return L.useReducer((e,n)=>t[e][n]??e,e)}var OD=`ScrollArea`,[kD,Yme]=xh(OD),[Xme,AD]=kD(OD),jD=L.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=L.useState(null),[l,u]=L.useState(null),[d,f]=L.useState(null),[p,m]=L.useState(null),[h,g]=L.useState(null),[_,v]=L.useState(0),[y,b]=L.useState(0),[x,S]=L.useState(!1),[C,w]=L.useState(!1),T=Tm(t,e=>c(e)),E=wy(i);return(0,B.jsx)(Xme,{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,B.jsx)(Eh.div,{dir:E,...o,ref:T,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});jD.displayName=OD;var MD=`ScrollAreaViewport`,ND=L.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=AD(MD,n),s=Tm(t,L.useRef(null),o.onViewportChange);return(0,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsx)(Eh.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,B.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});ND.displayName=MD;var PD=`ScrollAreaScrollbar`,FD=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=AD(PD,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return L.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,B.jsx)(Zme,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,B.jsx)(Qme,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,B.jsx)(ID,{...r,ref:t,forceMount:n}):i.type===`always`?(0,B.jsx)(LD,{...r,ref:t}):null});FD.displayName=PD;var Zme=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=AD(PD,e.__scopeScrollArea),[a,o]=L.useState(!1);return L.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,B.jsx)(Ih,{present:n||a,children:(0,B.jsx)(ID,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Qme=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=AD(PD,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=XD(()=>c(`SCROLL_END`),100),[s,c]=Jme(`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 L.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),L.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,B.jsx)(Ih,{present:n||s!==`hidden`,children:(0,B.jsx)(LD,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:H(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:H(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),ID=L.forwardRef((e,t)=>{let n=AD(PD,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=L.useState(!1),s=e.orientation===`horizontal`,c=XD(()=>{if(n.viewport){let e=n.viewport.offsetWidth{let{orientation:n=`vertical`,...r}=e,i=AD(PD,e.__scopeScrollArea),a=L.useRef(null),o=L.useRef(0),[s,c]=L.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=GD(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 ihe(e,o.current,s,t)}return n===`horizontal`?(0,B.jsx)($me,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=qD(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,B.jsx)(ehe,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=qD(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}),$me=L.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=AD(PD,e.__scopeScrollArea),[o,s]=L.useState(),c=L.useRef(null),l=Tm(t,c,a.onScrollbarXChange);return L.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(zD,{"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":KD(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),YD(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:WD(o.paddingLeft),paddingEnd:WD(o.paddingRight)}})}})}),ehe=L.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=AD(PD,e.__scopeScrollArea),[o,s]=L.useState(),c=L.useRef(null),l=Tm(t,c,a.onScrollbarYChange);return L.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(zD,{"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":KD(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),YD(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:WD(o.paddingTop),paddingEnd:WD(o.paddingBottom)}})}})}),[the,RD]=kD(PD),zD=L.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=AD(PD,n),[m,h]=L.useState(null),g=Tm(t,e=>h(e)),_=L.useRef(null),v=L.useRef(``),y=p.viewport,b=r.content-r.viewport,x=Oh(u),S=Oh(c),C=XD(d,10);function w(e){_.current&&l({x:e.clientX-_.current.left,y:e.clientY-_.current.top})}return L.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]),L.useEffect(S,[r,S]),ZD(m,C),ZD(p.content,C),(0,B.jsx)(the,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Oh(a),onThumbPointerUp:Oh(o),onThumbPositionChange:S,onThumbPointerDown:Oh(s),children:(0,B.jsx)(Eh.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:H(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:H(e.onPointerMove,w),onPointerUp:H(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})})})}),BD=`ScrollAreaThumb`,VD=L.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=RD(BD,e.__scopeScrollArea);return(0,B.jsx)(Ih,{present:n||i.hasThumb,children:(0,B.jsx)(nhe,{ref:t,...r})})}),nhe=L.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=AD(BD,n),o=RD(BD,n),{onThumbPositionChange:s}=o,c=Tm(t,e=>o.onThumbChange(e)),l=L.useRef(void 0),u=XD(()=>{l.current&&=(l.current(),void 0)},100);return L.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=ahe(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,B.jsx)(Eh.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:H(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:H(e.onPointerUp,o.onThumbPointerUp)})});VD.displayName=BD;var HD=`ScrollAreaCorner`,UD=L.forwardRef((e,t)=>{let n=AD(HD,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,B.jsx)(rhe,{...e,ref:t}):null});UD.displayName=HD;var rhe=L.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=AD(HD,n),[a,o]=L.useState(0),[s,c]=L.useState(0),l=!!(a&&s);return ZD(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),ZD(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,B.jsx)(Eh.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 WD(e){return e?parseInt(e,10):0}function GD(e,t){let n=e/t;return isNaN(n)?0:n}function KD(e){let t=GD(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function ihe(e,t,n,r=`ltr`){let i=KD(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 JD([c,l],d)(e)}function qD(e,t,n=`ltr`){let r=KD(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=DD(e,n===`ltr`?[0,o]:[o*-1,0]);return JD([0,o],[0,s])(c)}function JD(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 YD(e,t){return e>0&&e{})=>{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 XD(e,t){let n=Oh(e),r=L.useRef(0);return L.useEffect(()=>()=>window.clearTimeout(r.current),[]),L.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ZD(e,t){let n=Oh(t);Sh(()=>{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 QD=jD,ohe=ND,she=UD,$D=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(QD,{ref:r,className:V(`relative overflow-hidden`,e),...n,children:[(0,B.jsx)(ohe,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,B.jsx)(eO,{}),(0,B.jsx)(she,{})]}));$D.displayName=QD.displayName;var eO=L.forwardRef(({className:e,orientation:t=`vertical`,...n},r)=>(0,B.jsx)(FD,{ref:r,orientation:t,className:V(`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,B.jsx)(VD,{className:`relative flex-1 rounded-full bg-border`})}));eO.displayName=FD.displayName;function tO(e){let t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var che=[` `,`Enter`,`ArrowUp`,`ArrowDown`],lhe=[` `,`Enter`],nO=`Select`,[rO,iO,uhe]=Cy(nO),[aO,dhe]=xh(nO,[uhe,uv]),oO=uv(),[fhe,sO]=aO(nO),[phe,mhe]=aO(nO),cO=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=oO(t),[g,_]=L.useState(null),[v,y]=L.useState(null),[b,x]=L.useState(!1),S=wy(l),[C,w]=wh({prop:r,defaultProp:i??!1,onChange:a,caller:nO}),[T,E]=wh({prop:o,defaultProp:s,onChange:c,caller:nO}),D=L.useRef(null),O=g?m||!!g.closest(`form`):!0,[ee,te]=L.useState(new Set),k=Array.from(ee).map(e=>e.props.value).join(`;`);return(0,B.jsx)(bv,{...h,children:(0,B.jsxs)(fhe,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:Ch(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,B.jsx)(rO.Provider,{scope:t,children:(0,B.jsx)(phe,{scope:e.__scopeSelect,onNativeOptionAdd:L.useCallback(e=>{te(t=>new Set(t).add(e))},[]),onNativeOptionRemove:L.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,B.jsxs)(UO,{"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,B.jsx)(`option`,{value:``}):null,Array.from(ee)]},k):null]})})};cO.displayName=nO;var lO=`SelectTrigger`,uO=L.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=oO(n),o=sO(lO,n),s=o.disabled||r,c=Tm(t,o.onTriggerChange),l=iO(n),u=L.useRef(`touch`),[d,f,p]=GO(e=>{let t=l().filter(e=>!e.disabled),n=KO(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,B.jsx)(xv,{asChild:!0,...a,children:(0,B.jsx)(Eh.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":WO(o.value)?``:void 0,...i,ref:c,onClick:H(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:H(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:H(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&che.includes(e.key)&&(m(),e.preventDefault())})})})});uO.displayName=lO;var dO=`SelectValue`,fO=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=sO(dO,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Tm(t,c.onValueNodeChange);return Sh(()=>{l(u)},[l,u]),(0,B.jsx)(Eh.span,{...s,ref:d,style:{pointerEvents:`none`},children:WO(c.value)?(0,B.jsx)(B.Fragment,{children:o}):a})});fO.displayName=dO;var hhe=`SelectIcon`,pO=L.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(Eh.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});pO.displayName=hhe;var ghe=`SelectPortal`,mO=e=>(0,B.jsx)(Fh,{asChild:!0,...e});mO.displayName=ghe;var hO=`SelectContent`,gO=L.forwardRef((e,t)=>{let n=sO(hO,e.__scopeSelect),[r,i]=L.useState();if(Sh(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?yh.createPortal((0,B.jsx)(vO,{scope:e.__scopeSelect,children:(0,B.jsx)(rO.Slot,{scope:e.__scopeSelect,children:(0,B.jsx)(`div`,{children:e.children})})}),t):null}return(0,B.jsx)(bO,{...e,ref:t})});gO.displayName=hO;var _O=10,[vO,yO]=aO(hO),_he=`SelectContentImpl`,vhe=Th(`SelectContent.RemoveScroll`),bO=L.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=sO(hO,n),[y,b]=L.useState(null),[x,S]=L.useState(null),C=Tm(t,e=>b(e)),[w,T]=L.useState(null),[E,D]=L.useState(null),O=iO(n),[ee,te]=L.useState(!1),k=L.useRef(!1);L.useEffect(()=>{if(y)return _g(y)},[y]),zh();let A=L.useCallback(e=>{let[t,...n]=O().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},[O,x]),j=L.useCallback(()=>A([w,y]),[A,w,y]);L.useEffect(()=>{ee&&j()},[ee,j]);let{onOpenChange:M,triggerPointerDownPosRef:N}=v;L.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||M(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.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,N]),L.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[P,F]=GO(e=>{let t=O().filter(e=>!e.disabled),n=KO(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),I=L.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]),ne=L.useCallback(()=>y?.focus(),[y]),re=L.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ie=r===`popper`?SO:xO,ae=ie===SO?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,B.jsx)(vO,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:I,selectedItem:w,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:j,selectedItemText:E,position:r,isPositioned:ee,searchRef:P,children:(0,B.jsx)(dg,{as:vhe,allowPinchZoom:!0,children:(0,B.jsx)(Nh,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:H(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(Ah,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,B.jsx)(ie,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ae,onPlaced:()=>te(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:H(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&F(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().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()}})})})})})})});bO.displayName=_he;var yhe=`SelectItemAlignedPosition`,xO=L.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=sO(hO,n),o=yO(hO,n),[s,c]=L.useState(null),[l,u]=L.useState(null),d=Tm(t,e=>u(e)),f=iO(n),p=L.useRef(!1),m=L.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=L.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-_O,d=DD(a,[_O,Math.max(_O,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-_O,d=DD(a,[_O,Math.max(_O,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-_O*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-_O,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,te=m+v+ee,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(D,O+(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)+O)+k;s.style.height=t+`px`,h.scrollTop=te-E+h.offsetTop}s.style.margin=`${_O}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]);Sh(()=>y(),[y]);let[b,x]=L.useState();return Sh(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,B.jsx)(xhe,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:L.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,B.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,B.jsx)(Eh.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});xO.displayName=yhe;var bhe=`SelectPopperPosition`,SO=L.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=_O,...a}=e,o=oO(n);return(0,B.jsx)(Sv,{...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)`}})});SO.displayName=bhe;var[xhe,CO]=aO(hO,{}),wO=`SelectViewport`,TO=L.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=yO(wO,n),o=CO(wO,n),s=Tm(t,a.onViewportChange),c=L.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsx)(rO.Slot,{scope:n,children:(0,B.jsx)(Eh.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:H(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-_O*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});TO.displayName=wO;var EO=`SelectGroup`,[She,Che]=aO(EO),whe=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ch();return(0,B.jsx)(She,{scope:n,id:i,children:(0,B.jsx)(Eh.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});whe.displayName=EO;var DO=`SelectLabel`,OO=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Che(DO,n);return(0,B.jsx)(Eh.div,{id:i.id,...r,ref:t})});OO.displayName=DO;var kO=`SelectItem`,[The,AO]=aO(kO),jO=L.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=sO(kO,n),c=yO(kO,n),l=s.value===r,[u,d]=L.useState(a??``),[f,p]=L.useState(!1),m=Tm(t,e=>c.itemRefCallback?.(e,r,i)),h=Ch(),g=L.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A 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,B.jsx)(The,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:L.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(rO.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,B.jsx)(Eh.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:H(o.onFocus,()=>p(!0)),onBlur:H(o.onBlur,()=>p(!1)),onClick:H(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:H(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:H(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:H(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:H(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:H(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(lhe.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});jO.displayName=kO;var MO=`SelectItemText`,NO=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=sO(MO,n),s=yO(MO,n),c=AO(MO,n),l=mhe(MO,n),[u,d]=L.useState(null),f=Tm(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=L.useMemo(()=>(0,B.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Sh(()=>(h(m),()=>g(m)),[h,g,m]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Eh.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?yh.createPortal(a.children,o.valueNode):null]})});NO.displayName=MO;var PO=`SelectItemIndicator`,FO=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return AO(PO,n).isSelected?(0,B.jsx)(Eh.span,{"aria-hidden":!0,...r,ref:t}):null});FO.displayName=PO;var IO=`SelectScrollUpButton`,LO=L.forwardRef((e,t)=>{let n=yO(IO,e.__scopeSelect),r=CO(IO,e.__scopeSelect),[i,a]=L.useState(!1),o=Tm(t,r.onScrollButtonChange);return Sh(()=>{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,B.jsx)(BO,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});LO.displayName=IO;var RO=`SelectScrollDownButton`,zO=L.forwardRef((e,t)=>{let n=yO(RO,e.__scopeSelect),r=CO(RO,e.__scopeSelect),[i,a]=L.useState(!1),o=Tm(t,r.onScrollButtonChange);return Sh(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(BO,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});zO.displayName=RO;var BO=L.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=yO(`SelectScrollButton`,n),o=L.useRef(null),s=iO(n),c=L.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return L.useEffect(()=>()=>c(),[c]),Sh(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,B.jsx)(Eh.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:H(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:H(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:H(i.onPointerLeave,()=>{c()})})}),Ehe=`SelectSeparator`,VO=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(Eh.div,{"aria-hidden":!0,...r,ref:t})});VO.displayName=Ehe;var HO=`SelectArrow`,Dhe=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=oO(n),a=sO(HO,n),o=yO(HO,n);return a.open&&o.position===`popper`?(0,B.jsx)(Cv,{...i,...r,ref:t}):null});Dhe.displayName=HO;var Ohe=`SelectBubbleInput`,UO=L.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=L.useRef(null),a=Tm(r,i),o=tO(t);return L.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,B.jsx)(Eh.select,{...n,style:{...wv,...n.style},ref:a,defaultValue:t})});UO.displayName=Ohe;function WO(e){return e===``||e===void 0}function GO(e){let t=Oh(e),n=L.useRef(``),r=L.useRef(0),i=L.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=L.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return L.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function KO(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=khe(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 khe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ahe=cO,qO=uO,jhe=fO,Mhe=pO,Nhe=mO,JO=gO,Phe=TO,YO=OO,XO=jO,Fhe=NO,Ihe=FO,ZO=LO,QO=zO,$O=VO,ek=Ahe,tk=jhe,nk=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(qO,{ref:r,className:V(`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,B.jsx)(Mhe,{asChild:!0,children:(0,B.jsx)(Pp,{className:`h-4 w-4 opacity-50`})})]}));nk.displayName=qO.displayName;var rk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(ZO,{ref:n,className:V(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(kee,{className:`h-4 w-4`})}));rk.displayName=ZO.displayName;var ik=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(QO,{ref:n,className:V(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(Pp,{className:`h-4 w-4`})}));ik.displayName=QO.displayName;var ak=L.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,B.jsx)(Nhe,{children:(0,B.jsxs)(JO,{ref:i,className:V(`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,B.jsx)(rk,{}),(0,B.jsx)(Phe,{className:V(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,B.jsx)(ik,{})]})}));ak.displayName=JO.displayName;var Lhe=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(YO,{ref:n,className:V(`px-2 py-1.5 text-sm font-semibold`,e),...t}));Lhe.displayName=YO.displayName;var ok=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(XO,{ref:r,className:V(`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,B.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(Ihe,{children:(0,B.jsx)(Np,{className:`h-4 w-4`})})}),(0,B.jsx)(Fhe,{children:t})]}));ok.displayName=XO.displayName;var Rhe=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)($O,{ref:n,className:V(`-mx-1 my-1 h-px bg-muted`,e),...t}));Rhe.displayName=$O.displayName;var sk=`objectstack:ai-chat-messages`,ck=`objectstack:ai-chat-panel-open`;function zhe(){try{let e=localStorage.getItem(sk);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function lk(e){try{localStorage.setItem(sk,JSON.stringify(e))}catch{}}function Bhe(){try{return localStorage.getItem(ck)===`true`}catch{return!1}}function Vhe(){let[e,t]=(0,L.useState)(Bhe),n=(0,L.useCallback)(e=>{t(e);try{localStorage.setItem(ck,String(e))}catch{}},[]),r=(0,L.useCallback)(()=>{t(e=>{let t=!e;try{localStorage.setItem(ck,String(t))}catch{}return t})},[]);return(0,L.useEffect)(()=>{function e(e){e.shiftKey&&(e.ctrlKey||e.metaKey)&&e.key===`I`&&(e.preventDefault(),r())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),{isOpen:e,setOpen:n,toggle:r}}var Hhe=380,Uhe=48,Whe=`objectstack:ai-chat-agent`,uk=`__general__`;function Ghe(e){return(e.parts??[]).filter(e=>e.type===`text`).map(e=>e.text).join(``)}function Khe(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function qhe(e){if(!e||typeof e!=`object`)return``;let t=Object.entries(e);return t.length===0?``:t.slice(0,4).map(([e,t])=>{let n;try{n=typeof t==`string`?t:JSON.stringify(t)??String(t)}catch{n=String(t)}return`${e}: ${n.length>30?n.slice(0,30)+`…`:n}`}).join(`, `)}function Jhe(e){return e.type===`dynamic-tool`}function Yhe(e,t=80){let n;try{n=typeof e==`string`?e:JSON.stringify(e)??``}catch{n=String(e??``)}return n.length>t?n.slice(0,t)+`…`:n}function Xhe(e,t){return!t||t===`__general__`?`${e}/api/v1/ai/chat`:`${e}/api/v1/ai/agents/${t}/chat`}function Zhe(){try{return localStorage.getItem(`objectstack:ai-chat-agent`)??`__general__`}catch{return uk}}function dk(e){try{localStorage.setItem(Whe,e)}catch{}}function Qhe(e){let[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)(!0);return(0,L.useEffect)(()=>{let t=!1;return i(!0),fetch(`${e}/api/v1/ai/agents`,{credentials:`include`}).then(e=>e.ok?e.json():{agents:[]}).then(e=>{t||n(e.agents??[])}).catch(()=>{t||n([])}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),{agents:t,loading:r}}function $he({reasoning:e}){let[t,n]=(0,L.useState)(!1);return e.length===0?null:(0,B.jsxs)(`div`,{"data-testid":`reasoning-display`,className:`flex flex-col gap-1 rounded-md border border-border/30 bg-muted/30 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1.5 text-left text-muted-foreground hover:text-foreground transition-colors`,children:[t?(0,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(Tee,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(`span`,{className:`font-medium`,children:`Thinking`}),(0,B.jsxs)(`span`,{className:`text-[10px] opacity-60`,children:[`(`,e.length,` step`,e.length===1?``:`s`,`)`]})]}),t&&(0,B.jsx)(`div`,{className:`mt-1 space-y-1 pl-5 text-muted-foreground italic border-l-2 border-border/30`,children:e.map((e,t)=>(0,B.jsx)(`p`,{className:`text-[11px] leading-relaxed`,children:e},t))})]})}function ege({activeSteps:e,completedSteps:t}){if(e.size===0)return null;let n=t.length+e.size,r=t.length+1;return(0,B.jsxs)(`div`,{"data-testid":`step-progress`,className:`flex flex-col gap-1.5 rounded-md border border-blue-500/30 bg-blue-500/5 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Sm,{className:`h-3 w-3 shrink-0 text-blue-600 dark:text-blue-400`}),(0,B.jsxs)(`span`,{className:`font-medium text-blue-700 dark:text-blue-300`,children:[`Step `,r,` of `,n]})]}),Array.from(e.values()).map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 pl-5`,children:[(0,B.jsx)(Qp,{className:`h-3 w-3 shrink-0 animate-spin text-blue-600 dark:text-blue-400`}),(0,B.jsx)(`span`,{className:`text-blue-700 dark:text-blue-300`,children:e.stepName})]},t))]})}function tge({part:e,onApprove:t,onDeny:n}){let r=Khe(e.toolName),i=qhe(e.input);switch(e.state){case`input-streaming`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-planning`,className:`flex items-start gap-2 rounded-md border border-blue-500/40 bg-blue-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Qp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-blue-600 dark:text-blue-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium text-blue-700 dark:text-blue-300`,children:[`Planning to call `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-blue-600/80 dark:text-blue-300/80`,children:i})]})]});case`input-available`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-calling`,className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Qp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-primary`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Calling `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-muted-foreground`,children:i})]})]});case`approval-requested`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-confirm`,className:`flex flex-col gap-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(lm,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-yellow-600 dark:text-yellow-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Confirm: `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:i})]})]}),e.approval&&t&&n&&(0,B.jsxs)(`div`,{className:`flex gap-2 pl-5`,children:[(0,B.jsxs)(_h,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>t(e.approval.id),children:[(0,B.jsx)(Lp,{className:`mr-1 h-3 w-3`}),`Approve`]}),(0,B.jsxs)(_h,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs text-destructive hover:text-destructive`,onClick:()=>n(e.approval.id),children:[(0,B.jsx)(Rp,{className:`mr-1 h-3 w-3`}),`Deny`]})]})]});case`output-available`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-result`,className:`flex items-start gap-2 rounded-md border border-green-500/30 bg-green-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Lp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:r}),(0,B.jsx)(`p`,{className:`mt-0.5 text-muted-foreground truncate`,children:Yhe(e.output)})]})]});case`output-error`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-error`,className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Rp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[r,` failed`]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-destructive/80`,children:e.errorText})]})]});case`output-denied`:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-denied`,className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Rp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,B.jsxs)(`span`,{className:`font-medium text-muted-foreground`,children:[r,` — denied`]})]});default:return(0,B.jsxs)(`div`,{"data-testid":`tool-invocation-unknown`,className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(bm,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`font-medium`,children:r})]})}}function nge(){let{isOpen:e,setOpen:t,toggle:n}=Vhe(),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(Zhe),[s,c]=(0,L.useState)({reasoning:[],activeSteps:new Map,completedSteps:[]}),l=(0,L.useRef)(null),u=(0,L.useRef)(null),d=xx(),{agents:f,loading:p}=Qhe(d);(0,L.useEffect)(()=>{p||a!==`__general__`&&(f.some(e=>e.name===a)||(o(uk),dk(uk)))},[f,p,a]);let m=(0,L.useMemo)(()=>zhe(),[]),{messages:h,sendMessage:g,setMessages:_,status:v,error:y,addToolApprovalResponse:b}=ED({transport:(0,L.useMemo)(()=>new uD({api:Xhe(d,a)}),[d,a]),messages:m,onFinish:()=>{c({reasoning:[],activeSteps:new Map,completedSteps:[]})}}),x=v===`streaming`||v===`submitted`;(0,L.useEffect)(()=>{if(!x||h.length===0)return;let e=h[h.length-1];if(e.role!==`assistant`)return;let t=[],n=new Map,r=[];(e.parts||[]).forEach(e=>{e.type===`reasoning-delta`||e.type===`reasoning`?t.push(e.text):e.type===`step-start`?n.set(e.stepId,{stepName:e.stepName,startedAt:Date.now()}):e.type===`step-finish`&&r.push(e.stepName)}),c({reasoning:t,activeSteps:n,completedSteps:r})},[h,x]),(0,L.useEffect)(()=>{h.length>0&&lk(h)},[h]),(0,L.useEffect)(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[h]),(0,L.useEffect)(()=>{e&&u.current&&u.current.focus()},[e]);let S=()=>{_([]),lk([])},C=(0,L.useCallback)(e=>{o(e),dk(e),_([]),lk([])},[_]),w=()=>{let e=r.trim();!e||x||(i(``),g({text:e}))};return e?(0,B.jsxs)(`aside`,{"data-testid":`ai-chat-panel`,className:V(`fixed right-0 top-0 z-50 h-full`,`flex flex-col border-l border-border`,`bg-background shadow-xl`,`animate-in slide-in-from-right duration-200`),style:{width:Hhe},children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b`,children:[(0,B.jsxs)(`div`,{className:`flex h-12 items-center justify-between px-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,B.jsx)(jp,{className:`h-4 w-4 text-primary`}),`AI Chat`]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsxs)(_h,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:S,children:[(0,B.jsx)(gm,{className:`h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Clear chat`})]})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Clear history`})})]})}),(0,B.jsxs)(_h,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>t(!1),children:[(0,B.jsx)(xm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}),(0,B.jsx)(`div`,{className:`px-3 pb-2`,children:(0,B.jsxs)(ek,{value:a,onValueChange:C,disabled:p||x,children:[(0,B.jsx)(nk,{"data-testid":`agent-selector`,className:`h-8 text-xs`,children:(0,B.jsx)(tk,{placeholder:`Select agent…`})}),(0,B.jsxs)(ak,{children:[(0,B.jsx)(ok,{value:uk,children:`General Chat`}),f.map(e=>(0,B.jsx)(ok,{value:e.name,children:e.label},e.name))]})]})})]}),(0,B.jsx)($D,{className:`flex-1 overflow-hidden`,children:(0,B.jsxs)(`div`,{ref:l,className:`flex flex-col gap-3 p-3 overflow-y-auto h-full`,children:[h.length===0&&(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-12 text-center text-muted-foreground`,children:[(0,B.jsx)(dm,{className:`h-8 w-8 opacity-40`}),(0,B.jsx)(`p`,{className:`text-sm`,children:`Ask anything about your project.`}),(0,B.jsxs)(`p`,{className:`text-xs opacity-60`,children:[(0,B.jsx)(`kbd`,{children:`⌘⇧I`}),` to toggle this panel`]})]}),h.map(e=>{let t=Ghe(e),n=(e.parts??[]).filter(Jhe);return!(t||n.length>0)&&e.role!==`user`?null:(0,B.jsxs)(`div`,{className:V(`flex flex-col gap-1.5 rounded-lg px-3 py-2 text-sm`,e.role===`user`?`ml-8 bg-primary text-primary-foreground`:`mr-8 bg-muted text-foreground`),children:[(0,B.jsx)(`span`,{className:`text-[10px] font-medium opacity-60 uppercase`,children:e.role===`user`?`You`:`Assistant`}),t&&(0,B.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:t}),n.map(e=>(0,B.jsx)(tge,{part:e,onApprove:e=>b({id:e,approved:!0}),onDeny:e=>b({id:e,approved:!1,reason:`User denied the operation`})},e.toolCallId))]},e.id)}),x&&(0,B.jsxs)(B.Fragment,{children:[s.reasoning.length>0&&(0,B.jsx)(`div`,{className:`mr-8`,children:(0,B.jsx)($he,{reasoning:s.reasoning})}),s.activeSteps.size>0&&(0,B.jsx)(`div`,{className:`mr-8`,children:(0,B.jsx)(ege,{activeSteps:s.activeSteps,completedSteps:s.completedSteps})}),s.reasoning.length===0&&s.activeSteps.size===0&&(0,B.jsxs)(`div`,{className:`mr-8 flex items-center gap-2 rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`inline-block h-2 w-2 animate-pulse rounded-full bg-primary`}),`Thinking…`]})]}),y&&(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,B.jsx)(lm,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`font-medium`,children:`Chat Error`}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs opacity-80`,children:y.message||`Something went wrong`}),y.message&&/unexpected|json|parse|stream/i.test(y.message)&&(0,B.jsx)(`p`,{className:`mt-1 text-xs opacity-70`,children:`The server may not be returning the expected Vercel AI Data Stream format. Ensure the backend endpoint supports SSE streaming.`})]})]})]})}),(0,B.jsx)(`div`,{className:`shrink-0 border-t p-3`,children:(0,B.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,B.jsx)(`textarea`,{ref:u,"data-testid":`ai-chat-input`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),w())},placeholder:`Ask AI…`,rows:1,className:V(`flex-1 resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`max-h-32 min-h-[36px]`)}),(0,B.jsxs)(_h,{type:`button`,size:`icon`,className:`h-9 w-9 shrink-0`,disabled:!r.trim()||x,onClick:w,children:[(0,B.jsx)(cm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Send`})]})]})})]}):(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(`button`,{onClick:n,"data-testid":`ai-chat-toggle`,className:V(`fixed right-0 top-1/2 -translate-y-1/2 z-50`,`flex items-center justify-center`,`h-10 rounded-l-md border border-r-0 border-border`,`bg-background text-foreground shadow-md`,`hover:bg-accent transition-colors`),style:{width:Uhe},children:(0,B.jsx)(dm,{className:`h-5 w-5`})})}),(0,B.jsx)(Kv,{side:`left`,children:(0,B.jsxs)(`p`,{children:[`AI Chat `,(0,B.jsx)(`kbd`,{className:`ml-1 text-[10px] opacity-60`,children:`⌘⇧I`})]})})]})})}function rge(){return{plugins:new Map,viewers:new Map,panels:new Map,actions:new Map,commands:new Map,metadataIcons:new Map,activated:new Set}}var ige=class{state;listeners=new Set;constructor(){this.state=rge()}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getSnapshot(){return this.state}notify(){this.state={...this.state},this.listeners.forEach(e=>e())}register(e){let{id:t}=e.manifest;this.state.plugins.has(t)&&(console.warn(`[PluginRegistry] Plugin "${t}" is already registered, replacing.`),this.deactivate(t)),this.state.plugins.set(t,e),this.notify()}async registerAndActivate(e){this.register(e),await this.activate(e.manifest.id)}async activate(e){let t=this.state.plugins.get(e);if(!t){console.error(`[PluginRegistry] Cannot activate unknown plugin "${e}"`);return}if(this.state.activated.has(e))return;let n=this.createPluginAPI(e,t);try{await t.activate(n),this.state.activated.add(e),console.log(`[PluginRegistry] Activated plugin "${e}"`),this.notify()}catch(t){console.error(`[PluginRegistry] Failed to activate "${e}":`,t)}}deactivate(e){let t=this.state.plugins.get(e);if(t){try{t.deactivate?.()}catch(t){console.error(`[PluginRegistry] Error deactivating "${e}":`,t)}for(let[t,n]of this.state.viewers)n.pluginId===e&&this.state.viewers.delete(t);for(let[t,n]of this.state.panels)n.pluginId===e&&this.state.panels.delete(t);for(let[t,n]of this.state.actions)n.pluginId===e&&this.state.actions.delete(t);for(let[t,n]of this.state.commands)n.pluginId===e&&this.state.commands.delete(t);for(let[e,n]of this.state.metadataIcons)n.metadataType&&t.manifest.contributes.metadataIcons?.some(t=>t.metadataType===e)&&this.state.metadataIcons.delete(e);this.state.activated.delete(e),this.state.plugins.delete(e),this.notify()}}getViewer(e,t=`preview`){let n=null;for(let r of this.state.viewers.values())!r.metadataTypes.includes(e)&&!r.metadataTypes.includes(`*`)||r.modes.includes(t)&&(!n||r.priority>n.priority)&&(n=r);return n}getViewers(e){return Array.from(this.state.viewers.values()).filter(t=>t.metadataTypes.includes(e)||t.metadataTypes.includes(`*`)).sort((e,t)=>t.priority-e.priority)}getAvailableModes(e){let t=new Set;for(let n of this.state.viewers.values())(n.metadataTypes.includes(e)||n.metadataTypes.includes(`*`))&&n.modes.forEach(e=>t.add(e));return Array.from(t)}getActions(e,t){return Array.from(this.state.actions.values()).filter(n=>t&&n.location!==t?!1:n.metadataTypes.length===0||n.metadataTypes.includes(e))}getCommands(){return Array.from(this.state.commands.values())}getPanels(e){return Array.from(this.state.panels.values()).filter(t=>!e||t.location===e)}getPlugins(){return Array.from(this.state.plugins.values())}getSidebarGroups(){let e=new Map;for(let t of this.state.plugins.values())for(let n of t.manifest.contributes.sidebarGroups){let t=e.get(n.key);if(t){let e=new Set([...t.metadataTypes,...n.metadataTypes]);t.metadataTypes=Array.from(e),n.ordere.order-t.order)}getMetadataIcon(e){return this.state.metadataIcons.get(e)||null}getAllMetadataIcons(){return new Map(this.state.metadataIcons)}isActivated(e){return this.state.activated.has(e)}createPluginAPI(e,t){let n=this;return{registerViewer(r,i){let a=t.manifest.contributes.metadataViewers.find(e=>e.id===r);if(!a){console.warn(`[PluginRegistry] Viewer "${r}" not declared in manifest of "${e}"`);return}let o={id:r,pluginId:e,label:a.label,metadataTypes:a.metadataTypes,modes:a.modes,priority:a.priority,component:i};n.state.viewers.set(r,o),n.notify()},registerPanel(r,i){let a=t.manifest.contributes.panels.find(e=>e.id===r);if(!a){console.warn(`[PluginRegistry] Panel "${r}" not declared in manifest of "${e}"`);return}n.state.panels.set(r,{id:r,pluginId:e,label:a.label,icon:a.icon,location:a.location,component:i}),n.notify()},registerAction(r,i){let a=t.manifest.contributes.actions.find(e=>e.id===r);if(!a){console.warn(`[PluginRegistry] Action "${r}" not declared in manifest of "${e}"`);return}n.state.actions.set(r,{id:r,pluginId:e,label:a.label,icon:a.icon,location:a.location,metadataTypes:a.metadataTypes,handler:i}),n.notify()},registerCommand(r,i){let a=t.manifest.contributes.commands.find(e=>e.id===r);if(!a){console.warn(`[PluginRegistry] Command "${r}" not declared in manifest of "${e}"`);return}n.state.commands.set(r,{id:r,pluginId:e,label:a.label,shortcut:a.shortcut,icon:a.icon,handler:i}),n.notify()},registerMetadataIcon(e,r,i){let a=t.manifest.contributes.metadataIcons.find(t=>t.metadataType===e);n.state.metadataIcons.set(e,{metadataType:e,label:i||a?.label||e,icon:r}),n.notify()}}}},fk=null;function age(){return fk||=new ige,fk}var pk=(0,L.createContext)(null);function mk(){let e=(0,L.useContext)(pk);if(!e)throw Error(`usePluginRegistry must be used within a `);return e}function oge({plugins:e=[],registry:t,children:n}){let r=(0,L.useMemo)(()=>t||age(),[t]),[i,a]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{let t=!1;async function n(){for(let n of e){if(t)break;try{await r.registerAndActivate(n)}catch(e){console.error(`[PluginRegistryProvider] Failed to init plugin "${n.manifest.id}":`,e)}}t||a(!0)}return n(),()=>{t=!0}},[r,e]),i?(0,B.jsx)(pk.Provider,{value:r,children:n}):(0,B.jsx)(pk.Provider,{value:r,children:(0,B.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,B.jsx)(`div`,{className:`h-8 w-8 mx-auto animate-spin rounded-full border-4 border-muted border-t-primary`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading plugins…`})]})})})}function hk(){let e=mk();return(0,L.useSyncExternalStore)((0,L.useCallback)(t=>e.subscribe(t),[e]),(0,L.useCallback)(()=>e.getSnapshot(),[e]))}function sge(e,t=`preview`){let n=mk();return hk(),(0,L.useMemo)(()=>n.getViewer(e,t),[n,e,t])}function cge(e){let t=mk();return hk(),(0,L.useMemo)(()=>t.getViewers(e),[t,e])}function lge(e){let t=mk();return hk(),(0,L.useMemo)(()=>t.getAvailableModes(e),[t,e])}function uge(e,t){let n=mk();return hk(),(0,L.useMemo)(()=>n.getActions(e,t),[n,e,t])}var dge={preview:{icon:Wp,label:`Preview`},design:{icon:Hee,label:`Design`},code:{icon:Bp,label:`Code`},data:{icon:mm,label:`Data`}};function gk({metadataType:e,metadataName:t,data:n,packageId:r}){let[i,a]=(0,L.useState)(`preview`),o=lge(e),s=cge(e),c=sge(e,i),l=uge(e,`toolbar`),u=o.includes(i)?i:o[0]||`preview`,d=(0,L.useMemo)(()=>s.filter(e=>e.modes.includes(u)),[s,u]),[f,p]=(0,L.useState)(0),m=d[f]||c;if(!m)return(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,B.jsxs)(`p`,{className:`text-sm`,children:[`No viewer available for `,(0,B.jsx)(yx,{variant:`outline`,children:e})]}),(0,B.jsx)(`p`,{className:`text-xs`,children:`Install a plugin that supports this metadata type.`})]})});let h=m.component;return(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 border-b px-4 bg-muted/30 min-h-10`,children:[(0,B.jsx)(`div`,{className:`flex items-center gap-0.5`,children:o.map(e=>{let t=dge[e],n=t.icon;return(0,B.jsxs)(`button`,{onClick:()=>{a(e),p(0)},className:` - flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-colors - ${e===u?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`} - `,children:[(0,B.jsx)(n,{className:`h-3.5 w-3.5`}),t.label]},e)})}),d.length>1&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border`}),(0,B.jsxs)(ex,{children:[(0,B.jsx)(tx,{asChild:!0,children:(0,B.jsxs)(_h,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 text-xs`,children:[m.label,(0,B.jsx)(Pp,{className:`h-3 w-3`})]})}),(0,B.jsx)(nx,{align:`start`,children:d.map((e,t)=>(0,B.jsxs)(rx,{onClick:()=>p(t),className:t===f?`bg-accent`:``,children:[(0,B.jsx)(`span`,{className:`text-xs`,children:e.label}),(0,B.jsx)(yx,{variant:`outline`,className:`ml-2 text-[10px]`,children:e.pluginId})]},e.id))})]})]}),(0,B.jsx)(`div`,{className:`flex-1`}),l.map(r=>(0,B.jsx)(_h,{variant:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:()=>r.handler({metadataType:e,metadataName:t,data:n}),children:r.label},r.id)),(0,B.jsx)(yx,{variant:`secondary`,className:`text-[10px] font-mono`,children:m.pluginId})]}),(0,B.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,B.jsx)(h,{metadataType:e,metadataName:t,data:n,mode:u,packageId:r})})]})}var fge=E([`preview`,`design`,`code`,`data`]),pge=h({id:r().describe(`Unique viewer identifier`),metadataTypes:C(r()).min(1).describe(`Metadata types this viewer can handle`),label:r().describe(`Viewer display label`),priority:P().default(0).describe(`Viewer priority (higher wins)`),modes:C(fge).default([`preview`]).describe(`Supported view modes`)}),mge=h({key:r().describe(`Unique group key`),label:r().describe(`Group display label`),icon:r().optional().describe(`Lucide icon name`),metadataTypes:C(r()).describe(`Metadata types in this group`),order:P().default(100).describe(`Sort order (lower = higher)`)}),hge=E([`toolbar`,`contextMenu`,`commandPalette`]),gge=h({id:r().describe(`Unique action identifier`),label:r().describe(`Action display label`),icon:r().optional().describe(`Lucide icon name`),location:hge.describe(`UI location`),metadataTypes:C(r()).default([]).describe(`Applicable metadata types`)}),_ge=h({metadataType:r().describe(`Metadata type`),label:r().describe(`Display label`),icon:r().describe(`Lucide icon name`)}),vge=E([`bottom`,`right`,`modal`]),yge=h({id:r().describe(`Unique panel identifier`),label:r().describe(`Panel display label`),icon:r().optional().describe(`Lucide icon name`),location:vge.default(`bottom`).describe(`Panel location`)}),bge=h({id:r().describe(`Unique command identifier`),label:r().describe(`Command display label`),shortcut:r().optional().describe(`Keyboard shortcut`),icon:r().optional().describe(`Lucide icon name`)}),xge=h({metadataViewers:C(pge).default([]),sidebarGroups:C(mge).default([]),actions:C(gge).default([]),metadataIcons:C(_ge).default([]),panels:C(yge).default([]),commands:C(bge).default([])}),Sge=r().describe(`Activation event pattern`),Cge=h({id:r().regex(/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/).describe(`Plugin ID (dot-separated lowercase)`),name:r().describe(`Plugin display name`),version:r().default(`0.0.1`).describe(`Plugin version`),description:r().optional().describe(`Plugin description`),author:r().optional().describe(`Author`),contributes:xge.default({metadataViewers:[],sidebarGroups:[],actions:[],metadataIcons:[],panels:[],commands:[]}),activationEvents:C(Sge).default([`*`])});function _k(e){return Cge.parse(e)}var wge=h({key:r().describe(`Section key (e.g., "basics", "constraints", "security")`),label:r().describe(`Section display label`),icon:r().optional().describe(`Lucide icon name`),defaultExpanded:S().default(!0).describe(`Whether section is expanded by default`),order:P().default(0).describe(`Sort order (lower = higher)`)}),Tge=h({key:r().describe(`Group key matching field.group values`),label:r().describe(`Group display label`),icon:r().optional().describe(`Lucide icon name`),defaultExpanded:S().default(!0).describe(`Whether group is expanded by default`),order:P().default(0).describe(`Sort order (lower = higher)`)}),Ege=h({inlineEditing:S().default(!0).describe(`Enable inline editing of field properties`),dragReorder:S().default(!0).describe(`Enable drag-and-drop field reordering`),showFieldGroups:S().default(!0).describe(`Show field group headers`),showPropertyPanel:S().default(!0).describe(`Show the right-side property panel`),propertySections:C(wge).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:C(Tge).default([]).describe(`Field group definitions`),paginationThreshold:P().default(50).describe(`Number of fields before pagination is enabled`),batchOperations:S().default(!0).describe(`Enable batch add/remove field operations`),showUsageStats:S().default(!1).describe(`Show field usage statistics`)}),Dge=h({type:E([`lookup`,`master_detail`,`tree`]).describe(`Relationship type`),lineStyle:E([`solid`,`dashed`,`dotted`]).default(`solid`).describe(`Line style in diagrams`),color:r().default(`#94a3b8`).describe(`Line color (CSS value)`),highlightColor:r().default(`#0891b2`).describe(`Highlighted color on hover/select`),cardinalityLabel:r().default(`1:N`).describe(`Cardinality label (e.g., "1:N", "1:1", "N:M")`)}),Oge=h({visualCreation:S().default(!0).describe(`Enable drag-to-create relationships`),showReverseRelationships:S().default(!0).describe(`Show reverse/child-to-parent relationships`),showCascadeWarnings:S().default(!0).describe(`Show cascade delete behavior warnings`),displayConfig:C(Dge).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`)}),kge=E([`force`,`hierarchy`,`grid`,`circular`]).describe(`ER diagram layout algorithm`),Age=h({showFields:S().default(!0).describe(`Show field list inside entity nodes`),maxFieldsVisible:P().default(8).describe(`Max fields visible before "N more..." collapse`),showFieldTypes:S().default(!0).describe(`Show field type badges`),showRequiredIndicator:S().default(!0).describe(`Show required field indicators`),showRecordCount:S().default(!1).describe(`Show live record count on nodes`),showIcon:S().default(!0).describe(`Show object icon on node header`),showDescription:S().default(!0).describe(`Show description tooltip on hover`)}),jge=h({enabled:S().default(!0).describe(`Enable ER diagram panel`),layout:kge.default(`force`).describe(`Default layout algorithm`),nodeDisplay:Age.default({showFields:!0,maxFieldsVisible:8,showFieldTypes:!0,showRequiredIndicator:!0,showRecordCount:!1,showIcon:!0,showDescription:!0}).describe(`Node display configuration`),showMinimap:S().default(!0).describe(`Show minimap for large diagrams`),zoomControls:S().default(!0).describe(`Show zoom in/out/fit controls`),minZoom:P().default(.1).describe(`Minimum zoom level`),maxZoom:P().default(3).describe(`Maximum zoom level`),showEdgeLabels:S().default(!0).describe(`Show cardinality labels on relationship edges`),highlightOnHover:S().default(!0).describe(`Highlight connected entities on node hover`),clickToNavigate:S().default(!0).describe(`Click node to navigate to object detail`),dragToConnect:S().default(!0).describe(`Drag between nodes to create relationships`),hideOrphans:S().default(!1).describe(`Hide objects with no relationships`),autoFit:S().default(!0).describe(`Auto-fit diagram to viewport on load`),exportFormats:C(E([`png`,`svg`,`json`])).default([`png`,`svg`]).describe(`Available export formats for diagram`)}),Mge=E([`table`,`cards`,`tree`]).describe(`Object list display mode`),Nge=E([`name`,`label`,`fieldCount`,`updatedAt`]).describe(`Object list sort field`),Pge=h({package:r().optional().describe(`Filter by owning package`),tags:C(r()).optional().describe(`Filter by object tags`),includeSystem:S().default(!0).describe(`Include system-level objects`),includeAbstract:S().default(!1).describe(`Include abstract base objects`),hasFieldType:r().optional().describe(`Filter to objects containing a specific field type`),hasRelationships:S().optional().describe(`Filter to objects with lookup/master_detail fields`),searchQuery:r().optional().describe(`Free-text search across name, label, and description`)}),Fge=h({defaultDisplayMode:Mge.default(`table`).describe(`Default list display mode`),defaultSortField:Nge.default(`label`).describe(`Default sort field`),defaultSortDirection:E([`asc`,`desc`]).default(`asc`).describe(`Default sort direction`),defaultFilter:Pge.default({includeSystem:!0,includeAbstract:!1}).describe(`Default filter configuration`),showFieldCount:S().default(!0).describe(`Show field count badge`),showRelationshipCount:S().default(!0).describe(`Show relationship count badge`),showQuickPreview:S().default(!0).describe(`Show quick field preview tooltip on hover`),enableComparison:S().default(!1).describe(`Enable side-by-side object comparison`),showERDiagramToggle:S().default(!0).describe(`Show ER diagram toggle in toolbar`),showCreateAction:S().default(!0).describe(`Show create object action`),showStatsSummary:S().default(!0).describe(`Show statistics summary bar`)}),Ige=h({tabs:C(h({key:r().describe(`Tab key`),label:r().describe(`Tab display label`),icon:r().optional().describe(`Lucide icon name`),enabled:S().default(!0).describe(`Whether this tab is available`),order:P().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:r().default(`fields`).describe(`Default active tab key`),showHeader:S().default(!0).describe(`Show object summary header`),showBreadcrumbs:S().default(!0).describe(`Show navigation breadcrumbs`)});h({defaultView:E([`field-editor`,`relationship-mapper`,`er-diagram`,`object-manager`]).describe(`Default view when entering the Object Designer`).default(`field-editor`).describe(`Default view`),fieldEditor:Ege.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:Oge.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:jge.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:Fge.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:Ige.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 Lge=h({enabled:S().default(!0).describe(`Enable snap-to-grid`),gridSize:P().int().min(1).default(8).describe(`Snap grid size in pixels`),showGrid:S().default(!0).describe(`Show grid overlay on canvas`),showGuides:S().default(!0).describe(`Show alignment guides when dragging`)}),Rge=h({min:P().min(.1).default(.25).describe(`Minimum zoom level`),max:P().max(10).default(3).describe(`Maximum zoom level`),default:P().default(1).describe(`Default zoom level`),step:P().default(.1).describe(`Zoom step increment`)}),zge=h({type:r().describe(`Component type (e.g. "element:button", "element:text")`),label:r().describe(`Display label in palette`),icon:r().optional().describe(`Icon name for palette display`),category:E([`content`,`interactive`,`data`,`layout`]).describe(`Palette category grouping`),defaultWidth:P().int().min(1).default(4).describe(`Default width in grid columns`),defaultHeight:P().int().min(1).default(2).describe(`Default height in grid rows`)});h({snap:Lge.optional().describe(`Canvas snap settings`),zoom:Rge.optional().describe(`Canvas zoom settings`),palette:C(zge).optional().describe(`Custom element palette (defaults to all registered elements)`),showLayerPanel:S().default(!0).describe(`Show layer ordering panel`),showPropertyPanel:S().default(!0).describe(`Show property inspector panel`),undoLimit:P().int().min(1).default(50).describe(`Maximum undo history steps`)});var Bge=E([`rounded_rect`,`circle`,`diamond`,`parallelogram`,`hexagon`,`diamond_thick`,`attached_circle`,`screen_rect`]).describe(`Visual shape for rendering a flow node on the canvas`),Vge=h({action:r().describe(`FlowNodeAction value (e.g., "parallel_gateway")`),shape:Bge.describe(`Shape to render`),icon:r().describe(`Lucide icon name`),defaultLabel:r().describe(`Default display label`),defaultWidth:P().int().min(20).default(120).describe(`Default width in pixels`),defaultHeight:P().int().min(20).default(60).describe(`Default height in pixels`),fillColor:r().default(`#ffffff`).describe(`Node fill color (CSS value)`),borderColor:r().default(`#94a3b8`).describe(`Node border color (CSS value)`),allowBoundaryEvents:S().default(!1).describe(`Whether boundary events can be attached to this node type`),paletteCategory:E([`event`,`gateway`,`activity`,`data`,`subflow`]).describe(`Palette category for grouping`)}).describe(`Visual render descriptor for a flow node type`);h({nodeId:r().describe(`Corresponding FlowNode.id`),x:P().describe(`X position on canvas`),y:P().describe(`Y position on canvas`),width:P().int().min(20).optional().describe(`Width override in pixels`),height:P().int().min(20).optional().describe(`Height override in pixels`),collapsed:S().default(!1).describe(`Whether the node is collapsed`),fillColor:r().optional().describe(`Fill color override`),borderColor:r().optional().describe(`Border color override`),annotation:r().optional().describe(`User annotation displayed near the node`)}).describe(`Canvas layout data for a flow node`);var Hge=E([`solid`,`dashed`,`dotted`,`bold`]).describe(`Edge line style`);h({edgeId:r().describe(`Corresponding FlowEdge.id`),style:Hge.default(`solid`).describe(`Line style`),color:r().default(`#94a3b8`).describe(`Edge line color`),labelPosition:P().min(0).max(1).default(.5).describe(`Position of the condition label along the edge`),waypoints:C(h({x:P().describe(`Waypoint X`),y:P().describe(`Waypoint Y`)})).optional().describe(`Manual waypoints for edge routing`),animated:S().default(!1).describe(`Show animated flow indicator`)}).describe(`Canvas layout and visual data for a flow edge`);var Uge=E([`dagre`,`elk`,`force`,`manual`]).describe(`Auto-layout algorithm for the flow canvas`),Wge=E([`TB`,`BT`,`LR`,`RL`]).describe(`Auto-layout direction`);h({snap:h({enabled:S().default(!0).describe(`Enable snap-to-grid`),gridSize:P().int().min(1).default(16).describe(`Snap grid size in pixels`),showGrid:S().default(!0).describe(`Show grid overlay`)}).default({enabled:!0,gridSize:16,showGrid:!0}).describe(`Canvas snap-to-grid settings`),zoom:h({min:P().min(.1).default(.25).describe(`Minimum zoom level`),max:P().max(10).default(3).describe(`Maximum zoom level`),default:P().default(1).describe(`Default zoom level`),step:P().default(.1).describe(`Zoom step`)}).default({min:.25,max:3,default:1,step:.1}).describe(`Canvas zoom settings`),layoutAlgorithm:Uge.default(`dagre`).describe(`Default auto-layout algorithm`),layoutDirection:Wge.default(`TB`).describe(`Default auto-layout direction`),nodeDescriptors:C(Vge).optional().describe(`Custom node render descriptors (merged with built-in defaults)`),showMinimap:S().default(!0).describe(`Show minimap panel`),showPropertyPanel:S().default(!0).describe(`Show property panel`),showPalette:S().default(!0).describe(`Show node palette sidebar`),undoLimit:P().int().min(1).default(50).describe(`Maximum undo history steps`),animateExecution:S().default(!0).describe(`Animate edges during execution preview`),connectionValidation:S().default(!0).describe(`Validate connections before creating edges`)}).describe(`Studio Flow Builder configuration`);var vk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,B.jsx)(`table`,{ref:n,className:V(`w-full caption-bottom text-sm`,e),...t})}));vk.displayName=`Table`;var yk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`thead`,{ref:n,className:V(`[&_tr]:border-b`,e),...t}));yk.displayName=`TableHeader`;var bk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`tbody`,{ref:n,className:V(`[&_tr:last-child]:border-0`,e),...t}));bk.displayName=`TableBody`;var Gge=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`tfoot`,{ref:n,className:V(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,e),...t}));Gge.displayName=`TableFooter`;var xk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`tr`,{ref:n,className:V(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));xk.displayName=`TableRow`;var Sk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`th`,{ref:n,className:V(`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}));Sk.displayName=`TableHead`;var Ck=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`td`,{ref:n,className:V(`p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));Ck.displayName=`TableCell`;var Kge=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`caption`,{ref:n,className:V(`mt-4 text-sm text-muted-foreground`,e),...t}));Kge.displayName=`TableCaption`;function qge({value:e,type:t}){if(e==null)return(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`—`});if(t===`boolean`)return e?(0,B.jsxs)(yx,{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,B.jsx)(Np,{className:`h-3 w-3`}),` Yes`]}):(0,B.jsxs)(yx,{variant:`secondary`,className:`gap-1`,children:[(0,B.jsx)(xm,{className:`h-3 w-3`}),` No`]});if(t===`number`)return(0,B.jsx)(`span`,{className:`font-mono text-sm tabular-nums`,children:e});if(t===`select`)return(0,B.jsx)(yx,{variant:`outline`,children:String(e)});let n=String(e);return n.length>50?(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsxs)(`span`,{className:`cursor-default`,children:[n.slice(0,50),`…`]})}),(0,B.jsx)(Kv,{className:`max-w-sm`,children:(0,B.jsx)(`p`,{className:`text-xs`,children:n})})]})}):(0,B.jsx)(`span`,{children:n})}function Jge({cols:e}){return(0,B.jsx)(B.Fragment,{children:Array.from({length:3}).map((t,n)=>(0,B.jsx)(xk,{children:Array.from({length:e+1}).map((e,t)=>(0,B.jsx)(Ck,{children:(0,B.jsx)(Yg,{className:`h-4 w-full`})},t))},n))})}function Yge({objectApiName:e,onEdit:t}){let n=_p(),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)([]),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(1),[d,f]=(0,L.useState)(0),[p,m]=(0,L.useState)(``);(0,L.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,L.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||(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||(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||(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,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{children:[(0,B.jsx)(Yg,{className:`h-6 w-48`}),(0,B.jsx)(Yg,{className:`h-4 w-32 mt-1`})]}),(0,B.jsx)(Ex,{children:(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{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,B.jsxs)(Sx,{className:`flex flex-col shadow-sm`,children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(wx,{className:`text-xl font-semibold tracking-tight`,children:r.label}),(0,B.jsxs)(Tx,{children:[d>0?d:a.length,` records • `,(0,B.jsx)(`code`,{className:`text-xs bg-muted px-1 py-0.5 rounded`,children:r.name})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,onClick:g,className:`gap-1.5`,children:[(0,B.jsx)(om,{className:`h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:`Refresh`})]}),(0,B.jsxs)(_h,{onClick:()=>t({}),size:`sm`,className:`gap-1.5`,children:[(0,B.jsx)(am,{className:`h-3.5 w-3.5`}),`New `,r.label]})]})]}),(0,B.jsxs)(`div`,{className:`relative mt-3`,children:[(0,B.jsx)(sm,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(vh,{placeholder:`Search ${r.label.toLowerCase()}...`,value:p,onChange:e=>m(e.target.value),className:`pl-9 h-9`})]})]}),(0,B.jsx)(Ex,{className:`p-0`,children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(vk,{children:[(0,B.jsx)(yk,{children:(0,B.jsxs)(xk,{className:`hover:bg-transparent`,children:[v.map(e=>(0,B.jsx)(Sk,{className:`font-medium whitespace-nowrap`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.label,(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] px-1 py-0 font-normal opacity-50 hidden lg:inline-flex`,children:e.type})]})},e.name)),(0,B.jsx)(Sk,{className:`w-15 sticky right-0 bg-background`})]})}),(0,B.jsxs)(bk,{children:[s&&a.length===0?(0,B.jsx)(Jge,{cols:v.length}):y.map(e=>(0,B.jsxs)(xk,{className:`group`,children:[v.map(t=>(0,B.jsx)(Ck,{className:`py-2.5`,children:(0,B.jsx)(qge,{value:e[t.name],type:t.type})},t.name)),(0,B.jsx)(Ck,{className:`py-2.5 sticky right-0 bg-background`,children:(0,B.jsxs)(ex,{children:[(0,B.jsx)(tx,{asChild:!0,children:(0,B.jsxs)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,B.jsx)(Pee,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Actions`})]})}),(0,B.jsxs)(nx,{align:`end`,children:[(0,B.jsxs)(rx,{onClick:()=>t(e),children:[(0,B.jsx)(qee,{className:`mr-2 h-4 w-4`}),`Edit`]}),(0,B.jsx)(ax,{}),(0,B.jsxs)(rx,{onClick:()=>h(e.id),className:`text-destructive focus:text-destructive`,children:[(0,B.jsx)(gm,{className:`mr-2 h-4 w-4`}),`Delete`]})]})]})})]},e.id)),!s&&y.length===0&&(0,B.jsx)(xk,{children:(0,B.jsx)(Ck,{colSpan:v.length+1,className:`h-32 text-center`,children:(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 text-muted-foreground`,children:[(0,B.jsx)(sm,{className:`h-8 w-8 opacity-30`}),(0,B.jsx)(`span`,{className:`text-sm font-medium`,children:`No records found`}),(0,B.jsx)(`span`,{className:`text-xs`,children:p?`Try a different search term`:`Create your first record to get started`})]})})})]})]})})}),(0,B.jsxs)(Dx,{className:`py-3 px-4 border-t flex justify-between items-center`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Page `,l,` of `,b]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,disabled:l===1,onClick:()=>u(e=>Math.max(1,e-1)),className:`h-8 gap-1`,children:[(0,B.jsx)(Cee,{className:`h-3.5 w-3.5`}),`Previous`]}),(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,disabled:l>=b,onClick:()=>u(e=>e+1),className:`h-8 gap-1`,children:[`Next`,(0,B.jsx)(kp,{className:`h-3.5 w-3.5`})]})]})]})]})}var Xge={text:Yee,textarea:Kp,number:Jp,boolean:Jee,select:zee,lookup:Zp,formula:Eee,date:Dee,datetime:Dee,autonumber:Jp},Zge={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 Qge({text:e}){let[t,n]=(0,L.useState)(!1);return(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{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,B.jsx)(Np,{className:`h-3 w-3 text-emerald-500`}):(0,B.jsx)(Vp,{className:`h-3 w-3`})})}),(0,B.jsx)(Kv,{children:`Copy field name`})]})})}function $ge({objectApiName:e}){let t=_p(),[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(!0),[o,s]=(0,L.useState)(``);if((0,L.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,B.jsxs)(Sx,{children:[(0,B.jsx)(Cx,{children:(0,B.jsx)(Yg,{className:`h-6 w-48`})}),(0,B.jsxs)(Ex,{className:`space-y-3`,children:[(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`})]})]});if(!n)return(0,B.jsx)(Sx,{children:(0,B.jsxs)(Ex,{className:`py-12 text-center text-muted-foreground`,children:[`Object definition not found: `,(0,B.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,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(Sx,{children:[(0,B.jsx)(Cx,{className:`pb-3`,children:(0,B.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(wx,{className:`text-xl`,children:n.label}),d&&(0,B.jsx)(yx,{variant:`secondary`,className:`font-mono text-xs`,children:d})]}),(0,B.jsxs)(Tx,{className:`flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:u}),(0,B.jsx)(`span`,{children:`·`}),(0,B.jsxs)(`span`,{children:[l.length,` fields`]}),p&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:`·`}),(0,B.jsxs)(`span`,{className:`text-xs`,children:[`owned by `,(0,B.jsx)(`code`,{className:`font-mono`,children:p})]})]})]})]})})}),d&&(0,B.jsx)(Ex,{className:`pt-0 pb-3`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground bg-muted/50 rounded-md px-3 py-2`,children:[(0,B.jsx)(Up,{className:`h-3.5 w-3.5`}),(0,B.jsxs)(`span`,{children:[`Namespace: `,(0,B.jsx)(`strong`,{children:d}),` · Short name: `,(0,B.jsx)(`strong`,{children:f}),` · Table: `,(0,B.jsx)(`code`,{className:`font-mono bg-muted px-1 rounded`,children:u})]})]})})]}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(wx,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(Bp,{className:`h-4 w-4`}),`Field Definitions`]}),(0,B.jsxs)(yx,{variant:`secondary`,className:`text-xs`,children:[m.length,` / `,l.length]})]}),(0,B.jsxs)(`div`,{className:`relative mt-2`,children:[(0,B.jsx)(sm,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(vh,{placeholder:`Filter fields by name, label, or type...`,value:o,onChange:e=>s(e.target.value),className:`pl-9 h-8 text-sm`})]})]}),(0,B.jsx)(Ex,{className:`p-0`,children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(vk,{children:[(0,B.jsx)(yk,{children:(0,B.jsxs)(xk,{className:`hover:bg-transparent`,children:[(0,B.jsx)(Sk,{className:`w-8`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Field Name`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Label`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Type`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Required`}),(0,B.jsx)(Sk,{className:`font-medium`,children:`Details`})]})}),(0,B.jsxs)(bk,{children:[m.map((e,t)=>{let n=Xge[e.type]||jee,r=Zge[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,B.jsxs)(xk,{className:`group`,children:[(0,B.jsx)(Ck,{className:`py-2 text-center text-xs text-muted-foreground tabular-nums`,children:t+1}),(0,B.jsx)(Ck,{className:`py-2`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`code`,{className:`font-mono text-sm font-medium`,children:e.name}),(0,B.jsx)(Qge,{text:e.name}),e.required&&(0,B.jsx)(Lee,{className:`h-3 w-3 text-amber-500`})]})}),(0,B.jsx)(Ck,{className:`py-2 text-sm`,children:e.label}),(0,B.jsx)(Ck,{className:`py-2`,children:(0,B.jsxs)(yx,{variant:`outline`,className:`gap-1 text-xs ${r}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),e.type,e.multiple&&`[]`]})}),(0,B.jsx)(Ck,{className:`py-2`,children:e.required?(0,B.jsx)(yx,{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,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Optional`})}),(0,B.jsx)(Ck,{className:`py-2`,children:(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.reference&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] font-mono gap-1`,children:[(0,B.jsx)(Zp,{className:`h-2.5 w-2.5`}),` → `,e.reference]}),e.defaultValue!==void 0&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] font-mono`,children:[`default: `,JSON.stringify(e.defaultValue)]}),e.maxLength&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] font-mono`,children:[`max: `,e.maxLength]}),e.options&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px]`,children:[e.options.length,` options`]}),e.formula&&(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] font-mono`,children:[`ƒ `,String(e.formula).slice(0,30)]})]})})]},e.name)}),m.length===0&&(0,B.jsx)(xk,{children:(0,B.jsx)(Ck,{colSpan:6,className:`h-24 text-center text-muted-foreground text-sm`,children:o?`No fields matching filter`:`No fields defined`})})]})]})})})]})]})}var wk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`textarea`,{className:V(`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}));wk.displayName=`Textarea`;var e_e=`Label`,Tk=L.forwardRef((e,t)=>(0,B.jsx)(Qte.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Tk.displayName=e_e;var Ek=Tk,t_e=Pm(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Dk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Ek,{ref:n,className:V(t_e(),e),...t}));Dk.displayName=Ek.displayName;var Ok=`Switch`,[n_e,r_e]=xh(Ok),[i_e,a_e]=n_e(Ok),kk=L.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]=L.useState(null),m=Tm(t,e=>p(e)),h=L.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=wh({prop:i,defaultProp:a??!1,onChange:l,caller:Ok});return(0,B.jsxs)(i_e,{scope:n,checked:_,disabled:s,children:[(0,B.jsx)(Eh.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":Nk(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:H(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,B.jsx)(Mk,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});kk.displayName=Ok;var Ak=`SwitchThumb`,jk=L.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=a_e(Ak,n);return(0,B.jsx)(Eh.span,{"data-state":Nk(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});jk.displayName=Ak;var o_e=`SwitchBubbleInput`,Mk=L.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=L.useRef(null),s=Tm(o,a),c=tO(n),l=sv(t);return L.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,B.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}})});Mk.displayName=o_e;function Nk(e){return e?`checked`:`unchecked`}var Pk=kk,s_e=jk,Fk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Pk,{className:V(`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,B.jsx)(s_e,{className:V(`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`)})}));Fk.displayName=Pk.displayName;var Ik=Bg,c_e=Vg,Lk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Hg,{ref:n,className:V(`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}));Lk.displayName=Hg.displayName;var Rk=L.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(c_e,{children:[(0,B.jsx)(Lk,{}),(0,B.jsxs)(Ug,{ref:r,className:V(`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,B.jsxs)(Kg,{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,B.jsx)(xm,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Rk.displayName=Ug.displayName;var zk=({className:e,...t})=>(0,B.jsx)(`div`,{className:V(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});zk.displayName=`DialogHeader`;var Bk=({className:e,...t})=>(0,B.jsx)(`div`,{className:V(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Bk.displayName=`DialogFooter`;var Vk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Wg,{ref:n,className:V(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Vk.displayName=Wg.displayName;var Hk=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Gg,{ref:n,className:V(`text-sm text-muted-foreground`,e),...t}));Hk.displayName=Gg.displayName;function l_e({objectApiName:e,record:t,onSuccess:n,onCancel:r}){let i=_p(),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)({}),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null);(0,L.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,B.jsx)(Ik,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Rk,{className:`sm:max-w-lg`,children:[(0,B.jsxs)(zk,{children:[(0,B.jsx)(Vk,{children:`Loading...`}),(0,B.jsx)(Hk,{children:`Fetching object definition`})]}),(0,B.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,B.jsx)(Qp,{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,B.jsx)(Ik,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Rk,{className:`sm:max-w-lg max-h-[85vh] flex flex-col p-0 gap-0`,children:[(0,B.jsxs)(zk,{className:`px-6 pt-6 pb-4 border-b`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(Vk,{className:`text-lg`,children:[_?`Edit`:`New`,` `,a.label]}),(0,B.jsx)(yx,{variant:_?`secondary`:`default`,className:`text-xs`,children:_?`Editing`:`Creating`})]}),(0,B.jsx)(Hk,{children:_?`Update the fields below to modify this ${a.label.toLowerCase()}.`:`Fill in the fields below to create a new ${a.label.toLowerCase()}.`})]}),(0,B.jsxs)(`form`,{onSubmit:p,className:`flex-1 flex flex-col overflow-hidden`,children:[(0,B.jsx)($D,{className:`flex-1`,children:(0,B.jsxs)(`div`,{className:`p-6 space-y-5`,children:[d&&(0,B.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,B.jsx)(Ip,{className:`h-4 w-4 shrink-0`}),d]}),g.map(e=>{let t=h[e],n=t.label||e,r=t.required;return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Dk,{htmlFor:e,className:`text-sm font-medium`,children:n}),r&&(0,B.jsx)(`span`,{className:`text-xs text-destructive`,children:`*`}),(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] px-1 py-0 font-normal opacity-40 ml-auto`,children:t.type})]}),t.type===`boolean`?(0,B.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border p-3`,children:[(0,B.jsx)(Fk,{id:e,checked:!!s[e],onCheckedChange:t=>m(e,t)}),(0,B.jsx)(Dk,{htmlFor:e,className:`text-sm text-muted-foreground cursor-pointer`,children:s[e]?`Enabled`:`Disabled`})]}):t.type===`select`?(0,B.jsxs)(ek,{value:s[e]||``,onValueChange:t=>m(e,t),children:[(0,B.jsx)(nk,{id:e,children:(0,B.jsx)(tk,{placeholder:`Select an option...`})}),(0,B.jsx)(ak,{children:t.options?.map(e=>(0,B.jsx)(ok,{value:e.value,children:e.label},e.value))})]}):t.type===`textarea`?(0,B.jsx)(wk,{id:e,value:s[e]||``,onChange:t=>m(e,t.target.value),rows:3,required:r,placeholder:`Enter ${n.toLowerCase()}...`,className:`resize-none`}):(0,B.jsx)(vh,{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,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description})]},e)})]})}),(0,B.jsxs)(Bk,{className:`px-6 py-4 border-t bg-muted/30`,children:[(0,B.jsx)(_h,{variant:`outline`,onClick:r,type:`button`,className:`gap-1.5`,children:`Cancel`}),(0,B.jsx)(_h,{type:`submit`,disabled:l,className:`gap-1.5`,children:l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin`}),` Saving...`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Gee,{className:`h-4 w-4`}),` `,_?`Update`:`Create`]})})]})]})]})})}var Uk={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`},u_e={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 d_e({objectApiName:e}){let t=_p(),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,L.useState)(n[0]),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)([]),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(!1),y=a||r.path,b=(0,L.useCallback)(e=>{i(e),o(e.path),c(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),f(null)},[]),x=(0,L.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,L.useCallback)(()=>{d?.body&&(navigator.clipboard.writeText(d.body),v(!0),setTimeout(()=>v(!1),1500))},[d]),C=e=>u_e[String(e)[0]]??`text-muted-foreground`;return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[280px_1fr] gap-4 h-full`,children:[(0,B.jsxs)(`div`,{className:`space-y-3 lg:border-r lg:pr-4`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wider`,children:`Endpoints`}),(0,B.jsx)(`div`,{className:`space-y-1`,children:n.map((e,t)=>(0,B.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,B.jsx)(yx,{variant:`outline`,className:`font-mono text-[10px] shrink-0 ${Uk[e.method]}`,children:e.method}),(0,B.jsx)(`span`,{className:`truncate text-xs`,children:e.desc})]},t))}),(0,B.jsxs)(`div`,{className:`pt-3 border-t`,children:[(0,B.jsx)(`h4`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Query Parameters`}),(0,B.jsxs)(`div`,{className:`space-y-1 text-xs text-muted-foreground`,children:[(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$top=10`}),` — limit`]}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$skip=20`}),` — offset`]}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$sort=name`}),` — sort`]}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$select=name,email`}),` — fields`]}),(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`code`,{className:`text-foreground`,children:`?$count=true`}),` — total count`]})]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(yx,{variant:`outline`,className:`font-mono text-xs shrink-0 ${Uk[r.method]}`,children:r.method}),(0,B.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,B.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,B.jsx)(Qp,{className:`h-3.5 w-3.5 animate-spin`}):(0,B.jsx)(im,{className:`h-3.5 w-3.5`}),`Send`]})]}),[`POST`,`PATCH`].includes(r.method)&&(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,B.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,B.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col rounded-lg border overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-mono font-semibold ${C(d.status)}`,children:d.status||`ERR`}),(0,B.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,B.jsx)(zp,{className:`h-3 w-3`}),d.duration,`ms`]})]}),(0,B.jsxs)(`button`,{onClick:S,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[_?(0,B.jsx)(Np,{className:`h-3 w-3`}):(0,B.jsx)(Vp,{className:`h-3 w-3`}),_?`Copied`:`Copy`]})]}),(0,B.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,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,B.jsx)(qp,{className:`h-8 w-8 mx-auto opacity-30`}),(0,B.jsxs)(`p`,{children:[`Select an endpoint and click `,(0,B.jsx)(`strong`,{children:`Send`}),` to test`]})]})}),p.length>0&&(0,B.jsxs)(`div`,{className:`border-t pt-3 space-y-1`,children:[(0,B.jsx)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`History`}),(0,B.jsx)(`div`,{className:`space-y-1 max-h-48 overflow-auto`,children:p.map(e=>(0,B.jsxs)(`div`,{className:`rounded border`,children:[(0,B.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,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(yx,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${Uk[e.method]}`,children:e.method}),(0,B.jsx)(`span`,{className:`font-mono truncate`,children:e.url}),(0,B.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${C(e.status)}`,children:e.status}),(0,B.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]})]}),h===e.id&&(0,B.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 f_e({objectApiName:e}){let[t,n]=(0,L.useState)(`schema`),[r,i]=(0,L.useState)(null),[a,o]=(0,L.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,B.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 border-b px-4 bg-muted/30`,children:[[{id:`schema`,label:`Schema`,icon:Bp},{id:`data`,label:`Data`,icon:mm},{id:`api`,label:`API`,icon:qp}].map(e=>{let r=e.icon;return(0,B.jsxs)(`button`,{onClick:()=>n(e.id),className:` - flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors border-b-2 - ${t===e.id?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-border`} - `,children:[(0,B.jsx)(r,{className:`h-3.5 w-3.5`}),e.label]},e.id)}),(0,B.jsx)(`div`,{className:`ml-auto flex items-center gap-2 py-2`,children:(0,B.jsxs)(yx,{variant:`outline`,className:`font-mono text-xs gap-1`,children:[(0,B.jsx)(Up,{className:`h-3 w-3`}),e]})})]}),(0,B.jsxs)(`div`,{className:`flex-1 overflow-auto p-4`,children:[t===`schema`&&(0,B.jsx)($ge,{objectApiName:e}),t===`data`&&(0,B.jsx)(Yge,{objectApiName:e,onEdit:s}),t===`api`&&(0,B.jsx)(d_e,{objectApiName:e})]}),a&&(0,B.jsx)(l_e,{objectApiName:e,record:r&&Object.keys(r).length>0?r:void 0,onSuccess:c,onCancel:()=>{o(!1),i(null)}})]})}function p_e({metadataName:e}){return(0,B.jsx)(f_e,{objectApiName:e})}var m_e={manifest:_k({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`],label:`Object Explorer`,priority:100,modes:[`preview`,`data`,`code`]}],sidebarGroups:[{key:`data`,label:`Data`,icon:`database`,metadataTypes:[`object`,`hook`,`mapping`,`analyticsCube`,`data`],order:10}],metadataIcons:[{metadataType:`object`,label:`Objects`,icon:`package`},{metadataType:`hook`,label:`Hooks`,icon:`anchor`},{metadataType:`mapping`,label:`Mappings`,icon:`map`},{metadataType:`analyticsCube`,label:`Analytics Cubes`,icon:`pie-chart`},{metadataType:`data`,label:`Seed Data`,icon:`database`}]}}),activate(e){e.registerViewer(`object-explorer`,p_e),e.registerMetadataIcon(`object`,nm,`Objects`),e.registerMetadataIcon(`hook`,Dp,`Hooks`),e.registerMetadataIcon(`mapping`,em,`Mappings`),e.registerMetadataIcon(`analyticsCube`,Oee,`Analytics Cubes`),e.registerMetadataIcon(`data`,Up,`Seed Data`)}};function Wk(e){return typeof e==`string`?e:e&&typeof e==`object`&&`defaultValue`in e?String(e.defaultValue):e&&typeof e==`object`&&`key`in e?String(e.key):``}var h_e={actions:Sm,dashboards:Mp,reports:Kp,flows:ym,agent:jp,agents:jp,tool:bm,tools:bm,apis:qp,ragPipeline:Ap,ragPipelines:Ap,profiles:um,sharingRules:um},g_e={actions:`Action`,dashboards:`Dashboard`,reports:`Report`,flows:`Flow`,agent:`Agent`,agents:`Agent`,tool:`Tool`,tools:`Tool`,apis:`API`,ragPipeline:`RAG Pipeline`,ragPipelines:`RAG Pipeline`,profiles:`Profile`,sharingRules:`Sharing Rule`};function Gk({text:e}){let[t,n]=(0,L.useState)(!1);return(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,B.jsx)(Np,{className:`h-3 w-3 text-emerald-500`}):(0,B.jsx)(Vp,{className:`h-3 w-3`})})}),(0,B.jsx)(Kv,{children:`Copy`})]})})}function Kk({data:e,depth:t=0}){let[n,r]=(0,L.useState)({});if(e==null)return(0,B.jsx)(`span`,{className:`text-muted-foreground italic`,children:`null`});if(typeof e==`boolean`)return(0,B.jsx)(yx,{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,B.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,B.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-400 font-mono text-sm break-all`,children:[`"`,e.slice(0,120),`…"`]}):(0,B.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,B.jsx)(`span`,{className:`text-muted-foreground font-mono text-sm`,children:`[]`}):e.length<=5&&e.every(e=>typeof e!=`object`)?(0,B.jsxs)(`span`,{className:`font-mono text-sm`,children:[`[`,e.map((e,n)=>(0,B.jsxs)(`span`,{children:[n>0&&`, `,(0,B.jsx)(Kk,{data:e,depth:t+1})]},n)),`]`]}):(0,B.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,B.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[`Array(`,e.length,`)`]}),(0,B.jsx)(`div`,{className:`ml-4 border-l pl-3 space-y-0.5`,children:e.map((e,n)=>(0,B.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,B.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs shrink-0 mt-0.5`,children:[`[`,n,`]`]}),(0,B.jsx)(Kk,{data:e,depth:t+1})]},n))})]});if(typeof e==`object`){let i=Object.keys(e);return i.length===0?(0,B.jsx)(`span`,{className:`text-muted-foreground font-mono text-sm`,children:`{}`}):(0,B.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,B.jsx)(`div`,{children:(0,B.jsxs)(`div`,{className:`flex items-start gap-1 group`,children:[o?(0,B.jsx)(`button`,{onClick:()=>r(e=>({...e,[i]:!s})),className:`shrink-0 mt-0.5 p-0.5 rounded hover:bg-muted`,children:s?(0,B.jsx)(Fp,{className:`h-3 w-3 text-muted-foreground`}):(0,B.jsx)(Pp,{className:`h-3 w-3 text-muted-foreground`})}):(0,B.jsx)(`span`,{className:`w-4 shrink-0`}),(0,B.jsxs)(`span`,{className:`text-blue-600 dark:text-blue-400 font-mono text-sm shrink-0`,children:[i,`:`]}),o&&s?(0,B.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:Array.isArray(a)?`Array(${a.length})`:`{${Object.keys(a).length} keys}`}):(0,B.jsx)(`div`,{className:`min-w-0`,children:(0,B.jsx)(Kk,{data:a,depth:t+1})})]})},i)})})}return(0,B.jsx)(`span`,{className:`font-mono text-sm`,children:String(e)})}function __e({metaType:e,metaName:t,packageId:n}){let r=_p(),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(!0),[c,l]=(0,L.useState)(``),u=h_e[e]||Kp,d=g_e[e]||e.charAt(0).toUpperCase()+e.slice(1);if((0,L.useEffect)(()=>{let i=!0;s(!0),a(null);async function o(){try{let o=await r.meta.getItem(e,t,n?{packageId:n}:void 0);i&&a(o?.item||o)}catch(n){console.error(`[MetadataInspector] Failed to load ${e}/${t}:`,n)}finally{i&&s(!1)}}return o(),()=>{i=!1}},[r,e,t,n]),o)return(0,B.jsx)(`div`,{className:`space-y-4 p-4`,children:(0,B.jsxs)(Sx,{children:[(0,B.jsx)(Cx,{children:(0,B.jsx)(Yg,{className:`h-6 w-48`})}),(0,B.jsxs)(Ex,{className:`space-y-3`,children:[(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`}),(0,B.jsx)(Yg,{className:`h-10 w-full`})]})]})});if(!i)return(0,B.jsx)(`div`,{className:`p-4`,children:(0,B.jsx)(Sx,{children:(0,B.jsxs)(Ex,{className:`py-12 text-center text-muted-foreground`,children:[d,` definition not found: `,(0,B.jsx)(`code`,{className:`font-mono`,children:t})]})})});let f=Wk(i.label)||i.name||t,p=i.name||t,m=Wk(i.description),[h]=p.includes(`__`)?p.split(`__`):[null],g=Object.keys(i),_=c?g.filter(e=>e.toLowerCase().includes(c.toLowerCase())||JSON.stringify(i[e]).toLowerCase().includes(c.toLowerCase())):g;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(Sx,{children:(0,B.jsx)(Cx,{className:`pb-3`,children:(0,B.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(u,{className:`h-5 w-5 text-muted-foreground`}),(0,B.jsx)(wx,{className:`text-xl`,children:f}),h&&(0,B.jsx)(yx,{variant:`secondary`,className:`font-mono text-xs`,children:h}),(0,B.jsx)(yx,{variant:`outline`,className:`text-xs`,children:d})]}),(0,B.jsxs)(Tx,{className:`flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:p}),(0,B.jsx)(Gk,{text:p}),m&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:`·`}),(0,B.jsx)(`span`,{className:`text-xs`,children:m})]})]})]})})})}),(0,B.jsxs)(Sx,{children:[(0,B.jsxs)(Cx,{className:`pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(wx,{className:`text-base`,children:`Properties`}),(0,B.jsxs)(yx,{variant:`secondary`,className:`text-xs`,children:[_.length,` / `,g.length,` keys`]})]}),(0,B.jsxs)(`div`,{className:`relative mt-2`,children:[(0,B.jsx)(sm,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(vh,{placeholder:`Filter properties...`,value:c,onChange:e=>l(e.target.value),className:`pl-9 h-8 text-sm`})]})]}),(0,B.jsx)(Ex,{children:(0,B.jsx)($D,{className:`max-h-[60vh]`,children:(0,B.jsxs)(`div`,{className:`space-y-3`,children:[_.map(e=>(0,B.jsxs)(`div`,{className:`group rounded-md border p-3 hover:bg-muted/30 transition-colors`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,B.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400 font-mono text-sm font-medium`,children:e}),(0,B.jsx)(Gk,{text:JSON.stringify(i[e],null,2)}),(0,B.jsx)(yx,{variant:`outline`,className:`text-[10px] font-mono ml-auto`,children:Array.isArray(i[e])?`array(${i[e].length})`:typeof i[e]})]}),(0,B.jsx)(`div`,{className:`pl-1`,children:(0,B.jsx)(Kk,{data:i[e]})})]},e)),_.length===0&&(0,B.jsx)(`p`,{className:`text-sm text-center text-muted-foreground py-8`,children:c?`No properties match filter`:`No properties`})]})})})]})]})}var qk=`Tabs`,[v_e,y_e]=xh(qk,[ky]),Jk=ky(),[b_e,Yk]=v_e(qk),Xk=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=wy(s),[d,f]=wh({prop:r,onChange:i,defaultProp:a??``,caller:qk});return(0,B.jsx)(b_e,{scope:n,baseId:Ch(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,B.jsx)(Eh.div,{dir:u,"data-orientation":o,...l,ref:t})})});Xk.displayName=qk;var Zk=`TabsList`,Qk=L.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Yk(Zk,n),o=Jk(n);return(0,B.jsx)(Py,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,B.jsx)(Eh.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Qk.displayName=Zk;var $k=`TabsTrigger`,eA=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Yk($k,n),s=Jk(n),c=rA(o.baseId,r),l=iA(o.baseId,r),u=r===o.value;return(0,B.jsx)(Fy,{asChild:!0,...s,focusable:!i,active:u,children:(0,B.jsx)(Eh.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:H(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:H(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:H(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});eA.displayName=$k;var tA=`TabsContent`,nA=L.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Yk(tA,n),c=rA(s.baseId,r),l=iA(s.baseId,r),u=r===s.value,d=L.useRef(u);return L.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,B.jsx)(Ih,{present:i||u,children:({present:n})=>(0,B.jsx)(Eh.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});nA.displayName=tA;function rA(e,t){return`${e}-trigger-${t}`}function iA(e,t){return`${e}-content-${t}`}var x_e=Xk,aA=Qk,oA=eA,sA=nA,S_e=x_e,cA=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(aA,{ref:n,className:V(`inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground`,e),...t}));cA.displayName=aA.displayName;var lA=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(oA,{ref:n,className:V(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow`,e),...t}));lA.displayName=oA.displayName;var C_e=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(sA,{ref:n,className:V(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,e),...t}));C_e.displayName=sA.displayName;var uA={object:{label:`Object`,icon:Up},view:{label:`View`,icon:Vee},flow:{label:`Flow`,icon:ym},agent:{label:`Agent`,icon:jp},tool:{label:`Tool`,icon:bm},app:{label:`App`,icon:Op}};function dA(e,t){let n=` `.repeat(t);return e.split(` -`).map(e=>e.trim()?n+e:e).join(` -`)}function fA(e,t=0){if(e==null)return`undefined`;if(typeof e==`string`)return`'${e.replace(/'/g,`\\'`)}'`;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(Array.isArray(e)){if(e.length===0)return`[]`;let n=e.map(e=>fA(e,t+1));return n.join(`, `).length<60?`[${n.join(`, `)}]`:`[\n${n.map(e=>dA(e,t+1)).join(`, -`)}\n${dA(`]`,t)}`}if(typeof e==`object`){let n=Object.entries(e);if(n.length===0)return`{}`;let r=n.map(([e,n])=>`${dA(`${e}: ${fA(n,t+1)}`,t+1)}`);return r.join(`, `).length<60&&!r.some(e=>e.includes(` -`))?`{ ${n.map(([e,n])=>`${e}: ${fA(n,t+1)}`).join(`, `)} }`:`{\n${r.join(`, -`)}\n${dA(`}`,t)}`}return String(e)}function w_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` objects: {`,` ${t||e.name||`my_object`}: ${fA(e,2)},`,` },`,`});`].join(` -`)}function T_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` views: {`,` ${t||e.name||`my_view`}: ${fA(e,2)},`,` },`,`});`].join(` -`)}function E_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` flows: {`,` ${t||e.name||`my_flow`}: ${fA(e,2)},`,` },`,`});`].join(` -`)}function D_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` agents: {`,` ${t||e.name||`my_agent`}: ${fA(e,2)},`,` },`,`});`].join(` -`)}function O_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` apps: {`,` ${t||e.name||`my_app`}: ${fA(e,2)},`,` },`,`});`].join(` -`)}function k_e(e,t){return[`import { defineStack } from '@objectstack/spec';`,``,`export default defineStack({`,` tools: {`,` ${t||e.name||`my_tool`}: ${fA(e,2)},`,` },`,`});`].join(` -`)}var A_e={object:w_e,view:T_e,flow:E_e,agent:D_e,tool:k_e,app:O_e};function j_e({type:e,definition:t,name:n}){let[r,i]=(0,L.useState)(`typescript`),[a,o]=(0,L.useState)(!1),s=(0,L.useMemo)(()=>{let r=A_e[e];return r?r(t,n):`// Unknown export type`},[e,t,n]),c=(0,L.useMemo)(()=>JSON.stringify(t,null,2),[t]),l=r===`typescript`?s:c,u=(0,L.useCallback)(()=>{navigator.clipboard.writeText(l),o(!0),setTimeout(()=>o(!1),1500)},[l]),d=uA[e]?.icon??Bp;return(0,B.jsxs)(Sx,{children:[(0,B.jsx)(Cx,{className:`pb-3`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(wx,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(Bp,{className:`h-4 w-4`}),`Export as Code`]}),(0,B.jsxs)(Tx,{className:`flex items-center gap-1.5`,children:[(0,B.jsxs)(yx,{variant:`outline`,className:`text-[10px] gap-1`,children:[(0,B.jsx)(d,{className:`h-3 w-3`}),uA[e]?.label??e]}),n&&(0,B.jsx)(`code`,{className:`text-xs font-mono bg-muted px-1 py-0.5 rounded`,children:n})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(S_e,{value:r,onValueChange:e=>i(e),children:(0,B.jsxs)(cA,{className:`h-7`,children:[(0,B.jsx)(lA,{value:`typescript`,className:`text-xs px-2 py-0.5`,children:`TypeScript`}),(0,B.jsx)(lA,{value:`json`,className:`text-xs px-2 py-0.5`,children:`JSON`})]})}),(0,B.jsxs)(_h,{variant:`outline`,size:`sm`,onClick:u,className:`h-7 gap-1 text-xs`,children:[a?(0,B.jsx)(Np,{className:`h-3 w-3`}):(0,B.jsx)(Vp,{className:`h-3 w-3`}),a?`Copied!`:`Copy to Clipboard`]})]})]})}),(0,B.jsx)(Ex,{className:`p-0`,children:(0,B.jsx)(`pre`,{className:`overflow-auto p-4 text-xs font-mono bg-muted/30 rounded-b-lg whitespace-pre max-h-[60vh]`,children:(0,B.jsx)(`code`,{children:l})})})]})}var M_e={object:`object`,view:`view`,flow:`flow`,agent:`agent`,tool:`tool`,app:`app`};function N_e({metadataType:e,metadataName:t,packageId:n}){return(0,B.jsx)(__e,{metaType:e,metaName:t,packageId:n})}function P_e({metadataType:e,metadataName:t,data:n,packageId:r}){let i=_p(),[a,o]=(0,L.useState)(n??null),[s,c]=(0,L.useState)(!n);return(0,L.useEffect)(()=>{if(n){o(n),c(!1);return}let a=!0;c(!0);async function s(){try{let n=await i.meta.getItem(e,t,r?{packageId:r}:void 0);a&&o(n?.item||n)}catch(n){console.error(`[CodeViewer] Failed to load ${e}/${t}:`,n)}finally{a&&c(!1)}}return s(),()=>{a=!1}},[i,e,t,n,r]),s?(0,B.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading definition…`}):a?(0,B.jsx)(`div`,{className:`p-4`,children:(0,B.jsx)(j_e,{type:M_e[e]??`object`,definition:a,name:t})}):(0,B.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[`Definition not found: `,(0,B.jsx)(`code`,{className:`font-mono`,children:t})]})}var F_e={manifest:_k({id:`objectstack.default-inspector`,name:`Default Metadata Inspector`,version:`1.0.0`,description:`JSON tree viewer and code exporter for any metadata type. Fallback when no specialized viewer is available.`,contributes:{metadataViewers:[{id:`json-inspector`,metadataTypes:[`*`],label:`JSON Inspector`,priority:-1,modes:[`preview`]},{id:`code-exporter`,metadataTypes:[`*`],label:`Code Export`,priority:-1,modes:[`code`]}]}}),activate(e){e.registerViewer(`json-inspector`,N_e),e.registerViewer(`code-exporter`,P_e)}},pA=e=>`objectstack:agent-playground:${e}`;function I_e(e){return(e.parts??[]).filter(e=>e.type===`text`).map(e=>e.text).join(``)}function L_e(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function R_e(e){if(!e||typeof e!=`object`)return``;let t=Object.entries(e);return t.length===0?``:t.slice(0,4).map(([e,t])=>{let n;try{n=typeof t==`string`?t:JSON.stringify(t)??String(t)}catch{n=String(t)}return`${e}: ${n.length>30?n.slice(0,30)+`…`:n}`}).join(`, `)}function z_e(e){return e.type===`dynamic-tool`}function B_e(e,t=80){let n;try{n=typeof e==`string`?e:JSON.stringify(e)??``}catch{n=String(e??``)}return n.length>t?n.slice(0,t)+`…`:n}function V_e({reasoning:e}){let[t,n]=(0,L.useState)(!1);return e.length===0?null:(0,B.jsxs)(`div`,{"data-testid":`reasoning-display`,className:`flex flex-col gap-1 rounded-md border border-border/30 bg-muted/30 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1.5 text-left text-muted-foreground hover:text-foreground transition-colors`,children:[t?(0,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(Tee,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(`span`,{className:`font-medium`,children:`Thinking`}),(0,B.jsxs)(`span`,{className:`text-[10px] opacity-60`,children:[`(`,e.length,` step`,e.length===1?``:`s`,`)`]})]}),t&&(0,B.jsx)(`div`,{className:`mt-1 space-y-1 pl-5 text-muted-foreground italic border-l-2 border-border/30`,children:e.map((e,t)=>(0,B.jsx)(`p`,{className:`text-[11px] leading-relaxed`,children:e},t))})]})}function H_e({activeSteps:e,completedSteps:t}){if(e.size===0)return null;let n=t.length+e.size,r=t.length+1;return(0,B.jsxs)(`div`,{"data-testid":`step-progress`,className:`flex flex-col gap-1.5 rounded-md border border-blue-500/30 bg-blue-500/5 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Sm,{className:`h-3 w-3 shrink-0 text-blue-600 dark:text-blue-400`}),(0,B.jsxs)(`span`,{className:`font-medium text-blue-700 dark:text-blue-300`,children:[`Step `,r,` of `,n]})]}),Array.from(e.values()).map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 pl-5`,children:[(0,B.jsx)(Qp,{className:`h-3 w-3 shrink-0 animate-spin text-blue-600 dark:text-blue-400`}),(0,B.jsx)(`span`,{className:`text-blue-700 dark:text-blue-300`,children:e.stepName})]},t))]})}function U_e({part:e,onApprove:t,onDeny:n}){let r=L_e(e.toolName),i=R_e(e.input);switch(e.state){case`input-streaming`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-blue-500/40 bg-blue-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Qp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-blue-600 dark:text-blue-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium text-blue-700 dark:text-blue-300`,children:[`Planning to call `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-blue-600/80 dark:text-blue-300/80`,children:i})]})]});case`input-available`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Qp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-primary`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Calling `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-muted-foreground`,children:i})]})]});case`approval-requested`:return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(lm,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-yellow-600 dark:text-yellow-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Confirm: `,r]}),i&&(0,B.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:i})]})]}),e.approval&&t&&n&&(0,B.jsxs)(`div`,{className:`flex gap-2 pl-5`,children:[(0,B.jsxs)(_h,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>t(e.approval.id),children:[(0,B.jsx)(Lp,{className:`mr-1 h-3 w-3`}),`Approve`]}),(0,B.jsxs)(_h,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs text-destructive hover:text-destructive`,onClick:()=>n(e.approval.id),children:[(0,B.jsx)(Rp,{className:`mr-1 h-3 w-3`}),`Deny`]})]})]});case`output-available`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-green-500/30 bg-green-500/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Lp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:r}),(0,B.jsx)(`p`,{className:`mt-0.5 text-muted-foreground truncate`,children:B_e(e.output)})]})]});case`output-error`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Rp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[r,` failed`]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-destructive/80`,children:e.errorText})]})]});case`output-denied`:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(Rp,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,B.jsxs)(`span`,{className:`font-medium text-muted-foreground`,children:[r,` — denied`]})]});default:return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border/50 bg-muted/50 px-2.5 py-2 text-xs`,children:[(0,B.jsx)(bm,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`font-medium`,children:r})]})}}function W_e({metadataType:e,metadataName:t,data:n,packageId:r}){let i=_p(),[a,o]=(0,L.useState)(n??null),[s,c]=(0,L.useState)(!n),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)({reasoning:[],activeSteps:new Map,completedSteps:[]}),[p,m]=(0,L.useState)(!1),h=(0,L.useRef)(null),g=(0,L.useRef)(null),_=xx();(0,L.useEffect)(()=>{if(n){o(n),c(!1);return}let a=!0;c(!0);async function s(){try{let n=await i.meta.getItem(e,t,r?{packageId:r}:void 0);a&&o(n?.item||n)}catch(e){console.error(`[AgentPlayground] Failed to load agent ${t}:`,e)}finally{a&&c(!1)}}return s(),()=>{a=!1}},[i,e,t,n,r]);let v=(0,L.useCallback)(()=>{try{let e=pA(t),n=localStorage.getItem(e);return n?JSON.parse(n):[]}catch{return[]}},[t]),y=(0,L.useCallback)(e=>{try{let n=pA(t);localStorage.setItem(n,JSON.stringify(e))}catch{}},[t]),b=(0,L.useMemo)(()=>v(),[v]),{messages:x,sendMessage:S,setMessages:C,status:w,error:T,addToolApprovalResponse:E}=ED({transport:(0,L.useMemo)(()=>new uD({api:`${_}/api/v1/ai/agents/${t}/chat`}),[_,t]),messages:b,onFinish:()=>{f({reasoning:[],activeSteps:new Map,completedSteps:[]})}}),D=w===`streaming`||w===`submitted`;(0,L.useEffect)(()=>{if(!D||x.length===0)return;let e=x[x.length-1];if(e.role!==`assistant`)return;let t=[],n=new Map,r=[];(e.parts||[]).forEach(e=>{e.type===`reasoning-delta`||e.type===`reasoning`?t.push(e.text):e.type===`step-start`?n.set(e.stepId,{stepName:e.stepName,startedAt:Date.now()}):e.type===`step-finish`&&r.push(e.stepName)}),f({reasoning:t,activeSteps:n,completedSteps:r})},[x,D]),(0,L.useEffect)(()=>{x.length>0&&y(x)},[x,y]),(0,L.useEffect)(()=>{h.current&&(h.current.scrollTop=h.current.scrollHeight)},[x]);let O=()=>{C([]),y([])},ee=()=>{let e=new Blob([JSON.stringify(x,null,2)],{type:`application/json`}),n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`agent-${t}-conversation-${Date.now()}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},te=()=>{let e=l.trim();!e||D||(u(``),S({text:e}))};return s?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin`}),(0,B.jsx)(`span`,{children:`Loading agent...`})]})}):a?(0,B.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b bg-background`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(jp,{className:`h-5 w-5 text-primary`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold`,children:a.label}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a.role})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>m(!p),children:(0,B.jsx)(Pp,{className:V(`h-4 w-4 transition-transform`,p&&`rotate-180`)})})}),(0,B.jsx)(Kv,{children:(0,B.jsxs)(`p`,{children:[p?`Hide`:`Show`,` metadata`]})})]})}),(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:ee,disabled:x.length===0,children:(0,B.jsx)(Nee,{className:`h-4 w-4`})})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Download conversation`})})]})}),(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:O,children:(0,B.jsx)(gm,{className:`h-4 w-4`})})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Clear history`})})]})})]})]}),p&&(0,B.jsx)(`div`,{className:`px-4 pb-3 border-t`,children:(0,B.jsxs)(`div`,{className:`mt-3 text-xs space-y-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Instructions:`}),(0,B.jsx)(`p`,{className:`mt-1 text-foreground whitespace-pre-wrap`,children:a.instructions})]}),a.model&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Model:`}),(0,B.jsx)(`span`,{className:`ml-2 font-mono`,children:a.model.model})]}),a.skills&&a.skills.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Skills:`}),(0,B.jsx)(`span`,{className:`ml-2`,children:a.skills.join(`, `)})]}),a.tools&&a.tools.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Tools:`}),(0,B.jsx)(`span`,{className:`ml-2`,children:a.tools.map(e=>e.name).join(`, `)})]})]})})]}),(0,B.jsx)($D,{className:`flex-1`,children:(0,B.jsxs)(`div`,{ref:h,className:`flex flex-col gap-3 p-4 overflow-y-auto h-full`,children:[x.length===0&&(0,B.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-12 text-center text-muted-foreground`,children:[(0,B.jsx)(dm,{className:`h-8 w-8 opacity-40`}),(0,B.jsxs)(`p`,{className:`text-sm`,children:[`Start testing `,a.label]}),(0,B.jsx)(`p`,{className:`text-xs opacity-60`,children:`Send a message to begin the conversation`})]}),x.map(e=>{let t=I_e(e),n=(e.parts??[]).filter(z_e);return!(t||n.length>0)&&e.role!==`user`?null:(0,B.jsxs)(`div`,{className:V(`flex flex-col gap-1.5 rounded-lg px-3 py-2 text-sm`,e.role===`user`?`ml-8 bg-primary text-primary-foreground`:`mr-8 bg-muted text-foreground`),children:[(0,B.jsx)(`span`,{className:`text-[10px] font-medium opacity-60 uppercase`,children:e.role===`user`?`You`:`Assistant`}),t&&(0,B.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:t}),n.map(e=>(0,B.jsx)(U_e,{part:e,onApprove:e=>E({id:e,approved:!0}),onDeny:e=>E({id:e,approved:!1,reason:`User denied the operation`})},e.toolCallId))]},e.id)}),D&&(0,B.jsxs)(B.Fragment,{children:[d.reasoning.length>0&&(0,B.jsx)(`div`,{className:`mr-8`,children:(0,B.jsx)(V_e,{reasoning:d.reasoning})}),d.activeSteps.size>0&&(0,B.jsx)(`div`,{className:`mr-8`,children:(0,B.jsx)(H_e,{activeSteps:d.activeSteps,completedSteps:d.completedSteps})}),d.reasoning.length===0&&d.activeSteps.size===0&&(0,B.jsxs)(`div`,{className:`mr-8 flex items-center gap-2 rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`inline-block h-2 w-2 animate-pulse rounded-full bg-primary`}),`Thinking…`]})]}),T&&(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,B.jsx)(lm,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`font-medium`,children:`Error`}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs opacity-80`,children:T.message||`Something went wrong`})]})]})]})}),(0,B.jsx)(`div`,{className:`shrink-0 border-t p-4`,children:(0,B.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,B.jsx)(`textarea`,{ref:g,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),te())},placeholder:`Type your message...`,rows:1,className:V(`flex-1 resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`max-h-32 min-h-[36px]`)}),(0,B.jsx)(_h,{type:`button`,size:`icon`,className:`h-9 w-9 shrink-0`,disabled:!l.trim()||D,onClick:te,children:(0,B.jsx)(cm,{className:`h-4 w-4`})})]})})]}):(0,B.jsxs)(`div`,{className:`p-8 text-center text-muted-foreground`,children:[(0,B.jsx)(jp,{className:`h-12 w-12 mx-auto mb-4 opacity-40`}),(0,B.jsxs)(`p`,{className:`text-sm`,children:[`Agent not found: `,(0,B.jsx)(`code`,{className:`font-mono`,children:t})]})]})}var G_e={manifest:_k({id:`objectstack.agent-playground`,name:`Agent Playground`,version:`1.0.0`,description:`Interactive testing environment for AI agents with embedded chat interface.`,contributes:{metadataViewers:[{id:`agent-playground`,metadataTypes:[`agent`],label:`Playground`,priority:10,modes:[`preview`]}]}}),activate(e){e.registerViewer(`agent-playground`,W_e)}},mA=`Checkbox`,[K_e,q_e]=xh(mA),[J_e,hA]=K_e(mA);function Y_e(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=wh({prop:n,defaultProp:i??!1,onChange:c,caller:mA}),[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useRef(!1),y=m?!!o||!!m.closest(`form`):!0,b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:CA(i)?!1:i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,B.jsx)(J_e,{scope:t,...b,children:X_e(d)?d(b):r})}var gA=`CheckboxTrigger`,_A=L.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=hA(gA,e),h=Tm(i,u),g=L.useRef(c);return L.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,B.jsx)(Eh.button,{type:`button`,role:`checkbox`,"aria-checked":CA(c)?`mixed`:c,"aria-required":l,"data-state":wA(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:H(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:H(n,e=>{d(e=>CA(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});_A.displayName=gA;var vA=L.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,B.jsx)(Y_e,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_A,{...d,ref:t,__scopeCheckbox:n}),e&&(0,B.jsx)(SA,{__scopeCheckbox:n})]})})});vA.displayName=mA;var yA=`CheckboxIndicator`,bA=L.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=hA(yA,n);return(0,B.jsx)(Ih,{present:r||CA(a.checked)||a.checked===!0,children:(0,B.jsx)(Eh.span,{"data-state":wA(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});bA.displayName=yA;var xA=`CheckboxBubbleInput`,SA=L.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=hA(xA,e),m=Tm(n,p),h=tO(a),g=sv(r);L.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=CA(a),n.call(e,CA(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=L.useRef(CA(a)?!1:a);return(0,B.jsx)(Eh.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});SA.displayName=xA;function X_e(e){return typeof e==`function`}function CA(e){return e===`indeterminate`}function wA(e){return CA(e)?`indeterminate`:e?`checked`:`unchecked`}var TA=L.forwardRef(({className:e,...t},n)=>(0,B.jsx)(vA,{ref:n,className:V(`peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,B.jsx)(bA,{className:V(`flex items-center justify-center text-current`),children:(0,B.jsx)(Np,{className:`h-3.5 w-3.5`})})}));TA.displayName=vA.displayName;var EA=e=>`objectstack:tool-playground:${e}`;function Z_e(e){return{properties:e.properties||{},required:e.required||[]}}function Q_e({name:e,property:t,value:n,onChange:r,required:i}){let{type:a,description:o,enum:s}=t,c=e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return s&&s.length>0?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsxs)(ek,{value:n||``,onValueChange:r,children:[(0,B.jsx)(nk,{id:e,children:(0,B.jsx)(tk,{placeholder:`Select ${c}`})}),(0,B.jsx)(ak,{children:s.map(e=>(0,B.jsx)(ok,{value:String(e),children:String(e)},String(e)))})]})]}):a===`boolean`?(0,B.jsxs)(`div`,{className:`flex items-start space-x-2`,children:[(0,B.jsx)(TA,{id:e,checked:!!n,onCheckedChange:e=>r(e)}),(0,B.jsxs)(`div`,{className:`grid gap-1.5 leading-none`,children:[(0,B.jsxs)(Dk,{htmlFor:e,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o})]})]}):a===`number`||a===`integer`?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(vh,{id:e,type:`number`,value:n??``,onChange:e=>{let t=e.target.value;r(t===``?void 0:a===`integer`?parseInt(t,10):parseFloat(t))},placeholder:`Enter ${c}`})]}):a===`array`?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(wk,{id:e,value:n?JSON.stringify(n,null,2):``,onChange:e=>{try{r(JSON.parse(e.target.value))}catch{}},placeholder:`Enter JSON array`,rows:3,className:`font-mono text-xs`})]}):a===`object`?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(wk,{id:e,value:n?JSON.stringify(n,null,2):``,onChange:e=>{try{r(JSON.parse(e.target.value))}catch{}},placeholder:`Enter JSON object`,rows:4,className:`font-mono text-xs`})]}):(o?.length||0)>100?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(wk,{id:e,value:n||``,onChange:e=>r(e.target.value),placeholder:`Enter ${c}`,rows:3})]}):(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(Dk,{htmlFor:e,children:[c,i&&(0,B.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),(0,B.jsx)(vh,{id:e,type:`text`,value:n||``,onChange:e=>r(e.target.value),placeholder:`Enter ${c}`})]})}function $_e({entry:e}){let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(!1),a=e=>{navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),2e3)};return(0,B.jsxs)(`div`,{className:`border rounded-md overflow-hidden`,children:[(0,B.jsxs)(`button`,{onClick:()=>n(!t),className:`w-full flex items-center justify-between px-3 py-2 bg-muted/50 hover:bg-muted transition-colors text-left`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[t?(0,B.jsx)(Pp,{className:`h-3 w-3 shrink-0`}):(0,B.jsx)(Fp,{className:`h-3 w-3 shrink-0`}),e.status===`success`?(0,B.jsx)(Lp,{className:`h-3 w-3 shrink-0 text-green-600 dark:text-green-400`}):(0,B.jsx)(Rp,{className:`h-3 w-3 shrink-0 text-destructive`}),(0,B.jsx)(zp,{className:`h-3 w-3 shrink-0 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.timestamp).toLocaleTimeString()}),e.duration&&(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.duration,`ms)`]})]}),(0,B.jsx)(`div`,{className:`flex items-center gap-1`,children:r?(0,B.jsx)(Np,{className:`h-3 w-3 text-green-600`}):(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),a(JSON.stringify(e.status===`success`?e.result:e.error,null,2))},className:`p-1 hover:bg-background rounded`,children:(0,B.jsx)(Vp,{className:`h-3 w-3`})})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Copy result`})})]})})})]}),t&&(0,B.jsxs)(`div`,{className:`px-3 py-2 border-t space-y-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Parameters:`}),(0,B.jsx)(`pre`,{className:`text-xs bg-background rounded p-2 overflow-auto max-h-32`,children:JSON.stringify(e.parameters,null,2)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:e.status===`success`?`Result:`:`Error:`}),(0,B.jsx)(`pre`,{className:V(`text-xs rounded p-2 overflow-auto max-h-48`,e.status===`success`?`bg-green-500/10 text-green-700 dark:text-green-300`:`bg-destructive/10 text-destructive`),children:e.status===`success`?JSON.stringify(e.result,null,2):e.error})]})]})]})}function eve({metadataType:e,metadataName:t,data:n,packageId:r}){let i=_p(),[a,o]=(0,L.useState)(n??null),[s,c]=(0,L.useState)(!n),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)({}),[p,m]=(0,L.useState)([]),h=(0,L.useRef)(null),g=xx();(0,L.useEffect)(()=>{if(n){o(n),c(!1);return}let a=!0;c(!0);async function s(){try{let n=await i.meta.getItem(e,t,r?{packageId:r}:void 0);a&&o(n?.item||n)}catch(e){console.error(`[ToolPlayground] Failed to load tool ${t}:`,e)}finally{a&&c(!1)}}return s(),()=>{a=!1}},[i,e,t,n,r]),(0,L.useEffect)(()=>{try{let e=EA(t),n=localStorage.getItem(e);n&&m(JSON.parse(n))}catch{}},[t]);let _=e=>{try{let n=EA(t),r=e.slice(-50);localStorage.setItem(n,JSON.stringify(r)),m(r)}catch{}},v=()=>{try{let e=EA(t);localStorage.removeItem(e),m([])}catch{}},y=async()=>{if(!a||l)return;u(!0);let e=Date.now(),n=`exec-${Date.now()}`;try{let r=await fetch(`${g}/api/v1/ai/tools/${t}/execute`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({parameters:d})}),i=Date.now()-e;if(r.ok){let e=await r.json(),t={id:n,timestamp:Date.now(),parameters:{...d},status:`success`,result:e.result||e,duration:i};_([...p,t])}else{let e=await r.json().catch(()=>({error:r.statusText})),t={id:n,timestamp:Date.now(),parameters:{...d},status:`error`,error:e.error||`Tool execution failed`,duration:i};_([...p,t])}}catch(t){let r=Date.now()-e,i={id:n,timestamp:Date.now(),parameters:{...d},status:`error`,error:t instanceof Error?t.message:`Unknown error`,duration:r};_([...p,i])}finally{u(!1)}},b=()=>{f({})};if(s)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,B.jsx)(Qp,{className:`h-4 w-4 animate-spin`}),(0,B.jsx)(`span`,{children:`Loading tool...`})]})});if(!a)return(0,B.jsxs)(`div`,{className:`p-8 text-center text-muted-foreground`,children:[(0,B.jsx)(bm,{className:`h-12 w-12 mx-auto mb-4 opacity-40`}),(0,B.jsxs)(`p`,{className:`text-sm`,children:[`Tool not found: `,(0,B.jsx)(`code`,{className:`font-mono`,children:t})]})]});let{properties:x,required:S}=Z_e(a.parameters),C=Object.keys(x);return(0,B.jsxs)(`div`,{className:`grid grid-cols-2 h-full divide-x`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b bg-background px-4 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(bm,{className:`h-5 w-5 text-primary`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold`,children:a.label}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a.category||`Tool`})]})]}),a.description&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:a.description})]}),(0,B.jsx)($D,{className:`flex-1`,children:(0,B.jsx)(`div`,{className:`p-4 space-y-4`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Parameters`}),C.length===0?(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This tool has no parameters.`}):(0,B.jsx)(`div`,{className:`space-y-4`,children:C.map(e=>(0,B.jsx)(Q_e,{name:e,property:x[e],value:d[e],onChange:t=>f({...d,[e]:t}),required:S.includes(e)},e))})]})})}),(0,B.jsxs)(`div`,{className:`shrink-0 border-t p-4 flex gap-2`,children:[(0,B.jsx)(_h,{onClick:y,disabled:l,className:`flex-1`,children:l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qp,{className:`mr-2 h-4 w-4 animate-spin`}),`Executing...`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(im,{className:`mr-2 h-4 w-4`}),`Execute Tool`]})}),(0,B.jsx)(_h,{variant:`outline`,onClick:b,children:`Reset`})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b bg-background px-4 py-3 flex items-center justify-between`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium`,children:`Execution History`}),(0,B.jsx)(Uv,{children:(0,B.jsxs)(Wv,{children:[(0,B.jsx)(Gv,{asChild:!0,children:(0,B.jsx)(_h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:v,disabled:p.length===0,children:(0,B.jsx)(gm,{className:`h-4 w-4`})})}),(0,B.jsx)(Kv,{children:(0,B.jsx)(`p`,{children:`Clear history`})})]})})]}),(0,B.jsx)($D,{className:`flex-1`,children:(0,B.jsx)(`div`,{ref:h,className:`p-4 space-y-2`,children:p.length===0?(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center text-muted-foreground`,children:[(0,B.jsx)(zp,{className:`h-8 w-8 opacity-40 mb-2`}),(0,B.jsx)(`p`,{className:`text-sm`,children:`No executions yet`}),(0,B.jsx)(`p`,{className:`text-xs opacity-60`,children:`Execute the tool to see results here`})]}):p.slice().reverse().map(e=>(0,B.jsx)($_e,{entry:e},e.id))})})]})]})}var tve=[F_e,m_e,G_e,{manifest:_k({id:`objectstack.tool-playground`,name:`Tool Playground`,version:`1.0.0`,description:`Interactive testing environment for AI tools with auto-generated parameter forms.`,contributes:{metadataViewers:[{id:`tool-playground`,metadataTypes:[`tool`],label:`Playground`,priority:10,modes:[`preview`]}]}}),activate(e){e.registerViewer(`tool-playground`,eve)}},{manifest:_k({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:[`action`,`view`,`page`,`dashboard`,`report`,`theme`],order:20}],metadataIcons:[{metadataType:`action`,label:`Actions`,icon:`zap`},{metadataType:`view`,label:`Views`,icon:`eye`},{metadataType:`page`,label:`Pages`,icon:`file-code`},{metadataType:`dashboard`,label:`Dashboards`,icon:`bar-chart-3`},{metadataType:`report`,label:`Reports`,icon:`file-text`},{metadataType:`theme`,label:`Themes`,icon:`palette`}]}}),activate(e){e.registerMetadataIcon(`action`,Sm,`Actions`),e.registerMetadataIcon(`view`,Wp,`Views`),e.registerMetadataIcon(`page`,Gp,`Pages`),e.registerMetadataIcon(`dashboard`,Mp,`Dashboards`),e.registerMetadataIcon(`report`,Kp,`Reports`),e.registerMetadataIcon(`theme`,rm,`Themes`)}},{manifest:_k({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:[`flow`,`workflow`,`approval`,`webhook`],order:30}],metadataIcons:[{metadataType:`flow`,label:`Flows`,icon:`workflow`},{metadataType:`workflow`,label:`Workflows`,icon:`workflow`},{metadataType:`approval`,label:`Approvals`,icon:`check-square`},{metadataType:`webhook`,label:`Webhooks`,icon:`webhook`}]}}),activate(e){e.registerMetadataIcon(`flow`,ym,`Flows`),e.registerMetadataIcon(`workflow`,ym,`Workflows`),e.registerMetadataIcon(`approval`,fm,`Approvals`),e.registerMetadataIcon(`webhook`,vm,`Webhooks`)}},{manifest:_k({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:[`role`,`permission`,`profile`,`sharingRule`,`policy`],order:40}],metadataIcons:[{metadataType:`role`,label:`Roles`,icon:`user-cog`},{metadataType:`permission`,label:`Permissions`,icon:`lock`},{metadataType:`profile`,label:`Profiles`,icon:`shield`},{metadataType:`sharingRule`,label:`Sharing Rules`,icon:`shield`},{metadataType:`policy`,label:`Policies`,icon:`shield`}]}}),activate(e){e.registerMetadataIcon(`role`,_m,`Roles`),e.registerMetadataIcon(`permission`,$p,`Permissions`),e.registerMetadataIcon(`profile`,um,`Profiles`),e.registerMetadataIcon(`sharingRule`,um,`Sharing Rules`),e.registerMetadataIcon(`policy`,um,`Policies`)}},{manifest:_k({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:[`agent`,`tool`,`ragPipeline`],order:50}],metadataIcons:[{metadataType:`agent`,label:`Agents`,icon:`bot`},{metadataType:`tool`,label:`Tools`,icon:`wrench`},{metadataType:`ragPipeline`,label:`RAG Pipelines`,icon:`book-open`}]}}),activate(e){e.registerMetadataIcon(`agent`,jp,`Agents`),e.registerMetadataIcon(`tool`,bm,`Tools`),e.registerMetadataIcon(`ragPipeline`,Ap,`RAG Pipelines`)}},{manifest:_k({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:[`api`,`connector`],order:60}],metadataIcons:[{metadataType:`api`,label:`APIs`,icon:`globe`},{metadataType:`connector`,label:`Connectors`,icon:`link-2`}]}}),activate(e){e.registerMetadataIcon(`api`,qp,`APIs`),e.registerMetadataIcon(`connector`,Xp,`Connectors`)}}];function nve(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)([]),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(`overview`);(0,L.useEffect)(()=>{let e=xx();console.log(`[App] Connecting to API: ${e} (mode: ${bx.mode})`),t(new mp({baseUrl:e}))},[]),(0,L.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,L.useCallback)(e=>{a(e),s(null),l(null),d(`overview`)},[]),p=(0,L.useCallback)(e=>{e?(s(e),d(`object`)):(s(null),d(`overview`))},[]),m=(0,L.useCallback)(e=>{d(e),s(null),l(null)},[]),h=(0,L.useCallback)((e,t)=>{l({type:e,name:t}),s(null),d(`metadata`)},[]),g=(0,L.useCallback)((e,t)=>{e===`packages`?m(`packages`):t&&p(t)},[m,p]);return e?(0,B.jsx)(gp,{client:e,children:(0,B.jsx)(oge,{plugins:tve,children:(0,B.jsx)(Zee,{children:(0,B.jsxs)(Yv,{children:[(0,B.jsx)(Ese,{selectedObject:o,onSelectObject:p,selectedMeta:c,onSelectMeta:h,packages:n,selectedPackage:i,onSelectPackage:f,onSelectView:m,selectedView:u}),(0,B.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col h-svh overflow-hidden bg-background`,children:[(0,B.jsx)(Lse,{selectedObject:o,selectedMeta:c,selectedView:u,packageLabel:i?.manifest?.name||i?.manifest?.id}),(0,B.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:u===`object`&&o?(0,B.jsx)(gk,{metadataType:`object`,metadataName:o,packageId:i?.manifest?.id}):u===`metadata`&&c?(0,B.jsx)(gk,{metadataType:c.type,metadataName:c.name,packageId:i?.manifest?.id}):u===`packages`?(0,B.jsx)(Wse,{}):u===`api-console`?(0,B.jsx)(Qse,{}):(0,B.jsx)(Rse,{packages:n,selectedPackage:i,onNavigate:g})})]}),(0,B.jsx)(Gce,{}),(0,B.jsx)(nge,{})]})})})}):(0,B.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,B.jsx)(`div`,{className:`h-8 w-8 mx-auto animate-spin rounded-full border-4 border-muted border-t-primary`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connecting to ObjectStack…`})]})})}var rve=Object.defineProperty,DA=(e,t)=>{for(var n in t)rve(e,n,{get:t[n],enumerable:!0})};DA({},{AggregationFunctionEnum:()=>ive,AppNameSchema:()=>dve,BaseMetadataRecordSchema:()=>sve,CacheStrategyEnum:()=>ove,CorsConfigSchema:()=>IA,EventNameSchema:()=>AA,FieldMappingSchema:()=>MA,FieldNameSchema:()=>lve,FlowNameSchema:()=>fve,HttpMethod:()=>NA,HttpMethodSchema:()=>PA,HttpRequestSchema:()=>FA,IsolationLevelEnum:()=>VA,MAP_SUPPORTED_FIELDS:()=>uj,METADATA_ALIASES:()=>hj,MetadataFormatSchema:()=>HA,MutationEventEnum:()=>ave,ObjectNameSchema:()=>cve,PLURAL_TO_SINGULAR:()=>dj,RateLimitConfigSchema:()=>LA,RoleNameSchema:()=>pve,SINGULAR_TO_PLURAL:()=>fj,SnakeCaseIdentifierSchema:()=>kA,SortDirectionEnum:()=>zA,SortItemSchema:()=>BA,StaticMountSchema:()=>RA,SystemIdentifierSchema:()=>OA,TransformTypeSchema:()=>jA,ViewNameSchema:()=>uve,findClosestMatches:()=>ij,formatSuggestion:()=>oj,formatZodError:()=>lj,formatZodIssue:()=>cj,levenshteinDistance:()=>rj,normalizeMetadataCollection:()=>pj,normalizePluginMetadata:()=>gj,normalizeStackInput:()=>mj,objectStackErrorMap:()=>sj,pluralToSingular:()=>Sve,safeParsePretty:()=>xve,singularToPlural:()=>Cve,suggestFieldType:()=>aj});var OA=r().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)`),kA=r().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)`),AA=r().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)`),jA=I(`type`,[h({type:m(`constant`),value:u().describe(`Constant value to use`)}).describe(`Set a constant value`),h({type:m(`cast`),targetType:E([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),h({type:m(`lookup`),table:r().describe(`Lookup table name`),keyField:r().describe(`Field to match on`),valueField:r().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),h({type:m(`javascript`),expression:r().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),h({type:m(`map`),mappings:d(r(),u()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]),MA=h({source:r().describe(`Source field name`),target:r().describe(`Target field name`),transform:jA.optional().describe(`Transformation to apply`),defaultValue:u().optional().describe(`Default if source is null/undefined`)}),NA=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),PA=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),FA=h({url:r().describe(`API endpoint URL`),method:PA.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)}),IA=h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(NA).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),LA=h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),RA=h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)}),ive=E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`),zA=E([`asc`,`desc`]).describe(`Sort order direction`),BA=h({field:r().describe(`Field name to sort by`),order:zA.describe(`Sort direction`)}).describe(`Sort field and direction pair`),ave=E([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),VA=E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),ove=E([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`),HA=E([`yaml`,`json`,`typescript`,`javascript`]).describe(`Metadata file format`),sve=h({id:r().describe(`Unique metadata record identifier`),type:r().describe(`Metadata type (e.g. "object", "view", "flow")`),name:kA.describe(`Machine name (snake_case)`),format:HA.optional().describe(`Source file format`)}).describe(`Base metadata record fields shared across kernel and system`),cve=kA.brand().describe(`Branded object name (snake_case, no dots)`),lve=kA.brand().describe(`Branded field name (snake_case, no dots)`),uve=OA.brand().describe(`Branded view name (system identifier)`),dve=OA.brand().describe(`Branded app name (system identifier)`),fve=OA.brand().describe(`Branded flow name (system identifier)`),pve=OA.brand().describe(`Branded role name (system identifier)`),UA=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),WA=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),GA=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),KA=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:UA.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:WA.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:GA.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`),mve=h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:KA.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`),qA=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),JA=h({field:r().describe(`Field name to apply masking to`),strategy:qA.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`),hve=h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(JA).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`),YA=E(`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(`.`)),XA=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:OA.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)}),gve=h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)}),ZA=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}),_ve=h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),vve=h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)}),QA=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),$A=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),ej=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),tj=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),nj=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:YA.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(XA).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:ZA.optional().describe(`Configuration for currency field type`),vectorConfig:QA.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:$A.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:KA.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:JA.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:tj.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:ej.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),yve={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 rj(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 ij(e,t,n=3,r=3){let i=e.toLowerCase().replace(/[-\s]/g,`_`);return t.map(e=>({value:e,distance:rj(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 bve={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 aj(e){let t=e.toLowerCase().replace(/[-\s]/g,`_`),n=bve[t];return n?[n]:ij(t,YA.options)}function oj(e){return e.length===0?``:e.length===1?`Did you mean '${e[0]}'?`:`Did you mean one of: ${e.map(e=>`'${e}'`).join(`, `)}?`}var sj=e=>{if(e.code===`invalid_value`){let t=e.values,n=e.input,r=String(n??``),i=t.map(String),a=YA.options;if(i.length>10&&a.every(e=>i.includes(e))){let e=oj(aj(r)),t=`Invalid field type '${r}'.`;return{message:e?`${t} ${e}`:`${t} Valid types: ${i.slice(0,10).join(`, `)}...`}}let o=oj(ij(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 cj(e){return` \u2717 ${e.path.length>0?e.path.join(`.`):`(root)`}: ${e.message}`}function lj(e,t){let n=e.issues.length;return`${t?`${t} (${n} issue${n===1?``:`s`}):`:`Validation failed (${n} issue${n===1?``:`s`}):`} - -${e.issues.map(cj).join(` -`)}`}function xve(e,t,n){let r=e.safeParse(t,{error:sj});return r.success?{success:!0,data:r.data}:{success:!1,error:r.error,formatted:lj(r.error,n)}}var uj=[`objects`,`apps`,`pages`,`dashboards`,`reports`,`actions`,`themes`,`workflows`,`approvals`,`flows`,`roles`,`permissions`,`sharingRules`,`policies`,`apis`,`webhooks`,`agents`,`ragPipelines`,`hooks`,`mappings`,`analyticsCubes`,`connectors`,`datasources`],dj={objects:`object`,apps:`app`,pages:`page`,dashboards:`dashboard`,reports:`report`,actions:`action`,themes:`theme`,workflows:`workflow`,approvals:`approval`,flows:`flow`,roles:`role`,permissions:`permission`,profiles:`profile`,sharingRules:`sharingRule`,policies:`policy`,apis:`api`,webhooks:`webhook`,agents:`agent`,ragPipelines:`ragPipeline`,hooks:`hook`,mappings:`mapping`,analyticsCubes:`analyticsCube`,connectors:`connector`,datasources:`datasource`,views:`view`},fj=Object.fromEntries(Object.entries(dj).map(([e,t])=>[t,e]));function Sve(e){return dj[e]??e}function Cve(e){return fj[e]??e}function pj(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 mj(e){let t={...e};for(let e of uj)e in t&&(t[e]=pj(t[e]));return t}var hj={triggers:`hooks`};function gj(e){let t={...e};for(let[e,n]of Object.entries(hj))if(e in t){let r=pj(t[e]),i=pj(t[n]);Array.isArray(r)&&(t[n]=Array.isArray(i)?[...i,...r]:r),delete t[e]}for(let e of uj)e in t&&(t[e]=pj(t[e]));return Array.isArray(t.plugins)&&(t.plugins=t.plugins.map(e=>e&&typeof e==`object`&&!Array.isArray(e)?gj(e):e)),t}DA({},{ALL_OPERATORS:()=>Nve,AddressSchema:()=>vve,AggregationFunction:()=>Dj,AggregationMetricType:()=>CN,AggregationNodeSchema:()=>Oj,AggregationPipelineSchema:()=>nye,AggregationStageSchema:()=>oN,AnalyticsQuerySchema:()=>AN,ApiMethod:()=>oM,AsyncValidationSchema:()=>Gj,BaseEngineOptionsSchema:()=>EM,CDCConfigSchema:()=>mM,ComparisonOperatorSchema:()=>Tve,ComputedFieldCacheSchema:()=>tj,ConditionalValidationSchema:()=>Jj,ConsistencyLevelSchema:()=>$M,CrossFieldValidationSchema:()=>Uj,CubeJoinSchema:()=>ON,CubeSchema:()=>kN,CurrencyConfigSchema:()=>ZA,CurrencyValueSchema:()=>_ve,CustomValidatorSchema:()=>Kj,DataEngineAggregateOptionsSchema:()=>Kve,DataEngineAggregateRequestSchema:()=>VM,DataEngineBatchRequestSchema:()=>WM,DataEngineContractSchema:()=>Jve,DataEngineCountOptionsSchema:()=>qve,DataEngineCountRequestSchema:()=>BM,DataEngineDeleteOptionsSchema:()=>Gve,DataEngineDeleteRequestSchema:()=>zM,DataEngineExecuteRequestSchema:()=>HM,DataEngineFilterSchema:()=>wM,DataEngineFindOneRequestSchema:()=>IM,DataEngineFindRequestSchema:()=>FM,DataEngineInsertOptionsSchema:()=>OM,DataEngineInsertRequestSchema:()=>LM,DataEngineQueryOptionsSchema:()=>Uve,DataEngineRequestSchema:()=>Yve,DataEngineSortSchema:()=>TM,DataEngineUpdateOptionsSchema:()=>Wve,DataEngineUpdateRequestSchema:()=>RM,DataEngineVectorFindRequestSchema:()=>UM,DataQualityRulesSchema:()=>ej,DataTypeMappingSchema:()=>XM,DatasetLoadResultSchema:()=>mN,DatasetMode:()=>sN,DatasetSchema:()=>cN,DatasourceCapabilities:()=>xN,DatasourceSchema:()=>SN,DimensionSchema:()=>DN,DimensionType:()=>wN,DocumentSchema:()=>sye,DocumentSchemaValidationSchema:()=>rN,DocumentTemplateSchema:()=>gN,DocumentVersionSchema:()=>hN,DriverCapabilitiesSchema:()=>KM,DriverConfigSchema:()=>JM,DriverDefinitionSchema:()=>lye,DriverInterfaceSchema:()=>Xve,DriverOptionsSchema:()=>GM,DriverType:()=>bN,ESignatureConfigSchema:()=>_N,EngineAggregateOptionsSchema:()=>jM,EngineCountOptionsSchema:()=>MM,EngineDeleteOptionsSchema:()=>AM,EngineQueryOptionsSchema:()=>DM,EngineUpdateOptionsSchema:()=>kM,EqualityOperatorSchema:()=>wve,ExternalDataSourceSchema:()=>vN,ExternalFieldMappingSchema:()=>yN,ExternalLookupSchema:()=>cye,FILTER_OPERATORS:()=>wj,FeedActorSchema:()=>FN,FeedFilterMode:()=>RN,FeedItemSchema:()=>LN,FeedItemType:()=>jN,FeedVisibility:()=>IN,Field:()=>yve,FieldChangeEntrySchema:()=>NN,FieldMappingSchema:()=>xM,FieldNodeSchema:()=>Fj,FieldOperatorsSchema:()=>vj,FieldReferenceSchema:()=>_j,FieldSchema:()=>nj,FieldType:()=>YA,FileAttachmentConfigSchema:()=>$A,FilterConditionSchema:()=>yj,FormatValidationSchema:()=>Hj,FullTextSearchSchema:()=>Ij,HookContextSchema:()=>Hve,HookEvent:()=>vM,HookSchema:()=>yM,IndexSchema:()=>cM,JSONValidationSchema:()=>Wj,JoinNodeSchema:()=>jj,JoinStrategy:()=>Aj,JoinType:()=>kj,LOGICAL_OPERATORS:()=>Tj,LocationCoordinatesSchema:()=>gve,MappingSchema:()=>SM,MentionSchema:()=>MN,MetricSchema:()=>EN,NoSQLDataTypeMappingSchema:()=>iN,NoSQLDatabaseTypeSchema:()=>QM,NoSQLDriverConfigSchema:()=>tye,NoSQLIndexSchema:()=>rye,NoSQLIndexTypeSchema:()=>eN,NoSQLOperationTypeSchema:()=>eye,NoSQLQueryOptionsSchema:()=>aN,NoSQLTransactionOptionsSchema:()=>iye,NormalizedFilterSchema:()=>bj,NotificationChannel:()=>BN,ObjectCapabilities:()=>sM,ObjectDependencyGraphSchema:()=>dN,ObjectDependencyNodeSchema:()=>uN,ObjectExtensionSchema:()=>_M,ObjectOwnershipEnum:()=>Vve,ObjectSchema:()=>gM,PartitioningConfigSchema:()=>pM,PoolConfigSchema:()=>qM,QueryFilterSchema:()=>Ave,QuerySchema:()=>Lj,RangeOperatorSchema:()=>Dve,ReactionSchema:()=>PN,RecordSubscriptionSchema:()=>VN,ReferenceResolutionErrorSchema:()=>fN,ReferenceResolutionSchema:()=>lN,ReplicationConfigSchema:()=>nN,SQLDialectSchema:()=>YM,SQLDriverConfigSchema:()=>Zve,SQLiteAlterTableLimitations:()=>$ve,SQLiteDataTypeMappingDefaults:()=>Qve,SSLConfigSchema:()=>ZM,ScriptValidationSchema:()=>zj,SearchConfigSchema:()=>lM,SeedLoaderConfigSchema:()=>pN,SeedLoaderRequestSchema:()=>oye,SeedLoaderResultSchema:()=>aye,SelectOptionSchema:()=>XA,SetOperatorSchema:()=>Eve,ShardingConfigSchema:()=>tN,SoftDeleteConfigSchema:()=>dM,SortNodeSchema:()=>Ej,SpecialOperatorSchema:()=>kve,StateMachineValidationSchema:()=>Vj,StringOperatorSchema:()=>Ove,SubscriptionEventType:()=>zN,TenancyConfigSchema:()=>uM,TenantDatabaseLifecycleSchema:()=>WN,TenantResolverStrategySchema:()=>HN,TimeUpdateInterval:()=>TN,TransformType:()=>bM,TursoGroupSchema:()=>UN,TursoMultiTenantConfigSchema:()=>uye,UniquenessValidationSchema:()=>Bj,VALID_AST_OPERATORS:()=>xj,ValidationRuleSchema:()=>qj,VectorConfigSchema:()=>QA,VersioningConfigSchema:()=>fM,WindowFunction:()=>Mj,WindowFunctionNodeSchema:()=>Pj,WindowSpecSchema:()=>Nj,isFilterAST:()=>Sj,parseFilterAST:()=>Cj});var _j=h({$field:r().describe(`Field Reference/Column Name`)}),wve=h({$eq:D().optional(),$ne:D().optional()}),Tve=h({$gt:l([P(),N(),_j]).optional(),$gte:l([P(),N(),_j]).optional(),$lt:l([P(),N(),_j]).optional(),$lte:l([P(),N(),_j]).optional()}),Eve=h({$in:C(D()).optional(),$nin:C(D()).optional()}),Dve=h({$between:w([l([P(),N(),_j]),l([P(),N(),_j])]).optional()}),Ove=h({$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional()}),kve=h({$null:S().optional(),$exists:S().optional()}),vj=h({$eq:D().optional(),$ne:D().optional(),$gt:l([P(),N(),_j]).optional(),$gte:l([P(),N(),_j]).optional(),$lt:l([P(),N(),_j]).optional(),$lte:l([P(),N(),_j]).optional(),$in:C(D()).optional(),$nin:C(D()).optional(),$between:w([l([P(),N(),_j]),l([P(),N(),_j])]).optional(),$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional(),$null:S().optional(),$exists:S().optional()}),yj=F(()=>d(r(),u()).and(h({$and:C(yj).optional(),$or:C(yj).optional(),$not:yj.optional()}))),Ave=h({where:yj.optional()}),bj=F(()=>h({$and:C(l([d(r(),vj),bj])).optional(),$or:C(l([d(r(),vj),bj])).optional(),$not:l([d(r(),vj),bj]).optional()})),xj=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function Sj(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=>Sj(e));if(e.length>=2&&typeof e[1]==`string`)return xj.has(e[1].toLowerCase())}return e.every(e=>Sj(e))?e.length>0:!1}var jve={"=":`$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 Mve(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=jve[i];return a?{[t]:{[a]:r}}:{[t]:{[`$${i}`]:r}}}function Cj(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=>Cj(e)).filter(Boolean);return r.length===0?void 0:r.length===1?r[0]:{[n]:r}}if(e.length>=2&&typeof t==`string`)return Mve(e);if(e.every(e=>Array.isArray(e))){let t=e.map(e=>Cj(e)).filter(Boolean);return t.length===0?void 0:t.length===1?t[0]:{$and:t}}}var wj=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],Tj=[`$and`,`$or`,`$not`],Nve=[...wj,...Tj],Ej=h({field:r(),order:E([`asc`,`desc`]).default(`asc`)}),Dj=E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),Oj=h({function:Dj.describe(`Aggregation function`),field:r().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:r().describe(`Result column alias`),distinct:S().optional().describe(`Apply DISTINCT before aggregation`),filter:yj.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)}),kj=E([`inner`,`left`,`right`,`full`]),Aj=E([`auto`,`database`,`hash`,`loop`]),jj=F(()=>h({type:kj.describe(`Join type`),strategy:Aj.optional().describe(`Execution strategy hint`),object:r().describe(`Object/table to join`),alias:r().optional().describe(`Table alias`),on:yj.describe(`Join condition`),subquery:F(()=>Lj).optional().describe(`Subquery instead of object`)})),Mj=E([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),Nj=h({partitionBy:C(r()).optional().describe(`PARTITION BY fields`),orderBy:C(Ej).optional().describe(`ORDER BY specification`),frame:h({type:E([`rows`,`range`]).optional(),start:r().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:r().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)}),Pj=h({function:Mj.describe(`Window function name`),field:r().optional().describe(`Field to operate on (for aggregate window functions)`),alias:r().describe(`Result column alias`),over:Nj.describe(`Window specification (OVER clause)`)}),Fj=F(()=>l([r(),h({field:r(),fields:C(Fj).optional(),alias:r().optional()})])),Ij=h({query:r().describe(`Search query text`),fields:C(r()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:S().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:E([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:d(r(),P()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:P().optional().describe(`Minimum relevance score threshold`),language:r().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:S().optional().default(!1).describe(`Enable search result highlighting`)}),Lj=h({object:r().describe(`Object name (e.g. account)`),fields:C(Fj).optional().describe(`Fields to retrieve`),where:yj.optional().describe(`Filtering criteria (WHERE)`),search:Ij.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:C(Ej).optional().describe(`Sorting instructions (ORDER BY)`),limit:P().optional().describe(`Max records to return (LIMIT)`),offset:P().optional().describe(`Records to skip (OFFSET)`),top:P().optional().describe(`Alias for limit (OData compatibility)`),cursor:d(r(),u()).optional().describe(`Cursor for keyset pagination`),joins:C(jj).optional().describe(`Explicit Table Joins`),aggregations:C(Oj).optional().describe(`Aggregation functions`),groupBy:C(r()).optional().describe(`GROUP BY fields`),having:yj.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:C(Pj).optional().describe(`Window functions with OVER clause`),distinct:S().optional().describe(`SELECT DISTINCT flag`)}).extend({expand:F(()=>d(r(),Lj)).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.`)}),Rj=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label for the rule listing`),description:r().optional().describe(`Administrative notes explaining the business reason`),active:S().default(!0),events:C(E([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:P().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:C(r()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:E([`error`,`warning`,`info`]).default(`error`),message:r().describe(`Error message to display to the user`)}),zj=Rj.extend({type:m(`script`),condition:r().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),Bj=Rj.extend({type:m(`unique`),fields:C(r()).describe(`Fields that must be combined unique`),scope:r().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:S().default(!0)}),Vj=Rj.extend({type:m(`state_machine`),field:r().describe(`State field (e.g. status)`),transitions:d(r(),C(r())).describe(`Map of { OldState: [AllowedNewStates] }`)}),Hj=Rj.extend({type:m(`format`),field:r(),regex:r().optional(),format:E([`email`,`url`,`phone`,`json`]).optional()}),Uj=Rj.extend({type:m(`cross_field`),condition:r().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:C(r()).describe(`Fields involved in the validation`)}),Wj=Rj.extend({type:m(`json_schema`),field:r().describe(`JSON field to validate`),schema:d(r(),u()).describe(`JSON Schema object definition`)}),Gj=Rj.extend({type:m(`async`),field:r().describe(`Field to validate`),validatorUrl:r().optional().describe(`External API endpoint for validation`),method:E([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:d(r(),r()).optional().describe(`Custom headers for the request`),validatorFunction:r().optional().describe(`Reference to custom validator function`),timeout:P().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:P().optional().describe(`Debounce delay in milliseconds`),params:d(r(),u()).optional().describe(`Additional parameters to pass to validator`)}),Kj=Rj.extend({type:m(`custom`),handler:r().describe(`Name of the custom validation function registered in the system`),params:d(r(),u()).optional().describe(`Parameters passed to the custom handler`)}),qj=F(()=>I(`type`,[zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,Jj])),Jj=Rj.extend({type:m(`conditional`),when:r().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:qj.describe(`Validation rule to apply when condition is true`),otherwise:qj.optional().describe(`Validation rule to apply when condition is false`)}),Yj=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),Xj=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),Zj=h({target:r().optional().describe(`Target State ID`),cond:Xj.optional().describe(`Condition (Guard) required to take this path`),actions:C(Yj).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)}),Pve=h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)}),Qj=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(Yj).optional().describe(`Actions to run when entering this state`),exit:C(Yj).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),Zj,C(Zj)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(Zj).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),Qj).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),$j=h({id:kA.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),Qj).describe(`State Nodes`),on:d(r(),l([r(),Zj,C(Zj)])).optional()}),Fve=h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}),q=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),eM=h({ariaLabel:q.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`),Ive=h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`),tM=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),nM=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`),Lve=h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:tM.optional().describe(`Default number formatting rules`),dateFormat:nM.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`),rM=h({name:r(),label:q,type:YA,required:S().default(!1),options:C(h({label:q,value:r()})).optional()}),iM=E([`script`,`url`,`modal`,`flow`,`api`]),Rve=new Set(iM.options.filter(e=>e!==`script`)),aM=h({name:kA.describe(`Machine name (lowercase snake_case)`),label:q.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:iM.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(rM).optional().describe(`Input parameters required from user`),variant:E([`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:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:eM.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(Rve.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),zve={create:e=>aM.parse(e)},oM=E([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),sM=h({trackHistory:S().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:S().default(!0).describe(`Index records for global search`),apiEnabled:S().default(!0).describe(`Expose object via automatic APIs`),apiMethods:C(oM).optional().describe(`Whitelist of allowed API operations`),files:S().default(!1).describe(`Enable file attachments and document management`),feeds:S().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:S().default(!1).describe(`Enable standard tasks and events tracking`),trash:S().default(!0).describe(`Enable soft-delete with restore capability`),mru:S().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:S().default(!0).describe(`Allow record deep cloning`)}),cM=h({name:r().optional().describe(`Index name (auto-generated if not provided)`),fields:C(r()).describe(`Fields included in the index`),type:E([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:S().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:r().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),lM=h({fields:C(r()).describe(`Fields to index for full-text search weighting`),displayFields:C(r()).optional().describe(`Fields to display in search result cards`),filters:C(r()).optional().describe(`Default filters for search results`)}),uM=h({enabled:S().describe(`Enable multi-tenancy for this object`),strategy:E([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:r().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:S().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),dM=h({enabled:S().describe(`Enable soft delete (trash/recycle bin)`),field:r().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:S().default(!1).describe(`Cascade soft delete to related records`)}),fM=h({enabled:S().describe(`Enable record versioning`),strategy:E([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:P().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:r().default(`version`).describe(`Field name for version number/timestamp`)}),pM=h({enabled:S().describe(`Enable table partitioning`),strategy:E([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:r().describe(`Field name to partition by`),interval:r().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"`}),mM=h({enabled:S().describe(`Enable Change Data Capture`),events:C(E([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:r().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),hM=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:r().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:r().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:r().optional().describe(`Developer documentation / description`),icon:r().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:r().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:C(r()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:S().optional().default(!0).describe(`Is the object active and usable`),isSystem:S().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:S().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:r().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:r().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:d(r().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),nj).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:C(cM).optional().describe(`Database performance indexes`),tenancy:uM.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:dM.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:fM.optional().describe(`Record versioning and history tracking configuration`),partitioning:pM.optional().describe(`Table partitioning configuration for performance`),cdc:mM.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:C(qj).optional().describe(`Object-level validation rules`),stateMachines:d(r(),$j).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:r().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:h({type:E([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:r().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:P().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:r().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:C(r()).optional().describe(`Primary fields for hover/cards/lookups`),search:lM.optional().describe(`Search engine configuration`),enable:sM.optional().describe(`Enabled system features modules`),recordTypes:C(r()).optional().describe(`Record type names for this object`),sharingModel:E([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:r().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:C(aM).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function Bve(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var gM=Object.assign(hM,{create:e=>{let t={...e,label:e.label??Bve(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return hM.parse(t)}}),Vve=E([`own`,`extend`]),_M=h({extend:r().describe(`Target object name (FQN) to extend`),fields:d(r(),nj).optional().describe(`Fields to add/override`),label:r().optional().describe(`Override label for the extended object`),pluralLabel:r().optional().describe(`Override plural label for the extended object`),description:r().optional().describe(`Override description for the extended object`),validations:C(qj).optional().describe(`Additional validation rules to merge into the target object`),indexes:C(cM).optional().describe(`Additional indexes to merge into the target object`),priority:P().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)}),vM=E([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]),yM=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:r().optional().describe(`Description of what this hook does`),object:l([r(),C(r())]).describe(`Target object(s)`),events:C(vM).describe(`Lifecycle events`),handler:l([r(),M()]).optional().describe(`Handler function name (string) or inline function reference`),priority:P().default(100).describe(`Execution priority`),async:S().default(!1).describe(`Run specifically as fire-and-forget`),condition:r().optional().describe(`Formula expression; hook runs only when TRUE (e.g., "status = 'closed' AND amount > 1000")`),description:r().optional().describe(`Human-readable description of what this hook does`),retryPolicy:h({maxRetries:P().default(3).describe(`Maximum retry attempts on failure`),backoffMs:P().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:P().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:E([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)}),Hve=h({id:r().optional().describe(`Unique execution ID for tracing`),object:r(),event:vM,input:d(r(),u()).describe(`Mutable input parameters`),result:u().optional().describe(`Operation result (After hooks only)`),previous:d(r(),u()).optional().describe(`Record state before operation`),session:h({userId:r().optional(),tenantId:r().optional(),roles:C(r()).optional(),accessToken:r().optional()}).optional().describe(`Current session context`),transaction:u().optional().describe(`Database transaction handle`),ql:u().describe(`ObjectQL Engine Reference`),api:u().optional().describe(`Cross-object data access (ScopedContext)`),user:h({id:r().optional(),name:r().optional(),email:r().optional()}).optional().describe(`Current user info shortcut`)}),bM=E([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),xM=h({source:l([r(),C(r())]).describe(`Source column header(s)`),target:l([r(),C(r())]).describe(`Target object field(s)`),transform:bM.default(`none`),params:h({value:u().optional(),object:r().optional(),fromField:r().optional(),toField:r().optional(),autoCreate:S().optional(),valueMap:d(r(),u()).optional(),separator:r().optional()}).optional()}),SM=h({name:kA.describe(`Mapping unique name (lowercase snake_case)`),label:r().optional(),sourceFormat:E([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:r().describe(`Target Object Name`),fieldMapping:C(xM),mode:E([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:C(r()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:Lj.optional().describe(`Query to run for export only`),errorPolicy:E([`skip`,`abort`,`retry`]).default(`skip`),batchSize:P().default(1e3)}),CM=h({userId:r().optional(),tenantId:r().optional(),roles:C(r()).default([]),permissions:C(r()).default([]),isSystem:S().default(!1),accessToken:r().optional(),transaction:u().optional(),traceId:r().optional()}),wM=l([d(r(),u()),yj]).describe(`Data Engine query filter conditions`),TM=l([d(r(),E([`asc`,`desc`])),d(r(),l([m(1),m(-1)])),C(Ej)]).describe(`Sort order definition`),EM=h({context:CM.optional()}),DM=EM.extend({where:l([d(r(),u()),yj]).optional(),fields:C(Fj).optional(),orderBy:C(Ej).optional(),limit:P().optional(),offset:P().optional(),top:P().optional(),cursor:d(r(),u()).optional(),search:Ij.optional(),expand:F(()=>d(r(),Lj)).optional(),distinct:S().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`),Uve=EM.extend({filter:wM.optional(),select:C(r()).optional(),sort:TM.optional(),limit:P().int().min(1).optional(),skip:P().int().min(0).optional(),top:P().int().min(1).optional(),populate:C(r()).optional()}).describe(`Query options for IDataEngine.find() operations`),OM=EM.extend({returning:S().default(!0).optional()}).describe(`Options for DataEngine.insert operations`),kM=EM.extend({where:l([d(r(),u()),yj]).optional(),upsert:S().default(!1).optional(),multi:S().default(!1).optional(),returning:S().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`),Wve=EM.extend({filter:wM.optional(),upsert:S().default(!1).optional(),multi:S().default(!1).optional(),returning:S().default(!1).optional()}).describe(`Options for DataEngine.update operations`),AM=EM.extend({where:l([d(r(),u()),yj]).optional(),multi:S().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`),Gve=EM.extend({filter:wM.optional(),multi:S().default(!1).optional()}).describe(`Options for DataEngine.delete operations`),jM=EM.extend({where:l([d(r(),u()),yj]).optional(),groupBy:C(r()).optional(),aggregations:C(Oj).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`),Kve=EM.extend({filter:wM.optional(),groupBy:C(r()).optional(),aggregations:C(h({field:r(),method:E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:r().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`),MM=EM.extend({where:l([d(r(),u()),yj]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`),qve=EM.extend({filter:wM.optional()}).describe(`Options for DataEngine.count operations`),Jve=h({find:M().input(w([r(),DM.optional()])).output(i(C(u()))),findOne:M().input(w([r(),DM.optional()])).output(i(u())),insert:M().input(w([r(),l([d(r(),u()),C(d(r(),u()))]),OM.optional()])).output(i(u())),update:M().input(w([r(),d(r(),u()),kM.optional()])).output(i(u())),delete:M().input(w([r(),AM.optional()])).output(i(u())),count:M().input(w([r(),MM.optional()])).output(i(P())),aggregate:M().input(w([r(),jM])).output(i(C(u())))}).describe(`Standard Data Engine Contract`),NM={filter:wM.optional()},PM=DM.extend({...NM,select:C(r()).optional(),sort:TM.optional(),skip:P().int().min(0).optional(),populate:C(r()).optional()}),FM=h({method:m(`find`),object:r(),query:PM.optional()}),IM=h({method:m(`findOne`),object:r(),query:PM.optional()}),LM=h({method:m(`insert`),object:r(),data:l([d(r(),u()),C(d(r(),u()))]),options:OM.optional()}),RM=h({method:m(`update`),object:r(),data:d(r(),u()),id:l([r(),P()]).optional().describe(`ID for single update, or use where in options`),options:kM.extend(NM).optional()}),zM=h({method:m(`delete`),object:r(),id:l([r(),P()]).optional().describe(`ID for single delete, or use where in options`),options:AM.extend(NM).optional()}),BM=h({method:m(`count`),object:r(),query:MM.extend(NM).optional()}),VM=h({method:m(`aggregate`),object:r(),query:jM.extend(NM)}),HM=h({method:m(`execute`),command:u(),options:d(r(),u()).optional()}),UM=h({method:m(`vectorFind`),object:r(),vector:C(P()),where:l([d(r(),u()),yj]).optional(),fields:C(r()).optional(),limit:P().int().default(5).optional(),threshold:P().optional()}),WM=h({method:m(`batch`),requests:C(I(`method`,[FM,IM,LM,RM,zM,BM,VM,HM,UM])),transaction:S().default(!0).optional()}),Yve=I(`method`,[FM,IM,LM,RM,zM,BM,VM,WM,HM,UM]).describe(`Virtual ObjectQL Request Protocol`),GM=h({transaction:u().optional().describe(`Transaction handle`),timeout:P().optional().describe(`Timeout in ms`),skipCache:S().optional().describe(`Bypass cache`),traceContext:d(r(),r()).optional().describe(`OpenTelemetry context or request ID`),tenantId:r().optional().describe(`Tenant Isolation identifier`)}),KM=h({create:S().default(!0).describe(`Supports CREATE operations`),read:S().default(!0).describe(`Supports READ operations`),update:S().default(!0).describe(`Supports UPDATE operations`),delete:S().default(!0).describe(`Supports DELETE operations`),bulkCreate:S().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:S().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:S().default(!1).describe(`Supports bulk DELETE operations`),transactions:S().default(!1).describe(`Supports ACID transactions`),savepoints:S().default(!1).describe(`Supports transaction savepoints`),isolationLevels:C(VA).optional().describe(`Supported isolation levels`),queryFilters:S().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:S().default(!1).describe(`Supports GROUP BY and aggregation functions`),querySorting:S().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:S().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:S().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:S().default(!1).describe(`Supports subqueries`),queryCTE:S().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:S().default(!1).describe(`Supports SQL joins`),fullTextSearch:S().default(!1).describe(`Supports full-text search`),jsonQuery:S().default(!1).describe(`Supports JSON field querying`),geospatialQuery:S().default(!1).describe(`Supports geospatial queries`),streaming:S().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:S().default(!1).describe(`Supports JSON field types`),arrayFields:S().default(!1).describe(`Supports array field types`),vectorSearch:S().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:S().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:S().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:S().default(!1).describe(`Supports database migrations`),indexes:S().default(!1).describe(`Supports index creation and management`),connectionPooling:S().default(!1).describe(`Supports connection pooling`),preparedStatements:S().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:S().default(!1).describe(`Supports query result caching`)}),Xve=h({name:r().describe(`Driver unique name`),version:r().describe(`Driver version`),supports:KM,connect:M().input(w([])).output(i(te())).describe(`Establish connection`),disconnect:M().input(w([])).output(i(te())).describe(`Close connection`),checkHealth:M().input(w([])).output(i(S())).describe(`Health check`),getPoolStats:M().input(w([])).output(h({total:P(),idle:P(),active:P(),waiting:P()}).optional()).optional().describe(`Get connection pool statistics`),execute:M().input(w([u(),C(u()).optional(),GM.optional()])).output(i(u())).describe(`Execute raw command`),find:M().input(w([r(),Lj,GM.optional()])).output(i(C(d(r(),u())))).describe(`Find records`),findStream:M().input(w([r(),Lj,GM.optional()])).output(u()).describe(`Stream records (AsyncIterable)`),findOne:M().input(w([r(),Lj,GM.optional()])).output(i(d(r(),u()).nullable())).describe(`Find one record`),create:M().input(w([r(),d(r(),u()),GM.optional()])).output(i(d(r(),u()))).describe(`Create record`),update:M().input(w([r(),r().or(P()),d(r(),u()),GM.optional()])).output(i(d(r(),u()))).describe(`Update record`),upsert:M().input(w([r(),d(r(),u()),C(r()).optional(),GM.optional()])).output(i(d(r(),u()))).describe(`Upsert record`),delete:M().input(w([r(),r().or(P()),GM.optional()])).output(i(S())).describe(`Delete record`),count:M().input(w([r(),Lj.optional(),GM.optional()])).output(i(P())).describe(`Count records`),bulkCreate:M().input(w([r(),C(d(r(),u())),GM.optional()])).output(i(C(d(r(),u())))),bulkUpdate:M().input(w([r(),C(h({id:r().or(P()),data:d(r(),u())})),GM.optional()])).output(i(C(d(r(),u())))),bulkDelete:M().input(w([r(),C(r().or(P())),GM.optional()])).output(i(te())),updateMany:M().input(w([r(),Lj,d(r(),u()),GM.optional()])).output(i(P())).optional(),deleteMany:M().input(w([r(),Lj,GM.optional()])).output(i(P())).optional(),beginTransaction:M().input(w([h({isolationLevel:VA.optional()}).optional()])).output(i(u())).describe(`Start transaction`),commit:M().input(w([u()])).output(i(te())).describe(`Commit transaction`),rollback:M().input(w([u()])).output(i(te())).describe(`Rollback transaction`),syncSchema:M().input(w([r(),u(),GM.optional()])).output(i(te())).describe(`Sync object schema to DB`),syncSchemasBatch:M().input(w([C(h({object:r(),schema:u()})),GM.optional()])).output(i(te())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:M().input(w([r(),GM.optional()])).output(i(te())),explain:M().input(w([r(),Lj,GM.optional()])).output(i(u())).optional()}),qM=h({min:P().min(0).default(2).describe(`Minimum number of connections in pool`),max:P().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:P().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:P().min(0).default(5e3).describe(`Time in ms to wait for available connection`)}),JM=h({name:r().describe(`Driver instance name`),type:E([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:KM.describe(`Driver capability flags`),connectionString:r().optional().describe(`Database connection string (driver-specific format)`),poolConfig:qM.optional().describe(`Connection pool configuration`)}),YM=E([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`]),XM=h({text:r().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:r().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:r().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:r().describe(`SQL type for date fields (e.g., DATE)`),datetime:r().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:r().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:r().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:r().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)}),ZM=h({rejectUnauthorized:S().default(!0).describe(`Reject connections with invalid certificates`),ca:r().optional().describe(`CA certificate file path or content`),cert:r().optional().describe(`Client certificate file path or content`),key:r().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`}),Zve=JM.extend({type:m(`sql`).describe(`Driver type must be "sql"`),dialect:YM.describe(`SQL database dialect`),dataTypeMapping:XM.describe(`SQL data type mapping configuration`),ssl:S().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:ZM.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`}),Qve={text:`TEXT`,number:`REAL`,boolean:`INTEGER`,date:`TEXT`,datetime:`TEXT`,json:`TEXT`,uuid:`TEXT`,binary:`BLOB`},$ve={supportsAddColumn:!0,supportsRenameColumn:!0,supportsDropColumn:!0,supportsModifyColumn:!1,supportsAddConstraint:!1,rebuildStrategy:`create_copy_drop_rename`},QM=E([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]),eye=E([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]),$M=E([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`]),eN=E([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`]),tN=h({enabled:S().default(!1).describe(`Enable sharding`),shardKey:r().optional().describe(`Field to use as shard key`),shardingStrategy:E([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:P().int().positive().optional().describe(`Number of shards`)}),nN=h({enabled:S().default(!1).describe(`Enable replication`),replicaSetName:r().optional().describe(`Replica set name`),replicas:P().int().positive().optional().describe(`Number of replicas`),readPreference:E([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:E([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)}),rN=h({enabled:S().default(!1).describe(`Enable schema validation`),validationLevel:E([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:E([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:d(r(),u()).optional().describe(`JSON Schema for validation`)}),iN=h({text:r().describe(`NoSQL type for text fields`),number:r().describe(`NoSQL type for number fields`),boolean:r().describe(`NoSQL type for boolean fields`),date:r().describe(`NoSQL type for date fields`),datetime:r().describe(`NoSQL type for datetime fields`),json:r().optional().describe(`NoSQL type for JSON/object fields`),uuid:r().optional().describe(`NoSQL type for UUID fields`),binary:r().optional().describe(`NoSQL type for binary fields`),array:r().optional().describe(`NoSQL type for array fields`),objectId:r().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:r().optional().describe(`NoSQL type for geospatial point fields`)}),tye=JM.extend({type:m(`nosql`).describe(`Driver type must be "nosql"`),databaseType:QM.describe(`Specific NoSQL database type`),dataTypeMapping:iN.describe(`NoSQL data type mapping configuration`),consistency:$M.optional().describe(`Consistency level for operations`),replication:nN.optional().describe(`Replication configuration`),sharding:tN.optional().describe(`Sharding configuration`),schemaValidation:rN.optional().describe(`Document schema validation`),region:r().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:r().optional().describe(`AWS access key ID`),secretAccessKey:r().optional().describe(`AWS secret access key`),ttlField:r().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:P().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:r().optional().describe(`Prefix for collection/table names`)}),aN=h({consistency:$M.optional().describe(`Consistency level override`),readFromSecondary:S().optional().describe(`Allow reading from secondary replicas`),projection:d(r(),l([m(0),m(1)])).optional().describe(`Field projection`),timeout:P().int().positive().optional().describe(`Query timeout (ms)`),useCursor:S().optional().describe(`Use cursor instead of loading all results`),batchSize:P().int().positive().optional().describe(`Cursor batch size`),profile:S().optional().describe(`Enable query profiling`),hint:r().optional().describe(`Index hint for query optimization`)}),oN=h({operator:r().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:d(r(),u()).describe(`Stage-specific options`)}),nye=h({collection:r().describe(`Collection/table name`),stages:C(oN).describe(`Aggregation pipeline stages`),options:aN.optional().describe(`Query options`)}),rye=h({name:r().describe(`Index name`),type:eN.describe(`Index type`),fields:C(h({field:r().describe(`Field name`),order:E([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:S().default(!1).describe(`Enforce uniqueness`),sparse:S().default(!1).describe(`Sparse index`),expireAfterSeconds:P().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:d(r(),u()).optional().describe(`Partial index filter`),background:S().default(!1).describe(`Create index in background`)}),iye=h({readConcern:E([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:E([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:E([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:P().int().positive().optional().describe(`Transaction commit timeout (ms)`)}),sN=E([`insert`,`update`,`upsert`,`replace`,`ignore`]),cN=h({object:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:r().default(`name`).describe(`Field match for uniqueness check`),mode:sN.default(`upsert`).describe(`Conflict resolution strategy`),env:C(E([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:C(d(r(),u())).describe(`Data records`)}),lN=h({field:r().describe(`Source field name containing the reference value`),targetObject:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:r().default(`name`).describe(`Field on target object used for matching`),fieldType:E([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`),uN=h({object:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:C(r()).describe(`Objects this object depends on`),references:C(lN).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`),dN=h({nodes:C(uN).describe(`All objects in the dependency graph`),insertOrder:C(r()).describe(`Topologically sorted insert order`),circularDependencies:C(C(r())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`),fN=h({sourceObject:r().describe(`Object with the broken reference`),field:r().describe(`Field name with unresolved reference`),targetObject:r().describe(`Target object searched for the reference`),targetField:r().describe(`ExternalId field used for matching`),attemptedValue:u().describe(`Value that failed to resolve`),recordIndex:P().int().min(0).describe(`Index of the record in the dataset`),message:r().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`),pN=h({dryRun:S().default(!1).describe(`Validate references without writing data`),haltOnError:S().default(!1).describe(`Stop on first reference resolution error`),multiPass:S().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:sN.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:P().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:S().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:E([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`)}).describe(`Seed data loader configuration`),mN=h({object:r().describe(`Object that was loaded`),mode:sN.describe(`Import mode used`),inserted:P().int().min(0).describe(`Records inserted`),updated:P().int().min(0).describe(`Records updated`),skipped:P().int().min(0).describe(`Records skipped`),errored:P().int().min(0).describe(`Records with errors`),total:P().int().min(0).describe(`Total records in dataset`),referencesResolved:P().int().min(0).describe(`References resolved via externalId`),referencesDeferred:P().int().min(0).describe(`References deferred to second pass`),errors:C(fN).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`),aye=h({success:S().describe(`Overall success status`),dryRun:S().describe(`Whether this was a dry-run`),dependencyGraph:dN.describe(`Object dependency graph`),results:C(mN).describe(`Per-object load results`),errors:C(fN).describe(`All reference resolution errors`),summary:h({objectsProcessed:P().int().min(0).describe(`Total objects processed`),totalRecords:P().int().min(0).describe(`Total records across all objects`),totalInserted:P().int().min(0).describe(`Total records inserted`),totalUpdated:P().int().min(0).describe(`Total records updated`),totalSkipped:P().int().min(0).describe(`Total records skipped`),totalErrored:P().int().min(0).describe(`Total records with errors`),totalReferencesResolved:P().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:P().int().min(0).describe(`Total references deferred`),circularDependencyCount:P().int().min(0).describe(`Circular dependency chains detected`),durationMs:P().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`),oye=h({datasets:C(cN).min(1).describe(`Datasets to load`),config:a(e=>e??{},pN).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`),hN=h({versionNumber:P().describe(`Version number`),createdAt:P().describe(`Creation timestamp`),createdBy:r().describe(`Creator user ID`),size:P().describe(`File size in bytes`),checksum:r().describe(`File checksum`),downloadUrl:r().url().describe(`Download URL`),isLatest:S().optional().default(!1).describe(`Is latest version`)}),gN=h({id:r().describe(`Template ID`),name:r().describe(`Template name`),description:r().optional().describe(`Template description`),fileUrl:r().url().describe(`Template file URL`),fileType:r().describe(`File MIME type`),placeholders:C(h({key:r().describe(`Placeholder key`),label:r().describe(`Placeholder label`),type:E([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:S().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)}),_N=h({provider:E([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:S().optional().default(!1).describe(`E-signature enabled`),signers:C(h({email:r().email().describe(`Signer email`),name:r().describe(`Signer name`),role:r().describe(`Signer role`),order:P().describe(`Signing order`)})).describe(`Document signers`),expirationDays:P().optional().default(30).describe(`Expiration days`),reminderDays:P().optional().default(7).describe(`Reminder interval days`)}),sye=h({id:r().describe(`Document ID`),name:r().describe(`Document name`),description:r().optional().describe(`Document description`),fileType:r().describe(`File MIME type`),fileSize:P().describe(`File size in bytes`),category:r().optional().describe(`Document category`),tags:C(r()).optional().describe(`Document tags`),versioning:h({enabled:S().describe(`Versioning enabled`),versions:C(hN).describe(`Version history`),majorVersion:P().describe(`Major version`),minorVersion:P().describe(`Minor version`)}).optional().describe(`Version control`),template:gN.optional().describe(`Document template`),eSignature:_N.optional().describe(`E-signature config`),access:h({isPublic:S().optional().default(!1).describe(`Public access`),sharedWith:C(r()).optional().describe(`Shared with`),expiresAt:P().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),vN=h({id:r().describe(`Data source ID`),name:r().describe(`Data source name`),type:E([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:r().url().describe(`API endpoint URL`),authentication:h({type:E([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:d(r(),u()).describe(`Auth configuration`)}).describe(`Authentication`)}),yN=MA.extend({type:r().optional().describe(`Field type`),readonly:S().optional().default(!0).describe(`Read-only field`)}),cye=h({fieldName:r().describe(`Field name`),dataSource:vN.describe(`External data source`),query:h({endpoint:r().describe(`Query endpoint path`),method:E([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:d(r(),u()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:C(yN).describe(`Field mappings`),caching:h({enabled:S().optional().default(!0).describe(`Cache enabled`),ttl:P().optional().default(300).describe(`Cache TTL (seconds)`),strategy:E([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:h({enabled:S().optional().default(!0).describe(`Fallback enabled`),defaultValue:u().optional().describe(`Default fallback value`),showError:S().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:h({requestsPerSecond:P().describe(`Requests per second limit`),burstSize:P().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:h({maxRetries:P().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:P().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:P().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:C(P()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:h({request:h({headers:d(r(),r()).optional().describe(`Additional request headers`),queryParams:d(r(),r()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:h({dataPath:r().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:r().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:h({type:E([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:P().default(100).describe(`Items per page`),maxPages:P().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)}),bN=r().describe(`Underlying driver identifier`),lye=h({id:r().describe(`Unique driver identifier (e.g. "postgres")`),label:r().describe(`Display label (e.g. "PostgreSQL")`),description:r().optional(),icon:r().optional(),configSchema:d(r(),u()).describe(`JSON Schema for connection configuration`),capabilities:F(()=>xN).optional()}),xN=h({transactions:S().default(!1),queryFilters:S().default(!1),queryAggregations:S().default(!1),querySorting:S().default(!1),queryPagination:S().default(!1),queryWindowFunctions:S().default(!1),querySubqueries:S().default(!1),joins:S().default(!1),fullTextSearch:S().default(!1),readOnly:S().default(!1),dynamicSchema:S().default(!1)}),SN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:r().optional().describe(`Display label`),driver:bN.describe(`Underlying driver type`),config:d(r(),u()).describe(`Driver specific configuration`),pool:h({min:P().default(0).describe(`Minimum connections`),max:P().default(10).describe(`Maximum connections`),idleTimeoutMillis:P().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:P().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:C(d(r(),u())).optional().describe(`Read-only replica configurations`),capabilities:xN.optional().describe(`Capability overrides`),healthCheck:h({enabled:S().default(!0).describe(`Enable health check endpoint`),intervalMs:P().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:P().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:h({enabled:S().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:S().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:r().optional().describe(`CA certificate (PEM format or path to file)`),cert:r().optional().describe(`Client certificate (PEM format or path to file)`),key:r().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:h({maxRetries:P().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:P().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:P().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:P().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:r().optional().describe(`Internal description`),active:S().default(!0).describe(`Is datasource enabled`)}),CN=E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),wN=E([`string`,`number`,`boolean`,`time`,`geo`]),TN=E([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),EN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:r().describe(`Human readable label`),description:r().optional(),type:CN,sql:r().describe(`SQL expression or field reference`),filters:C(h({sql:r()})).optional(),format:r().optional()}),DN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:r().describe(`Human readable label`),description:r().optional(),type:wN,sql:r().describe(`SQL expression or column reference`),granularities:C(TN).optional()}),ON=h({name:r().describe(`Target cube name`),relationship:E([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:r().describe(`Join condition (ON clause)`)}),kN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:r().optional(),description:r().optional(),sql:r().describe(`Base SQL statement or Table Name`),measures:d(r(),EN).describe(`Quantitative metrics`),dimensions:d(r(),DN).describe(`Qualitative attributes`),joins:d(r(),ON).optional(),refreshKey:h({every:r().optional(),sql:r().optional()}).optional(),public:S().default(!1)}),AN=h({cube:r().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:C(r()).describe(`List of metrics to calculate`),dimensions:C(r()).optional().describe(`List of dimensions to group by`),filters:C(h({member:r().describe(`Dimension or Measure`),operator:E([`equals`,`notEquals`,`contains`,`notContains`,`gt`,`gte`,`lt`,`lte`,`set`,`notSet`,`inDateRange`]),values:C(r()).optional()})).optional(),timeDimensions:C(h({dimension:r(),granularity:TN.optional(),dateRange:l([r(),C(r())]).optional()})).optional(),order:d(r(),E([`asc`,`desc`])).optional(),limit:P().optional(),offset:P().optional(),timezone:r().optional().default(`UTC`)}),jN=E([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),MN=h({type:E([`user`,`team`,`record`]).describe(`Mention target type`),id:r().describe(`Target ID`),name:r().describe(`Display name for rendering`),offset:P().int().min(0).describe(`Character offset in body text`),length:P().int().min(1).describe(`Length of mention token in body text`)}),NN=h({field:r().describe(`Field machine name`),fieldLabel:r().optional().describe(`Field display label`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`),oldDisplayValue:r().optional().describe(`Human-readable old value`),newDisplayValue:r().optional().describe(`Human-readable new value`)}),PN=h({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:C(r()).describe(`Users who reacted`),count:P().int().min(1).describe(`Total reaction count`)}),FN=h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`),avatarUrl:r().url().optional().describe(`Actor avatar URL`),source:r().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),IN=E([`public`,`internal`,`private`]),LN=h({id:r().describe(`Feed item ID`),type:jN.describe(`Activity type`),object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID this feed item belongs to`),actor:FN.describe(`Who performed this action`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(MN).optional().describe(`Mentioned users/teams/records`),changes:C(NN).optional().describe(`Field-level changes`),reactions:C(PN).optional().describe(`Emoji reactions on this item`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),replyCount:P().int().min(0).default(0).describe(`Number of replies`),pinned:S().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:r().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:r().optional().describe(`User ID who pinned the item`),starred:S().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:r().datetime().optional().describe(`Timestamp when the item was starred`),visibility:IN.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:r().datetime().describe(`Creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),editedAt:r().datetime().optional().describe(`When comment was last edited`),isEdited:S().default(!1).describe(`Whether comment has been edited`)}),RN=E([`all`,`comments_only`,`changes_only`,`tasks_only`]),zN=E([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),BN=E([`in_app`,`email`,`push`,`slack`]),VN=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),userId:r().describe(`Subscribing user ID`),events:C(zN).default([`all`]).describe(`Event types to receive notifications for`),channels:C(BN).default([`in_app`]).describe(`Notification delivery channels`),active:S().default(!0).describe(`Whether the subscription is active`),createdAt:r().datetime().describe(`Subscription creation timestamp`)}),HN=E([`header`,`subdomain`,`path`,`token`,`lookup`]).describe(`Strategy for resolving tenant identity from request context`),UN=h({name:r().min(1).describe(`Turso database group name`),primaryLocation:r().min(2).describe(`Primary Turso region code (e.g., iad, lhr, nrt)`),replicaLocations:C(r().min(2)).default([]).describe(`Additional replica region codes`),schemaDatabase:r().optional().describe(`Schema database name for multi-db schemas`)}).describe(`Turso database group configuration`),WN=h({onTenantCreate:h({autoCreate:S().default(!0).describe(`Auto-create database on tenant registration`),group:r().optional().describe(`Turso group for the new database`),applyGroupSchema:S().default(!0).describe(`Apply shared schema from group`),seedData:S().default(!1).describe(`Populate seed data on creation`)}).describe(`Tenant creation hook`),onTenantDelete:h({immediate:S().default(!1).describe(`Destroy database immediately`),gracePeriodHours:P().int().min(0).default(72).describe(`Grace period before permanent deletion`),createBackup:S().default(!0).describe(`Create backup before deletion`)}).describe(`Tenant deletion hook`),onTenantSuspend:h({revokeTokens:S().default(!0).describe(`Revoke auth tokens on suspension`),readOnly:S().default(!0).describe(`Set database to read-only on suspension`)}).describe(`Tenant suspension hook`)}).describe(`Tenant database lifecycle hooks`),uye=h({organizationSlug:r().min(1).describe(`Turso organization slug`),urlTemplate:r().min(1).describe(`URL template with {tenant_id} placeholder`),groupAuthToken:r().min(1).describe(`Group-level auth token for platform operations`),tenantResolverStrategy:HN.default(`token`),group:UN.optional().describe(`Database group configuration`),lifecycle:WN.optional().describe(`Lifecycle hooks`),maxCachedConnections:P().int().min(1).default(100).describe(`Max cached tenant connections (LRU)`),connectionCacheTTL:P().int().min(0).default(300).describe(`Connection cache TTL in seconds`)}).describe(`Turso multi-tenant router configuration`);DA({},{AuditPolicySchema:()=>sP,CriteriaSharingRuleSchema:()=>eP,FieldPermissionSchema:()=>YN,NetworkPolicySchema:()=>aP,OWDModel:()=>gye,ObjectPermissionSchema:()=>JN,OwnerSharingRuleSchema:()=>tP,PasswordPolicySchema:()=>iP,PermissionSetSchema:()=>XN,PolicySchema:()=>cP,RLS:()=>hye,RLSAuditConfigSchema:()=>qN,RLSAuditEventSchema:()=>dye,RLSConfigSchema:()=>fye,RLSEvaluationResultSchema:()=>mye,RLSOperation:()=>GN,RLSUserContextSchema:()=>pye,RowLevelSecurityPolicySchema:()=>KN,SessionPolicySchema:()=>oP,ShareRecipientType:()=>QN,SharingLevel:()=>ZN,SharingRuleSchema:()=>nP,SharingRuleType:()=>_ye,TerritoryModelSchema:()=>vye,TerritorySchema:()=>yye,TerritoryType:()=>rP});var GN=E([`select`,`insert`,`update`,`delete`,`all`]),KN=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy unique identifier (snake_case)`),label:r().optional().describe(`Human-readable policy label`),description:r().optional().describe(`Policy description and business justification`),object:r().describe(`Target object name`),operation:GN.describe(`Database operation this policy applies to`),using:r().optional().describe(`Filter condition for SELECT/UPDATE/DELETE (PostgreSQL SQL WHERE clause syntax with parameterized context variables). Optional for INSERT-only policies.`),check:r().optional().describe(`Validation condition for INSERT/UPDATE (defaults to USING clause if not specified - enforced at application level)`),roles:C(r()).optional().describe(`Roles this policy applies to (omit for all roles)`),enabled:S().default(!0).describe(`Whether this policy is active`),priority:P().int().default(0).describe(`Policy evaluation priority (higher = evaluated first)`),tags:C(r()).optional().describe(`Policy categorization tags`)}).superRefine((e,t)=>{!e.using&&!e.check&&t.addIssue({code:de.custom,message:`At least one of "using" or "check" must be specified. For SELECT/UPDATE/DELETE operations, provide "using". For INSERT operations, provide "check".`})}),dye=h({timestamp:r().describe(`ISO 8601 timestamp of the evaluation`),userId:r().describe(`User ID whose access was evaluated`),operation:E([`select`,`insert`,`update`,`delete`]).describe(`Database operation being performed`),object:r().describe(`Target object name`),policyName:r().describe(`Name of the RLS policy evaluated`),granted:S().describe(`Whether access was granted`),evaluationDurationMs:P().describe(`Policy evaluation duration in milliseconds`),matchedCondition:r().optional().describe(`Which USING/CHECK clause matched`),rowCount:P().optional().describe(`Number of rows affected`),metadata:d(r(),u()).optional().describe(`Additional audit event metadata`)}),qN=h({enabled:S().describe(`Enable RLS audit logging`),logLevel:E([`all`,`denied_only`,`granted_only`,`none`]).describe(`Which evaluations to log`),destination:E([`system_log`,`audit_trail`,`external`]).describe(`Audit log destination`),sampleRate:P().min(0).max(1).describe(`Sampling rate (0-1) for high-traffic environments`),retentionDays:P().int().default(90).describe(`Audit log retention period in days`),includeRowData:S().default(!1).describe(`Include row data in audit logs (security-sensitive)`),alertOnDenied:S().default(!0).describe(`Send alerts when access is denied`)}),fye=h({enabled:S().default(!0).describe(`Enable RLS enforcement globally`),defaultPolicy:E([`deny`,`allow`]).default(`deny`).describe(`Default action when no policies match`),allowSuperuserBypass:S().default(!0).describe(`Allow superusers to bypass RLS`),bypassRoles:C(r()).optional().describe(`Roles that bypass RLS (see all data)`),logEvaluations:S().default(!1).describe(`Log RLS policy evaluations for debugging`),cacheResults:S().default(!0).describe(`Cache RLS evaluation results`),cacheTtlSeconds:P().int().positive().default(300).describe(`Cache TTL in seconds`),prefetchUserContext:S().default(!0).describe(`Pre-fetch user context for performance`),audit:qN.optional().describe(`RLS audit logging configuration`)}),pye=h({id:r().describe(`User ID`),email:r().email().optional().describe(`User email`),tenantId:r().optional().describe(`Tenant/Organization ID`),role:l([r(),C(r())]).optional().describe(`User role(s)`),department:r().optional().describe(`User department`),attributes:d(r(),u()).optional().describe(`Additional custom user attributes`)}),mye=h({policyName:r().describe(`Policy name`),granted:S().describe(`Whether access was granted`),durationMs:P().optional().describe(`Evaluation duration in milliseconds`),error:r().optional().describe(`Error message if evaluation failed`),usingResult:S().optional().describe(`USING clause evaluation result`),checkResult:S().optional().describe(`CHECK clause evaluation result`)}),hye={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})},JN=h({allowCreate:S().default(!1).describe(`Create permission`),allowRead:S().default(!1).describe(`Read permission`),allowEdit:S().default(!1).describe(`Edit permission`),allowDelete:S().default(!1).describe(`Delete permission`),allowTransfer:S().default(!1).describe(`Change record ownership`),allowRestore:S().default(!1).describe(`Restore from trash (Undelete)`),allowPurge:S().default(!1).describe(`Permanently delete (Hard Delete/GDPR)`),viewAllRecords:S().default(!1).describe(`View All Data (Bypass Sharing)`),modifyAllRecords:S().default(!1).describe(`Modify All Data (Bypass Sharing)`)}),YN=h({readable:S().default(!0).describe(`Field read access`),editable:S().default(!1).describe(`Field edit access`)}),XN=h({name:kA.describe(`Permission set unique name (lowercase snake_case)`),label:r().optional().describe(`Display label`),isProfile:S().default(!1).describe(`Whether this is a user profile`),objects:d(r(),JN).describe(`Entity permissions`),fields:d(r(),YN).optional().describe(`Field level security`),systemPermissions:C(r()).optional().describe(`System level capabilities`),tabPermissions:d(r(),E([`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:C(KN).optional().describe(`Row-level security policies (see rls.zod.ts for full spec)`),contextVariables:d(r(),u()).optional().describe(`Context variables for RLS evaluation`)}),gye=E([`private`,`public_read`,`public_read_write`,`controlled_by_parent`]),_ye=E([`owner`,`criteria`]),ZN=E([`read`,`edit`,`full`]),QN=E([`user`,`group`,`role`,`role_and_subordinates`,`guest`]),$N=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label`),description:r().optional().describe(`Administrative notes`),object:r().describe(`Target Object Name`),active:S().default(!0),accessLevel:ZN.default(`read`),sharedWith:h({type:QN,value:r().describe(`ID or Code of the User/Group/Role`)}).describe(`The recipient of the shared access`)}),eP=$N.extend({type:m(`criteria`),condition:r().describe(`Formula condition (e.g. "department = 'Sales'")`)}),tP=$N.extend({type:m(`owner`),ownedBy:h({type:QN,value:r()}).describe(`Source group/role whose records are being shared`)}),nP=I(`type`,[eP,tP]),rP=E([`geography`,`industry`,`named_account`,`product_line`]),vye=h({name:r().describe(`Model Name (e.g. FY24 Planning)`),state:E([`planning`,`active`,`archived`]).default(`planning`),startDate:r().optional(),endDate:r().optional()}),yye=h({name:kA.describe(`Territory unique name (lowercase snake_case)`),label:r().describe(`Territory Label (e.g. "West Coast")`),modelId:r().describe(`Belongs to which Territory Model`),parent:r().optional().describe(`Parent Territory`),type:rP.default(`geography`),assignmentRule:r().optional().describe(`Criteria based assignment rule`),assignedUsers:C(r()).optional(),accountAccess:E([`read`,`edit`]).default(`read`),opportunityAccess:E([`read`,`edit`]).default(`read`),caseAccess:E([`read`,`edit`]).default(`read`)}),iP=h({minLength:P().default(8),requireUppercase:S().default(!0),requireLowercase:S().default(!0),requireNumbers:S().default(!0),requireSymbols:S().default(!1),expirationDays:P().optional().describe(`Force password change every X days`),historyCount:P().default(3).describe(`Prevent reusing last X passwords`)}),aP=h({trustedRanges:C(r()).describe(`CIDR ranges allowed to access (e.g. 10.0.0.0/8)`),blockUnknown:S().default(!1).describe(`Block all IPs not in trusted ranges`),vpnRequired:S().default(!1)}),oP=h({idleTimeout:P().default(30).describe(`Minutes before idle session logout`),absoluteTimeout:P().default(480).describe(`Max session duration (minutes)`),forceMfa:S().default(!1).describe(`Require 2FA for all users`)}),sP=h({logRetentionDays:P().default(180),sensitiveFields:C(r()).describe(`Fields to redact in logs (e.g. password, ssn)`),captureRead:S().default(!1).describe(`Log read access (High volume!)`)}),cP=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Policy Name`),password:iP.optional(),network:aP.optional(),session:oP.optional(),audit:sP.optional(),isDefault:S().default(!1).describe(`Apply to all users by default`),assignedProfiles:C(r()).optional().describe(`Apply to specific profiles`)});DA({},{AIChatWindowProps:()=>JF,Action:()=>zve,ActionNavItemSchema:()=>OP,ActionParamSchema:()=>rM,ActionSchema:()=>aM,ActionType:()=>iM,AddRecordConfigSchema:()=>ZP,AnimationSchema:()=>vI,AnimationTriggerSchema:()=>NI,App:()=>bye,AppBrandingSchema:()=>jP,AppSchema:()=>NP,AppearanceConfigSchema:()=>YP,AriaPropsSchema:()=>eM,BlankPageLayoutItemSchema:()=>DF,BlankPageLayoutSchema:()=>OF,BorderRadiusSchema:()=>hI,BreakpointColumnMapSchema:()=>gP,BreakpointName:()=>hP,BreakpointOrderMapSchema:()=>_P,BreakpointsSchema:()=>_I,CalendarConfigSchema:()=>$P,ChartAnnotationSchema:()=>fP,ChartAxisSchema:()=>uP,ChartConfigSchema:()=>mP,ChartInteractionSchema:()=>pP,ChartSeriesSchema:()=>dP,ChartTypeSchema:()=>lP,ColorPaletteSchema:()=>fI,ColumnSummarySchema:()=>IP,ComponentAnimationSchema:()=>PI,ComponentPropsMap:()=>Dye,ConflictResolutionSchema:()=>TI,Dashboard:()=>Cye,DashboardHeaderActionSchema:()=>uF,DashboardHeaderSchema:()=>dF,DashboardNavItemSchema:()=>wP,DashboardSchema:()=>gF,DashboardWidgetSchema:()=>pF,DateFormatSchema:()=>nM,DensityMode:()=>jye,DensityModeSchema:()=>xI,DndConfigSchema:()=>Lye,DragConstraintSchema:()=>HI,DragHandleSchema:()=>BI,DragItemSchema:()=>WI,DropEffectSchema:()=>VI,DropZoneSchema:()=>UI,EasingFunctionSchema:()=>jI,ElementButtonPropsSchema:()=>QF,ElementDataSourceSchema:()=>wF,ElementFilterPropsSchema:()=>$F,ElementFormPropsSchema:()=>eI,ElementImagePropsSchema:()=>ZF,ElementNumberPropsSchema:()=>XF,ElementRecordPickerPropsSchema:()=>tI,ElementTextPropsSchema:()=>YF,EmbedConfigSchema:()=>xP,EvictionPolicySchema:()=>OI,FieldWidgetPropsSchema:()=>Eye,FocusManagementSchema:()=>dI,FocusTrapConfigSchema:()=>lI,FormFieldSchema:()=>iF,FormSectionSchema:()=>aF,FormViewSchema:()=>oF,GalleryConfigSchema:()=>UP,GanttConfigSchema:()=>eF,GestureConfigSchema:()=>cI,GestureTypeSchema:()=>rI,GlobalFilterOptionsFromSchema:()=>mF,GlobalFilterSchema:()=>hF,GroupNavItemSchema:()=>kP,GroupingConfigSchema:()=>HP,GroupingFieldSchema:()=>VP,HttpMethodSchema:()=>PA,HttpRequestSchema:()=>FA,I18nLabelSchema:()=>q,I18nObjectSchema:()=>Fve,InterfacePageConfigSchema:()=>jF,KanbanConfigSchema:()=>QP,KeyboardNavigationConfigSchema:()=>kye,KeyboardShortcutSchema:()=>uI,ListColumnSchema:()=>LP,ListViewSchema:()=>rF,LocaleConfigSchema:()=>Lve,LongPressGestureConfigSchema:()=>sI,MotionConfigSchema:()=>Pye,NavigationAreaSchema:()=>MP,NavigationConfigSchema:()=>nF,NavigationItemSchema:()=>AP,NavigationModeSchema:()=>tF,NotificationActionSchema:()=>zI,NotificationConfigSchema:()=>Iye,NotificationPositionSchema:()=>RI,NotificationSchema:()=>Fye,NotificationSeveritySchema:()=>LI,NotificationTypeSchema:()=>II,NumberFormatSchema:()=>tM,ObjectNavItemSchema:()=>CP,OfflineCacheConfigSchema:()=>kI,OfflineConfigSchema:()=>Nye,OfflineStrategySchema:()=>wI,PageAccordionProps:()=>qF,PageCardProps:()=>BF,PageComponentSchema:()=>TF,PageComponentType:()=>CF,PageHeaderProps:()=>RF,PageNavItemSchema:()=>TP,PageRegionSchema:()=>SF,PageSchema:()=>MF,PageTabsProps:()=>zF,PageTransitionSchema:()=>FI,PageTypeSchema:()=>kF,PageVariableSchema:()=>EF,PaginationConfigSchema:()=>zP,PerformanceConfigSchema:()=>yP,PersistStorageSchema:()=>DI,PinchGestureConfigSchema:()=>oI,PluralRuleSchema:()=>Ive,RecordActivityProps:()=>WF,RecordChatterProps:()=>GF,RecordDetailsProps:()=>VF,RecordHighlightsProps:()=>UF,RecordPathProps:()=>KF,RecordRelatedListProps:()=>HF,RecordReviewConfigSchema:()=>AF,Report:()=>wye,ReportChartSchema:()=>bF,ReportColumnSchema:()=>vF,ReportGroupingSchema:()=>yF,ReportNavItemSchema:()=>DP,ReportSchema:()=>xF,ReportType:()=>_F,ResponsiveConfigSchema:()=>vP,RowColorConfigSchema:()=>KP,RowHeightSchema:()=>BP,SelectionConfigSchema:()=>RP,ShadowSchema:()=>gI,SharingConfigSchema:()=>bP,SpacingSchema:()=>mI,SwipeDirectionSchema:()=>iI,SwipeGestureConfigSchema:()=>aI,SyncConfigSchema:()=>EI,ThemeMode:()=>Aye,ThemeModeSchema:()=>bI,ThemeSchema:()=>CI,TimelineConfigSchema:()=>WP,TouchInteractionSchema:()=>Oye,TouchTargetConfigSchema:()=>nI,TransitionConfigSchema:()=>MI,TransitionPresetSchema:()=>AI,TypographySchema:()=>pI,UrlNavItemSchema:()=>EP,UserActionsConfigSchema:()=>JP,ViewDataSchema:()=>PP,ViewFilterRuleSchema:()=>FP,ViewSchema:()=>sF,ViewSharingSchema:()=>GP,ViewTabSchema:()=>XP,VisualizationTypeSchema:()=>qP,WcagContrastLevel:()=>Mye,WcagContrastLevelSchema:()=>SI,WidgetActionTypeSchema:()=>lF,WidgetColorVariantSchema:()=>cF,WidgetEventSchema:()=>PF,WidgetLifecycleSchema:()=>NF,WidgetManifestSchema:()=>Tye,WidgetMeasureSchema:()=>fF,WidgetPropertySchema:()=>FF,WidgetSourceSchema:()=>IF,ZIndexSchema:()=>yI,defineApp:()=>xye,defineView:()=>Sye});var lP=E(`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(`.`)),uP=h({field:r().describe(`Data field key`),title:q.optional().describe(`Axis display title`),format:r().optional().describe(`Value format string (e.g., "$0,0.00")`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),stepSize:P().optional().describe(`Step size for ticks`),showGridLines:S().default(!0),position:E([`left`,`right`,`top`,`bottom`]).optional().describe(`Axis position`),logarithmic:S().default(!1)}),dP=h({name:r().describe(`Field name or series identifier`),label:q.optional().describe(`Series display label`),type:lP.optional().describe(`Override chart type for this series`),color:r().optional().describe(`Series color (hex/rgb/token)`),stack:r().optional().describe(`Stack identifier to group series`),yAxis:E([`left`,`right`]).default(`left`).describe(`Bind to specific Y-Axis`)}),fP=h({type:E([`line`,`region`]).default(`line`),axis:E([`x`,`y`]).default(`y`),value:l([P(),r()]).describe(`Start value`),endValue:l([P(),r()]).optional().describe(`End value for regions`),color:r().optional(),label:q.optional(),style:E([`solid`,`dashed`,`dotted`]).default(`dashed`)}),pP=h({tooltips:S().default(!0),zoom:S().default(!1),brush:S().default(!1),clickAction:r().optional().describe(`Action ID to trigger on click`)}),mP=h({type:lP,title:q.optional().describe(`Chart title`),subtitle:q.optional().describe(`Chart subtitle`),description:q.optional().describe(`Accessibility description`),xAxis:uP.optional().describe(`X-Axis configuration`),yAxis:C(uP).optional().describe(`Y-Axis configuration (support dual axis)`),series:C(dP).optional().describe(`Defined series configuration`),colors:C(r()).optional().describe(`Color palette`),height:P().optional().describe(`Fixed height in pixels`),showLegend:S().default(!0).describe(`Display legend`),showDataLabels:S().default(!1).describe(`Display data labels`),annotations:C(fP).optional(),interaction:pP.optional(),aria:eM.optional().describe(`ARIA accessibility attributes`)}),hP=E([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),gP=h({xs:P().min(1).max(12).optional(),sm:P().min(1).max(12).optional(),md:P().min(1).max(12).optional(),lg:P().min(1).max(12).optional(),xl:P().min(1).max(12).optional(),"2xl":P().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),_P=h({xs:P().optional(),sm:P().optional(),md:P().optional(),lg:P().optional(),xl:P().optional(),"2xl":P().optional()}).describe(`Display order per breakpoint`),vP=h({breakpoint:hP.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:C(hP).optional().describe(`Hide on these breakpoints`),columns:gP.optional().describe(`Grid columns per breakpoint`),order:_P.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),yP=h({lazyLoad:S().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:h({enabled:S().default(!1).describe(`Enable virtual scrolling`),itemHeight:P().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:P().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:E([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:S().optional().describe(`Prefetch data before component is visible`),pageSize:P().optional().describe(`Number of items per page for pagination`),debounceMs:P().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),bP=h({enabled:S().default(!1).describe(`Enable public sharing`),publicLink:r().optional().describe(`Generated public share URL`),password:r().optional().describe(`Password required to access shared link`),allowedDomains:C(r()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:r().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:S().optional().default(!1).describe(`Allow access without authentication`)}),xP=h({enabled:S().default(!1).describe(`Enable iframe embedding`),allowedOrigins:C(r()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:r().optional().default(`100%`).describe(`Embed width (CSS value)`),height:r().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:S().optional().default(!0).describe(`Show interface header in embed`),showNavigation:S().optional().default(!1).describe(`Show navigation in embed`),responsive:S().optional().default(!0).describe(`Enable responsive resizing`)}),SP=h({id:kA.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:q.describe(`Display proper label`),icon:r().optional().describe(`Icon name`),order:P().optional().describe(`Sort order within the same level (lower = first)`),badge:l([r(),P()]).optional().describe(`Badge text or count displayed on the item`),visible:r().optional().describe(`Visibility formula condition`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this item`)}),CP=SP.extend({type:m(`object`),objectName:r().describe(`Target object name`),viewName:r().optional().describe(`Default list view to open. Defaults to "all"`)}),wP=SP.extend({type:m(`dashboard`),dashboardName:r().describe(`Target dashboard name`)}),TP=SP.extend({type:m(`page`),pageName:r().describe(`Target custom page component name`),params:d(r(),u()).optional().describe(`Parameters passed to the page context`)}),EP=SP.extend({type:m(`url`),url:r().describe(`Target external URL`),target:E([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),DP=SP.extend({type:m(`report`),reportName:r().describe(`Target report name`)}),OP=SP.extend({type:m(`action`),actionDef:h({actionName:r().describe(`Action machine name to execute`),params:d(r(),u()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),kP=SP.extend({type:m(`group`),expanded:S().default(!1).describe(`Default expansion state in sidebar`)}),AP=F(()=>l([CP.extend({children:C(AP).optional().describe(`Child navigation items (e.g. specific views)`)}),wP,TP,EP,DP,OP,kP.extend({children:C(AP).describe(`Child navigation items`)})])),jP=h({primaryColor:r().optional().describe(`Primary theme color hex code`),logo:r().optional().describe(`Custom logo URL for this app`),favicon:r().optional().describe(`Custom favicon URL for this app`)}),MP=h({id:kA.describe(`Unique area identifier (lowercase snake_case)`),label:q.describe(`Area display label`),icon:r().optional().describe(`Area icon name`),order:P().optional().describe(`Sort order among areas (lower = first)`),description:q.optional().describe(`Area description`),visible:r().optional().describe(`Visibility formula condition for this area`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this area`),navigation:C(AP).describe(`Navigation items within this area`)}),NP=h({name:kA.describe(`App unique machine name (lowercase snake_case)`),label:q.describe(`App display label`),version:r().optional().describe(`App version`),description:q.optional().describe(`App description`),icon:r().optional().describe(`App icon used in the App Launcher`),branding:jP.optional().describe(`App-specific branding`),active:S().optional().default(!0).describe(`Whether the app is enabled`),isDefault:S().optional().default(!1).describe(`Is default app`),navigation:C(AP).optional().describe(`Full navigation tree for the app sidebar`),areas:C(MP).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:r().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this app`),objects:C(u()).optional().describe(`Objects belonging to this app`),apis:C(u()).optional().describe(`Custom APIs belonging to this app`),sharing:bP.optional().describe(`Public sharing configuration`),embed:xP.optional().describe(`Iframe embedding configuration`),mobileNavigation:h({mode:E([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:C(r()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:eM.optional().describe(`ARIA accessibility attributes for the application`)}),bye={create:e=>NP.parse(e)};function xye(e){return NP.parse(e)}var PP=I(`provider`,[h({provider:m(`object`),object:r().describe(`Target object name`)}),h({provider:m(`api`),read:FA.optional().describe(`Configuration for fetching data`),write:FA.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),h({provider:m(`value`),items:C(u()).describe(`Static data array`)})]),FP=h({field:r().describe(`Field name to filter on`),operator:r().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),IP=E([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),LP=h({field:r().describe(`Field name (snake_case)`),label:q.optional().describe(`Display label override`),width:P().positive().optional().describe(`Column width in pixels`),align:E([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:S().optional().describe(`Hide column by default`),sortable:S().optional().describe(`Allow sorting by this column`),resizable:S().optional().describe(`Allow resizing this column`),wrap:S().optional().describe(`Allow text wrapping`),type:r().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:E([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:IP.optional().describe(`Footer aggregation function for this column`),link:S().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:r().optional().describe(`Registered Action ID to execute when clicked`)}),RP=h({type:E([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),zP=h({pageSize:P().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:C(P().int().positive()).optional().describe(`Available page size options`)}),BP=E([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),VP=h({field:r().describe(`Field name to group by`),order:E([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:S().default(!1).describe(`Collapse groups by default`)}),HP=h({fields:C(VP).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),UP=h({coverField:r().optional().describe(`Attachment/image field to display as card cover`),coverFit:E([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:E([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:r().optional().describe(`Field to display as card title`),visibleFields:C(r()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),WP=h({startDateField:r().describe(`Field for timeline item start date`),endDateField:r().optional().describe(`Field for timeline item end date`),titleField:r().describe(`Field to display as timeline item title`),groupByField:r().optional().describe(`Field to group timeline rows`),colorField:r().optional().describe(`Field to determine item color`),scale:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),GP=h({type:E([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:r().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),KP=h({field:r().describe(`Field to derive color from (typically a select/status field)`),colors:d(r(),r()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),qP=E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),JP=h({sort:S().default(!0).describe(`Allow users to sort records`),search:S().default(!0).describe(`Allow users to search records`),filter:S().default(!0).describe(`Allow users to filter records`),rowHeight:S().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:S().default(!1).describe(`Add records through a form instead of inline`),buttons:C(r()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),YP=h({showDescription:S().default(!0).describe(`Show the view description text`),allowedVisualizations:C(qP).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),XP=h({name:kA.describe(`Tab identifier (snake_case)`),label:q.optional().describe(`Display label`),icon:r().optional().describe(`Tab icon name`),view:r().optional().describe(`Referenced list view name from listViews`),filter:C(FP).optional().describe(`Tab-specific filter criteria`),order:P().int().min(0).optional().describe(`Tab display order`),pinned:S().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:S().default(!1).describe(`Set as the default active tab`),visible:S().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),ZP=h({enabled:S().default(!0).describe(`Show the add record entry point`),position:E([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:E([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:r().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),QP=h({groupByField:r().describe(`Field to group columns by (usually status/select)`),summarizeField:r().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:C(r()).describe(`Fields to show on cards`)}),$P=h({startDateField:r(),endDateField:r().optional(),titleField:r(),colorField:r().optional()}),eF=h({startDateField:r(),endDateField:r(),titleField:r(),progressField:r().optional(),dependenciesField:r().optional()}),tF=E([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]),nF=h({mode:tF.default(`page`),view:r().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:S().default(!1).describe(`Disable standard navigation entirely`),openNewTab:S().default(!1).describe(`Force open in new tab (applies to page mode)`),width:l([r(),P()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),rF=h({name:kA.optional().describe(`Internal view name (lowercase snake_case)`),label:q.optional(),type:E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:PP.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:l([C(r()),C(LP)]).describe(`Fields to display as columns`),filter:C(FP).optional().describe(`Filter criteria (JSON Rules)`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional(),searchableFields:C(r()).optional().describe(`Fields enabled for search`),filterableFields:C(r()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:C(h({field:r().describe(`Field name to filter by`),label:r().optional().describe(`Display label for the chip`),operator:E([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:S().optional().describe(`Enable column resizing`),striped:S().optional().describe(`Striped row styling`),bordered:S().optional().describe(`Show borders`),selection:RP.optional().describe(`Row selection configuration`),navigation:nF.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:zP.optional().describe(`Pagination configuration`),kanban:QP.optional(),calendar:$P.optional(),gantt:eF.optional(),gallery:UP.optional(),timeline:WP.optional(),description:q.optional().describe(`View description for documentation/tooltips`),sharing:GP.optional().describe(`View sharing and access configuration`),rowHeight:BP.optional().describe(`Row height / density setting`),grouping:HP.optional().describe(`Group records by one or more fields`),rowColor:KP.optional().describe(`Color rows based on field value`),hiddenFields:C(r()).optional().describe(`Fields to hide in this specific view`),fieldOrder:C(r()).optional().describe(`Explicit field display order for this view`),rowActions:C(r()).optional().describe(`Actions available for individual row items`),bulkActions:C(r()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:S().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:C(h({condition:r().describe(`Condition expression to evaluate`),style:d(r(),r()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:S().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:C(E([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:JP.optional().describe(`User action toggles for the view toolbar`),appearance:YP.optional().describe(`Appearance and visualization configuration`),tabs:C(XP).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:ZP.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at the bottom of the list`),allowPrinting:S().optional().describe(`Allow users to print the view`),emptyState:h({title:q.optional(),message:q.optional(),icon:r().optional()}).optional().describe(`Empty state configuration when no records found`),aria:eM.optional().describe(`ARIA accessibility attributes for the list view`),responsive:vP.optional().describe(`Responsive layout configuration`),performance:yP.optional().describe(`Performance optimization settings`)}),iF=h({field:r().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:S().optional().describe(`Read-only override`),required:S().optional().describe(`Required override`),hidden:S().optional().describe(`Hidden override`),colSpan:P().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:r().optional().describe(`Custom widget/component name`),dependsOn:r().optional().describe(`Parent field name for cascading`),visibleOn:r().optional().describe(`Visibility condition expression`)}),aF=h({label:q.optional(),collapsible:S().default(!1),collapsed:S().default(!1),columns:E([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:C(l([r(),iF]))}),oF=h({type:E([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:PP.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:C(aF).optional(),groups:C(aF).optional(),defaultSort:C(h({field:r().describe(`Field name to sort by`),order:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:bP.optional().describe(`Public sharing configuration for this form`),aria:eM.optional().describe(`ARIA accessibility attributes for the form view`)}),sF=h({list:rF.optional(),form:oF.optional(),listViews:d(r(),rF).optional().describe(`Additional named list views`),formViews:d(r(),oF).optional().describe(`Additional named form views`)});function Sye(e){return sF.parse(e)}var cF=E([`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`]).describe(`Widget color variant`),lF=E([`script`,`url`,`modal`,`flow`,`api`]).describe(`Widget action type`),uF=h({label:q.describe(`Action button label`),actionUrl:r().describe(`URL or target for the action`),actionType:lF.optional().describe(`Type of action`),icon:r().optional().describe(`Icon identifier for the action button`)}).describe(`Dashboard header action`),dF=h({showTitle:S().default(!0).describe(`Show dashboard title in header`),showDescription:S().default(!0).describe(`Show dashboard description in header`),actions:C(uF).optional().describe(`Header action buttons`)}).describe(`Dashboard header configuration`),fF=h({valueField:r().describe(`Field to aggregate`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).default(`count`).describe(`Aggregate function`),label:q.optional().describe(`Measure display label`),format:r().optional().describe(`Number format string`)}).describe(`Widget measure definition`),pF=h({id:kA.describe(`Unique widget identifier (snake_case)`),title:q.optional().describe(`Widget title`),description:q.optional().describe(`Widget description text below the header`),type:lP.default(`metric`).describe(`Visualization type`),chartConfig:mP.optional().describe(`Chart visualization configuration`),colorVariant:cF.optional().describe(`Widget color variant for theming`),actionUrl:r().optional().describe(`URL or target for the widget action button`),actionType:lF.optional().describe(`Type of action for the widget action button`),actionIcon:r().optional().describe(`Icon identifier for the widget action button`),object:r().optional().describe(`Data source object name`),filter:yj.optional().describe(`Data filter criteria`),categoryField:r().optional().describe(`Field for grouping (X-Axis)`),valueField:r().optional().describe(`Field for values (Y-Axis)`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).optional().default(`count`).describe(`Aggregate function`),measures:C(fF).optional().describe(`Multiple measures for pivot/matrix analysis`),layout:h({x:P(),y:P(),w:P(),h:P()}).describe(`Grid layout position`),options:u().optional().describe(`Widget specific configuration`),responsive:vP.optional().describe(`Responsive layout configuration`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),mF=h({object:r().describe(`Source object name`),valueField:r().describe(`Field to use as option value`),labelField:r().describe(`Field to use as option label`),filter:yj.optional().describe(`Filter to apply to source object`)}).describe(`Dynamic filter options from object`),hF=h({field:r().describe(`Field name to filter on`),label:q.optional().describe(`Display label for the filter`),type:E([`text`,`select`,`date`,`number`,`lookup`]).optional().describe(`Filter input type`),options:C(h({value:l([r(),P(),S()]).describe(`Option value`),label:q})).optional().describe(`Static filter options`),optionsFrom:mF.optional().describe(`Dynamic filter options from object`),defaultValue:l([r(),P(),S()]).optional().describe(`Default filter value`),scope:E([`dashboard`,`widget`]).default(`dashboard`).describe(`Filter application scope`),targetWidgets:C(r()).optional().describe(`Widget IDs to apply this filter to`)}),gF=h({name:kA.describe(`Dashboard unique name`),label:q.describe(`Dashboard label`),description:q.optional().describe(`Dashboard description`),header:dF.optional().describe(`Dashboard header configuration`),widgets:C(pF).describe(`Widgets to display`),refreshInterval:P().optional().describe(`Auto-refresh interval in seconds`),dateRange:h({field:r().optional().describe(`Default date field name for time-based filtering`),defaultRange:E([`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:S().default(!0).describe(`Allow users to pick a custom date range`)}).optional().describe(`Global dashboard date range filter configuration`),globalFilters:C(hF).optional().describe(`Global filters that apply to all widgets in the dashboard`),aria:eM.optional().describe(`ARIA accessibility attributes`),performance:yP.optional().describe(`Performance optimization settings`)}),Cye={create:e=>gF.parse(e)},_F=E([`tabular`,`summary`,`matrix`,`joined`]),vF=h({field:r().describe(`Field name`),label:q.optional().describe(`Override label`),aggregate:E([`sum`,`avg`,`max`,`min`,`count`,`unique`]).optional().describe(`Aggregation function`),responsive:vP.optional().describe(`Responsive visibility for this column`)}),yF=h({field:r().describe(`Field to group by`),sortOrder:E([`asc`,`desc`]).default(`asc`),dateGranularity:E([`day`,`week`,`month`,`quarter`,`year`]).optional().describe(`For date fields`)}),bF=mP.extend({xAxis:r().describe(`Grouping field for X-Axis`),yAxis:r().describe(`Summary field for Y-Axis`),groupBy:r().optional().describe(`Additional grouping field`)}),xF=h({name:kA.describe(`Report unique name`),label:q.describe(`Report label`),description:q.optional(),objectName:r().describe(`Primary object`),type:_F.default(`tabular`).describe(`Report format type`),columns:C(vF).describe(`Columns to display`),groupingsDown:C(yF).optional().describe(`Row groupings`),groupingsAcross:C(yF).optional().describe(`Column groupings (Matrix only)`),filter:yj.optional().describe(`Filter criteria`),chart:bF.optional().describe(`Embedded chart configuration`),aria:eM.optional().describe(`ARIA accessibility attributes`),performance:yP.optional().describe(`Performance optimization settings`)}),wye={create:e=>xF.parse(e)},SF=h({name:r().describe(`Region name (e.g. "sidebar", "main", "header")`),width:E([`small`,`medium`,`large`,`full`]).optional(),components:C(F(()=>TF)).describe(`Components in this region`)}),CF=E(`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(`.`)),wF=h({object:r().describe(`Object to query`),view:r().optional().describe(`Named view to apply`),filter:yj.optional().describe(`Additional filter criteria`),sort:C(BA).optional().describe(`Sort order`),limit:P().int().positive().optional().describe(`Max records to display`)}),TF=h({type:l([CF,r()]).describe(`Component Type (Standard enum or custom string)`),id:r().optional().describe(`Unique instance ID`),label:q.optional(),properties:d(r(),u()).describe(`Component props passed to the widget. See component.zod.ts for schemas.`),events:d(r(),r()).optional().describe(`Event handlers map`),style:d(r(),r()).optional().describe(`Inline styles or utility classes`),className:r().optional().describe(`CSS class names`),visibility:r().optional().describe(`Visibility filter/formula`),dataSource:wF.optional().describe(`Per-element data binding for multi-object pages`),responsive:vP.optional().describe(`Responsive layout configuration`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),EF=h({name:r().describe(`Variable name`),type:E([`string`,`number`,`boolean`,`object`,`array`,`record_id`]).default(`string`),defaultValue:u().optional(),source:r().optional().describe(`Component ID that writes to this variable`)}),DF=h({componentId:r().describe(`Reference to a PageComponent.id in the page`),x:P().int().min(0).describe(`Grid column position (0-based)`),y:P().int().min(0).describe(`Grid row position (0-based)`),width:P().int().min(1).describe(`Width in grid columns`),height:P().int().min(1).describe(`Height in grid rows`)}),OF=h({columns:P().int().min(1).default(12).describe(`Number of grid columns`),rowHeight:P().int().min(1).default(40).describe(`Height of each grid row in pixels`),gap:P().int().min(0).default(8).describe(`Gap between grid items in pixels`),items:C(DF).describe(`Positioned components on the canvas`)}),kF=E([`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`),AF=h({object:r().describe(`Target object for review`),filter:yj.optional().describe(`Filter criteria for review queue`),sort:C(BA).optional().describe(`Sort order for review queue`),displayFields:C(r()).optional().describe(`Fields to display on the review page`),actions:C(h({label:r().describe(`Action button label`),type:E([`approve`,`reject`,`skip`,`custom`]).describe(`Action type`),field:r().optional().describe(`Field to update on action`),value:l([r(),P(),S()]).optional().describe(`Value to set on action`),nextRecord:S().optional().default(!0).describe(`Auto-advance to next record after action`)})).describe(`Review actions`),navigation:E([`sequential`,`random`,`filtered`]).optional().default(`sequential`).describe(`Record navigation mode`),showProgress:S().optional().default(!0).describe(`Show review progress indicator`)}),jF=h({source:r().optional().describe(`Source object name for the page`),levels:P().int().min(1).optional().describe(`Number of hierarchy levels to display`),filterBy:C(FP).optional().describe(`Page-level filter criteria`),appearance:YP.optional().describe(`Appearance and visualization configuration`),userFilters:h({elements:C(E([`grid`,`gallery`,`kanban`])).optional().describe(`Visualization element types available in user filter bar`),tabs:C(XP).optional().describe(`User-configurable tabs`)}).optional().describe(`User filter configuration`),userActions:JP.optional().describe(`User action toggles`),addRecord:ZP.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at page bottom`),allowPrinting:S().optional().describe(`Allow users to print the page`)}).describe(`Interface-level page configuration (Airtable parity)`),MF=h({name:kA.describe(`Page unique name (lowercase snake_case)`),label:q,description:q.optional(),icon:r().optional().describe(`Page icon name`),type:kF.default(`record`).describe(`Page type`),variables:C(EF).optional().describe(`Local page state variables`),object:r().optional().describe(`Bound object (for Record pages)`),recordReview:AF.optional().describe(`Record review configuration (required when type is "record_review")`),blankLayout:OF.optional().describe(`Free-form grid layout for blank pages (used when type is "blank")`),template:r().default(`default`).describe(`Layout template name (e.g. "header-sidebar-main")`),regions:C(SF).describe(`Defined regions with components`),isDefault:S().default(!1),assignedProfiles:C(r()).optional(),interfaceConfig:jF.optional().describe(`Interface-level page configuration (for Airtable-style interface pages)`),aria:eM.optional().describe(`ARIA accessibility attributes`)}).superRefine((e,t)=>{e.type===`record_review`&&!e.recordReview&&t.addIssue({code:de.custom,path:[`recordReview`],message:`recordReview is required when type is "record_review"`}),e.type===`blank`&&!e.blankLayout&&t.addIssue({code:de.custom,path:[`blankLayout`],message:`blankLayout is required when type is "blank"`})}),NF=h({onMount:r().optional().describe(`Initialization code when widget mounts`),onUpdate:r().optional().describe(`Code to run when props change`),onUnmount:r().optional().describe(`Cleanup code when widget unmounts`),onValidate:r().optional().describe(`Custom validation logic`),onFocus:r().optional().describe(`Code to run on focus`),onBlur:r().optional().describe(`Code to run on blur`),onError:r().optional().describe(`Error handling code`)}),PF=h({name:r().describe(`Event name`),label:q.optional().describe(`Human-readable event label`),description:q.optional().describe(`Event description and usage`),bubbles:S().default(!1).describe(`Whether event bubbles`),cancelable:S().default(!1).describe(`Whether event is cancelable`),payload:d(r(),u()).optional().describe(`Event payload schema`)}),FF=h({name:r().describe(`Property name (camelCase)`),label:q.optional().describe(`Human-readable label`),type:E([`string`,`number`,`boolean`,`array`,`object`,`function`,`any`]).describe(`TypeScript type`),required:S().default(!1).describe(`Whether property is required`),default:u().optional().describe(`Default value`),description:q.optional().describe(`Property description`),validation:d(r(),u()).optional().describe(`Validation rules`),category:r().optional().describe(`Property category`)}),IF=I(`type`,[h({type:m(`npm`),packageName:r().describe(`NPM package name`),version:r().default(`latest`),exportName:r().optional().describe(`Named export (default: default)`)}),h({type:m(`remote`),url:r().url().describe(`Remote entry URL (.js)`),moduleName:r().describe(`Exposed module name`),scope:r().describe(`Remote scope name`)}),h({type:m(`inline`),code:r().describe(`JavaScript code body`)})]),Tye=h({name:kA.describe(`Widget identifier (snake_case)`),label:q.describe(`Widget display name`),description:q.optional().describe(`Widget description`),version:r().optional().describe(`Widget version (semver)`),author:r().optional().describe(`Widget author`),icon:r().optional().describe(`Widget icon`),fieldTypes:C(r()).optional().describe(`Supported field types`),category:E([`input`,`display`,`picker`,`editor`,`custom`]).default(`custom`).describe(`Widget category`),lifecycle:NF.optional().describe(`Lifecycle hooks`),events:C(PF).optional().describe(`Custom events`),properties:C(FF).optional().describe(`Configuration properties`),implementation:IF.optional().describe(`Widget implementation source`),dependencies:C(h({name:r(),version:r().optional(),url:r().url().optional()})).optional().describe(`Widget dependencies`),screenshots:C(r().url()).optional().describe(`Screenshot URLs`),documentation:r().url().optional().describe(`Documentation URL`),license:r().optional().describe(`License (SPDX identifier)`),tags:C(r()).optional().describe(`Tags for categorization`),aria:eM.optional().describe(`ARIA accessibility attributes`),performance:yP.optional().describe(`Performance optimization settings`)}),Eye=h({value:u().describe(`Current field value`),onChange:M().input(w([u()])).output(te()).describe(`Callback to update field value`),readonly:S().default(!1).describe(`Read-only mode flag`),required:S().default(!1).describe(`Required field flag`),error:r().optional().describe(`Validation error message`),field:nj.describe(`Field schema definition`),record:d(r(),u()).optional().describe(`Complete record data`),options:d(r(),u()).optional().describe(`Custom widget options`)}),LF=h({}),RF=h({title:q.describe(`Page title`),subtitle:q.optional().describe(`Page subtitle`),icon:r().optional().describe(`Icon name`),breadcrumb:S().default(!0).describe(`Show breadcrumb`),actions:C(r()).optional().describe(`Action IDs to show in header`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),zF=h({type:E([`line`,`card`,`pill`]).default(`line`),position:E([`top`,`left`]).default(`top`),items:C(h({label:q,icon:r().optional(),children:C(u()).describe(`Child components`)})),aria:eM.optional().describe(`ARIA accessibility attributes`)}),BF=h({title:q.optional(),bordered:S().default(!0),actions:C(r()).optional(),body:C(u()).optional().describe(`Card content components (slot)`),footer:C(u()).optional().describe(`Card footer components (slot)`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),VF=h({columns:E([`1`,`2`,`3`,`4`]).default(`2`).describe(`Number of columns for field layout (1-4)`),layout:E([`auto`,`custom`]).default(`auto`).describe(`Layout mode: auto uses object compactLayout, custom uses explicit sections`),sections:C(r()).optional().describe(`Section IDs to show (required when layout is "custom")`),fields:C(r()).optional().describe(`Explicit field list to display (optional, overrides compactLayout)`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),HF=h({objectName:r().describe(`Related object name (e.g., "task", "opportunity")`),relationshipField:r().describe(`Field on related object that points to this record (e.g., "account_id")`),columns:C(r()).describe(`Fields to display in the related list`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional().describe(`Sort order for related records`),limit:P().int().positive().default(5).describe(`Number of records to display initially`),filter:C(FP).optional().describe(`Additional filter criteria for related records`),title:q.optional().describe(`Custom title for the related list`),showViewAll:S().default(!0).describe(`Show "View All" link to see all related records`),actions:C(r()).optional().describe(`Action IDs available for related records`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),UF=h({fields:C(r()).min(1).max(7).describe(`Key fields to highlight (1-7 fields max, typically displayed as prominent cards)`),layout:E([`horizontal`,`vertical`]).default(`horizontal`).describe(`Layout orientation for highlight fields`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),WF=h({types:C(jN).optional().describe(`Feed item types to show (default: all)`),filterMode:RN.default(`all`).describe(`Default activity filter`),showFilterToggle:S().default(!0).describe(`Show filter dropdown in panel header`),limit:P().int().positive().default(20).describe(`Number of items to load per page`),showCompleted:S().default(!1).describe(`Include completed activities`),unifiedTimeline:S().default(!0).describe(`Mix field changes and comments in one timeline (Airtable style)`),showCommentInput:S().default(!0).describe(`Show "Leave a comment" input at the bottom`),enableMentions:S().default(!0).describe(`Enable @mentions in comments`),enableReactions:S().default(!1).describe(`Enable emoji reactions on feed items`),enableThreading:S().default(!1).describe(`Enable threaded replies on comments`),showSubscriptionToggle:S().default(!0).describe(`Show bell icon for record-level notification subscription`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),GF=h({position:E([`sidebar`,`inline`,`drawer`]).default(`sidebar`).describe(`Where to render the chatter panel`),width:l([r(),P()]).optional().describe(`Panel width (e.g., "350px", "30%")`),collapsible:S().default(!0).describe(`Whether the panel can be collapsed`),defaultCollapsed:S().default(!1).describe(`Whether the panel starts collapsed`),feed:WF.optional().describe(`Embedded activity feed configuration`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),KF=h({statusField:r().describe(`Field name representing the current status/stage`),stages:C(h({value:r(),label:q})).optional().describe(`Explicit stage definitions (if not using field metadata)`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),qF=h({items:C(h({label:q,icon:r().optional(),collapsed:S().default(!1),children:C(u()).describe(`Child components`)})),allowMultiple:S().default(!1).describe(`Allow multiple panels to be expanded simultaneously`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),JF=h({mode:E([`float`,`sidebar`,`inline`]).default(`float`).describe(`Display mode for the chat window`),agentId:r().optional().describe(`Specific AI agent to use`),context:d(r(),u()).optional().describe(`Contextual data to pass to the AI`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),YF=h({content:r().describe(`Text or Markdown content`),variant:E([`heading`,`subheading`,`body`,`caption`]).optional().default(`body`).describe(`Text style variant`),align:E([`left`,`center`,`right`]).optional().default(`left`).describe(`Text alignment`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),XF=h({object:r().describe(`Source object`),field:r().optional().describe(`Field to aggregate`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function`),filter:yj.optional().describe(`Filter criteria`),format:E([`number`,`currency`,`percent`]).optional().describe(`Number display format`),prefix:r().optional().describe(`Prefix text (e.g. "$")`),suffix:r().optional().describe(`Suffix text (e.g. "%")`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),ZF=h({src:r().describe(`Image URL or attachment field`),alt:r().optional().describe(`Alt text for accessibility`),fit:E([`cover`,`contain`,`fill`]).optional().default(`cover`).describe(`Image object-fit mode`),height:P().optional().describe(`Fixed height in pixels`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),QF=h({label:q.describe(`Button display label`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().default(`primary`).describe(`Button visual variant`),size:E([`small`,`medium`,`large`]).optional().default(`medium`).describe(`Button size`),icon:r().optional().describe(`Icon name (Lucide icon)`),iconPosition:E([`left`,`right`]).optional().default(`left`).describe(`Icon position relative to label`),disabled:S().optional().default(!1).describe(`Disable the button`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),$F=h({object:r().describe(`Object to filter`),fields:C(r()).describe(`Filterable field names`),targetVariable:r().optional().describe(`Page variable to store filter state`),layout:E([`inline`,`dropdown`,`sidebar`]).optional().default(`inline`).describe(`Filter display layout`),showSearch:S().optional().default(!0).describe(`Show search input`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),eI=h({object:r().describe(`Object for the form`),fields:C(r()).optional().describe(`Fields to display (defaults to all editable fields)`),mode:E([`create`,`edit`]).optional().default(`create`).describe(`Form mode`),submitLabel:q.optional().describe(`Submit button label`),onSubmit:r().optional().describe(`Action expression on form submit`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),tI=h({object:r().describe(`Object to pick records from`),displayField:r().describe(`Field to display as the record label`),searchFields:C(r()).optional().describe(`Fields to search against`),filter:yj.optional().describe(`Filter criteria for available records`),multiple:S().optional().default(!1).describe(`Allow multiple record selection`),targetVariable:r().optional().describe(`Page variable to bind selected record ID(s)`),placeholder:q.optional().describe(`Placeholder text`),aria:eM.optional().describe(`ARIA accessibility attributes`)}),Dye={"page:header":RF,"page:tabs":zF,"page:card":BF,"page:footer":LF,"page:sidebar":LF,"page:accordion":qF,"page:section":LF,"record:details":VF,"record:related_list":HF,"record:highlights":UF,"record:activity":WF,"record:chatter":GF,"record:path":KF,"app:launcher":LF,"nav:menu":LF,"nav:breadcrumb":LF,"global:search":LF,"global:notifications":LF,"user:profile":LF,"ai:chat_window":JF,"ai:suggestion":h({context:r().optional()}),"element:text":YF,"element:number":XF,"element:image":ZF,"element:divider":LF,"element:button":QF,"element:filter":$F,"element:form":eI,"element:record_picker":tI},nI=h({minWidth:P().default(44).describe(`Minimum touch target width in pixels (WCAG 2.5.5: 44px)`),minHeight:P().default(44).describe(`Minimum touch target height in pixels (WCAG 2.5.5: 44px)`),padding:P().optional().describe(`Additional padding around touch target in pixels`),hitSlop:h({top:P().optional().describe(`Extra hit area above the element`),right:P().optional().describe(`Extra hit area to the right of the element`),bottom:P().optional().describe(`Extra hit area below the element`),left:P().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)`),rI=E([`swipe`,`pinch`,`long_press`,`double_tap`,`drag`,`rotate`,`pan`]).describe(`Touch gesture type`),iI=E([`up`,`down`,`left`,`right`]),aI=h({direction:C(iI).describe(`Allowed swipe directions`),threshold:P().optional().describe(`Minimum distance in pixels to recognize swipe`),velocity:P().optional().describe(`Minimum velocity (px/ms) to trigger swipe`)}).describe(`Swipe gesture recognition settings`),oI=h({minScale:P().optional().describe(`Minimum scale factor (e.g., 0.5 for 50%)`),maxScale:P().optional().describe(`Maximum scale factor (e.g., 3.0 for 300%)`)}).describe(`Pinch/zoom gesture recognition settings`),sI=h({duration:P().default(500).describe(`Hold duration in milliseconds to trigger long press`),moveTolerance:P().optional().describe(`Max movement in pixels allowed during press`)}).describe(`Long press gesture recognition settings`),cI=h({type:rI.describe(`Gesture type to configure`),label:q.optional().describe(`Descriptive label for the gesture action`),enabled:S().default(!0).describe(`Whether this gesture is active`),swipe:aI.optional().describe(`Swipe gesture settings (when type is swipe)`),pinch:oI.optional().describe(`Pinch gesture settings (when type is pinch)`),longPress:sI.optional().describe(`Long press settings (when type is long_press)`)}).describe(`Per-gesture configuration`),Oye=h({gestures:C(cI).optional().describe(`Configured gesture recognizers`),touchTarget:nI.optional().describe(`Touch target sizing and hit area`),hapticFeedback:S().optional().describe(`Enable haptic feedback on touch interactions`)}).merge(eM.partial()).describe(`Touch and gesture interaction configuration`),lI=h({enabled:S().default(!1).describe(`Enable focus trapping within this container`),initialFocus:r().optional().describe(`CSS selector for the element to focus on activation`),returnFocus:S().default(!0).describe(`Return focus to trigger element on deactivation`),escapeDeactivates:S().default(!0).describe(`Allow Escape key to deactivate the focus trap`)}).describe(`Focus trap configuration for modal-like containers`),uI=h({key:r().describe(`Key combination (e.g., "Ctrl+S", "Alt+N", "Escape")`),action:r().describe(`Action identifier to invoke when shortcut is triggered`),description:q.optional().describe(`Human-readable description of what the shortcut does`),scope:E([`global`,`view`,`form`,`modal`,`list`]).default(`global`).describe(`Scope in which this shortcut is active`)}).describe(`Keyboard shortcut binding`),dI=h({tabOrder:E([`auto`,`manual`]).default(`auto`).describe(`Tab order strategy: auto (DOM order) or manual (explicit tabIndex)`),skipLinks:S().default(!1).describe(`Provide skip-to-content navigation links`),focusVisible:S().default(!0).describe(`Show visible focus indicators for keyboard users`),focusTrap:lI.optional().describe(`Focus trap settings`),arrowNavigation:S().default(!1).describe(`Enable arrow key navigation between focusable items`)}).describe(`Focus and tab navigation management`),kye=h({shortcuts:C(uI).optional().describe(`Registered keyboard shortcuts`),focusManagement:dI.optional().describe(`Focus and tab order management`),rovingTabindex:S().default(!1).describe(`Enable roving tabindex pattern for composite widgets`)}).merge(eM.partial()).describe(`Keyboard navigation and shortcut configuration`),fI=h({primary:r().describe(`Primary brand color (hex, rgb, or hsl)`),secondary:r().optional().describe(`Secondary brand color`),accent:r().optional().describe(`Accent color for highlights`),success:r().optional().describe(`Success state color (default: green)`),warning:r().optional().describe(`Warning state color (default: yellow)`),error:r().optional().describe(`Error state color (default: red)`),info:r().optional().describe(`Info state color (default: blue)`),background:r().optional().describe(`Background color`),surface:r().optional().describe(`Surface/card background color`),text:r().optional().describe(`Primary text color`),textSecondary:r().optional().describe(`Secondary text color`),border:r().optional().describe(`Border color`),disabled:r().optional().describe(`Disabled state color`),primaryLight:r().optional().describe(`Lighter shade of primary`),primaryDark:r().optional().describe(`Darker shade of primary`),secondaryLight:r().optional().describe(`Lighter shade of secondary`),secondaryDark:r().optional().describe(`Darker shade of secondary`)}),pI=h({fontFamily:h({base:r().optional().describe(`Base font family (default: system fonts)`),heading:r().optional().describe(`Heading font family`),mono:r().optional().describe(`Monospace font family for code`)}).optional(),fontSize:h({xs:r().optional().describe(`Extra small font size (e.g., 0.75rem)`),sm:r().optional().describe(`Small font size (e.g., 0.875rem)`),base:r().optional().describe(`Base font size (e.g., 1rem)`),lg:r().optional().describe(`Large font size (e.g., 1.125rem)`),xl:r().optional().describe(`Extra large font size (e.g., 1.25rem)`),"2xl":r().optional().describe(`2X large font size (e.g., 1.5rem)`),"3xl":r().optional().describe(`3X large font size (e.g., 1.875rem)`),"4xl":r().optional().describe(`4X large font size (e.g., 2.25rem)`)}).optional(),fontWeight:h({light:P().optional().describe(`Light weight (default: 300)`),normal:P().optional().describe(`Normal weight (default: 400)`),medium:P().optional().describe(`Medium weight (default: 500)`),semibold:P().optional().describe(`Semibold weight (default: 600)`),bold:P().optional().describe(`Bold weight (default: 700)`)}).optional(),lineHeight:h({tight:r().optional().describe(`Tight line height (e.g., 1.25)`),normal:r().optional().describe(`Normal line height (e.g., 1.5)`),relaxed:r().optional().describe(`Relaxed line height (e.g., 1.75)`),loose:r().optional().describe(`Loose line height (e.g., 2)`)}).optional(),letterSpacing:h({tighter:r().optional().describe(`Tighter letter spacing (e.g., -0.05em)`),tight:r().optional().describe(`Tight letter spacing (e.g., -0.025em)`),normal:r().optional().describe(`Normal letter spacing (e.g., 0)`),wide:r().optional().describe(`Wide letter spacing (e.g., 0.025em)`),wider:r().optional().describe(`Wider letter spacing (e.g., 0.05em)`)}).optional()}),mI=h({0:r().optional().describe(`0 spacing (0)`),1:r().optional().describe(`Spacing unit 1 (e.g., 0.25rem)`),2:r().optional().describe(`Spacing unit 2 (e.g., 0.5rem)`),3:r().optional().describe(`Spacing unit 3 (e.g., 0.75rem)`),4:r().optional().describe(`Spacing unit 4 (e.g., 1rem)`),5:r().optional().describe(`Spacing unit 5 (e.g., 1.25rem)`),6:r().optional().describe(`Spacing unit 6 (e.g., 1.5rem)`),8:r().optional().describe(`Spacing unit 8 (e.g., 2rem)`),10:r().optional().describe(`Spacing unit 10 (e.g., 2.5rem)`),12:r().optional().describe(`Spacing unit 12 (e.g., 3rem)`),16:r().optional().describe(`Spacing unit 16 (e.g., 4rem)`),20:r().optional().describe(`Spacing unit 20 (e.g., 5rem)`),24:r().optional().describe(`Spacing unit 24 (e.g., 6rem)`)}),hI=h({none:r().optional().describe(`No border radius (0)`),sm:r().optional().describe(`Small border radius (e.g., 0.125rem)`),base:r().optional().describe(`Base border radius (e.g., 0.25rem)`),md:r().optional().describe(`Medium border radius (e.g., 0.375rem)`),lg:r().optional().describe(`Large border radius (e.g., 0.5rem)`),xl:r().optional().describe(`Extra large border radius (e.g., 0.75rem)`),"2xl":r().optional().describe(`2X large border radius (e.g., 1rem)`),full:r().optional().describe(`Full border radius (50%)`)}),gI=h({none:r().optional().describe(`No shadow`),sm:r().optional().describe(`Small shadow`),base:r().optional().describe(`Base shadow`),md:r().optional().describe(`Medium shadow`),lg:r().optional().describe(`Large shadow`),xl:r().optional().describe(`Extra large shadow`),"2xl":r().optional().describe(`2X large shadow`),inner:r().optional().describe(`Inner shadow (inset)`)}),_I=h({xs:r().optional().describe(`Extra small breakpoint (e.g., 480px)`),sm:r().optional().describe(`Small breakpoint (e.g., 640px)`),md:r().optional().describe(`Medium breakpoint (e.g., 768px)`),lg:r().optional().describe(`Large breakpoint (e.g., 1024px)`),xl:r().optional().describe(`Extra large breakpoint (e.g., 1280px)`),"2xl":r().optional().describe(`2X large breakpoint (e.g., 1536px)`)}),vI=h({duration:h({fast:r().optional().describe(`Fast animation (e.g., 150ms)`),base:r().optional().describe(`Base animation (e.g., 300ms)`),slow:r().optional().describe(`Slow animation (e.g., 500ms)`)}).optional(),timing:h({linear:r().optional().describe(`Linear timing function`),ease:r().optional().describe(`Ease timing function`),ease_in:r().optional().describe(`Ease-in timing function`),ease_out:r().optional().describe(`Ease-out timing function`),ease_in_out:r().optional().describe(`Ease-in-out timing function`)}).optional()}),yI=h({base:P().optional().describe(`Base z-index (e.g., 0)`),dropdown:P().optional().describe(`Dropdown z-index (e.g., 1000)`),sticky:P().optional().describe(`Sticky z-index (e.g., 1020)`),fixed:P().optional().describe(`Fixed z-index (e.g., 1030)`),modalBackdrop:P().optional().describe(`Modal backdrop z-index (e.g., 1040)`),modal:P().optional().describe(`Modal z-index (e.g., 1050)`),popover:P().optional().describe(`Popover z-index (e.g., 1060)`),tooltip:P().optional().describe(`Tooltip z-index (e.g., 1070)`)}),bI=E([`light`,`dark`,`auto`]),Aye=bI,xI=E([`compact`,`regular`,`spacious`]),jye=xI,SI=E([`AA`,`AAA`]),Mye=SI,CI=h({name:kA.describe(`Unique theme identifier (snake_case)`),label:r().describe(`Human-readable theme name`),description:r().optional().describe(`Theme description`),mode:bI.default(`light`).describe(`Theme mode (light, dark, or auto)`),colors:fI.describe(`Color palette configuration`),typography:pI.optional().describe(`Typography settings`),spacing:mI.optional().describe(`Spacing scale`),borderRadius:hI.optional().describe(`Border radius scale`),shadows:gI.optional().describe(`Box shadow effects`),breakpoints:_I.optional().describe(`Responsive breakpoints`),animation:vI.optional().describe(`Animation settings`),zIndex:yI.optional().describe(`Z-index scale for layering`),customVars:d(r(),r()).optional().describe(`Custom CSS variables (key-value pairs)`),logo:h({light:r().optional().describe(`Logo URL for light mode`),dark:r().optional().describe(`Logo URL for dark mode`),favicon:r().optional().describe(`Favicon URL`)}).optional().describe(`Logo assets`),extends:r().optional().describe(`Base theme to extend from`),density:xI.optional().describe(`Display density: compact, regular, or spacious`),wcagContrast:SI.optional().describe(`WCAG color contrast level (AA or AAA)`),rtl:S().optional().describe(`Enable right-to-left layout direction`),touchTarget:nI.optional().describe(`Touch target sizing defaults`),keyboardNavigation:dI.optional().describe(`Keyboard focus management settings`)}),wI=E([`cache_first`,`network_first`,`stale_while_revalidate`,`network_only`,`cache_only`]).describe(`Data fetching strategy for offline/online transitions`),TI=E([`client_wins`,`server_wins`,`manual`,`last_write_wins`]).describe(`How to resolve conflicts when syncing offline changes`),EI=h({strategy:wI.default(`network_first`).describe(`Sync fetch strategy`),conflictResolution:TI.default(`last_write_wins`).describe(`Conflict resolution policy`),retryInterval:P().optional().describe(`Retry interval in milliseconds between sync attempts`),maxRetries:P().optional().describe(`Maximum number of sync retry attempts`),batchSize:P().optional().describe(`Number of mutations to sync per batch`)}).describe(`Offline-to-online synchronization configuration`),DI=E([`indexeddb`,`localstorage`,`sqlite`]).describe(`Client-side storage backend for offline cache`),OI=E([`lru`,`lfu`,`fifo`]).describe(`Cache eviction policy`),kI=h({maxSize:P().optional().describe(`Maximum cache size in bytes`),ttl:P().optional().describe(`Time-to-live for cached entries in milliseconds`),persistStorage:DI.default(`indexeddb`).describe(`Storage backend`),evictionPolicy:OI.default(`lru`).describe(`Cache eviction policy when full`)}).describe(`Client-side offline cache configuration`),Nye=h({enabled:S().default(!1).describe(`Enable offline support`),strategy:wI.default(`network_first`).describe(`Default offline fetch strategy`),cache:kI.optional().describe(`Cache settings for offline data`),sync:EI.optional().describe(`Sync settings for offline mutations`),offlineIndicator:S().default(!0).describe(`Show a visual indicator when offline`),offlineMessage:q.optional().describe(`Customizable offline status message shown to users`),queueMaxSize:P().optional().describe(`Maximum number of queued offline mutations`)}).describe(`Offline support configuration`),AI=E([`fade`,`slide_up`,`slide_down`,`slide_left`,`slide_right`,`scale`,`rotate`,`flip`,`none`]).describe(`Transition preset type`),jI=E([`linear`,`ease`,`ease_in`,`ease_out`,`ease_in_out`,`spring`]).describe(`Animation easing function`),MI=h({preset:AI.optional().describe(`Transition preset to apply`),duration:P().optional().describe(`Transition duration in milliseconds`),easing:jI.optional().describe(`Easing function for the transition`),delay:P().optional().describe(`Delay before transition starts in milliseconds`),customKeyframes:r().optional().describe(`CSS @keyframes name for custom animations`),themeToken:r().optional().describe(`Reference to a theme animation token (e.g. "animation.duration.fast")`)}).describe(`Animation transition configuration`),NI=E([`on_mount`,`on_unmount`,`on_hover`,`on_focus`,`on_click`,`on_scroll`,`on_visible`]).describe(`Event that triggers the animation`),PI=h({label:q.optional().describe(`Descriptive label for this animation configuration`),enter:MI.optional().describe(`Enter/mount animation`),exit:MI.optional().describe(`Exit/unmount animation`),hover:MI.optional().describe(`Hover state animation`),trigger:NI.optional().describe(`When to trigger the animation`),reducedMotion:E([`respect`,`disable`,`alternative`]).default(`respect`).describe(`Accessibility: how to handle prefers-reduced-motion`)}).merge(eM.partial()).describe(`Component-level animation configuration`),FI=h({type:AI.default(`fade`).describe(`Page transition type`),duration:P().default(300).describe(`Transition duration in milliseconds`),easing:jI.default(`ease_in_out`).describe(`Easing function for the transition`),crossFade:S().default(!1).describe(`Whether to cross-fade between pages`)}).describe(`Page-level transition configuration`),Pye=h({label:q.optional().describe(`Descriptive label for the motion configuration`),defaultTransition:MI.optional().describe(`Default transition applied to all animations`),pageTransitions:FI.optional().describe(`Page navigation transition settings`),componentAnimations:d(r(),PI).optional().describe(`Component name to animation configuration mapping`),reducedMotion:S().default(!1).describe(`When true, respect prefers-reduced-motion and suppress animations globally`),enabled:S().default(!0).describe(`Enable or disable all animations globally`)}).describe(`Top-level motion and animation design configuration`),II=E([`toast`,`snackbar`,`banner`,`alert`,`inline`]).describe(`Notification presentation style`),LI=E([`info`,`success`,`warning`,`error`]).describe(`Notification severity level`),RI=E([`top_left`,`top_center`,`top_right`,`bottom_left`,`bottom_center`,`bottom_right`]).describe(`Screen position for notification placement`),zI=h({label:q.describe(`Action button label`),action:r().describe(`Action identifier to execute`),variant:E([`primary`,`secondary`,`link`]).default(`primary`).describe(`Button variant style`)}).describe(`Notification action button`),Fye=h({type:II.default(`toast`).describe(`Notification presentation style`),severity:LI.default(`info`).describe(`Notification severity level`),title:q.optional().describe(`Notification title`),message:q.describe(`Notification message body`),icon:r().optional().describe(`Icon name override`),duration:P().optional().describe(`Auto-dismiss duration in ms, omit for persistent`),dismissible:S().default(!0).describe(`Allow user to dismiss the notification`),actions:C(zI).optional().describe(`Action buttons`),position:RI.optional().describe(`Override default position`)}).merge(eM.partial()).describe(`Notification instance definition`),Iye=h({defaultPosition:RI.default(`top_right`).describe(`Default screen position for notifications`),defaultDuration:P().default(5e3).describe(`Default auto-dismiss duration in ms`),maxVisible:P().default(5).describe(`Maximum number of notifications visible at once`),stackDirection:E([`up`,`down`]).default(`down`).describe(`Stack direction for multiple notifications`),pauseOnHover:S().default(!0).describe(`Pause auto-dismiss timer on hover`)}).describe(`Global notification system configuration`),BI=E([`element`,`handle`,`grip_icon`]).describe(`Drag initiation method`),VI=E([`move`,`copy`,`link`,`none`]).describe(`Drop operation effect`),HI=h({axis:E([`x`,`y`,`both`]).default(`both`).describe(`Constrain drag axis`),bounds:E([`parent`,`viewport`,`none`]).default(`none`).describe(`Constrain within bounds`),grid:w([P(),P()]).optional().describe(`Snap to grid [x, y] in pixels`)}).describe(`Drag movement constraints`),UI=h({label:q.optional().describe(`Accessible label for the drop zone`),accept:C(r()).describe(`Accepted drag item types`),maxItems:P().optional().describe(`Maximum items allowed in drop zone`),highlightOnDragOver:S().default(!0).describe(`Highlight drop zone when dragging over`),dropEffect:VI.default(`move`).describe(`Visual effect on drop`)}).merge(eM.partial()).describe(`Drop zone configuration`),WI=h({type:r().describe(`Drag item type identifier for matching with drop zones`),label:q.optional().describe(`Accessible label describing the draggable item`),handle:BI.default(`element`).describe(`How to initiate drag`),constraint:HI.optional().describe(`Drag movement constraints`),preview:E([`element`,`custom`,`none`]).default(`element`).describe(`Drag preview type`),disabled:S().default(!1).describe(`Disable dragging`)}).merge(eM.partial()).describe(`Draggable item configuration`),Lye=h({enabled:S().default(!1).describe(`Enable drag and drop`),dragItem:WI.optional().describe(`Configuration for draggable item`),dropZone:UI.optional().describe(`Configuration for drop target`),sortable:S().default(!1).describe(`Enable sortable list behavior`),autoScroll:S().default(!0).describe(`Auto-scroll during drag near edges`),touchDelay:P().default(200).describe(`Delay in ms before drag starts on touch devices`)}).describe(`Drag and drop interaction configuration`);DA({},{AccessControlConfigSchema:()=>gL,AddFieldOperation:()=>PR,AdvancedAuthConfigSchema:()=>XR,AnalyzerConfigSchema:()=>CL,AppCompatibilityCheckSchema:()=>Axe,AppInstallRequestSchema:()=>jxe,AppInstallResultSchema:()=>Mxe,AppManifestSchema:()=>kxe,AppTranslationBundleSchema:()=>Nbe,AuditConfigSchema:()=>nbe,AuditEventActorSchema:()=>ML,AuditEventChangeSchema:()=>PL,AuditEventFilterSchema:()=>tbe,AuditEventSchema:()=>ebe,AuditEventSeverity:()=>jL,AuditEventTargetSchema:()=>NL,AuditEventType:()=>AL,AuditFindingSchema:()=>rz,AuditFindingSeveritySchema:()=>tz,AuditFindingStatusSchema:()=>nz,AuditLogConfigSchema:()=>ez,AuditRetentionPolicySchema:()=>FL,AuditScheduleSchema:()=>iz,AuditStorageConfigSchema:()=>LL,AuthConfigSchema:()=>mbe,AuthPluginConfigSchema:()=>GR,AuthProviderConfigSchema:()=>WR,AwarenessEventSchema:()=>Wbe,AwarenessSessionSchema:()=>Hbe,AwarenessUpdateSchema:()=>Ube,AwarenessUserStateSchema:()=>uB,BackupConfigSchema:()=>eL,BackupRetentionSchema:()=>$I,BackupStrategySchema:()=>QI,BatchProgressSchema:()=>Ebe,BatchTask:()=>jbe,BatchTaskSchema:()=>Oz,BucketConfigSchema:()=>yL,CRDTMergeResultSchema:()=>Bbe,CRDTStateSchema:()=>iB,CRDTType:()=>Rbe,CacheAvalanchePreventionSchema:()=>XI,CacheConfigSchema:()=>JI,CacheConsistencySchema:()=>YI,CacheInvalidationSchema:()=>qI,CacheStrategySchema:()=>GI,CacheTierSchema:()=>KI,CacheWarmupSchema:()=>ZI,ChangeImpactSchema:()=>MR,ChangePrioritySchema:()=>AR,ChangeRequestSchema:()=>pbe,ChangeSetSchema:()=>UR,ChangeStatusSchema:()=>jR,ChangeTypeSchema:()=>kR,CollaborationMode:()=>dB,CollaborationSessionConfigSchema:()=>fB,CollaborationSessionSchema:()=>Gbe,CollaborativeCursorSchema:()=>cB,ComplianceAuditRequirementSchema:()=>wR,ComplianceConfigSchema:()=>hbe,ComplianceEncryptionRequirementSchema:()=>TR,ComplianceFrameworkSchema:()=>CR,ConsoleDestinationConfigSchema:()=>UL,ConsumerConfigSchema:()=>sL,CoreServiceName:()=>yB,CounterOperationSchema:()=>zbe,CoverageBreakdownEntrySchema:()=>qz,CreateObjectOperation:()=>LR,CronScheduleSchema:()=>_z,CursorColorPreset:()=>aB,CursorSelectionSchema:()=>sB,CursorStyleSchema:()=>oB,CursorUpdateSchema:()=>Vbe,DEFAULT_SUSPICIOUS_ACTIVITY_RULES:()=>rbe,DataClassificationPolicySchema:()=>OR,DataClassificationSchema:()=>SR,DatabaseLevelIsolationStrategySchema:()=>DB,DatabaseProviderSchema:()=>SB,DeadLetterQueueSchema:()=>cL,DeleteObjectOperation:()=>zR,DeployBundleSchema:()=>Oxe,DeployDiffSchema:()=>Txe,DeployManifestSchema:()=>RB,DeployStatusEnum:()=>wxe,DeployValidationIssueSchema:()=>LB,DeployValidationResultSchema:()=>Dxe,DisasterRecoveryPlanSchema:()=>zye,DistributedCacheConfigSchema:()=>Rye,EmailAndPasswordConfigSchema:()=>JR,EmailTemplateSchema:()=>Az,EmailVerificationConfigSchema:()=>YR,EncryptionAlgorithmSchema:()=>UA,EncryptionConfigSchema:()=>KA,ExecuteSqlOperation:()=>BR,ExtendedLogLevel:()=>VL,ExternalServiceDestinationConfigSchema:()=>KL,FacetConfigSchema:()=>TL,FailoverConfigSchema:()=>nL,FailoverModeSchema:()=>tL,FeatureSchema:()=>vxe,FieldEncryptionSchema:()=>mve,FieldTranslationSchema:()=>Iz,FileDestinationConfigSchema:()=>WL,FileMetadataSchema:()=>uL,GCounterSchema:()=>Qz,GDPRConfigSchema:()=>ZR,HIPAAConfigSchema:()=>QR,HistogramBucketConfigSchema:()=>QL,HttpDestinationConfigSchema:()=>GL,HttpServerConfig:()=>Qye,HttpServerConfigSchema:()=>EL,InAppNotificationSchema:()=>Nz,IncidentCategorySchema:()=>oz,IncidentNotificationMatrixSchema:()=>uz,IncidentNotificationRuleSchema:()=>lz,IncidentResponsePhaseSchema:()=>cz,IncidentResponsePolicySchema:()=>_be,IncidentSchema:()=>gbe,IncidentSeveritySchema:()=>az,IncidentStatusSchema:()=>sz,IntervalScheduleSchema:()=>vz,JobExecutionSchema:()=>Cbe,JobExecutionStatus:()=>Sz,JobSchema:()=>Sbe,KernelServiceMapSchema:()=>dxe,KeyManagementProviderSchema:()=>WA,KeyRotationPolicySchema:()=>GA,LWWRegisterSchema:()=>Zz,LicenseMetricType:()=>OB,LicenseSchema:()=>bxe,LifecycleActionSchema:()=>mL,LifecyclePolicyConfigSchema:()=>vL,LifecyclePolicyRuleSchema:()=>_L,LocaleSchema:()=>Fz,LogDestinationSchema:()=>qL,LogDestinationType:()=>HL,LogEnrichmentConfigSchema:()=>JL,LogEntrySchema:()=>ibe,LogFormat:()=>zL,LogLevel:()=>RL,LoggerConfigSchema:()=>BL,LoggingConfigSchema:()=>obe,MaskingConfigSchema:()=>hve,MaskingRuleSchema:()=>JA,MaskingStrategySchema:()=>qA,MaskingVisibilityRuleSchema:()=>ER,MessageFormatSchema:()=>Vz,MessageQueueConfigSchema:()=>Bye,MessageQueueProviderSchema:()=>aL,MetadataCollectionInfoSchema:()=>exe,MetadataDiffResultSchema:()=>sxe,MetadataExportOptionsSchema:()=>txe,MetadataFallbackStrategySchema:()=>_B,MetadataFormatSchema:()=>hB,MetadataHistoryQueryOptionsSchema:()=>axe,MetadataHistoryQueryResultSchema:()=>oxe,MetadataHistoryRecordSchema:()=>vB,MetadataHistoryRetentionPolicySchema:()=>cxe,MetadataImportOptionsSchema:()=>nxe,MetadataLoadOptionsSchema:()=>Ybe,MetadataLoadResultSchema:()=>Xbe,MetadataLoaderContractSchema:()=>Jbe,MetadataManagerConfigSchema:()=>ixe,MetadataRecordSchema:()=>Kbe,MetadataSaveOptionsSchema:()=>Zbe,MetadataSaveResultSchema:()=>Qbe,MetadataScopeSchema:()=>pB,MetadataSourceSchema:()=>rxe,MetadataStateSchema:()=>mB,MetadataStatsSchema:()=>gB,MetadataWatchEventSchema:()=>$be,MetricAggregationConfigSchema:()=>nR,MetricAggregationType:()=>ZL,MetricDataPointSchema:()=>sbe,MetricDefinitionSchema:()=>eR,MetricExportConfigSchema:()=>aR,MetricLabelsSchema:()=>$L,MetricType:()=>YL,MetricUnit:()=>XL,MetricsConfigSchema:()=>lbe,MiddlewareConfig:()=>$ye,MiddlewareConfigSchema:()=>OL,MiddlewareType:()=>DL,MigrationDependencySchema:()=>HR,MigrationOperationSchema:()=>VR,MigrationPlanSchema:()=>Exe,MigrationStatementSchema:()=>IB,ModifyFieldOperation:()=>FR,MultipartUploadConfigSchema:()=>hL,MutualTLSConfigSchema:()=>KR,NotificationChannelSchema:()=>Pz,NotificationConfigSchema:()=>Mbe,ORSetElementSchema:()=>eB,ORSetSchema:()=>tB,OTComponentSchema:()=>Jz,OTOperationSchema:()=>Yz,OTOperationType:()=>Ibe,OTTransformResultSchema:()=>Lbe,ObjectMetadataSchema:()=>Vye,ObjectStorageConfigSchema:()=>xL,ObjectTranslationDataSchema:()=>Lz,ObjectTranslationNodeSchema:()=>Wz,OnceScheduleSchema:()=>yz,OpenTelemetryCompatibilitySchema:()=>xR,OtelExporterType:()=>bR,PCIDSSConfigSchema:()=>$R,PKG_CONVENTIONS:()=>Nxe,PNCounterSchema:()=>$z,PackagePublishResultSchema:()=>qbe,PlanSchema:()=>yxe,PresignedUrlConfigSchema:()=>Hye,ProvisioningStepSchema:()=>PB,PushNotificationSchema:()=>Mz,QueueConfig:()=>kbe,QueueConfigSchema:()=>Dz,QuotaEnforcementResultSchema:()=>mxe,RPOSchema:()=>rL,RTOSchema:()=>iL,RegistryConfigSchema:()=>xxe,RegistrySyncPolicySchema:()=>kB,RegistryUpstreamSchema:()=>AB,RemoveFieldOperation:()=>IR,RenameObjectOperation:()=>RR,RetryPolicySchema:()=>xz,RollbackPlanSchema:()=>NR,RouteHandlerMetadataSchema:()=>Jye,RowLevelIsolationStrategySchema:()=>TB,SMSTemplateSchema:()=>jz,SamplingDecision:()=>hR,SamplingStrategyType:()=>gR,ScheduleSchema:()=>bz,SchemaChangeSchema:()=>FB,SchemaLevelIsolationStrategySchema:()=>EB,SearchConfigSchema:()=>qye,SearchIndexConfigSchema:()=>wL,SearchProviderSchema:()=>SL,SecurityContextConfigSchema:()=>fbe,SecurityEventCorrelationSchema:()=>DR,ServerCapabilitiesSchema:()=>Xye,ServerEventSchema:()=>Yye,ServerEventType:()=>kL,ServerStatusSchema:()=>Zye,ServiceConfigSchema:()=>fxe,ServiceCriticalitySchema:()=>bB,ServiceLevelIndicatorSchema:()=>rR,ServiceLevelObjectiveSchema:()=>iR,ServiceRequirementDef:()=>lxe,ServiceStatusSchema:()=>uxe,SocialProviderConfigSchema:()=>qR,SpanAttributeValueSchema:()=>dR,SpanAttributesSchema:()=>fR,SpanEventSchema:()=>pR,SpanKind:()=>lR,SpanLinkSchema:()=>mR,SpanSchema:()=>ube,SpanStatus:()=>uR,StorageAclSchema:()=>fL,StorageClassSchema:()=>pL,StorageConnectionSchema:()=>bL,StorageNameMapping:()=>Ixe,StorageProviderSchema:()=>dL,StorageScopeSchema:()=>lL,StructuredLogEntrySchema:()=>abe,SupplierAssessmentStatusSchema:()=>fz,SupplierRiskLevelSchema:()=>dz,SupplierSecurityAssessmentSchema:()=>vbe,SupplierSecurityPolicySchema:()=>ybe,SupplierSecurityRequirementSchema:()=>pz,SuspiciousActivityRuleSchema:()=>IL,SystemFieldName:()=>Fxe,SystemObjectName:()=>Pxe,TASK_PRIORITY_VALUES:()=>wbe,TRANSLATE_PLACEHOLDER:()=>Fbe,Task:()=>Obe,TaskExecutionResultSchema:()=>Tbe,TaskPriority:()=>Cz,TaskRetryPolicySchema:()=>Tz,TaskSchema:()=>Ez,TaskStatus:()=>wz,TenantConnectionConfigSchema:()=>CB,TenantIsolationConfigSchema:()=>gxe,TenantIsolationLevel:()=>xB,TenantPlanSchema:()=>MB,TenantProvisioningRequestSchema:()=>Sxe,TenantProvisioningResultSchema:()=>Cxe,TenantProvisioningStatusEnum:()=>jB,TenantQuotaSchema:()=>wB,TenantRegionSchema:()=>NB,TenantSchema:()=>hxe,TenantSecurityPolicySchema:()=>_xe,TenantUsageSchema:()=>pxe,TextCRDTOperationSchema:()=>nB,TextCRDTStateSchema:()=>rB,TimeSeriesDataPointSchema:()=>tR,TimeSeriesSchema:()=>cbe,TopicConfigSchema:()=>oL,TraceContextPropagationSchema:()=>yR,TraceContextSchema:()=>cR,TraceFlagsSchema:()=>sR,TracePropagationFormat:()=>vR,TraceSamplingConfigSchema:()=>_R,TraceStateSchema:()=>oR,TracingConfigSchema:()=>dbe,TrainingCategorySchema:()=>mz,TrainingCompletionStatusSchema:()=>hz,TrainingCourseSchema:()=>gz,TrainingPlanSchema:()=>xbe,TrainingRecordSchema:()=>bbe,TranslationBundleSchema:()=>zz,TranslationConfigSchema:()=>Hz,TranslationCoverageResultSchema:()=>Pbe,TranslationDataSchema:()=>Rz,TranslationDiffItemSchema:()=>Kz,TranslationDiffStatusSchema:()=>Gz,TranslationFileOrganizationSchema:()=>Bz,UserActivityStatus:()=>lB,VectorClockSchema:()=>Xz,WorkerConfig:()=>Abe,WorkerConfigSchema:()=>kz,WorkerStatsSchema:()=>Dbe,azureBlobStorageExample:()=>Gye,gcsStorageExample:()=>Kye,minioStorageExample:()=>Wye,s3StorageExample:()=>Uye});var GI=E([`lru`,`lfu`,`fifo`,`ttl`,`adaptive`]).describe(`Cache eviction strategy`),KI=h({name:r().describe(`Unique cache tier name`),type:E([`memory`,`redis`,`memcached`,`cdn`]).describe(`Cache backend type`),maxSize:P().optional().describe(`Max size in MB`),ttl:P().default(300).describe(`Default TTL in seconds`),strategy:GI.default(`lru`).describe(`Eviction strategy`),warmup:S().default(!1).describe(`Pre-populate cache on startup`)}).describe(`Configuration for a single cache tier in the hierarchy`),qI=h({trigger:E([`create`,`update`,`delete`,`manual`]).describe(`Event that triggers invalidation`),scope:E([`key`,`pattern`,`tag`,`all`]).describe(`Invalidation scope`),pattern:r().optional().describe(`Key pattern for pattern-based invalidation`),tags:C(r()).optional().describe(`Cache tags to invalidate`)}).describe(`Rule defining when and how cached entries are invalidated`),JI=h({enabled:S().default(!1).describe(`Enable application-level caching`),tiers:C(KI).describe(`Ordered cache tier hierarchy`),invalidation:C(qI).describe(`Cache invalidation rules`),prefetch:S().default(!1).describe(`Enable cache prefetching`),compression:S().default(!1).describe(`Enable data compression in cache`),encryption:S().default(!1).describe(`Enable encryption for cached data`)}).describe(`Top-level application cache configuration`),YI=E([`write_through`,`write_behind`,`write_around`,`refresh_ahead`]).describe(`Distributed cache write consistency strategy`),XI=h({jitterTtl:h({enabled:S().default(!1).describe(`Add random jitter to TTL values`),maxJitterSeconds:P().default(60).describe(`Maximum jitter added to TTL in seconds`)}).optional().describe(`TTL jitter to prevent simultaneous expiration`),circuitBreaker:h({enabled:S().default(!1).describe(`Enable circuit breaker for backend protection`),failureThreshold:P().default(5).describe(`Failures before circuit opens`),resetTimeout:P().default(30).describe(`Seconds before half-open state`)}).optional().describe(`Circuit breaker for backend protection`),lockout:h({enabled:S().default(!1).describe(`Enable cache locking for key regeneration`),lockTimeoutMs:P().default(5e3).describe(`Maximum lock wait time in milliseconds`)}).optional().describe(`Lock-based stampede prevention`)}).describe(`Cache avalanche/stampede prevention configuration`),ZI=h({enabled:S().default(!1).describe(`Enable cache warmup`),strategy:E([`eager`,`lazy`,`scheduled`]).default(`lazy`).describe(`Warmup strategy: eager (at startup), lazy (on first access), scheduled (cron)`),schedule:r().optional().describe(`Cron expression for scheduled warmup`),patterns:C(r()).optional().describe(`Key patterns to warm up (e.g., "user:*", "config:*")`),concurrency:P().default(10).describe(`Maximum concurrent warmup operations`)}).describe(`Cache warmup strategy`),Rye=JI.extend({consistency:YI.optional().describe(`Distributed cache consistency strategy`),avalanchePrevention:XI.optional().describe(`Cache avalanche and stampede prevention`),warmup:ZI.optional().describe(`Cache warmup strategy`)}).describe(`Distributed cache configuration with consistency and avalanche prevention`),QI=E([`full`,`incremental`,`differential`]).describe(`Backup strategy type`),$I=h({days:P().min(1).describe(`Retention period in days`),minCopies:P().min(1).default(3).describe(`Minimum backup copies to retain`),maxCopies:P().optional().describe(`Maximum backup copies to store`)}).describe(`Backup retention policy`),eL=h({strategy:QI.default(`incremental`).describe(`Backup strategy`),schedule:r().optional().describe(`Cron expression for backup schedule (e.g., "0 2 * * *")`),retention:$I.describe(`Backup retention policy`),destination:h({type:E([`s3`,`gcs`,`azure_blob`,`local`]).describe(`Storage backend type`),bucket:r().optional().describe(`Cloud storage bucket/container name`),path:r().optional().describe(`Storage path prefix`),region:r().optional().describe(`Cloud storage region`)}).describe(`Backup storage destination`),encryption:h({enabled:S().default(!0).describe(`Enable backup encryption`),algorithm:E([`AES-256-GCM`,`AES-256-CBC`,`ChaCha20-Poly1305`]).default(`AES-256-GCM`).describe(`Encryption algorithm`),keyId:r().optional().describe(`KMS key ID for encryption`)}).optional().describe(`Backup encryption settings`),compression:h({enabled:S().default(!0).describe(`Enable backup compression`),algorithm:E([`gzip`,`zstd`,`lz4`,`snappy`]).default(`zstd`).describe(`Compression algorithm`)}).optional().describe(`Backup compression settings`),verifyAfterBackup:S().default(!0).describe(`Verify backup integrity after creation`)}).describe(`Backup configuration`),tL=E([`active_passive`,`active_active`,`pilot_light`,`warm_standby`]).describe(`Failover mode`),nL=h({mode:tL.default(`active_passive`).describe(`Failover mode`),autoFailover:S().default(!0).describe(`Enable automatic failover`),healthCheckInterval:P().default(30).describe(`Health check interval in seconds`),failureThreshold:P().default(3).describe(`Consecutive failures before failover`),regions:C(h({name:r().describe(`Region identifier (e.g., "us-east-1", "eu-west-1")`),role:E([`primary`,`secondary`,`witness`]).describe(`Region role`),endpoint:r().optional().describe(`Region endpoint URL`),priority:P().optional().describe(`Failover priority (lower = higher priority)`)})).min(2).describe(`Multi-region configuration (minimum 2 regions)`),dns:h({ttl:P().default(60).describe(`DNS TTL in seconds for failover`),provider:E([`route53`,`cloudflare`,`azure_dns`,`custom`]).optional().describe(`DNS provider for automatic failover`)}).optional().describe(`DNS failover settings`)}).describe(`Failover configuration`),rL=h({value:P().min(0).describe(`RPO value`),unit:E([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RPO time unit`)}).describe(`Recovery Point Objective (maximum acceptable data loss)`),iL=h({value:P().min(0).describe(`RTO value`),unit:E([`seconds`,`minutes`,`hours`]).default(`minutes`).describe(`RTO time unit`)}).describe(`Recovery Time Objective (maximum acceptable downtime)`),zye=h({enabled:S().default(!1).describe(`Enable disaster recovery plan`),rpo:rL.describe(`Recovery Point Objective`),rto:iL.describe(`Recovery Time Objective`),backup:eL.describe(`Backup configuration`),failover:nL.optional().describe(`Multi-region failover configuration`),replication:h({mode:E([`synchronous`,`asynchronous`,`semi_synchronous`]).default(`asynchronous`).describe(`Data replication mode`),maxLagSeconds:P().optional().describe(`Maximum acceptable replication lag in seconds`),includeObjects:C(r()).optional().describe(`Objects to replicate (empty = all)`),excludeObjects:C(r()).optional().describe(`Objects to exclude from replication`)}).optional().describe(`Data replication settings`),testing:h({enabled:S().default(!1).describe(`Enable automated DR testing`),schedule:r().optional().describe(`Cron expression for DR test schedule`),notificationChannel:r().optional().describe(`Notification channel for DR test results`)}).optional().describe(`Automated disaster recovery testing`),runbookUrl:r().optional().describe(`URL to disaster recovery runbook/playbook`),contacts:C(h({name:r().describe(`Contact name`),role:r().describe(`Contact role (e.g., "DBA", "SRE Lead")`),email:r().optional().describe(`Contact email`),phone:r().optional().describe(`Contact phone`)})).optional().describe(`Emergency contact list for DR incidents`)}).describe(`Complete disaster recovery plan configuration`),aL=E([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Supported message queue backend provider`),oL=h({name:r().describe(`Topic name identifier`),partitions:P().default(1).describe(`Number of partitions for parallel consumption`),replicationFactor:P().default(1).describe(`Number of replicas for fault tolerance`),retentionMs:P().optional().describe(`Message retention period in milliseconds`),compressionType:E([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression algorithm`)}).describe(`Configuration for a message queue topic`),sL=h({groupId:r().describe(`Consumer group identifier`),autoOffsetReset:E([`earliest`,`latest`]).default(`latest`).describe(`Where to start reading when no offset exists`),enableAutoCommit:S().default(!0).describe(`Automatically commit consumed offsets`),maxPollRecords:P().default(500).describe(`Maximum records returned per poll`)}).describe(`Consumer group configuration for topic consumption`),cL=h({enabled:S().default(!1).describe(`Enable dead letter queue for failed messages`),maxRetries:P().default(3).describe(`Maximum delivery attempts before sending to DLQ`),queueName:r().describe(`Name of the dead letter queue`)}).describe(`Dead letter queue configuration for unprocessable messages`),Bye=h({provider:aL.describe(`Message queue backend provider`),topics:C(oL).describe(`List of topic configurations`),consumers:C(sL).optional().describe(`Consumer group configurations`),deadLetterQueue:cL.optional().describe(`Dead letter queue for failed messages`),ssl:S().default(!1).describe(`Enable SSL/TLS for broker connections`),sasl:h({mechanism:E([`plain`,`scram-sha-256`,`scram-sha-512`]).describe(`SASL authentication mechanism`),username:r().describe(`SASL username`),password:r().describe(`SASL password`)}).optional().describe(`SASL authentication configuration`)}).describe(`Top-level message queue configuration`),lL=E([`global`,`tenant`,`user`,`session`,`temp`,`cache`,`data`,`logs`,`config`,`public`]).describe(`Storage scope classification`),uL=h({path:r().describe(`File path`),name:r().describe(`File name`),size:P().int().describe(`File size in bytes`),mimeType:r().describe(`MIME type`),lastModified:r().datetime().describe(`Last modified timestamp`),created:r().datetime().describe(`Creation timestamp`),etag:r().optional().describe(`Entity tag`)}),dL=E([`s3`,`azure_blob`,`gcs`,`minio`,`r2`,`spaces`,`wasabi`,`backblaze`,`local`]).describe(`Storage provider type`),fL=E([`private`,`public_read`,`public_read_write`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full_control`]).describe(`Storage access control level`),pL=E([`standard`,`intelligent`,`infrequent_access`,`glacier`,`deep_archive`]).describe(`Storage class/tier for cost optimization`),mL=E([`transition`,`delete`,`abort`]).describe(`Lifecycle policy action type`),Vye=h({contentType:r().describe(`MIME type (e.g., image/jpeg, application/pdf)`),contentLength:P().min(0).describe(`File size in bytes`),contentEncoding:r().optional().describe(`Content encoding (e.g., gzip)`),contentDisposition:r().optional().describe(`Content disposition header`),contentLanguage:r().optional().describe(`Content language`),cacheControl:r().optional().describe(`Cache control directives`),etag:r().optional().describe(`Entity tag for versioning/caching`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),versionId:r().optional().describe(`Object version identifier`),storageClass:pL.optional().describe(`Storage class/tier`),encryption:h({algorithm:r().describe(`Encryption algorithm (e.g., AES256, aws:kms)`),keyId:r().optional().describe(`KMS key ID if using managed encryption`)}).optional().describe(`Server-side encryption configuration`),custom:d(r(),r()).optional().describe(`Custom user-defined metadata`)}),Hye=h({operation:E([`get`,`put`,`delete`,`head`]).describe(`Allowed operation`),expiresIn:P().min(1).max(604800).describe(`Expiration time in seconds (max 7 days)`),contentType:r().optional().describe(`Required content type for PUT operations`),maxSize:P().min(0).optional().describe(`Maximum file size in bytes for PUT operations`),responseContentType:r().optional().describe(`Override content-type for GET operations`),responseContentDisposition:r().optional().describe(`Override content-disposition for GET operations`)}),hL=h({enabled:S().default(!0).describe(`Enable multipart uploads`),partSize:P().min(5*1024*1024).max(5*1024*1024*1024).default(10*1024*1024).describe(`Part size in bytes (min 5MB, max 5GB)`),maxParts:P().min(1).max(1e4).default(1e4).describe(`Maximum number of parts (max 10,000)`),threshold:P().min(0).default(100*1024*1024).describe(`File size threshold to trigger multipart upload (bytes)`),maxConcurrent:P().min(1).max(100).default(4).describe(`Maximum concurrent part uploads`),abortIncompleteAfterDays:P().min(1).optional().describe(`Auto-abort incomplete uploads after N days`)}),gL=h({acl:fL.default(`private`).describe(`Default access control level`),allowedOrigins:C(r()).optional().describe(`CORS allowed origins`),allowedMethods:C(E([`GET`,`PUT`,`POST`,`DELETE`,`HEAD`])).optional().describe(`CORS allowed HTTP methods`),allowedHeaders:C(r()).optional().describe(`CORS allowed headers`),exposeHeaders:C(r()).optional().describe(`CORS exposed headers`),maxAge:P().min(0).optional().describe(`CORS preflight cache duration in seconds`),corsEnabled:S().default(!1).describe(`Enable CORS configuration`),publicAccess:h({allowPublicRead:S().default(!1).describe(`Allow public read access`),allowPublicWrite:S().default(!1).describe(`Allow public write access`),allowPublicList:S().default(!1).describe(`Allow public bucket listing`)}).optional().describe(`Public access control`),allowedIps:C(r()).optional().describe(`Allowed IP addresses/CIDR blocks`),blockedIps:C(r()).optional().describe(`Blocked IP addresses/CIDR blocks`)}),_L=h({id:OA.describe(`Rule identifier`),enabled:S().default(!0).describe(`Enable this rule`),action:mL.describe(`Action to perform`),prefix:r().optional().describe(`Object key prefix filter (e.g., "uploads/")`),tags:d(r(),r()).optional().describe(`Object tag filters`),daysAfterCreation:P().min(0).optional().describe(`Days after object creation`),daysAfterModification:P().min(0).optional().describe(`Days after last modification`),targetStorageClass:pL.optional().describe(`Target storage class for transition action`)}).refine(e=>!(e.action===`transition`&&!e.targetStorageClass),{message:`targetStorageClass is required when action is "transition"`}),vL=h({enabled:S().default(!1).describe(`Enable lifecycle policies`),rules:C(_L).default([]).describe(`Lifecycle rules`)}),yL=h({name:OA.describe(`Bucket identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),bucketName:r().describe(`Actual bucket/container name in storage provider`),region:r().optional().describe(`Storage region (e.g., us-east-1, westus)`),provider:dL.describe(`Storage provider`),endpoint:r().optional().describe(`Custom endpoint URL (for S3-compatible providers)`),pathStyle:S().default(!1).describe(`Use path-style URLs (for S3-compatible providers)`),versioning:S().default(!1).describe(`Enable object versioning`),encryption:h({enabled:S().default(!1).describe(`Enable server-side encryption`),algorithm:E([`AES256`,`aws:kms`,`azure:kms`,`gcp:kms`]).default(`AES256`).describe(`Encryption algorithm`),kmsKeyId:r().optional().describe(`KMS key ID for managed encryption`)}).optional().describe(`Server-side encryption configuration`),accessControl:gL.optional().describe(`Access control configuration`),lifecyclePolicy:vL.optional().describe(`Lifecycle policy configuration`),multipartConfig:hL.optional().describe(`Multipart upload configuration`),tags:d(r(),r()).optional().describe(`Bucket tags for organization`),description:r().optional().describe(`Bucket description`),enabled:S().default(!0).describe(`Enable this bucket`)}),bL=h({accessKeyId:r().optional().describe(`AWS access key ID or MinIO access key`),secretAccessKey:r().optional().describe(`AWS secret access key or MinIO secret key`),sessionToken:r().optional().describe(`AWS session token for temporary credentials`),accountName:r().optional().describe(`Azure storage account name`),accountKey:r().optional().describe(`Azure storage account key`),sasToken:r().optional().describe(`Azure SAS token`),projectId:r().optional().describe(`GCP project ID`),credentials:r().optional().describe(`GCP service account credentials JSON`),endpoint:r().optional().describe(`Custom endpoint URL`),region:r().optional().describe(`Default region`),useSSL:S().default(!0).describe(`Use SSL/TLS for connections`),timeout:P().min(0).optional().describe(`Connection timeout in milliseconds`)}),xL=h({name:OA.describe(`Storage configuration identifier`),label:r().describe(`Display label`),provider:dL.describe(`Primary storage provider`),scope:lL.optional().default(`global`).describe(`Storage scope`),connection:bL.describe(`Connection credentials`),buckets:C(yL).default([]).describe(`Configured buckets`),defaultBucket:r().optional().describe(`Default bucket name for operations`),location:r().optional().describe(`Root path (local) or base location`),quota:P().int().positive().optional().describe(`Max size in bytes`),options:d(r(),u()).optional().describe(`Provider-specific configuration options`),enabled:S().default(!0).describe(`Enable this storage configuration`),description:r().optional().describe(`Configuration description`)}),Uye=xL.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}),Wye=xL.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}),Gye=xL.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}),Kye=xL.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}),SL=E([`elasticsearch`,`algolia`,`meilisearch`,`typesense`,`opensearch`]).describe(`Supported full-text search engine provider`),CL=h({type:E([`standard`,`simple`,`whitespace`,`keyword`,`pattern`,`language`]).describe(`Text analyzer type`),language:r().optional().describe(`Language for language-specific analysis`),stopwords:C(r()).optional().describe(`Custom stopwords to filter during analysis`),customFilters:C(r()).optional().describe(`Additional token filter names to apply`)}).describe(`Text analyzer configuration for index tokenization and normalization`),wL=h({indexName:r().describe(`Name of the search index`),objectName:r().describe(`Source ObjectQL object`),fields:C(h({name:r().describe(`Field name to index`),type:E([`text`,`keyword`,`number`,`date`,`boolean`,`geo`]).describe(`Index field data type`),analyzer:r().optional().describe(`Named analyzer to use for this field`),searchable:S().default(!0).describe(`Include field in full-text search`),filterable:S().default(!1).describe(`Allow filtering on this field`),sortable:S().default(!1).describe(`Allow sorting by this field`),boost:P().default(1).describe(`Relevance boost factor for this field`)})).describe(`Fields to include in the search index`),replicas:P().default(1).describe(`Number of index replicas for availability`),shards:P().default(1).describe(`Number of index shards for distribution`)}).describe(`Search index definition mapping an ObjectQL object to a search engine index`),TL=h({field:r().describe(`Field name to generate facets from`),maxValues:P().default(10).describe(`Maximum number of facet values to return`),sort:E([`count`,`alpha`]).default(`count`).describe(`Facet value sort order`)}).describe(`Faceted search configuration for a single field`),qye=h({provider:SL.describe(`Search engine backend provider`),indexes:C(wL).describe(`Search index definitions`),analyzers:d(r(),CL).optional().describe(`Named text analyzer configurations`),facets:C(TL).optional().describe(`Faceted search configurations`),typoTolerance:S().default(!0).describe(`Enable typo-tolerant search`),synonyms:d(r(),C(r())).optional().describe(`Synonym mappings for search expansion`),ranking:C(E([`typo`,`geo`,`words`,`filters`,`proximity`,`attribute`,`exact`,`custom`])).optional().describe(`Custom ranking rule order`)}).describe(`Top-level full-text search engine configuration`),EL=h({port:P().int().min(1).max(65535).default(3e3).describe(`Port number to listen on`),host:r().default(`0.0.0.0`).describe(`Host address to bind to`),cors:IA.optional().describe(`CORS configuration`),requestTimeout:P().int().default(3e4).describe(`Request timeout in milliseconds`),bodyLimit:r().default(`10mb`).describe(`Maximum request body size`),compression:S().default(!0).describe(`Enable response compression`),security:h({helmet:S().default(!0).describe(`Enable security headers via helmet`),rateLimit:LA.optional().describe(`Global rate limiting configuration`)}).optional().describe(`Security configuration`),static:C(RA).optional().describe(`Static file serving configuration`),trustProxy:S().default(!1).describe(`Trust X-Forwarded-* headers`)}),Jye=h({method:NA.describe(`HTTP method`),path:r().describe(`URL path pattern`),handler:r().describe(`Handler identifier or name`),metadata:h({summary:r().optional().describe(`Route summary for documentation`),description:r().optional().describe(`Route description`),tags:C(r()).optional().describe(`Tags for grouping`),operationId:r().optional().describe(`Unique operation identifier`)}).optional(),security:h({authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:r().optional().describe(`Rate limit policy override`)}).optional()}),DL=E([`authentication`,`authorization`,`logging`,`validation`,`transformation`,`error`,`custom`]),OL=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Middleware name (snake_case)`),type:DL.describe(`Middleware type`),enabled:S().default(!0).describe(`Whether middleware is enabled`),order:P().int().default(100).describe(`Execution order priority`),config:d(r(),u()).optional().describe(`Middleware configuration object`),paths:h({include:C(r()).optional().describe(`Include path patterns (glob)`),exclude:C(r()).optional().describe(`Exclude path patterns (glob)`)}).optional().describe(`Path filtering`)}),kL=E([`starting`,`started`,`stopping`,`stopped`,`request`,`response`,`error`]),Yye=h({type:kL.describe(`Event type`),timestamp:r().datetime().describe(`Event timestamp (ISO 8601)`),data:d(r(),u()).optional().describe(`Event-specific data`)}),Xye=h({httpVersions:C(E([`1.0`,`1.1`,`2.0`,`3.0`])).default([`1.1`]).describe(`Supported HTTP versions`),websocket:S().default(!1).describe(`WebSocket support`),sse:S().default(!1).describe(`Server-Sent Events support`),serverPush:S().default(!1).describe(`HTTP/2 Server Push support`),streaming:S().default(!0).describe(`Response streaming support`),middleware:S().default(!0).describe(`Middleware chain support`),routeParams:S().default(!0).describe(`URL parameter support (/users/:id)`),compression:S().default(!0).describe(`Built-in compression support`)}),Zye=h({state:E([`stopped`,`starting`,`running`,`stopping`,`error`]).describe(`Current server state`),uptime:P().int().optional().describe(`Server uptime in milliseconds`),server:h({port:P().int().describe(`Listening port`),host:r().describe(`Bound host`),url:r().optional().describe(`Full server URL`)}).optional(),connections:h({active:P().int().describe(`Active connections`),total:P().int().describe(`Total connections handled`)}).optional(),requests:h({total:P().int().describe(`Total requests processed`),success:P().int().describe(`Successful requests`),errors:P().int().describe(`Failed requests`)}).optional()}),Qye=Object.assign(EL,{create:e=>e}),$ye=Object.assign(OL,{create:e=>e}),AL=E(`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(`,`)),jL=E([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ML=h({type:E([`user`,`system`,`service`,`api_client`,`integration`]).describe(`Actor type`),id:r().describe(`Actor identifier`),name:r().optional().describe(`Actor display name`),email:r().email().optional().describe(`Actor email address`),ipAddress:r().optional().describe(`Actor IP address`),userAgent:r().optional().describe(`User agent string`)}),NL=h({type:r().describe(`Target type`),id:r().describe(`Target identifier`),name:r().optional().describe(`Target display name`),metadata:d(r(),u()).optional().describe(`Target metadata`)}),PL=h({field:r().describe(`Changed field name`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`)}),ebe=h({id:r().describe(`Audit event ID`),eventType:AL.describe(`Event type`),severity:jL.default(`info`).describe(`Event severity`),timestamp:r().datetime().describe(`Event timestamp`),actor:ML.describe(`Event actor`),target:NL.optional().describe(`Event target`),description:r().describe(`Event description`),changes:C(PL).optional().describe(`List of changes`),result:E([`success`,`failure`,`partial`]).default(`success`).describe(`Action result`),errorMessage:r().optional().describe(`Error message`),tenantId:r().optional().describe(`Tenant identifier`),requestId:r().optional().describe(`Request ID for tracing`),metadata:d(r(),u()).optional().describe(`Additional metadata`),location:h({country:r().optional(),region:r().optional(),city:r().optional()}).optional().describe(`Geographic location`)}),FL=h({retentionDays:P().int().min(1).default(180).describe(`Retention period in days`),archiveAfterRetention:S().default(!0).describe(`Archive logs after retention period`),archiveStorage:h({type:E([`s3`,`gcs`,`azure_blob`,`filesystem`]).describe(`Archive storage type`),endpoint:r().optional().describe(`Storage endpoint URL`),bucket:r().optional().describe(`Storage bucket/container name`),path:r().optional().describe(`Storage path prefix`),credentials:d(r(),u()).optional().describe(`Storage credentials`)}).optional().describe(`Archive storage configuration`),customRetention:d(r(),P().int().positive()).optional().describe(`Custom retention by event type`),minimumRetentionDays:P().int().positive().optional().describe(`Minimum retention for compliance`)}),IL=h({id:r().describe(`Rule identifier`),name:r().describe(`Rule name`),description:r().optional().describe(`Rule description`),enabled:S().default(!0).describe(`Rule enabled status`),eventTypes:C(AL).describe(`Event types to monitor`),condition:h({threshold:P().int().positive().describe(`Event threshold`),windowSeconds:P().int().positive().describe(`Time window in seconds`),groupBy:C(r()).optional().describe(`Grouping criteria`),filters:d(r(),u()).optional().describe(`Additional filters`)}).describe(`Detection condition`),actions:C(E([`alert`,`lock_account`,`block_ip`,`require_mfa`,`log_critical`,`webhook`])).describe(`Actions to take`),alertSeverity:jL.default(`warning`).describe(`Alert severity`),notifications:h({email:C(r().email()).optional().describe(`Email recipients`),slack:r().url().optional().describe(`Slack webhook URL`),webhook:r().url().optional().describe(`Custom webhook URL`)}).optional().describe(`Notification configuration`)}),LL=h({type:E([`database`,`elasticsearch`,`mongodb`,`clickhouse`,`s3`,`gcs`,`azure_blob`,`custom`]).describe(`Storage backend type`),connectionString:r().optional().describe(`Connection string`),config:d(r(),u()).optional().describe(`Storage-specific configuration`),bufferEnabled:S().default(!0).describe(`Enable buffering`),bufferSize:P().int().positive().default(100).describe(`Buffer size`),flushIntervalSeconds:P().int().positive().default(5).describe(`Flush interval in seconds`),compression:S().default(!0).describe(`Enable compression`)}),tbe=h({eventTypes:C(AL).optional().describe(`Event types to include`),severities:C(jL).optional().describe(`Severity levels to include`),actorId:r().optional().describe(`Actor identifier`),tenantId:r().optional().describe(`Tenant identifier`),timeRange:h({from:r().datetime().describe(`Start time`),to:r().datetime().describe(`End time`)}).optional().describe(`Time range filter`),result:E([`success`,`failure`,`partial`]).optional().describe(`Result status`),searchQuery:r().optional().describe(`Search query`),customFilters:d(r(),u()).optional().describe(`Custom filters`)}),nbe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().default(!0).describe(`Enable audit logging`),eventTypes:C(AL).optional().describe(`Event types to audit`),excludeEventTypes:C(AL).optional().describe(`Event types to exclude`),minimumSeverity:jL.default(`info`).describe(`Minimum severity level`),storage:LL.describe(`Storage configuration`),retentionPolicy:FL.optional().describe(`Retention policy`),suspiciousActivityRules:C(IL).default([]).describe(`Suspicious activity rules`),includeSensitiveData:S().default(!1).describe(`Include sensitive data`),redactFields:C(r()).default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`]).describe(`Fields to redact`),logReads:S().default(!1).describe(`Log read operations`),readSamplingRate:P().min(0).max(1).default(.1).describe(`Read sampling rate`),logSystemEvents:S().default(!0).describe(`Log system events`),customHandlers:C(h({eventType:AL.describe(`Event type to handle`),handlerId:r().describe(`Unique identifier for the handler`)})).optional().describe(`Custom event handler references`),compliance:h({standards:C(E([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),immutableLogs:S().default(!0).describe(`Enforce immutable logs`),requireSigning:S().default(!1).describe(`Require log signing`),signingKey:r().optional().describe(`Signing key`)}).optional().describe(`Compliance configuration`)}),rbe=[{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`}],RL=E([`debug`,`info`,`warn`,`error`,`fatal`,`silent`]).describe(`Log severity level`),zL=E([`json`,`text`,`pretty`]).describe(`Log output format`),BL=h({name:r().optional().describe(`Logger name identifier`),level:RL.optional().default(`info`),format:zL.optional().default(`json`),redact:C(r()).optional().default([`password`,`token`,`secret`,`key`]).describe(`Keys to redact from log context`),sourceLocation:S().optional().default(!1).describe(`Include file and line number`),file:r().optional().describe(`Path to log file`),rotation:h({maxSize:r().optional().default(`10m`),maxFiles:P().optional().default(5)}).optional()}),ibe=h({timestamp:r().datetime().describe(`ISO 8601 timestamp`),level:RL,message:r().describe(`Log message`),context:d(r(),u()).optional().describe(`Structured context data`),error:d(r(),u()).optional().describe(`Error object if present`),traceId:r().optional().describe(`Distributed trace ID`),spanId:r().optional().describe(`Span ID`),service:r().optional().describe(`Service name`),component:r().optional().describe(`Component name (e.g. plugin id)`)}),VL=E([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]).describe(`Extended log severity level`),HL=E([`console`,`file`,`syslog`,`elasticsearch`,`cloudwatch`,`stackdriver`,`azure_monitor`,`datadog`,`splunk`,`loki`,`http`,`kafka`,`redis`,`custom`]).describe(`Log destination type`),UL=h({stream:E([`stdout`,`stderr`]).optional().default(`stdout`),colors:S().optional().default(!0),prettyPrint:S().optional().default(!1)}).describe(`Console destination configuration`),WL=h({path:r().describe(`Log file path`),rotation:h({maxSize:r().optional().default(`10m`),maxFiles:P().int().positive().optional().default(5),compress:S().optional().default(!0),interval:E([`hourly`,`daily`,`weekly`,`monthly`]).optional()}).optional(),encoding:r().optional().default(`utf8`),append:S().optional().default(!0)}).describe(`File destination configuration`),GL=h({url:r().url().describe(`HTTP endpoint URL`),method:E([`POST`,`PUT`]).optional().default(`POST`),headers:d(r(),r()).optional(),auth:h({type:E([`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional(),apiKeyHeader:r().optional().default(`X-API-Key`)}).optional(),batch:h({maxSize:P().int().positive().optional().default(100),flushInterval:P().int().positive().optional().default(5e3)}).optional(),retry:h({maxAttempts:P().int().positive().optional().default(3),initialDelay:P().int().positive().optional().default(1e3),backoffMultiplier:P().positive().optional().default(2)}).optional(),timeout:P().int().positive().optional().default(3e4)}).describe(`HTTP destination configuration`),KL=h({endpoint:r().url().optional(),region:r().optional(),credentials:h({accessKeyId:r().optional(),secretAccessKey:r().optional(),apiKey:r().optional(),projectId:r().optional()}).optional(),logGroup:r().optional(),logStream:r().optional(),index:r().optional(),config:d(r(),u()).optional()}).describe(`External service destination configuration`),qL=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Destination name (snake_case)`),type:HL.describe(`Destination type`),level:VL.optional().default(`info`),enabled:S().optional().default(!0),console:UL.optional(),file:WL.optional(),http:GL.optional(),externalService:KL.optional(),format:E([`json`,`text`,`pretty`]).optional().default(`json`),filterId:r().optional().describe(`Filter function identifier`)}).describe(`Log destination configuration`),JL=h({staticFields:d(r(),u()).optional().describe(`Static fields added to every log`),dynamicEnrichers:C(r()).optional().describe(`Dynamic enricher function IDs`),addHostname:S().optional().default(!0),addProcessId:S().optional().default(!0),addEnvironment:S().optional().default(!0),addTimestampFormats:h({unix:S().optional().default(!1),iso:S().optional().default(!0)}).optional(),addCaller:S().optional().default(!1),addCorrelationIds:S().optional().default(!0)}).describe(`Log enrichment configuration`),abe=h({timestamp:r().datetime().describe(`ISO 8601 timestamp`),level:VL.describe(`Log severity level`),message:r().describe(`Log message`),context:d(r(),u()).optional().describe(`Structured context`),error:h({name:r().optional(),message:r().optional(),stack:r().optional(),code:r().optional(),details:d(r(),u()).optional()}).optional().describe(`Error details`),trace:h({traceId:r().describe(`Trace ID`),spanId:r().describe(`Span ID`),parentSpanId:r().optional().describe(`Parent span ID`),traceFlags:P().int().optional().describe(`Trace flags`)}).optional().describe(`Distributed tracing context`),source:h({service:r().optional().describe(`Service name`),component:r().optional().describe(`Component name`),file:r().optional().describe(`Source file`),line:P().int().optional().describe(`Line number`),function:r().optional().describe(`Function name`)}).optional().describe(`Source information`),host:h({hostname:r().optional(),pid:P().int().optional(),ip:r().optional()}).optional().describe(`Host information`),environment:r().optional().describe(`Environment (e.g., production, staging)`),user:h({id:r().optional(),username:r().optional(),email:r().optional()}).optional().describe(`User context`),request:h({id:r().optional(),method:r().optional(),path:r().optional(),userAgent:r().optional(),ip:r().optional()}).optional().describe(`Request context`),labels:d(r(),r()).optional().describe(`Custom labels`),metadata:d(r(),u()).optional().describe(`Additional metadata`)}).describe(`Structured log entry`),obe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),level:VL.optional().default(`info`),default:BL.optional().describe(`Default logger configuration`),loggers:d(r(),BL).optional().describe(`Named logger configurations`),destinations:C(qL).describe(`Log destinations`),enrichment:JL.optional(),redact:C(r()).optional().default([`password`,`passwordHash`,`token`,`apiKey`,`secret`,`creditCard`,`ssn`,`authorization`]).describe(`Fields to redact`),sampling:h({enabled:S().optional().default(!1),rate:P().min(0).max(1).optional().default(1),rateByLevel:d(r(),P().min(0).max(1)).optional()}).optional(),buffer:h({enabled:S().optional().default(!0),size:P().int().positive().optional().default(1e3),flushInterval:P().int().positive().optional().default(1e3),flushOnShutdown:S().optional().default(!0)}).optional(),performance:h({async:S().optional().default(!0),workers:P().int().positive().optional().default(1)}).optional()}).describe(`Logging configuration`),YL=E([`counter`,`gauge`,`histogram`,`summary`]).describe(`Metric type`),XL=E([`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`),ZL=E([`sum`,`avg`,`min`,`max`,`count`,`p50`,`p75`,`p90`,`p95`,`p99`,`p999`,`rate`,`stddev`]).describe(`Metric aggregation type`),QL=h({type:E([`linear`,`exponential`,`explicit`]).describe(`Bucket type`),linear:h({start:P().describe(`Start value`),width:P().positive().describe(`Bucket width`),count:P().int().positive().describe(`Number of buckets`)}).optional(),exponential:h({start:P().positive().describe(`Start value`),factor:P().positive().describe(`Growth factor`),count:P().int().positive().describe(`Number of buckets`)}).optional(),explicit:h({boundaries:C(P()).describe(`Bucket boundaries`)}).optional()}).describe(`Histogram bucket configuration`),$L=d(r(),r()).describe(`Metric labels`),eR=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Metric name (snake_case)`),label:r().optional().describe(`Display label`),type:YL.describe(`Metric type`),unit:XL.optional().describe(`Metric unit`),description:r().optional().describe(`Metric description`),labelNames:C(r()).optional().default([]).describe(`Label names`),histogram:QL.optional(),summary:h({quantiles:C(P().min(0).max(1)).optional().default([.5,.9,.99]),maxAge:P().int().positive().optional().default(600),ageBuckets:P().int().positive().optional().default(5)}).optional(),enabled:S().optional().default(!0)}).describe(`Metric definition`),sbe=h({name:r().describe(`Metric name`),type:YL.describe(`Metric type`),timestamp:r().datetime().describe(`Observation timestamp`),value:P().optional().describe(`Metric value`),labels:$L.optional().describe(`Metric labels`),histogram:h({count:P().int().nonnegative().describe(`Total count`),sum:P().describe(`Sum of all values`),buckets:C(h({upperBound:P().describe(`Upper bound of bucket`),count:P().int().nonnegative().describe(`Count in bucket`)})).describe(`Histogram buckets`)}).optional(),summary:h({count:P().int().nonnegative().describe(`Total count`),sum:P().describe(`Sum of all values`),quantiles:C(h({quantile:P().min(0).max(1).describe(`Quantile (0-1)`),value:P().describe(`Quantile value`)})).describe(`Summary quantiles`)}).optional()}).describe(`Metric data point`),tR=h({timestamp:r().datetime().describe(`Timestamp`),value:P().describe(`Value`),labels:d(r(),r()).optional().describe(`Labels`)}).describe(`Time series data point`),cbe=h({name:r().describe(`Series name`),labels:d(r(),r()).optional().describe(`Series labels`),dataPoints:C(tR).describe(`Data points`),startTime:r().datetime().optional().describe(`Start time`),endTime:r().datetime().optional().describe(`End time`)}).describe(`Time series`),nR=h({type:ZL.describe(`Aggregation type`),window:h({size:P().int().positive().describe(`Window size in seconds`),sliding:S().optional().default(!1),slideInterval:P().int().positive().optional()}).optional(),groupBy:C(r()).optional().describe(`Group by label names`),filters:d(r(),u()).optional().describe(`Filter criteria`)}).describe(`Metric aggregation configuration`),rR=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLI name (snake_case)`),label:r().describe(`Display label`),description:r().optional().describe(`SLI description`),metric:r().describe(`Base metric name`),type:E([`availability`,`latency`,`throughput`,`error_rate`,`saturation`,`custom`]).describe(`SLI type`),successCriteria:h({threshold:P().describe(`Threshold value`),operator:E([`lt`,`lte`,`gt`,`gte`,`eq`]).describe(`Comparison operator`),percentile:P().min(0).max(1).optional().describe(`Percentile (0-1)`)}).describe(`Success criteria`),window:h({size:P().int().positive().describe(`Window size in seconds`),rolling:S().optional().default(!0)}).describe(`Measurement window`),enabled:S().optional().default(!0)}).describe(`Service Level Indicator`),iR=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`SLO name (snake_case)`),label:r().describe(`Display label`),description:r().optional().describe(`SLO description`),sli:r().describe(`SLI name`),target:P().min(0).max(100).describe(`Target percentage`),period:h({type:E([`rolling`,`calendar`]).describe(`Period type`),duration:P().int().positive().optional().describe(`Duration in seconds`),calendar:E([`daily`,`weekly`,`monthly`,`quarterly`,`yearly`]).optional()}).describe(`Time period`),errorBudget:h({enabled:S().optional().default(!0),alertThreshold:P().min(0).max(100).optional().default(80),burnRateWindows:C(h({window:P().int().positive().describe(`Window size`),threshold:P().positive().describe(`Burn rate threshold`)})).optional()}).optional(),alerts:C(h({name:r().describe(`Alert name`),severity:E([`info`,`warning`,`critical`]).describe(`Alert severity`),condition:h({type:E([`slo_breach`,`error_budget`,`burn_rate`]).describe(`Condition type`),threshold:P().optional().describe(`Threshold value`)}).describe(`Alert condition`)})).optional().default([]),enabled:S().optional().default(!0)}).describe(`Service Level Objective`),aR=h({type:E([`prometheus`,`openmetrics`,`graphite`,`statsd`,`influxdb`,`datadog`,`cloudwatch`,`stackdriver`,`azure_monitor`,`http`,`custom`]).describe(`Export type`),endpoint:r().optional().describe(`Export endpoint`),interval:P().int().positive().optional().default(60),batch:h({enabled:S().optional().default(!0),size:P().int().positive().optional().default(1e3)}).optional(),auth:h({type:E([`none`,`basic`,`bearer`,`api_key`]).describe(`Auth type`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional()}).optional(),config:d(r(),u()).optional().describe(`Additional configuration`)}).describe(`Metric export configuration`),lbe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),metrics:C(eR).optional().default([]),defaultLabels:$L.optional().default({}),aggregations:C(nR).optional().default([]),slis:C(rR).optional().default([]),slos:C(iR).optional().default([]),exports:C(aR).optional().default([]),collectionInterval:P().int().positive().optional().default(15),retention:h({period:P().int().positive().optional().default(604800),downsampling:C(h({afterSeconds:P().int().positive().describe(`Downsample after seconds`),resolution:P().int().positive().describe(`Downsampled resolution`)})).optional()}).optional(),cardinalityLimits:h({maxLabelCombinations:P().int().positive().optional().default(1e4),onLimitExceeded:E([`drop`,`sample`,`alert`]).optional().default(`alert`)}).optional()}).describe(`Metrics configuration`),oR=h({entries:d(r(),r()).describe(`Trace state entries`)}).describe(`Trace state`),sR=P().int().min(0).max(255).describe(`Trace flags bitmap`),cR=h({traceId:r().regex(/^[0-9a-f]{32}$/).describe(`Trace ID (32 hex chars)`),spanId:r().regex(/^[0-9a-f]{16}$/).describe(`Span ID (16 hex chars)`),traceFlags:sR.optional().default(1),traceState:oR.optional(),parentSpanId:r().regex(/^[0-9a-f]{16}$/).optional().describe(`Parent span ID (16 hex chars)`),sampled:S().optional().default(!0),remote:S().optional().default(!1)}).describe(`Trace context (W3C Trace Context)`),lR=E([`internal`,`server`,`client`,`producer`,`consumer`]).describe(`Span kind`),uR=E([`unset`,`ok`,`error`]).describe(`Span status`),dR=l([r(),P(),S(),C(r()),C(P()),C(S())]).describe(`Span attribute value`),fR=d(r(),dR).describe(`Span attributes`),pR=h({name:r().describe(`Event name`),timestamp:r().datetime().describe(`Event timestamp`),attributes:fR.optional().describe(`Event attributes`)}).describe(`Span event`),mR=h({context:cR.describe(`Linked trace context`),attributes:fR.optional().describe(`Link attributes`)}).describe(`Span link`),ube=h({context:cR.describe(`Trace context`),name:r().describe(`Span name`),kind:lR.optional().default(`internal`),startTime:r().datetime().describe(`Span start time`),endTime:r().datetime().optional().describe(`Span end time`),duration:P().nonnegative().optional().describe(`Duration in milliseconds`),status:h({code:uR.describe(`Status code`),message:r().optional().describe(`Status message`)}).optional(),attributes:fR.optional().default({}),events:C(pR).optional().default([]),links:C(mR).optional().default([]),resource:fR.optional().describe(`Resource attributes`),instrumentationLibrary:h({name:r().describe(`Library name`),version:r().optional().describe(`Library version`)}).optional()}).describe(`OpenTelemetry span`),hR=E([`drop`,`record_only`,`record_and_sample`]).describe(`Sampling decision`),gR=E([`always_on`,`always_off`,`trace_id_ratio`,`rate_limiting`,`parent_based`,`probability`,`composite`,`custom`]).describe(`Sampling strategy type`),_R=h({type:gR.describe(`Sampling strategy`),ratio:P().min(0).max(1).optional().describe(`Sample ratio (0-1)`),rateLimit:P().positive().optional().describe(`Traces per second`),parentBased:h({whenParentSampled:gR.optional().default(`always_on`),whenParentNotSampled:gR.optional().default(`always_off`),root:gR.optional().default(`trace_id_ratio`),rootRatio:P().min(0).max(1).optional().default(.1)}).optional(),composite:C(h({strategy:gR.describe(`Strategy type`),ratio:P().min(0).max(1).optional(),condition:d(r(),u()).optional().describe(`Condition for this strategy`)})).optional(),rules:C(h({name:r().describe(`Rule name`),match:h({service:r().optional(),spanName:r().optional(),attributes:d(r(),u()).optional()}).optional(),decision:hR.describe(`Sampling decision`),rate:P().min(0).max(1).optional()})).optional().default([]),customSamplerId:r().optional().describe(`Custom sampler identifier`)}).describe(`Trace sampling configuration`),vR=E([`w3c`,`b3`,`b3_multi`,`jaeger`,`xray`,`ottrace`,`custom`]).describe(`Trace propagation format`),yR=h({formats:C(vR).optional().default([`w3c`]),extract:S().optional().default(!0),inject:S().optional().default(!0),headers:h({traceId:r().optional(),spanId:r().optional(),traceFlags:r().optional(),traceState:r().optional()}).optional(),baggage:h({enabled:S().optional().default(!0),maxSize:P().int().positive().optional().default(8192),allowedKeys:C(r()).optional()}).optional()}).describe(`Trace context propagation`),bR=E([`otlp_http`,`otlp_grpc`,`jaeger`,`zipkin`,`console`,`datadog`,`honeycomb`,`lightstep`,`newrelic`,`custom`]).describe(`OpenTelemetry exporter type`),xR=h({sdkVersion:r().optional().describe(`OTel SDK version`),exporter:h({type:bR.describe(`Exporter type`),endpoint:r().url().optional().describe(`Exporter endpoint`),protocol:r().optional().describe(`Protocol version`),headers:d(r(),r()).optional().describe(`HTTP headers`),timeout:P().int().positive().optional().default(1e4),compression:E([`none`,`gzip`]).optional().default(`none`),batch:h({maxBatchSize:P().int().positive().optional().default(512),maxQueueSize:P().int().positive().optional().default(2048),exportTimeout:P().int().positive().optional().default(3e4),scheduledDelay:P().int().positive().optional().default(5e3)}).optional()}).describe(`Exporter configuration`),resource:h({serviceName:r().describe(`Service name`),serviceVersion:r().optional().describe(`Service version`),serviceInstanceId:r().optional().describe(`Service instance ID`),serviceNamespace:r().optional().describe(`Service namespace`),deploymentEnvironment:r().optional().describe(`Deployment environment`),attributes:fR.optional().describe(`Additional resource attributes`)}).describe(`Resource attributes`),instrumentation:h({autoInstrumentation:S().optional().default(!0),libraries:C(r()).optional().describe(`Enabled libraries`),disabledLibraries:C(r()).optional().describe(`Disabled libraries`)}).optional(),semanticConventionsVersion:r().optional().describe(`Semantic conventions version`)}).describe(`OpenTelemetry compatibility configuration`),dbe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).max(64).describe(`Configuration name (snake_case, max 64 chars)`),label:r().describe(`Display label`),enabled:S().optional().default(!0),sampling:_R.optional().default({type:`always_on`,rules:[]}),propagation:yR.optional().default({formats:[`w3c`],extract:!0,inject:!0}),openTelemetry:xR.optional(),spanLimits:h({maxAttributes:P().int().positive().optional().default(128),maxEvents:P().int().positive().optional().default(128),maxLinks:P().int().positive().optional().default(128),maxAttributeValueLength:P().int().positive().optional().default(4096)}).optional(),traceIdGenerator:E([`random`,`uuid`,`custom`]).optional().default(`random`),customTraceIdGeneratorId:r().optional().describe(`Custom generator identifier`),performance:h({asyncExport:S().optional().default(!0),exportInterval:P().int().positive().optional().default(5e3)}).optional()}).describe(`Tracing configuration`),SR=E([`pii`,`phi`,`pci`,`financial`,`confidential`,`internal`,`public`]).describe(`Data classification level`),CR=E([`gdpr`,`hipaa`,`sox`,`pci_dss`,`ccpa`,`iso27001`]).describe(`Compliance framework identifier`),wR=h({framework:CR.describe(`Compliance framework identifier`),requiredEvents:C(r()).describe(`Audit event types required by this framework (e.g., "data.delete", "auth.login")`),retentionDays:P().min(1).describe(`Minimum audit log retention period required by this framework (in days)`),alertOnMissing:S().default(!0).describe(`Raise alert if a required audit event is not being captured`)}).describe(`Compliance framework audit event requirements`),TR=h({framework:CR.describe(`Compliance framework identifier`),dataClassifications:C(SR).describe(`Data classifications that must be encrypted under this framework`),minimumAlgorithm:E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).default(`aes-256-gcm`).describe(`Minimum encryption algorithm strength required`),keyRotationMaxDays:P().min(1).default(90).describe(`Maximum key rotation interval required (in days)`)}).describe(`Compliance framework encryption requirements`),ER=h({dataClassification:SR.describe(`Data classification this rule applies to`),defaultMasked:S().default(!0).describe(`Whether data is masked by default`),unmaskRoles:C(r()).optional().describe(`Roles allowed to view unmasked data`),auditUnmask:S().default(!0).describe(`Log an audit event when data is unmasked`),requireApproval:S().default(!1).describe(`Require explicit approval before unmasking`),approvalRoles:C(r()).optional().describe(`Roles that can approve unmasking requests`)}).describe(`Masking visibility and audit rule per data classification`),DR=h({enabled:S().default(!0).describe(`Enable cross-subsystem security event correlation`),correlationId:S().default(!0).describe(`Inject a shared correlation ID into audit, encryption, and masking events`),linkAuthToAudit:S().default(!0).describe(`Link authentication events to subsequent data operation audit trails`),linkEncryptionToAudit:S().default(!0).describe(`Log encryption/decryption operations in the audit trail`),linkMaskingToAudit:S().default(!0).describe(`Log masking/unmasking operations in the audit trail`)}).describe(`Cross-subsystem security event correlation configuration`),OR=h({classification:SR.describe(`Data classification level`),requireEncryption:S().default(!1).describe(`Encryption required for this classification`),requireMasking:S().default(!1).describe(`Masking required for this classification`),requireAudit:S().default(!1).describe(`Audit trail required for access to this classification`),retentionDays:P().optional().describe(`Data retention limit in days (for compliance)`)}).describe(`Security policy for a specific data classification level`),fbe=h({enabled:S().default(!0).describe(`Enable unified security context governance`),complianceAuditRequirements:C(wR).optional().describe(`Compliance-driven audit event requirements`),complianceEncryptionRequirements:C(TR).optional().describe(`Compliance-driven encryption requirements by data classification`),maskingVisibility:C(ER).optional().describe(`Masking visibility rules per data classification`),dataClassifications:C(OR).optional().describe(`Data classification policies for unified security enforcement`),eventCorrelation:DR.optional().describe(`Cross-subsystem security event correlation settings`),enforceOnWrite:S().default(!0).describe(`Enforce encryption and masking requirements on data write operations`),enforceOnRead:S().default(!0).describe(`Enforce masking and audit requirements on data read operations`),failOpen:S().default(!1).describe(`When false (default), deny access if security context cannot be evaluated`)}).describe(`Unified security context governance configuration`),kR=E([`standard`,`normal`,`emergency`,`major`]),AR=E([`critical`,`high`,`medium`,`low`]),jR=E([`draft`,`submitted`,`in-review`,`approved`,`scheduled`,`in-progress`,`completed`,`failed`,`rolled-back`,`cancelled`]),MR=h({level:E([`low`,`medium`,`high`,`critical`]).describe(`Impact level`),affectedSystems:C(r()).describe(`Affected systems`),affectedUsers:P().optional().describe(`Affected user count`),downtime:h({required:S().describe(`Downtime required`),durationMinutes:P().optional().describe(`Downtime duration`)}).optional().describe(`Downtime information`)}),NR=h({description:r().describe(`Rollback description`),steps:C(h({order:P().describe(`Step order`),description:r().describe(`Step description`),estimatedMinutes:P().describe(`Estimated duration`)})).describe(`Rollback steps`),testProcedure:r().optional().describe(`Test procedure`)}),pbe=h({id:r().describe(`Change request ID`),title:r().describe(`Change title`),description:r().describe(`Change description`),type:kR.describe(`Change type`),priority:AR.describe(`Change priority`),status:jR.describe(`Change status`),requestedBy:r().describe(`Requester user ID`),requestedAt:P().describe(`Request timestamp`),impact:MR.describe(`Impact assessment`),implementation:h({description:r().describe(`Implementation description`),steps:C(h({order:P().describe(`Step order`),description:r().describe(`Step description`),estimatedMinutes:P().describe(`Estimated duration`)})).describe(`Implementation steps`),testing:r().optional().describe(`Testing procedure`)}).describe(`Implementation plan`),rollbackPlan:NR.describe(`Rollback plan`),schedule:h({plannedStart:P().describe(`Planned start time`),plannedEnd:P().describe(`Planned end time`),actualStart:P().optional().describe(`Actual start time`),actualEnd:P().optional().describe(`Actual end time`)}).optional().describe(`Schedule`),securityImpact:h({assessed:S().describe(`Whether security impact has been assessed`),riskLevel:E([`none`,`low`,`medium`,`high`,`critical`]).optional().describe(`Security risk level`),affectedDataClassifications:C(SR).optional().describe(`Affected data classifications`),requiresSecurityApproval:S().default(!1).describe(`Whether security team approval is required`),reviewedBy:r().optional().describe(`Security reviewer user ID`),reviewedAt:P().optional().describe(`Security review timestamp`),reviewNotes:r().optional().describe(`Security review notes or conditions`)}).optional().describe(`Security impact assessment per ISO 27001:2022 A.8.32`),approval:h({required:S().describe(`Approval required`),approvers:C(h({userId:r().describe(`Approver user ID`),approvedAt:P().optional().describe(`Approval timestamp`),comments:r().optional().describe(`Approver comments`)})).describe(`Approvers`)}).optional().describe(`Approval workflow`),attachments:C(h({name:r().describe(`Attachment name`),url:r().url().describe(`Attachment URL`)})).optional().describe(`Attachments`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs for extensibility`)}),PR=h({type:m(`add_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to add`),field:nj.describe(`Full field definition to add`)}).describe(`Add a new field to an existing object`),FR=h({type:m(`modify_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to modify`),changes:d(r(),u()).describe(`Partial field definition updates`)}).describe(`Modify properties of an existing field`),IR=h({type:m(`remove_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to remove`)}).describe(`Remove a field from an existing object`),LR=h({type:m(`create_object`),object:gM.describe(`Full object definition to create`)}).describe(`Create a new object`),RR=h({type:m(`rename_object`),oldName:r().describe(`Current object name`),newName:r().describe(`New object name`)}).describe(`Rename an existing object`),zR=h({type:m(`delete_object`),objectName:r().describe(`Name of the object to delete`)}).describe(`Delete an existing object`),BR=h({type:m(`execute_sql`),sql:r().describe(`Raw SQL statement to execute`),description:r().optional().describe(`Human-readable description of the SQL`)}).describe(`Execute a raw SQL statement`),VR=I(`type`,[PR,FR,IR,LR,RR,zR,BR]),HR=h({migrationId:r().describe(`ID of the migration this depends on`),package:r().optional().describe(`Package that owns the dependency migration`)}).describe(`Dependency reference to another migration that must run first`),UR=h({id:r().uuid().describe(`Unique identifier for this change set`),name:r().describe(`Human readable name for the migration`),description:r().optional().describe(`Detailed description of what this migration does`),author:r().optional().describe(`Author who created this migration`),createdAt:r().datetime().optional().describe(`ISO 8601 timestamp when the migration was created`),dependencies:C(HR).optional().describe(`Migrations that must run before this one`),operations:C(VR).describe(`Ordered list of atomic migration operations`),rollback:C(VR).optional().describe(`Operations to reverse this migration`)}).describe(`A versioned set of atomic schema migration operations`),WR=h({id:r().describe(`Provider ID (github, google)`),clientId:r().describe(`OAuth Client ID`),clientSecret:r().describe(`OAuth Client Secret`),scope:C(r()).optional().describe(`Requested permissions`)}),GR=h({organization:S().default(!1).describe(`Enable Organization/Teams support`),twoFactor:S().default(!1).describe(`Enable 2FA`),passkeys:S().default(!1).describe(`Enable Passkey support`),magicLink:S().default(!1).describe(`Enable Magic Link login`)}),KR=h({enabled:S().default(!1).describe(`Enable mutual TLS authentication`),clientCertRequired:S().default(!1).describe(`Require client certificates for all connections`),trustedCAs:C(r()).describe(`PEM-encoded CA certificates or file paths`),crlUrl:r().optional().describe(`Certificate Revocation List (CRL) URL`),ocspUrl:r().optional().describe(`Online Certificate Status Protocol (OCSP) URL`),certificateValidation:E([`strict`,`relaxed`,`none`]).describe(`Certificate validation strictness level`),allowedCNs:C(r()).optional().describe(`Allowed Common Names (CN) on client certificates`),allowedOUs:C(r()).optional().describe(`Allowed Organizational Units (OU) on client certificates`),pinning:h({enabled:S().describe(`Enable certificate pinning`),pins:C(r()).describe(`Pinned certificate hashes`)}).optional().describe(`Certificate pinning configuration`)}),qR=d(r(),h({clientId:r().describe(`OAuth Client ID`),clientSecret:r().describe(`OAuth Client Secret`),enabled:S().optional().default(!0).describe(`Enable this provider`),scope:C(r()).optional().describe(`Additional OAuth scopes`)}).catchall(u())).optional().describe(`Social/OAuth provider map forwarded to better-auth socialProviders. Keys are provider ids (google, github, apple, …).`),JR=h({enabled:S().default(!0).describe(`Enable email/password auth`),disableSignUp:S().optional().describe(`Disable new user registration via email/password`),requireEmailVerification:S().optional().describe(`Require email verification before creating a session`),minPasswordLength:P().optional().describe(`Minimum password length (default 8)`),maxPasswordLength:P().optional().describe(`Maximum password length (default 128)`),resetPasswordTokenExpiresIn:P().optional().describe(`Reset-password token TTL in seconds (default 3600)`),autoSignIn:S().optional().describe(`Auto sign-in after sign-up (default true)`),revokeSessionsOnPasswordReset:S().optional().describe(`Revoke all other sessions on password reset`)}).optional().describe(`Email and password authentication options forwarded to better-auth`),YR=h({sendOnSignUp:S().optional().describe(`Automatically send verification email after sign-up`),sendOnSignIn:S().optional().describe(`Send verification email on sign-in when not yet verified`),autoSignInAfterVerification:S().optional().describe(`Auto sign-in the user after email verification`),expiresIn:P().optional().describe(`Verification token TTL in seconds (default 3600)`)}).optional().describe(`Email verification options forwarded to better-auth`),XR=h({crossSubDomainCookies:h({enabled:S().describe(`Enable cross-subdomain cookies`),additionalCookies:C(r()).optional().describe(`Extra cookies shared across subdomains`),domain:r().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:S().optional().describe(`Force Secure flag on cookies`),disableCSRFCheck:S().optional().describe(`⚠ Disable CSRF check — security risk, use with caution`),cookiePrefix:r().optional().describe(`Prefix for auth cookie names`)}).optional().describe(`Advanced / low-level Better-Auth options`),mbe=h({secret:r().optional().describe(`Encryption secret`),baseUrl:r().optional().describe(`Base URL for auth routes`),databaseUrl:r().optional().describe(`Database connection string`),providers:C(WR).optional(),plugins:GR.optional(),session:h({expiresIn:P().default(3600*24*7).describe(`Session duration in seconds`),updateAge:P().default(3600*24).describe(`Session update frequency`)}).optional(),trustedOrigins:C(r()).optional().describe(`Trusted origins for CSRF protection. Supports wildcards (e.g. "https://*.example.com"). The baseUrl origin is always trusted implicitly.`),socialProviders:qR,emailAndPassword:JR,emailVerification:YR,advanced:XR,mutualTls:KR.optional().describe(`Mutual TLS (mTLS) configuration`)}).catchall(u()),ZR=h({enabled:S().describe(`Enable GDPR compliance controls`),dataSubjectRights:h({rightToAccess:S().default(!0).describe(`Allow data subjects to access their data`),rightToRectification:S().default(!0).describe(`Allow data subjects to correct their data`),rightToErasure:S().default(!0).describe(`Allow data subjects to request deletion`),rightToRestriction:S().default(!0).describe(`Allow data subjects to restrict processing`),rightToPortability:S().default(!0).describe(`Allow data subjects to export their data`),rightToObjection:S().default(!0).describe(`Allow data subjects to object to processing`)}).describe(`Data subject rights configuration per GDPR Articles 15-21`),legalBasis:E([`consent`,`contract`,`legal-obligation`,`vital-interests`,`public-task`,`legitimate-interests`]).describe(`Legal basis for data processing under GDPR Article 6`),consentTracking:S().default(!0).describe(`Track and record user consent`),dataRetentionDays:P().optional().describe(`Maximum data retention period in days`),dataProcessingAgreement:r().optional().describe(`URL or reference to the data processing agreement`)}).describe(`GDPR (General Data Protection Regulation) compliance configuration`),QR=h({enabled:S().describe(`Enable HIPAA compliance controls`),phi:h({encryption:S().default(!0).describe(`Encrypt Protected Health Information at rest`),accessControl:S().default(!0).describe(`Enforce role-based access to PHI`),auditTrail:S().default(!0).describe(`Log all PHI access events`),backupAndRecovery:S().default(!0).describe(`Enable PHI backup and disaster recovery`)}).describe(`Protected Health Information safeguards`),businessAssociateAgreement:S().default(!1).describe(`BAA is in place with third-party processors`)}).describe(`HIPAA (Health Insurance Portability and Accountability Act) compliance configuration`),$R=h({enabled:S().describe(`Enable PCI-DSS compliance controls`),level:E([`1`,`2`,`3`,`4`]).describe(`PCI-DSS compliance level (1 = highest)`),cardDataFields:C(r()).describe(`Field names containing cardholder data`),tokenization:S().default(!0).describe(`Replace card data with secure tokens`),encryptionInTransit:S().default(!0).describe(`Encrypt cardholder data during transmission`),encryptionAtRest:S().default(!0).describe(`Encrypt stored cardholder data`)}).describe(`PCI-DSS (Payment Card Industry Data Security Standard) compliance configuration`),ez=h({enabled:S().default(!0).describe(`Enable audit logging`),retentionDays:P().default(365).describe(`Number of days to retain audit logs`),immutable:S().default(!0).describe(`Prevent modification or deletion of audit logs`),signLogs:S().default(!1).describe(`Cryptographically sign log entries for tamper detection`),events:C(E([`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`),tz=E([`critical`,`major`,`minor`,`observation`]),nz=E([`open`,`in_remediation`,`remediated`,`verified`,`accepted_risk`,`closed`]),rz=h({id:r().describe(`Unique finding identifier`),title:r().describe(`Finding title`),description:r().describe(`Finding description`),severity:tz.describe(`Finding severity`),status:nz.describe(`Finding status`),controlReference:r().optional().describe(`ISO 27001 control reference`),framework:CR.optional().describe(`Related compliance framework`),identifiedAt:P().describe(`Identification timestamp`),identifiedBy:r().describe(`Identifier (auditor name or system)`),remediationPlan:r().optional().describe(`Remediation plan`),remediationDeadline:P().optional().describe(`Remediation deadline timestamp`),verifiedAt:P().optional().describe(`Verification timestamp`),verifiedBy:r().optional().describe(`Verifier name or role`),notes:r().optional().describe(`Additional notes`)}).describe(`Audit finding with remediation tracking per ISO 27001:2022 A.5.35`),iz=h({id:r().describe(`Unique audit schedule identifier`),title:r().describe(`Audit title`),scope:C(r()).describe(`Audit scope areas`),framework:CR.describe(`Target compliance framework`),scheduledAt:P().describe(`Scheduled audit timestamp`),completedAt:P().optional().describe(`Completion timestamp`),assessor:r().describe(`Assessor or audit team`),isExternal:S().default(!1).describe(`Whether this is an external audit`),recurrenceMonths:P().default(0).describe(`Recurrence interval in months (0 = one-time)`),findings:C(rz).optional().describe(`Audit findings`)}).describe(`Audit schedule for independent security reviews per ISO 27001:2022 A.5.35`),hbe=h({gdpr:ZR.optional().describe(`GDPR compliance settings`),hipaa:QR.optional().describe(`HIPAA compliance settings`),pciDss:$R.optional().describe(`PCI-DSS compliance settings`),auditLog:ez.describe(`Audit log configuration`),auditSchedules:C(iz).optional().describe(`Scheduled compliance audits (A.5.35)`)}).describe(`Unified compliance configuration spanning GDPR, HIPAA, PCI-DSS, and audit governance`),az=E([`critical`,`high`,`medium`,`low`]),oz=E([`data_breach`,`malware`,`unauthorized_access`,`denial_of_service`,`social_engineering`,`insider_threat`,`physical_security`,`configuration_error`,`vulnerability_exploit`,`policy_violation`,`other`]),sz=E([`reported`,`triaged`,`investigating`,`containing`,`eradicating`,`recovering`,`resolved`,`closed`]),cz=h({phase:E([`identification`,`containment`,`eradication`,`recovery`,`lessons_learned`]).describe(`Response phase name`),description:r().describe(`Phase description and objectives`),assignedTo:r().describe(`Responsible team or role`),targetHours:P().min(0).describe(`Target completion time in hours`),completedAt:P().optional().describe(`Actual completion timestamp`),notes:r().optional().describe(`Phase notes and findings`)}).describe(`Incident response phase with timing and assignment`),lz=h({severity:az.describe(`Minimum severity to trigger notification`),channels:C(E([`email`,`sms`,`slack`,`pagerduty`,`webhook`])).describe(`Notification channels`),recipients:C(r()).describe(`Roles or teams to notify`),withinMinutes:P().min(1).describe(`Notification deadline in minutes from detection`),notifyRegulators:S().default(!1).describe(`Whether to notify regulatory authorities`),regulatorDeadlineHours:P().optional().describe(`Regulatory notification deadline in hours`)}).describe(`Incident notification rule per severity level`),uz=h({rules:C(lz).describe(`Notification rules by severity level`),escalationTimeoutMinutes:P().default(30).describe(`Auto-escalation timeout in minutes`),escalationChain:C(r()).default([]).describe(`Ordered escalation chain of roles`)}).describe(`Incident notification matrix with escalation policies`),gbe=h({id:r().describe(`Unique incident identifier`),title:r().describe(`Incident title`),description:r().describe(`Detailed incident description`),severity:az.describe(`Incident severity level`),category:oz.describe(`Incident category`),status:sz.describe(`Current incident status`),reportedBy:r().describe(`Reporter user ID or system name`),reportedAt:P().describe(`Report timestamp`),detectedAt:P().optional().describe(`Detection timestamp`),resolvedAt:P().optional().describe(`Resolution timestamp`),affectedSystems:C(r()).describe(`Affected systems`),affectedDataClassifications:C(SR).optional().describe(`Affected data classifications`),responsePhases:C(cz).optional().describe(`Incident response phases`),rootCause:r().optional().describe(`Root cause analysis`),correctiveActions:C(r()).optional().describe(`Corrective actions taken or planned`),lessonsLearned:r().optional().describe(`Lessons learned from the incident`),relatedChangeRequestIds:C(r()).optional().describe(`Related change request IDs`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Security incident record per ISO 27001:2022 A.5.24–A.5.28`),_be=h({enabled:S().default(!0).describe(`Enable incident response management`),notificationMatrix:uz.describe(`Notification and escalation matrix`),defaultResponseTeam:r().describe(`Default incident response team or role`),triageDeadlineHours:P().default(1).describe(`Maximum hours to begin triage after detection`),requirePostIncidentReview:S().default(!0).describe(`Require post-incident review for all incidents`),regulatoryNotificationThreshold:az.default(`high`).describe(`Minimum severity requiring regulatory notification`),retentionDays:P().default(2555).describe(`Incident record retention period in days (default ~7 years)`)}).describe(`Organization-level incident response policy per ISO 27001:2022`),dz=E([`critical`,`high`,`medium`,`low`]),fz=E([`pending`,`in_progress`,`completed`,`expired`,`failed`]),pz=h({id:r().describe(`Requirement identifier`),description:r().describe(`Requirement description`),controlReference:r().optional().describe(`ISO 27001 control reference`),mandatory:S().default(!0).describe(`Whether this requirement is mandatory`),compliant:S().optional().describe(`Whether the supplier meets this requirement`),evidence:r().optional().describe(`Compliance evidence or assessment notes`)}).describe(`Individual supplier security requirement`),vbe=h({supplierId:r().describe(`Unique supplier identifier`),supplierName:r().describe(`Supplier display name`),riskLevel:dz.describe(`Supplier risk classification`),status:fz.describe(`Assessment status`),assessedBy:r().describe(`Assessor user ID or team`),assessedAt:P().describe(`Assessment timestamp`),validUntil:P().describe(`Assessment validity expiry timestamp`),requirements:C(pz).describe(`Security requirements and their compliance status`),overallCompliant:S().describe(`Whether supplier meets all mandatory requirements`),dataClassificationsShared:C(SR).optional().describe(`Data classifications shared with supplier`),servicesProvided:C(r()).optional().describe(`Services provided by this supplier`),certifications:C(r()).optional().describe(`Supplier certifications (e.g., ISO 27001, SOC 2)`),remediationItems:C(h({requirementId:r().describe(`Non-compliant requirement ID`),action:r().describe(`Required remediation action`),deadline:P().describe(`Remediation deadline timestamp`),status:E([`pending`,`in_progress`,`completed`]).default(`pending`).describe(`Remediation status`)})).optional().describe(`Remediation items for non-compliant requirements`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs`)}).describe(`Supplier security assessment record per ISO 27001:2022 A.5.19–A.5.21`),ybe=h({enabled:S().default(!0).describe(`Enable supplier security management`),reassessmentIntervalDays:P().default(365).describe(`Supplier reassessment interval in days`),requirePreOnboardingAssessment:S().default(!0).describe(`Require security assessment before supplier onboarding`),formalAssessmentThreshold:dz.default(`medium`).describe(`Minimum risk level requiring formal assessment`),monitorChanges:S().default(!0).describe(`Monitor supplier security posture changes`),requiredCertifications:C(r()).default([]).describe(`Required certifications for critical-risk suppliers`)}).describe(`Organization-level supplier security management policy per ISO 27001:2022`),mz=E([`security_awareness`,`data_protection`,`incident_response`,`access_control`,`phishing_awareness`,`compliance`,`secure_development`,`physical_security`,`business_continuity`,`other`]),hz=E([`not_started`,`in_progress`,`completed`,`failed`,`expired`]),gz=h({id:r().describe(`Unique course identifier`),title:r().describe(`Course title`),description:r().describe(`Course description and learning objectives`),category:mz.describe(`Training category`),durationMinutes:P().min(1).describe(`Estimated course duration in minutes`),mandatory:S().default(!1).describe(`Whether training is mandatory`),targetRoles:C(r()).describe(`Target roles or groups`),validityDays:P().optional().describe(`Certification validity period in days`),passingScore:P().min(0).max(100).optional().describe(`Minimum passing score percentage`),version:r().optional().describe(`Course content version`)}).describe(`Security training course definition`),bbe=h({courseId:r().describe(`Training course identifier`),userId:r().describe(`User identifier`),status:hz.describe(`Training completion status`),assignedAt:P().describe(`Assignment timestamp`),completedAt:P().optional().describe(`Completion timestamp`),score:P().min(0).max(100).optional().describe(`Assessment score percentage`),expiresAt:P().optional().describe(`Certification expiry timestamp`),notes:r().optional().describe(`Training notes or comments`)}).describe(`Individual training completion record`),xbe=h({enabled:S().default(!0).describe(`Enable training management`),courses:C(gz).describe(`Training courses`),recertificationIntervalDays:P().default(365).describe(`Default recertification interval in days`),trackCompletion:S().default(!0).describe(`Track training completion for compliance`),gracePeriodDays:P().default(30).describe(`Grace period in days after certification expiry`),sendReminders:S().default(!0).describe(`Send reminders for upcoming training deadlines`),reminderDaysBefore:P().default(14).describe(`Days before deadline to send first reminder`)}).describe(`Organizational training plan per ISO 27001:2022 A.6.3`),_z=h({type:m(`cron`),expression:r().describe(`Cron expression (e.g., "0 0 * * *" for daily at midnight)`),timezone:r().optional().default(`UTC`).describe(`Timezone for cron execution (e.g., "America/New_York")`)}),vz=h({type:m(`interval`),intervalMs:P().int().positive().describe(`Interval in milliseconds`)}),yz=h({type:m(`once`),at:r().datetime().describe(`ISO 8601 datetime when to execute`)}),bz=I(`type`,[_z,vz,yz]),xz=h({maxRetries:P().int().min(0).default(3).describe(`Maximum number of retry attempts`),backoffMs:P().int().positive().default(1e3).describe(`Initial backoff delay in milliseconds`),backoffMultiplier:P().positive().default(2).describe(`Multiplier for exponential backoff`)}),Sbe=h({id:r().describe(`Unique job identifier`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Job name (snake_case)`),schedule:bz.describe(`Job schedule configuration`),handler:r().describe(`Handler path (e.g. "path/to/file:functionName") or script ID`),retryPolicy:xz.optional().describe(`Retry policy configuration`),timeout:P().int().positive().optional().describe(`Timeout in milliseconds`),enabled:S().default(!0).describe(`Whether the job is enabled`)}),Sz=E([`running`,`success`,`failed`,`timeout`]),Cbe=h({jobId:r().describe(`Job identifier`),startedAt:r().datetime().describe(`ISO 8601 datetime when execution started`),completedAt:r().datetime().optional().describe(`ISO 8601 datetime when execution completed`),status:Sz.describe(`Execution status`),error:r().optional().describe(`Error message if failed`),duration:P().int().optional().describe(`Execution duration in milliseconds`)}),Cz=E([`critical`,`high`,`normal`,`low`,`background`]),wbe={critical:0,high:1,normal:2,low:3,background:4},wz=E([`pending`,`queued`,`processing`,`completed`,`failed`,`cancelled`,`timeout`,`dead`]),Tz=h({maxRetries:P().int().min(0).default(3).describe(`Maximum retry attempts`),backoffStrategy:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy between retries`),initialDelayMs:P().int().positive().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().int().positive().default(6e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:P().positive().default(2).describe(`Multiplier for exponential backoff`)}),Ez=h({id:r().describe(`Unique task identifier`),type:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),payload:u().describe(`Task payload data`),queue:r().default(`default`).describe(`Queue name`),priority:Cz.default(`normal`).describe(`Task priority level`),retryPolicy:Tz.optional().describe(`Retry policy configuration`),timeoutMs:P().int().positive().optional().describe(`Task timeout in milliseconds`),scheduledAt:r().datetime().optional().describe(`ISO 8601 datetime to execute task`),attempts:P().int().min(0).default(0).describe(`Number of execution attempts`),status:wz.default(`pending`).describe(`Current task status`),metadata:h({createdAt:r().datetime().optional().describe(`When task was created`),updatedAt:r().datetime().optional().describe(`Last update time`),createdBy:r().optional().describe(`User who created task`),tags:C(r()).optional().describe(`Task tags for filtering`)}).optional().describe(`Task metadata`)}),Tbe=h({taskId:r().describe(`Task identifier`),status:wz.describe(`Execution status`),result:u().optional().describe(`Execution result data`),error:h({message:r().describe(`Error message`),stack:r().optional().describe(`Error stack trace`),code:r().optional().describe(`Error code`)}).optional().describe(`Error details if failed`),durationMs:P().int().optional().describe(`Execution duration in milliseconds`),startedAt:r().datetime().describe(`When execution started`),completedAt:r().datetime().optional().describe(`When execution completed`),attempt:P().int().min(1).describe(`Attempt number (1-indexed)`),willRetry:S().describe(`Whether task will be retried`)}),Dz=h({name:r().describe(`Queue name (snake_case)`),concurrency:P().int().min(1).default(5).describe(`Max concurrent task executions`),rateLimit:h({max:P().int().positive().describe(`Maximum tasks per duration`),duration:P().int().positive().describe(`Duration in milliseconds`)}).optional().describe(`Rate limit configuration`),defaultRetryPolicy:Tz.optional().describe(`Default retry policy for tasks`),deadLetterQueue:r().optional().describe(`Dead letter queue name`),priority:P().int().min(0).default(0).describe(`Queue priority (lower = higher priority)`),autoScale:h({enabled:S().default(!1).describe(`Enable auto-scaling`),minWorkers:P().int().min(1).default(1).describe(`Minimum workers`),maxWorkers:P().int().min(1).default(10).describe(`Maximum workers`),scaleUpThreshold:P().int().positive().default(100).describe(`Queue size to scale up`),scaleDownThreshold:P().int().min(0).default(10).describe(`Queue size to scale down`)}).optional().describe(`Auto-scaling configuration`)}),Oz=h({id:r().describe(`Unique batch job identifier`),type:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Task type (snake_case)`),items:C(u()).describe(`Array of items to process`),batchSize:P().int().min(1).default(100).describe(`Number of items per batch`),queue:r().default(`batch`).describe(`Queue for batch tasks`),priority:Cz.default(`normal`).describe(`Batch task priority`),parallel:S().default(!0).describe(`Process batches in parallel`),stopOnError:S().default(!1).describe(`Stop batch if any item fails`),onProgress:M().input(w([h({processed:P(),total:P(),failed:P()})])).output(te()).optional().describe(`Progress callback function (called after each batch)`)}),Ebe=h({batchId:r().describe(`Batch job identifier`),total:P().int().min(0).describe(`Total number of items`),processed:P().int().min(0).default(0).describe(`Items processed`),succeeded:P().int().min(0).default(0).describe(`Items succeeded`),failed:P().int().min(0).default(0).describe(`Items failed`),percentage:P().min(0).max(100).describe(`Progress percentage`),status:E([`pending`,`running`,`completed`,`failed`,`cancelled`]).describe(`Batch status`),startedAt:r().datetime().optional().describe(`When batch started`),completedAt:r().datetime().optional().describe(`When batch completed`)}),kz=h({name:r().describe(`Worker name`),queues:C(r()).min(1).describe(`Queue names to process`),queueConfigs:C(Dz).optional().describe(`Queue configurations`),pollIntervalMs:P().int().positive().default(1e3).describe(`Queue polling interval in milliseconds`),visibilityTimeoutMs:P().int().positive().default(3e4).describe(`How long a task is invisible after being claimed`),defaultTimeoutMs:P().int().positive().default(3e5).describe(`Default task timeout in milliseconds`),shutdownTimeoutMs:P().int().positive().default(3e4).describe(`Graceful shutdown timeout in milliseconds`),handlers:d(r(),M()).optional().describe(`Task type handlers`)}),Dbe=h({workerName:r().describe(`Worker name`),totalProcessed:P().int().min(0).describe(`Total tasks processed`),succeeded:P().int().min(0).describe(`Successful tasks`),failed:P().int().min(0).describe(`Failed tasks`),active:P().int().min(0).describe(`Currently active tasks`),avgExecutionMs:P().min(0).optional().describe(`Average execution time in milliseconds`),uptimeMs:P().int().min(0).describe(`Worker uptime in milliseconds`),queues:d(r(),h({pending:P().int().min(0).describe(`Pending tasks`),active:P().int().min(0).describe(`Active tasks`),completed:P().int().min(0).describe(`Completed tasks`),failed:P().int().min(0).describe(`Failed tasks`)})).optional().describe(`Per-queue statistics`)}),Obe=Object.assign(Ez,{create:e=>e}),kbe=Object.assign(Dz,{create:e=>e}),Abe=Object.assign(kz,{create:e=>e}),jbe=Object.assign(Oz,{create:e=>e}),Az=h({id:r().describe(`Template identifier`),subject:r().describe(`Email subject`),body:r().describe(`Email body content`),bodyType:E([`text`,`html`,`markdown`]).optional().default(`html`).describe(`Body content type`),variables:C(r()).optional().describe(`Template variables`),attachments:C(h({name:r().describe(`Attachment filename`),url:r().url().describe(`Attachment URL`)})).optional().describe(`Email attachments`)}),jz=h({id:r().describe(`Template identifier`),message:r().describe(`SMS message content`),maxLength:P().optional().default(160).describe(`Maximum message length`),variables:C(r()).optional().describe(`Template variables`)}),Mz=h({title:r().describe(`Notification title`),body:r().describe(`Notification body`),icon:r().url().optional().describe(`Notification icon URL`),badge:P().optional().describe(`Badge count`),data:d(r(),u()).optional().describe(`Custom data`),actions:C(h({action:r().describe(`Action identifier`),title:r().describe(`Action button title`)})).optional().describe(`Notification actions`)}),Nz=h({title:r().describe(`Notification title`),message:r().describe(`Notification message`),type:E([`info`,`success`,`warning`,`error`]).describe(`Notification type`),actionUrl:r().optional().describe(`Action URL`),dismissible:S().optional().default(!0).describe(`User dismissible`),expiresAt:P().optional().describe(`Expiration timestamp`)}),Pz=E([`email`,`sms`,`push`,`in-app`,`slack`,`teams`,`webhook`]),Mbe=h({id:r().describe(`Notification ID`),name:r().describe(`Notification name`),channel:Pz.describe(`Notification channel`),template:l([Az,jz,Mz,Nz]).describe(`Notification template`),recipients:h({to:C(r()).describe(`Primary recipients`),cc:C(r()).optional().describe(`CC recipients`),bcc:C(r()).optional().describe(`BCC recipients`)}).describe(`Recipients`),schedule:h({type:E([`immediate`,`delayed`,`scheduled`]).describe(`Schedule type`),delay:P().optional().describe(`Delay in milliseconds`),scheduledAt:P().optional().describe(`Scheduled timestamp`)}).optional().describe(`Scheduling`),retryPolicy:h({enabled:S().optional().default(!0).describe(`Enable retries`),maxRetries:P().optional().default(3).describe(`Max retry attempts`),backoffStrategy:E([`exponential`,`linear`,`fixed`]).describe(`Backoff strategy`)}).optional().describe(`Retry policy`),tracking:h({trackOpens:S().optional().default(!1).describe(`Track opens`),trackClicks:S().optional().default(!1).describe(`Track clicks`),trackDelivery:S().optional().default(!0).describe(`Track delivery`)}).optional().describe(`Tracking configuration`)}),Fz=r().describe(`BCP-47 Language Tag (e.g. en-US, zh-CN)`),Iz=h({label:r().optional().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),placeholder:r().optional().describe(`Translated placeholder text for form inputs`),options:d(r(),r()).optional().describe(`Option value to translated label map`)}).describe(`Translation data for a single field`),Lz=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),fields:d(r(),Iz).optional().describe(`Field-level translations`)}).describe(`Translation data for a single object`),Rz=h({objects:d(r(),Lz).optional().describe(`Object translations keyed by object name`),apps:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID`),validationMessages:d(r(),r()).optional().describe(`Translatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})`)}).describe(`Translation data for objects, apps, and UI messages`),zz=d(Fz,Rz).describe(`Map of locale codes to translation data`),Bz=E([`bundled`,`per_locale`,`per_namespace`]).describe(`Translation file organization strategy`),Vz=E([`icu`,`simple`]).describe(`Message interpolation format: ICU MessageFormat or simple {variable} replacement`),Hz=h({defaultLocale:Fz.describe(`Default locale (e.g., "en")`),supportedLocales:C(Fz).describe(`Supported BCP-47 locale codes`),fallbackLocale:Fz.optional().describe(`Fallback locale code`),fileOrganization:Bz.default(`per_locale`).describe(`File organization strategy`),messageFormat:Vz.default(`simple`).describe(`Message interpolation format (ICU MessageFormat or simple)`),lazyLoad:S().default(!1).describe(`Load translations on demand`),cache:S().default(!0).describe(`Cache loaded translations`)}).describe(`Internationalization configuration`),Uz=d(r(),r()).describe(`Option value to translated label map`),Wz=h({label:r().describe(`Translated singular label`),pluralLabel:r().optional().describe(`Translated plural label`),description:r().optional().describe(`Translated object description`),helpText:r().optional().describe(`Translated help text for the object`),fields:d(r(),Iz).optional().describe(`Field translations keyed by field name`),_options:d(r(),Uz).optional().describe(`Object-scoped picklist option translations keyed by field name`),_views:d(r(),h({label:r().optional().describe(`Translated view label`),description:r().optional().describe(`Translated view description`)})).optional().describe(`View translations keyed by view name`),_sections:d(r(),h({label:r().optional().describe(`Translated section label`)})).optional().describe(`Section translations keyed by section name`),_actions:d(r(),h({label:r().optional().describe(`Translated action label`),confirmMessage:r().optional().describe(`Translated confirmation message`)})).optional().describe(`Action translations keyed by action name`),_notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Notification translations keyed by notification name`),_errors:d(r(),r()).optional().describe(`Error message translations keyed by error code`)}).describe(`Object-first aggregated translation node`),Nbe=h({_meta:h({locale:r().optional().describe(`BCP-47 locale code for this bundle`),direction:E([`ltr`,`rtl`]).optional().describe(`Text direction: left-to-right or right-to-left`)}).optional().describe(`Bundle-level metadata (locale, bidi direction)`),namespace:r().optional().describe(`Namespace for plugin isolation to avoid translation key collisions`),o:d(r(),Wz).optional().describe(`Object-first translations keyed by object name`),_globalOptions:d(r(),Uz).optional().describe(`Global picklist option translations keyed by option set name`),app:d(r(),h({label:r().describe(`Translated app label`),description:r().optional().describe(`Translated app description`)})).optional().describe(`App translations keyed by app name`),nav:d(r(),r()).optional().describe(`Navigation item translations keyed by nav item name`),dashboard:d(r(),h({label:r().optional().describe(`Translated dashboard label`),description:r().optional().describe(`Translated dashboard description`)})).optional().describe(`Dashboard translations keyed by dashboard name`),reports:d(r(),h({label:r().optional().describe(`Translated report label`),description:r().optional().describe(`Translated report description`)})).optional().describe(`Report translations keyed by report name`),pages:d(r(),h({title:r().optional().describe(`Translated page title`),description:r().optional().describe(`Translated page description`)})).optional().describe(`Page translations keyed by page name`),messages:d(r(),r()).optional().describe(`UI message translations keyed by message ID (supports ICU MessageFormat)`),validationMessages:d(r(),r()).optional().describe(`Validation error message translations keyed by rule name (supports ICU MessageFormat)`),notifications:d(r(),h({title:r().optional().describe(`Translated notification title`),body:r().optional().describe(`Translated notification body (supports ICU MessageFormat when enabled)`)})).optional().describe(`Global notification translations keyed by notification name`),errors:d(r(),r()).optional().describe(`Global error message translations keyed by error code`)}).describe(`Object-first application translation bundle for a single locale`),Gz=E([`missing`,`redundant`,`stale`]).describe(`Translation diff status: missing from bundle, redundant (no matching metadata), or stale (metadata changed)`),Kz=h({key:r().describe(`Dot-path translation key`),status:Gz.describe(`Diff status of this translation key`),objectName:r().optional().describe(`Associated object name (snake_case)`),locale:r().describe(`BCP-47 locale code`),sourceHash:r().optional().describe(`Hash of source metadata for precise stale detection`),aiSuggested:r().optional().describe(`AI-suggested translation for this key`),aiConfidence:P().min(0).max(1).optional().describe(`AI suggestion confidence score (0–1)`)}).describe(`A single translation diff item`),qz=h({group:r().describe(`Translation group category`),totalKeys:P().int().nonnegative().describe(`Total keys in this group`),translatedKeys:P().int().nonnegative().describe(`Translated keys in this group`),coveragePercent:P().min(0).max(100).describe(`Coverage percentage for this group`)}).describe(`Coverage breakdown for a single translation group`),Pbe=h({locale:r().describe(`BCP-47 locale code`),objectName:r().optional().describe(`Object name scope (omit for full bundle)`),totalKeys:P().int().nonnegative().describe(`Total translatable keys from metadata`),translatedKeys:P().int().nonnegative().describe(`Number of translated keys`),missingKeys:P().int().nonnegative().describe(`Number of missing translations`),redundantKeys:P().int().nonnegative().describe(`Number of redundant translations`),staleKeys:P().int().nonnegative().describe(`Number of stale translations`),coveragePercent:P().min(0).max(100).describe(`Translation coverage percentage`),items:C(Kz).describe(`Detailed diff items`),breakdown:C(qz).optional().describe(`Per-group coverage breakdown`)}).describe(`Aggregated translation coverage result`),Fbe=`__TRANSLATE__`,Ibe=E([`insert`,`delete`,`retain`]),Jz=I(`type`,[h({type:m(`insert`),text:r().describe(`Text to insert`),attributes:d(r(),u()).optional().describe(`Text formatting attributes (e.g., bold, italic)`)}),h({type:m(`delete`),count:P().int().positive().describe(`Number of characters to delete`)}),h({type:m(`retain`),count:P().int().positive().describe(`Number of characters to retain`),attributes:d(r(),u()).optional().describe(`Attribute changes to apply`)})]),Yz=h({operationId:r().uuid().describe(`Unique operation identifier`),documentId:r().describe(`Document identifier`),userId:r().describe(`User who created the operation`),sessionId:r().uuid().describe(`Session identifier`),components:C(Jz).describe(`Operation components`),baseVersion:P().int().nonnegative().describe(`Document version this operation is based on`),timestamp:r().datetime().describe(`ISO 8601 datetime when operation was created`),metadata:d(r(),u()).optional().describe(`Additional operation metadata`)}),Lbe=h({operation:Yz.describe(`Transformed operation`),transformed:S().describe(`Whether transformation was applied`),conflicts:C(r()).optional().describe(`Conflict descriptions if any`)}),Rbe=E([`lww-register`,`g-counter`,`pn-counter`,`g-set`,`or-set`,`lww-map`,`text`,`tree`,`json`]),Xz=h({clock:d(r(),P().int().nonnegative()).describe(`Map of replica ID to logical timestamp`)}),Zz=h({type:m(`lww-register`),value:u().describe(`Current register value`),timestamp:r().datetime().describe(`ISO 8601 datetime of last write`),replicaId:r().describe(`ID of replica that performed last write`),vectorClock:Xz.optional().describe(`Optional vector clock for causality tracking`)}),zbe=h({replicaId:r().describe(`Replica identifier`),delta:P().int().describe(`Change amount (positive for increment, negative for decrement)`),timestamp:r().datetime().describe(`ISO 8601 datetime of operation`)}),Qz=h({type:m(`g-counter`),counts:d(r(),P().int().nonnegative()).describe(`Map of replica ID to count`)}),$z=h({type:m(`pn-counter`),positive:d(r(),P().int().nonnegative()).describe(`Positive increments per replica`),negative:d(r(),P().int().nonnegative()).describe(`Negative increments per replica`)}),eB=h({value:u().describe(`Element value`),timestamp:r().datetime().describe(`Addition timestamp`),replicaId:r().describe(`Replica that added the element`),uid:r().uuid().describe(`Unique identifier for this addition`),removed:S().optional().default(!1).describe(`Whether element has been removed`)}),tB=h({type:m(`or-set`),elements:C(eB).describe(`Set elements with metadata`)}),nB=h({operationId:r().uuid().describe(`Unique operation identifier`),replicaId:r().describe(`Replica identifier`),position:P().int().nonnegative().describe(`Position in document`),insert:r().optional().describe(`Text to insert`),delete:P().int().positive().optional().describe(`Number of characters to delete`),timestamp:r().datetime().describe(`ISO 8601 datetime of operation`),lamportTimestamp:P().int().nonnegative().describe(`Lamport timestamp for ordering`)}),rB=h({type:m(`text`),documentId:r().describe(`Document identifier`),content:r().describe(`Current text content`),operations:C(nB).describe(`History of operations`),lamportClock:P().int().nonnegative().describe(`Current Lamport clock value`),vectorClock:Xz.describe(`Vector clock for causality`)}),iB=I(`type`,[Zz,Qz,$z,tB,rB]),Bbe=h({state:iB.describe(`Merged CRDT state`),conflicts:C(h({type:r().describe(`Conflict type`),description:r().describe(`Conflict description`),resolved:S().describe(`Whether conflict was automatically resolved`)})).optional().describe(`Conflicts encountered during merge`)}),aB=E([`blue`,`green`,`red`,`yellow`,`purple`,`orange`,`pink`,`teal`,`indigo`,`cyan`]),oB=h({color:l([aB,r()]).describe(`Cursor color (preset or custom hex)`),opacity:P().min(0).max(1).optional().default(1).describe(`Cursor opacity (0-1)`),label:r().optional().describe(`Label to display with cursor (usually username)`),showLabel:S().optional().default(!0).describe(`Whether to show label`),pulseOnUpdate:S().optional().default(!0).describe(`Whether to pulse when cursor moves`)}),sB=h({anchor:h({line:P().int().nonnegative().describe(`Anchor line number`),column:P().int().nonnegative().describe(`Anchor column number`)}).describe(`Selection anchor (start point)`),focus:h({line:P().int().nonnegative().describe(`Focus line number`),column:P().int().nonnegative().describe(`Focus column number`)}).describe(`Selection focus (end point)`),direction:E([`forward`,`backward`]).optional().describe(`Selection direction`)}),cB=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier`),userName:r().describe(`Display name of user`),position:h({line:P().int().nonnegative().describe(`Cursor line number (0-indexed)`),column:P().int().nonnegative().describe(`Cursor column number (0-indexed)`)}).describe(`Current cursor position`),selection:sB.optional().describe(`Current text selection`),style:oB.describe(`Visual style for this cursor`),isTyping:S().optional().default(!1).describe(`Whether user is currently typing`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last cursor update`),metadata:d(r(),u()).optional().describe(`Additional cursor metadata`)}),Vbe=h({position:h({line:P().int().nonnegative(),column:P().int().nonnegative()}).optional().describe(`Updated cursor position`),selection:sB.optional().describe(`Updated selection`),isTyping:S().optional().describe(`Updated typing state`),metadata:d(r(),u()).optional().describe(`Updated metadata`)}),lB=E([`active`,`idle`,`viewing`,`disconnected`]),uB=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),userName:r().describe(`Display name`),userAvatar:r().optional().describe(`User avatar URL`),status:lB.describe(`Current activity status`),currentDocument:r().optional().describe(`Document ID user is currently editing`),currentView:r().optional().describe(`Current view/page user is on`),lastActivity:r().datetime().describe(`ISO 8601 datetime of last activity`),joinedAt:r().datetime().describe(`ISO 8601 datetime when user joined session`),permissions:C(r()).optional().describe(`User permissions in this session`),metadata:d(r(),u()).optional().describe(`Additional user state metadata`)}),Hbe=h({sessionId:r().uuid().describe(`Session identifier`),documentId:r().optional().describe(`Document ID this session is for`),users:C(uB).describe(`Active users in session`),startedAt:r().datetime().describe(`ISO 8601 datetime when session started`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last update`),metadata:d(r(),u()).optional().describe(`Session metadata`)}),Ube=h({status:lB.optional().describe(`Updated status`),currentDocument:r().optional().describe(`Updated current document`),currentView:r().optional().describe(`Updated current view`),metadata:d(r(),u()).optional().describe(`Updated metadata`)}),Wbe=h({eventId:r().uuid().describe(`Event identifier`),sessionId:r().uuid().describe(`Session identifier`),eventType:E([`user.joined`,`user.left`,`user.updated`,`session.created`,`session.ended`]).describe(`Type of awareness event`),userId:r().optional().describe(`User involved in event`),timestamp:r().datetime().describe(`ISO 8601 datetime of event`),payload:u().describe(`Event payload`)}),dB=E([`ot`,`crdt`,`lock`,`hybrid`]),fB=h({mode:dB.describe(`Collaboration mode to use`),enableCursorSharing:S().optional().default(!0).describe(`Enable cursor sharing`),enablePresence:S().optional().default(!0).describe(`Enable presence tracking`),enableAwareness:S().optional().default(!0).describe(`Enable awareness state`),maxUsers:P().int().positive().optional().describe(`Maximum concurrent users`),idleTimeout:P().int().positive().optional().default(3e5).describe(`Idle timeout in milliseconds`),conflictResolution:E([`ot`,`crdt`,`manual`]).optional().default(`ot`).describe(`Conflict resolution strategy`),persistence:S().optional().default(!0).describe(`Enable operation persistence`),snapshot:h({enabled:S().describe(`Enable periodic snapshots`),interval:P().int().positive().describe(`Snapshot interval in milliseconds`)}).optional().describe(`Snapshot configuration`)}),Gbe=h({sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier`),config:fB.describe(`Session configuration`),users:C(uB).describe(`Active users`),cursors:C(cB).describe(`Active cursors`),version:P().int().nonnegative().describe(`Current document version`),operations:C(l([Yz,nB])).optional().describe(`Recent operations`),createdAt:r().datetime().describe(`ISO 8601 datetime when session was created`),lastActivity:r().datetime().describe(`ISO 8601 datetime of last activity`),status:E([`active`,`idle`,`ended`]).describe(`Session status`)}),pB=E([`system`,`platform`,`user`]),mB=E([`draft`,`active`,`archived`,`deprecated`]),Kbe=h({id:r(),name:r(),type:r(),namespace:r().default(`default`),packageId:r().optional().describe(`Package ID that owns/delivered this metadata`),managedBy:E([`package`,`platform`,`user`]).optional().describe(`Who manages this metadata record lifecycle`),scope:pB.default(`platform`),metadata:d(r(),u()),extends:r().optional().describe(`Name of the parent metadata to extend/override`),strategy:E([`merge`,`replace`]).default(`merge`),owner:r().optional(),state:mB.default(`active`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant isolation`),version:P().default(1).describe(`Record version for optimistic concurrency control`),checksum:r().optional().describe(`Content checksum for change detection`),source:E([`filesystem`,`database`,`api`,`migration`]).optional().describe(`Origin of this metadata record`),tags:C(r()).optional().describe(`Classification tags for filtering and grouping`),publishedDefinition:u().optional().describe(`Snapshot of the last published definition`),publishedAt:r().datetime().optional().describe(`When this metadata was last published`),publishedBy:r().optional().describe(`Who published this version`),createdBy:r().optional(),createdAt:r().datetime().optional().describe(`Creation timestamp`),updatedBy:r().optional(),updatedAt:r().datetime().optional().describe(`Last update timestamp`)}),qbe=h({success:S().describe(`Whether the publish succeeded`),packageId:r().describe(`The package ID that was published`),version:P().int().describe(`New version number after publish`),publishedAt:r().datetime().describe(`Publish timestamp`),itemsPublished:P().int().describe(`Total metadata items published`),validationErrors:C(h({type:r().describe(`Metadata type that failed validation`),name:r().describe(`Item name that failed validation`),message:r().describe(`Validation error message`)})).optional().describe(`Validation errors if publish failed`)}),hB=E([`json`,`yaml`,`yml`,`ts`,`js`,`typescript`,`javascript`]),gB=h({path:r().optional(),size:P().optional(),mtime:r().datetime().optional(),hash:r().optional(),etag:r().optional(),modifiedAt:r().datetime().optional(),format:hB.optional()}),Jbe=h({name:r(),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Loader protocol identifier`),description:r().optional(),supportedFormats:C(r()).optional(),supportsWatch:S().optional(),supportsWrite:S().optional(),supportsCache:S().optional(),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)})}),Ybe=h({scope:pB.optional(),namespace:r().optional(),raw:S().optional().describe(`Return raw file content instead of parsed JSON`),cache:S().optional(),useCache:S().optional(),validate:S().optional(),ifNoneMatch:r().optional(),recursive:S().optional(),limit:P().optional(),patterns:C(r()).optional(),loader:r().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),Xbe=h({data:u(),stats:gB.optional(),format:hB.optional(),source:r().optional(),fromCache:S().optional(),etag:r().optional(),notModified:S().optional(),loadTime:P().optional()}),Zbe=h({format:hB.optional(),create:S().default(!0),overwrite:S().default(!0),path:r().optional(),prettify:S().optional(),indent:P().optional(),sortKeys:S().optional(),backup:S().optional(),atomic:S().optional(),loader:r().optional().describe(`Specific loader to use (e.g. filesystem, database)`)}),Qbe=h({success:S(),path:r().optional(),stats:gB.optional(),etag:r().optional(),size:P().optional(),saveTime:P().optional(),backupPath:r().optional()}),$be=h({type:E([`add`,`change`,`unlink`,`added`,`changed`,`deleted`]),path:r(),name:r().optional(),stats:gB.optional(),metadataType:r().optional(),data:u().optional(),timestamp:r().datetime().optional()}),exe=h({type:r(),count:P(),namespaces:C(r())}),txe=h({types:C(r()).optional(),namespaces:C(r()).optional(),output:r().describe(`Output directory or file`),format:hB.default(`json`)}),nxe=h({source:r().describe(`Input directory or file`),strategy:E([`merge`,`replace`,`skip`]).default(`merge`),validate:S().default(!0)}),_B=E([`filesystem`,`memory`,`none`]),rxe=E([`filesystem`,`database`,`api`,`migration`]),ixe=h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:_B.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory for filesystem-based metadata`),formats:C(hB).optional().describe(`Enabled metadata formats`),watch:S().optional().describe(`Enable file watching for filesystem loaders`),cache:S().optional().describe(`Enable metadata caching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`)}).optional().describe(`File watcher options`)}),vB=h({id:r(),metadataId:r().describe(`Foreign key to sys_metadata.id`),name:r(),type:r(),version:P().describe(`Version number at this snapshot`),operationType:E([`create`,`update`,`publish`,`revert`,`delete`]).describe(`Type of operation that created this history entry`),metadata:l([r(),d(r(),u())]).nullable().optional().describe(`Snapshot of metadata definition at this version (raw JSON string or parsed object)`),checksum:r().describe(`SHA-256 checksum of metadata content`),previousChecksum:r().optional().describe(`Checksum of the previous version`),changeNote:r().optional().describe(`Description of changes made in this version`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant isolation`),recordedBy:r().optional().describe(`User who made this change`),recordedAt:r().datetime().describe(`Timestamp when this version was recorded`)}),axe=h({limit:P().int().positive().optional().describe(`Maximum number of history records to return`),offset:P().int().nonnegative().optional().describe(`Number of records to skip`),since:r().datetime().optional().describe(`Only return history after this timestamp`),until:r().datetime().optional().describe(`Only return history before this timestamp`),operationType:E([`create`,`update`,`publish`,`revert`,`delete`]).optional().describe(`Filter by operation type`),includeMetadata:S().optional().default(!0).describe(`Include full metadata payload`)}),oxe=h({records:C(vB),total:P().int().nonnegative(),hasMore:S()}),sxe=h({type:r(),name:r(),version1:P(),version2:P(),checksum1:r(),checksum2:r(),identical:S(),patch:C(u()).optional().describe(`JSON patch operations`),summary:r().optional().describe(`Human-readable summary of changes`)}),cxe=h({maxVersions:P().int().positive().optional().describe(`Maximum number of versions to retain`),maxAgeDays:P().int().positive().optional().describe(`Maximum age of history records in days`),autoCleanup:S().default(!1).describe(`Enable automatic cleanup of old history`),cleanupIntervalHours:P().int().positive().default(24).describe(`How often to run cleanup (in hours)`)}),yB=E([`metadata`,`data`,`auth`,`file-storage`,`search`,`cache`,`queue`,`automation`,`graphql`,`analytics`,`realtime`,`job`,`notification`,`ai`,`i18n`,`ui`,`workflow`]),bB=E([`required`,`core`,`optional`]),lxe={data:`required`,metadata:`core`,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`},uxe=h({name:yB,enabled:S(),status:E([`running`,`stopped`,`degraded`,`initializing`]),version:r().optional(),provider:r().optional().describe(`Implementation provider (e.g. "s3" for storage)`),features:C(r()).optional().describe(`List of supported sub-features`)}),dxe=d(yB,u().describe(`Service Instance implementing the protocol interface`)),fxe=h({id:r(),name:yB,options:d(r(),u()).optional()}),xB=E([`shared_schema`,`isolated_schema`,`isolated_db`]),SB=E([`turso`,`postgres`,`memory`]).describe(`Database provider for tenant data`),CB=h({url:r().min(1).describe(`Database connection URL`),authToken:r().optional().describe(`Database auth token (encrypted at rest)`),group:r().optional().describe(`Turso database group name`)}).describe(`Tenant database connection configuration`),wB=h({maxUsers:P().int().positive().optional().describe(`Maximum number of users`),maxStorage:P().int().positive().optional().describe(`Maximum storage in bytes`),apiRateLimit:P().int().positive().optional().describe(`API requests per minute`),maxObjects:P().int().positive().optional().describe(`Maximum number of custom objects`),maxRecordsPerObject:P().int().positive().optional().describe(`Maximum records per object`),maxDeploymentsPerDay:P().int().positive().optional().describe(`Maximum deployments per day`),maxStorageBytes:P().int().positive().optional().describe(`Maximum storage in bytes`)}),pxe=h({currentObjectCount:P().int().min(0).default(0).describe(`Current number of custom objects`),currentRecordCount:P().int().min(0).default(0).describe(`Total records across all objects`),currentStorageBytes:P().int().min(0).default(0).describe(`Current storage usage in bytes`),deploymentsToday:P().int().min(0).default(0).describe(`Deployments executed today`),currentUsers:P().int().min(0).default(0).describe(`Current number of active users`),apiRequestsThisMinute:P().int().min(0).default(0).describe(`API requests in the current minute`),lastUpdatedAt:r().datetime().optional().describe(`Last usage update time`)}).describe(`Current tenant resource usage`),mxe=h({allowed:S().describe(`Whether the operation is within quota`),exceededQuota:r().optional().describe(`Name of the exceeded quota`),currentUsage:P().optional().describe(`Current usage value`),limit:P().optional().describe(`Quota limit`),message:r().optional().describe(`Human-readable quota message`)}).describe(`Quota enforcement check result`),hxe=h({id:r().describe(`Unique tenant identifier`),name:r().describe(`Tenant display name`),isolationLevel:xB,databaseProvider:SB.optional().describe(`Database provider`),connectionConfig:CB.optional().describe(`Database connection config`),provisioningStatus:E([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).optional().describe(`Current provisioning lifecycle status`),plan:E([`free`,`pro`,`enterprise`]).optional().describe(`Subscription plan`),customizations:d(r(),u()).optional().describe(`Custom configuration values`),quotas:wB.optional()}),TB=h({strategy:m(`shared_schema`).describe(`Row-level isolation strategy`),database:h({enableRLS:S().default(!0).describe(`Enable PostgreSQL Row-Level Security`),contextMethod:E([`session_variable`,`search_path`,`application_name`]).default(`session_variable`).describe(`How to set tenant context`),contextVariable:r().default(`app.current_tenant`).describe(`Session variable name`),applicationValidation:S().default(!0).describe(`Application-level tenant validation`)}).optional().describe(`Database configuration`),performance:h({usePartialIndexes:S().default(!0).describe(`Use partial indexes per tenant`),usePartitioning:S().default(!1).describe(`Use table partitioning by tenant_id`),poolSizePerTenant:P().int().positive().optional().describe(`Connection pool size per tenant`)}).optional().describe(`Performance settings`)}),EB=h({strategy:m(`isolated_schema`).describe(`Schema-level isolation strategy`),schema:h({namingPattern:r().default(`tenant_{tenant_id}`).describe(`Schema naming pattern`),includePublicSchema:S().default(!0).describe(`Include public schema`),sharedSchema:r().default(`public`).describe(`Schema for shared resources`),autoCreateSchema:S().default(!0).describe(`Auto-create schema`)}).optional().describe(`Schema configuration`),migrations:h({strategy:E([`parallel`,`sequential`,`on_demand`]).default(`parallel`).describe(`Migration strategy`),maxConcurrent:P().int().positive().default(10).describe(`Max concurrent migrations`),rollbackOnError:S().default(!0).describe(`Rollback on error`)}).optional().describe(`Migration configuration`),performance:h({poolPerSchema:S().default(!1).describe(`Separate pool per schema`),schemaCacheTTL:P().int().positive().default(3600).describe(`Schema cache TTL`)}).optional().describe(`Performance settings`)}),DB=h({strategy:m(`isolated_db`).describe(`Database-level isolation strategy`),database:h({namingPattern:r().default(`tenant_{tenant_id}`).describe(`Database naming pattern`),serverStrategy:E([`shared`,`sharded`,`dedicated`]).default(`shared`).describe(`Server assignment strategy`),separateCredentials:S().default(!0).describe(`Separate credentials per tenant`),autoCreateDatabase:S().default(!0).describe(`Auto-create database`)}).optional().describe(`Database configuration`),connectionPool:h({poolSize:P().int().positive().default(10).describe(`Connection pool size`),maxActivePools:P().int().positive().default(100).describe(`Max active pools`),idleTimeout:P().int().positive().default(300).describe(`Idle pool timeout`),usePooler:S().default(!0).describe(`Use connection pooler`)}).optional().describe(`Connection pool configuration`),backup:h({strategy:E([`individual`,`consolidated`,`on_demand`]).default(`individual`).describe(`Backup strategy`),frequencyHours:P().int().positive().default(24).describe(`Backup frequency`),retentionDays:P().int().positive().default(30).describe(`Backup retention days`)}).optional().describe(`Backup configuration`),encryption:h({perTenantKeys:S().default(!1).describe(`Per-tenant encryption keys`),algorithm:r().default(`AES-256-GCM`).describe(`Encryption algorithm`),keyManagement:E([`aws_kms`,`azure_key_vault`,`gcp_kms`,`hashicorp_vault`,`custom`]).optional().describe(`Key management service`)}).optional().describe(`Encryption configuration`)}),gxe=I(`strategy`,[TB,EB,DB]),_xe=h({encryption:h({atRest:S().default(!0).describe(`Require encryption at rest`),inTransit:S().default(!0).describe(`Require encryption in transit`),fieldLevel:S().default(!1).describe(`Require field-level encryption`)}).optional().describe(`Encryption requirements`),accessControl:h({requireMFA:S().default(!1).describe(`Require MFA`),requireSSO:S().default(!1).describe(`Require SSO`),ipWhitelist:C(r()).optional().describe(`Allowed IP addresses`),sessionTimeout:P().int().positive().default(3600).describe(`Session timeout`)}).optional().describe(`Access control requirements`),compliance:h({standards:C(E([`sox`,`hipaa`,`gdpr`,`pci_dss`,`iso_27001`,`fedramp`])).optional().describe(`Compliance standards`),requireAuditLog:S().default(!0).describe(`Require audit logging`),auditRetentionDays:P().int().positive().default(365).describe(`Audit retention days`),dataResidency:h({region:r().optional().describe(`Required region (e.g., US, EU, APAC)`),excludeRegions:C(r()).optional().describe(`Prohibited regions`)}).optional().describe(`Data residency requirements`)}).optional().describe(`Compliance requirements`)}),OB=E([`boolean`,`counter`,`gauge`]).describe(`License metric type`),vxe=h({code:r().regex(/^[a-z_][a-z0-9_.]*$/).describe(`Feature code (e.g. core.api_access)`),label:r(),description:r().optional(),type:OB.default(`boolean`),unit:E([`count`,`bytes`,`seconds`,`percent`]).optional(),requires:C(r()).optional()}),yxe=h({code:r().describe(`Plan code (e.g. pro_v1)`),label:r(),active:S().default(!0),features:C(r()).describe(`List of enabled boolean features`),limits:d(r(),P()).describe(`Map of metric codes to limit values (e.g. { storage_gb: 10 })`),currency:r().default(`USD`).optional(),priceMonthly:P().optional(),priceYearly:P().optional()}),bxe=h({spaceId:r().describe(`Target Space ID`),planCode:r(),issuedAt:r().datetime(),expiresAt:r().datetime().optional(),status:E([`active`,`expired`,`suspended`,`trial`]),customFeatures:C(r()).optional(),customLimits:d(r(),P()).optional(),plugins:C(r()).optional().describe(`List of enabled plugin package IDs`),signature:r().optional().describe(`Cryptographic signature of the license`)}),kB=E([`manual`,`auto`,`proxy`]).describe(`Registry synchronization strategy`),AB=h({url:r().url().describe(`Upstream registry endpoint`),syncPolicy:kB.default(`auto`),syncInterval:P().int().min(60).optional().describe(`Auto-sync interval in seconds`),auth:h({type:E([`none`,`basic`,`bearer`,`api-key`,`oauth2`]).default(`none`),username:r().optional(),password:r().optional(),token:r().optional(),apiKey:r().optional()}).optional(),tls:h({enabled:S().default(!0),verifyCertificate:S().default(!0),certificate:r().optional(),privateKey:r().optional()}).optional(),timeout:P().int().min(1e3).default(3e4).describe(`Request timeout in milliseconds`),retry:h({maxAttempts:P().int().min(0).default(3),backoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`)}).optional()}),xxe=h({type:E([`public`,`private`,`hybrid`]).describe(`Registry deployment type`),upstream:C(AB).optional().describe(`Upstream registries to sync from or proxy to`),scope:C(r()).optional().describe(`npm-style scopes managed by this registry (e.g., @my-corp, @enterprise)`),defaultScope:r().optional().describe(`Default scope prefix for new plugins`),storage:h({backend:E([`local`,`s3`,`gcs`,`azure-blob`,`oss`]).default(`local`),path:r().optional(),credentials:d(r(),u()).optional()}).optional(),visibility:E([`public`,`private`,`internal`]).default(`private`).describe(`Who can access this registry`),accessControl:h({requireAuthForRead:S().default(!1),requireAuthForWrite:S().default(!0),allowedPrincipals:C(r()).optional()}).optional(),cache:h({enabled:S().default(!0),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().optional().describe(`Maximum cache size in bytes`)}).optional(),mirrors:C(h({url:r().url(),priority:P().int().min(1).default(1)})).optional().describe(`Mirror registries for redundancy`)}),jB=E([`provisioning`,`active`,`suspended`,`failed`,`destroying`]).describe(`Tenant provisioning lifecycle status`),MB=E([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),NB=E([`us-east`,`us-west`,`eu-west`,`eu-central`,`ap-southeast`,`ap-northeast`]).describe(`Available deployment region`),PB=h({name:r().min(1).describe(`Step name (e.g., create_database, sync_schema)`),status:E([`pending`,`running`,`completed`,`failed`,`skipped`]).describe(`Step status`),startedAt:r().datetime().optional().describe(`Step start time`),completedAt:r().datetime().optional().describe(`Step completion time`),durationMs:P().int().min(0).optional().describe(`Step duration in ms`),error:r().optional().describe(`Error message on failure`)}).describe(`Individual provisioning step status`),Sxe=h({orgId:r().min(1).describe(`Organization ID`),plan:MB.default(`free`),region:NB.default(`us-east`),displayName:r().optional().describe(`Tenant display name`),adminEmail:r().email().optional().describe(`Initial admin user email`),metadata:d(r(),u()).optional().describe(`Additional metadata`)}).describe(`Tenant provisioning request`),Cxe=h({tenantId:r().min(1).describe(`Provisioned tenant ID`),connectionUrl:r().min(1).describe(`Database connection URL`),status:jB,region:NB,plan:MB,steps:C(PB).default([]).describe(`Pipeline step statuses`),totalDurationMs:P().int().min(0).optional().describe(`Total provisioning duration`),provisionedAt:r().datetime().optional().describe(`Provisioning completion time`),error:r().optional().describe(`Error message on failure`)}).describe(`Tenant provisioning result`),wxe=E([`validating`,`diffing`,`migrating`,`registering`,`ready`,`failed`,`rolling_back`]).describe(`Deployment lifecycle status`),FB=h({entityType:E([`object`,`field`,`index`,`view`,`flow`,`permission`]).describe(`Entity type`),entityName:r().min(1).describe(`Entity name`),parentEntity:r().optional().describe(`Parent entity name`),changeType:E([`added`,`modified`,`removed`]).describe(`Change type`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`)}).describe(`Individual schema change`),Txe=h({changes:C(FB).default([]).describe(`List of schema changes`),summary:h({added:P().int().min(0).default(0).describe(`Number of added entities`),modified:P().int().min(0).default(0).describe(`Number of modified entities`),removed:P().int().min(0).default(0).describe(`Number of removed entities`)}).describe(`Change summary counts`),hasBreakingChanges:S().default(!1).describe(`Whether diff contains breaking changes`)}).describe(`Schema diff between current and desired state`),IB=h({sql:r().min(1).describe(`SQL DDL statement`),reversible:S().default(!0).describe(`Whether the statement can be reversed`),rollbackSql:r().optional().describe(`Reverse SQL for rollback`),order:P().int().min(0).describe(`Execution order`)}).describe(`Single DDL migration statement`),Exe=h({statements:C(IB).default([]).describe(`Ordered DDL statements`),dialect:r().min(1).describe(`Target SQL dialect`),reversible:S().default(!0).describe(`Whether the plan can be fully rolled back`),estimatedDurationMs:P().int().min(0).optional().describe(`Estimated execution time`)}).describe(`Ordered migration plan`),LB=h({severity:E([`error`,`warning`,`info`]).describe(`Issue severity`),path:r().describe(`Entity path (e.g., objects.project_task.fields.name)`),message:r().describe(`Issue description`),code:r().optional().describe(`Validation error code`)}).describe(`Validation issue`),Dxe=h({valid:S().describe(`Whether the bundle is valid`),issues:C(LB).default([]).describe(`Validation issues`),errorCount:P().int().min(0).default(0).describe(`Number of errors`),warningCount:P().int().min(0).default(0).describe(`Number of warnings`)}).describe(`Bundle validation result`),RB=h({version:r().min(1).describe(`Deployment version`),checksum:r().optional().describe(`SHA256 checksum`),objects:C(r()).default([]).describe(`Object names included`),views:C(r()).default([]).describe(`View names included`),flows:C(r()).default([]).describe(`Flow names included`),permissions:C(r()).default([]).describe(`Permission names included`),createdAt:r().datetime().optional().describe(`Bundle creation time`)}).describe(`Deployment manifest`),Oxe=h({manifest:RB,objects:C(d(r(),u())).default([]).describe(`Object definitions`),views:C(d(r(),u())).default([]).describe(`View definitions`),flows:C(d(r(),u())).default([]).describe(`Flow definitions`),permissions:C(d(r(),u())).default([]).describe(`Permission definitions`),seedData:C(d(r(),u())).default([]).describe(`Seed data records`)}).describe(`Deploy bundle containing all metadata for deployment`),kxe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`App identifier (snake_case)`),label:r().min(1).describe(`App display label`),version:r().min(1).describe(`App version (semver)`),description:r().optional().describe(`App description`),minKernelVersion:r().optional().describe(`Minimum required kernel version`),objects:C(r()).default([]).describe(`Object names provided`),views:C(r()).default([]).describe(`View names provided`),flows:C(r()).default([]).describe(`Flow names provided`),hasSeedData:S().default(!1).describe(`Whether app includes seed data`),seedData:C(d(r(),u())).default([]).describe(`Seed data records`),dependencies:C(r()).default([]).describe(`Required app dependencies`)}).describe(`App manifest for marketplace installation`),Axe=h({compatible:S().describe(`Whether the app is compatible`),issues:C(h({severity:E([`error`,`warning`]).describe(`Issue severity`),message:r().describe(`Issue description`),category:E([`kernel_version`,`object_conflict`,`dependency_missing`,`quota_exceeded`]).describe(`Issue category`)})).default([]).describe(`Compatibility issues`)}).describe(`App compatibility check result`),jxe=h({tenantId:r().min(1).describe(`Target tenant ID`),appId:r().min(1).describe(`App identifier`),configOverrides:d(r(),u()).optional().describe(`Configuration overrides`),skipSeedData:S().default(!1).describe(`Skip seed data population`)}).describe(`App install request`),Mxe=h({success:S().describe(`Whether installation succeeded`),appId:r().describe(`Installed app identifier`),version:r().describe(`Installed app version`),installedObjects:C(r()).default([]).describe(`Objects created/updated`),createdTables:C(r()).default([]).describe(`Database tables created`),seededRecords:P().int().min(0).default(0).describe(`Seed records inserted`),durationMs:P().int().min(0).optional().describe(`Installation duration`),error:r().optional().describe(`Error message on failure`)}).describe(`App install result`),Nxe={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`}},Pxe={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`,USER_PREFERENCE:`sys_user_preference`,ROLE:`sys_role`,PERMISSION_SET:`sys_permission_set`,AUDIT_LOG:`sys_audit_log`,METADATA:`sys_metadata`,PRESENCE:`sys_presence`},Fxe={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`},Ixe={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}};DA({},{ActivationEventSchema:()=>MH,AdvancedPluginLifecycleConfigSchema:()=>kSe,ArtifactChecksumSchema:()=>VB,ArtifactFileEntrySchema:()=>BB,ArtifactSignatureSchema:()=>HB,BreakingChangeSchema:()=>QH,CLICommandContributionSchema:()=>Lxe,CORE_PLUGIN_TYPES:()=>LV,CapabilityConformanceLevelSchema:()=>gV,CompatibilityLevelSchema:()=>ZH,CompatibilityMatrixEntrySchema:()=>eU,CustomizationOriginSchema:()=>aSe,CustomizationPolicySchema:()=>UV,DEFAULT_METADATA_TYPE_REGISTRY:()=>vSe,DeadLetterQueueEntrySchema:()=>Xxe,DependencyConflictSchema:()=>tU,DependencyGraphNodeSchema:()=>pU,DependencyGraphSchema:()=>mU,DependencyResolutionResultSchema:()=>QB,DependencyStatusEnum:()=>YB,DeprecationNoticeSchema:()=>$H,DevFixtureConfigSchema:()=>eV,DevPluginConfigSchema:()=>Kxe,DevPluginPreset:()=>nV,DevServiceOverrideSchema:()=>$B,DevToolsConfigSchema:()=>tV,DisablePackageRequestSchema:()=>mH,DisablePackageResponseSchema:()=>hH,DistributedStateConfigSchema:()=>CH,DynamicLoadRequestSchema:()=>BSe,DynamicLoadingConfigSchema:()=>USe,DynamicPluginOperationSchema:()=>AH,DynamicPluginResultSchema:()=>HSe,DynamicUnloadRequestSchema:()=>VSe,EVENT_PRIORITY_VALUES:()=>qxe,EnablePackageRequestSchema:()=>fH,EnablePackageResponseSchema:()=>pH,EventBusConfigSchema:()=>Qxe,EventHandlerSchema:()=>sV,EventLogEntrySchema:()=>Zxe,EventMessageQueueConfigSchema:()=>fV,EventMetadataSchema:()=>iV,EventPersistenceSchema:()=>cV,EventPhaseSchema:()=>DH,EventPriority:()=>rV,EventQueueConfigSchema:()=>lV,EventReplayConfigSchema:()=>Yxe,EventRouteSchema:()=>Jxe,EventSchema:()=>oV,EventSourcingConfigSchema:()=>uV,EventTypeDefinitionSchema:()=>aV,EventWebhookConfigSchema:()=>dV,ExecutionContextSchema:()=>CM,ExtensionPointSchema:()=>CV,FeatureFlag:()=>$xe,FeatureFlagSchema:()=>hV,FeatureStrategy:()=>mV,FieldChangeSchema:()=>zV,GetPackageRequestSchema:()=>oH,GetPackageResponseSchema:()=>sH,GracefulDegradationSchema:()=>TH,HealthStatusSchema:()=>rU,HookRegisteredEventSchema:()=>FSe,HookTriggeredEventSchema:()=>ISe,HotReloadConfigSchema:()=>wH,InstallPackageRequestSchema:()=>cH,InstallPackageResponseSchema:()=>lH,InstalledPackageSchema:()=>rH,KernelContextSchema:()=>JB,KernelEventBaseSchema:()=>kH,KernelReadyEventSchema:()=>LSe,KernelSecurityPolicySchema:()=>WH,KernelSecurityScanResultSchema:()=>UH,KernelSecurityVulnerabilitySchema:()=>HH,KernelShutdownEventSchema:()=>RSe,ListPackagesRequestSchema:()=>iH,ListPackagesResponseSchema:()=>aH,ManifestSchema:()=>RV,MergeConflictSchema:()=>VV,MergeResultSchema:()=>oSe,MergeStrategyConfigSchema:()=>HV,MetadataBulkRegisterRequestSchema:()=>ySe,MetadataBulkResultSchema:()=>eH,MetadataCategoryEnum:()=>zB,MetadataChangeTypeSchema:()=>gH,MetadataCollectionInfoSchema:()=>mSe,MetadataDependencySchema:()=>tH,MetadataDiffItemSchema:()=>_H,MetadataEventSchema:()=>gSe,MetadataExportOptionsSchema:()=>lSe,MetadataFallbackStrategySchema:()=>KV,MetadataFormatSchema:()=>WV,MetadataImportOptionsSchema:()=>uSe,MetadataLoadOptionsSchema:()=>sSe,MetadataLoadResultSchema:()=>dSe,MetadataLoaderContractSchema:()=>hSe,MetadataManagerConfigSchema:()=>qV,MetadataOverlaySchema:()=>BV,MetadataPluginConfigSchema:()=>$V,MetadataPluginManifestSchema:()=>_Se,MetadataQueryResultSchema:()=>ZV,MetadataQuerySchema:()=>XV,MetadataSaveOptionsSchema:()=>cSe,MetadataSaveResultSchema:()=>fSe,MetadataStatsSchema:()=>GV,MetadataTypeRegistryEntrySchema:()=>YV,MetadataTypeSchema:()=>JV,MetadataValidationResultSchema:()=>QV,MetadataWatchEventSchema:()=>pSe,MultiVersionSupportSchema:()=>QSe,NamespaceConflictErrorSchema:()=>xSe,NamespaceRegistryEntrySchema:()=>bSe,OclifPluginConfigSchema:()=>Rxe,OpsDomainModuleSchema:()=>GSe,OpsFilePathSchema:()=>qH,OpsPluginStructureSchema:()=>KSe,PackageArtifactSchema:()=>UB,PackageDependencyConflictSchema:()=>hU,PackageDependencyResolutionResultSchema:()=>gU,PackageDependencySchema:()=>fU,PackageStatusEnum:()=>nH,PermissionActionSchema:()=>IH,PermissionSchema:()=>RH,PermissionScopeSchema:()=>FH,PermissionSetSchema:()=>zH,PluginBuildOptionsSchema:()=>zxe,PluginBuildResultSchema:()=>Bxe,PluginCachingSchema:()=>MV,PluginCapabilityManifestSchema:()=>wV,PluginCapabilitySchema:()=>bV,PluginCodeSplittingSchema:()=>DV,PluginCompatibilityMatrixSchema:()=>XSe,PluginContextSchema:()=>nSe,PluginDependencyResolutionResultSchema:()=>ZSe,PluginDependencyResolutionSchema:()=>AV,PluginDependencySchema:()=>SV,PluginDiscoveryConfigSchema:()=>PH,PluginDiscoverySourceSchema:()=>NH,PluginDynamicImportSchema:()=>OV,PluginErrorEventSchema:()=>MSe,PluginEventBaseSchema:()=>OH,PluginHealthCheckSchema:()=>SH,PluginHealthReportSchema:()=>DSe,PluginHealthStatusSchema:()=>xH,PluginHotReloadSchema:()=>jV,PluginInitializationSchema:()=>kV,PluginInstallConfigSchema:()=>lCe,PluginInterfaceSchema:()=>xV,PluginLifecycleEventType:()=>zSe,PluginLifecyclePhaseEventSchema:()=>jSe,PluginLifecycleSchema:()=>IV,PluginLoadingConfigSchema:()=>FV,PluginLoadingEventSchema:()=>eSe,PluginLoadingStateSchema:()=>tSe,PluginLoadingStrategySchema:()=>TV,PluginMetadataSchema:()=>JSe,PluginPerformanceMonitoringSchema:()=>PV,PluginPreloadConfigSchema:()=>EV,PluginProvenanceSchema:()=>yU,PluginPublishOptionsSchema:()=>Uxe,PluginPublishResultSchema:()=>Wxe,PluginQualityMetricsSchema:()=>oU,PluginRegisteredEventSchema:()=>ASe,PluginRegistryEntrySchema:()=>sCe,PluginSandboxingSchema:()=>NV,PluginSchema:()=>iSe,PluginSearchFiltersSchema:()=>cCe,PluginSecurityManifestSchema:()=>WSe,PluginSecurityProtocol:()=>uCe,PluginSourceSchema:()=>jH,PluginStartupResultSchema:()=>iU,PluginStateSnapshotSchema:()=>OSe,PluginStatisticsSchema:()=>sU,PluginTrustLevelSchema:()=>GH,PluginTrustScoreSchema:()=>bU,PluginUpdateStrategySchema:()=>EH,PluginValidateOptionsSchema:()=>Vxe,PluginValidateResultSchema:()=>Hxe,PluginVendorSchema:()=>aU,PluginVersionMetadataSchema:()=>$Se,PreviewModeConfigSchema:()=>qB,ProtocolFeatureSchema:()=>yV,ProtocolReferenceSchema:()=>vV,ProtocolVersionSchema:()=>_V,RealTimeNotificationConfigSchema:()=>pV,RequiredActionSchema:()=>ZB,ResolvedDependencySchema:()=>XB,ResourceTypeSchema:()=>LH,RollbackPackageRequestSchema:()=>TSe,RollbackPackageResponseSchema:()=>ESe,RuntimeConfigSchema:()=>BH,RuntimeMode:()=>KB,SBOMEntrySchema:()=>_U,SBOMSchema:()=>vU,SandboxConfigSchema:()=>VH,ScopeConfigSchema:()=>rCe,ScopeInfoSchema:()=>iCe,SecurityPolicySchema:()=>dU,SecurityScanResultSchema:()=>uU,SecurityVulnerabilitySchema:()=>lU,SemanticVersionSchema:()=>XH,ServiceFactoryRegistrationSchema:()=>nCe,ServiceMetadataSchema:()=>eCe,ServiceRegisteredEventSchema:()=>NSe,ServiceRegistryConfigSchema:()=>tCe,ServiceScopeType:()=>nU,ServiceUnregisteredEventSchema:()=>PSe,StartupOptionsSchema:()=>aCe,StartupOrchestrationResultSchema:()=>oCe,TenantRuntimeContextSchema:()=>Gxe,UninstallPackageRequestSchema:()=>uH,UninstallPackageResponseSchema:()=>dH,UpgradeContextSchema:()=>rSe,UpgradeImpactLevelSchema:()=>vH,UpgradePackageRequestSchema:()=>CSe,UpgradePackageResponseSchema:()=>wSe,UpgradePhaseSchema:()=>bH,UpgradePlanSchema:()=>yH,UpgradeSnapshotSchema:()=>SSe,ValidationErrorSchema:()=>JH,ValidationFindingSchema:()=>GB,ValidationResultSchema:()=>qSe,ValidationSeverityEnum:()=>WB,ValidationWarningSchema:()=>YH,VersionConstraintSchema:()=>YSe,VulnerabilitySeverity:()=>cU});var Lxe=h({name:r().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:r().optional().describe(`Command description for help text`),module:r().optional().describe(`Module path exporting oclif Command classes`)}),Rxe=h({commands:h({strategy:E([`pattern`,`explicit`,`single`]).optional().describe(`Command discovery strategy`),target:r().optional().describe(`Target directory for command files`),glob:r().optional().describe(`Glob pattern for command file matching`)}).optional().describe(`Command discovery configuration`),topicSeparator:r().optional().describe(`Character separating topic and command names`)}).describe(`oclif plugin configuration section`),zB=E([`objects`,`views`,`pages`,`flows`,`dashboards`,`permissions`,`agents`,`reports`,`actions`,`translations`,`themes`,`datasets`,`apis`,`triggers`,`workflows`]).describe(`Metadata category within the artifact`),BB=h({path:r().describe(`Relative file path within the artifact`),size:P().int().nonnegative().describe(`File size in bytes`),category:zB.optional().describe(`Metadata category this file belongs to`)}).describe(`A single file entry within the artifact`),VB=h({algorithm:E([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm used for checksums`),files:d(r(),r().regex(/^[a-f0-9]+$/)).describe(`File path to hash value mapping`)}).describe(`Checksum manifest for artifact integrity verification`),HB=h({algorithm:E([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).default(`RSA-SHA256`).describe(`Signing algorithm used`),publicKeyRef:r().describe(`Public key reference (URL or fingerprint) for signature verification`),signature:r().describe(`Base64-encoded digital signature`),signedAt:r().datetime().optional().describe(`ISO 8601 timestamp of when the artifact was signed`),signedBy:r().optional().describe(`Identity of the signer (publisher ID or email)`)}).describe(`Digital signature for artifact authenticity verification`),UB=h({formatVersion:r().regex(/^\d+\.\d+$/).default(`1.0`).describe(`Artifact format version (e.g. "1.0")`),packageId:r().describe(`Package identifier from manifest`),version:r().describe(`Package version from manifest`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Archive format of the artifact`),size:P().int().positive().optional().describe(`Total artifact file size in bytes`),builtAt:r().datetime().describe(`ISO 8601 timestamp of when the artifact was built`),builtWith:r().optional().describe(`Build tool identifier (e.g. "os-cli@3.2.0")`),files:C(BB).optional().describe(`List of files contained in the artifact`),metadataCategories:C(zB).optional().describe(`Metadata categories included in this artifact`),checksums:VB.optional().describe(`SHA256 checksums for artifact integrity verification`),signature:HB.optional().describe(`Digital signature for artifact authenticity verification`)}).describe(`Package artifact structure and metadata`),zxe=h({directory:r().optional().describe(`Project root directory (defaults to current working directory)`),outDir:r().optional().describe(`Output directory for the built artifact (defaults to ./dist)`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Archive format for the artifact`),sign:S().default(!1).describe(`Whether to digitally sign the artifact`),privateKeyPath:r().optional().describe(`Path to RSA/ECDSA private key file for signing`),signAlgorithm:E([`RSA-SHA256`,`RSA-SHA384`,`RSA-SHA512`,`ECDSA-SHA256`]).optional().describe(`Signing algorithm to use`),checksumAlgorithm:E([`sha256`,`sha384`,`sha512`]).default(`sha256`).describe(`Hash algorithm for file checksums`),includeData:S().default(!0).describe(`Whether to include seed data in the artifact`),includeLocales:S().default(!0).describe(`Whether to include locale/translation files`)}).describe(`Options for the os plugin build command`),Bxe=h({success:S().describe(`Whether the build succeeded`),artifactPath:r().optional().describe(`Absolute path to the generated artifact file`),artifact:UB.optional().describe(`Artifact metadata`),fileCount:P().int().min(0).optional().describe(`Total number of files in the artifact`),size:P().int().min(0).optional().describe(`Total artifact size in bytes`),durationMs:P().optional().describe(`Build duration in milliseconds`),errorMessage:r().optional().describe(`Error message if build failed`),warnings:C(r()).optional().describe(`Warnings emitted during build`)}).describe(`Result of the os plugin build command`),WB=E([`error`,`warning`,`info`]).describe(`Validation issue severity`),GB=h({severity:WB.describe(`Issue severity level`),rule:r().describe(`Validation rule identifier`),message:r().describe(`Human-readable finding description`),path:r().optional().describe(`Relative file path within the artifact`)}).describe(`A single validation finding`),Vxe=h({artifactPath:r().describe(`Path to the artifact file to validate`),verifySignature:S().default(!0).describe(`Whether to verify the digital signature`),publicKeyPath:r().optional().describe(`Path to the public key for signature verification`),verifyChecksums:S().default(!0).describe(`Whether to verify checksums of all files`),validateMetadata:S().default(!0).describe(`Whether to validate metadata against schemas`),platformVersion:r().optional().describe(`Platform version for compatibility verification`)}).describe(`Options for the os plugin validate command`),Hxe=h({valid:S().describe(`Whether the artifact passed validation`),artifact:UB.optional().describe(`Extracted artifact metadata`),checksumVerification:h({passed:S().describe(`Whether all checksums match`),checksums:VB.optional().describe(`Verified checksums`),mismatches:C(r()).optional().describe(`Files with checksum mismatches`)}).optional().describe(`Checksum verification result`),signatureVerification:h({passed:S().describe(`Whether the signature is valid`),signature:HB.optional().describe(`Signature details`),failureReason:r().optional().describe(`Signature verification failure reason`)}).optional().describe(`Signature verification result`),platformCompatibility:h({compatible:S().describe(`Whether artifact is compatible`),requiredRange:r().optional().describe(`Required platform version range`),targetVersion:r().optional().describe(`Target platform version`)}).optional().describe(`Platform compatibility check result`),findings:C(GB).describe(`All validation findings`),summary:h({errors:P().int().min(0).describe(`Error count`),warnings:P().int().min(0).describe(`Warning count`),infos:P().int().min(0).describe(`Info count`)}).optional().describe(`Finding counts by severity`)}).describe(`Result of the os plugin validate command`),Uxe=h({artifactPath:r().describe(`Path to the artifact file to publish`),registryUrl:r().url().optional().describe(`Marketplace API base URL`),token:r().optional().describe(`Authentication token for marketplace API`),releaseNotes:r().optional().describe(`Release notes for this version`),preRelease:S().default(!1).describe(`Whether this is a pre-release version`),skipValidation:S().default(!1).describe(`Whether to skip local validation before publish`),access:E([`public`,`restricted`]).default(`public`).describe(`Package access level on the marketplace`),tags:C(r()).optional().describe(`Tags for marketplace categorization`)}).describe(`Options for the os plugin publish command`),Wxe=h({success:S().describe(`Whether the publish succeeded`),packageId:r().optional().describe(`Published package identifier`),version:r().optional().describe(`Published version string`),artifactUrl:r().url().optional().describe(`URL of the published artifact in the marketplace`),sha256:r().optional().describe(`SHA256 checksum of the uploaded artifact`),submissionId:r().optional().describe(`Marketplace submission ID for review tracking`),errorMessage:r().optional().describe(`Error message if publish failed`),message:r().optional().describe(`Human-readable status message`)}).describe(`Result of the os plugin publish command`),KB=E([`development`,`production`,`test`,`provisioning`,`preview`]).describe(`Kernel operating mode`),qB=h({autoLogin:S().default(!0).describe(`Auto-login as simulated user, skipping login/registration pages`),simulatedRole:E([`admin`,`user`,`viewer`]).default(`admin`).describe(`Permission role for the simulated preview user`),simulatedUserName:r().default(`Preview User`).describe(`Display name for the simulated preview user`),readOnly:S().default(!1).describe(`Restrict the preview session to read-only operations`),expiresInSeconds:P().int().min(0).default(0).describe(`Preview session duration in seconds (0 = no expiration)`),bannerMessage:r().optional().describe(`Banner message displayed in the UI during preview mode`)}),JB=h({instanceId:r().uuid().describe(`Unique UUID for this running kernel process`),mode:KB.default(`production`),version:r().describe(`Kernel version`),appName:r().optional().describe(`Host application name`),cwd:r().describe(`Current working directory`),workspaceRoot:r().optional().describe(`Workspace root if different from cwd`),startTime:P().int().describe(`Boot timestamp (ms)`),features:d(r(),S()).default({}).describe(`Global feature toggles`),previewMode:qB.optional().describe(`Preview/demo mode configuration (used when mode is "preview")`)}),Gxe=JB.extend({tenantId:r().min(1).describe(`Resolved tenant identifier`),tenantPlan:E([`free`,`pro`,`enterprise`]).describe(`Tenant subscription plan`),tenantRegion:r().optional().describe(`Tenant deployment region`),tenantDbUrl:r().min(1).describe(`Tenant database connection URL`),tenantQuotas:wB.optional().describe(`Tenant resource quotas`)}).describe(`Tenant-aware kernel runtime context`),YB=E([`satisfied`,`needs_install`,`needs_upgrade`,`conflict`]).describe(`Resolution status for a dependency`),XB=h({packageId:r().describe(`Dependency package identifier`),requiredRange:r().describe(`SemVer range required (e.g. "^2.0.0")`),resolvedVersion:r().optional().describe(`Actual version resolved from registry`),installedVersion:r().optional().describe(`Currently installed version`),status:YB.describe(`Resolution status`),conflictReason:r().optional().describe(`Explanation of the conflict`)}).describe(`Resolution result for a single dependency`),ZB=h({type:E([`install`,`upgrade`,`confirm_conflict`]).describe(`Type of action required`),packageId:r().describe(`Target package identifier`),description:r().describe(`Human-readable action description`)}).describe(`Action required before installation can proceed`),QB=h({dependencies:C(XB).describe(`Resolution result for each dependency`),canProceed:S().describe(`Whether installation can proceed`),requiredActions:C(ZB).describe(`Actions required before proceeding`),installOrder:C(r()).describe(`Topologically sorted package IDs for installation`),circularDependencies:C(C(r())).optional().describe(`Circular dependency chains detected (e.g. [["A", "B", "A"]])`)}).describe(`Complete dependency resolution result`),$B=h({service:r().min(1).describe(`Target service identifier`),enabled:S().default(!0).describe(`Enable or disable this service`),strategy:E([`mock`,`memory`,`stub`,`passthrough`]).default(`memory`).describe(`Implementation strategy for development`),config:d(r(),u()).optional().describe(`Strategy-specific configuration for this service override`)}),eV=h({enabled:S().default(!0).describe(`Load fixture data on startup`),paths:C(r()).optional().describe(`Glob patterns for fixture files`),resetBeforeLoad:S().default(!0).describe(`Clear existing data before loading fixtures`),envFilter:C(r()).optional().describe(`Only load fixtures matching these environment tags`)}),tV=h({hotReload:S().default(!0).describe(`Enable HMR / live-reload`),requestInspector:S().default(!1).describe(`Enable request inspector`),dbExplorer:S().default(!1).describe(`Enable database explorer UI`),verboseLogging:S().default(!0).describe(`Enable verbose logging`),apiDocs:S().default(!0).describe(`Serve OpenAPI docs at /_dev/docs`),mailCatcher:S().default(!1).describe(`Capture outbound emails in dev`)}),nV=E([`minimal`,`standard`,`full`]).describe(`Predefined dev configuration profile`),Kxe=h({preset:nV.default(`standard`).describe(`Base configuration preset`),services:d(r().min(1),$B.omit({service:!0})).optional().describe(`Per-service dev overrides keyed by service name`),fixtures:eV.optional().describe(`Fixture data loading configuration`),tools:tV.optional().describe(`Developer tooling settings`),port:P().int().min(1).max(65535).default(4400).describe(`Port for the dev-tools dashboard`),open:S().default(!1).describe(`Auto-open dev dashboard in browser`),seedAdminUser:S().default(!0).describe(`Create a default admin user for development`),simulatedLatency:P().int().min(0).default(0).describe(`Artificial latency (ms) added to service calls`)}),rV=E([`critical`,`high`,`normal`,`low`,`background`]),qxe={critical:0,high:1,normal:2,low:3,background:4},iV=h({source:r().describe(`Event source (e.g., plugin name, system component)`),timestamp:r().datetime().describe(`ISO 8601 datetime when event was created`),userId:r().optional().describe(`User who triggered the event`),tenantId:r().optional().describe(`Tenant identifier for multi-tenant systems`),correlationId:r().optional().describe(`Correlation ID for event tracing`),causationId:r().optional().describe(`ID of the event that caused this event`),priority:rV.optional().default(`normal`).describe(`Event priority`)}),aV=h({name:AA.describe(`Event type name (lowercase with dots)`),version:r().default(`1.0.0`).describe(`Event schema version`),schema:u().optional().describe(`JSON Schema for event payload validation`),description:r().optional().describe(`Event type description`),deprecated:S().optional().default(!1).describe(`Whether this event type is deprecated`),tags:C(r()).optional().describe(`Event type tags`)}),oV=h({id:r().optional().describe(`Unique event identifier`),name:AA.describe(`Event name (lowercase with dots, e.g., user.created, order.paid)`),payload:u().describe(`Event payload schema`),metadata:iV.describe(`Event metadata`)}),sV=h({id:r().optional().describe(`Unique handler identifier`),eventName:r().describe(`Name of event to handle (supports wildcards like user.*)`),handler:u().describe(`Handler function`),priority:P().int().default(0).describe(`Execution priority (lower numbers execute first)`),async:S().default(!0).describe(`Execute in background (true) or block (false)`),retry:h({maxRetries:P().int().min(0).default(3).describe(`Maximum retry attempts`),backoffMs:P().int().positive().default(1e3).describe(`Initial backoff delay`),backoffMultiplier:P().positive().default(2).describe(`Backoff multiplier`)}).optional().describe(`Retry policy for failed handlers`),timeoutMs:P().int().positive().optional().describe(`Handler timeout in milliseconds`),filter:u().optional().describe(`Optional filter to determine if handler should execute`)}),Jxe=h({from:r().describe(`Source event pattern (supports wildcards, e.g., user.* or *.created)`),to:C(r()).describe(`Target event names to route to`),transform:u().optional().describe(`Optional function to transform payload`)}),cV=h({enabled:S().default(!1).describe(`Enable event persistence`),retention:P().int().positive().describe(`Days to retain persisted events`),filter:u().optional().describe(`Optional filter function to select which events to persist`),storage:E([`database`,`file`,`s3`,`custom`]).default(`database`).describe(`Storage backend for persisted events`)}),lV=h({name:r().default(`events`).describe(`Event queue name`),concurrency:P().int().min(1).default(10).describe(`Max concurrent event handlers`),retryPolicy:h({maxRetries:P().int().min(0).default(3).describe(`Max retries for failed events`),backoffStrategy:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:P().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:P().int().positive().default(6e4).describe(`Maximum retry delay`)}).optional().describe(`Default retry policy for events`),deadLetterQueue:r().optional().describe(`Dead letter queue name for failed events`),priorityEnabled:S().default(!0).describe(`Process events based on priority`)}),Yxe=h({fromTimestamp:r().datetime().describe(`Start timestamp for replay (ISO 8601)`),toTimestamp:r().datetime().optional().describe(`End timestamp for replay (ISO 8601)`),eventTypes:C(r()).optional().describe(`Event types to replay (empty = all)`),filters:d(r(),u()).optional().describe(`Additional filters for event selection`),speed:P().positive().default(1).describe(`Replay speed multiplier (1 = real-time)`),targetHandlers:C(r()).optional().describe(`Handler IDs to execute (empty = all)`)}),uV=h({enabled:S().default(!1).describe(`Enable event sourcing`),snapshotInterval:P().int().positive().default(100).describe(`Create snapshot every N events`),snapshotRetention:P().int().positive().default(10).describe(`Number of snapshots to retain`),retention:P().int().positive().default(365).describe(`Days to retain events`),aggregateTypes:C(r()).optional().describe(`Aggregate types to enable event sourcing for`),storage:h({type:E([`database`,`file`,`s3`,`eventstore`]).default(`database`).describe(`Storage backend`),options:d(r(),u()).optional().describe(`Storage-specific options`)}).optional().describe(`Event store configuration`)}),Xxe=h({id:r().describe(`Unique entry identifier`),event:oV.describe(`Original event`),error:h({message:r().describe(`Error message`),stack:r().optional().describe(`Error stack trace`),code:r().optional().describe(`Error code`)}).describe(`Failure details`),retries:P().int().min(0).describe(`Number of retry attempts`),firstFailedAt:r().datetime().describe(`When event first failed`),lastFailedAt:r().datetime().describe(`When event last failed`),failedHandler:r().optional().describe(`Handler ID that failed`)}),Zxe=h({id:r().describe(`Unique log entry identifier`),event:oV.describe(`The event`),status:E([`pending`,`processing`,`completed`,`failed`]).describe(`Processing status`),handlersExecuted:C(h({handlerId:r().describe(`Handler identifier`),status:E([`success`,`failed`,`timeout`]).describe(`Handler execution status`),durationMs:P().int().optional().describe(`Execution duration`),error:r().optional().describe(`Error message if failed`)})).optional().describe(`Handlers that processed this event`),receivedAt:r().datetime().describe(`When event was received`),processedAt:r().datetime().optional().describe(`When event was processed`),totalDurationMs:P().int().optional().describe(`Total processing time`)}),dV=h({id:r().optional().describe(`Unique webhook identifier`),eventPattern:r().describe(`Event name pattern (supports wildcards)`),url:r().url().describe(`Webhook endpoint URL`),method:E([`GET`,`POST`,`PUT`,`PATCH`]).default(`POST`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`HTTP headers`),authentication:h({type:E([`none`,`bearer`,`basic`,`api-key`]).describe(`Auth type`),credentials:d(r(),r()).optional().describe(`Auth credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:h({maxRetries:P().int().min(0).default(3).describe(`Max retry attempts`),backoffStrategy:E([`fixed`,`linear`,`exponential`]).default(`exponential`),initialDelayMs:P().int().positive().default(1e3).describe(`Initial retry delay`),maxDelayMs:P().int().positive().default(6e4).describe(`Max retry delay`)}).optional().describe(`Retry policy`),timeoutMs:P().int().positive().default(3e4).describe(`Request timeout in milliseconds`),transform:u().optional().describe(`Transform event before sending`),enabled:S().default(!0).describe(`Whether webhook is enabled`)}),fV=h({provider:E([`kafka`,`rabbitmq`,`aws-sqs`,`redis-pubsub`,`google-pubsub`,`azure-service-bus`]).describe(`Message queue provider`),topic:r().describe(`Topic or queue name`),eventPattern:r().default(`*`).describe(`Event name pattern to publish (supports wildcards)`),partitionKey:r().optional().describe(`JSON path for partition key (e.g., "metadata.tenantId")`),format:E([`json`,`avro`,`protobuf`]).default(`json`).describe(`Message serialization format`),includeMetadata:S().default(!0).describe(`Include event metadata in message`),compression:E([`none`,`gzip`,`snappy`,`lz4`]).default(`none`).describe(`Message compression`),batchSize:P().int().min(1).default(1).describe(`Batch size for publishing`),flushIntervalMs:P().int().positive().default(1e3).describe(`Flush interval for batching`)}),pV=h({enabled:S().default(!0).describe(`Enable real-time notifications`),protocol:E([`websocket`,`sse`,`long-polling`]).default(`websocket`).describe(`Real-time protocol`),eventPattern:r().default(`*`).describe(`Event pattern to broadcast`),userFilter:S().default(!0).describe(`Filter events by user`),tenantFilter:S().default(!0).describe(`Filter events by tenant`),channels:C(h({name:r().describe(`Channel name`),eventPattern:r().describe(`Event pattern for channel`),filter:u().optional().describe(`Additional filter function`)})).optional().describe(`Named channels for event broadcasting`),rateLimit:h({maxEventsPerSecond:P().int().positive().describe(`Max events per second per client`),windowMs:P().int().positive().default(1e3).describe(`Rate limit window`)}).optional().describe(`Rate limiting configuration`)}),Qxe=h({persistence:cV.optional().describe(`Event persistence configuration`),queue:lV.optional().describe(`Event queue configuration`),eventSourcing:uV.optional().describe(`Event sourcing configuration`),replay:h({enabled:S().default(!0).describe(`Enable event replay capability`)}).optional().describe(`Event replay configuration`),webhooks:C(dV).optional().describe(`Webhook configurations`),messageQueue:fV.optional().describe(`Message queue integration`),realtime:pV.optional().describe(`Real-time notification configuration`),eventTypes:C(aV).optional().describe(`Event type definitions`),handlers:C(sV).optional().describe(`Global event handlers`)}),mV=E([`boolean`,`percentage`,`user_list`,`group`,`custom`]),hV=h({name:kA.describe(`Feature key (snake_case)`),label:r().optional().describe(`Display label`),description:r().optional(),enabled:S().default(!1).describe(`Is globally enabled`),strategy:mV.default(`boolean`),conditions:h({percentage:P().min(0).max(100).optional(),users:C(r()).optional(),groups:C(r()).optional(),expression:r().optional().describe(`Custom formula expression`)}).optional(),environment:E([`dev`,`staging`,`prod`,`all`]).default(`all`).describe(`Environment validity`),expiresAt:r().datetime().optional().describe(`Feature flag expiration date`)}),$xe=Object.assign(hV,{create:e=>e}),gV=E([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),_V=h({major:P().int().min(0),minor:P().int().min(0),patch:P().int().min(0)}).describe(`Semantic version of the protocol`),vV=h({id:r().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:r(),version:_V,specification:r().optional().describe(`URL or path to protocol specification`),description:r().optional()}),yV=h({name:r().describe(`Feature identifier within the protocol`),enabled:S().default(!0),description:r().optional(),sinceVersion:r().optional().describe(`Version when this feature was added`),deprecatedSince:r().optional().describe(`Version when deprecated`)}),bV=h({protocol:vV,conformance:gV.default(`full`),implementedFeatures:C(r()).optional().describe(`List of implemented feature names`),features:C(yV).optional(),metadata:d(r(),u()).optional(),certified:S().default(!1).describe(`Has passed official conformance tests`),certificationDate:r().datetime().optional()}),xV=h({id:r().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:r(),description:r().optional(),version:_V,methods:C(h({name:r().describe(`Method name`),description:r().optional(),parameters:C(h({name:r(),type:r().describe(`Type notation (e.g., string, number, User)`),required:S().default(!0),description:r().optional()})).optional(),returnType:r().optional().describe(`Return value type`),async:S().default(!1).describe(`Whether method returns a Promise`)})),events:C(h({name:r().describe(`Event name`),description:r().optional(),payload:r().optional().describe(`Event payload type`)})).optional(),stability:E([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),SV=h({pluginId:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:r().describe(`Semantic version constraint`),optional:S().default(!1),reason:r().optional(),requiredCapabilities:C(r()).optional().describe(`Protocol IDs the dependency must support`)}),CV=h({id:r().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:r(),description:r().optional(),type:E([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:h({input:r().optional().describe(`Input type/schema`),output:r().optional().describe(`Output type/schema`),signature:r().optional().describe(`Function signature if applicable`)}).optional(),cardinality:E([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),wV=h({implements:C(bV).optional().describe(`List of protocols this plugin conforms to`),provides:C(xV).optional().describe(`Services/APIs this plugin offers to others`),requires:C(SV).optional().describe(`Required plugins and their capabilities`),extensionPoints:C(CV).optional().describe(`Points where other plugins can extend this plugin`),extensions:C(h({targetPluginId:r().describe(`Plugin ID being extended`),extensionPointId:r().describe(`Extension point identifier`),implementation:r().describe(`Path to implementation module`),priority:P().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),TV=E([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),EV=h({enabled:S().default(!1),priority:P().int().min(0).default(100),resources:C(E([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:h({routes:C(r()).optional(),roles:C(r()).optional(),deviceType:C(E([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:E([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),DV=h({enabled:S().default(!0),strategy:E([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:E([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:P().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:h({enabled:S().default(!0),minChunks:P().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),OV=h({enabled:S().default(!0),mode:E([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:S().default(!1).describe(`Prefetch module in idle time`),preload:S().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:r().optional().describe(`Custom chunk name for webpack`),timeout:P().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:h({enabled:S().default(!0),maxAttempts:P().int().min(1).max(10).default(3),backoffMs:P().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),kV=h({mode:E([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:P().int().min(100).default(3e4),priority:P().int().min(0).default(100),critical:S().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:h({enabled:S().default(!1),maxAttempts:P().int().min(1).max(5).default(3),backoffMs:P().int().min(0).default(1e3)}).optional(),healthCheckInterval:P().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),AV=h({strategy:E([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:h({resolve:S().default(!0),onMissing:E([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:E([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:h({load:S().default(!0),onFailure:E([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:E([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:E([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),jV=h({enabled:S().default(!1),environment:E([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:E([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:C(r()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:C(r()).optional().describe(`Glob patterns for files to ignore`),debounceMs:P().int().min(0).default(300),preserveState:S().default(!1),stateSerialization:h({enabled:S().default(!1),handler:r().optional()}).optional(),hooks:h({beforeReload:r().optional().describe(`Function to call before reload`),afterReload:r().optional().describe(`Function to call after reload`),onError:r().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:h({healthValidation:S().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:S().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:P().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:S().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:P().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:P().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:P().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),MV=h({enabled:S().default(!0),storage:E([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:E([`version`,`hash`,`timestamp`]).default(`version`),ttl:P().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:P().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:C(E([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:h({enabled:S().default(!1),algorithm:E([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),NV=h({enabled:S().default(!1),scope:E([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:E([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:C(r()).optional().describe(`List of allowed capability IDs`),resourceQuotas:h({maxMemoryMB:P().int().min(1).optional(),maxCpuTimeMs:P().int().min(100).optional(),maxFileDescriptors:P().int().min(1).optional(),maxNetworkKBps:P().int().min(1).optional()}).optional(),permissions:h({allowedAPIs:C(r()).optional(),allowedPaths:C(r()).optional(),allowedEndpoints:C(r()).optional(),allowedEnvVars:C(r()).optional()}).optional(),ipc:h({enabled:S().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:E([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:P().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:P().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:C(r()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),PV=h({enabled:S().default(!1),metrics:C(E([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:P().min(0).max(1).default(1),reportingInterval:P().int().min(1).default(60),budgets:h({maxLoadTimeMs:P().int().min(0).optional(),maxInitTimeMs:P().int().min(0).optional(),maxMemoryMB:P().int().min(0).optional()}).optional(),onBudgetViolation:E([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),FV=h({strategy:TV.default(`lazy`),preload:EV.optional(),codeSplitting:DV.optional(),dynamicImport:OV.optional(),initialization:kV.optional(),dependencyResolution:AV.optional(),hotReload:jV.optional(),caching:MV.optional(),sandboxing:NV.optional(),monitoring:PV.optional()}).describe(`Complete plugin loading configuration`),eSe=h({type:E([`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:r(),timestamp:P().int().min(0),durationMs:P().int().min(0).optional(),metadata:d(r(),u()).optional(),error:h({message:r(),code:r().optional(),stack:r().optional()}).optional()}).describe(`Plugin loading lifecycle event`),tSe=h({pluginId:r(),state:E([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:P().min(0).max(100).default(0),startedAt:P().int().min(0).optional(),completedAt:P().int().min(0).optional(),lastError:r().optional(),retryCount:P().int().min(0).default(0)}).describe(`Plugin loading state`),nSe=h({ql:h({object:M().describe(`Get object handle for method chaining`),query:M().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:h({getCurrentUser:M().describe(`Get the current authenticated user`),getConfig:M().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:h({debug:M().describe(`Log debug message`),info:M().describe(`Log info message`),warn:M().describe(`Log warning message`),error:M().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:h({get:M().describe(`Get a value from storage`),set:M().describe(`Set a value in storage`),delete:M().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:h({t:M().describe(`Translate a key`),getLocale:M().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:d(r(),u()),events:d(r(),u()),app:h({router:h({get:M().describe(`Register GET route handler`),post:M().describe(`Register POST route handler`),use:M().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:h({register:M().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),rSe=h({previousVersion:r().describe(`Version before upgrade`),newVersion:r().describe(`Version after upgrade`),isMajorUpgrade:S().describe(`Whether this is a major version bump`),previousMetadata:d(r(),u()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`),IV=h({onInstall:M().optional().describe(`Called when plugin is installed`),onEnable:M().optional().describe(`Called when plugin is enabled`),onDisable:M().optional().describe(`Called when plugin is disabled`),onUninstall:M().optional().describe(`Called when plugin is uninstalled`),onUpgrade:M().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),LV=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`],iSe=IV.extend({id:r().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:E([`standard`,...LV]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:r().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:r().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:S().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:r().optional(),author:r().optional(),homepage:r().url().optional()}),RV=h({id:r().describe(`Unique package identifier (reverse domain style)`),namespace:r().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")`),defaultDatasource:r().optional().default(`default`).describe(`Default datasource for all objects in this package`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:E([`plugin`,...LV,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:r().describe(`Human-readable package name`),description:r().optional().describe(`Package description`),permissions:C(r()).optional().describe(`Array of required permission strings`),objects:C(r()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:C(r()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:d(r(),r()).optional().describe(`Package dependencies`),configuration:h({title:r().optional(),properties:d(r(),h({type:E([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:u().optional().describe(`Default value`),description:r().optional().describe(`Tooltip description`),required:S().optional().describe(`Is this setting required?`),secret:S().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:C(r()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:h({kinds:C(h({id:r().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:C(r()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:r().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:C(r()).optional().describe(`Events this plugin listens to`),menus:d(r(),C(h({id:r(),label:r(),command:r().optional()}))).optional().describe(`UI Menu contributions`),themes:C(h({id:r(),label:r(),path:r()})).optional().describe(`Theme contributions`),translations:C(h({locale:r(),path:r()})).optional().describe(`Translation resources`),actions:C(h({name:r().describe(`Unique action name`),label:r().optional(),description:r().optional(),input:u().optional().describe(`Input validation schema`),output:u().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:C(h({id:r().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:r().describe(`Human readable name`),description:r().optional()})).optional().describe(`Driver contributions`),fieldTypes:C(h({name:r().describe(`Unique field type name (e.g. "vector")`),label:r().describe(`Display label`),description:r().optional()})).optional().describe(`Field Type contributions`),functions:C(h({name:r().describe(`Function name (e.g. "distance")`),description:r().optional(),args:C(r()).optional().describe(`Argument types`),returnType:r().optional()})).optional().describe(`Query Function contributions`),routes:C(h({prefix:r().regex(/^\//).describe(`API path prefix`),service:r().describe(`Service name this plugin provides`),methods:C(r()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:C(h({name:r().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:r().optional().describe(`Command description for help text`),module:r().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:C(cN).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:wV.optional().describe(`Plugin capability declarations for interoperability`),extensions:d(r(),u()).optional().describe(`Extension points and contributions`),loading:FV.optional().describe(`Plugin loading and runtime behavior configuration`),engine:h({objectstack:r().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)}),aSe=E([`package`,`admin`,`user`,`migration`,`api`]),zV=h({path:r().describe(`JSON path to the changed field`),originalValue:u().optional().describe(`Original value from the package`),currentValue:u().describe(`Current customized value`),changedBy:r().optional().describe(`User or admin who made this change`),changedAt:r().datetime().optional().describe(`Timestamp of the change`)}),BV=h({id:r().describe(`Overlay record ID (UUID)`),baseType:r().describe(`Metadata type being customized`),baseName:r().describe(`Metadata name being customized`),packageId:r().optional().describe(`Package ID that delivered the base metadata`),packageVersion:r().optional().describe(`Package version when overlay was created`),scope:E([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:r().optional().describe(`Tenant identifier`),owner:r().optional().describe(`Owner user ID for user-scope overlays`),patch:d(r(),u()).describe(`JSON Merge Patch payload (changed fields only)`),changes:C(zV).optional().describe(`Field-level change tracking for conflict detection`),active:S().default(!0).describe(`Whether this overlay is active`),createdAt:r().datetime().optional(),createdBy:r().optional(),updatedAt:r().datetime().optional(),updatedBy:r().optional()}),VV=h({path:r().describe(`JSON path to the conflicting field`),baseValue:u().describe(`Value in the old package version`),incomingValue:u().describe(`Value in the new package version`),customValue:u().describe(`Customer customized value`),suggestedResolution:E([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:r().optional().describe(`Explanation for the suggested resolution`)}),HV=h({defaultStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:C(r()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:C(r()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:S().default(!0).describe(`Auto-resolve changes that do not conflict`)}),oSe=h({success:S().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:d(r(),u()).optional().describe(`Merged metadata result`),updatedOverlay:d(r(),u()).optional().describe(`Updated overlay after merge`),conflicts:C(VV).optional().describe(`Unresolved merge conflicts`),autoResolved:C(h({path:r(),resolution:r(),description:r().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:h({totalFields:P().int().min(0).describe(`Total fields evaluated`),unchanged:P().int().min(0).describe(`Fields with no changes`),autoResolved:P().int().min(0).describe(`Fields auto-resolved`),conflicts:P().int().min(0).describe(`Fields with conflicts`)}).optional()}),UV=h({metadataType:r().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:S().default(!0),lockedFields:C(r()).optional().describe(`Field paths that cannot be customized`),customizableFields:C(r()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:S().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:S().default(!1).describe(`Whether admins can delete package-delivered fields`)}),WV=E([`json`,`yaml`,`typescript`,`javascript`]),GV=h({size:P().int().min(0).describe(`File size in bytes`),modifiedAt:r().datetime().describe(`Last modified date`),etag:r().describe(`Entity tag for cache validation`),format:WV.describe(`Serialization format`),path:r().optional().describe(`File system path`),metadata:d(r(),u()).optional().describe(`Provider-specific metadata`)}),sSe=h({patterns:C(r()).optional().describe(`File glob patterns`),ifNoneMatch:r().optional().describe(`ETag for conditional request`),ifModifiedSince:r().datetime().optional().describe(`Only load if modified after this date`),validate:S().default(!0).describe(`Validate against schema`),useCache:S().default(!0).describe(`Enable caching`),filter:r().optional().describe(`Filter predicate as string`),limit:P().int().min(1).optional().describe(`Maximum items to load`),recursive:S().default(!0).describe(`Search subdirectories`)}),cSe=h({format:WV.default(`typescript`).describe(`Output format`),prettify:S().default(!0).describe(`Format with indentation`),indent:P().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:S().default(!1).describe(`Sort object keys`),includeDefaults:S().default(!1).describe(`Include default values`),backup:S().default(!1).describe(`Create backup file`),overwrite:S().default(!0).describe(`Overwrite existing file`),atomic:S().default(!0).describe(`Use atomic write operation`),path:r().optional().describe(`Custom output path`)}),lSe=h({output:r().describe(`Output file path`),format:WV.default(`json`).describe(`Export format`),filter:r().optional().describe(`Filter items to export`),includeStats:S().default(!1).describe(`Include metadata statistics`),compress:S().default(!1).describe(`Compress output (gzip)`),prettify:S().default(!0).describe(`Pretty print output`)}),uSe=h({conflictResolution:E([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Simulate import without saving`),continueOnError:S().default(!1).describe(`Continue if validation fails`),transform:r().optional().describe(`Transform items before import`)}),dSe=h({data:u().nullable().describe(`Loaded metadata`),fromCache:S().default(!1).describe(`Loaded from cache`),notModified:S().default(!1).describe(`Not modified since last request`),etag:r().optional().describe(`Entity tag`),stats:GV.optional().describe(`Metadata statistics`),loadTime:P().min(0).optional().describe(`Load duration in ms`)}),fSe=h({success:S().describe(`Save successful`),path:r().describe(`Output path`),etag:r().optional().describe(`Generated entity tag`),size:P().int().min(0).optional().describe(`File size`),saveTime:P().min(0).optional().describe(`Save duration in ms`),backupPath:r().optional().describe(`Backup file path`)}),pSe=h({type:E([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:r().describe(`Type of metadata`),name:r().describe(`Item identifier`),path:r().describe(`File path`),data:u().optional().describe(`Item data`),timestamp:r().datetime().describe(`Event timestamp`)}),mSe=h({type:r().describe(`Collection type`),count:P().int().min(0).describe(`Number of items`),formats:C(WV).describe(`Formats in collection`),totalSize:P().int().min(0).optional().describe(`Total size in bytes`),lastModified:r().datetime().optional().describe(`Last modification date`),location:r().optional().describe(`Collection location`)}),hSe=h({name:r().describe(`Loader identifier`),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)}).describe(`Loader capabilities`),supportedFormats:C(WV).describe(`Supported formats`),supportsWatch:S().default(!1).describe(`Supports file watching`),supportsWrite:S().default(!0).describe(`Supports write operations`),supportsCache:S().default(!0).describe(`Supports caching`)}),KV=E([`filesystem`,`memory`,`none`]),qV=h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:KV.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory path`),formats:C(WV).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:h({enabled:S().default(!0).describe(`Enable caching`),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:S().default(!1).describe(`Enable file watching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`),ignoreInitial:S().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:h({strict:S().default(!0).describe(`Strict validation`),throwOnError:S().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:d(r(),u()).optional().describe(`Loader-specific configuration`)}),JV=E([`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`]),YV=h({type:JV.describe(`Metadata type identifier`),label:r().describe(`Display label for the metadata type`),description:r().optional().describe(`Description of the metadata type`),filePatterns:C(r()).describe(`Glob patterns to discover files of this type`),supportsOverlay:S().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:S().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:S().default(!1).describe(`Whether version history is tracked`),loadOrder:P().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:E([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)}),XV=h({types:C(JV).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),packageId:r().optional().describe(`Filter by owning package`),search:r().optional().describe(`Full-text search query`),scope:E([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:E([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:C(r()).optional().describe(`Filter by tags`),sortBy:E([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(500).default(50).describe(`Items per page`)}),ZV=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),namespace:r().optional().describe(`Namespace`),label:r().optional().describe(`Display label`),scope:E([`system`,`platform`,`user`]).optional(),state:E([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:r().optional(),updatedAt:r().datetime().optional()})).describe(`Matched metadata items`),total:P().int().min(0).describe(`Total matching items`),page:P().int().min(1).describe(`Current page`),pageSize:P().int().min(1).describe(`Page size`)}),gSe=h({event:E([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:JV.describe(`Metadata type`),name:r().describe(`Metadata item name`),namespace:r().optional().describe(`Namespace`),packageId:r().optional().describe(`Owning package ID`),timestamp:r().datetime().describe(`Event timestamp`),actor:r().optional().describe(`User or system that triggered the event`),payload:d(r(),u()).optional().describe(`Event-specific payload`)}),QV=h({valid:S().describe(`Whether the metadata is valid`),errors:C(h({path:r().describe(`JSON path to the invalid field`),message:r().describe(`Error description`),code:r().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:C(h({path:r().describe(`JSON path to the field`),message:r().describe(`Warning description`)})).optional().describe(`Validation warnings`)}),$V=h({storage:qV.describe(`Storage backend configuration`),customizationPolicies:C(UV).optional().describe(`Default customization policies per type`),mergeStrategy:HV.optional().describe(`Merge strategy for package upgrades`),additionalTypes:C(YV.omit({type:!0}).extend({type:r().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:S().default(!0).describe(`Emit metadata change events`),validateOnWrite:S().default(!0).describe(`Validate metadata on write`),enableVersioning:S().default(!1).describe(`Track metadata version history`),cacheMaxItems:P().int().min(0).default(1e4).describe(`Max items in memory cache`)}),_Se=h({id:m(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:m(`ObjectStack Metadata Service`).describe(`Plugin name`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:m(`standard`).describe(`Plugin type`),description:r().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:h({crud:S().default(!0).describe(`Supports metadata CRUD`),query:S().default(!0).describe(`Supports metadata query`),overlay:S().default(!0).describe(`Supports customization overlays`),watch:S().default(!1).describe(`Supports file watching`),importExport:S().default(!0).describe(`Supports import/export`),validation:S().default(!0).describe(`Supports schema validation`),versioning:S().default(!1).describe(`Supports version history`),events:S().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:$V.optional().describe(`Plugin configuration`)}),vSe=[{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`}],ySe=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue if individual item fails`),validate:S().default(!0).describe(`Validate before register`)}),eH=h({total:P().int().min(0).describe(`Total items processed`),succeeded:P().int().min(0).describe(`Successfully processed`),failed:P().int().min(0).describe(`Failed items`),errors:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),error:r().describe(`Error message`)})).optional().describe(`Per-item errors`)}),tH=h({sourceType:r().describe(`Dependent metadata type`),sourceName:r().describe(`Dependent metadata name`),targetType:r().describe(`Referenced metadata type`),targetName:r().describe(`Referenced metadata name`),kind:E([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)}),nH=E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),rH=h({manifest:RV.describe(`Full package manifest`),status:nH.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:S().default(!0).describe(`Whether the package is currently enabled`),installedAt:r().datetime().optional().describe(`Installation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),installedVersion:r().optional().describe(`Currently installed version for quick access`),previousVersion:r().optional().describe(`Version before the last upgrade`),statusChangedAt:r().datetime().optional().describe(`Status change timestamp`),errorMessage:r().optional().describe(`Error message when status is error`),settings:d(r(),u()).optional().describe(`User-provided configuration settings`),upgradeHistory:C(h({fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Version after upgrade`),upgradedAt:r().datetime().describe(`Upgrade timestamp`),status:E([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:C(r()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:C(r()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`),bSe=h({namespace:r().describe(`Namespace prefix`),packageId:r().describe(`Owning package ID`),registeredAt:r().datetime().describe(`Registration timestamp`),status:E([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),xSe=h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package display name`),suggestion:r().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),iH=h({status:nH.optional().describe(`Filter by package status`),type:RV.shape.type.optional().describe(`Filter by package type`),enabled:S().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),aH=h({packages:C(rH).describe(`List of installed packages`),total:P().describe(`Total package count`)}).describe(`List packages response`),oH=h({id:r().describe(`Package identifier`)}).describe(`Get package request`),sH=h({package:rH.describe(`Package details`)}).describe(`Get package response`),cH=h({manifest:RV.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),lH=h({package:rH.describe(`Installed package details`),message:r().optional().describe(`Installation status message`),dependencyResolution:QB.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),uH=h({id:r().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),dH=h({id:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),fH=h({id:r().describe(`Package ID to enable`)}).describe(`Enable package request`),pH=h({package:rH.describe(`Enabled package details`),message:r().optional().describe(`Enable status message`)}).describe(`Enable package response`),mH=h({id:r().describe(`Package ID to disable`)}).describe(`Disable package request`),hH=h({package:rH.describe(`Disabled package details`),message:r().optional().describe(`Disable status message`)}).describe(`Disable package response`),gH=E([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),_H=h({type:r().describe(`Metadata type`),name:r().describe(`Metadata name`),changeType:gH.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:S().default(!1).describe(`Whether this change may conflict with customizations`),summary:r().optional().describe(`Human-readable change summary`),previousName:r().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),vH=E([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),yH=h({packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Currently installed version`),toVersion:r().describe(`Target upgrade version`),impactLevel:vH.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:C(_H).describe(`All metadata changes`),affectedCustomizations:P().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:S().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:C(r()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:C(h({packageId:r(),fromVersion:r(),toVersion:r()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:P().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:r().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`),SSe=h({id:r().describe(`Snapshot identifier`),packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Target upgrade version`),tenantId:r().optional().describe(`Tenant identifier`),previousManifest:RV.describe(`Complete manifest of the previous package version`),metadataSnapshot:C(h({type:r(),name:r(),metadata:d(r(),u())})).describe(`Snapshot of all package metadata`),customizationSnapshot:C(d(r(),u())).optional().describe(`Snapshot of customer customizations`),createdAt:r().datetime().describe(`Snapshot creation timestamp`),expiresAt:r().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),CSe=h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:RV.optional().describe(`New manifest (if installing from local)`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`),bH=E([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`),wSe=h({success:S().describe(`Whether the upgrade succeeded`),phase:bH.describe(`Current upgrade phase`),plan:yH.optional().describe(`Upgrade plan`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r(),baseValue:u(),incomingValue:u(),customValue:u()})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if upgrade failed`),message:r().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),TSe=h({packageId:r().describe(`Package ID to rollback`),snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),ESe=h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Version restored to`),message:r().optional().describe(`Rollback status message`)}).describe(`Rollback package response`),xH=E([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),SH=h({interval:P().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:P().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:P().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:P().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:r().optional().describe(`Method name to call for health check`),autoRestart:S().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:P().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)}),DSe=h({status:xH,timestamp:r().datetime(),message:r().optional(),metrics:h({uptime:P().describe(`Plugin uptime in milliseconds`),memoryUsage:P().optional().describe(`Memory usage in bytes`),cpuUsage:P().optional().describe(`CPU usage percentage`),activeConnections:P().optional().describe(`Number of active connections`),errorRate:P().optional().describe(`Error rate (errors per minute)`),responseTime:P().optional().describe(`Average response time in ms`)}).partial().optional(),checks:C(h({name:r().describe(`Check name`),status:E([`passed`,`failed`,`warning`]),message:r().optional(),data:d(r(),u()).optional()})).optional(),dependencies:C(h({pluginId:r(),status:xH,message:r().optional()})).optional()}),CH=h({provider:E([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:C(r()).optional().describe(`Backend connection endpoints`),keyPrefix:r().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:P().int().min(0).optional().describe(`State expiration time in seconds`),auth:h({username:r().optional(),password:r().optional(),token:r().optional(),certificate:r().optional()}).optional(),replication:h({enabled:S().default(!0),minReplicas:P().int().min(1).default(1)}).optional(),customConfig:d(r(),u()).optional().describe(`Provider-specific configuration`)}),wH=h({enabled:S().default(!1),watchPatterns:C(r()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:P().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:S().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:E([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:CH.optional().describe(`Configuration for distributed state management`),shutdownTimeout:P().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:C(r()).optional().describe(`Hook names to call before reload`),afterReload:C(r()).optional().describe(`Hook names to call after reload`)}),TH=h({enabled:S().default(!0),fallbackMode:E([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:C(r()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:C(r()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:C(h({feature:r().describe(`Feature name`),enabled:S().describe(`Whether feature is available in degraded mode`),reason:r().optional()})).optional(),autoRecovery:h({enabled:S().default(!0),retryInterval:P().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:P().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),EH=h({mode:E([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:h({major:S().default(!1).describe(`Allow major version updates`),minor:S().default(!0).describe(`Allow minor version updates`),patch:S().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:h({cron:r().optional(),timezone:r().default(`UTC`),maintenanceWindow:P().int().min(1).default(60)}).optional(),rollback:h({enabled:S().default(!0),automatic:S().default(!0),keepVersions:P().int().min(1).default(3),timeout:P().int().min(1e3).default(3e4)}).optional(),validation:h({checkCompatibility:S().default(!0),runTests:S().default(!1),testSuite:r().optional()}).optional()}),OSe=h({pluginId:r(),version:r(),timestamp:r().datetime(),state:d(r(),u()),metadata:h({checksum:r().optional().describe(`State checksum for verification`),compressed:S().default(!1),encryption:r().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),kSe=h({health:SH.optional(),hotReload:wH.optional(),degradation:TH.optional(),updates:EH.optional(),resources:h({maxMemory:P().int().optional().describe(`Maximum memory in bytes`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:P().int().optional().describe(`Maximum concurrent connections`),timeout:P().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:h({enableMetrics:S().default(!0),enableTracing:S().default(!0),enableProfiling:S().default(!1),metricsInterval:P().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()}),DH=E([`init`,`start`,`destroy`]).describe(`Plugin lifecycle phase`),OH=h({pluginName:r().describe(`Name of the plugin`),timestamp:P().int().describe(`Unix timestamp in milliseconds when event occurred`)}),ASe=OH.extend({version:r().optional().describe(`Plugin version`)}),jSe=OH.extend({duration:P().min(0).optional().describe(`Duration of the lifecycle phase in milliseconds`),phase:DH.optional().describe(`Lifecycle phase`)}),MSe=OH.extend({error:h({name:r().describe(`Error class name`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`),code:r().optional().describe(`Error code`)}).describe(`Serializable error representation`),phase:DH.describe(`Lifecycle phase where error occurred`),errorMessage:r().optional().describe(`Error message`),errorStack:r().optional().describe(`Error stack trace`)}),NSe=h({serviceName:r().describe(`Name of the registered service`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),serviceType:r().optional().describe(`Type or interface name of the service`)}),PSe=h({serviceName:r().describe(`Name of the unregistered service`),timestamp:P().int().describe(`Unix timestamp in milliseconds`)}),FSe=h({hookName:r().describe(`Name of the hook`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),handlerCount:P().int().min(0).describe(`Number of handlers registered for this hook`)}),ISe=h({hookName:r().describe(`Name of the hook`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),args:C(u()).describe(`Arguments passed to the hook handlers`),handlerCount:P().int().min(0).optional().describe(`Number of handlers that will handle this event`)}),kH=h({timestamp:P().int().describe(`Unix timestamp in milliseconds`)}),LSe=kH.extend({duration:P().min(0).optional().describe(`Total initialization duration in milliseconds`),pluginCount:P().int().min(0).optional().describe(`Number of plugins initialized`)}),RSe=kH.extend({reason:r().optional().describe(`Reason for kernel shutdown`)}),zSe=E([`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`),AH=E([`load`,`unload`,`reload`,`enable`,`disable`]).describe(`Runtime plugin operation type`),jH=h({type:E([`npm`,`local`,`url`,`registry`,`git`]).describe(`Plugin source type`),location:r().describe(`Package name, file path, URL, or git repository`),version:r().optional().describe(`Semver version range (e.g., "^1.0.0")`),integrity:r().optional().describe(`Subresource Integrity hash (e.g., "sha384-...")`)}).describe(`Plugin source location for dynamic resolution`),MH=h({type:E([`onCommand`,`onRoute`,`onObject`,`onEvent`,`onService`,`onSchedule`,`onStartup`]).describe(`Trigger type for lazy activation`),pattern:r().describe(`Match pattern for the activation trigger`)}).describe(`Lazy activation trigger for a dynamic plugin`),BSe=h({pluginId:r().describe(`Unique plugin identifier`),source:jH,activationEvents:C(MH).optional().describe(`Lazy activation triggers; if omitted plugin starts immediately`),config:d(r(),u()).optional().describe(`Runtime configuration overrides`),priority:P().int().min(0).default(100).describe(`Loading priority (lower is higher)`),sandbox:S().default(!1).describe(`Run in an isolated sandbox`),timeout:P().int().min(1e3).default(6e4).describe(`Maximum time to complete loading in ms`)}).describe(`Request to dynamically load a plugin at runtime`),VSe=h({pluginId:r().describe(`Plugin to unload`),strategy:E([`graceful`,`forceful`,`drain`]).default(`graceful`).describe(`How to handle in-flight work during unload`),timeout:P().int().min(1e3).default(3e4).describe(`Maximum time to complete unloading in ms`),cleanupCache:S().default(!1).describe(`Remove cached code and assets after unload`),dependentAction:E([`cascade`,`warn`,`block`]).default(`block`).describe(`How to handle plugins that depend on this one`)}).describe(`Request to dynamically unload a plugin at runtime`),HSe=h({success:S(),operation:AH,pluginId:r(),durationMs:P().int().min(0).optional(),version:r().optional(),error:h({code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),details:d(r(),u()).optional()}).optional(),warnings:C(r()).optional()}).describe(`Result of a dynamic plugin operation`),NH=h({type:E([`registry`,`npm`,`directory`,`url`]).describe(`Discovery source type`),endpoint:r().describe(`Registry URL, directory path, or manifest URL`),pollInterval:P().int().min(0).default(0).describe(`How often to re-scan for new plugins (0 = manual)`),filter:h({tags:C(r()).optional(),vendors:C(r()).optional(),minTrustLevel:E([`verified`,`trusted`,`community`,`untrusted`]).optional()}).optional()}).describe(`Source for runtime plugin discovery`),PH=h({enabled:S().default(!1),sources:C(NH).default([]),autoLoad:S().default(!1).describe(`Automatically load newly discovered plugins`),requireApproval:S().default(!0).describe(`Require admin approval before loading discovered plugins`)}).describe(`Runtime plugin discovery configuration`),USe=h({enabled:S().default(!1).describe(`Enable runtime load/unload of plugins`),maxDynamicPlugins:P().int().min(1).default(50).describe(`Upper limit on runtime-loaded plugins`),discovery:PH.optional(),defaultSandbox:S().default(!0).describe(`Sandbox dynamically loaded plugins by default`),allowedSources:C(E([`npm`,`local`,`url`,`registry`,`git`])).optional().describe(`Restrict which source types are permitted`),requireIntegrity:S().default(!0).describe(`Require integrity hash verification for remote sources`),operationTimeout:P().int().min(1e3).default(6e4).describe(`Default timeout for load/unload operations in ms`)}).describe(`Dynamic plugin loading subsystem configuration`),FH=E([`global`,`tenant`,`user`,`resource`,`plugin`]).describe(`Scope of permission application`),IH=E([`create`,`read`,`update`,`delete`,`execute`,`manage`,`configure`,`share`,`export`,`import`,`admin`]).describe(`Type of action being permitted`),LH=E([`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`),RH=h({id:r().describe(`Unique permission identifier`),resource:LH,actions:C(IH),scope:FH.default(`plugin`),filter:h({resourceIds:C(r()).optional(),condition:r().optional().describe(`Filter expression (e.g., owner = currentUser)`),fields:C(r()).optional().describe(`Allowed fields for data resources`)}).optional(),description:r(),required:S().default(!0),justification:r().optional().describe(`Why this permission is needed`)}),zH=h({permissions:C(RH),groups:C(h({name:r().describe(`Group name`),description:r(),permissions:C(r()).describe(`Permission IDs in this group`)})).optional(),defaultGrant:E([`prompt`,`allow`,`deny`,`inherit`]).default(`prompt`)}),BH=h({engine:E([`v8-isolate`,`wasm`,`container`,`process`]).default(`v8-isolate`).describe(`Execution environment engine`),engineConfig:h({wasm:h({maxMemoryPages:P().int().min(1).max(65536).optional().describe(`Maximum WASM memory pages (64KB each)`),instructionLimit:P().int().min(1).optional().describe(`Maximum instructions before timeout`),enableSimd:S().default(!1).describe(`Enable WebAssembly SIMD support`),enableThreads:S().default(!1).describe(`Enable WebAssembly threads`),enableBulkMemory:S().default(!0).describe(`Enable bulk memory operations`)}).optional(),container:h({image:r().optional().describe(`Container image to use`),runtime:E([`docker`,`podman`,`containerd`]).default(`docker`),resources:h({cpuLimit:r().optional().describe(`CPU limit (e.g., "0.5", "2")`),memoryLimit:r().optional().describe(`Memory limit (e.g., "512m", "1g")`)}).optional(),networkMode:E([`none`,`bridge`,`host`]).default(`bridge`)}).optional(),v8Isolate:h({heapSizeMb:P().int().min(1).optional(),enableSnapshot:S().default(!0)}).optional()}).optional(),resourceLimits:h({maxMemory:P().int().optional().describe(`Maximum memory allocation`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU usage percentage`),timeout:P().int().min(0).optional().describe(`Maximum execution time`)}).optional()}),VH=h({enabled:S().default(!0),level:E([`none`,`minimal`,`standard`,`strict`,`paranoid`]).default(`standard`),runtime:BH.optional().describe(`Execution environment and isolation settings`),filesystem:h({mode:E([`none`,`readonly`,`restricted`,`full`]).default(`restricted`),allowedPaths:C(r()).optional().describe(`Whitelisted paths`),deniedPaths:C(r()).optional().describe(`Blacklisted paths`),maxFileSize:P().int().optional().describe(`Maximum file size in bytes`)}).optional(),network:h({mode:E([`none`,`local`,`restricted`,`full`]).default(`restricted`),allowedHosts:C(r()).optional().describe(`Whitelisted hosts`),deniedHosts:C(r()).optional().describe(`Blacklisted hosts`),allowedPorts:C(P()).optional().describe(`Allowed port numbers`),maxConnections:P().int().optional()}).optional(),process:h({allowSpawn:S().default(!1).describe(`Allow spawning child processes`),allowedCommands:C(r()).optional().describe(`Whitelisted commands`),timeout:P().int().optional().describe(`Process timeout in ms`)}).optional(),memory:h({maxHeap:P().int().optional().describe(`Maximum heap size in bytes`),maxStack:P().int().optional().describe(`Maximum stack size in bytes`)}).optional(),cpu:h({maxCpuPercent:P().min(0).max(100).optional(),maxThreads:P().int().optional()}).optional(),environment:h({mode:E([`none`,`readonly`,`restricted`,`full`]).default(`readonly`),allowedVars:C(r()).optional(),deniedVars:C(r()).optional()}).optional()}),HH=h({cve:r().optional(),id:r(),severity:E([`critical`,`high`,`medium`,`low`,`info`]),category:r().optional(),title:r(),location:r().optional(),remediation:r().optional(),description:r(),affectedVersions:C(r()),fixedIn:C(r()).optional(),cvssScore:P().min(0).max(10).optional(),exploitAvailable:S().default(!1),patchAvailable:S().default(!1),workaround:r().optional(),references:C(r()).optional(),discoveredDate:r().datetime().optional(),publishedDate:r().datetime().optional()}),UH=h({timestamp:r().datetime(),scanner:h({name:r(),version:r()}),status:E([`passed`,`failed`,`warning`]),vulnerabilities:C(HH).optional(),codeIssues:C(h({severity:E([`error`,`warning`,`info`]),type:r().describe(`Issue type (e.g., sql-injection, xss)`),file:r(),line:P().int().optional(),message:r(),suggestion:r().optional()})).optional(),dependencyVulnerabilities:C(h({package:r(),version:r(),vulnerability:HH})).optional(),licenseCompliance:h({status:E([`compliant`,`non-compliant`,`unknown`]),issues:C(h({package:r(),license:r(),reason:r()})).optional()}).optional(),summary:h({totalVulnerabilities:P().int(),criticalCount:P().int(),highCount:P().int(),mediumCount:P().int(),lowCount:P().int(),infoCount:P().int()})}),WH=h({csp:h({directives:d(r(),C(r())).optional(),reportOnly:S().default(!1)}).optional(),cors:h({allowedOrigins:C(r()),allowedMethods:C(r()),allowedHeaders:C(r()),allowCredentials:S().default(!1),maxAge:P().int().optional()}).optional(),rateLimit:h({enabled:S().default(!0),maxRequests:P().int(),windowMs:P().int().describe(`Time window in milliseconds`),strategy:E([`fixed`,`sliding`,`token-bucket`]).default(`sliding`)}).optional(),authentication:h({required:S().default(!0),methods:C(E([`jwt`,`oauth2`,`api-key`,`session`,`certificate`])),tokenExpiration:P().int().optional().describe(`Token expiration in seconds`)}).optional(),encryption:h({dataAtRest:S().default(!1).describe(`Encrypt data at rest`),dataInTransit:S().default(!0).describe(`Enforce HTTPS/TLS`),algorithm:r().optional().describe(`Encryption algorithm`),minKeyLength:P().int().optional().describe(`Minimum key length in bits`)}).optional(),auditLog:h({enabled:S().default(!0),events:C(r()).optional().describe(`Events to log`),retention:P().int().optional().describe(`Log retention in days`)}).optional()}),GH=E([`verified`,`trusted`,`community`,`untrusted`,`blocked`]).describe(`Trust level of the plugin`),WSe=h({pluginId:r(),trustLevel:GH,permissions:zH,sandbox:VH,policy:WH.optional(),scanResults:C(UH).optional(),vulnerabilities:C(HH).optional(),codeSigning:h({signed:S(),signature:r().optional(),certificate:r().optional(),algorithm:r().optional(),timestamp:r().datetime().optional()}).optional(),certifications:C(h({name:r().describe(`Certification name (e.g., SOC 2, ISO 27001)`),issuer:r(),issuedDate:r().datetime(),expiryDate:r().datetime().optional(),certificateUrl:r().url().optional()})).optional(),securityContact:h({email:r().email().optional(),url:r().url().optional(),pgpKey:r().optional()}).optional(),vulnerabilityDisclosure:h({policyUrl:r().url().optional(),responseTime:P().int().optional().describe(`Expected response time in hours`),bugBounty:S().default(!1)}).optional()}),KH=/^[a-z][a-z0-9_]*$/,qH=r().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];KH.test(e)||t.addIssue({code:de.custom,message:`Domain directory '${e}' must be lowercase snake_case`})}let r=n[n.length-1];r===`index.ts`||r===`main.ts`||KH.test(r.split(`.`)[0])||t.addIssue({code:de.custom,message:`Filename '${r}' base name must be lowercase snake_case`})}),GSe=h({name:r().regex(KH).describe(`Module name (snake_case)`),files:C(r()).describe(`List of files in this module`),metadata:d(r(),u()).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:de.custom,message:`Module '${e.name}' is missing an 'index.ts' entry point.`})}),KSe=h({root:r().describe(`Root directory path of the plugin project`),files:C(r()).describe(`List of all file paths relative to root`),metadata:d(r(),u()).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:de.custom,message:`Missing 'objectstack.config.ts' configuration file.`}),e.files.filter(e=>e.startsWith(`src/`)).forEach(e=>{let n=qH.safeParse(e);n.success||n.error.issues.forEach(n=>{t.addIssue({...n,path:[e]})})})}),JH=h({field:r().describe(`Field name that failed validation`),message:r().describe(`Human-readable error message`),code:r().optional().describe(`Machine-readable error code`)}),YH=h({field:r().describe(`Field name with warning`),message:r().describe(`Human-readable warning message`),code:r().optional().describe(`Machine-readable warning code`)}),qSe=h({valid:S().describe(`Whether the plugin passed validation`),errors:C(JH).optional().describe(`Validation errors`),warnings:C(YH).optional().describe(`Validation warnings`)}),JSe=h({name:r().min(1).describe(`Unique plugin identifier`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic version (e.g., 1.0.0)`),dependencies:C(r()).optional().describe(`Array of plugin names this plugin depends on`),signature:r().optional().describe(`Cryptographic signature for plugin verification`)}).passthrough().describe(`Plugin metadata for validation`),XH=h({major:P().int().min(0).describe(`Major version (breaking changes)`),minor:P().int().min(0).describe(`Minor version (backward compatible features)`),patch:P().int().min(0).describe(`Patch version (backward compatible fixes)`),preRelease:r().optional().describe(`Pre-release identifier (alpha, beta, rc.1)`),build:r().optional().describe(`Build metadata`)}).describe(`Semantic version number`),YSe=l([r().regex(/^[\d.]+$/).describe("Exact version: `1.2.3`"),r().regex(/^\^[\d.]+$/).describe("Compatible with: `^1.2.3` (`>=1.2.3 <2.0.0`)"),r().regex(/^~[\d.]+$/).describe("Approximately: `~1.2.3` (`>=1.2.3 <1.3.0`)"),r().regex(/^>=[\d.]+$/).describe("Greater than or equal: `>=1.2.3`"),r().regex(/^>[\d.]+$/).describe("Greater than: `>1.2.3`"),r().regex(/^<=[\d.]+$/).describe("Less than or equal: `<=1.2.3`"),r().regex(/^<[\d.]+$/).describe("Less than: `<1.2.3`"),r().regex(/^[\d.]+ - [\d.]+$/).describe("Range: `1.2.3 - 2.3.4`"),m(`*`).describe(`Any version`),m(`latest`).describe(`Latest stable version`)]),ZH=E([`fully-compatible`,`backward-compatible`,`deprecated-compatible`,`breaking-changes`,`incompatible`]).describe(`Compatibility level between versions`),QH=h({introducedIn:r().describe(`Version that introduced this breaking change`),type:E([`api-removed`,`api-renamed`,`api-signature-changed`,`behavior-changed`,`dependency-changed`,`configuration-changed`,`protocol-changed`]),description:r(),migrationGuide:r().optional().describe(`How to migrate from old to new`),deprecatedIn:r().optional().describe(`Version where old API was deprecated`),removedIn:r().optional().describe(`Version where old API will be removed`),automatedMigration:S().default(!1).describe(`Whether automated migration tool is available`),severity:E([`critical`,`major`,`minor`]).describe(`Impact severity`)}),$H=h({feature:r().describe(`Deprecated feature identifier`),deprecatedIn:r(),removeIn:r().optional(),reason:r(),alternative:r().optional().describe(`What to use instead`),migrationPath:r().optional().describe(`How to migrate to alternative`)}),eU=h({from:r().describe(`Version being upgraded from`),to:r().describe(`Version being upgraded to`),compatibility:ZH,breakingChanges:C(QH).optional(),migrationRequired:S().default(!1),migrationComplexity:E([`trivial`,`simple`,`moderate`,`complex`,`major`]).optional(),estimatedMigrationTime:P().optional(),migrationScript:r().optional().describe(`Path to migration script`),testCoverage:P().min(0).max(100).optional().describe(`Percentage of migration covered by tests`)}),XSe=h({pluginId:r(),currentVersion:r(),compatibilityMatrix:C(eU),supportedVersions:C(h({version:r(),supported:S(),endOfLife:r().datetime().optional().describe(`End of support date`),securitySupport:S().default(!1).describe(`Still receives security updates`)})),minimumCompatibleVersion:r().optional().describe(`Oldest version that can be directly upgraded`)}),tU=h({type:E([`version-mismatch`,`missing-dependency`,`circular-dependency`,`incompatible-versions`,`conflicting-interfaces`]),plugins:C(h({pluginId:r(),version:r(),requirement:r().optional().describe(`What this plugin requires`)})),description:r(),resolutions:C(h({strategy:E([`upgrade`,`downgrade`,`replace`,`disable`,`manual`]),description:r(),automaticResolution:S().default(!1),riskLevel:E([`low`,`medium`,`high`])})).optional(),severity:E([`critical`,`error`,`warning`,`info`])}),ZSe=h({success:S(),resolved:C(h({pluginId:r(),version:r(),resolvedVersion:r()})).optional(),conflicts:C(tU).optional(),warnings:C(r()).optional(),installationOrder:C(r()).optional().describe(`Plugin IDs in order they should be installed`),dependencyGraph:d(r(),C(r())).optional().describe(`Map of plugin ID to its dependencies`)}),QSe=h({enabled:S().default(!1),maxConcurrentVersions:P().int().min(1).default(2).describe(`How many versions can run at the same time`),selectionStrategy:E([`latest`,`stable`,`compatible`,`pinned`,`canary`,`custom`]).default(`latest`),routing:C(h({condition:r().describe(`Routing condition (e.g., tenant, user, feature flag)`),version:r().describe(`Version to use when condition matches`),priority:P().int().default(100).describe(`Rule priority`)})).optional(),rollout:h({enabled:S().default(!1),strategy:E([`percentage`,`blue-green`,`canary`]),percentage:P().min(0).max(100).optional().describe(`Percentage of traffic to new version`),duration:P().int().optional().describe(`Rollout duration in milliseconds`)}).optional()}),$Se=h({pluginId:r(),version:XH,versionString:r().describe(`Full version string (e.g., 1.2.3-beta.1+build.123)`),releaseDate:r().datetime(),releaseNotes:r().optional(),breakingChanges:C(QH).optional(),deprecations:C($H).optional(),compatibilityMatrix:C(eU).optional(),securityFixes:C(h({cve:r().optional().describe(`CVE identifier`),severity:E([`critical`,`high`,`medium`,`low`]),description:r(),fixedIn:r().describe(`Version where vulnerability was fixed`)})).optional(),statistics:h({downloads:P().int().min(0).optional(),installations:P().int().min(0).optional(),ratings:P().min(0).max(5).optional()}).optional(),support:h({status:E([`active`,`maintenance`,`deprecated`,`eol`]),endOfLife:r().datetime().optional(),securitySupport:S().default(!0)})}),nU=E([`singleton`,`transient`,`scoped`]).describe(`Service scope type`),eCe=h({name:r().min(1).describe(`Unique service name identifier`),scope:nU.optional().default(`singleton`).describe(`Service scope type`),type:r().optional().describe(`Service type or interface name`),registeredAt:P().int().optional().describe(`Unix timestamp in milliseconds when service was registered`),metadata:d(r(),u()).optional().describe(`Additional service-specific metadata`)}),tCe=h({strictMode:S().optional().default(!0).describe(`Throw errors on invalid operations (duplicate registration, service not found, etc.)`),allowOverwrite:S().optional().default(!1).describe(`Allow overwriting existing service registrations`),enableLogging:S().optional().default(!1).describe(`Enable logging for service registration and retrieval`),scopeTypes:C(r()).optional().describe(`Supported scope types`),maxServices:P().int().min(1).optional().describe(`Maximum number of services that can be registered`)}),nCe=h({name:r().min(1).describe(`Unique service name identifier`),scope:nU.optional().default(`singleton`).describe(`Service scope type`),factoryType:E([`sync`,`async`]).optional().default(`sync`).describe(`Whether factory is synchronous or asynchronous`),singleton:S().optional().default(!0).describe(`Whether to cache the factory result (singleton pattern)`)}),rCe=h({scopeType:r().describe(`Type of scope`),scopeId:r().optional().describe(`Unique scope identifier`),metadata:d(r(),u()).optional().describe(`Scope-specific context metadata`)}),iCe=h({scopeId:r().describe(`Unique scope identifier`),scopeType:r().describe(`Type of scope`),createdAt:P().int().describe(`Unix timestamp in milliseconds when scope was created`),serviceCount:P().int().min(0).optional().describe(`Number of services registered in this scope`),metadata:d(r(),u()).optional().describe(`Scope-specific context metadata`)}),aCe=h({timeout:P().int().min(0).optional().default(3e4).describe(`Maximum time in milliseconds to wait for each plugin to start`),rollbackOnFailure:S().optional().default(!0).describe(`Whether to rollback already-started plugins if any plugin fails`),healthCheck:S().optional().default(!1).describe(`Whether to run health checks after plugin startup`),parallel:S().optional().default(!1).describe(`Whether to start plugins in parallel when dependencies allow`),context:u().optional().describe(`Custom context object to pass to plugin lifecycle methods`)}),rU=h({healthy:S().describe(`Whether the plugin is healthy`),timestamp:P().int().describe(`Unix timestamp in milliseconds when health check was performed`),details:d(r(),u()).optional().describe(`Optional plugin-specific health details`),message:r().optional().describe(`Error message if plugin is unhealthy`)}),iU=h({plugin:h({name:r(),version:r().optional()}).passthrough().describe(`Plugin metadata`),success:S().describe(`Whether the plugin started successfully`),duration:P().min(0).describe(`Time taken to start the plugin in milliseconds`),error:h({name:r().describe(`Error class name`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`),code:r().optional().describe(`Error code`)}).optional().describe(`Serializable error representation if startup failed`),health:rU.optional().describe(`Health status after startup if health check was enabled`)}),oCe=h({results:C(iU).describe(`Startup results for each plugin`),totalDuration:P().min(0).describe(`Total time taken for all plugins in milliseconds`),allSuccessful:S().describe(`Whether all plugins started successfully`),rolledBack:C(r()).optional().describe(`Names of plugins that were rolled back`)}),aU=h({id:r().regex(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+$/).describe(`Vendor identifier (reverse domain)`),name:r(),website:r().url().optional(),email:r().email().optional(),verified:S().default(!1).describe(`Whether vendor is verified by ObjectStack`),trustLevel:E([`official`,`verified`,`community`,`unverified`]).default(`unverified`)}),oU=h({testCoverage:P().min(0).max(100).optional(),documentationScore:P().min(0).max(100).optional(),codeQuality:P().min(0).max(100).optional(),securityScan:h({lastScanDate:r().datetime().optional(),vulnerabilities:h({critical:P().int().min(0).default(0),high:P().int().min(0).default(0),medium:P().int().min(0).default(0),low:P().int().min(0).default(0)}).optional(),passed:S().default(!1)}).optional(),conformanceTests:C(h({protocolId:r().describe(`Protocol being tested`),passed:S(),totalTests:P().int().min(0),passedTests:P().int().min(0),lastRunDate:r().datetime().optional()})).optional()}),sU=h({downloads:P().int().min(0).default(0),downloadsLastMonth:P().int().min(0).default(0),activeInstallations:P().int().min(0).default(0),ratings:h({average:P().min(0).max(5).default(0),count:P().int().min(0).default(0),distribution:h({5:P().int().min(0).default(0),4:P().int().min(0).default(0),3:P().int().min(0).default(0),2:P().int().min(0).default(0),1:P().int().min(0).default(0)}).optional()}).optional(),stars:P().int().min(0).optional(),dependents:P().int().min(0).default(0)}),sCe=h({id:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Plugin identifier (reverse domain notation)`),version:r().regex(/^\d+\.\d+\.\d+$/),name:r(),description:r().optional(),readme:r().optional(),category:E([`data`,`integration`,`ui`,`analytics`,`security`,`automation`,`ai`,`utility`,`driver`,`gateway`,`adapter`]).optional(),tags:C(r()).optional(),vendor:aU,capabilities:wV.optional(),compatibility:h({minObjectStackVersion:r().optional(),maxObjectStackVersion:r().optional(),nodeVersion:r().optional(),platforms:C(E([`linux`,`darwin`,`win32`,`browser`])).optional()}).optional(),links:h({homepage:r().url().optional(),repository:r().url().optional(),documentation:r().url().optional(),bugs:r().url().optional(),changelog:r().url().optional()}).optional(),media:h({icon:r().url().optional(),logo:r().url().optional(),screenshots:C(r().url()).optional(),video:r().url().optional()}).optional(),quality:oU.optional(),statistics:sU.optional(),license:r().optional().describe(`SPDX license identifier`),pricing:h({model:E([`free`,`freemium`,`paid`,`enterprise`]),price:P().min(0).optional(),currency:r().default(`USD`).optional(),billingPeriod:E([`one-time`,`monthly`,`yearly`]).optional()}).optional(),publishedAt:r().datetime().optional(),updatedAt:r().datetime().optional(),deprecated:S().default(!1),deprecationMessage:r().optional(),replacedBy:r().optional().describe(`Plugin ID that replaces this one`),flags:h({experimental:S().default(!1),beta:S().default(!1),featured:S().default(!1),verified:S().default(!1)}).optional()}),cCe=h({query:r().optional(),category:C(r()).optional(),tags:C(r()).optional(),trustLevel:C(E([`official`,`verified`,`community`,`unverified`])).optional(),implementsProtocols:C(r()).optional(),pricingModel:C(E([`free`,`freemium`,`paid`,`enterprise`])).optional(),minRating:P().min(0).max(5).optional(),sortBy:E([`relevance`,`downloads`,`rating`,`updated`,`name`]).optional(),sortOrder:E([`asc`,`desc`]).default(`desc`).optional(),page:P().int().min(1).default(1).optional(),limit:P().int().min(1).max(100).default(20).optional()}),lCe=h({pluginId:r(),version:r().optional().describe(`Defaults to latest`),config:d(r(),u()).optional(),autoUpdate:S().default(!1).optional(),options:h({skipDependencies:S().default(!1).optional(),force:S().default(!1).optional(),target:E([`system`,`space`,`user`]).default(`space`).optional()}).optional()}),cU=E([`critical`,`high`,`medium`,`low`,`info`]).describe(`Severity level of a security vulnerability`),lU=h({cve:r().regex(/^CVE-\d{4}-\d+$/).optional().describe(`CVE identifier`),id:r().describe(`Vulnerability ID`),title:r().describe(`Short title summarizing the vulnerability`),description:r().describe(`Detailed description of the vulnerability`),severity:cU.describe(`Severity level of this vulnerability`),cvss:P().min(0).max(10).optional().describe(`CVSS score ranging from 0 to 10`),package:h({name:r().describe(`Name of the affected package`),version:r().describe(`Version of the affected package`),ecosystem:r().optional().describe(`Package ecosystem (e.g., npm, pip, maven)`)}).describe(`Affected package information`),vulnerableVersions:r().describe(`Semver range of vulnerable versions`),patchedVersions:r().optional().describe(`Semver range of patched versions`),references:C(h({type:E([`advisory`,`article`,`report`,`web`]).describe(`Type of reference source`),url:r().url().describe(`URL of the reference`)})).default([]).describe(`External references related to the vulnerability`),cwe:C(r()).default([]).describe(`CWE identifiers associated with this vulnerability`),publishedAt:r().datetime().optional().describe(`ISO 8601 date when the vulnerability was published`),mitigation:r().optional().describe(`Recommended steps to mitigate the vulnerability`)}).describe(`A known security vulnerability in a package dependency`),uU=h({scanId:r().uuid().describe(`Unique identifier for this security scan`),plugin:h({id:r().describe(`Plugin identifier`),version:r().describe(`Plugin version that was scanned`)}).describe(`Plugin that was scanned`),scannedAt:r().datetime().describe(`ISO 8601 timestamp when the scan was performed`),scanner:h({name:r().describe(`Scanner name (e.g., snyk, osv, trivy)`),version:r().describe(`Version of the scanner tool`)}).describe(`Information about the scanner tool used`),status:E([`passed`,`failed`,`warning`]).describe(`Overall result status of the security scan`),vulnerabilities:C(lU).describe(`List of vulnerabilities discovered during the scan`),summary:h({critical:P().int().min(0).default(0).describe(`Count of critical severity vulnerabilities`),high:P().int().min(0).default(0).describe(`Count of high severity vulnerabilities`),medium:P().int().min(0).default(0).describe(`Count of medium severity vulnerabilities`),low:P().int().min(0).default(0).describe(`Count of low severity vulnerabilities`),info:P().int().min(0).default(0).describe(`Count of informational severity vulnerabilities`),total:P().int().min(0).default(0).describe(`Total count of all vulnerabilities`)}).describe(`Summary counts of vulnerabilities by severity`),licenseIssues:C(h({package:r().describe(`Name of the package with a license issue`),license:r().describe(`License identifier of the package`),reason:r().describe(`Reason the license is flagged`),severity:E([`error`,`warning`,`info`]).describe(`Severity of the license compliance issue`)})).default([]).describe(`License compliance issues found during the scan`),codeQuality:h({score:P().min(0).max(100).optional().describe(`Overall code quality score from 0 to 100`),issues:C(h({type:E([`security`,`quality`,`style`]).describe(`Category of the code quality issue`),severity:E([`error`,`warning`,`info`]).describe(`Severity of the code quality issue`),message:r().describe(`Description of the code quality issue`),file:r().optional().describe(`File path where the issue was found`),line:P().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:r().datetime().optional().describe(`ISO 8601 timestamp for the next scheduled scan`)}).describe(`Result of a security scan performed on a plugin`),dU=h({id:r().describe(`Unique identifier for the security policy`),name:r().describe(`Human-readable name of the security policy`),autoScan:h({enabled:S().default(!0).describe(`Whether automatic scanning is enabled`),frequency:E([`on-publish`,`daily`,`weekly`,`monthly`]).default(`daily`).describe(`How often automatic scans are performed`)}).describe(`Automatic security scanning configuration`),thresholds:h({maxCritical:P().int().min(0).default(0).describe(`Maximum allowed critical vulnerabilities before blocking`),maxHigh:P().int().min(0).default(0).describe(`Maximum allowed high vulnerabilities before blocking`),maxMedium:P().int().min(0).default(5).describe(`Maximum allowed medium vulnerabilities before warning`)}).describe(`Vulnerability count thresholds for policy enforcement`),allowedLicenses:C(r()).default([`MIT`,`Apache-2.0`,`BSD-3-Clause`,`BSD-2-Clause`,`ISC`]).describe(`List of SPDX license identifiers that are permitted`),prohibitedLicenses:C(r()).default([`GPL-3.0`,`AGPL-3.0`]).describe(`List of SPDX license identifiers that are prohibited`),codeSigning:h({required:S().default(!1).describe(`Whether code signing is required for plugins`),allowedSigners:C(r()).default([]).describe(`List of trusted signer identities`)}).optional().describe(`Code signing requirements for plugin artifacts`),sandbox:h({networkAccess:E([`none`,`localhost`,`allowlist`,`all`]).default(`all`).describe(`Level of network access granted to the plugin`),allowedDestinations:C(r()).default([]).describe(`Permitted network destinations when using allowlist mode`),filesystemAccess:E([`none`,`read-only`,`temp-only`,`full`]).default(`full`).describe(`Level of file system access granted to the plugin`),maxMemoryMB:P().int().positive().optional().describe(`Maximum memory allocation in megabytes`),maxCPUSeconds:P().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`),fU=h({name:r().describe(`Package name or identifier`),versionConstraint:r().describe("Semver range (e.g., `^1.0.0`, `>=2.0.0 <3.0.0`)"),type:E([`required`,`optional`,`peer`,`dev`]).default(`required`).describe(`Category of the dependency relationship`),resolvedVersion:r().optional().describe(`Concrete version resolved during dependency resolution`)}).describe(`A package dependency with its version constraint`),pU=h({id:r().describe(`Unique identifier of the package`),version:r().describe(`Resolved version of the package`),dependencies:C(fU).default([]).describe(`Dependencies required by this package`),depth:P().int().min(0).describe(`Depth level in the dependency tree (0 = root)`),isDirect:S().describe(`Whether this is a direct (top-level) dependency`),metadata:h({name:r().describe(`Display name of the package`),description:r().optional().describe(`Short description of the package`),license:r().optional().describe(`SPDX license identifier of the package`),homepage:r().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`),mU=h({root:h({id:r().describe(`Identifier of the root package`),version:r().describe(`Version of the root package`)}).describe(`Root package of the dependency graph`),nodes:C(pU).describe(`All resolved package nodes in the dependency graph`),edges:C(h({from:r().describe(`Package ID`),to:r().describe(`Package ID`),constraint:r().describe(`Version constraint`)})).describe(`Directed edges representing dependency relationships`),stats:h({totalDependencies:P().int().min(0).describe(`Total number of resolved dependencies`),directDependencies:P().int().min(0).describe(`Number of direct (top-level) dependencies`),maxDepth:P().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`),hU=h({package:r().describe(`Name of the package with conflicting version requirements`),conflicts:C(h({version:r().describe(`Conflicting version of the package`),requestedBy:C(r()).describe(`Packages that require this version`),constraint:r().describe(`Semver constraint that produced this version requirement`)})).describe(`List of conflicting version requirements`),resolution:h({strategy:E([`pick-highest`,`pick-lowest`,`manual`]).describe(`Strategy used to resolve the conflict`),version:r().optional().describe(`Resolved version selected by the strategy`),reason:r().optional().describe(`Explanation of why this resolution was chosen`)}).optional().describe(`Suggested resolution for the conflict`),severity:E([`error`,`warning`,`info`]).describe(`Severity level of the dependency conflict`)}).describe(`A detected conflict between dependency version requirements`),gU=h({status:E([`success`,`conflict`,`error`]).describe(`Overall status of the dependency resolution`),graph:mU.optional().describe(`Resolved dependency graph if resolution succeeded`),conflicts:C(hU).default([]).describe(`List of dependency conflicts detected during resolution`),errors:C(h({package:r().describe(`Name of the package that caused the error`),error:r().describe(`Error message describing what went wrong`)})).default([]).describe(`Errors encountered during dependency resolution`),installOrder:C(r()).default([]).describe(`Topologically sorted list of package IDs for installation`),resolvedIn:P().int().min(0).optional().describe(`Time taken to resolve dependencies in milliseconds`)}).describe(`Result of a dependency resolution process`),_U=h({name:r().describe(`Name of the software component`),version:r().describe(`Version of the software component`),purl:r().optional().describe(`Package URL identifier`),license:r().optional().describe(`SPDX license identifier of the component`),hashes:h({sha256:r().optional().describe(`SHA-256 hash of the component artifact`),sha512:r().optional().describe(`SHA-512 hash of the component artifact`)}).optional().describe(`Cryptographic hashes for integrity verification`),supplier:h({name:r().describe(`Name of the component supplier`),url:r().url().optional().describe(`URL of the component supplier`)}).optional().describe(`Supplier information for the component`),externalRefs:C(h({type:E([`website`,`repository`,`documentation`,`issue-tracker`]).describe(`Type of external reference`),url:r().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`),vU=h({format:E([`spdx`,`cyclonedx`]).default(`cyclonedx`).describe(`SBOM standard format used`),version:r().describe(`Version of the SBOM specification`),plugin:h({id:r().describe(`Plugin identifier`),version:r().describe(`Plugin version`),name:r().describe(`Human-readable plugin name`)}).describe(`Metadata about the plugin this SBOM describes`),components:C(_U).describe(`List of software components included in the plugin`),generatedAt:r().datetime().describe(`ISO 8601 timestamp when the SBOM was generated`),generator:h({name:r().describe(`Name of the SBOM generator tool`),version:r().describe(`Version of the SBOM generator tool`)}).optional().describe(`Tool used to generate this SBOM`)}).describe(`Software Bill of Materials for a plugin`),yU=h({pluginId:r().describe(`Unique identifier of the plugin`),version:r().describe(`Version of the plugin artifact`),build:h({timestamp:r().datetime().describe(`ISO 8601 timestamp when the build was produced`),environment:h({os:r().describe(`Operating system used for the build`),arch:r().describe(`CPU architecture used for the build`),nodeVersion:r().describe(`Node.js version used for the build`)}).optional().describe(`Environment details where the build was executed`),source:h({repository:r().url().describe(`URL of the source repository`),commit:r().regex(/^[a-f0-9]{40}$/).describe(`Full SHA-1 commit hash of the source`),branch:r().optional().describe(`Branch name the build was produced from`),tag:r().optional().describe(`Git tag associated with the build`)}).optional().describe(`Source repository information for the build`),builder:h({name:r().describe(`Name of the person or system that produced the build`),email:r().email().optional().describe(`Email address of the builder`)}).optional().describe(`Identity of the builder who produced the artifact`)}).describe(`Build provenance information`),artifacts:C(h({filename:r().describe(`Name of the artifact file`),sha256:r().describe(`SHA-256 hash of the artifact`),size:P().int().positive().describe(`Size of the artifact in bytes`)})).describe(`List of build artifacts with integrity hashes`),signatures:C(h({algorithm:E([`rsa`,`ecdsa`,`ed25519`]).describe(`Cryptographic algorithm used for signing`),publicKey:r().describe(`Public key used to verify the signature`),signature:r().describe(`Digital signature value`),signedBy:r().describe(`Identity of the signer`),timestamp:r().datetime().describe(`ISO 8601 timestamp when the signature was created`)})).default([]).describe(`Cryptographic signatures for the plugin artifact`),attestations:C(h({type:E([`code-review`,`security-scan`,`test-results`,`ci-build`]).describe(`Type of attestation`),status:E([`passed`,`failed`]).describe(`Result status of the attestation`),url:r().url().optional().describe(`URL with details about the attestation`),timestamp:r().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`),bU=h({pluginId:r().describe(`Unique identifier of the plugin`),score:P().min(0).max(100).describe(`Overall trust score from 0 to 100`),components:h({vendorReputation:P().min(0).max(100).describe(`Vendor reputation score from 0 to 100`),securityScore:P().min(0).max(100).describe(`Security scan results score from 0 to 100`),codeQuality:P().min(0).max(100).describe(`Code quality score from 0 to 100`),communityScore:P().min(0).max(100).describe(`Community engagement score from 0 to 100`),maintenanceScore:P().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:E([`verified`,`trusted`,`neutral`,`untrusted`,`blocked`]).describe(`Computed trust level based on the overall score`),badges:C(E([`official`,`verified-vendor`,`security-scanned`,`code-signed`,`open-source`,`popular`])).default([]).describe(`Verification badges earned by the plugin`),updatedAt:r().datetime().describe(`ISO 8601 timestamp when the trust score was last updated`)}).describe(`Trust score and verification status for a plugin`),uCe={VulnerabilitySeverity:cU,SecurityVulnerability:lU,SecurityScanResult:uU,SecurityPolicy:dU,PackageDependency:fU,DependencyGraphNode:pU,DependencyGraph:mU,DependencyConflict:hU,DependencyResolutionResult:gU,SBOMEntry:_U,SBOM:vU,PluginProvenance:yU,PluginTrustScore:bU};DA({},{AnalyticsTimeRangeSchema:()=>OU,AppDiscoveryRequestSchema:()=>PCe,AppDiscoveryResponseSchema:()=>FCe,AppSubscriptionSchema:()=>ICe,ArtifactDownloadResponseSchema:()=>fCe,ArtifactReferenceSchema:()=>SU,CreateListingRequestSchema:()=>bCe,CuratedCollectionSchema:()=>DCe,FeaturedListingSchema:()=>ECe,InstalledAppSummarySchema:()=>zU,ListInstalledAppsRequestSchema:()=>LCe,ListInstalledAppsResponseSchema:()=>RCe,ListReviewsRequestSchema:()=>MCe,ListReviewsResponseSchema:()=>NCe,ListingActionRequestSchema:()=>SCe,ListingStatusSchema:()=>wU,MarketplaceCategorySchema:()=>CU,MarketplaceHealthMetricsSchema:()=>kCe,MarketplaceInstallRequestSchema:()=>gCe,MarketplaceInstallResponseSchema:()=>_Ce,MarketplaceListingSchema:()=>EU,MarketplaceSearchRequestSchema:()=>mCe,MarketplaceSearchResponseSchema:()=>hCe,PackageSubmissionSchema:()=>pCe,PolicyActionSchema:()=>OCe,PolicyViolationTypeSchema:()=>NU,PricingModelSchema:()=>TU,PublisherProfileSchema:()=>vCe,PublisherSchema:()=>dCe,PublisherVerificationSchema:()=>xU,PublishingAnalyticsRequestSchema:()=>CCe,PublishingAnalyticsResponseSchema:()=>wCe,RecommendationReasonSchema:()=>IU,RecommendedAppSchema:()=>LU,RejectionReasonSchema:()=>MU,ReleaseChannelSchema:()=>DU,ReviewCriterionSchema:()=>AU,ReviewDecisionSchema:()=>jU,ReviewModerationStatusSchema:()=>PU,SubmissionReviewSchema:()=>TCe,SubmitReviewRequestSchema:()=>jCe,SubscriptionStatusSchema:()=>RU,TimeSeriesPointSchema:()=>kU,TrendingListingSchema:()=>ACe,UpdateListingRequestSchema:()=>xCe,UserReviewSchema:()=>FU,VersionReleaseSchema:()=>yCe});var xU=E([`unverified`,`pending`,`verified`,`trusted`,`partner`]).describe(`Publisher verification status`),dCe=h({id:r().describe(`Publisher ID`),name:r().describe(`Publisher display name`),type:E([`individual`,`organization`]).describe(`Publisher type`),verification:xU.default(`unverified`).describe(`Publisher verification status`),email:r().email().optional().describe(`Contact email`),website:r().url().optional().describe(`Publisher website`),logoUrl:r().url().optional().describe(`Publisher logo URL`),description:r().optional().describe(`Publisher description`),registeredAt:r().datetime().optional().describe(`Publisher registration timestamp`)}).describe(`Developer or organization that publishes packages`),SU=h({url:r().url().describe(`Artifact download URL`),sha256:r().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum`),size:P().int().positive().describe(`Artifact size in bytes`),format:E([`tgz`,`zip`]).default(`tgz`).describe(`Artifact format`),uploadedAt:r().datetime().describe(`Upload timestamp`)}).describe(`Reference to a downloadable package artifact`),fCe=h({downloadUrl:r().url().describe(`Artifact download URL (may be pre-signed)`),sha256:r().regex(/^[a-f0-9]{64}$/).describe(`SHA256 checksum for verification`),size:P().int().positive().describe(`Artifact size in bytes`),format:E([`tgz`,`zip`]).describe(`Artifact format`),expiresAt:r().datetime().optional().describe(`URL expiration timestamp for pre-signed URLs`)}).describe(`Artifact download response with integrity metadata`),CU=E([`crm`,`erp`,`hr`,`finance`,`project`,`collaboration`,`analytics`,`integration`,`automation`,`ai`,`security`,`developer-tools`,`ui-theme`,`storage`,`other`]).describe(`Marketplace package category`),wU=E([`draft`,`submitted`,`in-review`,`approved`,`published`,`rejected`,`suspended`,`deprecated`,`unlisted`]).describe(`Marketplace listing status`),TU=E([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).describe(`Package pricing model`),EU=h({id:r().describe(`Listing ID (matches package manifest ID)`),packageId:r().describe(`Package identifier`),publisherId:r().describe(`Publisher ID`),status:wU.default(`draft`).describe(`Publication state: draft, published, under-review, suspended, deprecated, or unlisted`),name:r().describe(`Display name`),tagline:r().max(120).optional().describe(`Short tagline (max 120 chars)`),description:r().optional().describe(`Full description (Markdown)`),category:CU.describe(`Package category`),tags:C(r()).optional().describe(`Search tags`),iconUrl:r().url().optional().describe(`Package icon URL`),screenshots:C(h({url:r().url(),caption:r().optional()})).optional().describe(`Screenshots`),documentationUrl:r().url().optional().describe(`Documentation URL`),supportUrl:r().url().optional().describe(`Support URL`),repositoryUrl:r().url().optional().describe(`Source repository URL`),pricing:TU.default(`free`).describe(`Pricing model`),priceInCents:P().int().min(0).optional().describe(`Price in cents (e.g. 999 = $9.99)`),latestVersion:r().describe(`Latest published version`),minPlatformVersion:r().optional().describe(`Minimum ObjectStack platform version`),versions:C(h({version:r().describe(`Version string`),releaseDate:r().datetime().describe(`Release date`),releaseNotes:r().optional().describe(`Release notes`),minPlatformVersion:r().optional().describe(`Minimum platform version`),deprecated:S().default(!1).describe(`Whether this version is deprecated`),artifact:SU.optional().describe(`Downloadable artifact for this version`)})).optional().describe(`Published versions`),stats:h({totalInstalls:P().int().min(0).default(0).describe(`Total installs`),activeInstalls:P().int().min(0).default(0).describe(`Active installs`),averageRating:P().min(0).max(5).optional().describe(`Average user rating (0-5)`),totalRatings:P().int().min(0).default(0).describe(`Total ratings count`),totalReviews:P().int().min(0).default(0).describe(`Total reviews count`)}).optional().describe(`Aggregate marketplace statistics`),publishedAt:r().datetime().optional().describe(`First published timestamp`),updatedAt:r().datetime().optional().describe(`Last updated timestamp`)}).describe(`Public-facing package listing on the marketplace`),pCe=h({id:r().describe(`Submission ID`),packageId:r().describe(`Package identifier`),version:r().describe(`Version being submitted`),publisherId:r().describe(`Publisher submitting`),status:E([`pending`,`scanning`,`in-review`,`changes-requested`,`approved`,`rejected`]).default(`pending`).describe(`Review status`),artifactUrl:r().describe(`Package artifact URL for review`),releaseNotes:r().optional().describe(`Release notes for this version`),isNewListing:S().default(!1).describe(`Whether this is a new listing submission`),scanResults:h({passed:S(),securityScore:P().min(0).max(100).optional(),compatibilityCheck:S().optional(),issues:C(h({severity:E([`critical`,`high`,`medium`,`low`,`info`]),message:r(),file:r().optional(),line:P().optional()})).optional()}).optional().describe(`Automated scan results`),reviewerNotes:r().optional().describe(`Notes from the platform reviewer`),submittedAt:r().datetime().optional().describe(`Submission timestamp`),reviewedAt:r().datetime().optional().describe(`Review completion timestamp`)}).describe(`Developer submission of a package version for review`),mCe=h({query:r().optional().describe(`Full-text search query`),category:CU.optional().describe(`Filter by category`),tags:C(r()).optional().describe(`Filter by tags`),pricing:TU.optional().describe(`Filter by pricing model`),publisherVerification:xU.optional().describe(`Filter by publisher verification level`),sortBy:E([`relevance`,`popularity`,`rating`,`newest`,`updated`,`name`]).default(`relevance`).describe(`Sort field`),sortDirection:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(100).default(20).describe(`Items per page`),platformVersion:r().optional().describe(`Filter by platform version compatibility`)}).describe(`Marketplace search request`),hCe=h({items:C(EU).describe(`Search result listings`),total:P().int().min(0).describe(`Total matching results`),page:P().int().min(1).describe(`Current page number`),pageSize:P().int().min(1).describe(`Items per page`),facets:h({categories:C(h({category:CU,count:P().int().min(0)})).optional(),pricing:C(h({model:TU,count:P().int().min(0)})).optional()}).optional().describe(`Aggregation facets for refining search`)}).describe(`Marketplace search response`),gCe=h({listingId:r().describe(`Marketplace listing ID`),version:r().optional().describe(`Version to install`),licenseKey:r().optional().describe(`License key for paid packages`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),artifactRef:SU.optional().describe(`Artifact reference for direct installation`),tenantId:r().optional().describe(`Tenant identifier`)}).describe(`Install from marketplace request`),_Ce=h({success:S().describe(`Whether installation succeeded`),packageId:r().optional().describe(`Installed package identifier`),version:r().optional().describe(`Installed version`),message:r().optional().describe(`Installation status message`)}).describe(`Install from marketplace response`),vCe=h({organizationId:r().describe(`Identity Organization ID`),publisherId:r().describe(`Marketplace publisher ID`),verification:xU.default(`unverified`),agreementVersion:r().optional().describe(`Accepted developer agreement version`),website:r().url().optional().describe(`Publisher website`),supportEmail:r().email().optional().describe(`Publisher support email`),registeredAt:r().datetime()}),DU=E([`alpha`,`beta`,`rc`,`stable`]),yCe=h({version:r().describe(`Semver version (e.g., 2.1.0-beta.1)`),channel:DU.default(`stable`),releaseNotes:r().optional().describe(`Release notes (Markdown)`),changelog:C(h({type:E([`added`,`changed`,`fixed`,`removed`,`deprecated`,`security`]),description:r()})).optional().describe(`Structured changelog entries`),minPlatformVersion:r().optional(),artifactUrl:r().optional().describe(`Built package artifact URL`),artifactChecksum:r().optional().describe(`SHA-256 checksum`),deprecated:S().default(!1),deprecationMessage:r().optional(),releasedAt:r().datetime().optional()}),bCe=h({packageId:r().describe(`Package identifier`),name:r().describe(`App display name`),tagline:r().max(120).optional(),description:r().optional(),category:r().describe(`Marketplace category`),tags:C(r()).optional(),iconUrl:r().url().optional(),screenshots:C(h({url:r().url(),caption:r().optional()})).optional(),documentationUrl:r().url().optional(),supportUrl:r().url().optional(),repositoryUrl:r().url().optional(),pricing:E([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).default(`free`),priceInCents:P().int().min(0).optional()}),xCe=h({listingId:r().describe(`Listing ID to update`),name:r().optional(),tagline:r().max(120).optional(),description:r().optional(),category:r().optional(),tags:C(r()).optional(),iconUrl:r().url().optional(),screenshots:C(h({url:r().url(),caption:r().optional()})).optional(),documentationUrl:r().url().optional(),supportUrl:r().url().optional(),repositoryUrl:r().url().optional(),pricing:E([`free`,`freemium`,`paid`,`subscription`,`usage-based`,`contact-sales`]).optional(),priceInCents:P().int().min(0).optional()}),SCe=h({listingId:r().describe(`Listing ID`),action:E([`submit`,`unlist`,`deprecate`,`reactivate`]).describe(`Action to perform on listing`),reason:r().optional()}),OU=E([`last_7d`,`last_30d`,`last_90d`,`last_365d`,`all_time`]),CCe=h({listingId:r().describe(`Listing to get analytics for`),timeRange:OU.default(`last_30d`),metrics:C(E([`installs`,`uninstalls`,`active_installs`,`ratings`,`revenue`,`page_views`])).optional().describe(`Metrics to include (default: all)`)}),kU=h({date:r(),value:P()}),wCe=h({listingId:r(),timeRange:OU,summary:h({totalInstalls:P().int().min(0),activeInstalls:P().int().min(0),totalUninstalls:P().int().min(0),averageRating:P().min(0).max(5).optional(),totalRatings:P().int().min(0),totalRevenue:P().min(0).optional().describe(`Revenue in cents`),pageViews:P().int().min(0)}),timeSeries:d(r(),C(kU)).optional().describe(`Time series keyed by metric name`),ratingDistribution:h({1:P().int().min(0).default(0),2:P().int().min(0).default(0),3:P().int().min(0).default(0),4:P().int().min(0).default(0),5:P().int().min(0).default(0)}).optional()}),AU=h({id:r().describe(`Criterion ID`),category:E([`security`,`performance`,`quality`,`ux`,`documentation`,`policy`,`compatibility`]),description:r(),required:S().default(!0),passed:S().optional(),notes:r().optional()}),jU=E([`approved`,`rejected`,`changes-requested`]),MU=E([`security-vulnerability`,`policy-violation`,`quality-below-standard`,`misleading-metadata`,`incompatible`,`duplicate`,`insufficient-documentation`,`other`]),TCe=h({id:r().describe(`Review ID`),submissionId:r().describe(`Submission being reviewed`),reviewerId:r().describe(`Platform reviewer ID`),decision:jU.optional().describe(`Final decision`),criteria:C(AU).optional().describe(`Review checklist results`),rejectionReasons:C(MU).optional(),feedback:r().optional().describe(`Detailed review feedback (Markdown)`),internalNotes:r().optional().describe(`Internal reviewer notes`),startedAt:r().datetime().optional(),completedAt:r().datetime().optional()}),ECe=h({listingId:r().describe(`Featured listing ID`),priority:P().int().min(0).default(0),bannerUrl:r().url().optional(),editorialNote:r().optional(),startDate:r().datetime(),endDate:r().datetime().optional(),active:S().default(!0)}),DCe=h({id:r().describe(`Collection ID`),name:r().describe(`Collection name`),description:r().optional(),coverImageUrl:r().url().optional(),listingIds:C(r()).min(1).describe(`Ordered listing IDs`),published:S().default(!1),sortOrder:P().int().min(0).default(0),createdBy:r().optional(),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional()}),NU=E([`malware`,`data-harvesting`,`spam`,`copyright`,`inappropriate-content`,`terms-of-service`,`security-risk`,`abandoned`]),OCe=h({id:r().describe(`Action ID`),listingId:r().describe(`Target listing ID`),violationType:NU,action:E([`warning`,`suspend`,`takedown`,`restrict`]),reason:r().describe(`Explanation of the violation`),actionBy:r().describe(`Admin user ID`),actionAt:r().datetime(),resolution:r().optional(),resolved:S().default(!1)}),kCe=h({totalListings:P().int().min(0),listingsByStatus:d(r(),P().int().min(0)).optional(),listingsByCategory:d(r(),P().int().min(0)).optional(),totalPublishers:P().int().min(0),verifiedPublishers:P().int().min(0),totalInstalls:P().int().min(0),averageReviewTime:P().min(0).optional(),pendingReviews:P().int().min(0),listingsByPricing:d(r(),P().int().min(0)).optional(),snapshotAt:r().datetime()}),ACe=h({listingId:r(),rank:P().int().min(1),trendScore:P().min(0),installVelocity:P().min(0),period:r()}),PU=E([`pending`,`approved`,`flagged`,`rejected`]),FU=h({id:r().describe(`Review ID`),listingId:r().describe(`Listing being reviewed`),userId:r().describe(`Review author user ID`),displayName:r().optional().describe(`Reviewer display name`),rating:P().int().min(1).max(5).describe(`Star rating (1-5)`),title:r().max(200).optional().describe(`Review title`),body:r().max(5e3).optional().describe(`Review text`),appVersion:r().optional().describe(`App version being reviewed`),moderationStatus:PU.default(`pending`),helpfulCount:P().int().min(0).default(0),publisherResponse:h({body:r(),respondedAt:r().datetime()}).optional().describe(`Publisher response to review`),submittedAt:r().datetime(),updatedAt:r().datetime().optional()}),jCe=h({listingId:r().describe(`Listing to review`),rating:P().int().min(1).max(5).describe(`Star rating`),title:r().max(200).optional(),body:r().max(5e3).optional()}),MCe=h({listingId:r().describe(`Listing to get reviews for`),sortBy:E([`newest`,`oldest`,`highest`,`lowest`,`most-helpful`]).default(`newest`),rating:P().int().min(1).max(5).optional(),page:P().int().min(1).default(1),pageSize:P().int().min(1).max(50).default(10)}),NCe=h({items:C(FU),total:P().int().min(0),page:P().int().min(1),pageSize:P().int().min(1),ratingSummary:h({averageRating:P().min(0).max(5),totalRatings:P().int().min(0),distribution:h({1:P().int().min(0).default(0),2:P().int().min(0).default(0),3:P().int().min(0).default(0),4:P().int().min(0).default(0),5:P().int().min(0).default(0)})}).optional()}),IU=E([`popular-in-category`,`similar-users`,`complements-installed`,`trending`,`new-release`,`editor-pick`]),LU=h({listingId:r(),name:r(),tagline:r().optional(),iconUrl:r().url().optional(),category:CU,pricing:TU,averageRating:P().min(0).max(5).optional(),activeInstalls:P().int().min(0).optional(),reason:IU}),PCe=h({tenantId:r().optional(),categories:C(CU).optional(),platformVersion:r().optional(),limit:P().int().min(1).max(50).default(10)}),FCe=h({featured:C(LU).optional(),recommended:C(LU).optional(),trending:C(LU).optional(),newArrivals:C(LU).optional(),collections:C(h({id:r(),name:r(),description:r().optional(),coverImageUrl:r().url().optional(),apps:C(LU)})).optional()}),RU=E([`active`,`trialing`,`past-due`,`cancelled`,`expired`]),ICe=h({id:r().describe(`Subscription ID`),listingId:r().describe(`App listing ID`),tenantId:r().describe(`Customer tenant ID`),status:RU,licenseKey:r().optional(),plan:r().optional().describe(`Subscription plan name`),billingCycle:E([`monthly`,`annual`]).optional(),priceInCents:P().int().min(0).optional(),currentPeriodStart:r().datetime().optional(),currentPeriodEnd:r().datetime().optional(),trialEndDate:r().datetime().optional(),autoRenew:S().default(!0),createdAt:r().datetime()}),zU=h({listingId:r(),packageId:r(),name:r(),iconUrl:r().url().optional(),installedVersion:r(),latestVersion:r().optional(),updateAvailable:S().default(!1),enabled:S().default(!0),subscriptionStatus:RU.optional(),installedAt:r().datetime()}),LCe=h({tenantId:r().optional(),enabled:S().optional(),updateAvailable:S().optional(),sortBy:E([`name`,`installed-date`,`updated-date`]).default(`name`),page:P().int().min(1).default(1),pageSize:P().int().min(1).max(100).default(20)}),RCe=h({items:C(zU),total:P().int().min(0),page:P().int().min(1),pageSize:P().int().min(1)});DA({},{TestActionSchema:()=>VU,TestActionTypeSchema:()=>BU,TestAssertionSchema:()=>UU,TestAssertionTypeSchema:()=>HU,TestContextSchema:()=>zCe,TestScenarioSchema:()=>GU,TestStepSchema:()=>WU,TestSuiteSchema:()=>BCe});var zCe=d(r(),u()).describe(`Initial context or variables for the test`),BU=E([`create_record`,`update_record`,`delete_record`,`read_record`,`query_records`,`api_call`,`run_script`,`wait`]).describe(`Type of test action to perform`),VU=h({type:BU.describe(`The action type to execute`),target:r().describe(`Target Object, API Endpoint, or Function Name`),payload:d(r(),u()).optional().describe(`Data to send or use`),user:r().optional().describe(`Run as specific user/role for impersonation testing`)}).describe(`A single test action to execute against the system`),HU=E([`equals`,`not_equals`,`contains`,`not_contains`,`is_null`,`not_null`,`gt`,`gte`,`lt`,`lte`,`error`]).describe(`Comparison operator for test assertions`),UU=h({field:r().describe(`Field path in the result to check (e.g. "body.data.0.status")`),operator:HU.describe(`Comparison operator to use`),expectedValue:u().describe(`Expected value to compare against`)}).describe(`A test assertion that validates the result of a test action`),WU=h({name:r().describe(`Step name for identification in test reports`),description:r().optional().describe(`Human-readable description of what this step tests`),action:VU.describe(`The action to execute in this step`),assertions:C(UU).optional().describe(`Assertions to validate after the action completes`),capture:d(r(),r()).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`),GU=h({id:r().describe(`Unique scenario identifier`),name:r().describe(`Scenario name for test reports`),description:r().optional().describe(`Detailed description of the test scenario`),tags:C(r()).optional().describe(`Tags for filtering and categorization (e.g. "critical", "regression", "crm")`),setup:C(WU).optional().describe(`Steps to run before main test (preconditions)`),steps:C(WU).describe(`Main test sequence to execute`),teardown:C(WU).optional().describe(`Steps to cleanup after test execution`),requires:h({params:C(r()).optional().describe(`Required environment variables or parameters`),plugins:C(r()).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`),BCe=h({name:r().describe(`Test suite name`),scenarios:C(GU).describe(`List of test scenarios in this suite`)}).describe(`A collection of test scenarios grouped into a test suite`);DA({},{AUTH_CONSTANTS:()=>KCe,AUTH_ERROR_CODES:()=>qCe,AccountSchema:()=>HCe,ApiKeySchema:()=>GCe,InvitationSchema:()=>XCe,InvitationStatus:()=>qU,MemberSchema:()=>YCe,OrganizationSchema:()=>JCe,RoleSchema:()=>KU,SCIM:()=>ewe,SCIMAddressSchema:()=>$U,SCIMBulkOperationSchema:()=>oW,SCIMBulkRequestSchema:()=>twe,SCIMBulkResponseOperationSchema:()=>sW,SCIMBulkResponseSchema:()=>nwe,SCIMEmailSchema:()=>ZU,SCIMEnterpriseUserSchema:()=>tW,SCIMErrorSchema:()=>QCe,SCIMGroupReferenceSchema:()=>eW,SCIMGroupSchema:()=>iW,SCIMListResponseSchema:()=>ZCe,SCIMMemberReferenceSchema:()=>rW,SCIMMetaSchema:()=>YU,SCIMNameSchema:()=>XU,SCIMPatchOperationSchema:()=>aW,SCIMPatchRequestSchema:()=>$Ce,SCIMPhoneNumberSchema:()=>QU,SCIMUserSchema:()=>nW,SCIM_SCHEMAS:()=>JU,SessionSchema:()=>UCe,UserSchema:()=>VCe,VerificationTokenSchema:()=>WCe});var VCe=h({id:r().describe(`Unique user identifier`),email:r().email().describe(`User email address`),emailVerified:S().default(!1).describe(`Whether email is verified`),name:r().optional().describe(`User display name`),image:r().url().optional().describe(`Profile image URL`),createdAt:r().datetime().describe(`Account creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),HCe=h({id:r().describe(`Unique account identifier`),userId:r().describe(`Associated user ID`),type:E([`oauth`,`oidc`,`email`,`credentials`,`saml`,`ldap`]).describe(`Account type`),provider:r().describe(`Provider name`),providerAccountId:r().describe(`Provider account ID`),refreshToken:r().optional().describe(`OAuth refresh token`),accessToken:r().optional().describe(`OAuth access token`),expiresAt:P().optional().describe(`Token expiry timestamp (Unix)`),tokenType:r().optional().describe(`OAuth token type`),scope:r().optional().describe(`OAuth scope`),idToken:r().optional().describe(`OAuth ID token`),sessionState:r().optional().describe(`Session state`),createdAt:r().datetime().describe(`Account creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),UCe=h({id:r().describe(`Unique session identifier`),sessionToken:r().describe(`Session token`),userId:r().describe(`Associated user ID`),activeOrganizationId:r().optional().describe(`Active organization ID for context switching`),expires:r().datetime().describe(`Session expiry timestamp`),createdAt:r().datetime().describe(`Session creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`),ipAddress:r().optional().describe(`IP address`),userAgent:r().optional().describe(`User agent string`),fingerprint:r().optional().describe(`Device fingerprint`)}),WCe=h({identifier:r().describe(`Token identifier (email or phone)`),token:r().describe(`Verification token`),expires:r().datetime().describe(`Token expiry timestamp`),createdAt:r().datetime().describe(`Token creation timestamp`)}),GCe=h({id:r().describe(`API key identifier`),name:r().describe(`API key display name`),start:r().optional().describe(`Key prefix for identification`),prefix:r().optional().describe(`Custom key prefix`),userId:r().describe(`Owner user ID`),organizationId:r().optional().describe(`Scoped organization ID`),expiresAt:r().datetime().optional().describe(`Expiration timestamp`),createdAt:r().datetime().describe(`Creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`),lastUsedAt:r().datetime().optional().describe(`Last used timestamp`),lastRefetchAt:r().datetime().optional().describe(`Last refetch timestamp`),enabled:S().default(!0).describe(`Whether the key is active`),rateLimitEnabled:S().optional().describe(`Whether rate limiting is enabled`),rateLimitTimeWindow:P().int().min(0).optional().describe(`Rate limit window (ms)`),rateLimitMax:P().int().min(0).optional().describe(`Max requests per window`),remaining:P().int().min(0).optional().describe(`Remaining requests`),permissions:d(r(),S()).optional().describe(`Granular permission flags`),scopes:C(r()).optional().describe(`High-level access scopes`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),KCe={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`},qCe={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`},KU=h({name:kA.describe(`Unique role name (lowercase snake_case)`),label:r().describe(`Display label (e.g. VP of Sales)`),parent:r().optional().describe(`Parent Role ID (Reports To)`),description:r().optional()}),JCe=h({id:r().describe(`Unique organization identifier`),name:r().describe(`Organization display name`),slug:r().regex(/^[a-z0-9_-]+$/).describe(`Unique URL-friendly slug (lowercase alphanumeric, hyphens, underscores)`),logo:r().url().optional().describe(`Organization logo URL`),metadata:d(r(),u()).optional().describe(`Custom metadata`),createdAt:r().datetime().describe(`Organization creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),YCe=h({id:r().describe(`Unique member identifier`),organizationId:r().describe(`Organization ID`),userId:r().describe(`User ID`),role:r().describe(`Member role (e.g., owner, admin, member, guest)`),createdAt:r().datetime().describe(`Member creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),qU=E([`pending`,`accepted`,`rejected`,`expired`]),XCe=h({id:r().describe(`Unique invitation identifier`),organizationId:r().describe(`Organization ID`),email:r().email().describe(`Invitee email address`),role:r().describe(`Role to assign upon acceptance`),status:qU.default(`pending`).describe(`Invitation status`),expiresAt:r().datetime().describe(`Invitation expiry timestamp`),inviterId:r().describe(`User ID of the inviter`),createdAt:r().datetime().describe(`Invitation creation timestamp`),updatedAt:r().datetime().describe(`Last update timestamp`)}),JU={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`},YU=h({resourceType:r().optional().describe(`Resource type`),created:r().datetime().optional().describe(`Creation timestamp`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),location:r().url().optional().describe(`Resource location URI`),version:r().optional().describe(`Entity tag (ETag) for concurrency control`)}),XU=h({formatted:r().optional().describe(`Formatted full name`),familyName:r().optional().describe(`Family name (last name)`),givenName:r().optional().describe(`Given name (first name)`),middleName:r().optional().describe(`Middle name`),honorificPrefix:r().optional().describe(`Honorific prefix (Mr., Ms., Dr.)`),honorificSuffix:r().optional().describe(`Honorific suffix (Jr., Sr.)`)}),ZU=h({value:r().email().describe(`Email address`),type:E([`work`,`home`,`other`]).optional().describe(`Email type`),display:r().optional().describe(`Display label`),primary:S().optional().default(!1).describe(`Primary email indicator`)}),QU=h({value:r().describe(`Phone number`),type:E([`work`,`home`,`mobile`,`fax`,`pager`,`other`]).optional().describe(`Phone number type`),display:r().optional().describe(`Display label`),primary:S().optional().default(!1).describe(`Primary phone indicator`)}),$U=h({formatted:r().optional().describe(`Formatted address`),streetAddress:r().optional().describe(`Street address`),locality:r().optional().describe(`City/Locality`),region:r().optional().describe(`State/Region`),postalCode:r().optional().describe(`Postal code`),country:r().optional().describe(`Country`),type:E([`work`,`home`,`other`]).optional().describe(`Address type`),primary:S().optional().default(!1).describe(`Primary address indicator`)}),eW=h({value:r().describe(`Group ID`),$ref:r().url().optional().describe(`URI reference to the group`),display:r().optional().describe(`Group display name`),type:E([`direct`,`indirect`]).optional().describe(`Membership type`)}),tW=h({employeeNumber:r().optional().describe(`Employee number`),costCenter:r().optional().describe(`Cost center`),organization:r().optional().describe(`Organization`),division:r().optional().describe(`Division`),department:r().optional().describe(`Department`),manager:h({value:r().describe(`Manager ID`),$ref:r().url().optional().describe(`Manager URI`),displayName:r().optional().describe(`Manager name`)}).optional().describe(`Manager reference`)}),nW=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.USER),`Must include core User schema URI`).default([JU.USER]).describe(`SCIM schema URIs (must include User schema)`),id:r().optional().describe(`Unique resource identifier`),externalId:r().optional().describe(`External identifier from client system`),userName:r().describe(`Unique username (REQUIRED)`),name:XU.optional().describe(`Structured name components`),displayName:r().optional().describe(`Display name for UI`),nickName:r().optional().describe(`Nickname`),profileUrl:r().url().optional().describe(`Profile page URL`),title:r().optional().describe(`Job title`),userType:r().optional().describe(`User type (employee, contractor)`),preferredLanguage:r().optional().describe(`Preferred language (ISO 639-1)`),locale:r().optional().describe(`Locale (e.g., en-US)`),timezone:r().optional().describe(`Timezone`),active:S().optional().default(!0).describe(`Account active status`),password:r().optional().describe(`Password (write-only)`),emails:C(ZU).optional().describe(`Email addresses`),phoneNumbers:C(QU).optional().describe(`Phone numbers`),ims:C(h({value:r(),type:r().optional(),primary:S().optional()})).optional().describe(`IM addresses`),photos:C(h({value:r().url(),type:E([`photo`,`thumbnail`]).optional(),primary:S().optional()})).optional().describe(`Photo URLs`),addresses:C($U).optional().describe(`Physical addresses`),groups:C(eW).optional().describe(`Group memberships`),entitlements:C(h({value:r(),type:r().optional(),primary:S().optional()})).optional().describe(`Entitlements`),roles:C(h({value:r(),type:r().optional(),primary:S().optional()})).optional().describe(`Roles`),x509Certificates:C(h({value:r(),type:r().optional(),primary:S().optional()})).optional().describe(`X509 certificates`),meta:YU.optional().describe(`Resource metadata`),[JU.ENTERPRISE_USER]:tW.optional().describe(`Enterprise user attributes`)}).superRefine((e,t)=>{e[JU.ENTERPRISE_USER]!=null&&((e.schemas||[]).includes(JU.ENTERPRISE_USER)||t.addIssue({code:de.custom,path:[`schemas`],message:`schemas must include "${JU.ENTERPRISE_USER}" when enterprise user extension attributes are present`}))}),rW=h({value:r().describe(`Member ID`),$ref:r().url().optional().describe(`URI reference to the member`),type:E([`User`,`Group`]).optional().describe(`Member type`),display:r().optional().describe(`Member display name`)}),iW=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.GROUP),`Must include core Group schema URI`).default([JU.GROUP]).describe(`SCIM schema URIs (must include Group schema)`),id:r().optional().describe(`Unique resource identifier`),externalId:r().optional().describe(`External identifier from client system`),displayName:r().describe(`Group display name (REQUIRED)`),members:C(rW).optional().describe(`Group members`),meta:YU.optional().describe(`Resource metadata`)}),ZCe=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.LIST_RESPONSE),{message:`schemas must include ${JU.LIST_RESPONSE}`}).default([JU.LIST_RESPONSE]).describe(`SCIM schema URIs`),totalResults:P().int().min(0).describe(`Total results count`),Resources:C(l([nW,iW,d(r(),u())])).describe(`Resources array (Users, Groups, or custom resources)`),startIndex:P().int().min(1).optional().describe(`Start index (1-based)`),itemsPerPage:P().int().min(0).optional().describe(`Items per page`)}),QCe=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.ERROR),{message:`schemas must include ${JU.ERROR}`}).default([JU.ERROR]).describe(`SCIM schema URIs`),status:P().int().min(400).max(599).describe(`HTTP status code`),scimType:E([`invalidFilter`,`tooMany`,`uniqueness`,`mutability`,`invalidSyntax`,`invalidPath`,`noTarget`,`invalidValue`,`invalidVers`,`sensitive`]).optional().describe(`SCIM error type`),detail:r().optional().describe(`Error detail message`)}),aW=h({op:E([`add`,`remove`,`replace`]).describe(`Operation type`),path:r().optional().describe(`Attribute path (optional for add)`),value:u().optional().describe(`Value to set`)}),$Ce=h({schemas:C(r()).min(1).refine(e=>e.includes(JU.PATCH_OP),{message:`SCIM PATCH requests must include the PatchOp schema URI`}).default([JU.PATCH_OP]).describe(`SCIM schema URIs`),Operations:C(aW).min(1).describe(`Patch operations`)}),ewe={user:(e,t,n,r)=>({schemas:[JU.USER],userName:e,emails:[{value:t,type:`work`,primary:!0}],name:{givenName:n,familyName:r},active:!0}),group:(e,t)=>({schemas:[JU.GROUP],displayName:e,members:t||[]}),listResponse:(e,t)=>({schemas:[JU.LIST_RESPONSE],totalResults:t??e.length,Resources:e,startIndex:1,itemsPerPage:e.length}),error:(e,t,n)=>({schemas:[JU.ERROR],status:e,detail:t,scimType:n})},oW=h({method:E([`POST`,`PUT`,`PATCH`,`DELETE`]).describe(`HTTP method for the bulk operation`),path:r().describe(`Resource endpoint path (e.g. /Users, /Groups/{id})`),bulkId:r().optional().describe(`Client-assigned ID for cross-referencing between operations`),data:d(r(),u()).optional().describe(`Request body for POST/PUT/PATCH operations`),version:r().optional().describe(`ETag for optimistic concurrency control`)}),twe=h({schemas:C(m(JU.BULK_REQUEST)).default([JU.BULK_REQUEST]).describe(`SCIM schema URIs (BulkRequest)`),operations:C(oW).min(1).describe(`Bulk operations to execute (minimum 1)`),failOnErrors:P().int().optional().describe(`Stop processing after this many errors`)}),sW=h({method:E([`POST`,`PUT`,`PATCH`,`DELETE`]).describe(`HTTP method that was executed`),bulkId:r().optional().describe(`Client-assigned bulk operation ID`),location:r().optional().describe(`URL of the created or modified resource`),status:r().describe(`HTTP status code as string (e.g. "201", "400")`),response:u().optional().describe(`Response body (typically present for errors)`)}),nwe=h({schemas:C(m(JU.BULK_RESPONSE)).default([JU.BULK_RESPONSE]).describe(`SCIM schema URIs (BulkResponse)`),operations:C(sW).describe(`Results for each bulk operation`)});DA({},{AICodeReviewResultSchema:()=>gwe,AIKnowledgeSchema:()=>uW,AIModelConfigSchema:()=>cW,AIOperationCostSchema:()=>Pwe,AIOpsAgentConfigSchema:()=>wwe,AIOrchestrationExecutionResultSchema:()=>$we,AIOrchestrationSchema:()=>Zwe,AIOrchestrationTriggerSchema:()=>nK,AITaskSchema:()=>iK,AITaskTypeSchema:()=>rK,AIToolSchema:()=>lW,AgentActionResultSchema:()=>zW,AgentActionSchema:()=>MW,AgentActionSequenceResultSchema:()=>cwe,AgentActionSequenceSchema:()=>swe,AgentCommunicationProtocolSchema:()=>cK,AgentGroupMemberSchema:()=>uK,AgentGroupRoleSchema:()=>lK,AgentSchema:()=>mW,AnomalyDetectionConfigSchema:()=>QW,AutoScalingPolicySchema:()=>tG,BatchAIOrchestrationExecutionSchema:()=>Qwe,BillingPeriodSchema:()=>kG,BudgetLimitSchema:()=>Lwe,BudgetStatusSchema:()=>jG,BudgetTypeSchema:()=>AG,CICDPipelineConfigSchema:()=>WW,ChunkingStrategySchema:()=>BG,CodeContentSchema:()=>bK,CodeGenerationConfigSchema:()=>VW,CodeGenerationRequestSchema:()=>pwe,CodeGenerationTargetSchema:()=>BW,ComponentActionParamsSchema:()=>jW,ComponentActionTypeSchema:()=>wW,ComponentAgentActionSchema:()=>RW,ConversationAnalyticsSchema:()=>lTe,ConversationContextSchema:()=>OK,ConversationMessageSchema:()=>wK,ConversationSessionSchema:()=>oTe,ConversationSummarySchema:()=>sTe,CostAlertSchema:()=>NG,CostAlertTypeSchema:()=>MG,CostAnalyticsSchema:()=>IG,CostBreakdownDimensionSchema:()=>PG,CostBreakdownEntrySchema:()=>FG,CostEntrySchema:()=>Iwe,CostMetricTypeSchema:()=>Fwe,CostOptimizationRecommendationSchema:()=>LG,CostQueryFiltersSchema:()=>zwe,CostReportSchema:()=>Rwe,DataActionParamsSchema:()=>kW,DataActionTypeSchema:()=>SW,DataAgentActionSchema:()=>IW,DeploymentStrategySchema:()=>KW,DevOpsAgentSchema:()=>uwe,DevOpsToolSchema:()=>dwe,DevelopmentConfigSchema:()=>JW,DocumentChunkSchema:()=>Bwe,DocumentLoaderConfigSchema:()=>GG,DocumentMetadataSchema:()=>VG,EmbeddingModelSchema:()=>zG,EntitySchema:()=>ZG,EvaluationMetricsSchema:()=>hK,FeedbackLoopSchema:()=>uTe,FieldSynonymConfigSchema:()=>Ywe,FileContentSchema:()=>yK,FilterExpressionSchema:()=>KG,FilterGroupSchema:()=>qG,FormActionParamsSchema:()=>OW,FormActionTypeSchema:()=>xW,FormAgentActionSchema:()=>FW,FunctionCallSchema:()=>SK,GeneratedCodeSchema:()=>mwe,GitHubIntegrationSchema:()=>YW,HyperparametersSchema:()=>pK,ImageContentSchema:()=>vK,IntegrationConfigSchema:()=>ZW,IntentActionMappingSchema:()=>lwe,IssueSchema:()=>AK,MCPCapabilitySchema:()=>TG,MCPClientConfigSchema:()=>Nwe,MCPPromptArgumentSchema:()=>_G,MCPPromptMessageSchema:()=>vG,MCPPromptRequestSchema:()=>jwe,MCPPromptResponseSchema:()=>Mwe,MCPPromptSchema:()=>yG,MCPResourceRequestSchema:()=>Dwe,MCPResourceResponseSchema:()=>Owe,MCPResourceSchema:()=>pG,MCPResourceTemplateSchema:()=>mG,MCPResourceTypeSchema:()=>fG,MCPRootEntrySchema:()=>CG,MCPRootsConfigSchema:()=>wG,MCPSamplingConfigSchema:()=>SG,MCPServerConfigSchema:()=>DG,MCPServerInfoSchema:()=>EG,MCPStreamingConfigSchema:()=>bG,MCPToolApprovalSchema:()=>xG,MCPToolCallRequestSchema:()=>kwe,MCPToolCallResponseSchema:()=>Awe,MCPToolParameterSchema:()=>hG,MCPToolSchema:()=>gG,MCPTransportConfigSchema:()=>dG,MCPTransportTypeSchema:()=>uG,MessageContentSchema:()=>xK,MessageContentTypeSchema:()=>aTe,MessagePruningEventSchema:()=>cTe,MessageRoleSchema:()=>gK,MetadataFilterSchema:()=>JG,MetadataSourceSchema:()=>kK,ModelCapabilitySchema:()=>rG,ModelConfigSchema:()=>oG,ModelDriftSchema:()=>iTe,ModelFeatureSchema:()=>fK,ModelLimitsSchema:()=>iG,ModelPricingSchema:()=>aG,ModelProviderSchema:()=>nG,ModelRegistryEntrySchema:()=>lG,ModelRegistrySchema:()=>Twe,ModelSelectionCriteriaSchema:()=>Ewe,MonitoringConfigSchema:()=>qW,MultiAgentGroupSchema:()=>eTe,NLQAnalyticsSchema:()=>Jwe,NLQFieldMappingSchema:()=>$G,NLQModelConfigSchema:()=>qwe,NLQParseResultSchema:()=>tK,NLQRequestSchema:()=>Wwe,NLQResponseSchema:()=>Gwe,NLQTrainingExampleSchema:()=>Kwe,NavigationActionParamsSchema:()=>EW,NavigationActionTypeSchema:()=>yW,NavigationAgentActionSchema:()=>NW,PerformanceOptimizationSchema:()=>Cwe,PipelineStageSchema:()=>UW,PluginCompositionRequestSchema:()=>_we,PluginCompositionResultSchema:()=>vwe,PluginRecommendationRequestSchema:()=>ywe,PluginRecommendationSchema:()=>bwe,PluginScaffoldingTemplateSchema:()=>hwe,PostProcessingActionSchema:()=>sK,PredictionRequestSchema:()=>nTe,PredictionResultSchema:()=>rTe,PredictiveModelSchema:()=>tTe,PredictiveModelTypeSchema:()=>dK,PromptTemplateSchema:()=>cG,PromptVariableSchema:()=>sG,QueryContextSchema:()=>eK,QueryIntentSchema:()=>XG,QueryTemplateSchema:()=>Xwe,RAGPipelineConfigSchema:()=>YG,RAGPipelineStatusSchema:()=>Uwe,RAGQueryRequestSchema:()=>Vwe,RAGQueryResponseSchema:()=>Hwe,RerankingConfigSchema:()=>UG,ResolutionSchema:()=>jK,RetrievalStrategySchema:()=>HG,RootCauseAnalysisRequestSchema:()=>xwe,RootCauseAnalysisResultSchema:()=>Swe,SelfHealingActionSchema:()=>$W,SelfHealingConfigSchema:()=>eG,SkillSchema:()=>vW,SkillTriggerConditionSchema:()=>_W,StructuredOutputConfigSchema:()=>pW,StructuredOutputFormatSchema:()=>dW,TestingConfigSchema:()=>HW,TextContentSchema:()=>_K,TimeframeSchema:()=>QG,TokenBudgetConfigSchema:()=>EK,TokenBudgetStrategySchema:()=>TK,TokenUsageSchema:()=>OG,TokenUsageStatsSchema:()=>DK,ToolCallSchema:()=>CK,ToolCategorySchema:()=>hW,ToolSchema:()=>gW,TrainingConfigSchema:()=>mK,TransformPipelineStepSchema:()=>fW,TypedAgentActionSchema:()=>owe,UIActionTypeSchema:()=>TW,VectorStoreConfigSchema:()=>WG,VectorStoreProviderSchema:()=>RG,VercelIntegrationSchema:()=>XW,VersionManagementSchema:()=>GW,ViewActionParamsSchema:()=>DW,ViewActionTypeSchema:()=>bW,ViewAgentActionSchema:()=>PW,WorkflowActionParamsSchema:()=>AW,WorkflowActionTypeSchema:()=>CW,WorkflowAgentActionSchema:()=>LW,WorkflowFieldConditionSchema:()=>aK,WorkflowScheduleSchema:()=>oK,defineAgent:()=>rwe,defineSkill:()=>awe,defineTool:()=>iwe,fullStackDevOpsAgentExample:()=>fwe});var cW=h({provider:E([`openai`,`azure_openai`,`anthropic`,`local`]).default(`openai`),model:r().describe(`Model name (e.g. gpt-4, claude-3-opus)`),temperature:P().min(0).max(2).default(.7),maxTokens:P().optional(),topP:P().optional()}),lW=h({type:E([`action`,`flow`,`query`,`vector_search`]),name:r().describe(`Reference name (Action Name, Flow Name)`),description:r().optional().describe(`Override description for the LLM`)}),uW=h({topics:C(r()).describe(`Topics/Tags to recruit knowledge from`),indexes:C(r()).describe(`Vector Store Indexes`)}),dW=E([`json_object`,`json_schema`,`regex`,`grammar`,`xml`]).describe(`Output format for structured agent responses`),fW=E([`trim`,`parse_json`,`validate`,`coerce_types`]).describe(`Post-processing step for structured output`),pW=h({format:dW.describe(`Expected output format`),schema:d(r(),u()).optional().describe(`JSON Schema definition for output`),strict:S().default(!1).describe(`Enforce exact schema compliance`),retryOnValidationFailure:S().default(!0).describe(`Retry generation when output fails validation`),maxRetries:P().int().min(0).default(3).describe(`Maximum retries on validation failure`),fallbackFormat:dW.optional().describe(`Fallback format if primary format fails`),transformPipeline:C(fW).optional().describe(`Post-processing steps applied to output`)}).describe(`Structured output configuration for agent responses`),mW=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Agent unique identifier`),label:r().describe(`Agent display name`),avatar:r().optional(),role:r().describe(`The persona/role (e.g. "Senior Support Engineer")`),instructions:r().describe(`System Prompt / Prime Directives`),model:cW.optional(),lifecycle:$j.optional().describe(`State machine defining the agent conversation follow and constraints`),skills:C(r().regex(/^[a-z_][a-z0-9_]*$/)).optional().describe(`Skill names to attach (Agent→Skill→Tool architecture)`),tools:C(lW).optional().describe(`Direct tool references (legacy fallback)`),knowledge:uW.optional().describe(`RAG access`),active:S().default(!0),access:C(r()).optional().describe(`Who can chat with this agent`),permissions:C(r()).optional().describe(`Required permissions or roles`),tenantId:r().optional().describe(`Tenant/Organization ID`),visibility:E([`global`,`organization`,`private`]).default(`organization`),planning:h({strategy:E([`react`,`plan_and_execute`,`reflexion`,`tree_of_thought`]).default(`react`).describe(`Autonomous reasoning strategy`),maxIterations:P().int().min(1).max(100).default(10).describe(`Maximum planning loop iterations`),allowReplan:S().default(!0).describe(`Allow dynamic re-planning based on intermediate results`)}).optional().describe(`Autonomous reasoning and planning configuration`),memory:h({shortTerm:h({maxMessages:P().int().min(1).default(50).describe(`Max recent messages in working memory`),maxTokens:P().int().min(100).optional().describe(`Max tokens for short-term context window`)}).optional().describe(`Short-term / working memory`),longTerm:h({enabled:S().default(!1).describe(`Enable long-term memory persistence`),store:E([`vector`,`database`,`redis`]).default(`vector`).describe(`Long-term memory storage backend`),maxEntries:P().int().min(1).optional().describe(`Max entries in long-term memory`)}).optional().describe(`Long-term / persistent memory`),reflectionInterval:P().int().min(1).optional().describe(`Reflect every N interactions to improve behavior`)}).optional().describe(`Agent memory management`),guardrails:h({maxTokensPerInvocation:P().int().min(1).optional().describe(`Token budget per single invocation`),maxExecutionTimeSec:P().int().min(1).optional().describe(`Max execution time in seconds`),blockedTopics:C(r()).optional().describe(`Forbidden topics or action names`)}).optional().describe(`Safety guardrails for the agent`),structuredOutput:pW.optional().describe(`Structured output format and validation configuration`)});function rwe(e){return mW.parse(e)}var hW=E([`data`,`action`,`flow`,`integration`,`vector_search`,`analytics`,`utility`]).describe(`Tool operational category`),gW=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool unique identifier (snake_case)`),label:r().describe(`Tool display name`),description:r().describe(`Tool description for LLM function calling`),category:hW.optional().describe(`Tool category for grouping and filtering`),parameters:d(r(),u()).describe(`JSON Schema for tool parameters`),outputSchema:d(r(),u()).optional().describe(`JSON Schema for tool output`),objectName:r().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object name (snake_case)`),requiresConfirmation:S().default(!1).describe(`Require user confirmation before execution`),permissions:C(r()).optional().describe(`Required permissions or roles`),active:S().default(!0).describe(`Whether the tool is enabled`),builtIn:S().default(!1).describe(`Platform built-in tool flag`)});function iwe(e){return gW.parse(e)}var _W=h({field:r().describe(`Context field to evaluate`),operator:E([`eq`,`neq`,`in`,`not_in`,`contains`]).describe(`Comparison operator`),value:l([r(),C(r())]).describe(`Expected value or values`)}),vW=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Skill unique identifier (snake_case)`),label:r().describe(`Skill display name`),description:r().optional().describe(`Skill description`),instructions:r().optional().describe(`LLM instructions when skill is active`),tools:C(r().regex(/^[a-z_][a-z0-9_]*$/)).describe(`Tool names belonging to this skill`),triggerPhrases:C(r()).optional().describe(`Phrases that activate this skill`),triggerConditions:C(_W).optional().describe(`Programmatic activation conditions`),permissions:C(r()).optional().describe(`Required permissions or roles`),active:S().default(!0).describe(`Whether the skill is enabled`)});function awe(e){return vW.parse(e)}var yW=E([`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`]),bW=E([`change_view_mode`,`apply_filter`,`clear_filter`,`apply_sort`,`change_grouping`,`show_columns`,`expand_record`,`collapse_record`,`refresh_view`,`export_data`]),xW=E([`create_record`,`update_record`,`delete_record`,`fill_field`,`clear_field`,`submit_form`,`cancel_form`,`validate_form`,`save_draft`]),SW=E([`select_record`,`deselect_record`,`select_all`,`deselect_all`,`bulk_update`,`bulk_delete`,`bulk_export`]),CW=E([`trigger_flow`,`trigger_approval`,`trigger_webhook`,`run_report`,`send_email`,`send_notification`,`schedule_task`]),wW=E([`open_modal`,`close_modal`,`open_sidebar`,`close_sidebar`,`show_notification`,`hide_notification`,`open_dropdown`,`close_dropdown`,`toggle_section`]),TW=l([yW,bW,xW,SW,CW,wW]),EW=h({object:r().optional().describe(`Object name (for object-specific navigation)`),recordId:r().optional().describe(`Record ID (for detail page)`),viewType:E([`list`,`form`,`detail`,`kanban`,`calendar`,`gantt`]).optional(),dashboardId:r().optional().describe(`Dashboard ID`),reportId:r().optional().describe(`Report ID`),appName:r().optional().describe(`App name`),mode:E([`new`,`edit`,`view`]).optional().describe(`Form mode`),openInNewTab:S().optional().describe(`Open in new tab`)}),DW=h({viewMode:E([`list`,`kanban`,`calendar`,`gantt`,`pivot`]).optional(),filters:d(r(),u()).optional().describe(`Filter conditions`),sort:C(h({field:r(),order:E([`asc`,`desc`])})).optional(),groupBy:r().optional().describe(`Field to group by`),columns:C(r()).optional().describe(`Columns to show/hide`),recordId:r().optional().describe(`Record to expand/collapse`),exportFormat:E([`csv`,`xlsx`,`pdf`,`json`]).optional()}),OW=h({object:r().optional().describe(`Object name`),recordId:r().optional().describe(`Record ID (for edit/delete)`),fieldValues:d(r(),u()).optional().describe(`Field name-value pairs`),fieldName:r().optional().describe(`Specific field to fill/clear`),fieldValue:u().optional().describe(`Value to set`),validateOnly:S().optional().describe(`Validate without saving`)}),kW=h({recordIds:C(r()).optional().describe(`Record IDs to select/operate on`),filters:d(r(),u()).optional().describe(`Filter for bulk operations`),updateData:d(r(),u()).optional().describe(`Data for bulk update`),exportFormat:E([`csv`,`xlsx`,`pdf`,`json`]).optional()}),AW=h({flowName:r().optional().describe(`Flow/workflow name`),approvalProcessName:r().optional().describe(`Approval process name`),webhookUrl:r().optional().describe(`Webhook URL`),reportName:r().optional().describe(`Report name`),emailTemplate:r().optional().describe(`Email template`),recipients:C(r()).optional().describe(`Email recipients`),subject:r().optional().describe(`Email subject`),message:r().optional().describe(`Notification/email message`),taskData:d(r(),u()).optional().describe(`Task creation data`),scheduleTime:r().optional().describe(`Schedule time (ISO 8601)`),contextData:d(r(),u()).optional().describe(`Additional context data`)}),jW=h({componentId:r().optional().describe(`Component ID`),modalConfig:h({title:r().optional(),content:u().optional(),size:E([`small`,`medium`,`large`,`fullscreen`]).optional()}).optional(),notificationConfig:h({type:E([`info`,`success`,`warning`,`error`]).optional(),message:r(),duration:P().optional().describe(`Duration in ms`)}).optional(),sidebarConfig:h({position:E([`left`,`right`]).optional(),width:r().optional(),content:u().optional()}).optional()}),MW=h({id:r().optional().describe(`Unique action ID`),type:TW.describe(`Type of UI action to perform`),params:l([EW,DW,OW,kW,AW,jW]).describe(`Action-specific parameters`),requireConfirmation:S().default(!1).describe(`Require user confirmation before executing`),confirmationMessage:r().optional().describe(`Message to show in confirmation dialog`),successMessage:r().optional().describe(`Message to show on success`),onError:E([`retry`,`skip`,`abort`]).default(`abort`).describe(`Error handling strategy`),metadata:h({intent:r().optional().describe(`Original user intent/query`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),agentName:r().optional().describe(`Agent that generated this action`),timestamp:r().datetime().optional().describe(`Generation timestamp (ISO 8601)`)}).optional()}),NW=MW.extend({type:yW,params:EW}),PW=MW.extend({type:bW,params:DW}),FW=MW.extend({type:xW,params:OW}),IW=MW.extend({type:SW,params:kW}),LW=MW.extend({type:CW,params:AW}),RW=MW.extend({type:wW,params:jW}),owe=l([NW,PW,FW,IW,LW,RW]),swe=h({id:r().optional().describe(`Unique sequence ID`),actions:C(MW).describe(`Ordered list of actions`),mode:E([`sequential`,`parallel`]).default(`sequential`).describe(`Execution mode`),stopOnError:S().default(!0).describe(`Stop sequence on first error`),atomic:S().default(!1).describe(`Transaction mode (all-or-nothing)`),startTime:r().datetime().optional().describe(`Execution start time (ISO 8601)`),endTime:r().datetime().optional().describe(`Execution end time (ISO 8601)`),metadata:h({intent:r().optional().describe(`Original user intent`),confidence:P().min(0).max(1).optional().describe(`Overall confidence score`),agentName:r().optional().describe(`Agent that generated this sequence`)}).optional()}),zW=h({actionId:r().describe(`ID of the executed action`),status:E([`success`,`error`,`cancelled`,`pending`]).describe(`Execution status`),data:u().optional().describe(`Action result data`),error:h({code:r(),message:r(),details:u().optional()}).optional().describe(`Error details if status is "error"`),metadata:h({startTime:r().optional().describe(`Execution start time (ISO 8601)`),endTime:r().optional().describe(`Execution end time (ISO 8601)`),duration:P().optional().describe(`Execution duration in ms`)}).optional()}),cwe=h({sequenceId:r().describe(`ID of the executed sequence`),status:E([`success`,`partial_success`,`error`,`cancelled`]).describe(`Overall execution status`),results:C(zW).describe(`Results for each action`),summary:h({total:P().describe(`Total number of actions`),successful:P().describe(`Number of successful actions`),failed:P().describe(`Number of failed actions`),cancelled:P().describe(`Number of cancelled actions`)}),metadata:h({startTime:r().optional(),endTime:r().optional(),totalDuration:P().optional().describe(`Total execution time in ms`)}).optional()}),lwe=h({intent:r().describe(`Intent pattern (e.g., "open_new_record_form")`),examples:C(r()).optional().describe(`Example user queries`),actionTemplate:MW.describe(`Action to execute`),paramExtraction:d(r(),h({type:E([`entity`,`slot`,`context`]),required:S().default(!1),default:u().optional()})).optional().describe(`Rules for extracting parameters from user input`),minConfidence:P().min(0).max(1).default(.7).describe(`Minimum confidence to execute`)}),BW=E([`frontend`,`backend`,`api`,`database`,`tests`,`documentation`,`infrastructure`]).describe(`Code generation target`),VW=h({enabled:S().optional().default(!0).describe(`Enable code generation`),targets:C(BW).describe(`Code generation targets`),templateRepo:r().optional().describe(`Template repository for scaffolding`),styleGuide:r().optional().describe(`Code style guide to follow`),includeTests:S().optional().default(!0).describe(`Generate tests with code`),includeDocumentation:S().optional().default(!0).describe(`Generate documentation`),validationMode:E([`strict`,`moderate`,`permissive`]).optional().default(`strict`).describe(`Code validation strictness`)}),HW=h({enabled:S().optional().default(!0).describe(`Enable automated testing`),testTypes:C(E([`unit`,`integration`,`e2e`,`performance`,`security`,`accessibility`])).optional().default([`unit`,`integration`]).describe(`Types of tests to run`),coverageThreshold:P().min(0).max(100).optional().default(80).describe(`Minimum test coverage percentage`),framework:r().optional().describe(`Testing framework (e.g., vitest, jest, playwright)`),preCommitTests:S().optional().default(!0).describe(`Run tests before committing`),autoFix:S().optional().default(!1).describe(`Attempt to auto-fix failing tests`)}),UW=h({name:r().describe(`Pipeline stage name`),type:E([`build`,`test`,`lint`,`security_scan`,`deploy`,`smoke_test`,`rollback`]).describe(`Stage type`),order:P().int().min(0).describe(`Execution order`),parallel:S().optional().default(!1).describe(`Can run in parallel with other stages`),commands:C(r()).describe(`Commands to execute`),env:d(r(),r()).optional().describe(`Stage-specific environment variables`),timeout:P().int().min(60).optional().default(600).describe(`Stage timeout in seconds`),retryOnFailure:S().optional().default(!1).describe(`Retry stage on failure`),maxRetries:P().int().min(0).max(5).optional().default(0).describe(`Maximum retry attempts`)}),WW=h({name:r().describe(`Pipeline name`),trigger:E([`push`,`pull_request`,`release`,`schedule`,`manual`]).describe(`Pipeline trigger`),branches:C(r()).optional().describe(`Branches to run pipeline on`),stages:C(UW).describe(`Pipeline stages`),notifications:h({onSuccess:S().optional().default(!1),onFailure:S().optional().default(!0),channels:C(r()).optional().describe(`Notification channels (e.g., slack, email)`)}).optional().describe(`Pipeline notifications`)}),GW=h({scheme:E([`semver`,`calver`,`custom`]).optional().default(`semver`).describe(`Versioning scheme`),autoIncrement:E([`major`,`minor`,`patch`,`none`]).optional().default(`patch`).describe(`Auto-increment strategy`),prefix:r().optional().default(`v`).describe(`Version tag prefix`),generateChangelog:S().optional().default(!0).describe(`Generate changelog automatically`),changelogFormat:E([`conventional`,`keepachangelog`,`custom`]).optional().default(`conventional`).describe(`Changelog format`),tagReleases:S().optional().default(!0).describe(`Create Git tags for releases`)}),KW=h({type:E([`rolling`,`blue_green`,`canary`,`recreate`]).optional().default(`rolling`).describe(`Deployment strategy`),canaryPercentage:P().min(0).max(100).optional().default(10).describe(`Canary deployment percentage`),healthCheckUrl:r().optional().describe(`Health check endpoint`),healthCheckTimeout:P().int().min(10).optional().default(60).describe(`Health check timeout in seconds`),autoRollback:S().optional().default(!0).describe(`Automatically rollback on failure`),smokeTests:C(r()).optional().describe(`Smoke test commands to run post-deployment`)}),qW=h({enabled:S().optional().default(!0).describe(`Enable monitoring`),metrics:C(E([`performance`,`errors`,`usage`,`availability`,`latency`])).optional().default([`performance`,`errors`,`availability`]).describe(`Metrics to monitor`),alerts:C(h({name:r().describe(`Alert name`),metric:r().describe(`Metric to monitor`),threshold:P().describe(`Alert threshold`),severity:E([`info`,`warning`,`critical`]).describe(`Alert severity`)})).optional().describe(`Alert configurations`),integrations:C(r()).optional().describe(`Monitoring service integrations`)}),JW=h({specificationSource:r().describe(`Path to ObjectStack specification`),codeGeneration:VW.describe(`Code generation settings`),testing:HW.optional().describe(`Testing configuration`),linting:h({enabled:S().optional().default(!0),autoFix:S().optional().default(!0),rules:d(r(),u()).optional()}).optional().describe(`Code linting configuration`),formatting:h({enabled:S().optional().default(!0),autoFormat:S().optional().default(!0),config:d(r(),u()).optional()}).optional().describe(`Code formatting configuration`)}),YW=h({connector:r().describe(`GitHub connector name`),repository:h({owner:r().describe(`Repository owner`),name:r().describe(`Repository name`)}).describe(`Repository configuration`),featureBranch:r().optional().default(`develop`).describe(`Default feature branch`),pullRequest:h({autoCreate:S().optional().default(!0).describe(`Automatically create PRs`),autoMerge:S().optional().default(!1).describe(`Automatically merge PRs when checks pass`),requireReviews:S().optional().default(!0).describe(`Require reviews before merge`),deleteBranchOnMerge:S().optional().default(!0).describe(`Delete feature branch after merge`)}).optional().describe(`Pull request settings`)}),XW=h({connector:r().describe(`Vercel connector name`),project:r().describe(`Vercel project name`),environments:h({production:r().optional().default(`main`).describe(`Production branch`),preview:C(r()).optional().default([`develop`,`feature/*`]).describe(`Preview branches`)}).optional().describe(`Environment mapping`),deployment:h({autoDeployProduction:S().optional().default(!1).describe(`Auto-deploy to production`),autoDeployPreview:S().optional().default(!0).describe(`Auto-deploy preview environments`),requireApproval:S().optional().default(!0).describe(`Require approval for production deployments`)}).optional().describe(`Deployment settings`)}),ZW=h({github:YW.describe(`GitHub integration configuration`),vercel:XW.describe(`Vercel integration configuration`),additional:d(r(),u()).optional().describe(`Additional integration configurations`)}),uwe=mW.extend({developmentConfig:JW.describe(`Development configuration`),pipelines:C(WW).optional().describe(`CI/CD pipelines`),versionManagement:GW.optional().describe(`Version management configuration`),deploymentStrategy:KW.optional().describe(`Deployment strategy`),monitoring:qW.optional().describe(`Monitoring configuration`),integrations:ZW.describe(`Integration configurations`),selfIteration:h({enabled:S().optional().default(!0).describe(`Enable self-iteration`),iterationFrequency:r().optional().describe(`Iteration frequency (cron expression)`),optimizationGoals:C(E([`performance`,`security`,`code_quality`,`test_coverage`,`documentation`])).optional().describe(`Optimization goals`),learningMode:E([`conservative`,`balanced`,`aggressive`]).optional().default(`balanced`).describe(`Learning mode`)}).optional().describe(`Self-iteration configuration`)}),dwe=lW.extend({type:E([`action`,`flow`,`query`,`vector_search`,`git_operation`,`code_generation`,`test_execution`,`deployment`,`monitoring`])}),fwe={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. - -Your responsibilities: -1. Generate code based on ObjectStack specifications -2. Write comprehensive tests for all generated code -3. Ensure code quality through linting and formatting -4. Manage Git workflow (commits, branches, PRs) -5. Deploy applications to Vercel -6. Monitor deployments and handle rollbacks -7. Continuously optimize and iterate on the codebase - -Guidelines: -- Follow ObjectStack naming conventions (camelCase for props, snake_case for names) -- Write clean, maintainable, well-documented code -- Ensure 80%+ test coverage -- Use conventional commit messages -- Create detailed PR descriptions -- Deploy only after all checks pass -- Monitor production deployments closely -- Learn from failures and optimize continuously - -Always prioritize code quality, security, and maintainability.`,model:{provider:`openai`,model:`gpt-4-turbo-preview`,temperature:.3,maxTokens:8192},tools:[{type:`action`,name:`generate_from_spec`,description:`Generate code from ObjectStack specification`},{type:`action`,name:`run_tests`,description:`Execute test suites`},{type:`action`,name:`commit_and_push`,description:`Commit changes and push to GitHub`},{type:`action`,name:`create_pull_request`,description:`Create pull request on GitHub`},{type:`action`,name:`deploy_to_vercel`,description:`Deploy application to Vercel`},{type:`action`,name:`check_deployment_health`,description:`Check deployment health status`},{type:`action`,name:`rollback_deployment`,description:`Rollback to previous deployment`}],knowledge:{topics:[`objectstack_protocol`,`typescript_best_practices`,`testing_strategies`,`ci_cd_patterns`,`deployment_strategies`],indexes:[`devops_knowledge_base`]},developmentConfig:{specificationSource:`packages/spec`,codeGeneration:{enabled:!0,targets:[`frontend`,`backend`,`api`,`tests`,`documentation`],styleGuide:`objectstack`,includeTests:!0,includeDocumentation:!0,validationMode:`strict`},testing:{enabled:!0,testTypes:[`unit`,`integration`,`e2e`],coverageThreshold:80,framework:`vitest`,preCommitTests:!0,autoFix:!1},linting:{enabled:!0,autoFix:!0},formatting:{enabled:!0,autoFormat:!0}},pipelines:[{name:`CI Pipeline`,trigger:`pull_request`,branches:[`main`,`develop`],stages:[{name:`Install Dependencies`,type:`build`,order:1,commands:[`pnpm install`],timeout:300,parallel:!1,retryOnFailure:!1,maxRetries:0},{name:`Lint`,type:`lint`,order:2,parallel:!0,commands:[`pnpm run lint`],timeout:180,retryOnFailure:!1,maxRetries:0},{name:`Type Check`,type:`lint`,order:2,parallel:!0,commands:[`pnpm run type-check`],timeout:180,retryOnFailure:!1,maxRetries:0},{name:`Test`,type:`test`,order:3,commands:[`pnpm run test:ci`],timeout:600,parallel:!1,retryOnFailure:!1,maxRetries:0},{name:`Build`,type:`build`,order:4,commands:[`pnpm run build`],timeout:600,parallel:!1,retryOnFailure:!1,maxRetries:0},{name:`Security Scan`,type:`security_scan`,order:5,commands:[`pnpm audit`,`pnpm run security-scan`],timeout:300,parallel:!1,retryOnFailure:!1,maxRetries:0}]},{name:`CD Pipeline`,trigger:`push`,branches:[`main`],stages:[{name:`Deploy to Production`,type:`deploy`,order:1,commands:[`vercel deploy --prod`],timeout:600,parallel:!1,retryOnFailure:!1,maxRetries:0},{name:`Smoke Tests`,type:`smoke_test`,order:2,commands:[`pnpm run test:smoke`],timeout:300,parallel:!1,retryOnFailure:!0,maxRetries:2}],notifications:{onSuccess:!0,onFailure:!0,channels:[`slack`,`email`]}}],versionManagement:{scheme:`semver`,autoIncrement:`patch`,prefix:`v`,generateChangelog:!0,changelogFormat:`conventional`,tagReleases:!0},deploymentStrategy:{type:`rolling`,healthCheckUrl:`/api/health`,healthCheckTimeout:60,autoRollback:!0,smokeTests:[`pnpm run test:smoke`],canaryPercentage:10},monitoring:{enabled:!0,metrics:[`performance`,`errors`,`availability`],alerts:[{name:`High Error Rate`,metric:`error_rate`,threshold:.05,severity:`critical`},{name:`Slow Response Time`,metric:`response_time`,threshold:1e3,severity:`warning`}],integrations:[`vercel`,`datadog`]},integrations:{github:{connector:`github_production`,repository:{owner:`objectstack-ai`,name:`app`},featureBranch:`develop`,pullRequest:{autoCreate:!0,autoMerge:!1,requireReviews:!0,deleteBranchOnMerge:!0}},vercel:{connector:`vercel_production`,project:`objectstack-app`,environments:{production:`main`,preview:[`develop`,`feature/*`]},deployment:{autoDeployProduction:!1,autoDeployPreview:!0,requireApproval:!0}}},selfIteration:{enabled:!0,iterationFrequency:`0 0 * * 0`,optimizationGoals:[`code_quality`,`test_coverage`,`performance`],learningMode:`balanced`},active:!0},pwe=h({description:r().describe(`What the plugin should do`),pluginType:E([`driver`,`app`,`widget`,`integration`,`automation`,`analytics`,`ai-agent`,`custom`]),outputFormat:E([`source-code`,`low-code-schema`,`dsl`]).default(`source-code`).describe(`Format of the generated output`),language:E([`typescript`,`javascript`,`python`]).default(`typescript`),framework:h({runtime:E([`node`,`browser`,`edge`,`universal`]).optional(),uiFramework:E([`react`,`vue`,`svelte`,`none`]).optional(),testing:E([`vitest`,`jest`,`mocha`,`none`]).optional()}).optional(),capabilities:C(r()).optional().describe(`Protocol IDs to implement`),dependencies:C(r()).optional().describe(`Required plugin IDs`),examples:C(h({input:r(),expectedOutput:r(),description:r().optional()})).optional(),style:h({indentation:E([`tab`,`2spaces`,`4spaces`]).default(`2spaces`),quotes:E([`single`,`double`]).default(`single`),semicolons:S().default(!0),trailingComma:S().default(!0)}).optional(),schemaOptions:h({format:E([`json`,`yaml`,`typescript`]).default(`typescript`).describe(`Output schema format`),includeExamples:S().default(!0),strictValidation:S().default(!0),generateUI:S().default(!0).describe(`Generate view, dashboard, and page definitions`),generateDataModels:S().default(!0).describe(`Generate object and field definitions`)}).optional(),context:h({existingCode:r().optional(),documentationUrls:C(r()).optional(),referencePlugins:C(r()).optional()}).optional(),options:h({generateTests:S().default(!0),generateDocs:S().default(!0),generateExamples:S().default(!0),targetCoverage:P().min(0).max(100).default(80),optimizationLevel:E([`none`,`basic`,`aggressive`]).default(`basic`)}).optional()}),mwe=h({outputFormat:E([`source-code`,`low-code-schema`,`dsl`]),code:r().optional(),language:r().optional(),schemas:C(h({type:E([`object`,`view`,`dashboard`,`app`,`workflow`,`api`,`page`]),path:r().describe(`File path for the schema`),content:r().describe(`Schema content (JSON/YAML/TypeScript)`),description:r().optional()})).optional().describe(`Generated low-code schema files`),files:C(h({path:r(),content:r(),description:r().optional()})),tests:C(h({path:r(),content:r(),coverage:P().min(0).max(100).optional()})).optional(),documentation:h({readme:r().optional(),api:r().optional(),usage:r().optional()}).optional(),package:h({name:r(),version:r(),dependencies:d(r(),r()).optional(),devDependencies:d(r(),r()).optional()}).optional(),quality:h({complexity:P().optional().describe(`Cyclomatic complexity`),maintainability:P().min(0).max(100).optional(),testCoverage:P().min(0).max(100).optional(),lintScore:P().min(0).max(100).optional()}).optional(),confidence:P().min(0).max(100).describe(`AI confidence in generated code`),suggestions:C(r()).optional(),warnings:C(r()).optional()}),hwe=h({id:r(),name:r(),description:r(),pluginType:r(),structure:C(h({type:E([`file`,`directory`]),path:r(),template:r().optional().describe(`Template content with variables`),optional:S().default(!1)})),variables:C(h({name:r(),description:r(),type:E([`string`,`number`,`boolean`,`array`,`object`]),required:S().default(!0),default:u().optional(),validation:r().optional().describe(`Validation regex or rule`)})),scripts:C(h({name:r(),command:r(),description:r().optional(),optional:S().default(!1)})).optional()}),gwe=h({assessment:E([`excellent`,`good`,`acceptable`,`needs-improvement`,`poor`]),score:P().min(0).max(100),issues:C(h({severity:E([`critical`,`error`,`warning`,`info`,`style`]),category:E([`bug`,`security`,`performance`,`maintainability`,`style`,`documentation`,`testing`,`type-safety`,`best-practice`]),file:r(),line:P().int().optional(),column:P().int().optional(),message:r(),suggestion:r().optional(),autoFixable:S().default(!1),autoFix:r().optional().describe(`Automated fix code`)})),highlights:C(h({category:r(),description:r(),file:r().optional()})).optional(),metrics:h({complexity:P().optional(),maintainability:P().min(0).max(100).optional(),testCoverage:P().min(0).max(100).optional(),duplicateCode:P().min(0).max(100).optional(),technicalDebt:r().optional().describe(`Estimated technical debt`)}).optional(),recommendations:C(h({priority:E([`high`,`medium`,`low`]),title:r(),description:r(),effort:E([`trivial`,`small`,`medium`,`large`]).optional()})),security:h({vulnerabilities:C(h({severity:E([`critical`,`high`,`medium`,`low`]),type:r(),description:r(),remediation:r().optional()})).optional(),score:P().min(0).max(100).optional()}).optional()}),_we=h({goal:r().describe(`What should the composed plugins achieve`),availablePlugins:C(h({pluginId:r(),version:r(),capabilities:C(r()).optional(),description:r().optional()})),constraints:h({maxPlugins:P().int().min(1).optional(),requiredPlugins:C(r()).optional(),excludedPlugins:C(r()).optional(),performance:h({maxLatency:P().optional().describe(`Maximum latency in ms`),maxMemory:P().optional().describe(`Maximum memory in bytes`)}).optional()}).optional(),optimize:E([`performance`,`reliability`,`simplicity`,`cost`,`security`]).optional()}),vwe=h({plugins:C(h({pluginId:r(),version:r(),role:r().describe(`Role in the composition`),configuration:d(r(),u()).optional()})),integration:h({code:r(),config:d(r(),u()).optional(),initOrder:C(r())}),dataFlow:C(h({from:r(),to:r(),data:r().describe(`Data type or description`)})),performance:h({estimatedLatency:P().optional().describe(`Estimated latency in ms`),estimatedMemory:P().optional().describe(`Estimated memory in bytes`)}).optional(),confidence:P().min(0).max(100),alternatives:C(h({description:r(),plugins:C(r()),tradeoffs:r()})).optional(),warnings:C(r()).optional()}),ywe=h({context:h({installedPlugins:C(r()).optional(),industry:r().optional(),useCases:C(r()).optional(),teamSize:P().int().optional(),budget:E([`free`,`low`,`medium`,`high`,`unlimited`]).optional()}),criteria:h({prioritize:E([`popularity`,`rating`,`compatibility`,`features`,`cost`,`support`]).optional(),certifiedOnly:S().default(!1),minRating:P().min(0).max(5).optional(),maxResults:P().int().min(1).max(50).default(10)}).optional()}),bwe=h({recommendations:C(h({pluginId:r(),name:r(),description:r(),score:P().min(0).max(100).describe(`Relevance score`),reasons:C(r()).describe(`Why this plugin is recommended`),benefits:C(r()),considerations:C(r()).optional(),alternatives:C(r()).optional(),estimatedValue:r().optional().describe(`Expected value/ROI`)})),combinations:C(h({plugins:C(r()),description:r(),synergies:C(r()).describe(`How these plugins work well together`),totalScore:P().min(0).max(100)})).optional(),learningPath:C(h({step:P().int(),plugin:r(),reason:r(),resources:C(r()).optional()})).optional()}),QW=h({enabled:S().default(!0),metrics:C(E([`cpu-usage`,`memory-usage`,`response-time`,`error-rate`,`throughput`,`latency`,`connection-count`,`queue-depth`])),algorithm:E([`statistical`,`machine-learning`,`heuristic`,`hybrid`]).default(`hybrid`),sensitivity:E([`low`,`medium`,`high`]).default(`medium`).describe(`How aggressively to detect anomalies`),timeWindow:P().int().min(60).default(300).describe(`Historical data window for anomaly detection`),confidenceThreshold:P().min(0).max(100).default(80).describe(`Minimum confidence to flag as anomaly`),alertOnDetection:S().default(!0)}),$W=h({id:r(),type:E([`restart`,`scale`,`rollback`,`clear-cache`,`adjust-config`,`execute-script`,`notify`]),trigger:h({healthStatus:C(xH).optional(),anomalyTypes:C(r()).optional(),errorPatterns:C(r()).optional(),customCondition:r().optional().describe(`Custom trigger condition (e.g., "errorRate > 0.1")`)}),parameters:d(r(),u()).optional(),maxAttempts:P().int().min(1).default(3),cooldown:P().int().min(0).default(60),timeout:P().int().min(1).default(300),requireApproval:S().default(!1),priority:P().int().min(1).default(5).describe(`Action priority (lower number = higher priority)`)}),eG=h({enabled:S().default(!0),strategy:E([`conservative`,`moderate`,`aggressive`]).default(`moderate`),actions:C($W),anomalyDetection:QW.optional(),maxConcurrentHealing:P().int().min(1).default(1).describe(`Maximum number of simultaneous healing attempts`),learning:h({enabled:S().default(!0).describe(`Learn from successful/failed healing attempts`),feedbackLoop:S().default(!0).describe(`Adjust strategy based on outcomes`)}).optional()}),tG=h({enabled:S().default(!1),metric:E([`cpu-usage`,`memory-usage`,`request-rate`,`response-time`,`queue-depth`,`custom`]),customMetric:r().optional(),targetValue:P().describe(`Desired metric value (e.g., 70 for 70% CPU)`),bounds:h({minInstances:P().int().min(1).default(1),maxInstances:P().int().min(1).default(10),minResources:h({cpu:r().optional().describe(`CPU limit (e.g., "0.5", "1")`),memory:r().optional().describe(`Memory limit (e.g., "512Mi", "1Gi")`)}).optional(),maxResources:h({cpu:r().optional(),memory:r().optional()}).optional()}),scaleUp:h({threshold:P().describe(`Metric value that triggers scale up`),stabilizationWindow:P().int().min(0).default(60).describe(`How long metric must exceed threshold`),cooldown:P().int().min(0).default(300).describe(`Minimum time between scale-up operations`),stepSize:P().int().min(1).default(1).describe(`Number of instances to add`)}),scaleDown:h({threshold:P().describe(`Metric value that triggers scale down`),stabilizationWindow:P().int().min(0).default(300).describe(`How long metric must be below threshold`),cooldown:P().int().min(0).default(600).describe(`Minimum time between scale-down operations`),stepSize:P().int().min(1).default(1).describe(`Number of instances to remove`)}),predictive:h({enabled:S().default(!1).describe(`Use ML to predict future load`),lookAhead:P().int().min(60).default(300).describe(`How far ahead to predict (seconds)`),confidence:P().min(0).max(100).default(80).describe(`Minimum confidence for prediction-based scaling`)}).optional()}),xwe=h({incidentId:r(),pluginId:r(),symptoms:C(h({type:r().describe(`Symptom type`),description:r(),severity:E([`low`,`medium`,`high`,`critical`]),timestamp:r().datetime()})),timeRange:h({start:r().datetime(),end:r().datetime()}),analyzeLogs:S().default(!0),analyzeMetrics:S().default(!0),analyzeDependencies:S().default(!0),context:d(r(),u()).optional()}),Swe=h({analysisId:r(),incidentId:r(),rootCauses:C(h({id:r(),description:r(),confidence:P().min(0).max(100),category:E([`code-defect`,`configuration`,`resource-exhaustion`,`dependency-failure`,`network-issue`,`data-corruption`,`security-breach`,`other`]),evidence:C(h({type:E([`log`,`metric`,`trace`,`event`]),content:r(),timestamp:r().datetime().optional()})),impact:E([`low`,`medium`,`high`,`critical`]),recommendations:C(r())})),contributingFactors:C(h({description:r(),confidence:P().min(0).max(100)})).optional(),timeline:C(h({timestamp:r().datetime(),event:r(),significance:E([`low`,`medium`,`high`])})).optional(),remediation:h({immediate:C(r()),shortTerm:C(r()),longTerm:C(r())}).optional(),overallConfidence:P().min(0).max(100),timestamp:r().datetime()}),Cwe=h({id:r(),pluginId:r(),type:E([`caching`,`query-optimization`,`resource-allocation`,`code-refactoring`,`architecture-change`,`configuration-tuning`]),description:r(),expectedImpact:h({performanceGain:P().min(0).max(100).describe(`Expected performance improvement (%)`),resourceSavings:h({cpu:P().optional().describe(`CPU reduction (%)`),memory:P().optional().describe(`Memory reduction (%)`),network:P().optional().describe(`Network reduction (%)`)}).optional(),costReduction:P().optional().describe(`Estimated cost reduction (%)`)}),difficulty:E([`trivial`,`easy`,`moderate`,`complex`,`very-complex`]),steps:C(r()),risks:C(r()).optional(),confidence:P().min(0).max(100),priority:E([`low`,`medium`,`high`,`critical`])}),wwe=h({agentId:r(),pluginId:r(),selfHealing:eG.optional(),autoScaling:C(tG).optional(),monitoring:h({enabled:S().default(!0),interval:P().int().min(1e3).default(6e4).describe(`Monitoring interval in milliseconds`),metrics:C(r()).optional()}).optional(),optimization:h({enabled:S().default(!0),scanInterval:P().int().min(3600).default(86400).describe(`How often to scan for optimization opportunities`),autoApply:S().default(!1).describe(`Automatically apply low-risk optimizations`)}).optional(),incidentResponse:h({enabled:S().default(!0),autoRCA:S().default(!0),notifications:C(h({channel:E([`email`,`slack`,`webhook`,`sms`]),config:d(r(),u())})).optional()}).optional()}),nG=E([`openai`,`azure_openai`,`anthropic`,`google`,`cohere`,`huggingface`,`local`,`custom`]),rG=h({textGeneration:S().optional().default(!0).describe(`Supports text generation`),textEmbedding:S().optional().default(!1).describe(`Supports text embedding`),imageGeneration:S().optional().default(!1).describe(`Supports image generation`),imageUnderstanding:S().optional().default(!1).describe(`Supports image understanding`),functionCalling:S().optional().default(!1).describe(`Supports function calling`),codeGeneration:S().optional().default(!1).describe(`Supports code generation`),reasoning:S().optional().default(!1).describe(`Supports advanced reasoning`)}),iG=h({maxTokens:P().int().positive().describe(`Maximum tokens per request`),contextWindow:P().int().positive().describe(`Context window size`),maxOutputTokens:P().int().positive().optional().describe(`Maximum output tokens`),rateLimit:h({requestsPerMinute:P().int().positive().optional(),tokensPerMinute:P().int().positive().optional()}).optional()}),aG=h({currency:r().optional().default(`USD`),inputCostPer1kTokens:P().optional().describe(`Cost per 1K input tokens`),outputCostPer1kTokens:P().optional().describe(`Cost per 1K output tokens`),embeddingCostPer1kTokens:P().optional().describe(`Cost per 1K embedding tokens`)}),oG=h({id:r().describe(`Unique model identifier`),name:r().describe(`Model display name`),version:r().describe(`Model version (e.g., "gpt-4-turbo-2024-04-09")`),provider:nG,capabilities:rG,limits:iG,pricing:aG.optional(),endpoint:r().url().optional().describe(`Custom API endpoint`),apiKey:r().optional().describe(`API key (Warning: Prefer secretRef)`),secretRef:r().optional().describe(`Reference to stored secret (e.g. system:openai_api_key)`),region:r().optional().describe(`Deployment region (e.g., "us-east-1")`),description:r().optional(),tags:C(r()).optional().describe(`Tags for categorization`),deprecated:S().optional().default(!1),recommendedFor:C(r()).optional().describe(`Use case recommendations`)}),sG=h({name:r().describe(`Variable name (e.g., "user_name", "context")`),type:E([`string`,`number`,`boolean`,`object`,`array`]).default(`string`),required:S().default(!1),defaultValue:u().optional(),description:r().optional(),validation:h({minLength:P().optional(),maxLength:P().optional(),pattern:r().optional(),enum:C(u()).optional()}).optional()}),cG=h({id:r().describe(`Unique template identifier`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template name (snake_case)`),label:r().describe(`Display name`),system:r().optional().describe(`System prompt`),user:r().describe(`User prompt template with variables`),assistant:r().optional().describe(`Assistant message prefix`),variables:C(sG).optional().describe(`Template variables`),modelId:r().optional().describe(`Recommended model ID`),temperature:P().min(0).max(2).optional(),maxTokens:P().optional(),topP:P().optional(),frequencyPenalty:P().optional(),presencePenalty:P().optional(),stopSequences:C(r()).optional(),version:r().optional().default(`1.0.0`),description:r().optional(),category:r().optional().describe(`Template category (e.g., "code_generation", "support")`),tags:C(r()).optional(),examples:C(h({input:d(r(),u()).describe(`Example variable values`),output:r().describe(`Expected output`)})).optional()}),lG=h({model:oG,status:E([`active`,`deprecated`,`experimental`,`disabled`]).default(`active`),priority:P().int().default(0).describe(`Priority for model selection`),fallbackModels:C(r()).optional().describe(`Fallback model IDs`),healthCheck:h({enabled:S().default(!0),intervalSeconds:P().int().default(300),lastChecked:r().optional().describe(`ISO timestamp`),status:E([`healthy`,`unhealthy`,`unknown`]).default(`unknown`)}).optional()}),Twe=h({name:r().describe(`Registry name`),models:d(r(),lG).describe(`Model entries by ID`),promptTemplates:d(r(),cG).optional().describe(`Prompt templates by name`),defaultModel:r().optional().describe(`Default model ID`),enableAutoFallback:S().default(!0).describe(`Auto-fallback on errors`)}),Ewe=h({capabilities:C(r()).optional().describe(`Required capabilities`),maxCostPer1kTokens:P().optional().describe(`Maximum acceptable cost`),minContextWindow:P().optional().describe(`Minimum context window size`),provider:nG.optional(),tags:C(r()).optional(),excludeDeprecated:S().default(!0)}),uG=E([`stdio`,`http`,`websocket`,`grpc`]),dG=h({type:uG,url:r().url().optional().describe(`Server URL (for HTTP/WebSocket/gRPC)`),headers:d(r(),r()).optional().describe(`Custom headers for requests`),auth:h({type:E([`none`,`bearer`,`api_key`,`oauth2`,`custom`]).default(`none`),token:r().optional().describe(`Bearer token or API key`),secretRef:r().optional().describe(`Reference to stored secret`),headerName:r().optional().describe(`Custom auth header name`)}).optional(),timeout:P().int().positive().optional().default(3e4).describe(`Request timeout in milliseconds`),retryAttempts:P().int().min(0).max(5).optional().default(3),retryDelay:P().int().positive().optional().default(1e3).describe(`Delay between retries in milliseconds`),command:r().optional().describe(`Command to execute (for stdio transport)`),args:C(r()).optional().describe(`Command arguments`),env:d(r(),r()).optional().describe(`Environment variables`),workingDirectory:r().optional().describe(`Working directory for the process`)}),fG=E([`text`,`json`,`binary`,`stream`]),pG=h({uri:r().describe(`Unique resource identifier (e.g., "objectstack://objects/account/ABC123")`),name:r().describe(`Human-readable resource name`),description:r().optional().describe(`Resource description for AI consumption`),mimeType:r().optional().describe(`MIME type (e.g., "application/json", "text/plain")`),resourceType:fG.default(`json`),content:u().optional().describe(`Resource content (for static resources)`),contentUrl:r().url().optional().describe(`URL to fetch content dynamically`),size:P().int().nonnegative().optional().describe(`Resource size in bytes`),lastModified:r().datetime().optional().describe(`Last modification timestamp (ISO 8601)`),tags:C(r()).optional().describe(`Tags for resource categorization`),permissions:h({read:S().default(!0),write:S().default(!1),delete:S().default(!1)}).optional(),cacheable:S().default(!0).describe(`Whether this resource can be cached`),cacheMaxAge:P().int().nonnegative().optional().describe(`Cache max age in seconds`)}),mG=h({uriPattern:r().describe(`URI pattern with variables (e.g., "objectstack://objects/{objectName}/{recordId}")`),name:r().describe(`Template name`),description:r().optional(),parameters:C(h({name:r().describe(`Parameter name`),type:E([`string`,`number`,`boolean`]).default(`string`),required:S().default(!0),description:r().optional(),pattern:r().optional().describe(`Regex validation pattern`),default:u().optional()})).describe(`URI parameters`),handler:r().optional().describe(`Handler function name for dynamic generation`),mimeType:r().optional(),resourceType:fG.default(`json`)}),hG=h({name:r().describe(`Parameter name`),type:E([`string`,`number`,`boolean`,`object`,`array`]),description:r().describe(`Parameter description for AI consumption`),required:S().default(!1),default:u().optional(),enum:C(u()).optional().describe(`Allowed values`),pattern:r().optional().describe(`Regex validation pattern (for strings)`),minimum:P().optional().describe(`Minimum value (for numbers)`),maximum:P().optional().describe(`Maximum value (for numbers)`),minLength:P().int().nonnegative().optional().describe(`Minimum length (for strings/arrays)`),maxLength:P().int().nonnegative().optional().describe(`Maximum length (for strings/arrays)`),properties:d(r(),F(()=>hG)).optional().describe(`Properties for object types`),items:F(()=>hG).optional().describe(`Item schema for array types`)}),gG=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool function name (snake_case)`),description:r().describe(`Tool description for AI consumption (be detailed and specific)`),parameters:C(hG).describe(`Tool parameters`),returns:h({type:E([`string`,`number`,`boolean`,`object`,`array`,`void`]),description:r().optional(),schema:hG.optional().describe(`Return value schema`)}).optional(),handler:r().describe(`Handler function or endpoint reference`),async:S().default(!0).describe(`Whether the tool executes asynchronously`),timeout:P().int().positive().optional().describe(`Execution timeout in milliseconds`),sideEffects:E([`none`,`read`,`write`,`delete`]).default(`read`).describe(`Tool side effects`),requiresConfirmation:S().default(!1).describe(`Require user confirmation before execution`),confirmationMessage:r().optional(),examples:C(h({description:r(),parameters:d(r(),u()),result:u().optional()})).optional().describe(`Usage examples for AI learning`),category:r().optional().describe(`Tool category (e.g., "data", "workflow", "analytics")`),tags:C(r()).optional(),deprecated:S().default(!1),version:r().optional().default(`1.0.0`)}),_G=h({name:r().describe(`Argument name`),description:r().optional(),type:E([`string`,`number`,`boolean`]).default(`string`),required:S().default(!1),default:u().optional()}),vG=h({role:E([`system`,`user`,`assistant`]).describe(`Message role`),content:r().describe(`Message content (can include {{variable}} placeholders)`)}),yG=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Prompt template name (snake_case)`),description:r().optional().describe(`Prompt description`),messages:C(vG).describe(`Prompt message sequence`),arguments:C(_G).optional().describe(`Dynamic arguments for the prompt`),category:r().optional(),tags:C(r()).optional(),version:r().optional().default(`1.0.0`)}),bG=h({enabled:S().describe(`Enable streaming for MCP communication`),chunkSize:P().int().positive().optional().describe(`Size of each streamed chunk in bytes`),heartbeatIntervalMs:P().int().positive().optional().default(3e4).describe(`Heartbeat interval in milliseconds`),backpressure:E([`drop`,`buffer`,`block`]).optional().describe(`Backpressure handling strategy`)}).describe(`Streaming configuration for MCP communication`),xG=h({requireApproval:S().default(!1).describe(`Require approval before tool execution`),approvalStrategy:E([`human_in_loop`,`auto_approve`,`policy_based`]).describe(`Approval strategy for tool execution`),dangerousToolPatterns:C(r()).optional().describe(`Regex patterns for tools needing approval`),autoApproveTimeout:P().int().positive().optional().describe(`Auto-approve timeout in seconds`)}).describe(`Tool approval configuration for MCP`),SG=h({enabled:S().describe(`Enable LLM sampling`),maxTokens:P().int().positive().describe(`Maximum tokens to generate`),temperature:P().min(0).max(2).optional().describe(`Sampling temperature`),stopSequences:C(r()).optional().describe(`Stop sequences to end generation`),modelPreferences:C(r()).optional().describe(`Preferred model IDs in priority order`),systemPrompt:r().optional().describe(`System prompt for sampling context`)}).describe(`Sampling configuration for MCP`),CG=h({uri:r().describe(`Root URI (e.g., file:///path/to/project)`),name:r().optional().describe(`Human-readable root name`),readOnly:S().optional().describe(`Whether the root is read-only`)}).describe(`A single root directory or resource`),wG=h({roots:C(CG).describe(`Root directories or resources available to the client`),watchForChanges:S().default(!1).describe(`Watch root directories for filesystem changes`),notifyOnChange:S().default(!0).describe(`Notify server when root contents change`)}).describe(`Roots configuration for MCP client`),TG=h({resources:S().default(!1).describe(`Supports resource listing and retrieval`),resourceTemplates:S().default(!1).describe(`Supports dynamic resource templates`),tools:S().default(!1).describe(`Supports tool/function calling`),prompts:S().default(!1).describe(`Supports prompt templates`),sampling:S().default(!1).describe(`Supports sampling from LLMs`),logging:S().default(!1).describe(`Supports logging and debugging`)}),EG=h({name:r().describe(`Server name`),version:r().describe(`Server version (semver)`),description:r().optional(),capabilities:TG,protocolVersion:r().default(`2024-11-05`).describe(`MCP protocol version`),vendor:r().optional().describe(`Server vendor/provider`),homepage:r().url().optional().describe(`Server homepage URL`),documentation:r().url().optional().describe(`Documentation URL`)}),DG=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Server unique identifier (snake_case)`),label:r().describe(`Display name`),description:r().optional(),serverInfo:EG,transport:dG,resources:C(pG).optional().describe(`Static resources`),resourceTemplates:C(mG).optional().describe(`Dynamic resource templates`),tools:C(gG).optional().describe(`Available tools`),prompts:C(yG).optional().describe(`Prompt templates`),autoStart:S().default(!1).describe(`Auto-start server on system boot`),restartOnFailure:S().default(!0).describe(`Auto-restart on failure`),healthCheck:h({enabled:S().default(!0),interval:P().int().positive().default(6e4).describe(`Health check interval in milliseconds`),timeout:P().int().positive().default(5e3).describe(`Health check timeout in milliseconds`),endpoint:r().optional().describe(`Health check endpoint (for HTTP servers)`)}).optional(),permissions:h({allowedAgents:C(r()).optional().describe(`Agent names allowed to use this server`),allowedUsers:C(r()).optional().describe(`User IDs allowed to use this server`),requireAuth:S().default(!0)}).optional(),rateLimit:h({enabled:S().default(!1),requestsPerMinute:P().int().positive().optional(),requestsPerHour:P().int().positive().optional(),burstSize:P().int().positive().optional()}).optional(),tags:C(r()).optional(),status:E([`active`,`inactive`,`maintenance`,`deprecated`]).default(`active`),version:r().optional().default(`1.0.0`),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional(),streaming:bG.optional().describe(`Streaming configuration`),toolApproval:xG.optional().describe(`Tool approval configuration`),sampling:SG.optional().describe(`LLM sampling configuration`)}),Dwe=h({uri:r().describe(`Resource URI to fetch`),parameters:d(r(),u()).optional().describe(`URI template parameters`)}),Owe=h({resource:pG,content:u().describe(`Resource content`)}),kwe=h({toolName:r().describe(`Tool to invoke`),parameters:d(r(),u()).describe(`Tool parameters`),timeout:P().int().positive().optional(),confirmationProvided:S().optional().describe(`User confirmation for tools that require it`),context:h({userId:r().optional(),sessionId:r().optional(),agentName:r().optional(),metadata:d(r(),u()).optional()}).optional()}),Awe=h({toolName:r(),status:E([`success`,`error`,`timeout`,`cancelled`]),result:u().optional().describe(`Tool execution result`),error:h({code:r(),message:r(),details:u().optional()}).optional(),executionTime:P().nonnegative().optional().describe(`Execution time in milliseconds`),timestamp:r().datetime().optional()}),jwe=h({promptName:r().describe(`Prompt template to use`),arguments:d(r(),u()).optional().describe(`Prompt arguments`)}),Mwe=h({promptName:r(),messages:C(vG).describe(`Rendered prompt messages`)}),Nwe=h({servers:C(DG).describe(`MCP servers to connect to`),defaultTimeout:P().int().positive().default(3e4).describe(`Default timeout for requests`),enableCaching:S().default(!0).describe(`Enable client-side caching`),cacheMaxAge:P().int().nonnegative().default(300).describe(`Cache max age in seconds`),retryAttempts:P().int().min(0).max(5).default(3),retryDelay:P().int().positive().default(1e3),enableLogging:S().default(!0),logLevel:E([`debug`,`info`,`warn`,`error`]).default(`info`),roots:wG.optional().describe(`Root directories/resources configuration`)}),OG=h({prompt:P().int().nonnegative().describe(`Input tokens`),completion:P().int().nonnegative().describe(`Output tokens`),total:P().int().nonnegative().describe(`Total tokens`)}),Pwe=h({operationId:r(),operationType:E([`conversation`,`orchestration`,`prediction`,`rag`,`nlq`]),agentName:r().optional().describe(`Agent that performed the operation`),modelId:r(),tokens:OG,cost:P().nonnegative().describe(`Cost in USD`),timestamp:r().datetime(),metadata:d(r(),u()).optional()}),Fwe=E([`token`,`request`,`character`,`second`,`image`,`embedding`]),kG=E([`hourly`,`daily`,`weekly`,`monthly`,`quarterly`,`yearly`,`custom`]),Iwe=h({id:r().describe(`Unique cost entry ID`),timestamp:r().datetime().describe(`ISO 8601 timestamp`),modelId:r().describe(`AI model used`),provider:r().describe(`AI provider (e.g., "openai", "anthropic")`),operation:r().describe(`Operation type (e.g., "chat_completion", "embedding")`),tokens:OG.optional().describe(`Standardized token usage`),requestCount:P().int().positive().default(1),promptCost:P().nonnegative().optional().describe(`Cost of prompt tokens`),completionCost:P().nonnegative().optional().describe(`Cost of completion tokens`),totalCost:P().nonnegative().describe(`Total cost in base currency`),currency:r().default(`USD`),sessionId:r().optional().describe(`Conversation session ID`),userId:r().optional().describe(`User who triggered the request`),agentId:r().optional().describe(`AI agent ID`),object:r().optional().describe(`Related object (e.g., "case", "project")`),recordId:r().optional().describe(`Related record ID`),tags:C(r()).optional(),metadata:d(r(),u()).optional()}),AG=E([`global`,`user`,`agent`,`object`,`project`,`department`]),Lwe=h({type:AG,scope:r().optional().describe(`Scope identifier (userId, agentId, etc.)`),maxCost:P().nonnegative().describe(`Maximum cost limit`),currency:r().default(`USD`),period:kG,customPeriodDays:P().int().positive().optional().describe(`Custom period in days`),softLimit:P().nonnegative().optional().describe(`Soft limit for warnings`),warnThresholds:C(P().min(0).max(1)).optional().describe(`Warning thresholds (e.g., [0.5, 0.8, 0.95])`),enforced:S().default(!0).describe(`Block requests when exceeded`),gracePeriodSeconds:P().int().nonnegative().default(0).describe(`Grace period after limit exceeded`),allowRollover:S().default(!1).describe(`Allow unused budget to rollover`),maxRolloverPercentage:P().min(0).max(1).optional().describe(`Max rollover as % of limit`),name:r().optional().describe(`Budget name`),description:r().optional(),active:S().default(!0),tags:C(r()).optional()}),jG=h({budgetId:r(),type:AG,scope:r().optional(),periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),currentCost:P().nonnegative().default(0),maxCost:P().nonnegative(),currency:r().default(`USD`),percentageUsed:P().nonnegative().describe(`Usage as percentage (can exceed 1.0 if over budget)`),remainingCost:P().describe(`Remaining budget (can be negative if exceeded)`),isExceeded:S().default(!1),isWarning:S().default(!1),projectedCost:P().nonnegative().optional().describe(`Projected cost for period`),projectedOverage:P().nonnegative().optional().describe(`Projected overage`),lastUpdated:r().datetime().describe(`ISO 8601 timestamp`)}),MG=E([`threshold_warning`,`threshold_critical`,`limit_exceeded`,`anomaly_detected`,`projection_exceeded`]),NG=h({id:r(),timestamp:r().datetime().describe(`ISO 8601 timestamp`),type:MG,severity:E([`info`,`warning`,`critical`]),budgetId:r().optional(),budgetType:AG.optional(),scope:r().optional(),message:r().describe(`Alert message`),currentCost:P().nonnegative(),maxCost:P().nonnegative().optional(),threshold:P().min(0).max(1).optional(),currency:r().default(`USD`),recommendations:C(r()).optional(),acknowledged:S().default(!1),acknowledgedBy:r().optional(),acknowledgedAt:r().datetime().optional(),resolved:S().default(!1),metadata:d(r(),u()).optional()}),PG=E([`model`,`provider`,`user`,`agent`,`object`,`operation`,`date`,`hour`,`tag`]),FG=h({dimension:PG,value:r().describe(`Dimension value (e.g., model ID, user ID)`),totalCost:P().nonnegative(),requestCount:P().int().nonnegative(),totalTokens:P().int().nonnegative().optional(),percentageOfTotal:P().min(0).max(1),periodStart:r().datetime().optional(),periodEnd:r().datetime().optional()}),IG=h({periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),totalCost:P().nonnegative(),totalRequests:P().int().nonnegative(),totalTokens:P().int().nonnegative().optional(),currency:r().default(`USD`),averageCostPerRequest:P().nonnegative(),averageCostPerToken:P().nonnegative().optional(),averageRequestsPerDay:P().nonnegative(),costTrend:E([`increasing`,`decreasing`,`stable`]).optional(),trendPercentage:P().optional().describe(`% change vs previous period`),byModel:C(FG).optional(),byProvider:C(FG).optional(),byUser:C(FG).optional(),byAgent:C(FG).optional(),byOperation:C(FG).optional(),byDate:C(FG).optional(),topModels:C(FG).optional(),topUsers:C(FG).optional(),topAgents:C(FG).optional(),tokensPerDollar:P().nonnegative().optional(),requestsPerDollar:P().nonnegative().optional()}),LG=h({id:r(),type:E([`switch_model`,`reduce_tokens`,`batch_requests`,`cache_results`,`adjust_parameters`,`limit_usage`]),title:r(),description:r(),estimatedSavings:P().nonnegative().optional(),savingsPercentage:P().min(0).max(1).optional(),priority:E([`low`,`medium`,`high`]),effort:E([`low`,`medium`,`high`]),actionable:S().default(!0),actionSteps:C(r()).optional(),targetModel:r().optional(),alternativeModel:r().optional(),affectedUsers:C(r()).optional(),status:E([`pending`,`accepted`,`rejected`,`implemented`]).default(`pending`),implementedAt:r().datetime().optional()}),Rwe=h({id:r(),name:r(),generatedAt:r().datetime().describe(`ISO 8601 timestamp`),periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),period:kG,analytics:IG,budgets:C(jG).optional(),alerts:C(NG).optional(),activeAlertCount:P().int().nonnegative().default(0),recommendations:C(LG).optional(),previousPeriodCost:P().nonnegative().optional(),costChange:P().optional().describe(`Change vs previous period`),costChangePercentage:P().optional(),forecastedCost:P().nonnegative().optional(),forecastedBudgetStatus:E([`under`,`at`,`over`]).optional(),format:E([`summary`,`detailed`,`executive`]).default(`summary`),currency:r().default(`USD`)}),zwe=h({startDate:r().datetime().optional().describe(`ISO 8601 timestamp`),endDate:r().datetime().optional().describe(`ISO 8601 timestamp`),modelIds:C(r()).optional(),providers:C(r()).optional(),userIds:C(r()).optional(),agentIds:C(r()).optional(),operations:C(r()).optional(),sessionIds:C(r()).optional(),minCost:P().nonnegative().optional(),maxCost:P().nonnegative().optional(),tags:C(r()).optional(),groupBy:C(PG).optional(),orderBy:E([`timestamp`,`cost`,`tokens`]).optional().default(`timestamp`),orderDirection:E([`asc`,`desc`]).optional().default(`desc`),limit:P().int().positive().optional(),offset:P().int().nonnegative().optional()}),RG=E([`pinecone`,`weaviate`,`qdrant`,`milvus`,`chroma`,`pgvector`,`redis`,`opensearch`,`elasticsearch`,`custom`]),zG=h({provider:E([`openai`,`cohere`,`huggingface`,`azure_openai`,`local`,`custom`]),model:r().describe(`Model name (e.g., "text-embedding-3-large")`),dimensions:P().int().positive().describe(`Embedding vector dimensions`),maxTokens:P().int().positive().optional().describe(`Maximum tokens per embedding`),batchSize:P().int().positive().optional().default(100).describe(`Batch size for embedding`),endpoint:r().url().optional().describe(`Custom endpoint URL`),apiKey:r().optional().describe(`API key`),secretRef:r().optional().describe(`Reference to stored secret`)}),BG=I(`type`,[h({type:m(`fixed`),chunkSize:P().int().positive().describe(`Fixed chunk size in tokens/chars`),chunkOverlap:P().int().min(0).default(0).describe(`Overlap between chunks`),unit:E([`tokens`,`characters`]).default(`tokens`)}),h({type:m(`semantic`),model:r().optional().describe(`Model for semantic chunking`),minChunkSize:P().int().positive().default(100),maxChunkSize:P().int().positive().default(1e3)}),h({type:m(`recursive`),separators:C(r()).default([` - -`,` -`,` `,``]),chunkSize:P().int().positive(),chunkOverlap:P().int().min(0).default(0)}),h({type:m(`markdown`),maxChunkSize:P().int().positive().default(1e3),respectHeaders:S().default(!0).describe(`Keep headers with content`),respectCodeBlocks:S().default(!0).describe(`Keep code blocks intact`)})]),VG=h({source:r().describe(`Document source (file path, URL, etc.)`),sourceType:E([`file`,`url`,`api`,`database`,`custom`]).optional(),title:r().optional(),author:r().optional().describe(`Document author`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`),tags:C(r()).optional(),category:r().optional(),language:r().optional().describe(`Document language (ISO 639-1 code)`),custom:d(r(),u()).optional().describe(`Custom metadata fields`)}),Bwe=h({id:r().describe(`Unique chunk identifier`),content:r().describe(`Chunk text content`),embedding:C(P()).optional().describe(`Embedding vector`),metadata:VG,chunkIndex:P().int().min(0).describe(`Chunk position in document`),tokens:P().int().optional().describe(`Token count`)}),HG=I(`type`,[h({type:m(`similarity`),topK:P().int().positive().default(5).describe(`Number of results to retrieve`),scoreThreshold:P().min(0).max(1).optional().describe(`Minimum similarity score`)}),h({type:m(`mmr`),topK:P().int().positive().default(5),fetchK:P().int().positive().default(20).describe(`Initial fetch size`),lambda:P().min(0).max(1).default(.5).describe(`Diversity vs relevance (0=diverse, 1=relevant)`)}),h({type:m(`hybrid`),topK:P().int().positive().default(5),vectorWeight:P().min(0).max(1).default(.7).describe(`Weight for vector search`),keywordWeight:P().min(0).max(1).default(.3).describe(`Weight for keyword search`)}),h({type:m(`parent_document`),topK:P().int().positive().default(5),retrieveParent:S().default(!0).describe(`Retrieve full parent document`)})]),UG=h({enabled:S().default(!1),model:r().optional().describe(`Reranking model name`),provider:E([`cohere`,`huggingface`,`custom`]).optional(),topK:P().int().positive().default(3).describe(`Final number of results after reranking`)}),WG=h({provider:RG,indexName:r().describe(`Index/collection name`),namespace:r().optional().describe(`Namespace for multi-tenancy`),host:r().optional().describe(`Vector store host`),port:P().int().optional().describe(`Vector store port`),secretRef:r().optional().describe(`Reference to stored secret`),apiKey:r().optional().describe(`API key or reference to secret`),dimensions:P().int().positive().describe(`Vector dimensions`),metric:E([`cosine`,`euclidean`,`dotproduct`]).optional().default(`cosine`),batchSize:P().int().positive().optional().default(100),connectionPoolSize:P().int().positive().optional().default(10),timeout:P().int().positive().optional().default(3e4).describe(`Timeout in milliseconds`)}),GG=h({type:E([`file`,`directory`,`url`,`api`,`database`,`custom`]),source:r().describe(`Source path, URL, or identifier`),fileTypes:C(r()).optional().describe(`Accepted file extensions (e.g., [".pdf", ".md"])`),recursive:S().optional().default(!1).describe(`Process directories recursively`),maxFileSize:P().int().optional().describe(`Maximum file size in bytes`),excludePatterns:C(r()).optional().describe(`Patterns to exclude`),extractImages:S().optional().default(!1).describe(`Extract text from images (OCR)`),extractTables:S().optional().default(!1).describe(`Extract and format tables`),loaderConfig:d(r(),u()).optional().describe(`Custom loader-specific config`)}),KG=h({field:r().describe(`Metadata field to filter`),operator:E([`eq`,`neq`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`,`contains`]).default(`eq`),value:l([r(),P(),S(),C(l([r(),P()]))]).describe(`Filter value`)}),qG=h({logic:E([`and`,`or`]).default(`and`),filters:C(l([KG,F(()=>qG)]))}),JG=l([KG,qG,d(r(),l([r(),P(),S(),C(l([r(),P()]))]))]),YG=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Pipeline name (snake_case)`),label:r().describe(`Display name`),description:r().optional(),embedding:zG,vectorStore:WG,chunking:BG,retrieval:HG,reranking:UG.optional(),loaders:C(GG).optional().describe(`Document loaders`),maxContextTokens:P().int().positive().default(4e3).describe(`Maximum tokens in context`),contextWindow:P().int().positive().optional().describe(`LLM context window size`),metadataFilters:JG.optional().describe(`Global filters for retrieval`),enableCache:S().default(!0),cacheTTL:P().int().positive().default(3600).describe(`Cache TTL in seconds`),cacheInvalidationStrategy:E([`time_based`,`manual`,`on_update`]).default(`time_based`).optional()}),Vwe=h({query:r().describe(`User query`),pipelineName:r().describe(`Pipeline to use`),topK:P().int().positive().optional(),metadataFilters:d(r(),u()).optional(),conversationHistory:C(h({role:E([`user`,`assistant`,`system`]),content:r()})).optional(),includeMetadata:S().default(!0),includeSources:S().default(!0)}),Hwe=h({query:r(),results:C(h({content:r(),score:P(),metadata:VG.optional(),chunkId:r().optional()})),context:r().describe(`Assembled context for LLM`),tokens:OG.optional().describe(`Token usage for this query`),cost:P().nonnegative().optional().describe(`Cost for this query in USD`),retrievalTime:P().optional().describe(`Retrieval time in milliseconds`)}),Uwe=h({name:r(),status:E([`active`,`indexing`,`error`,`disabled`]),documentsIndexed:P().int().min(0),lastIndexed:r().datetime().optional().describe(`ISO timestamp`),errorMessage:r().optional(),health:h({vectorStore:E([`healthy`,`unhealthy`,`unknown`]),embeddingService:E([`healthy`,`unhealthy`,`unknown`])}).optional()}),XG=E([`select`,`aggregate`,`filter`,`sort`,`compare`,`trend`,`insight`,`create`,`update`,`delete`]),ZG=h({type:E([`object`,`field`,`value`,`operator`,`function`,`timeframe`]),text:r().describe(`Original text from query`),value:u().describe(`Normalized value`),confidence:P().min(0).max(1).describe(`Confidence score`),span:w([P(),P()]).optional().describe(`Character span in query`)}),QG=h({type:E([`absolute`,`relative`]),start:r().optional().describe(`Start date (ISO format)`),end:r().optional().describe(`End date (ISO format)`),relative:h({unit:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]),value:P().int(),direction:E([`past`,`future`,`current`]).default(`past`)}).optional(),text:r().describe(`Original timeframe text`)}),$G=h({naturalLanguage:r().describe(`NL field name (e.g., "customer name")`),objectField:r().describe(`Actual field name (e.g., "account.name")`),object:r().describe(`Object name`),field:r().describe(`Field name`),confidence:P().min(0).max(1)}),eK=h({userId:r().optional(),userRole:r().optional(),currentObject:r().optional().describe(`Current object being viewed`),currentRecordId:r().optional().describe(`Current record ID`),conversationHistory:C(h({query:r(),timestamp:r(),intent:XG.optional()})).optional(),defaultLimit:P().int().default(100),timezone:r().default(`UTC`),locale:r().default(`en-US`)}),tK=h({originalQuery:r(),intent:XG,intentConfidence:P().min(0).max(1),entities:C(ZG),targetObject:r().optional().describe(`Primary object to query`),fields:C($G).optional(),timeframe:QG.optional(),ast:d(r(),u()).describe(`Generated ObjectQL AST`),confidence:P().min(0).max(1).describe(`Overall confidence`),ambiguities:C(h({type:r(),description:r(),suggestions:C(r()).optional()})).optional().describe(`Detected ambiguities requiring clarification`),alternatives:C(h({interpretation:r(),confidence:P(),ast:u()})).optional()}),Wwe=h({query:r().describe(`Natural language query`),context:eK.optional(),includeAlternatives:S().default(!1).describe(`Include alternative interpretations`),maxAlternatives:P().int().default(3),minConfidence:P().min(0).max(1).default(.5).describe(`Minimum confidence threshold`),executeQuery:S().default(!1).describe(`Execute query and return results`),maxResults:P().int().optional().describe(`Maximum results to return`)}),Gwe=h({parseResult:tK,results:C(d(r(),u())).optional().describe(`Query results`),totalCount:P().int().optional(),executionTime:P().optional().describe(`Execution time in milliseconds`),needsClarification:S().describe(`Whether query needs clarification`),tokens:OG.optional().describe(`Token usage for this query`),cost:P().nonnegative().optional().describe(`Cost for this query in USD`),suggestions:C(r()).optional().describe(`Query refinement suggestions`)}),Kwe=h({query:r().describe(`Natural language query`),context:eK.optional(),expectedIntent:XG,expectedObject:r().optional(),expectedAST:d(r(),u()).describe(`Expected ObjectQL AST`),category:r().optional().describe(`Example category`),tags:C(r()).optional(),notes:r().optional()}),qwe=h({modelId:r().describe(`Model from registry`),systemPrompt:r().optional().describe(`System prompt override`),includeSchema:S().default(!0).describe(`Include object schema in prompt`),includeExamples:S().default(!0).describe(`Include examples in prompt`),enableIntentDetection:S().default(!0),intentThreshold:P().min(0).max(1).default(.7),enableEntityRecognition:S().default(!0),entityRecognitionModel:r().optional(),enableFuzzyMatching:S().default(!0).describe(`Fuzzy match field names`),fuzzyMatchThreshold:P().min(0).max(1).default(.8),enableTimeframeDetection:S().default(!0),defaultTimeframe:r().optional().describe(`Default timeframe if not specified`),enableCaching:S().default(!0),cacheTTL:P().int().default(3600).describe(`Cache TTL in seconds`)}),Jwe=h({totalQueries:P().int(),successfulQueries:P().int(),failedQueries:P().int(),averageConfidence:P().min(0).max(1),intentDistribution:d(r(),P().int()).describe(`Count by intent type`),topQueries:C(h({query:r(),count:P().int(),averageConfidence:P()})),averageParseTime:P().describe(`Average parse time in milliseconds`),averageExecutionTime:P().optional(),lowConfidenceQueries:C(h({query:r(),confidence:P(),timestamp:r().datetime()})),startDate:r().datetime().describe(`ISO timestamp`),endDate:r().datetime().describe(`ISO timestamp`)}),Ywe=h({object:r().describe(`Object name`),field:r().describe(`Field name`),synonyms:C(r()).describe(`Natural language synonyms`),examples:C(r()).optional().describe(`Example queries using synonyms`)}),Xwe=h({id:r(),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template name (snake_case)`),label:r(),pattern:r().describe(`Query pattern with placeholders`),variables:C(h({name:r(),type:E([`object`,`field`,`value`,`timeframe`]),required:S().default(!1)})),astTemplate:d(r(),u()).describe(`AST template with variable placeholders`),category:r().optional(),examples:C(r()).optional(),tags:C(r()).optional()}),nK=E([`record_created`,`record_updated`,`field_changed`,`scheduled`,`manual`,`webhook`,`batch`]),rK=E([`classify`,`extract`,`summarize`,`generate`,`predict`,`translate`,`sentiment`,`entity_recognition`,`anomaly_detection`,`recommendation`]),iK=h({id:r().optional().describe(`Optional task ID for referencing`),name:r().describe(`Human-readable task name`),type:rK,model:r().optional().describe(`Model ID from registry (uses default if not specified)`),promptTemplate:r().optional().describe(`Prompt template ID for this task`),inputFields:C(r()).describe(`Source fields to process (e.g., ["description", "comments"])`),inputSchema:d(r(),u()).optional().describe(`Validation schema for inputs`),inputContext:d(r(),u()).optional().describe(`Additional context for the AI model`),outputField:r().describe(`Target field to store the result`),outputSchema:d(r(),u()).optional().describe(`Validation schema for output`),outputFormat:E([`text`,`json`,`number`,`boolean`,`array`]).optional().default(`text`),classes:C(r()).optional().describe(`Valid classes for classification tasks`),multiClass:S().optional().default(!1).describe(`Allow multiple classes to be selected`),extractionSchema:d(r(),u()).optional().describe(`JSON schema for structured extraction`),maxLength:P().optional().describe(`Maximum length for generated content`),temperature:P().min(0).max(2).optional().describe(`Model temperature override`),fallbackValue:u().optional().describe(`Fallback value if AI task fails`),retryAttempts:P().int().min(0).max(5).optional().default(1),condition:r().optional().describe(`Formula condition - task only runs if TRUE`),description:r().optional(),active:S().optional().default(!0)}),aK=h({field:r().describe(`Field name to monitor`),operator:E([`changed`,`changed_to`,`changed_from`,`is`,`is_not`]).optional().default(`changed`),value:u().optional().describe(`Value to compare against (for changed_to/changed_from/is/is_not)`)}),oK=h({type:E([`cron`,`interval`,`daily`,`weekly`,`monthly`]).default(`cron`),cron:r().optional().describe(`Cron expression (required if type is "cron")`),interval:P().optional().describe(`Interval in minutes (required if type is "interval")`),time:r().optional().describe(`Time of day for daily schedules (HH:MM format)`),dayOfWeek:P().int().min(0).max(6).optional().describe(`Day of week for weekly (0=Sunday)`),dayOfMonth:P().int().min(1).max(31).optional().describe(`Day of month for monthly`),timezone:r().optional().default(`UTC`)}),sK=h({type:E([`field_update`,`send_email`,`create_record`,`update_related`,`trigger_flow`,`webhook`]),name:r().describe(`Action name`),config:d(r(),u()).describe(`Action-specific configuration`),condition:r().optional().describe(`Execute only if condition is TRUE`)}),Zwe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Orchestration unique identifier (snake_case)`),label:r().describe(`Display name`),description:r().optional(),objectName:r().describe(`Target object for this orchestration`),trigger:nK,fieldConditions:C(aK).optional().describe(`Fields to monitor (for field_changed trigger)`),schedule:oK.optional().describe(`Schedule configuration (for scheduled trigger)`),webhookConfig:h({secret:r().optional().describe(`Webhook verification secret`),headers:d(r(),r()).optional().describe(`Expected headers`)}).optional().describe(`Webhook configuration (for webhook trigger)`),entryCriteria:r().optional().describe(`Formula condition - workflow only runs if TRUE`),aiTasks:C(iK).describe(`AI tasks to execute in sequence`),postActions:C(sK).optional().describe(`Actions after AI tasks complete`),executionMode:E([`sequential`,`parallel`]).optional().default(`sequential`).describe(`How to execute multiple AI tasks`),stopOnError:S().optional().default(!1).describe(`Stop workflow if any task fails`),timeout:P().optional().describe(`Maximum execution time in seconds`),priority:E([`low`,`normal`,`high`,`critical`]).optional().default(`normal`),enableLogging:S().optional().default(!0),enableMetrics:S().optional().default(!0),notifyOnFailure:C(r()).optional().describe(`User IDs to notify on failure`),active:S().optional().default(!0),version:r().optional().default(`1.0.0`),tags:C(r()).optional(),category:r().optional().describe(`Workflow category (e.g., "support", "sales", "hr")`),owner:r().optional().describe(`User ID of workflow owner`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`)}),Qwe=h({workflowName:r().describe(`Orchestration to execute`),recordIds:C(r()).describe(`Records to process`),batchSize:P().int().min(1).max(1e3).optional().default(10),parallelism:P().int().min(1).max(10).optional().default(3),priority:E([`low`,`normal`,`high`]).optional().default(`normal`)}),$we=h({workflowName:r(),recordId:r(),status:E([`success`,`partial_success`,`failed`,`skipped`]),executionTime:P().describe(`Execution time in milliseconds`),tasksExecuted:P().int().describe(`Number of tasks executed`),tasksSucceeded:P().int().describe(`Number of tasks succeeded`),tasksFailed:P().int().describe(`Number of tasks failed`),taskResults:C(h({taskId:r().optional(),taskName:r(),status:E([`success`,`failed`,`skipped`]),output:u().optional(),error:r().optional(),executionTime:P().optional().describe(`Task execution time in milliseconds`),modelUsed:r().optional(),tokensUsed:P().optional()})).optional(),tokens:OG.optional().describe(`Total token usage for this execution`),cost:P().nonnegative().optional().describe(`Total cost for this execution in USD`),error:r().optional(),startedAt:r().datetime().describe(`ISO timestamp`),completedAt:r().datetime().optional().describe(`ISO timestamp`)}),cK=E([`message_passing`,`shared_memory`,`blackboard`]),lK=E([`coordinator`,`specialist`,`critic`,`executor`]),uK=h({agentId:r().describe(`Agent identifier (reference to AgentSchema.name)`),role:lK.describe(`Agent role within the group`),capabilities:C(r()).optional().describe(`List of capabilities this agent contributes`),dependencies:C(r()).optional().describe(`Agent IDs this agent depends on for input`),priority:P().int().min(0).optional().describe(`Execution priority (0 = highest)`)}),eTe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Group unique identifier (snake_case)`),label:r().describe(`Group display name`),description:r().optional(),strategy:E([`sequential`,`parallel`,`debate`,`hierarchical`,`swarm`]).describe(`Multi-agent orchestration strategy`),agents:C(uK).min(2).describe(`Agent members (minimum 2)`),communication:h({protocol:cK.describe(`Inter-agent communication protocol`),messageQueue:r().optional().describe(`Message queue identifier for async communication`),maxRounds:P().int().min(1).optional().describe(`Maximum communication rounds before forced termination`)}).describe(`Communication configuration`),conflictResolution:E([`voting`,`priorityBased`,`consensusBased`,`coordinatorDecides`]).optional().describe(`How conflicts between agents are resolved`),timeout:P().int().min(1).optional().describe(`Maximum execution time in seconds for the group`),active:S().default(!0).describe(`Whether this agent group is active`)}),dK=E([`classification`,`regression`,`clustering`,`forecasting`,`anomaly_detection`,`recommendation`,`ranking`]),fK=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Feature name (snake_case)`),label:r().optional().describe(`Human-readable label`),field:r().describe(`Source field name`),object:r().optional().describe(`Source object (if different from target)`),dataType:E([`numeric`,`categorical`,`text`,`datetime`,`boolean`]).describe(`Feature data type`),transformation:E([`none`,`normalize`,`standardize`,`one_hot_encode`,`label_encode`,`log_transform`,`binning`,`embedding`]).optional().default(`none`),required:S().optional().default(!0),defaultValue:u().optional(),description:r().optional(),importance:P().optional().describe(`Feature importance score (0-1)`)}),pK=h({learningRate:P().optional().describe(`Learning rate for training`),epochs:P().int().optional().describe(`Number of training epochs`),batchSize:P().int().optional().describe(`Training batch size`),maxDepth:P().int().optional().describe(`Maximum tree depth`),numTrees:P().int().optional().describe(`Number of trees in ensemble`),minSamplesSplit:P().int().optional().describe(`Minimum samples to split node`),minSamplesLeaf:P().int().optional().describe(`Minimum samples in leaf node`),hiddenLayers:C(P().int()).optional().describe(`Hidden layer sizes`),activation:r().optional().describe(`Activation function`),dropout:P().optional().describe(`Dropout rate`),l1Regularization:P().optional().describe(`L1 regularization strength`),l2Regularization:P().optional().describe(`L2 regularization strength`),numClusters:P().int().optional().describe(`Number of clusters (k-means, etc.)`),seasonalPeriod:P().int().optional().describe(`Seasonal period for time series`),forecastHorizon:P().int().optional().describe(`Number of periods to forecast`),custom:d(r(),u()).optional().describe(`Algorithm-specific parameters`)}),mK=h({trainingDataRatio:P().min(0).max(1).optional().default(.8).describe(`Proportion of data for training`),validationDataRatio:P().min(0).max(1).optional().default(.1).describe(`Proportion for validation`),testDataRatio:P().min(0).max(1).optional().default(.1).describe(`Proportion for testing`),dataFilter:r().optional().describe(`Formula to filter training data`),minRecords:P().int().optional().default(100).describe(`Minimum records required`),maxRecords:P().int().optional().describe(`Maximum records to use`),strategy:E([`full`,`incremental`,`online`,`transfer_learning`]).optional().default(`full`),crossValidation:S().optional().default(!0),folds:P().int().min(2).max(10).optional().default(5).describe(`Cross-validation folds`),earlyStoppingEnabled:S().optional().default(!0),earlyStoppingPatience:P().int().optional().default(10).describe(`Epochs without improvement before stopping`),maxTrainingTime:P().optional().describe(`Maximum training time in seconds`),gpuEnabled:S().optional().default(!1),randomSeed:P().int().optional().describe(`Random seed for reproducibility`)}).superRefine((e,t)=>{if(e.trainingDataRatio&&e.validationDataRatio&&e.testDataRatio){let n=e.trainingDataRatio+e.validationDataRatio+e.testDataRatio;Math.abs(n-1)>.01&&t.addIssue({code:de.custom,message:`Data split ratios must sum to 1. Current sum: ${n}`,path:[`trainingDataRatio`]})}}),hK=h({accuracy:P().optional(),precision:P().optional(),recall:P().optional(),f1Score:P().optional(),auc:P().optional().describe(`Area Under ROC Curve`),mse:P().optional().describe(`Mean Squared Error`),rmse:P().optional().describe(`Root Mean Squared Error`),mae:P().optional().describe(`Mean Absolute Error`),r2Score:P().optional().describe(`R-squared score`),silhouetteScore:P().optional(),daviesBouldinIndex:P().optional(),mape:P().optional().describe(`Mean Absolute Percentage Error`),smape:P().optional().describe(`Symmetric MAPE`),custom:d(r(),P()).optional()}),tTe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Model unique identifier (snake_case)`),label:r().describe(`Model display name`),description:r().optional(),type:dK,algorithm:r().optional().describe(`Specific algorithm (e.g., "random_forest", "xgboost", "lstm")`),objectName:r().describe(`Target object for predictions`),target:r().describe(`Target field to predict`),targetType:E([`numeric`,`categorical`,`binary`]).optional().describe(`Target field type`),features:C(fK).describe(`Input features for the model`),hyperparameters:pK.optional(),training:mK.optional(),metrics:hK.optional().describe(`Evaluation metrics from last training`),deploymentStatus:E([`draft`,`training`,`trained`,`deployed`,`deprecated`]).optional().default(`draft`),version:r().optional().default(`1.0.0`),predictionField:r().optional().describe(`Field to store predictions`),confidenceField:r().optional().describe(`Field to store confidence scores`),updateTrigger:E([`on_create`,`on_update`,`manual`,`scheduled`]).optional().default(`on_create`),autoRetrain:S().optional().default(!1),retrainSchedule:r().optional().describe(`Cron expression for auto-retraining`),retrainThreshold:P().optional().describe(`Performance threshold to trigger retraining`),enableExplainability:S().optional().default(!1).describe(`Generate feature importance & explanations`),enableMonitoring:S().optional().default(!0),alertOnDrift:S().optional().default(!0).describe(`Alert when model drift is detected`),active:S().optional().default(!0),owner:r().optional().describe(`User ID of model owner`),permissions:C(r()).optional().describe(`User/group IDs with access`),tags:C(r()).optional(),category:r().optional().describe(`Model category (e.g., "sales", "marketing", "operations")`),lastTrainedAt:r().datetime().optional().describe(`ISO timestamp`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`)}),nTe=h({modelName:r().describe(`Model to use for prediction`),recordIds:C(r()).optional().describe(`Specific records to predict (if not provided, uses all)`),inputData:d(r(),u()).optional().describe(`Direct input data (alternative to recordIds)`),returnConfidence:S().optional().default(!0),returnExplanation:S().optional().default(!1)}),rTe=h({modelName:r(),modelVersion:r(),recordId:r().optional(),prediction:u().describe(`The predicted value`),confidence:P().optional().describe(`Confidence score (0-1)`),probabilities:d(r(),P()).optional().describe(`Class probabilities (for classification)`),explanation:h({topFeatures:C(h({feature:r(),importance:P(),value:u()})).optional(),reasoning:r().optional()}).optional(),tokens:OG.optional().describe(`Token usage for this prediction (if AI-powered)`),cost:P().nonnegative().optional().describe(`Cost for this prediction in USD`),metadata:h({executionTime:P().optional().describe(`Execution time in milliseconds`),timestamp:r().datetime().optional().describe(`ISO timestamp`)}).optional()}),iTe=h({modelName:r(),driftType:E([`feature_drift`,`prediction_drift`,`performance_drift`]),severity:E([`low`,`medium`,`high`,`critical`]),detectedAt:r().datetime().describe(`ISO timestamp`),metrics:h({driftScore:P().describe(`Drift magnitude (0-1)`),affectedFeatures:C(r()).optional(),performanceChange:P().optional().describe(`Change in performance metric`)}),recommendation:r().optional(),autoRetrainTriggered:S().optional().default(!1)}),gK=E([`system`,`user`,`assistant`,`function`,`tool`]),aTe=E([`text`,`image`,`file`,`code`,`structured`]),_K=h({type:m(`text`),text:r().describe(`Text content`),metadata:d(r(),u()).optional()}),vK=h({type:m(`image`),imageUrl:r().url().describe(`Image URL`),detail:E([`low`,`high`,`auto`]).optional().default(`auto`),metadata:d(r(),u()).optional()}),yK=h({type:m(`file`),fileUrl:r().url().describe(`File attachment URL`),mimeType:r().describe(`MIME type`),fileName:r().optional(),metadata:d(r(),u()).optional()}),bK=h({type:m(`code`),text:r().describe(`Code snippet`),language:r().optional().default(`text`),metadata:d(r(),u()).optional()}),xK=l([_K,vK,yK,bK]),SK=h({name:r().describe(`Function name`),arguments:r().describe(`JSON string of function arguments`),result:r().optional().describe(`Function execution result`)}),CK=h({id:r().describe(`Tool call ID`),type:E([`function`]).default(`function`),function:SK}),wK=h({id:r().describe(`Unique message ID`),timestamp:r().datetime().describe(`ISO 8601 timestamp`),role:gK,content:C(xK).describe(`Message content (multimodal array)`),functionCall:SK.optional().describe(`Legacy function call`),toolCalls:C(CK).optional().describe(`Tool calls`),toolCallId:r().optional().describe(`Tool call ID this message responds to`),name:r().optional().describe(`Name of the function/user`),tokens:OG.optional().describe(`Token usage for this message`),cost:P().nonnegative().optional().describe(`Cost for this message in USD`),pinned:S().optional().default(!1).describe(`Prevent removal during pruning`),importance:P().min(0).max(1).optional().describe(`Importance score for pruning`),embedding:C(P()).optional().describe(`Vector embedding for semantic search`),metadata:d(r(),u()).optional()}),TK=E([`fifo`,`importance`,`semantic`,`sliding_window`,`summary`]),EK=h({maxTokens:P().int().positive().describe(`Maximum total tokens`),maxPromptTokens:P().int().positive().optional().describe(`Max tokens for prompt`),maxCompletionTokens:P().int().positive().optional().describe(`Max tokens for completion`),reserveTokens:P().int().nonnegative().default(500).describe(`Reserve tokens for system messages`),bufferPercentage:P().min(0).max(1).default(.1).describe(`Buffer percentage (0.1 = 10%)`),strategy:TK.default(`sliding_window`),slidingWindowSize:P().int().positive().optional().describe(`Number of recent messages to keep`),minImportanceScore:P().min(0).max(1).optional().describe(`Minimum importance to keep`),semanticThreshold:P().min(0).max(1).optional().describe(`Semantic similarity threshold`),enableSummarization:S().default(!1).describe(`Enable context summarization`),summarizationThreshold:P().int().positive().optional().describe(`Trigger summarization at N tokens`),summaryModel:r().optional().describe(`Model ID for summarization`),warnThreshold:P().min(0).max(1).default(.8).describe(`Warn at % of budget (0.8 = 80%)`)}),DK=h({promptTokens:P().int().nonnegative().default(0),completionTokens:P().int().nonnegative().default(0),totalTokens:P().int().nonnegative().default(0),budgetLimit:P().int().positive(),budgetUsed:P().int().nonnegative().default(0),budgetRemaining:P().int().nonnegative(),budgetPercentage:P().min(0).max(1).describe(`Usage as percentage of budget`),messageCount:P().int().nonnegative().default(0),prunedMessageCount:P().int().nonnegative().default(0),summarizedMessageCount:P().int().nonnegative().default(0)}),OK=h({sessionId:r().describe(`Conversation session ID`),userId:r().optional().describe(`User identifier`),agentId:r().optional().describe(`AI agent identifier`),object:r().optional().describe(`Related object (e.g., "case", "project")`),recordId:r().optional().describe(`Related record ID`),scope:d(r(),u()).optional().describe(`Additional context scope`),systemMessage:r().optional().describe(`System prompt/instructions`),metadata:d(r(),u()).optional()}),oTe=h({id:r().describe(`Unique session ID`),name:r().optional().describe(`Session name/title`),context:OK,modelId:r().optional().describe(`AI model ID`),tokenBudget:EK,messages:C(wK).default([]),tokens:DK.optional(),totalTokens:OG.optional().describe(`Total tokens across all messages`),totalCost:P().nonnegative().optional().describe(`Total cost for this session in USD`),status:E([`active`,`paused`,`completed`,`archived`]).default(`active`),createdAt:r().datetime().describe(`ISO 8601 timestamp`),updatedAt:r().datetime().describe(`ISO 8601 timestamp`),expiresAt:r().datetime().optional().describe(`ISO 8601 timestamp`),metadata:d(r(),u()).optional()}),sTe=h({summary:r().describe(`Conversation summary`),keyPoints:C(r()).optional().describe(`Key discussion points`),originalTokens:P().int().nonnegative().describe(`Original token count`),summaryTokens:P().int().nonnegative().describe(`Summary token count`),tokensSaved:P().int().nonnegative().describe(`Tokens saved`),messageRange:h({startIndex:P().int().nonnegative(),endIndex:P().int().nonnegative()}).describe(`Range of messages summarized`),generatedAt:r().datetime().describe(`ISO 8601 timestamp`),modelId:r().optional().describe(`Model used for summarization`)}),cTe=h({timestamp:r().datetime().describe(`Event timestamp`),prunedMessages:C(h({messageId:r(),role:gK,tokens:P().int().nonnegative(),importance:P().min(0).max(1).optional()})),tokensFreed:P().int().nonnegative(),messagesRemoved:P().int().nonnegative(),remainingTokens:P().int().nonnegative(),remainingMessages:P().int().nonnegative()}),lTe=h({sessionId:r(),totalMessages:P().int().nonnegative(),userMessages:P().int().nonnegative(),assistantMessages:P().int().nonnegative(),systemMessages:P().int().nonnegative(),totalTokens:P().int().nonnegative(),averageTokensPerMessage:P().nonnegative(),peakTokenUsage:P().int().nonnegative(),pruningEvents:P().int().nonnegative().default(0),summarizationEvents:P().int().nonnegative().default(0),tokensSavedByPruning:P().int().nonnegative().default(0),tokensSavedBySummarization:P().int().nonnegative().default(0),duration:P().nonnegative().optional().describe(`Session duration in seconds`),firstMessageAt:r().datetime().optional().describe(`ISO 8601 timestamp`),lastMessageAt:r().datetime().optional().describe(`ISO 8601 timestamp`)}),kK=h({file:r().optional(),line:P().optional(),column:P().optional(),package:r().optional(),object:r().optional(),field:r().optional(),component:r().optional()}),AK=h({id:r(),severity:E([`critical`,`error`,`warning`,`info`]),message:r(),stackTrace:r().optional(),timestamp:r().datetime(),userId:r().optional(),context:d(r(),u()).optional(),source:kK.optional()}),jK=h({issueId:r(),reasoning:r().describe(`Explanation of why this fix is needed`),confidence:P().min(0).max(1),fix:I(`type`,[h({type:m(`metadata_change`),changeSet:UR}),h({type:m(`manual_intervention`),instructions:r()})])}),uTe=h({issue:AK,analysis:r().optional().describe(`AI analysis of the root cause`),resolutions:C(jK).optional(),status:E([`open`,`analyzing`,`resolved`,`ignored`]).default(`open`)});DA({},{AckMessageSchema:()=>Dq,AddReactionRequestSchema:()=>yX,AddReactionResponseSchema:()=>bX,AiInsightsRequestSchema:()=>kDe,AiInsightsResponseSchema:()=>ADe,AiNlqRequestSchema:()=>TDe,AiNlqResponseSchema:()=>EDe,AiSuggestRequestSchema:()=>DDe,AiSuggestResponseSchema:()=>ODe,AnalyticsEndpoint:()=>ZDe,AnalyticsMetadataResponseSchema:()=>tOe,AnalyticsQueryRequestSchema:()=>QDe,AnalyticsResultResponseSchema:()=>$De,AnalyticsSqlResponseSchema:()=>nOe,ApiChangelogEntrySchema:()=>uY,ApiDiscoveryQuerySchema:()=>nY,ApiDiscoveryResponseSchema:()=>UDe,ApiDocumentationConfig:()=>JDe,ApiDocumentationConfigSchema:()=>fY,ApiEndpoint:()=>mTe,ApiEndpointRegistration:()=>WDe,ApiEndpointRegistrationSchema:()=>ZJ,ApiEndpointSchema:()=>KK,ApiErrorSchema:()=>MK,ApiMappingSchema:()=>GK,ApiMetadataSchema:()=>QJ,ApiParameterSchema:()=>YJ,ApiProtocolType:()=>KJ,ApiRegistry:()=>KDe,ApiRegistryEntry:()=>GDe,ApiRegistryEntrySchema:()=>$J,ApiRegistrySchema:()=>tY,ApiResponseSchema:()=>XJ,ApiRoutesSchema:()=>YK,ApiTestCollection:()=>YDe,ApiTestCollectionSchema:()=>lY,ApiTestRequestSchema:()=>cY,ApiTestingUiConfigSchema:()=>sY,ApiTestingUiType:()=>oY,AppDefinitionResponseSchema:()=>bOe,AuthEndpointAliases:()=>pOe,AuthEndpointPaths:()=>yY,AuthEndpointSchema:()=>fOe,AuthFeaturesConfigSchema:()=>SY,AuthProvider:()=>oOe,AuthProviderInfoSchema:()=>bY,AutomationApiContracts:()=>_ke,AutomationApiErrorCode:()=>gke,AutomationFlowPathParamsSchema:()=>uZ,AutomationRunPathParamsSchema:()=>dZ,AutomationTriggerRequestSchema:()=>KTe,AutomationTriggerResponseSchema:()=>qTe,BasePresenceSchema:()=>nq,BaseResponseSchema:()=>J,BatchApiContracts:()=>VTe,BatchConfigSchema:()=>HTe,BatchDataRequestSchema:()=>yEe,BatchDataResponseSchema:()=>bEe,BatchEndpointsConfigSchema:()=>zJ,BatchLoadingStrategySchema:()=>WK,BatchOperationResultSchema:()=>iJ,BatchOperationType:()=>$q,BatchOptionsSchema:()=>tJ,BatchRecordSchema:()=>eJ,BatchUpdateRequestSchema:()=>nJ,BatchUpdateResponseSchema:()=>aJ,BulkRequestSchema:()=>IK,BulkResponseSchema:()=>VK,CacheControlSchema:()=>cJ,CacheDirective:()=>sJ,CacheInvalidationRequestSchema:()=>pJ,CacheInvalidationResponseSchema:()=>mJ,CacheInvalidationTarget:()=>fJ,CallbackSchema:()=>HJ,ChangelogEntrySchema:()=>PX,CheckPermissionRequestSchema:()=>LEe,CheckPermissionResponseSchema:()=>REe,CodeGenerationTemplateSchema:()=>dY,CompleteChunkedUploadRequestSchema:()=>jY,CompleteChunkedUploadResponseSchema:()=>MY,CompleteUploadRequestSchema:()=>wY,ConceptListResponseSchema:()=>xOe,ConflictResolutionStrategy:()=>eY,CreateDataRequestSchema:()=>pEe,CreateDataResponseSchema:()=>mEe,CreateExportJobRequestSchema:()=>HX,CreateExportJobResponseSchema:()=>UX,CreateFeedItemRequestSchema:()=>pX,CreateFeedItemResponseSchema:()=>mX,CreateFlowRequestSchema:()=>_Z,CreateFlowResponseSchema:()=>vZ,CreateManyDataRequestSchema:()=>xEe,CreateManyDataResponseSchema:()=>SEe,CreateRequestSchema:()=>PK,CreateViewRequestSchema:()=>jEe,CreateViewResponseSchema:()=>MEe,CrudEndpointPatternSchema:()=>IJ,CrudEndpointsConfigSchema:()=>LJ,CrudOperation:()=>FJ,CursorMessageSchema:()=>Tq,CursorPositionSchema:()=>_q,DEFAULT_AI_ROUTES:()=>$Y,DEFAULT_ANALYTICS_ROUTES:()=>tX,DEFAULT_AUTOMATION_ROUTES:()=>nX,DEFAULT_BATCH_ROUTES:()=>qY,DEFAULT_DATA_CRUD_ROUTES:()=>KY,DEFAULT_DISCOVERY_ROUTES:()=>XOe,DEFAULT_DISPATCHER_ROUTES:()=>qOe,DEFAULT_I18N_ROUTES:()=>eX,DEFAULT_METADATA_ROUTES:()=>GY,DEFAULT_NOTIFICATION_ROUTES:()=>QY,DEFAULT_PERMISSION_ROUTES:()=>JY,DEFAULT_REALTIME_ROUTES:()=>ZY,DEFAULT_VERSIONING_CONFIG:()=>aOe,DEFAULT_VIEW_ROUTES:()=>YY,DEFAULT_WORKFLOW_ROUTES:()=>XY,DataEventSchema:()=>vTe,DataEventType:()=>$K,DataLoaderConfigSchema:()=>UK,DeduplicationStrategy:()=>KX,DeleteDataRequestSchema:()=>_Ee,DeleteDataResponseSchema:()=>vEe,DeleteFeedItemRequestSchema:()=>_X,DeleteFeedItemResponseSchema:()=>vX,DeleteFlowRequestSchema:()=>xZ,DeleteFlowResponseSchema:()=>SZ,DeleteManyDataRequestSchema:()=>TEe,DeleteManyDataResponseSchema:()=>EEe,DeleteManyRequestSchema:()=>oJ,DeleteResponseSchema:()=>HK,DeleteViewRequestSchema:()=>FEe,DeleteViewResponseSchema:()=>IEe,DisablePackageRequestSchema:()=>mH,DisablePackageResponseSchema:()=>hH,DiscoverySchema:()=>XK,DispatcherConfigSchema:()=>KOe,DispatcherErrorCode:()=>JOe,DispatcherErrorResponseSchema:()=>YOe,DispatcherRouteSchema:()=>PY,DocumentStateSchema:()=>STe,ETagSchema:()=>lJ,EditMessageSchema:()=>Eq,EditOperationSchema:()=>yq,EditOperationType:()=>vq,EmailPasswordConfigPublicSchema:()=>xY,EnablePackageRequestSchema:()=>fH,EnablePackageResponseSchema:()=>pH,EndpointMapping:()=>hOe,EndpointRegistrySchema:()=>zDe,EnhancedApiErrorSchema:()=>yJ,ErrorCategory:()=>hJ,ErrorHandlingConfigSchema:()=>HY,ErrorHttpStatusMap:()=>WTe,ErrorMessageSchema:()=>Oq,ErrorResponseSchema:()=>GTe,EventFilterCondition:()=>uq,EventFilterSchema:()=>dq,EventMessageSchema:()=>Cq,EventPatternSchema:()=>fq,EventSubscriptionSchema:()=>pq,ExportApiContracts:()=>lke,ExportFormat:()=>BX,ExportImportTemplateSchema:()=>ske,ExportJobProgressSchema:()=>WX,ExportJobStatus:()=>VX,ExportJobSummarySchema:()=>ZX,ExportRequestSchema:()=>dTe,FederationEntityKeySchema:()=>Gq,FederationEntitySchema:()=>Yq,FederationExternalFieldSchema:()=>Kq,FederationGatewaySchema:()=>Zq,FederationProvidesSchema:()=>Jq,FederationRequiresSchema:()=>qq,FeedApiContracts:()=>ike,FeedApiErrorCode:()=>rke,FeedItemPathParamsSchema:()=>lX,FeedListFilterType:()=>uX,FeedPathParamsSchema:()=>cX,FeedUnsubscribeRequestSchema:()=>RX,FieldErrorSchema:()=>vJ,FieldMappingEntrySchema:()=>qX,FileTypeValidationSchema:()=>_Oe,FileUploadResponseSchema:()=>EY,FilterOperator:()=>lq,FindDataRequestSchema:()=>cEe,FindDataResponseSchema:()=>lEe,FlowSummarySchema:()=>pZ,GeneratedApiDocumentationSchema:()=>qDe,GeneratedEndpointSchema:()=>GJ,GetAnalyticsMetaRequestSchema:()=>eOe,GetAuthConfigResponseSchema:()=>gOe,GetChangelogRequestSchema:()=>NX,GetChangelogResponseSchema:()=>FX,GetDataRequestSchema:()=>dEe,GetDataResponseSchema:()=>fEe,GetDiscoveryRequestSchema:()=>JTe,GetDiscoveryResponseSchema:()=>YTe,GetEffectivePermissionsRequestSchema:()=>VEe,GetEffectivePermissionsResponseSchema:()=>HEe,GetExportJobDownloadRequestSchema:()=>JX,GetExportJobDownloadResponseSchema:()=>YX,GetFeedRequestSchema:()=>dX,GetFeedResponseSchema:()=>fX,GetFieldLabelsRequestSchema:()=>FDe,GetFieldLabelsResponseSchema:()=>IDe,GetFlowRequestSchema:()=>hZ,GetFlowResponseSchema:()=>gZ,GetInstalledPackageRequestSchema:()=>PZ,GetInstalledPackageResponseSchema:()=>FZ,GetLocalesRequestSchema:()=>jDe,GetLocalesResponseSchema:()=>MDe,GetMetaItemCachedRequestSchema:()=>iEe,GetMetaItemCachedResponseSchema:()=>aEe,GetMetaItemRequestSchema:()=>eEe,GetMetaItemResponseSchema:()=>tEe,GetMetaItemsRequestSchema:()=>QTe,GetMetaItemsResponseSchema:()=>$Te,GetMetaTypesRequestSchema:()=>XTe,GetMetaTypesResponseSchema:()=>ZTe,GetNotificationPreferencesRequestSchema:()=>hDe,GetNotificationPreferencesResponseSchema:()=>gDe,GetObjectPermissionsRequestSchema:()=>zEe,GetObjectPermissionsResponseSchema:()=>BEe,GetPackageRequestSchema:()=>oH,GetPackageResponseSchema:()=>sH,GetPresenceRequestSchema:()=>lDe,GetPresenceResponseSchema:()=>uDe,GetPresignedUrlRequestSchema:()=>CY,GetRunRequestSchema:()=>kZ,GetRunResponseSchema:()=>AZ,GetTranslationsRequestSchema:()=>NDe,GetTranslationsResponseSchema:()=>PDe,GetUiViewRequestSchema:()=>oEe,GetUiViewResponseSchema:()=>sEe,GetViewRequestSchema:()=>kEe,GetViewResponseSchema:()=>AEe,GetWorkflowConfigRequestSchema:()=>UEe,GetWorkflowConfigResponseSchema:()=>WEe,GetWorkflowStateRequestSchema:()=>GEe,GetWorkflowStateResponseSchema:()=>KEe,GraphQLConfig:()=>zTe,GraphQLConfigSchema:()=>Qq,GraphQLDataLoaderConfigSchema:()=>Rq,GraphQLDirectiveConfigSchema:()=>Bq,GraphQLDirectiveLocation:()=>zq,GraphQLMutationConfigSchema:()=>Fq,GraphQLPersistedQuerySchema:()=>Wq,GraphQLQueryAdapterSchema:()=>oX,GraphQLQueryComplexitySchema:()=>Hq,GraphQLQueryConfigSchema:()=>Pq,GraphQLQueryDepthLimitSchema:()=>Vq,GraphQLRateLimitSchema:()=>Uq,GraphQLResolverConfigSchema:()=>Lq,GraphQLScalarType:()=>RTe,GraphQLSubscriptionConfigSchema:()=>Iq,GraphQLTypeConfigSchema:()=>Nq,HandlerStatusSchema:()=>IY,HttpFindQueryParamsSchema:()=>uEe,HttpMethod:()=>NA,HttpStatusCode:()=>qJ,IdRequestSchema:()=>zK,ImportValidationConfigSchema:()=>ake,ImportValidationMode:()=>GX,ImportValidationResultSchema:()=>oke,InitiateChunkedUploadRequestSchema:()=>DY,InitiateChunkedUploadResponseSchema:()=>OY,InstallPackageRequestSchema:()=>cH,InstallPackageResponseSchema:()=>lH,ListExportJobsRequestSchema:()=>XX,ListExportJobsResponseSchema:()=>QX,ListFlowsRequestSchema:()=>fZ,ListFlowsResponseSchema:()=>mZ,ListInstalledPackagesRequestSchema:()=>MZ,ListInstalledPackagesResponseSchema:()=>NZ,ListNotificationsRequestSchema:()=>yDe,ListNotificationsResponseSchema:()=>bDe,ListPackagesRequestSchema:()=>iH,ListPackagesResponseSchema:()=>aH,ListRecordResponseSchema:()=>RK,ListRunsRequestSchema:()=>DZ,ListRunsResponseSchema:()=>OZ,ListViewsRequestSchema:()=>DEe,ListViewsResponseSchema:()=>OEe,LoginRequestSchema:()=>sOe,LoginType:()=>vY,MarkAllNotificationsReadRequestSchema:()=>CDe,MarkAllNotificationsReadResponseSchema:()=>wDe,MarkNotificationsReadRequestSchema:()=>xDe,MarkNotificationsReadResponseSchema:()=>SDe,MetadataBulkRegisterRequestSchema:()=>AOe,MetadataBulkResponseSchema:()=>MOe,MetadataBulkUnregisterRequestSchema:()=>jOe,MetadataCacheApi:()=>UTe,MetadataCacheRequestSchema:()=>uJ,MetadataCacheResponseSchema:()=>dJ,MetadataDeleteResponseSchema:()=>DOe,MetadataDependenciesResponseSchema:()=>WOe,MetadataDependentsResponseSchema:()=>GOe,MetadataEffectiveResponseSchema:()=>FOe,MetadataEndpointsConfigSchema:()=>RJ,MetadataEventSchema:()=>_Te,MetadataEventType:()=>QK,MetadataExistsResponseSchema:()=>EOe,MetadataExportRequestSchema:()=>IOe,MetadataExportResponseSchema:()=>LOe,MetadataImportRequestSchema:()=>ROe,MetadataImportResponseSchema:()=>zOe,MetadataItemResponseSchema:()=>COe,MetadataListResponseSchema:()=>wOe,MetadataNamesResponseSchema:()=>TOe,MetadataOverlayResponseSchema:()=>NOe,MetadataOverlaySaveRequestSchema:()=>POe,MetadataQueryRequestSchema:()=>OOe,MetadataQueryResponseSchema:()=>kOe,MetadataRegisterRequestSchema:()=>SOe,MetadataTypeInfoResponseSchema:()=>UOe,MetadataTypesResponseSchema:()=>HOe,MetadataValidateRequestSchema:()=>BOe,MetadataValidateResponseSchema:()=>VOe,ModificationResultSchema:()=>BK,NotificationPreferencesSchema:()=>MJ,NotificationSchema:()=>NJ,OData:()=>ITe,ODataConfigSchema:()=>LTe,ODataErrorSchema:()=>FTe,ODataFilterFunctionSchema:()=>NTe,ODataFilterOperatorSchema:()=>MTe,ODataMetadataSchema:()=>Mq,ODataQueryAdapterSchema:()=>sX,ODataQuerySchema:()=>jTe,ODataResponseSchema:()=>PTe,ObjectDefinitionResponseSchema:()=>yOe,ObjectQLReferenceSchema:()=>JJ,ObjectStackProtocolSchema:()=>LDe,OpenApi31ExtensionsSchema:()=>UJ,OpenApiGenerationConfigSchema:()=>UY,OpenApiSecuritySchemeSchema:()=>iY,OpenApiServerSchema:()=>rY,OpenApiSpec:()=>XDe,OpenApiSpecSchema:()=>aY,OperatorMappingSchema:()=>iX,PackageApiContracts:()=>yke,PackageApiErrorCode:()=>vke,PackageInstallRequestSchema:()=>IZ,PackageInstallResponseSchema:()=>LZ,PackagePathParamsSchema:()=>jZ,PackageRollbackRequestSchema:()=>WZ,PackageRollbackResponseSchema:()=>GZ,PackageUpgradeRequestSchema:()=>RZ,PackageUpgradeResponseSchema:()=>zZ,PinFeedItemRequestSchema:()=>CX,PinFeedItemResponseSchema:()=>wX,PingMessageSchema:()=>kq,PongMessageSchema:()=>Aq,PresenceMessageSchema:()=>wq,PresenceStateSchema:()=>gq,PresenceStatus:()=>eq,PresenceUpdateSchema:()=>xTe,PresignedUrlResponseSchema:()=>TY,QueryAdapterConfigSchema:()=>nke,QueryAdapterTargetSchema:()=>tke,QueryOptimizationConfigSchema:()=>pTe,RealtimeConfigSchema:()=>bTe,RealtimeConnectRequestSchema:()=>$Ee,RealtimeConnectResponseSchema:()=>eDe,RealtimeDisconnectRequestSchema:()=>tDe,RealtimeDisconnectResponseSchema:()=>nDe,RealtimeEventSchema:()=>yTe,RealtimeEventType:()=>iq,RealtimePresenceSchema:()=>sq,RealtimeRecordAction:()=>tq,RealtimeSubscribeRequestSchema:()=>rDe,RealtimeSubscribeResponseSchema:()=>iDe,RealtimeUnsubscribeRequestSchema:()=>aDe,RealtimeUnsubscribeResponseSchema:()=>oDe,RecordDataSchema:()=>NK,RefreshTokenRequestSchema:()=>lOe,RegisterDeviceRequestSchema:()=>dDe,RegisterDeviceResponseSchema:()=>fDe,RegisterRequestSchema:()=>cOe,RemoveReactionRequestSchema:()=>xX,RemoveReactionResponseSchema:()=>SX,RequestValidationConfigSchema:()=>BY,ResolveDependenciesRequestSchema:()=>BZ,ResolveDependenciesResponseSchema:()=>VZ,ResponseEnvelopeConfigSchema:()=>VY,RestApiConfig:()=>BDe,RestApiConfigSchema:()=>PJ,RestApiEndpointSchema:()=>LY,RestApiPluginConfig:()=>ZOe,RestApiPluginConfigSchema:()=>WY,RestApiRouteCategory:()=>FY,RestApiRouteRegistration:()=>QOe,RestApiRouteRegistrationSchema:()=>RY,RestQueryAdapterSchema:()=>aX,RestServerConfig:()=>VDe,RestServerConfigSchema:()=>WJ,RetryStrategy:()=>_J,RouteCategory:()=>jq,RouteCoverageEntrySchema:()=>rX,RouteCoverageReportSchema:()=>eke,RouteDefinitionSchema:()=>kTe,RouteGenerationConfigSchema:()=>BJ,RouteHealthEntrySchema:()=>ZK,RouteHealthReportSchema:()=>gTe,RouterConfigSchema:()=>ATe,SaveMetaItemRequestSchema:()=>nEe,SaveMetaItemResponseSchema:()=>rEe,ScheduleExportRequestSchema:()=>$X,ScheduleExportResponseSchema:()=>eZ,ScheduledExportSchema:()=>cke,SchemaDefinition:()=>HDe,SearchFeedRequestSchema:()=>jX,SearchFeedResponseSchema:()=>MX,ServiceInfoSchema:()=>JK,ServiceStatus:()=>qK,SessionResponseSchema:()=>uOe,SessionSchema:()=>_Y,SessionUserSchema:()=>gY,SetPresenceRequestSchema:()=>sDe,SetPresenceResponseSchema:()=>cDe,SimpleCursorPositionSchema:()=>DTe,SimplePresenceStateSchema:()=>ETe,SingleRecordResponseSchema:()=>LK,StandardApiContracts:()=>fTe,StandardErrorCode:()=>gJ,StarFeedItemRequestSchema:()=>DX,StarFeedItemResponseSchema:()=>OX,StorageApiContracts:()=>vOe,SubgraphConfigSchema:()=>Xq,SubscribeMessageSchema:()=>xq,SubscribeRequestSchema:()=>IX,SubscribeResponseSchema:()=>LX,SubscriptionEventSchema:()=>aq,SubscriptionSchema:()=>oq,ToggleFlowRequestSchema:()=>TZ,ToggleFlowResponseSchema:()=>EZ,TransportProtocol:()=>rq,TriggerFlowRequestSchema:()=>CZ,TriggerFlowResponseSchema:()=>wZ,UninstallPackageApiRequestSchema:()=>KZ,UninstallPackageApiResponseSchema:()=>qZ,UninstallPackageRequestSchema:()=>uH,UninstallPackageResponseSchema:()=>dH,UnpinFeedItemRequestSchema:()=>TX,UnpinFeedItemResponseSchema:()=>EX,UnregisterDeviceRequestSchema:()=>pDe,UnregisterDeviceResponseSchema:()=>mDe,UnstarFeedItemRequestSchema:()=>kX,UnstarFeedItemResponseSchema:()=>AX,UnsubscribeMessageSchema:()=>Sq,UnsubscribeRequestSchema:()=>mq,UnsubscribeResponseSchema:()=>zX,UpdateDataRequestSchema:()=>hEe,UpdateDataResponseSchema:()=>gEe,UpdateFeedItemRequestSchema:()=>hX,UpdateFeedItemResponseSchema:()=>gX,UpdateFlowRequestSchema:()=>yZ,UpdateFlowResponseSchema:()=>bZ,UpdateManyDataRequestSchema:()=>CEe,UpdateManyDataResponseSchema:()=>wEe,UpdateManyRequestSchema:()=>rJ,UpdateNotificationPreferencesRequestSchema:()=>_De,UpdateNotificationPreferencesResponseSchema:()=>vDe,UpdateRequestSchema:()=>FK,UpdateViewRequestSchema:()=>NEe,UpdateViewResponseSchema:()=>PEe,UploadArtifactRequestSchema:()=>HZ,UploadArtifactResponseSchema:()=>UZ,UploadChunkRequestSchema:()=>kY,UploadChunkResponseSchema:()=>AY,UploadProgressSchema:()=>NY,UserProfileResponseSchema:()=>dOe,ValidationMode:()=>zY,VersionDefinitionSchema:()=>hY,VersionNegotiationResponseSchema:()=>iOe,VersionStatus:()=>mY,VersioningConfigSchema:()=>rOe,VersioningStrategy:()=>pY,WebSocketConfigSchema:()=>wTe,WebSocketEventSchema:()=>TTe,WebSocketMessageSchema:()=>CTe,WebSocketMessageType:()=>cq,WebSocketPresenceStatus:()=>hq,WebSocketServerConfigSchema:()=>OTe,WebhookConfigSchema:()=>RDe,WebhookEventSchema:()=>VJ,WellKnownCapabilitiesSchema:()=>hTe,WorkflowApproveRequestSchema:()=>YEe,WorkflowApproveResponseSchema:()=>XEe,WorkflowRejectRequestSchema:()=>ZEe,WorkflowRejectResponseSchema:()=>QEe,WorkflowStateSchema:()=>jJ,WorkflowTransitionRequestSchema:()=>qEe,WorkflowTransitionResponseSchema:()=>JEe,getAuthEndpointUrl:()=>mOe,getDefaultRouteRegistrations:()=>$Oe,mapFieldTypeToGraphQL:()=>BTe});var MK=h({code:r().describe(`Error code (e.g. validation_error)`),message:r().describe(`Readable error message`),category:r().optional().describe(`Error category (e.g. validation, authorization)`),details:u().optional().describe(`Additional error context (e.g. field validation errors)`),requestId:r().optional().describe(`Request ID for tracking`)}),J=h({success:S().describe(`Operation success status`),error:MK.optional().describe(`Error details if success is false`),meta:h({timestamp:r(),duration:P().optional(),requestId:r().optional(),traceId:r().optional()}).optional().describe(`Response metadata`)}),NK=d(r(),u()).describe(`Key-value map of record data`),PK=h({data:NK.describe(`Record data to insert`)}),FK=h({data:NK.describe(`Partial record data to update`)}),IK=h({records:C(NK).describe(`Array of records to process`),allOrNone:S().default(!0).describe(`If true, rollback entire transaction on any failure`)}),dTe=v(Lj,h({format:E([`csv`,`json`,`xlsx`]).default(`csv`)})),LK=J.extend({data:NK.describe(`The requested or modified record`)}),RK=J.extend({data:C(NK).describe(`Array of matching records`),pagination:h({total:P().optional().describe(`Total matching records count`),limit:P().optional().describe(`Page size`),offset:P().optional().describe(`Page offset`),cursor:r().optional().describe(`Cursor for next page`),nextCursor:r().optional().describe(`Next cursor for pagination`),hasMore:S().describe(`Are there more pages?`)}).describe(`Pagination info`)}),zK=h({id:r().describe(`Record ID`)}),BK=h({id:r().optional().describe(`Record ID if processed`),success:S(),errors:C(MK).optional(),index:P().optional().describe(`Index in original request`),data:u().optional().describe(`Result data (e.g. created record)`)}),VK=J.extend({data:C(BK).describe(`Results for each item in the batch`)}),HK=J.extend({id:r().describe(`ID of the deleted record`)}),fTe={create:{input:PK,output:LK},delete:{input:zK,output:HK},get:{input:zK,output:LK},update:{input:FK,output:LK},list:{input:Lj,output:RK},bulkCreate:{input:IK,output:VK},bulkUpdate:{input:IK,output:VK},bulkUpsert:{input:IK,output:VK},bulkDelete:{input:h({ids:C(r())}),output:VK}},UK=h({maxBatchSize:P().int().default(100).describe(`Maximum number of keys per batch load`),batchScheduleFn:E([`microtask`,`timeout`,`manual`]).default(`microtask`).describe(`Scheduling strategy for collecting batch keys`),cacheEnabled:S().default(!0).describe(`Enable per-request result caching`),cacheKeyFn:r().optional().describe(`Name or identifier of the cache key function`),cacheTtl:P().min(0).optional().describe(`Cache time-to-live in seconds (0 = no expiration)`),coalesceRequests:S().default(!0).describe(`Deduplicate identical requests within a batch window`),maxConcurrency:P().int().optional().describe(`Maximum parallel batch requests`)}),WK=h({strategy:E([`dataloader`,`windowed`,`prefetch`]).describe(`Batch loading strategy type`),windowMs:P().optional().describe(`Collection window duration in milliseconds (for windowed strategy)`),prefetchDepth:P().int().optional().describe(`Depth of relation prefetching (for prefetch strategy)`),associationLoading:E([`lazy`,`eager`,`batch`]).default(`batch`).describe(`How to load related associations`)}),pTe=h({preventNPlusOne:S().describe(`Enable N+1 query detection and prevention`),dataLoader:UK.optional().describe(`DataLoader batch loading configuration`),batchStrategy:WK.optional().describe(`Batch loading strategy configuration`),maxQueryDepth:P().int().describe(`Maximum depth for nested relation queries`),queryComplexityLimit:P().optional().describe(`Maximum allowed query complexity score`),enableQueryPlan:S().default(!1).describe(`Log query execution plans for debugging`)}),GK=h({source:r().describe(`Source field/path`),target:r().describe(`Target field/path`),transform:r().optional().describe(`Transformation function name`)}),KK=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique endpoint ID`),path:r().regex(/^\//).describe(`URL Path (e.g. /api/v1/customers)`),method:NA.describe(`HTTP Method`),summary:r().optional(),description:r().optional(),type:E([`flow`,`script`,`object_operation`,`proxy`]).describe(`Implementation type`),target:r().describe(`Target Flow ID, Script Name, or Proxy URL`),objectParams:h({object:r().optional(),operation:E([`find`,`get`,`create`,`update`,`delete`]).optional()}).optional().describe(`For object_operation type`),inputMapping:C(GK).optional().describe(`Map Request Body to Internal Params`),outputMapping:C(GK).optional().describe(`Map Internal Result to Response Body`),authRequired:S().default(!0).describe(`Require authentication`),rateLimit:LA.optional().describe(`Rate limiting policy`),cacheTtl:P().optional().describe(`Response cache TTL in seconds`)}),mTe=Object.assign(KK,{create:e=>e}),qK=E([`available`,`registered`,`unavailable`,`degraded`,`stub`]).describe(`available = fully operational, registered = route declared but handler unverified, unavailable = not installed, degraded = partial, stub = placeholder that returns 501`),JK=h({enabled:S(),status:qK,handlerReady:S().optional().describe(`Whether the HTTP handler is confirmed to be mounted. Omitted = readiness unknown/unverified; true = handler mounted; false = handler missing or stub (likely 501).`),route:r().optional().describe(`e.g. /api/v1/analytics`),provider:r().optional().describe(`e.g. "objectql", "plugin-redis", "driver-memory"`),version:r().optional().describe(`Semantic version of the service implementation (e.g. "3.0.6")`),message:r().optional().describe(`e.g. "Install plugin-workflow to enable"`),rateLimit:h({requestsPerMinute:P().int().optional().describe(`Maximum requests per minute`),requestsPerHour:P().int().optional().describe(`Maximum requests per hour`),burstLimit:P().int().optional().describe(`Maximum burst request count`),retryAfterMs:P().int().optional().describe(`Suggested retry-after delay in milliseconds when rate-limited`)}).optional().describe(`Rate limit and quota info for this service`)}),YK=h({data:r().describe(`e.g. /api/v1/data`),metadata:r().describe(`e.g. /api/v1/meta`),discovery:r().optional().describe(`e.g. /api/v1/discovery`),ui:r().optional().describe(`e.g. /api/v1/ui`),auth:r().optional().describe(`e.g. /api/v1/auth`),automation:r().optional().describe(`e.g. /api/v1/automation`),storage:r().optional().describe(`e.g. /api/v1/storage`),analytics:r().optional().describe(`e.g. /api/v1/analytics`),graphql:r().optional().describe(`e.g. /graphql`),packages:r().optional().describe(`e.g. /api/v1/packages`),workflow:r().optional().describe(`e.g. /api/v1/workflow`),realtime:r().optional().describe(`e.g. /api/v1/realtime`),notifications:r().optional().describe(`e.g. /api/v1/notifications`),ai:r().optional().describe(`e.g. /api/v1/ai`),i18n:r().optional().describe(`e.g. /api/v1/i18n`),feed:r().optional().describe(`e.g. /api/v1/feed`)}),XK=h({name:r(),version:r(),environment:E([`production`,`sandbox`,`development`]),routes:YK,locale:h({default:r(),supported:C(r()),timezone:r()}),services:d(r(),JK).describe(`Per-service availability map keyed by CoreServiceName`),capabilities:d(r(),h({enabled:S().describe(`Whether this capability is available`),features:d(r(),S()).optional().describe(`Sub-feature flags within this capability`),description:r().optional().describe(`Human-readable capability description`)})).optional().describe(`Hierarchical capability descriptors for frontend intelligent adaptation`),schemaDiscovery:h({openapi:r().optional().describe(`URL to OpenAPI (Swagger) specification (e.g., "/api/v1/openapi.json")`),graphql:r().optional().describe(`URL to GraphQL schema endpoint (e.g., "/graphql")`),jsonSchema:r().optional().describe(`URL to JSON Schema definitions`)}).optional().describe(`Schema discovery endpoints for API toolchain integration`),metadata:d(r(),u()).optional().describe(`Custom metadata key-value pairs for extensibility`)}),hTe=h({feed:S().describe(`Whether the backend supports Feed / Chatter API`),comments:S().describe(`Whether the backend supports comments (a subset of Feed)`),automation:S().describe(`Whether the backend supports Automation CRUD (flows, triggers)`),cron:S().describe(`Whether the backend supports cron scheduling`),search:S().describe(`Whether the backend supports full-text search`),export:S().describe(`Whether the backend supports async export`),chunkedUpload:S().describe(`Whether the backend supports chunked (multipart) uploads`)}).describe(`Well-known capability flags for frontend intelligent adaptation`),ZK=h({route:r().describe(`Route path pattern`),method:NA.describe(`HTTP method (GET, POST, etc.)`),service:r().describe(`Target service name`),declared:S().describe(`Whether the route is declared in discovery/metadata`),handlerRegistered:S().describe(`Whether the HTTP handler is registered`),healthStatus:E([`pass`,`fail`,`missing`,`skip`]).describe(`pass = handler responds, fail = 501/503, missing = no handler (404), skip = not checked`),message:r().optional().describe(`Diagnostic message`)}),gTe=h({timestamp:r().describe(`ISO 8601 timestamp of report generation`),adapter:r().describe(`Adapter or runtime that produced this report`),totalDeclared:P().int().describe(`Total routes declared in discovery`),totalRegistered:P().int().describe(`Routes with confirmed handler`),totalMissing:P().int().describe(`Routes missing a handler`),routes:C(ZK).describe(`Per-route health entries`)}),QK=E(`metadata.object.created,metadata.object.updated,metadata.object.deleted,metadata.field.created,metadata.field.updated,metadata.field.deleted,metadata.view.created,metadata.view.updated,metadata.view.deleted,metadata.app.created,metadata.app.updated,metadata.app.deleted,metadata.agent.created,metadata.agent.updated,metadata.agent.deleted,metadata.tool.created,metadata.tool.updated,metadata.tool.deleted,metadata.flow.created,metadata.flow.updated,metadata.flow.deleted,metadata.action.created,metadata.action.updated,metadata.action.deleted,metadata.workflow.created,metadata.workflow.updated,metadata.workflow.deleted,metadata.dashboard.created,metadata.dashboard.updated,metadata.dashboard.deleted,metadata.report.created,metadata.report.updated,metadata.report.deleted,metadata.role.created,metadata.role.updated,metadata.role.deleted,metadata.permission.created,metadata.permission.updated,metadata.permission.deleted`.split(`,`)),$K=E([`data.record.created`,`data.record.updated`,`data.record.deleted`,`data.field.changed`]),_Te=h({id:r().uuid().describe(`Unique event identifier`),type:QK.describe(`Event type`),metadataType:r().describe(`Metadata type (object, view, agent, etc.)`),name:r().describe(`Metadata item name`),packageId:r().optional().describe(`Package ID`),definition:u().optional().describe(`Full definition (create/update only)`),userId:r().optional().describe(`User who triggered the event`),timestamp:r().datetime().describe(`Event timestamp`)}),vTe=h({id:r().uuid().describe(`Unique event identifier`),type:$K.describe(`Event type`),object:r().describe(`Object name`),recordId:r().describe(`Record ID`),changes:d(r(),u()).optional().describe(`Changed fields`),before:d(r(),u()).optional().describe(`Before state`),after:d(r(),u()).optional().describe(`After state`),userId:r().optional().describe(`User who triggered the event`),timestamp:r().datetime().describe(`Event timestamp`)}),eq=E([`online`,`away`,`busy`,`offline`]),tq=E([`created`,`updated`,`deleted`]),nq=h({userId:r().describe(`User identifier`),status:eq.describe(`Current presence status`),lastSeen:r().datetime().describe(`ISO 8601 datetime of last activity`),metadata:d(r(),u()).optional().describe(`Custom presence data (e.g., current page, custom status)`)}),rq=E([`websocket`,`sse`,`polling`]),iq=E([`record.created`,`record.updated`,`record.deleted`,`field.changed`]),aq=h({type:iq.describe(`Type of event to subscribe to`),object:r().optional().describe(`Object name to subscribe to`),filters:u().optional().describe(`Filter conditions`)}),oq=h({id:r().uuid().describe(`Unique subscription identifier`),events:C(aq).describe(`Array of events to subscribe to`),transport:rq.describe(`Transport protocol to use`),channel:r().optional().describe(`Optional channel name for grouping subscriptions`)}),sq=nq,yTe=h({id:r().uuid().describe(`Unique event identifier`),type:r().describe(`Event type (e.g., record.created, record.updated)`),object:r().optional().describe(`Object name the event relates to`),action:tq.optional().describe(`Action performed`),payload:d(r(),u()).describe(`Event payload data`),timestamp:r().datetime().describe(`ISO 8601 datetime when event occurred`),userId:r().optional().describe(`User who triggered the event`),sessionId:r().optional().describe(`Session identifier`)}),bTe=h({enabled:S().default(!0).describe(`Enable realtime synchronization`),transport:rq.default(`websocket`).describe(`Transport protocol`),subscriptions:C(oq).optional().describe(`Default subscriptions`)}).passthrough(),cq=E([`subscribe`,`unsubscribe`,`event`,`ping`,`pong`,`ack`,`error`,`presence`,`cursor`,`edit`]),lq=E([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`,`contains`,`startsWith`,`endsWith`,`exists`,`regex`]),uq=h({field:r().describe(`Field path to filter on (supports dot notation, e.g., "user.email")`),operator:lq.describe(`Comparison operator`),value:u().optional().describe(`Value to compare against (not needed for "exists" operator)`)}),dq=h({conditions:C(uq).optional().describe(`Array of filter conditions`),and:F(()=>C(dq)).optional().describe(`AND logical combination of filters`),or:F(()=>C(dq)).optional().describe(`OR logical combination of filters`),not:F(()=>dq).optional().describe(`NOT logical negation of filter`)}),fq=r().min(1).regex(/^[a-z*][a-z0-9_.*]*$/,{message:`Event pattern must be lowercase and may contain letters, numbers, underscores, dots, or wildcards (e.g., "record.*", "*.created", "user.login")`}).describe(`Event pattern (supports wildcards like "record.*" or "*.created")`),pq=h({subscriptionId:r().uuid().describe(`Unique subscription identifier`),events:C(fq).describe(`Event patterns to subscribe to (supports wildcards, e.g., "record.*", "user.created")`),objects:C(r()).optional().describe(`Object names to filter events by (e.g., ["account", "contact"])`),filters:dq.optional().describe(`Advanced filter conditions for event payloads`),channels:C(r()).optional().describe(`Channel names for scoped subscriptions`)}),mq=h({subscriptionId:r().uuid().describe(`Subscription ID to unsubscribe from`)}),hq=eq,gq=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Unique session identifier`),status:hq.describe(`Current presence status`),lastSeen:r().datetime().describe(`ISO 8601 datetime of last activity`),currentLocation:r().optional().describe(`Current page/route user is viewing`),device:E([`desktop`,`mobile`,`tablet`,`other`]).optional().describe(`Device type`),customStatus:r().optional().describe(`Custom user status message`),metadata:d(r(),u()).optional().describe(`Additional custom presence data`)}),xTe=h({status:hq.optional().describe(`Updated presence status`),currentLocation:r().optional().describe(`Updated current location`),customStatus:r().optional().describe(`Updated custom status message`),metadata:d(r(),u()).optional().describe(`Updated metadata`)}),_q=h({userId:r().describe(`User identifier`),sessionId:r().uuid().describe(`Session identifier`),documentId:r().describe(`Document identifier being edited`),position:h({line:P().int().nonnegative().describe(`Line number (0-indexed)`),column:P().int().nonnegative().describe(`Column number (0-indexed)`)}).optional().describe(`Cursor position in document`),selection:h({start:h({line:P().int().nonnegative(),column:P().int().nonnegative()}),end:h({line:P().int().nonnegative(),column:P().int().nonnegative()})}).optional().describe(`Selection range (if text is selected)`),color:r().optional().describe(`Cursor color for visual representation`),userName:r().optional().describe(`Display name of user`),lastUpdate:r().datetime().describe(`ISO 8601 datetime of last cursor update`)}),vq=E([`insert`,`delete`,`replace`]),yq=h({operationId:r().uuid().describe(`Unique operation identifier`),documentId:r().describe(`Document identifier`),userId:r().describe(`User who performed the edit`),sessionId:r().uuid().describe(`Session identifier`),type:vq.describe(`Type of edit operation`),position:h({line:P().int().nonnegative().describe(`Line number (0-indexed)`),column:P().int().nonnegative().describe(`Column number (0-indexed)`)}).describe(`Starting position of the operation`),endPosition:h({line:P().int().nonnegative(),column:P().int().nonnegative()}).optional().describe(`Ending position (for delete/replace operations)`),content:r().optional().describe(`Content to insert/replace`),version:P().int().nonnegative().describe(`Document version before this operation`),timestamp:r().datetime().describe(`ISO 8601 datetime when operation was created`),baseOperationId:r().uuid().optional().describe(`Previous operation ID this builds upon (for OT)`)}),STe=h({documentId:r().describe(`Document identifier`),version:P().int().nonnegative().describe(`Current document version`),content:r().describe(`Current document content`),lastModified:r().datetime().describe(`ISO 8601 datetime of last modification`),activeSessions:C(r().uuid()).describe(`Active editing session IDs`),checksum:r().optional().describe(`Content checksum for integrity verification`)}),bq=h({messageId:r().uuid().describe(`Unique message identifier`),type:cq.describe(`Message type`),timestamp:r().datetime().describe(`ISO 8601 datetime when message was sent`)}),xq=bq.extend({type:m(`subscribe`),subscription:pq.describe(`Subscription configuration`)}),Sq=bq.extend({type:m(`unsubscribe`),request:mq.describe(`Unsubscribe request`)}),Cq=bq.extend({type:m(`event`),subscriptionId:r().uuid().describe(`Subscription ID this event belongs to`),eventName:AA.describe(`Event name`),object:r().optional().describe(`Object name the event relates to`),payload:u().describe(`Event payload data`),userId:r().optional().describe(`User who triggered the event`)}),wq=bq.extend({type:m(`presence`),presence:gq.describe(`Presence state`)}),Tq=bq.extend({type:m(`cursor`),cursor:_q.describe(`Cursor position`)}),Eq=bq.extend({type:m(`edit`),operation:yq.describe(`Edit operation`)}),Dq=bq.extend({type:m(`ack`),ackMessageId:r().uuid().describe(`ID of the message being acknowledged`),success:S().describe(`Whether the operation was successful`),error:r().optional().describe(`Error message if operation failed`)}),Oq=bq.extend({type:m(`error`),code:r().describe(`Error code`),message:r().describe(`Error message`),details:u().optional().describe(`Additional error details`)}),kq=bq.extend({type:m(`ping`)}),Aq=bq.extend({type:m(`pong`),pingMessageId:r().uuid().optional().describe(`ID of ping message being responded to`)}),CTe=I(`type`,[xq,Sq,Cq,wq,Tq,Eq,Dq,Oq,kq,Aq]),wTe=h({url:r().url().describe(`WebSocket server URL`),protocols:C(r()).optional().describe(`WebSocket sub-protocols`),reconnect:S().optional().default(!0).describe(`Enable automatic reconnection`),reconnectInterval:P().int().positive().optional().default(1e3).describe(`Reconnection interval in milliseconds`),maxReconnectAttempts:P().int().positive().optional().default(5).describe(`Maximum reconnection attempts`),pingInterval:P().int().positive().optional().default(3e4).describe(`Ping interval in milliseconds`),timeout:P().int().positive().optional().default(5e3).describe(`Message timeout in milliseconds`),headers:d(r(),r()).optional().describe(`Custom headers for WebSocket handshake`)}),TTe=h({type:E([`subscribe`,`unsubscribe`,`data-change`,`presence-update`,`cursor-update`,`error`]).describe(`Event type`),channel:r().describe(`Channel identifier (e.g., "record.account.123", "user.456")`),payload:u().describe(`Event payload data`),timestamp:P().describe(`Unix timestamp in milliseconds`)}),ETe=h({userId:r().describe(`User identifier`),userName:r().describe(`User display name`),status:E([`online`,`away`,`offline`]).describe(`User presence status`),lastSeen:P().describe(`Unix timestamp of last activity in milliseconds`),metadata:d(r(),u()).optional().describe(`Additional presence metadata (e.g., current page, custom status)`)}),DTe=h({userId:r().describe(`User identifier`),recordId:r().describe(`Record identifier being edited`),fieldName:r().describe(`Field name being edited`),position:P().describe(`Cursor position (character offset from start)`),selection:h({start:P().describe(`Selection start position`),end:P().describe(`Selection end position`)}).optional().describe(`Text selection range (if text is selected)`)}),OTe=h({enabled:S().default(!1).describe(`Enable WebSocket server`),path:r().default(`/ws`).describe(`WebSocket endpoint path`),heartbeatInterval:P().default(3e4).describe(`Heartbeat interval in milliseconds`),reconnectAttempts:P().default(5).describe(`Maximum reconnection attempts for clients`),presence:S().default(!1).describe(`Enable presence tracking`),cursorSharing:S().default(!1).describe(`Enable collaborative cursor sharing`)}),jq=E([`system`,`api`,`auth`,`static`,`webhook`,`plugin`]),kTe=h({method:NA,path:r().describe(`URL Path pattern`),category:jq.default(`api`),handler:r().describe(`Unique handler identifier`),summary:r().optional().describe(`OpenAPI summary`),description:r().optional().describe(`OpenAPI description`),public:S().default(!1).describe(`Is publicly accessible`),permissions:C(r()).optional().describe(`Required permissions`),timeout:P().int().optional().describe(`Execution timeout in ms`),rateLimit:r().optional().describe(`Rate limit policy name`)}),ATe=h({basePath:r().default(`/api`).describe(`Global API prefix`),mounts:h({data:r().default(`/data`).describe(`Data Protocol (CRUD)`),metadata:r().default(`/meta`).describe(`Metadata Protocol (Schemas)`),auth:r().default(`/auth`).describe(`Auth Protocol`),automation:r().default(`/automation`).describe(`Automation Protocol`),storage:r().default(`/storage`).describe(`Storage Protocol`),analytics:r().default(`/analytics`).describe(`Analytics Protocol`),graphql:r().default(`/graphql`).describe(`GraphQL Endpoint`),ui:r().default(`/ui`).describe(`UI Metadata Protocol (Views, Layouts)`),workflow:r().default(`/workflow`).describe(`Workflow Engine Protocol`),realtime:r().default(`/realtime`).describe(`Realtime/WebSocket Protocol`),notifications:r().default(`/notifications`).describe(`Notification Protocol`),ai:r().default(`/ai`).describe(`AI Engine Protocol (NLQ, Chat, Suggest)`),i18n:r().default(`/i18n`).describe(`Internationalization Protocol`),packages:r().default(`/packages`).describe(`Package Management Protocol`)}).default({data:`/data`,metadata:`/meta`,auth:`/auth`,automation:`/automation`,storage:`/storage`,analytics:`/analytics`,graphql:`/graphql`,ui:`/ui`,workflow:`/workflow`,realtime:`/realtime`,notifications:`/notifications`,ai:`/ai`,i18n:`/i18n`,packages:`/packages`}),cors:IA.optional(),staticMounts:C(RA).optional()}),jTe=h({$select:l([r(),C(r())]).optional().describe(`Fields to select`),$filter:r().optional().describe(`Filter expression (OData filter syntax)`),$orderby:l([r(),C(r())]).optional().describe(`Sort order`),$top:P().int().min(0).optional().describe(`Max results to return`),$skip:P().int().min(0).optional().describe(`Results to skip`),$expand:l([r(),C(r())]).optional().describe(`Navigation properties to expand (lookup/master_detail fields)`),$count:S().optional().describe(`Include total count`),$search:r().optional().describe(`Search expression`),$format:E([`json`,`xml`,`atom`]).optional().describe(`Response format`),$apply:r().optional().describe(`Aggregation expression`)}),MTe=E([`eq`,`ne`,`lt`,`le`,`gt`,`ge`,`and`,`or`,`not`,`(`,`)`,`in`,`has`]),NTe=E(`contains.startswith.endswith.length.indexof.substring.tolower.toupper.trim.concat.year.month.day.hour.minute.second.date.time.now.maxdatetime.mindatetime.round.floor.ceiling.cast.isof.any.all`.split(`.`)),PTe=h({"@odata.context":r().url().optional().describe(`Metadata context URL`),"@odata.count":P().int().optional().describe(`Total results count`),"@odata.nextLink":r().url().optional().describe(`Next page URL`),value:C(d(r(),u())).describe(`Results array`)}),FTe=h({error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),target:r().optional().describe(`Error target`),details:C(h({code:r(),message:r(),target:r().optional()})).optional().describe(`Error details`),innererror:d(r(),u()).optional().describe(`Inner error details`)})}),Mq=h({namespace:r().describe(`Service namespace`),entityTypes:C(h({name:r().describe(`Entity type name`),key:C(r()).describe(`Key fields`),properties:C(h({name:r(),type:r().describe(`OData type (Edm.String, Edm.Int32, etc.)`),nullable:S().default(!0)})),navigationProperties:C(h({name:r(),type:r(),partner:r().optional()})).optional()})).describe(`Entity types`),entitySets:C(h({name:r().describe(`Entity set name`),entityType:r().describe(`Entity type`)})).describe(`Entity sets`)}),ITe={buildUrl:(e,t)=>{let n=new URLSearchParams;t.$select&&n.append(`$select`,Array.isArray(t.$select)?t.$select.join(`,`):t.$select),t.$filter&&n.append(`$filter`,t.$filter),t.$orderby&&n.append(`$orderby`,Array.isArray(t.$orderby)?t.$orderby.join(`,`):t.$orderby),t.$top!==void 0&&n.append(`$top`,t.$top.toString()),t.$skip!==void 0&&n.append(`$skip`,t.$skip.toString()),t.$expand&&n.append(`$expand`,Array.isArray(t.$expand)?t.$expand.join(`,`):t.$expand),t.$count!==void 0&&n.append(`$count`,t.$count.toString()),t.$search&&n.append(`$search`,t.$search),t.$format&&n.append(`$format`,t.$format),t.$apply&&n.append(`$apply`,t.$apply);let r=n.toString();return r?`${e}?${r}`:e},filter:{eq:(e,t)=>`${e} eq ${typeof t==`string`?`'${t}'`:t}`,ne:(e,t)=>`${e} ne ${typeof t==`string`?`'${t}'`:t}`,gt:(e,t)=>`${e} gt ${t}`,lt:(e,t)=>`${e} lt ${t}`,contains:(e,t)=>`contains(${e}, '${t}')`,and:(...e)=>e.join(` and `),or:(...e)=>e.join(` or `)}},LTe=h({enabled:S().default(!0).describe(`Enable OData API`),path:r().default(`/odata`).describe(`OData endpoint path`),metadata:Mq.optional().describe(`OData metadata configuration`)}).passthrough(),RTe=E([`ID`,`String`,`Int`,`Float`,`Boolean`,`DateTime`,`Date`,`Time`,`JSON`,`JSONObject`,`Upload`,`URL`,`Email`,`PhoneNumber`,`Currency`,`Decimal`,`BigInt`,`Long`,`UUID`,`Base64`,`Void`]),Nq=h({name:r().describe(`GraphQL type name (PascalCase recommended)`),object:r().describe(`Source ObjectQL object name`),description:r().optional().describe(`Type description`),fields:h({include:C(r()).optional().describe(`Fields to include`),exclude:C(r()).optional().describe(`Fields to exclude (e.g., sensitive fields)`),mappings:d(r(),h({graphqlName:r().optional().describe(`Custom GraphQL field name`),graphqlType:r().optional().describe(`Override GraphQL type`),description:r().optional().describe(`Field description`),deprecationReason:r().optional().describe(`Why field is deprecated`),nullable:S().optional().describe(`Override nullable`)})).optional().describe(`Field-level customizations`)}).optional().describe(`Field configuration`),interfaces:C(r()).optional().describe(`GraphQL interface names`),isInterface:S().optional().default(!1).describe(`Define as GraphQL interface`),directives:C(h({name:r().describe(`Directive name`),args:d(r(),u()).optional().describe(`Directive arguments`)})).optional().describe(`GraphQL directives`)}),Pq=h({name:r().describe(`Query field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),type:E([`get`,`list`,`search`]).describe(`Query type`),description:r().optional().describe(`Query description`),args:d(r(),h({type:r().describe(`GraphQL type (e.g., "ID!", "String", "Int")`),description:r().optional().describe(`Argument description`),defaultValue:u().optional().describe(`Default value`)})).optional().describe(`Query arguments`),filtering:h({enabled:S().default(!0).describe(`Allow filtering`),fields:C(r()).optional().describe(`Filterable fields`),operators:C(E([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`notIn`,`contains`,`startsWith`,`endsWith`,`isNull`,`isNotNull`])).optional().describe(`Allowed filter operators`)}).optional().describe(`Filtering capabilities`),sorting:h({enabled:S().default(!0).describe(`Allow sorting`),fields:C(r()).optional().describe(`Sortable fields`),defaultSort:h({field:r(),direction:E([`ASC`,`DESC`])}).optional().describe(`Default sort order`)}).optional().describe(`Sorting capabilities`),pagination:h({enabled:S().default(!0).describe(`Enable pagination`),type:E([`offset`,`cursor`,`relay`]).default(`offset`).describe(`Pagination style`),defaultLimit:P().int().min(1).default(20).describe(`Default page size`),maxLimit:P().int().min(1).default(100).describe(`Maximum page size`),cursors:h({field:r().default(`id`).describe(`Field to use for cursor pagination`)}).optional()}).optional().describe(`Pagination configuration`),fields:h({required:C(r()).optional().describe(`Required fields (always returned)`),selectable:C(r()).optional().describe(`Selectable fields`)}).optional().describe(`Field selection configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),cache:h({enabled:S().default(!1).describe(`Enable caching`),ttl:P().int().min(0).optional().describe(`Cache TTL in seconds`),key:r().optional().describe(`Cache key template`)}).optional().describe(`Query caching`)}),Fq=h({name:r().describe(`Mutation field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),type:E([`create`,`update`,`delete`,`upsert`,`custom`]).describe(`Mutation type`),description:r().optional().describe(`Mutation description`),input:h({typeName:r().optional().describe(`Custom input type name`),fields:h({include:C(r()).optional().describe(`Fields to include`),exclude:C(r()).optional().describe(`Fields to exclude`),required:C(r()).optional().describe(`Required input fields`)}).optional().describe(`Input field configuration`),validation:h({enabled:S().default(!0).describe(`Enable input validation`),rules:C(r()).optional().describe(`Custom validation rules`)}).optional().describe(`Input validation`)}).optional().describe(`Input configuration`),output:h({type:E([`object`,`payload`,`boolean`,`custom`]).default(`object`).describe(`Output type`),includeEnvelope:S().optional().default(!1).describe(`Wrap in success/error payload`),customType:r().optional().describe(`Custom output type name`)}).optional().describe(`Output configuration`),transaction:h({enabled:S().default(!0).describe(`Use database transaction`),isolationLevel:E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`]).optional().describe(`Transaction isolation level`)}).optional().describe(`Transaction configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),hooks:h({before:C(r()).optional().describe(`Pre-mutation hooks`),after:C(r()).optional().describe(`Post-mutation hooks`)}).optional().describe(`Lifecycle hooks`)}),Iq=h({name:r().describe(`Subscription field name (camelCase recommended)`),object:r().describe(`Source ObjectQL object name`),events:C(E([`created`,`updated`,`deleted`,`custom`])).describe(`Events to subscribe to`),description:r().optional().describe(`Subscription description`),filter:h({enabled:S().default(!0).describe(`Allow filtering subscriptions`),fields:C(r()).optional().describe(`Filterable fields`)}).optional().describe(`Subscription filtering`),payload:h({includeEntity:S().default(!0).describe(`Include entity in payload`),includePreviousValues:S().optional().default(!1).describe(`Include previous field values`),includeMeta:S().optional().default(!0).describe(`Include metadata (timestamp, user, etc.)`)}).optional().describe(`Payload configuration`),authRequired:S().default(!0).describe(`Require authentication`),permissions:C(r()).optional().describe(`Required permissions`),rateLimit:h({enabled:S().default(!0).describe(`Enable rate limiting`),maxSubscriptionsPerUser:P().int().min(1).default(10).describe(`Max concurrent subscriptions per user`),throttleMs:P().int().min(0).optional().describe(`Throttle interval in milliseconds`)}).optional().describe(`Subscription rate limiting`)}),Lq=h({path:r().describe(`Resolver path (Type.field)`),type:E([`datasource`,`computed`,`script`,`proxy`]).describe(`Resolver implementation type`),implementation:h({datasource:r().optional().describe(`Datasource ID`),query:r().optional().describe(`Query/SQL to execute`),expression:r().optional().describe(`Computation expression`),dependencies:C(r()).optional().describe(`Dependent fields`),script:r().optional().describe(`Script ID or inline code`),url:r().optional().describe(`Proxy URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`]).optional().describe(`HTTP method`)}).optional().describe(`Implementation configuration`),cache:h({enabled:S().default(!1).describe(`Enable resolver caching`),ttl:P().int().min(0).optional().describe(`Cache TTL in seconds`),keyArgs:C(r()).optional().describe(`Arguments to include in cache key`)}).optional().describe(`Resolver caching`)}),Rq=h({name:r().describe(`DataLoader name`),source:r().describe(`Source object or datasource`),batchFunction:h({type:E([`findByIds`,`query`,`script`,`custom`]).describe(`Batch function type`),keyField:r().optional().describe(`Field to batch on (e.g., "id")`),query:r().optional().describe(`Query template`),script:r().optional().describe(`Script ID`),maxBatchSize:P().int().min(1).optional().default(100).describe(`Maximum batch size`)}).describe(`Batch function configuration`),cache:h({enabled:S().default(!0).describe(`Enable per-request caching`),keyFn:r().optional().describe(`Custom cache key function`)}).optional().describe(`DataLoader caching`),options:h({batch:S().default(!0).describe(`Enable batching`),cache:S().default(!0).describe(`Enable caching`),maxCacheSize:P().int().min(0).optional().describe(`Max cache entries`)}).optional().describe(`DataLoader options`)}),zq=E([`QUERY`,`MUTATION`,`SUBSCRIPTION`,`FIELD`,`FRAGMENT_DEFINITION`,`FRAGMENT_SPREAD`,`INLINE_FRAGMENT`,`VARIABLE_DEFINITION`,`SCHEMA`,`SCALAR`,`OBJECT`,`FIELD_DEFINITION`,`ARGUMENT_DEFINITION`,`INTERFACE`,`UNION`,`ENUM`,`ENUM_VALUE`,`INPUT_OBJECT`,`INPUT_FIELD_DEFINITION`]),Bq=h({name:r().regex(/^[a-z][a-zA-Z0-9]*$/).describe(`Directive name (camelCase)`),description:r().optional().describe(`Directive description`),locations:C(zq).describe(`Directive locations`),args:d(r(),h({type:r().describe(`Argument type`),description:r().optional().describe(`Argument description`),defaultValue:u().optional().describe(`Default value`)})).optional().describe(`Directive arguments`),repeatable:S().optional().default(!1).describe(`Can be applied multiple times`),implementation:h({type:E([`auth`,`validation`,`transform`,`cache`,`deprecation`,`custom`]).describe(`Directive type`),handler:r().optional().describe(`Handler function name or script`)}).optional().describe(`Directive implementation`)}),Vq=h({enabled:S().default(!0).describe(`Enable query depth limiting`),maxDepth:P().int().min(1).default(10).describe(`Maximum query depth`),ignoreFields:C(r()).optional().describe(`Fields excluded from depth calculation`),onDepthExceeded:E([`reject`,`log`,`warn`]).default(`reject`).describe(`Action when depth exceeded`),errorMessage:r().optional().describe(`Custom error message for depth violations`)}),Hq=h({enabled:S().default(!0).describe(`Enable query complexity limiting`),maxComplexity:P().int().min(1).default(1e3).describe(`Maximum query complexity`),defaultFieldComplexity:P().int().min(0).default(1).describe(`Default complexity per field`),fieldComplexity:d(r(),l([P().int().min(0),h({base:P().int().min(0).describe(`Base complexity`),multiplier:r().optional().describe(`Argument multiplier (e.g., "limit")`),calculator:r().optional().describe(`Custom calculator function`)})])).optional().describe(`Per-field complexity configuration`),listMultiplier:P().min(0).default(10).describe(`Multiplier for list fields`),onComplexityExceeded:E([`reject`,`log`,`warn`]).default(`reject`).describe(`Action when complexity exceeded`),errorMessage:r().optional().describe(`Custom error message for complexity violations`)}),Uq=h({enabled:S().default(!0).describe(`Enable rate limiting`),strategy:E([`token_bucket`,`fixed_window`,`sliding_window`,`cost_based`]).default(`token_bucket`).describe(`Rate limiting strategy`),global:h({maxRequests:P().int().min(1).default(1e3).describe(`Maximum requests per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`)}).optional().describe(`Global rate limits`),perUser:h({maxRequests:P().int().min(1).default(100).describe(`Maximum requests per user per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`)}).optional().describe(`Per-user rate limits`),costBased:h({enabled:S().default(!1).describe(`Enable cost-based rate limiting`),maxCost:P().int().min(1).default(1e4).describe(`Maximum cost per window`),windowMs:P().int().min(1e3).default(6e4).describe(`Time window in milliseconds`),useComplexityAsCost:S().default(!0).describe(`Use query complexity as cost`)}).optional().describe(`Cost-based rate limiting`),operations:d(r(),h({maxRequests:P().int().min(1).describe(`Max requests for this operation`),windowMs:P().int().min(1e3).describe(`Time window`)})).optional().describe(`Per-operation rate limits`),onLimitExceeded:E([`reject`,`queue`,`log`]).default(`reject`).describe(`Action when rate limit exceeded`),errorMessage:r().optional().describe(`Custom error message for rate limit violations`),includeHeaders:S().default(!0).describe(`Include rate limit headers in response`)}),Wq=h({enabled:S().default(!1).describe(`Enable persisted queries`),mode:E([`optional`,`required`]).default(`optional`).describe(`Persisted query mode (optional: allow both, required: only persisted)`),store:h({type:E([`memory`,`redis`,`database`,`file`]).default(`memory`).describe(`Query store type`),connection:r().optional().describe(`Store connection string or path`),ttl:P().int().min(0).optional().describe(`TTL in seconds for stored queries`)}).optional().describe(`Query store configuration`),apq:h({enabled:S().default(!0).describe(`Enable Automatic Persisted Queries`),hashAlgorithm:E([`sha256`,`sha1`,`md5`]).default(`sha256`).describe(`Hash algorithm for query IDs`),cache:h({ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(1).optional().describe(`Maximum number of cached queries`)}).optional().describe(`APQ cache configuration`)}).optional().describe(`Automatic Persisted Queries configuration`),allowlist:h({enabled:S().default(!1).describe(`Enable query allow list (reject queries not in list)`),queries:C(h({id:r().describe(`Query ID or hash`),operation:r().optional().describe(`Operation name`),query:r().optional().describe(`Query string`)})).optional().describe(`Allowed queries`),source:r().optional().describe(`External allow list source (file path or URL)`)}).optional().describe(`Query allow list configuration`),security:h({maxQuerySize:P().int().min(1).optional().describe(`Maximum query string size in bytes`),rejectIntrospection:S().default(!1).describe(`Reject introspection queries`)}).optional().describe(`Security configuration`)}),Gq=h({fields:r().describe(`Selection set of fields composing the entity key`),resolvable:S().optional().default(!0).describe(`Whether entities can be resolved from this subgraph`)}),Kq=h({field:r().describe(`Field name marked as external`),ownerSubgraph:r().optional().describe(`Subgraph that owns this field`)}),qq=h({field:r().describe(`Field with the requirement`),fields:r().describe(`Selection set of required fields (e.g., "price weight")`)}),Jq=h({field:r().describe(`Field that provides additional entity fields`),fields:r().describe(`Selection set of provided fields (e.g., "name price")`)}),Yq=h({typeName:r().describe(`GraphQL type name for this entity`),keys:C(Gq).min(1).describe(`Entity key definitions`),externalFields:C(Kq).optional().describe(`Fields owned by other subgraphs`),requires:C(qq).optional().describe(`Required external fields for computed fields`),provides:C(Jq).optional().describe(`Fields provided during resolution`),owner:S().optional().default(!1).describe(`Whether this subgraph is the owner of this entity`)}),Xq=h({name:r().describe(`Unique subgraph identifier`),url:r().describe(`Subgraph endpoint URL`),schemaSource:E([`introspection`,`file`,`registry`]).default(`introspection`).describe(`How to obtain the subgraph schema`),schemaPath:r().optional().describe(`Path to schema file (SDL format)`),entities:C(Yq).optional().describe(`Entity definitions for this subgraph`),healthCheck:h({enabled:S().default(!0).describe(`Enable health checking`),path:r().default(`/health`).describe(`Health check endpoint path`),intervalMs:P().int().min(1e3).default(3e4).describe(`Health check interval in milliseconds`)}).optional().describe(`Subgraph health check configuration`),forwardHeaders:C(r()).optional().describe(`HTTP headers to forward to this subgraph`)}),Zq=h({enabled:S().default(!1).describe(`Enable GraphQL Federation gateway mode`),version:E([`v1`,`v2`]).default(`v2`).describe(`Federation specification version`),subgraphs:C(Xq).describe(`Subgraph configurations`),serviceDiscovery:h({type:E([`static`,`dns`,`consul`,`kubernetes`]).default(`static`).describe(`Service discovery method`),pollIntervalMs:P().int().min(1e3).optional().describe(`Discovery poll interval in milliseconds`),namespace:r().optional().describe(`Kubernetes namespace for subgraph discovery`)}).optional().describe(`Service discovery configuration`),queryPlanning:h({strategy:E([`parallel`,`sequential`,`adaptive`]).default(`parallel`).describe(`Query execution strategy across subgraphs`),maxDepth:P().int().min(1).optional().describe(`Max query depth in federated execution`),dryRun:S().optional().default(!1).describe(`Log query plans without executing`)}).optional().describe(`Query planning configuration`),composition:h({conflictResolution:E([`error`,`first_wins`,`last_wins`]).default(`error`).describe(`Strategy for resolving schema conflicts`),validate:S().default(!0).describe(`Validate composed supergraph schema`)}).optional().describe(`Schema composition configuration`),errorHandling:h({includeSubgraphName:S().default(!1).describe(`Include subgraph name in error responses`),partialErrors:E([`propagate`,`nullify`,`reject`]).default(`propagate`).describe(`Behavior when a subgraph returns partial errors`)}).optional().describe(`Error handling configuration`)}),Qq=h({enabled:S().default(!0).describe(`Enable GraphQL API`),path:r().default(`/graphql`).describe(`GraphQL endpoint path`),playground:h({enabled:S().default(!0).describe(`Enable GraphQL Playground`),path:r().default(`/playground`).describe(`Playground path`)}).optional().describe(`GraphQL Playground configuration`),schema:h({autoGenerateTypes:S().default(!0).describe(`Auto-generate types from Objects`),types:C(Nq).optional().describe(`Type configurations`),queries:C(Pq).optional().describe(`Query configurations`),mutations:C(Fq).optional().describe(`Mutation configurations`),subscriptions:C(Iq).optional().describe(`Subscription configurations`),resolvers:C(Lq).optional().describe(`Custom resolver configurations`),directives:C(Bq).optional().describe(`Custom directive configurations`)}).optional().describe(`Schema generation configuration`),dataLoaders:C(Rq).optional().describe(`DataLoader configurations`),security:h({depthLimit:Vq.optional().describe(`Query depth limiting`),complexity:Hq.optional().describe(`Query complexity calculation`),rateLimit:Uq.optional().describe(`Rate limiting`),persistedQueries:Wq.optional().describe(`Persisted queries`)}).optional().describe(`Security configuration`),federation:Zq.optional().describe(`GraphQL Federation gateway configuration`)}),zTe=Object.assign(Qq,{create:e=>e}),BTe=e=>({text:`String`,textarea:`String`,email:`Email`,url:`URL`,phone:`PhoneNumber`,password:`String`,markdown:`String`,html:`String`,richtext:`String`,number:`Float`,currency:`Currency`,percent:`Float`,date:`Date`,datetime:`DateTime`,time:`Time`,boolean:`Boolean`,toggle:`Boolean`,select:`String`,multiselect:`[String]`,radio:`String`,checkboxes:`[String]`,lookup:`ID`,master_detail:`ID`,tree:`ID`,image:`URL`,file:`URL`,avatar:`URL`,video:`URL`,audio:`URL`,formula:`String`,summary:`Float`,autonumber:`String`,location:`JSONObject`,address:`JSONObject`,code:`String`,json:`JSON`,color:`String`,rating:`Float`,slider:`Float`,signature:`String`,qrcode:`String`,progress:`Float`,tags:`[String]`,vector:`[Float]`})[e]||`String`,$q=E([`create`,`update`,`upsert`,`delete`]),eJ=h({id:r().optional().describe(`Record ID (required for update/delete)`),data:NK.optional().describe(`Record data (required for create/update/upsert)`),externalId:r().optional().describe(`External ID for upsert matching`)}),tJ=h({atomic:S().optional().default(!0).describe(`If true, rollback entire batch on any failure (transaction mode)`),returnRecords:S().optional().default(!1).describe(`If true, return full record data in response`),continueOnError:S().optional().default(!1).describe(`If true (and atomic=false), continue processing remaining records after errors`),validateOnly:S().optional().default(!1).describe(`If true, validate records without persisting changes (dry-run mode)`)}),nJ=h({operation:$q.describe(`Type of batch operation`),records:C(eJ).min(1).max(200).describe(`Array of records to process (max 200 per batch)`),options:tJ.optional().describe(`Batch operation options`)}),rJ=h({records:C(eJ).min(1).max(200).describe(`Array of records to update (max 200 per batch)`),options:tJ.optional().describe(`Update options`)}),iJ=h({id:r().optional().describe(`Record ID if operation succeeded`),success:S().describe(`Whether this record was processed successfully`),errors:C(MK).optional().describe(`Array of errors if operation failed`),data:NK.optional().describe(`Full record data (if returnRecords=true)`),index:P().optional().describe(`Index of the record in the request array`)}),aJ=J.extend({operation:$q.optional().describe(`Operation type that was performed`),total:P().describe(`Total number of records in the batch`),succeeded:P().describe(`Number of records that succeeded`),failed:P().describe(`Number of records that failed`),results:C(iJ).describe(`Detailed results for each record`)}),oJ=h({ids:C(r()).min(1).max(200).describe(`Array of record IDs to delete (max 200)`),options:tJ.optional().describe(`Delete options`)}),VTe={batchOperation:{input:nJ,output:aJ},updateMany:{input:rJ,output:aJ},deleteMany:{input:oJ,output:aJ}},HTe=h({enabled:S().default(!0).describe(`Enable batch operations`),maxRecordsPerBatch:P().int().min(1).max(1e3).default(200).describe(`Maximum records per batch`),defaultOptions:tJ.optional().describe(`Default batch options`)}).passthrough(),sJ=E([`public`,`private`,`no-cache`,`no-store`,`must-revalidate`,`max-age`]),cJ=h({directives:C(sJ).describe(`Cache control directives`),maxAge:P().optional().describe(`Maximum cache age in seconds`),staleWhileRevalidate:P().optional().describe(`Allow serving stale content while revalidating (seconds)`),staleIfError:P().optional().describe(`Allow serving stale content on error (seconds)`)}),lJ=h({value:r().describe(`ETag value (hash or version identifier)`),weak:S().optional().default(!1).describe(`Whether this is a weak ETag`)}),uJ=h({ifNoneMatch:r().optional().describe(`ETag value for conditional request (If-None-Match header)`),ifModifiedSince:r().datetime().optional().describe(`Timestamp for conditional request (If-Modified-Since header)`),cacheControl:cJ.optional().describe(`Client cache control preferences`)}),dJ=h({data:u().optional().describe(`Metadata payload (omitted for 304 Not Modified)`),etag:lJ.optional().describe(`ETag for this resource version`),lastModified:r().datetime().optional().describe(`Last modification timestamp`),cacheControl:cJ.optional().describe(`Cache control directives`),notModified:S().optional().default(!1).describe(`True if resource has not been modified (304 response)`),version:r().optional().describe(`Metadata version identifier`)}),fJ=E([`all`,`object`,`field`,`permission`,`layout`,`custom`]),pJ=h({target:fJ.describe(`What to invalidate`),identifiers:C(r()).optional().describe(`Specific resources to invalidate (e.g., object names)`),cascade:S().optional().default(!1).describe(`If true, invalidate dependent resources`),pattern:r().optional().describe(`Pattern for custom invalidation (supports wildcards)`)}),mJ=h({success:S().describe(`Whether invalidation succeeded`),invalidated:P().describe(`Number of cache entries invalidated`),targets:C(r()).optional().describe(`List of invalidated resources`)}),UTe={getCached:{input:uJ,output:dJ},invalidate:{input:pJ,output:mJ}},hJ=E([`validation`,`authentication`,`authorization`,`not_found`,`conflict`,`rate_limit`,`server`,`external`,`maintenance`]),gJ=E(`validation_error.invalid_field.missing_required_field.invalid_format.value_too_long.value_too_short.value_out_of_range.invalid_reference.duplicate_value.invalid_query.invalid_filter.invalid_sort.max_records_exceeded.unauthenticated.invalid_credentials.expired_token.invalid_token.session_expired.mfa_required.email_not_verified.permission_denied.insufficient_privileges.field_not_accessible.record_not_accessible.license_required.ip_restricted.time_restricted.resource_not_found.object_not_found.record_not_found.field_not_found.endpoint_not_found.resource_conflict.concurrent_modification.delete_restricted.duplicate_record.lock_conflict.rate_limit_exceeded.quota_exceeded.concurrent_limit_exceeded.internal_error.database_error.timeout.service_unavailable.not_implemented.external_service_error.integration_error.webhook_delivery_failed.batch_partial_failure.batch_complete_failure.transaction_failed`.split(`.`)),WTe={validation:400,authentication:401,authorization:403,not_found:404,conflict:409,rate_limit:429,server:500,external:502,maintenance:503},_J=E([`no_retry`,`retry_immediate`,`retry_backoff`,`retry_after`]),vJ=h({field:r().describe(`Field path (supports dot notation)`),code:gJ.describe(`Error code for this field`),message:r().describe(`Human-readable error message`),value:u().optional().describe(`The invalid value that was provided`),constraint:u().optional().describe(`The constraint that was violated (e.g., max length)`)}),yJ=h({code:gJ.describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),category:hJ.optional().describe(`Error category`),httpStatus:P().optional().describe(`HTTP status code`),retryable:S().default(!1).describe(`Whether the request can be retried`),retryStrategy:_J.optional().describe(`Recommended retry strategy`),retryAfter:P().optional().describe(`Seconds to wait before retrying`),details:u().optional().describe(`Additional error context`),fieldErrors:C(vJ).optional().describe(`Field-specific validation errors`),timestamp:r().datetime().optional().describe(`When the error occurred`),requestId:r().optional().describe(`Request ID for tracking`),traceId:r().optional().describe(`Distributed trace ID`),documentation:r().url().optional().describe(`URL to error documentation`),helpText:r().optional().describe(`Suggested actions to resolve the error`)}),GTe=h({success:m(!1).describe(`Always false for error responses`),error:yJ.describe(`Error details`),meta:h({timestamp:r().datetime().optional(),requestId:r().optional(),traceId:r().optional()}).optional().describe(`Response metadata`)}),bJ=E([`on_create`,`on_update`,`on_create_or_update`,`on_delete`,`schedule`]),xJ=h({name:r().describe(`Action name`),type:m(`field_update`),field:r().describe(`Field to update`),value:u().describe(`Value or Formula to set`)}),SJ=h({name:r().describe(`Action name`),type:m(`email_alert`),template:r().describe(`Email template ID/DevName`),recipients:C(r()).describe(`List of recipient emails or user IDs`)}),CJ=h({name:r().describe(`Action name`),type:m(`connector_action`),connectorId:r().describe(`Target Connector ID (e.g. slack, twilio)`),actionId:r().describe(`Target Action ID (e.g. send_message)`),input:d(r(),u()).describe(`Input parameters matching the action schema`)}),wJ=h({name:r().describe(`Action name`),type:m(`http_call`),url:r().describe(`Target URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`]).default(`POST`).describe(`HTTP Method`),headers:d(r(),r()).optional().describe(`HTTP Headers`),body:r().optional().describe(`Request body (JSON or text)`)}),TJ=h({name:r().describe(`Action name`),type:m(`task_creation`),taskObject:r().describe(`Task object name (e.g., "task", "project_task")`),subject:r().describe(`Task subject/title`),description:r().optional().describe(`Task description`),assignedTo:r().optional().describe(`User ID or field reference for assignee`),dueDate:r().optional().describe(`Due date (ISO string or formula)`),priority:r().optional().describe(`Task priority`),relatedTo:r().optional().describe(`Related record ID or field reference`),additionalFields:d(r(),u()).optional().describe(`Additional custom fields`)}),EJ=h({name:r().describe(`Action name`),type:m(`push_notification`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),recipients:C(r()).describe(`User IDs or device tokens`),data:d(r(),u()).optional().describe(`Additional data payload`),badge:P().optional().describe(`Badge count (iOS)`),sound:r().optional().describe(`Notification sound`),clickAction:r().optional().describe(`Action/URL when notification is clicked`)}),DJ=h({name:r().describe(`Action name`),type:m(`custom_script`),language:E([`javascript`,`typescript`,`python`]).default(`javascript`).describe(`Script language`),code:r().describe(`Script code to execute`),timeout:P().default(3e4).describe(`Execution timeout in milliseconds`),context:d(r(),u()).optional().describe(`Additional context variables`)}),OJ=I(`type`,[xJ,SJ,wJ,CJ,TJ,EJ,DJ]),kJ=h({id:r().optional().describe(`Unique identifier`),timeLength:P().int().describe(`Duration amount (e.g. 1, 30)`),timeUnit:E([`minutes`,`hours`,`days`]).describe(`Unit of time`),offsetDirection:E([`before`,`after`]).describe(`Before or After the reference date`),offsetFrom:E([`trigger_date`,`date_field`]).describe(`Basis for calculation`),dateField:r().optional().describe(`Date field to calculate from (required if offsetFrom is date_field)`),actions:C(OJ).describe(`Actions to execute at the scheduled time`)}),AJ=h({name:kA.describe(`Unique workflow name (lowercase snake_case)`),objectName:r().describe(`Target Object`),triggerType:bJ.describe(`When to evaluate`),criteria:r().optional().describe(`Formula condition. If TRUE, actions execute.`),actions:C(OJ).optional().describe(`Immediate actions`),timeTriggers:C(kJ).optional().describe(`Scheduled actions relative to trigger or date field`),active:S().default(!0).describe(`Whether this workflow is active`),executionOrder:P().int().min(0).default(100).describe(`Deterministic execution order when multiple workflows match (lower runs first)`),reevaluateOnChange:S().default(!1).describe(`Re-evaluate rule if field updates change the record validity`)}),KTe=h({trigger:r(),payload:d(r(),u())}),qTe=h({success:S(),jobId:r().optional(),result:u().optional()}),JTe=h({}),YTe=XK.partial().required({version:!0}).extend({apiName:r().optional().describe(`API name (deprecated — use name)`)}),XTe=h({}),ZTe=h({types:C(r()).describe(`Available metadata type names (e.g., "object", "plugin", "view")`)}),QTe=h({type:r().describe(`Metadata type name (e.g., "object", "plugin")`),packageId:r().optional().describe(`Optional package ID to filter items by`)}),$Te=h({type:r().describe(`Metadata type name`),items:C(u()).describe(`Array of metadata items`)}),eEe=h({type:r().describe(`Metadata type name`),name:r().describe(`Item name (snake_case identifier)`),packageId:r().optional().describe(`Optional package ID to filter items by`)}),tEe=h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),item:u().describe(`Metadata item definition`)}),nEe=h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),item:u().describe(`Metadata item definition`)}),rEe=h({success:S(),message:r().optional()}),iEe=h({type:r().describe(`Metadata type name`),name:r().describe(`Item name`),cacheRequest:uJ.optional().describe(`Cache validation parameters`)}),aEe=dJ,oEe=h({object:r().describe(`Object name (snake_case)`),type:E([`list`,`form`]).describe(`View type`)}),sEe=sF,cEe=h({object:r().describe(`The unique machine name of the object to query (e.g. "account").`),query:Lj.optional().describe(`Structured query definition (filter, sort, select, pagination).`)}),lEe=h({object:r().describe(`The object name for the returned records.`),records:C(d(r(),u())).describe(`The list of matching records.`),total:P().optional().describe(`Total number of records matching the filter (if requested).`),nextCursor:r().optional().describe(`Cursor for the next page of results (cursor-based pagination).`),hasMore:S().optional().describe(`True if there are more records available (pagination).`)}),uEe=h({filter:r().optional().describe(`JSON-encoded filter expression (canonical, singular).`),filters:r().optional().describe(`JSON-encoded filter expression (deprecated plural alias).`),select:r().optional().describe(`Comma-separated list of fields to retrieve.`),sort:r().optional().describe(`Sort expression (e.g. "name asc,created_at desc" or "-created_at").`),orderBy:r().optional().describe(`Alias for sort (OData compatibility).`),top:pe().optional().describe(`Max records to return (limit).`),skip:pe().optional().describe(`Records to skip (offset).`),expand:r().optional().describe(`Comma-separated list of lookup/master_detail field names to expand. Resolved to populate array and passed to the engine for batch $in expansion.`),search:r().optional().describe(`Full-text search query.`),distinct:me().optional().describe(`SELECT DISTINCT flag.`),count:me().optional().describe(`Include total count in response.`)}),dEe=h({object:r().describe(`The object name.`),id:r().describe(`The unique record identifier (primary key).`),select:C(r()).optional().describe(`Fields to include in the response (allowlisted query param).`),expand:C(r()).optional().describe(`Lookup/master_detail field names to expand. The engine resolves these via batch $in queries, replacing foreign key IDs with full objects.`)}),fEe=h({object:r().describe(`The object name.`),id:r().describe(`The record ID.`),record:d(r(),u()).describe(`The complete record data.`)}),pEe=h({object:r().describe(`The object name.`),data:d(r(),u()).describe(`The dictionary of field values to insert.`)}),mEe=h({object:r().describe(`The object name.`),id:r().describe(`The ID of the newly created record.`),record:d(r(),u()).describe(`The created record, including server-generated fields (created_at, owner).`)}),hEe=h({object:r().describe(`The object name.`),id:r().describe(`The ID of the record to update.`),data:d(r(),u()).describe(`The fields to update (partial update).`)}),gEe=h({object:r().describe(`Object name`),id:r().describe(`Updated record ID`),record:d(r(),u()).describe(`Updated record`)}),_Ee=h({object:r().describe(`Object name`),id:r().describe(`Record ID to delete`)}),vEe=h({object:r().describe(`Object name`),id:r().describe(`Deleted record ID`),success:S().describe(`Whether deletion succeeded`)}),yEe=h({object:r().describe(`Object name`),request:nJ.describe(`Batch operation request`)}),bEe=aJ,xEe=h({object:r().describe(`Object name`),records:C(d(r(),u())).describe(`Array of records to create`)}),SEe=h({object:r().describe(`Object name`),records:C(d(r(),u())).describe(`Created records`),count:P().describe(`Number of records created`)}),CEe=h({object:r().describe(`Object name`),records:C(h({id:r().describe(`Record ID`),data:d(r(),u()).describe(`Fields to update`)})).describe(`Array of updates`),options:tJ.optional().describe(`Update options`)}),wEe=aJ,TEe=h({object:r().describe(`Object name`),ids:C(r()).describe(`Array of record IDs to delete`),options:tJ.optional().describe(`Delete options`)}),EEe=aJ,DEe=h({object:r().describe(`Object name (snake_case)`),type:E([`list`,`form`]).optional().describe(`Filter by view type`)}),OEe=h({object:r().describe(`Object name`),views:C(sF).describe(`Array of view definitions`)}),kEe=h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier`)}),AEe=h({object:r().describe(`Object name`),view:sF.describe(`View definition`)}),jEe=h({object:r().describe(`Object name (snake_case)`),data:sF.describe(`View definition to create`)}),MEe=h({object:r().describe(`Object name`),viewId:r().describe(`Created view identifier`),view:sF.describe(`Created view definition`)}),NEe=h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier`),data:sF.partial().describe(`Partial view data to update`)}),PEe=h({object:r().describe(`Object name`),viewId:r().describe(`Updated view identifier`),view:sF.describe(`Updated view definition`)}),FEe=h({object:r().describe(`Object name (snake_case)`),viewId:r().describe(`View identifier to delete`)}),IEe=h({object:r().describe(`Object name`),viewId:r().describe(`Deleted view identifier`),success:S().describe(`Whether deletion succeeded`)}),LEe=h({object:r().describe(`Object name to check permissions for`),action:E([`create`,`read`,`edit`,`delete`,`transfer`,`restore`,`purge`]).describe(`Action to check`),recordId:r().optional().describe(`Specific record ID (for record-level checks)`),field:r().optional().describe(`Specific field name (for field-level checks)`)}),REe=h({allowed:S().describe(`Whether the action is permitted`),reason:r().optional().describe(`Reason if denied`)}),zEe=h({object:r().describe(`Object name to get permissions for`)}),BEe=h({object:r().describe(`Object name`),permissions:JN.describe(`Object-level permissions`),fieldPermissions:d(r(),YN).optional().describe(`Field-level permissions keyed by field name`)}),VEe=h({}),HEe=h({objects:d(r(),JN).describe(`Effective object permissions keyed by object name`),systemPermissions:C(r()).describe(`Effective system-level permissions`)}),UEe=h({object:r().describe(`Object name to get workflow config for`)}),WEe=h({object:r().describe(`Object name`),workflows:C(AJ).describe(`Active workflow rules for this object`)}),jJ=h({currentState:r().describe(`Current workflow state name`),availableTransitions:C(h({name:r().describe(`Transition name`),targetState:r().describe(`Target state after transition`),label:r().optional().describe(`Display label`),requiresApproval:S().default(!1).describe(`Whether transition requires approval`)})).describe(`Available transitions from current state`),history:C(h({fromState:r().describe(`Previous state`),toState:r().describe(`New state`),action:r().describe(`Action that triggered the transition`),userId:r().describe(`User who performed the action`),timestamp:r().datetime().describe(`When the transition occurred`),comment:r().optional().describe(`Optional comment`)})).optional().describe(`State transition history`)}),GEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID to get workflow state for`)}),KEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),state:jJ.describe(`Current workflow state and available transitions`)}),qEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),transition:r().describe(`Transition name to execute`),comment:r().optional().describe(`Optional comment for the transition`),data:d(r(),u()).optional().describe(`Additional data for the transition`)}),JEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the transition succeeded`),state:jJ.describe(`New workflow state after transition`)}),YEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),comment:r().optional().describe(`Approval comment`),data:d(r(),u()).optional().describe(`Additional data`)}),XEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the approval succeeded`),state:jJ.describe(`New workflow state after approval`)}),ZEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),reason:r().describe(`Rejection reason`),comment:r().optional().describe(`Additional comment`)}),QEe=h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),success:S().describe(`Whether the rejection succeeded`),state:jJ.describe(`New workflow state after rejection`)}),$Ee=h({transport:rq.optional().describe(`Preferred transport protocol`),channels:C(r()).optional().describe(`Channels to subscribe to on connect`),token:r().optional().describe(`Authentication token`)}),eDe=h({connectionId:r().describe(`Unique connection identifier`),transport:rq.describe(`Negotiated transport protocol`),url:r().optional().describe(`WebSocket/SSE endpoint URL`)}),tDe=h({connectionId:r().optional().describe(`Connection ID to disconnect`)}),nDe=h({success:S().describe(`Whether disconnection succeeded`)}),rDe=h({channel:r().describe(`Channel name to subscribe to`),events:C(r()).optional().describe(`Specific event types to listen for`),filter:d(r(),u()).optional().describe(`Event filter criteria`)}),iDe=h({subscriptionId:r().describe(`Unique subscription identifier`),channel:r().describe(`Subscribed channel name`)}),aDe=h({subscriptionId:r().describe(`Subscription ID to cancel`)}),oDe=h({success:S().describe(`Whether unsubscription succeeded`)}),sDe=h({channel:r().describe(`Channel to set presence in`),state:sq.describe(`Presence state to set`)}),cDe=h({success:S().describe(`Whether presence was set`)}),lDe=h({channel:r().describe(`Channel to get presence for`)}),uDe=h({channel:r().describe(`Channel name`),members:C(sq).describe(`Active members and their presence state`)}),dDe=h({token:r().describe(`Device push notification token`),platform:E([`ios`,`android`,`web`]).describe(`Device platform`),deviceId:r().optional().describe(`Unique device identifier`),name:r().optional().describe(`Device friendly name`)}),fDe=h({deviceId:r().describe(`Registered device ID`),success:S().describe(`Whether registration succeeded`)}),pDe=h({deviceId:r().describe(`Device ID to unregister`)}),mDe=h({success:S().describe(`Whether unregistration succeeded`)}),MJ=h({email:S().default(!0).describe(`Receive email notifications`),push:S().default(!0).describe(`Receive push notifications`),inApp:S().default(!0).describe(`Receive in-app notifications`),digest:E([`none`,`daily`,`weekly`]).default(`none`).describe(`Email digest frequency`),channels:d(r(),h({enabled:S().default(!0).describe(`Whether this channel is enabled`),email:S().optional().describe(`Override email setting`),push:S().optional().describe(`Override push setting`)})).optional().describe(`Per-channel notification preferences`)}),hDe=h({}),gDe=h({preferences:MJ.describe(`Current notification preferences`)}),_De=h({preferences:MJ.partial().describe(`Preferences to update`)}),vDe=h({preferences:MJ.describe(`Updated notification preferences`)}),NJ=h({id:r().describe(`Notification ID`),type:r().describe(`Notification type`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),read:S().default(!1).describe(`Whether notification has been read`),data:d(r(),u()).optional().describe(`Additional notification data`),actionUrl:r().optional().describe(`URL to navigate to when clicked`),createdAt:r().datetime().describe(`When notification was created`)}),yDe=h({read:S().optional().describe(`Filter by read status`),type:r().optional().describe(`Filter by notification type`),limit:P().default(20).describe(`Maximum number of notifications to return`),cursor:r().optional().describe(`Pagination cursor`)}),bDe=h({notifications:C(NJ).describe(`List of notifications`),unreadCount:P().describe(`Total number of unread notifications`),cursor:r().optional().describe(`Next page cursor`)}),xDe=h({ids:C(r()).describe(`Notification IDs to mark as read`)}),SDe=h({success:S().describe(`Whether the operation succeeded`),readCount:P().describe(`Number of notifications marked as read`)}),CDe=h({}),wDe=h({success:S().describe(`Whether the operation succeeded`),readCount:P().describe(`Number of notifications marked as read`)}),TDe=h({query:r().describe(`Natural language query string`),object:r().optional().describe(`Target object context`),conversationId:r().optional().describe(`Conversation ID for multi-turn queries`)}),EDe=h({query:u().describe(`Generated structured query (AST)`),explanation:r().optional().describe(`Human-readable explanation of the query`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),suggestions:C(r()).optional().describe(`Suggested follow-up queries`)}),DDe=h({object:r().describe(`Object name for context`),field:r().optional().describe(`Field to suggest values for`),recordId:r().optional().describe(`Record ID for context`),partial:r().optional().describe(`Partial input for completion`)}),ODe=h({suggestions:C(h({value:u().describe(`Suggested value`),label:r().describe(`Display label`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),reason:r().optional().describe(`Reason for this suggestion`)})).describe(`Suggested values`)}),kDe=h({object:r().describe(`Object name to analyze`),recordId:r().optional().describe(`Specific record to analyze`),type:E([`summary`,`trends`,`anomalies`,`recommendations`]).optional().describe(`Type of insight`)}),ADe=h({insights:C(h({type:r().describe(`Insight type`),title:r().describe(`Insight title`),description:r().describe(`Detailed description`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),data:d(r(),u()).optional().describe(`Supporting data`)})).describe(`Generated insights`)}),jDe=h({}),MDe=h({locales:C(h({code:r().describe(`BCP-47 locale code (e.g., en-US, zh-CN)`),label:r().describe(`Display name of the locale`),isDefault:S().default(!1).describe(`Whether this is the default locale`)})).describe(`Available locales`)}),NDe=h({locale:r().describe(`BCP-47 locale code`),namespace:r().optional().describe(`Translation namespace (e.g., objects, apps, messages)`),keys:C(r()).optional().describe(`Specific translation keys to fetch`)}),PDe=h({locale:r().describe(`Locale code`),translations:Rz.describe(`Translation data`)}),FDe=h({object:r().describe(`Object name`),locale:r().describe(`BCP-47 locale code`)}),IDe=h({object:r().describe(`Object name`),locale:r().describe(`Locale code`),labels:d(r(),h({label:r().describe(`Translated field label`),help:r().optional().describe(`Translated help text`),options:d(r(),r()).optional().describe(`Translated option labels`)})).describe(`Field labels keyed by field name`)}),LDe=h({getDiscovery:M().describe(`Get API discovery information`),getMetaTypes:M().describe(`Get available metadata types`),getMetaItems:M().describe(`Get all items of a metadata type`),getMetaItem:M().describe(`Get a specific metadata item`),saveMetaItem:M().describe(`Save metadata item`),getMetaItemCached:M().describe(`Get a metadata item with cache validation`),getUiView:M().describe(`Get UI view definition`),analyticsQuery:M().describe(`Execute analytics query`),getAnalyticsMeta:M().describe(`Get analytics metadata (cubes)`),triggerAutomation:M().describe(`Trigger an automation flow or script`),listPackages:M().describe(`List installed packages with optional filters`),getPackage:M().describe(`Get a specific installed package by ID`),installPackage:M().describe(`Install a new package from manifest`),uninstallPackage:M().describe(`Uninstall a package by ID`),enablePackage:M().describe(`Enable a disabled package`),disablePackage:M().describe(`Disable an installed package`),findData:M().describe(`Find data records`),getData:M().describe(`Get single data record`),createData:M().describe(`Create a data record`),updateData:M().describe(`Update a data record`),deleteData:M().describe(`Delete a data record`),batchData:M().describe(`Perform batch operations`),createManyData:M().describe(`Create multiple records`),updateManyData:M().describe(`Update multiple records`),deleteManyData:M().describe(`Delete multiple records`),listViews:M().describe(`List views for an object`),getView:M().describe(`Get a specific view`),createView:M().describe(`Create a new view`),updateView:M().describe(`Update an existing view`),deleteView:M().describe(`Delete a view`),checkPermission:M().describe(`Check if an action is permitted`),getObjectPermissions:M().describe(`Get permissions for an object`),getEffectivePermissions:M().describe(`Get effective permissions for current user`),getWorkflowConfig:M().describe(`Get workflow configuration for an object`),getWorkflowState:M().describe(`Get workflow state for a record`),workflowTransition:M().describe(`Execute a workflow state transition`),workflowApprove:M().describe(`Approve a workflow step`),workflowReject:M().describe(`Reject a workflow step`),realtimeConnect:M().describe(`Establish realtime connection`),realtimeDisconnect:M().describe(`Close realtime connection`),realtimeSubscribe:M().describe(`Subscribe to a realtime channel`),realtimeUnsubscribe:M().describe(`Unsubscribe from a realtime channel`),setPresence:M().describe(`Set user presence state`),getPresence:M().describe(`Get channel presence information`),registerDevice:M().describe(`Register a device for push notifications`),unregisterDevice:M().describe(`Unregister a device`),getNotificationPreferences:M().describe(`Get notification preferences`),updateNotificationPreferences:M().describe(`Update notification preferences`),listNotifications:M().describe(`List notifications`),markNotificationsRead:M().describe(`Mark specific notifications as read`),markAllNotificationsRead:M().describe(`Mark all notifications as read`),aiNlq:M().describe(`Natural language query`),aiChat:M().describe(`AI chat interaction`),aiSuggest:M().describe(`Get AI-powered suggestions`),aiInsights:M().describe(`Get AI-generated insights`),getLocales:M().describe(`Get available locales`),getTranslations:M().describe(`Get translations for a locale`),getFieldLabels:M().describe(`Get translated field labels for an object`),listFeed:M().describe(`List feed items for a record`),createFeedItem:M().describe(`Create a new feed item`),updateFeedItem:M().describe(`Update an existing feed item`),deleteFeedItem:M().describe(`Delete a feed item`),addReaction:M().describe(`Add an emoji reaction to a feed item`),removeReaction:M().describe(`Remove an emoji reaction from a feed item`),pinFeedItem:M().describe(`Pin a feed item`),unpinFeedItem:M().describe(`Unpin a feed item`),starFeedItem:M().describe(`Star a feed item`),unstarFeedItem:M().describe(`Unstar a feed item`),searchFeed:M().describe(`Search feed items`),getChangelog:M().describe(`Get field-level changelog for a record`),feedSubscribe:M().describe(`Subscribe to record notifications`),feedUnsubscribe:M().describe(`Unsubscribe from record notifications`)}),PJ=h({version:r().regex(/^[a-zA-Z0-9_\-\.]+$/).default(`v1`).describe(`API version (e.g., v1, v2, 2024-01)`),basePath:r().default(`/api`).describe(`Base URL path for API`),apiPath:r().optional().describe(`Full API path (defaults to {basePath}/{version})`),enableCrud:S().default(!0).describe(`Enable automatic CRUD endpoint generation`),enableMetadata:S().default(!0).describe(`Enable metadata API endpoints`),enableUi:S().default(!0).describe(`Enable UI API endpoints (Views, Menus, Layouts)`),enableBatch:S().default(!0).describe(`Enable batch operation endpoints`),enableDiscovery:S().default(!0).describe(`Enable API discovery endpoint`),documentation:h({enabled:S().default(!0).describe(`Enable API documentation`),title:r().default(`ObjectStack API`).describe(`API documentation title`),description:r().optional().describe(`API description`),version:r().optional().describe(`Documentation version`),termsOfService:r().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().optional(),email:r().optional()}).optional(),license:h({name:r(),url:r().optional()}).optional()}).optional().describe(`OpenAPI/Swagger documentation config`),responseFormat:h({envelope:S().default(!0).describe(`Wrap responses in standard envelope`),includeMetadata:S().default(!0).describe(`Include response metadata (timestamp, requestId)`),includePagination:S().default(!0).describe(`Include pagination info in list responses`)}).optional().describe(`Response format options`)}),FJ=E([`create`,`read`,`update`,`delete`,`list`]),IJ=h({method:NA.describe(`HTTP method`),path:r().describe(`URL path pattern`),summary:r().optional().describe(`Operation summary`),description:r().optional().describe(`Operation description`)}),LJ=h({operations:h({create:S().default(!0).describe(`Enable create operation`),read:S().default(!0).describe(`Enable read operation`),update:S().default(!0).describe(`Enable update operation`),delete:S().default(!0).describe(`Enable delete operation`),list:S().default(!0).describe(`Enable list operation`)}).optional().describe(`Enable/disable operations`),patterns:d(FJ,IJ.optional()).optional().describe(`Custom URL patterns for operations`),dataPrefix:r().default(`/data`).describe(`URL prefix for data endpoints`),objectParamStyle:E([`path`,`query`]).default(`path`).describe(`How object name is passed (path param or query param)`)}),RJ=h({prefix:r().default(`/meta`).describe(`URL prefix for metadata endpoints`),enableCache:S().default(!0).describe(`Enable HTTP cache headers (ETag, Last-Modified)`),cacheTtl:P().int().default(3600).describe(`Cache TTL in seconds`),endpoints:h({types:S().default(!0).describe(`GET /meta - List all metadata types`),items:S().default(!0).describe(`GET /meta/:type - List items of type`),item:S().default(!0).describe(`GET /meta/:type/:name - Get specific item`),schema:S().default(!0).describe(`GET /meta/:type/:name/schema - Get JSON schema`)}).optional().describe(`Enable/disable specific endpoints`)}),zJ=h({maxBatchSize:P().int().min(1).max(1e3).default(200).describe(`Maximum records per batch operation`),enableBatchEndpoint:S().default(!0).describe(`Enable POST /data/:object/batch endpoint`),operations:h({createMany:S().default(!0).describe(`Enable POST /data/:object/createMany`),updateMany:S().default(!0).describe(`Enable POST /data/:object/updateMany`),deleteMany:S().default(!0).describe(`Enable POST /data/:object/deleteMany`),upsertMany:S().default(!0).describe(`Enable POST /data/:object/upsertMany`)}).optional().describe(`Enable/disable specific batch operations`),defaultAtomic:S().default(!0).describe(`Default atomic/transaction mode for batch operations`)}),BJ=h({includeObjects:C(r()).optional().describe(`Specific objects to generate routes for (empty = all)`),excludeObjects:C(r()).optional().describe(`Objects to exclude from route generation`),nameTransform:E([`none`,`plural`,`kebab-case`,`camelCase`]).default(`none`).describe(`Transform object names in URLs`),overrides:d(r(),h({enabled:S().optional().describe(`Enable/disable routes for this object`),basePath:r().optional().describe(`Custom base path`),operations:d(FJ,S()).optional().describe(`Enable/disable specific operations`)})).optional().describe(`Per-object route customization`)}),VJ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Webhook event identifier (snake_case)`),description:r().describe(`Human-readable event description`),method:NA.default(`POST`).describe(`HTTP method for webhook delivery`),payloadSchema:r().describe(`JSON Schema $ref for the webhook payload`),headers:d(r(),r()).optional().describe(`Custom headers to include in webhook delivery`),security:C(E([`hmac_sha256`,`basic`,`bearer`,`api_key`])).describe(`Supported authentication methods for webhook verification`)}),RDe=h({enabled:S().default(!1).describe(`Enable webhook support`),events:C(VJ).describe(`Registered webhook events`),deliveryConfig:h({maxRetries:P().int().default(3).describe(`Maximum delivery retry attempts`),retryIntervalMs:P().int().default(5e3).describe(`Milliseconds between retry attempts`),timeoutMs:P().int().default(3e4).describe(`Delivery request timeout in milliseconds`),signatureHeader:r().default(`X-Signature-256`).describe(`Header name for webhook signature`)}).describe(`Webhook delivery configuration`),registrationEndpoint:r().default(`/webhooks`).describe(`URL path for webhook registration`)}),HJ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Callback identifier (snake_case)`),expression:r().describe(`Runtime expression (e.g., {$request.body#/callbackUrl})`),method:NA.describe(`HTTP method for callback request`),url:r().describe(`Callback URL template with runtime expressions`)}),UJ=h({webhooks:d(r(),VJ).optional().describe(`OpenAPI 3.1 webhooks (top-level webhook definitions)`),callbacks:d(r(),C(HJ)).optional().describe(`OpenAPI 3.1 callbacks (async response definitions)`),jsonSchemaDialect:r().default(`https://json-schema.org/draft/2020-12/schema`).describe(`JSON Schema dialect for schema definitions`),pathItemReferences:S().default(!1).describe(`Allow $ref in path items (OpenAPI 3.1 feature)`)}),WJ=h({api:PJ.optional().describe(`REST API configuration`),crud:LJ.optional().describe(`CRUD endpoints configuration`),metadata:RJ.optional().describe(`Metadata endpoints configuration`),batch:zJ.optional().describe(`Batch endpoints configuration`),routes:BJ.optional().describe(`Route generation configuration`),openApi31:UJ.optional().describe(`OpenAPI 3.1 extensions configuration`)}),GJ=h({id:r().describe(`Unique endpoint identifier`),method:NA.describe(`HTTP method`),path:r().describe(`Full URL path`),object:r().describe(`Object name (snake_case)`),operation:l([FJ,r()]).describe(`Operation type`),handler:r().describe(`Handler function identifier`),metadata:h({summary:r().optional(),description:r().optional(),tags:C(r()).optional(),deprecated:S().optional()}).optional()}),zDe=h({endpoints:C(GJ).describe(`All generated endpoints`),total:P().int().describe(`Total number of endpoints`),byObject:d(r(),C(GJ)).optional().describe(`Endpoints grouped by object`),byOperation:d(r(),C(GJ)).optional().describe(`Endpoints grouped by operation`)}),BDe=Object.assign(PJ,{create:e=>e}),VDe=Object.assign(WJ,{create:e=>e}),KJ=E([`rest`,`graphql`,`odata`,`websocket`,`file`,`auth`,`metadata`,`plugin`,`webhook`,`rpc`]),qJ=l([P().int().min(100).max(599),E([`2xx`,`3xx`,`4xx`,`5xx`])]),JJ=h({objectId:kA.describe(`Object name to reference`),includeFields:C(r()).optional().describe(`Include only these fields in the schema`),excludeFields:C(r()).optional().describe(`Exclude these fields from the schema`),includeRelated:C(r()).optional().describe(`Include related objects via lookup fields`)}),HDe=l([u().describe(`Static JSON Schema definition`),h({$ref:JJ.describe(`Dynamic reference to ObjectQL object`)}).describe(`Dynamic ObjectQL reference`)]),YJ=h({name:r().describe(`Parameter name`),in:E([`path`,`query`,`header`,`body`,`cookie`]).describe(`Parameter location`),description:r().optional().describe(`Parameter description`),required:S().default(!1).describe(`Whether parameter is required`),schema:l([h({type:E([`string`,`number`,`integer`,`boolean`,`array`,`object`]).describe(`Parameter type`),format:r().optional().describe(`Format (e.g., date-time, email, uuid)`),enum:C(u()).optional().describe(`Allowed values`),default:u().optional().describe(`Default value`),items:u().optional().describe(`Array item schema`),properties:d(r(),u()).optional().describe(`Object properties`)}).describe(`Static JSON Schema`),h({$ref:JJ}).describe(`Dynamic ObjectQL reference`)]).describe(`Parameter schema definition`),example:u().optional().describe(`Example value`)}),XJ=h({statusCode:qJ.describe(`HTTP status code`),description:r().describe(`Response description`),contentType:r().default(`application/json`).describe(`Response content type`),schema:l([u().describe(`Static JSON Schema`),h({$ref:JJ}).describe(`Dynamic ObjectQL reference`)]).optional().describe(`Response body schema`),headers:d(r(),h({description:r().optional(),schema:u()})).optional().describe(`Response headers`),example:u().optional().describe(`Example response`)}),ZJ=h({id:r().describe(`Unique endpoint identifier`),method:NA.optional().describe(`HTTP method`),path:r().describe(`URL path pattern`),summary:r().optional().describe(`Short endpoint summary`),description:r().optional().describe(`Detailed endpoint description`),operationId:r().optional().describe(`Unique operation identifier`),tags:C(r()).optional().default([]).describe(`Tags for categorization`),parameters:C(YJ).optional().default([]).describe(`Endpoint parameters`),requestBody:h({description:r().optional(),required:S().default(!1),contentType:r().default(`application/json`),schema:u().optional(),example:u().optional()}).optional().describe(`Request body specification`),responses:C(XJ).optional().default([]).describe(`Possible responses`),rateLimit:LA.optional().describe(`Endpoint specific rate limiting`),security:C(d(r(),C(r()))).optional().describe(`Security requirements (e.g. [{"bearerAuth": []}])`),requiredPermissions:C(r()).optional().default([]).describe(`Required RBAC permissions (e.g., "customer.read", "manage_users")`),priority:P().int().min(0).max(1e3).optional().default(100).describe(`Route priority for conflict resolution (0-1000, higher = more important)`),protocolConfig:d(r(),u()).optional().describe(`Protocol-specific configuration for custom protocols (gRPC, tRPC, etc.)`),deprecated:S().default(!1).describe(`Whether endpoint is deprecated`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation link`)}),QJ=h({owner:r().optional().describe(`Owner team or person`),status:E([`active`,`deprecated`,`experimental`,`beta`]).default(`active`).describe(`API lifecycle status`),tags:C(r()).optional().default([]).describe(`Classification tags`),pluginSource:r().optional().describe(`Source plugin name`),custom:d(r(),u()).optional().describe(`Custom metadata fields`)}),$J=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique API identifier (snake_case)`),name:r().describe(`API display name`),type:KJ.describe(`API protocol type`),version:r().describe(`API version (e.g., v1, 2024-01)`),basePath:r().describe(`Base URL path for this API`),description:r().optional().describe(`API description`),endpoints:C(ZJ).describe(`Registered endpoints`),config:d(r(),u()).optional().describe(`Protocol-specific configuration`),metadata:QJ.optional().describe(`Additional metadata`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`Contact information`),license:h({name:r(),url:r().url().optional()}).optional().describe(`License information`)}),eY=E([`error`,`priority`,`first-wins`,`last-wins`]),tY=h({version:r().describe(`Registry version`),conflictResolution:eY.optional().default(`error`).describe(`Strategy for handling route conflicts`),apis:C($J).describe(`All registered APIs`),totalApis:P().int().describe(`Total number of registered APIs`),totalEndpoints:P().int().describe(`Total number of endpoints`),byType:d(KJ,C($J)).optional().describe(`APIs grouped by protocol type`),byStatus:d(r(),C($J)).optional().describe(`APIs grouped by status`),updatedAt:r().datetime().optional().describe(`Last registry update time`)}),nY=h({type:KJ.optional().describe(`Filter by API protocol type`),tags:C(r()).optional().describe(`Filter by tags (ANY match)`),status:E([`active`,`deprecated`,`experimental`,`beta`]).optional().describe(`Filter by lifecycle status`),pluginSource:r().optional().describe(`Filter by plugin name`),search:r().optional().describe(`Full-text search in name/description`),version:r().optional().describe(`Filter by specific version`)}),UDe=h({apis:C($J).describe(`Matching API entries`),total:P().int().describe(`Total matching APIs`),filters:nY.optional().describe(`Applied query filters`)}),WDe=Object.assign(ZJ,{create:e=>e}),GDe=Object.assign($J,{create:e=>e}),KDe=Object.assign(tY,{create:e=>e}),rY=h({url:r().url().describe(`Server base URL`),description:r().optional().describe(`Server description`),variables:d(r(),h({default:r(),description:r().optional(),enum:C(r()).optional()})).optional().describe(`URL template variables`)}),iY=h({type:E([`apiKey`,`http`,`oauth2`,`openIdConnect`]).describe(`Security type`),scheme:r().optional().describe(`HTTP auth scheme (bearer, basic, etc.)`),bearerFormat:r().optional().describe(`Bearer token format (e.g., JWT)`),name:r().optional().describe(`API key parameter name`),in:E([`header`,`query`,`cookie`]).optional().describe(`API key location`),flows:h({implicit:u().optional(),password:u().optional(),clientCredentials:u().optional(),authorizationCode:u().optional()}).optional().describe(`OAuth2 flows`),openIdConnectUrl:r().url().optional().describe(`OpenID Connect discovery URL`),description:r().optional().describe(`Security scheme description`)}),aY=h({openapi:r().default(`3.0.0`).describe(`OpenAPI specification version`),info:h({title:r().describe(`API title`),version:r().describe(`API version`),description:r().optional().describe(`API description`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional(),license:h({name:r(),url:r().url().optional()}).optional()}).describe(`API metadata`),servers:C(rY).optional().default([]).describe(`API servers`),paths:d(r(),u()).describe(`API paths and operations`),components:h({schemas:d(r(),u()).optional(),responses:d(r(),u()).optional(),parameters:d(r(),u()).optional(),examples:d(r(),u()).optional(),requestBodies:d(r(),u()).optional(),headers:d(r(),u()).optional(),securitySchemes:d(r(),iY).optional(),links:d(r(),u()).optional(),callbacks:d(r(),u()).optional()}).optional().describe(`Reusable components`),security:C(d(r(),C(r()))).optional().describe(`Global security requirements`),tags:C(h({name:r(),description:r().optional(),externalDocs:h({description:r().optional(),url:r().url()}).optional()})).optional().describe(`Tag definitions`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation`)}),oY=E([`swagger-ui`,`redoc`,`rapidoc`,`stoplight`,`scalar`,`graphql-playground`,`graphiql`,`postman`,`custom`]),sY=h({type:oY.describe(`Testing UI implementation`),path:r().default(`/api-docs`).describe(`URL path for documentation UI`),theme:E([`light`,`dark`,`auto`]).default(`light`).describe(`UI color theme`),enableTryItOut:S().default(!0).describe(`Enable interactive API testing`),enableFilter:S().default(!0).describe(`Enable endpoint filtering`),enableCors:S().default(!0).describe(`Enable CORS for browser testing`),defaultModelsExpandDepth:P().int().min(-1).default(1).describe(`Default expand depth for schemas (-1 = fully expand)`),displayRequestDuration:S().default(!0).describe(`Show request duration`),syntaxHighlighting:S().default(!0).describe(`Enable syntax highlighting`),customCssUrl:r().url().optional().describe(`Custom CSS stylesheet URL`),customJsUrl:r().url().optional().describe(`Custom JavaScript URL`),layout:h({showExtensions:S().default(!1).describe(`Show vendor extensions`),showCommonExtensions:S().default(!1).describe(`Show common extensions`),deepLinking:S().default(!0).describe(`Enable deep linking`),displayOperationId:S().default(!1).describe(`Display operation IDs`),defaultModelRendering:E([`example`,`model`]).default(`example`).describe(`Default model rendering mode`),defaultModelsExpandDepth:P().int().default(1).describe(`Models expand depth`),defaultModelExpandDepth:P().int().default(1).describe(`Single model expand depth`),docExpansion:E([`list`,`full`,`none`]).default(`list`).describe(`Documentation expansion mode`)}).optional().describe(`Layout configuration`)}),cY=h({name:r().describe(`Test request name`),description:r().optional().describe(`Request description`),method:E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`HEAD`,`OPTIONS`]).describe(`HTTP method`),url:r().describe(`Request URL (can include variables)`),headers:d(r(),r()).optional().default({}).describe(`Request headers`),queryParams:d(r(),l([r(),P(),S()])).optional().default({}).describe(`Query parameters`),body:u().optional().describe(`Request body`),variables:d(r(),u()).optional().default({}).describe(`Template variables`),expectedResponse:h({statusCode:P().int(),body:u().optional()}).optional().describe(`Expected response for validation`)}),lY=h({name:r().describe(`Collection name`),description:r().optional().describe(`Collection description`),variables:d(r(),u()).optional().default({}).describe(`Shared variables`),requests:C(cY).describe(`Test requests in this collection`),folders:C(h({name:r(),description:r().optional(),requests:C(cY)})).optional().describe(`Request folders for organization`)}),uY=h({version:r().describe(`API version`),date:r().date().describe(`Release date`),changes:h({added:C(r()).optional().default([]).describe(`New features`),changed:C(r()).optional().default([]).describe(`Changes`),deprecated:C(r()).optional().default([]).describe(`Deprecations`),removed:C(r()).optional().default([]).describe(`Removed features`),fixed:C(r()).optional().default([]).describe(`Bug fixes`),security:C(r()).optional().default([]).describe(`Security fixes`)}).describe(`Version changes`),migrationGuide:r().optional().describe(`Migration guide URL or text`)}),dY=h({language:r().describe(`Target language/framework (e.g., typescript, python, curl)`),name:r().describe(`Template name`),template:r().describe(`Code template with placeholders`),variables:C(r()).optional().describe(`Required template variables`)}),fY=h({enabled:S().default(!0).describe(`Enable API documentation`),title:r().default(`API Documentation`).describe(`Documentation title`),version:r().describe(`API version`),description:r().optional().describe(`API description`),servers:C(rY).optional().default([]).describe(`API server URLs`),ui:sY.optional().describe(`Testing UI configuration`),generateOpenApi:S().default(!0).describe(`Generate OpenAPI 3.0 specification`),generateTestCollections:S().default(!0).describe(`Generate API test collections`),testCollections:C(lY).optional().default([]).describe(`Predefined test collections`),changelog:C(uY).optional().default([]).describe(`API version changelog`),codeTemplates:C(dY).optional().default([]).describe(`Code generation templates`),termsOfService:r().url().optional().describe(`Terms of service URL`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`Contact information`),license:h({name:r(),url:r().url().optional()}).optional().describe(`API license`),externalDocs:h({description:r().optional(),url:r().url()}).optional().describe(`External documentation link`),securitySchemes:d(r(),iY).optional().describe(`Security scheme definitions`),tags:C(h({name:r(),description:r().optional(),externalDocs:h({description:r().optional(),url:r().url()}).optional()})).optional().describe(`Global tag definitions`)}),qDe=h({openApiSpec:aY.optional().describe(`Generated OpenAPI specification`),testCollections:C(lY).optional().describe(`Generated test collections`),markdown:r().optional().describe(`Generated markdown documentation`),html:r().optional().describe(`Generated HTML documentation`),generatedAt:r().datetime().describe(`Generation timestamp`),sourceApis:C(r()).describe(`Source API IDs used for generation`)}),JDe=Object.assign(fY,{create:e=>e}),YDe=Object.assign(lY,{create:e=>e}),XDe=Object.assign(aY,{create:e=>e}),ZDe=E([`/api/v1/analytics/query`,`/api/v1/analytics/meta`,`/api/v1/analytics/sql`]),QDe=h({query:AN.describe(`The analytic query definition`),cube:r().describe(`Target cube name`),format:E([`json`,`csv`,`xlsx`]).default(`json`).describe(`Response format`)}),$De=J.extend({data:h({rows:C(d(r(),u())).describe(`Result rows`),fields:C(h({name:r(),type:r()})).describe(`Column metadata`),sql:r().optional().describe(`Executed SQL (if debug enabled)`)})}),eOe=h({cube:r().optional().describe(`Optional cube name to filter`)}),tOe=J.extend({data:h({cubes:C(kN).describe(`Available cubes`)})}),nOe=J.extend({data:h({sql:r(),params:C(u())})}),pY=E([`urlPath`,`header`,`queryParam`,`dateBased`]),mY=E([`preview`,`current`,`supported`,`deprecated`,`retired`]),hY=h({version:r().describe(`Version identifier (e.g., "v1", "v2beta1", "2025-01-01")`),status:mY.describe(`Lifecycle status of this version`),releasedAt:r().describe(`Release date (ISO 8601, e.g., "2025-01-15")`),deprecatedAt:r().optional().describe(`Deprecation date (ISO 8601). Only set for deprecated/retired versions`),sunsetAt:r().optional().describe(`Sunset date (ISO 8601). After this date, the version returns 410 Gone`),migrationGuide:r().url().optional().describe(`URL to migration guide for upgrading from this version`),description:r().optional().describe(`Human-readable description or release notes summary`),breakingChanges:C(r()).optional().describe(`List of breaking changes (for preview/new versions)`)}),rOe=h({strategy:pY.default(`urlPath`).describe(`How the API version is specified by clients`),current:r().describe(`The current/recommended API version identifier`),default:r().describe(`Fallback version when client does not specify one`),versions:C(hY).min(1).describe(`All available API versions with lifecycle metadata`),headerName:r().default(`ObjectStack-Version`).describe(`HTTP header name for version negotiation (header/dateBased strategies)`),queryParamName:r().default(`version`).describe(`Query parameter name for version specification (queryParam strategy)`),urlPrefix:r().default(`/api`).describe(`URL prefix before version segment (urlPath strategy)`),deprecation:h({warnHeader:S().default(!0).describe(`Include Deprecation header (RFC 8594) in responses`),sunsetHeader:S().default(!0).describe(`Include Sunset header (RFC 8594) with retirement date`),linkHeader:S().default(!0).describe(`Include Link header pointing to migration guide URL`),rejectRetired:S().default(!0).describe(`Return 410 Gone for retired API versions`),warningMessage:r().optional().describe(`Custom warning message for deprecated version responses`)}).optional().describe(`Deprecation lifecycle behavior`),includeInDiscovery:S().default(!0).describe(`Include version information in the API discovery endpoint`)}),iOe=h({current:r().describe(`Current recommended API version`),requested:r().optional().describe(`Version requested by the client`),resolved:r().describe(`Resolved API version for this request`),supported:C(r()).describe(`All supported version identifiers`),deprecated:C(r()).optional().describe(`Deprecated version identifiers`),versions:C(hY).optional().describe(`Full version definitions with lifecycle metadata`)}),aOe={strategy:`urlPath`,current:`v1`,default:`v1`,versions:[{version:`v1`,status:`current`,releasedAt:`2025-01-15`,description:`ObjectStack API v1 — Initial stable release`}],deprecation:{warnHeader:!0,sunsetHeader:!0,linkHeader:!0,rejectRetired:!0},includeInDiscovery:!0},oOe=E([`local`,`google`,`github`,`microsoft`,`ldap`,`saml`]),gY=h({id:r().describe(`User ID`),email:r().email().describe(`Email address`),emailVerified:S().default(!1).describe(`Is email verified?`),name:r().describe(`Display name`),image:r().optional().describe(`Avatar URL`),username:r().optional().describe(`Username (optional)`),roles:C(r()).optional().default([]).describe(`Assigned role IDs`),tenantId:r().optional().describe(`Current tenant ID`),language:r().default(`en`).describe(`Preferred language`),timezone:r().optional().describe(`Preferred timezone`),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional()}),_Y=h({id:r(),expiresAt:r().datetime(),token:r().optional(),ipAddress:r().optional(),userAgent:r().optional(),userId:r()}),vY=E([`email`,`username`,`phone`,`magic-link`,`social`]),sOe=h({type:vY.default(`email`).describe(`Login method`),email:r().email().optional().describe(`Required for email/magic-link`),username:r().optional().describe(`Required for username login`),password:r().optional().describe(`Required for password login`),provider:r().optional().describe(`Required for social (google, github)`),redirectTo:r().optional().describe(`Redirect URL after successful login`)}),cOe=h({email:r().email(),password:r(),name:r(),image:r().optional()}),lOe=h({refreshToken:r().describe(`Refresh token`)}),uOe=J.extend({data:h({session:_Y.describe(`Active Session Info`),user:gY.describe(`Current User Details`),token:r().optional().describe(`Bearer token if not using cookies`)})}),dOe=J.extend({data:gY}),yY={signInEmail:`/sign-in/email`,signUpEmail:`/sign-up/email`,signOut:`/sign-out`,getSession:`/get-session`,forgetPassword:`/forget-password`,resetPassword:`/reset-password`,sendVerificationEmail:`/send-verification-email`,verifyEmail:`/verify-email`,twoFactorEnable:`/two-factor/enable`,twoFactorVerify:`/two-factor/verify`,passkeyRegister:`/passkey/register`,passkeyAuthenticate:`/passkey/authenticate`,magicLinkSend:`/magic-link/send`,magicLinkVerify:`/magic-link/verify`},fOe=h({signInEmail:h({method:m(`POST`),path:m(yY.signInEmail),description:m(`Sign in with email and password`)}),signUpEmail:h({method:m(`POST`),path:m(yY.signUpEmail),description:m(`Register new user with email and password`)}),signOut:h({method:m(`POST`),path:m(yY.signOut),description:m(`Sign out current user`)}),getSession:h({method:m(`GET`),path:m(yY.getSession),description:m(`Get current user session`)}),forgetPassword:h({method:m(`POST`),path:m(yY.forgetPassword),description:m(`Request password reset email`)}),resetPassword:h({method:m(`POST`),path:m(yY.resetPassword),description:m(`Reset password with token`)}),sendVerificationEmail:h({method:m(`POST`),path:m(yY.sendVerificationEmail),description:m(`Send email verification link`)}),verifyEmail:h({method:m(`GET`),path:m(yY.verifyEmail),description:m(`Verify email with token`)})}),pOe={login:yY.signInEmail,register:yY.signUpEmail,logout:yY.signOut,me:yY.getSession};function mOe(e,t){return`${e.replace(/\/$/,``)}${yY[t]}`}var hOe={"/login":yY.signInEmail,"/register":yY.signUpEmail,"/logout":yY.signOut,"/me":yY.getSession,"/refresh":yY.getSession},bY=h({id:r().describe(`Provider ID (e.g., google, github, microsoft)`),name:r().describe(`Display name (e.g., Google, GitHub)`),enabled:S().describe(`Whether this provider is enabled`)}),xY=h({enabled:S().describe(`Whether email/password auth is enabled`),disableSignUp:S().optional().describe(`Whether new user registration is disabled`),requireEmailVerification:S().optional().describe(`Whether email verification is required`)}),SY=h({twoFactor:S().default(!1).describe(`Two-factor authentication enabled`),passkeys:S().default(!1).describe(`Passkey/WebAuthn support enabled`),magicLink:S().default(!1).describe(`Magic link login enabled`),organization:S().default(!1).describe(`Multi-tenant organization support enabled`)}),gOe=h({emailPassword:xY.describe(`Email/password authentication config`),socialProviders:C(bY).describe(`Available social/OAuth providers`),features:SY.describe(`Enabled authentication features`)}),CY=h({filename:r().describe(`Original filename`),mimeType:r().describe(`File MIME type`),size:P().describe(`File size in bytes`),scope:r().default(`user`).describe(`Target storage scope (e.g. user, private, public)`),bucket:r().optional().describe(`Specific bucket override (admin only)`)}),wY=h({fileId:r().describe(`File ID returned from presigned request`),eTag:r().optional().describe(`S3 ETag verification`)}),TY=J.extend({data:h({uploadUrl:r().describe(`PUT/POST URL for direct upload`),downloadUrl:r().optional().describe(`Public/Private preview URL`),fileId:r().describe(`Temporary File ID`),method:E([`PUT`,`POST`]).describe(`HTTP Method to use`),headers:d(r(),r()).optional().describe(`Required headers for upload`),expiresIn:P().describe(`URL expiry in seconds`)})}),EY=J.extend({data:uL.describe(`Uploaded file metadata`)}),_Oe=h({mode:E([`whitelist`,`blacklist`]).describe(`whitelist = only allow listed types, blacklist = block listed types`),mimeTypes:C(r()).min(1).describe(`List of MIME types to allow or block (e.g., "image/jpeg", "application/pdf")`),extensions:C(r()).optional().describe(`List of file extensions to allow or block (e.g., ".jpg", ".pdf")`),maxFileSize:P().int().min(1).optional().describe(`Maximum file size in bytes`),minFileSize:P().int().min(0).optional().describe(`Minimum file size in bytes (e.g., reject empty files)`)}),DY=h({filename:r().describe(`Original filename`),mimeType:r().describe(`File MIME type`),totalSize:P().int().min(1).describe(`Total file size in bytes`),chunkSize:P().int().min(5242880).default(5242880).describe(`Size of each chunk in bytes (minimum 5MB per S3 spec)`),scope:r().default(`user`).describe(`Target storage scope`),bucket:r().optional().describe(`Specific bucket override (admin only)`),metadata:d(r(),r()).optional().describe(`Custom metadata key-value pairs`)}),OY=J.extend({data:h({uploadId:r().describe(`Multipart upload session ID`),resumeToken:r().describe(`Opaque token for resuming interrupted uploads`),fileId:r().describe(`Assigned file ID`),totalChunks:P().int().min(1).describe(`Expected number of chunks`),chunkSize:P().int().describe(`Chunk size in bytes`),expiresAt:r().datetime().describe(`Upload session expiration timestamp`)})}),kY=h({uploadId:r().describe(`Multipart upload session ID`),chunkIndex:P().int().min(0).describe(`Zero-based chunk index`),resumeToken:r().describe(`Resume token from initiate response`)}),AY=J.extend({data:h({chunkIndex:P().int().describe(`Chunk index that was uploaded`),eTag:r().describe(`Chunk ETag for multipart completion`),bytesReceived:P().int().describe(`Bytes received for this chunk`)})}),jY=h({uploadId:r().describe(`Multipart upload session ID`),parts:C(h({chunkIndex:P().int().describe(`Chunk index`),eTag:r().describe(`ETag returned from chunk upload`)})).min(1).describe(`Ordered list of uploaded parts for assembly`)}),MY=J.extend({data:h({fileId:r().describe(`Final file ID`),key:r().describe(`Storage key/path of the assembled file`),size:P().int().describe(`Total file size in bytes`),mimeType:r().describe(`File MIME type`),eTag:r().optional().describe(`Final ETag of the assembled file`),url:r().optional().describe(`Download URL for the assembled file`)})}),NY=J.extend({data:h({uploadId:r().describe(`Multipart upload session ID`),fileId:r().describe(`Assigned file ID`),filename:r().describe(`Original filename`),totalSize:P().int().describe(`Total file size in bytes`),uploadedSize:P().int().describe(`Bytes uploaded so far`),totalChunks:P().int().describe(`Total expected chunks`),uploadedChunks:P().int().describe(`Number of chunks uploaded`),percentComplete:P().min(0).max(100).describe(`Upload progress percentage`),status:E([`in_progress`,`completing`,`completed`,`failed`,`expired`]).describe(`Current upload session status`),startedAt:r().datetime().describe(`Upload session start timestamp`),expiresAt:r().datetime().describe(`Session expiration timestamp`)})}),vOe={getPresignedUrl:{method:`POST`,path:`/api/v1/storage/upload/presigned`,input:CY,output:TY},completeUpload:{method:`POST`,path:`/api/v1/storage/upload/complete`,input:wY,output:EY},initiateChunkedUpload:{method:`POST`,path:`/api/v1/storage/upload/chunked`,input:DY,output:OY},uploadChunk:{method:`PUT`,path:`/api/v1/storage/upload/chunked/:uploadId/chunk/:chunkIndex`,input:kY,output:AY},completeChunkedUpload:{method:`POST`,path:`/api/v1/storage/upload/chunked/:uploadId/complete`,input:jY,output:MY},getUploadProgress:{method:`GET`,path:`/api/v1/storage/upload/chunked/:uploadId/progress`,output:NY}},yOe=J.extend({data:gM.describe(`Full Object Schema`)}),bOe=J.extend({data:NP.describe(`Full App Configuration`)}),xOe=J.extend({data:C(h({name:r(),label:r(),icon:r().optional(),description:r().optional()})).describe(`List of available concepts (Objects, Apps, Flows)`)}),SOe=h({type:JV.describe(`Metadata type`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Item name (snake_case)`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Optional namespace`)}),COe=J.extend({data:h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),definition:d(r(),u()).describe(`Metadata definition payload`)}).describe(`Metadata item`)}),wOe=J.extend({data:C(d(r(),u())).describe(`Array of metadata definitions`)}),TOe=J.extend({data:C(r()).describe(`Array of metadata item names`)}),EOe=J.extend({data:h({exists:S().describe(`Whether the item exists`)})}),DOe=J.extend({data:h({type:r().describe(`Metadata type`),name:r().describe(`Deleted item name`)})}),OOe=XV.describe(`Metadata query with filtering, sorting, and pagination`),kOe=J.extend({data:ZV.describe(`Paginated query result`)}),AOe=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue on individual failure`),validate:S().default(!0).describe(`Validate before registering`)}),jOe=h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`)})).min(1).describe(`Items to unregister`)}),MOe=J.extend({data:eH.describe(`Bulk operation result`)}),NOe=J.extend({data:BV.optional().describe(`Overlay definition, undefined if none`)}),POe=BV.describe(`Overlay to save`),FOe=J.extend({data:d(r(),u()).optional().describe(`Effective metadata with all overlays applied`)}),IOe=h({types:C(r()).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),format:E([`json`,`yaml`]).default(`json`).describe(`Export format`)}),LOe=J.extend({data:u().describe(`Exported metadata bundle`)}),ROe=h({data:u().describe(`Metadata bundle to import`),conflictResolution:E([`skip`,`overwrite`,`merge`]).default(`skip`).describe(`Conflict resolution strategy`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Dry run (no save)`)}),zOe=J.extend({data:h({total:P().int().min(0),imported:P().int().min(0),skipped:P().int().min(0),failed:P().int().min(0),errors:C(h({type:r(),name:r(),error:r()})).optional()}).describe(`Import result`)}),BOe=h({type:r().describe(`Metadata type to validate against`),data:u().describe(`Metadata payload to validate`)}),VOe=J.extend({data:QV.describe(`Validation result`)}),HOe=J.extend({data:C(r()).describe(`Registered metadata type identifiers`)}),UOe=J.extend({data:h({type:r().describe(`Metadata type identifier`),label:r().describe(`Display label`),description:r().optional().describe(`Description`),filePatterns:C(r()).describe(`File glob patterns`),supportsOverlay:S().describe(`Overlay support`),domain:r().describe(`Protocol domain`)}).optional().describe(`Type info`)}),WOe=J.extend({data:C(tH).describe(`Items this item depends on`)}),GOe=J.extend({data:C(tH).describe(`Items that depend on this item`)}),PY=h({prefix:r().regex(/^\//).describe(`URL path prefix for routing (e.g. /api/v1/data)`),service:yB.describe(`Target core service name`),authRequired:S().default(!0).describe(`Whether authentication is required`),criticality:bB.default(`optional`).describe(`Service criticality level for unavailability handling`),permissions:C(r()).optional().describe(`Required permissions for this route namespace`)}),KOe=h({routes:C(PY).describe(`Route-to-service mappings`),fallback:E([`404`,`proxy`,`custom`]).default(`404`).describe(`Behavior when no route matches`),proxyTarget:r().url().optional().describe(`Proxy target URL when fallback is "proxy"`)}),qOe=[{prefix:`/api/v1/discovery`,service:`metadata`,authRequired:!1,criticality:`required`},{prefix:`/api/v1/health`,service:`metadata`,authRequired:!1,criticality:`required`},{prefix:`/api/v1/meta`,service:`metadata`,criticality:`required`},{prefix:`/api/v1/data`,service:`data`,criticality:`required`},{prefix:`/api/v1/auth`,service:`auth`,criticality:`required`},{prefix:`/api/v1/packages`,service:`metadata`},{prefix:`/api/v1/ui`,service:`ui`},{prefix:`/api/v1/workflow`,service:`workflow`},{prefix:`/api/v1/analytics`,service:`analytics`},{prefix:`/api/v1/automation`,service:`automation`},{prefix:`/api/v1/storage`,service:`file-storage`},{prefix:`/api/v1/feed`,service:`data`},{prefix:`/api/v1/i18n`,service:`i18n`},{prefix:`/api/v1/notifications`,service:`notification`},{prefix:`/api/v1/realtime`,service:`realtime`},{prefix:`/api/v1/ai`,service:`ai`}],JOe=E([`404`,`405`,`501`,`503`]).describe(`404 = route not found, 405 = method not allowed, 501 = not implemented (stub), 503 = service unavailable`),YOe=h({success:m(!1),error:h({code:P().int().describe(`HTTP status code (404, 405, 501, 503, …)`),message:r().describe(`Human-readable error message`),type:E([`ROUTE_NOT_FOUND`,`METHOD_NOT_ALLOWED`,`NOT_IMPLEMENTED`,`SERVICE_UNAVAILABLE`]).optional().describe(`Machine-readable error type`),route:r().optional().describe(`Requested route path`),service:r().optional().describe(`Target service name, if resolvable`),hint:r().optional().describe(`Actionable hint for the developer (e.g., "Install plugin-workflow")`)})}),FY=E([`discovery`,`metadata`,`data`,`batch`,`permission`,`analytics`,`automation`,`workflow`,`ui`,`realtime`,`notification`,`ai`,`i18n`]),IY=E([`implemented`,`stub`,`planned`]),LY=h({method:NA.describe(`HTTP method for this endpoint`),path:r().describe(`URL path pattern (e.g., /api/v1/data/:object/:id)`),handler:r().describe(`Protocol method name or handler identifier`),category:FY.describe(`Route category`),public:S().default(!1).describe(`Is publicly accessible without authentication`),permissions:C(r()).optional().describe(`Required permissions (e.g., ["data.read", "object.account.read"])`),summary:r().optional().describe(`Short description for OpenAPI`),description:r().optional().describe(`Detailed description for OpenAPI`),tags:C(r()).optional().describe(`OpenAPI tags for grouping`),requestSchema:r().optional().describe(`Request schema name (for validation)`),responseSchema:r().optional().describe(`Response schema name (for documentation)`),timeout:P().int().optional().describe(`Request timeout in milliseconds`),rateLimit:r().optional().describe(`Rate limit policy name`),cacheable:S().default(!1).describe(`Whether response can be cached`),cacheTtl:P().int().optional().describe(`Cache TTL in seconds`),handlerStatus:IY.optional().describe(`Handler implementation status: implemented (default if omitted), stub, or planned`)}),RY=h({prefix:r().regex(/^\//).describe(`URL path prefix for this route group`),service:r().describe(`Core service name (metadata, data, auth, etc.)`),category:FY.describe(`Primary category for this route group`),methods:C(r()).optional().describe(`Protocol method names implemented`),endpoints:C(LY).optional().describe(`Endpoint definitions`),middleware:C(OL).optional().describe(`Middleware stack for this route group`),authRequired:S().default(!0).describe(`Whether authentication is required by default`),documentation:h({title:r().optional().describe(`Route group title`),description:r().optional().describe(`Route group description`),tags:C(r()).optional().describe(`OpenAPI tags`)}).optional().describe(`Documentation metadata for this route group`)}),zY=E([`strict`,`permissive`,`strip`]),BY=h({enabled:S().default(!0).describe(`Enable automatic request validation`),mode:zY.default(`strict`).describe(`How to handle validation errors`),validateBody:S().default(!0).describe(`Validate request body against schema`),validateQuery:S().default(!0).describe(`Validate query string parameters`),validateParams:S().default(!0).describe(`Validate URL path parameters`),validateHeaders:S().default(!1).describe(`Validate request headers`),includeFieldErrors:S().default(!0).describe(`Include field-level error details in response`),errorPrefix:r().optional().describe(`Custom prefix for validation error messages`),schemaRegistry:r().optional().describe(`Schema registry name to use for validation`)}),VY=h({enabled:S().default(!0).describe(`Enable automatic response envelope wrapping`),includeMetadata:S().default(!0).describe(`Include meta object in responses`),includeTimestamp:S().default(!0).describe(`Include timestamp in response metadata`),includeRequestId:S().default(!0).describe(`Include requestId in response metadata`),includeDuration:S().default(!1).describe(`Include request duration in ms`),includeTraceId:S().default(!1).describe(`Include distributed traceId`),customMetadata:d(r(),u()).optional().describe(`Additional metadata fields to include`),skipIfWrapped:S().default(!0).describe(`Skip wrapping if response already has success field`)}),HY=h({enabled:S().default(!0).describe(`Enable standardized error handling`),includeStackTrace:S().default(!1).describe(`Include stack traces in error responses`),logErrors:S().default(!0).describe(`Log errors to system logger`),exposeInternalErrors:S().default(!1).describe(`Expose internal error details in responses`),includeRequestId:S().default(!0).describe(`Include requestId in error responses`),includeTimestamp:S().default(!0).describe(`Include timestamp in error responses`),includeDocumentation:S().default(!0).describe(`Include documentation URLs for errors`),documentationBaseUrl:r().url().optional().describe(`Base URL for error documentation`),customErrorMessages:d(r(),r()).optional().describe(`Custom error messages by error code`),redactFields:C(r()).optional().describe(`Field names to redact from error details`)}),UY=h({enabled:S().default(!0).describe(`Enable automatic OpenAPI documentation generation`),version:E([`3.0.0`,`3.0.1`,`3.0.2`,`3.0.3`,`3.1.0`]).default(`3.0.3`).describe(`OpenAPI specification version`),title:r().default(`ObjectStack API`).describe(`API title`),description:r().optional().describe(`API description`),apiVersion:r().default(`1.0.0`).describe(`API version`),outputPath:r().default(`/api/docs/openapi.json`).describe(`URL path to serve OpenAPI JSON`),uiPath:r().default(`/api/docs`).describe(`URL path to serve documentation UI`),uiFramework:E([`swagger-ui`,`redoc`,`rapidoc`,`elements`]).default(`swagger-ui`).describe(`Documentation UI framework`),includeInternal:S().default(!1).describe(`Include internal endpoints in documentation`),generateSchemas:S().default(!0).describe(`Auto-generate schemas from Zod definitions`),includeExamples:S().default(!0).describe(`Include request/response examples`),servers:C(h({url:r().describe(`Server URL`),description:r().optional().describe(`Server description`)})).optional().describe(`Server URLs for API`),contact:h({name:r().optional(),url:r().url().optional(),email:r().email().optional()}).optional().describe(`API contact information`),license:h({name:r().describe(`License name`),url:r().url().optional().describe(`License URL`)}).optional().describe(`API license information`),securitySchemes:d(r(),h({type:E([`apiKey`,`http`,`oauth2`,`openIdConnect`]),scheme:r().optional(),bearerFormat:r().optional()})).optional().describe(`Security scheme definitions`)}),WY=h({enabled:S().default(!0).describe(`Enable REST API plugin`),basePath:r().default(`/api`).describe(`Base path for all API routes`),version:r().default(`v1`).describe(`API version identifier`),routes:C(RY).describe(`Route registrations`),validation:BY.optional().describe(`Request validation configuration`),responseEnvelope:VY.optional().describe(`Response envelope configuration`),errorHandling:HY.optional().describe(`Error handling configuration`),openApi:UY.optional().describe(`OpenAPI documentation configuration`),globalMiddleware:C(OL).optional().describe(`Global middleware stack`),cors:h({enabled:S().default(!0),origins:C(r()).optional(),methods:C(NA).optional(),credentials:S().default(!0)}).optional().describe(`CORS configuration`),performance:h({enableCompression:S().default(!0).describe(`Enable response compression`),enableETag:S().default(!0).describe(`Enable ETag generation`),enableCaching:S().default(!0).describe(`Enable HTTP caching`),defaultCacheTtl:P().int().default(300).describe(`Default cache TTL in seconds`)}).optional().describe(`Performance optimization settings`)}),XOe={prefix:`/api/v1/discovery`,service:`metadata`,category:`discovery`,methods:[`getDiscovery`],authRequired:!1,endpoints:[{method:`GET`,path:``,handler:`getDiscovery`,category:`discovery`,public:!0,summary:`Get API discovery information`,description:`Returns API version, capabilities, and available routes`,tags:[`Discovery`],responseSchema:`GetDiscoveryResponseSchema`,cacheable:!0,cacheTtl:3600}],middleware:[{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},GY={prefix:`/api/v1/meta`,service:`metadata`,category:`metadata`,methods:[`getMetaTypes`,`getMetaItems`,`getMetaItem`,`saveMetaItem`],authRequired:!0,endpoints:[{method:`GET`,path:``,handler:`getMetaTypes`,category:`metadata`,public:!1,summary:`List all metadata types`,description:`Returns available metadata types (object, field, view, etc.)`,tags:[`Metadata`],responseSchema:`GetMetaTypesResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`GET`,path:`/:type`,handler:`getMetaItems`,category:`metadata`,public:!1,summary:`List metadata items of a type`,description:`Returns all items of the specified metadata type`,tags:[`Metadata`],responseSchema:`GetMetaItemsResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`GET`,path:`/:type/:name`,handler:`getMetaItem`,category:`metadata`,public:!1,summary:`Get specific metadata item`,description:`Returns a specific metadata item by type and name`,tags:[`Metadata`],requestSchema:`GetMetaItemRequestSchema`,responseSchema:`GetMetaItemResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`PUT`,path:`/:type/:name`,handler:`saveMetaItem`,category:`metadata`,public:!1,summary:`Create or update metadata item`,description:`Creates or updates a metadata item`,tags:[`Metadata`],requestSchema:`SaveMetaItemRequestSchema`,responseSchema:`SaveMetaItemResponseSchema`,permissions:[`metadata.write`],cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},KY={prefix:`/api/v1/data`,service:`data`,category:`data`,methods:[`findData`,`getData`,`createData`,`updateData`,`deleteData`],authRequired:!0,endpoints:[{method:`GET`,path:`/:object`,handler:`findData`,category:`data`,public:!1,summary:`Query records`,description:`Query records with filtering, sorting, and pagination`,tags:[`Data`],requestSchema:`FindDataRequestSchema`,responseSchema:`ListRecordResponseSchema`,permissions:[`data.read`],cacheable:!1},{method:`GET`,path:`/:object/:id`,handler:`getData`,category:`data`,public:!1,summary:`Get record by ID`,description:`Retrieve a single record by its ID`,tags:[`Data`],requestSchema:`IdRequestSchema`,responseSchema:`SingleRecordResponseSchema`,permissions:[`data.read`],cacheable:!1},{method:`POST`,path:`/:object`,handler:`createData`,category:`data`,public:!1,summary:`Create record`,description:`Create a new record`,tags:[`Data`],requestSchema:`CreateRequestSchema`,responseSchema:`SingleRecordResponseSchema`,permissions:[`data.create`],cacheable:!1},{method:`PATCH`,path:`/:object/:id`,handler:`updateData`,category:`data`,public:!1,summary:`Update record`,description:`Update an existing record`,tags:[`Data`],requestSchema:`UpdateRequestSchema`,responseSchema:`SingleRecordResponseSchema`,permissions:[`data.update`],cacheable:!1},{method:`DELETE`,path:`/:object/:id`,handler:`deleteData`,category:`data`,public:!1,summary:`Delete record`,description:`Delete a record by ID`,tags:[`Data`],requestSchema:`IdRequestSchema`,responseSchema:`DeleteResponseSchema`,permissions:[`data.delete`],cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},qY={prefix:`/api/v1/data/:object`,service:`data`,category:`batch`,methods:[`batchData`,`createManyData`,`updateManyData`,`deleteManyData`],authRequired:!0,endpoints:[{method:`POST`,path:`/batch`,handler:`batchData`,category:`batch`,public:!1,summary:`Batch operation`,description:`Execute a batch operation (create, update, upsert, delete)`,tags:[`Batch`],requestSchema:`BatchUpdateRequestSchema`,responseSchema:`BatchUpdateResponseSchema`,permissions:[`data.batch`],timeout:6e4,cacheable:!1},{method:`POST`,path:`/createMany`,handler:`createManyData`,category:`batch`,public:!1,summary:`Batch create`,description:`Create multiple records in a single operation`,tags:[`Batch`],requestSchema:`CreateManyRequestSchema`,responseSchema:`BatchUpdateResponseSchema`,permissions:[`data.create`,`data.batch`],timeout:6e4,cacheable:!1},{method:`POST`,path:`/updateMany`,handler:`updateManyData`,category:`batch`,public:!1,summary:`Batch update`,description:`Update multiple records in a single operation`,tags:[`Batch`],requestSchema:`UpdateManyRequestSchema`,responseSchema:`BatchUpdateResponseSchema`,permissions:[`data.update`,`data.batch`],timeout:6e4,cacheable:!1},{method:`POST`,path:`/deleteMany`,handler:`deleteManyData`,category:`batch`,public:!1,summary:`Batch delete`,description:`Delete multiple records in a single operation`,tags:[`Batch`],requestSchema:`DeleteManyRequestSchema`,responseSchema:`BatchUpdateResponseSchema`,permissions:[`data.delete`,`data.batch`],timeout:6e4,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},JY={prefix:`/api/v1/auth`,service:`auth`,category:`permission`,methods:[`checkPermission`,`getObjectPermissions`,`getEffectivePermissions`],authRequired:!0,endpoints:[{method:`POST`,path:`/check`,handler:`checkPermission`,category:`permission`,public:!1,summary:`Check permission`,description:`Check if current user has a specific permission`,tags:[`Permission`],requestSchema:`CheckPermissionRequestSchema`,responseSchema:`CheckPermissionResponseSchema`,cacheable:!1},{method:`GET`,path:`/permissions/:object`,handler:`getObjectPermissions`,category:`permission`,public:!1,summary:`Get object permissions`,description:`Get all permissions for a specific object`,tags:[`Permission`],responseSchema:`ObjectPermissionsResponseSchema`,cacheable:!0,cacheTtl:300},{method:`GET`,path:`/permissions/effective`,handler:`getEffectivePermissions`,category:`permission`,public:!1,summary:`Get effective permissions`,description:`Get all effective permissions for current user`,tags:[`Permission`],responseSchema:`EffectivePermissionsResponseSchema`,cacheable:!0,cacheTtl:300}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},YY={prefix:`/api/v1/ui`,service:`ui`,category:`ui`,methods:[`listViews`,`getView`,`createView`,`updateView`,`deleteView`],authRequired:!0,endpoints:[{method:`GET`,path:`/views/:object`,handler:`listViews`,category:`ui`,public:!1,summary:`List views for an object`,description:`Returns all views (list, form) for the specified object`,tags:[`Views`,`UI`],responseSchema:`ListViewsResponseSchema`,cacheable:!0,cacheTtl:1800},{method:`GET`,path:`/views/:object/:viewId`,handler:`getView`,category:`ui`,public:!1,summary:`Get a specific view`,description:`Returns a specific view definition by object and view ID`,tags:[`Views`,`UI`],responseSchema:`GetViewResponseSchema`,cacheable:!0,cacheTtl:1800},{method:`POST`,path:`/views/:object`,handler:`createView`,category:`ui`,public:!1,summary:`Create a new view`,description:`Creates a new view definition for the specified object`,tags:[`Views`,`UI`],requestSchema:`CreateViewRequestSchema`,responseSchema:`CreateViewResponseSchema`,permissions:[`ui.view.create`],cacheable:!1},{method:`PATCH`,path:`/views/:object/:viewId`,handler:`updateView`,category:`ui`,public:!1,summary:`Update a view`,description:`Updates an existing view definition`,tags:[`Views`,`UI`],requestSchema:`UpdateViewRequestSchema`,responseSchema:`UpdateViewResponseSchema`,permissions:[`ui.view.update`],cacheable:!1},{method:`DELETE`,path:`/views/:object/:viewId`,handler:`deleteView`,category:`ui`,public:!1,summary:`Delete a view`,description:`Deletes a view definition`,tags:[`Views`,`UI`],responseSchema:`DeleteViewResponseSchema`,permissions:[`ui.view.delete`],cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},XY={prefix:`/api/v1/workflow`,service:`workflow`,category:`workflow`,methods:[`getWorkflowConfig`,`getWorkflowState`,`workflowTransition`,`workflowApprove`,`workflowReject`],authRequired:!0,endpoints:[{method:`GET`,path:`/:object/config`,handler:`getWorkflowConfig`,category:`workflow`,public:!1,summary:`Get workflow configuration`,description:`Returns workflow rules and state machine configuration for an object`,tags:[`Workflow`],responseSchema:`GetWorkflowConfigResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`GET`,path:`/:object/:recordId/state`,handler:`getWorkflowState`,category:`workflow`,public:!1,summary:`Get workflow state`,description:`Returns current workflow state and available transitions for a record`,tags:[`Workflow`],responseSchema:`GetWorkflowStateResponseSchema`,cacheable:!1},{method:`POST`,path:`/:object/:recordId/transition`,handler:`workflowTransition`,category:`workflow`,public:!1,summary:`Execute workflow transition`,description:`Transitions a record to a new workflow state`,tags:[`Workflow`],requestSchema:`WorkflowTransitionRequestSchema`,responseSchema:`WorkflowTransitionResponseSchema`,permissions:[`workflow.transition`],cacheable:!1},{method:`POST`,path:`/:object/:recordId/approve`,handler:`workflowApprove`,category:`workflow`,public:!1,summary:`Approve workflow step`,description:`Approves a pending workflow approval step`,tags:[`Workflow`],requestSchema:`WorkflowApproveRequestSchema`,responseSchema:`WorkflowApproveResponseSchema`,permissions:[`workflow.approve`],cacheable:!1},{method:`POST`,path:`/:object/:recordId/reject`,handler:`workflowReject`,category:`workflow`,public:!1,summary:`Reject workflow step`,description:`Rejects a pending workflow approval step`,tags:[`Workflow`],requestSchema:`WorkflowRejectRequestSchema`,responseSchema:`WorkflowRejectResponseSchema`,permissions:[`workflow.reject`],cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},ZY={prefix:`/api/v1/realtime`,service:`realtime`,category:`realtime`,methods:[`realtimeConnect`,`realtimeDisconnect`,`realtimeSubscribe`,`realtimeUnsubscribe`,`setPresence`,`getPresence`],authRequired:!0,endpoints:[{method:`POST`,path:`/connect`,handler:`realtimeConnect`,category:`realtime`,public:!1,summary:`Establish realtime connection`,description:`Negotiates a realtime connection (WebSocket/SSE) and returns connection details`,tags:[`Realtime`],requestSchema:`RealtimeConnectRequestSchema`,responseSchema:`RealtimeConnectResponseSchema`,cacheable:!1},{method:`POST`,path:`/disconnect`,handler:`realtimeDisconnect`,category:`realtime`,public:!1,summary:`Close realtime connection`,description:`Closes an active realtime connection`,tags:[`Realtime`],requestSchema:`RealtimeDisconnectRequestSchema`,responseSchema:`RealtimeDisconnectResponseSchema`,cacheable:!1},{method:`POST`,path:`/subscribe`,handler:`realtimeSubscribe`,category:`realtime`,public:!1,summary:`Subscribe to channel`,description:`Subscribes to a realtime channel for receiving events`,tags:[`Realtime`],requestSchema:`RealtimeSubscribeRequestSchema`,responseSchema:`RealtimeSubscribeResponseSchema`,cacheable:!1},{method:`POST`,path:`/unsubscribe`,handler:`realtimeUnsubscribe`,category:`realtime`,public:!1,summary:`Unsubscribe from channel`,description:`Unsubscribes from a realtime channel`,tags:[`Realtime`],requestSchema:`RealtimeUnsubscribeRequestSchema`,responseSchema:`RealtimeUnsubscribeResponseSchema`,cacheable:!1},{method:`PUT`,path:`/presence/:channel`,handler:`setPresence`,category:`realtime`,public:!1,summary:`Set presence state`,description:`Sets the current user's presence state in a channel`,tags:[`Realtime`],requestSchema:`SetPresenceRequestSchema`,responseSchema:`SetPresenceResponseSchema`,cacheable:!1},{method:`GET`,path:`/presence/:channel`,handler:`getPresence`,category:`realtime`,public:!1,summary:`Get channel presence`,description:`Returns all active members and their presence state in a channel`,tags:[`Realtime`],responseSchema:`GetPresenceResponseSchema`,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},QY={prefix:`/api/v1/notifications`,service:`notification`,category:`notification`,methods:[`registerDevice`,`unregisterDevice`,`getNotificationPreferences`,`updateNotificationPreferences`,`listNotifications`,`markNotificationsRead`,`markAllNotificationsRead`],authRequired:!0,endpoints:[{method:`POST`,path:`/devices`,handler:`registerDevice`,category:`notification`,public:!1,summary:`Register device for push notifications`,description:`Registers a device token for receiving push notifications`,tags:[`Notifications`],requestSchema:`RegisterDeviceRequestSchema`,responseSchema:`RegisterDeviceResponseSchema`,cacheable:!1},{method:`DELETE`,path:`/devices/:deviceId`,handler:`unregisterDevice`,category:`notification`,public:!1,summary:`Unregister device`,description:`Removes a device from push notification registration`,tags:[`Notifications`],responseSchema:`UnregisterDeviceResponseSchema`,cacheable:!1},{method:`GET`,path:`/preferences`,handler:`getNotificationPreferences`,category:`notification`,public:!1,summary:`Get notification preferences`,description:`Returns current user notification preferences`,tags:[`Notifications`],responseSchema:`GetNotificationPreferencesResponseSchema`,cacheable:!1},{method:`PATCH`,path:`/preferences`,handler:`updateNotificationPreferences`,category:`notification`,public:!1,summary:`Update notification preferences`,description:`Updates user notification preferences`,tags:[`Notifications`],requestSchema:`UpdateNotificationPreferencesRequestSchema`,responseSchema:`UpdateNotificationPreferencesResponseSchema`,cacheable:!1},{method:`GET`,path:``,handler:`listNotifications`,category:`notification`,public:!1,summary:`List notifications`,description:`Returns paginated list of notifications for the current user`,tags:[`Notifications`],responseSchema:`ListNotificationsResponseSchema`,cacheable:!1},{method:`POST`,path:`/read`,handler:`markNotificationsRead`,category:`notification`,public:!1,summary:`Mark notifications as read`,description:`Marks specific notifications as read by their IDs`,tags:[`Notifications`],requestSchema:`MarkNotificationsReadRequestSchema`,responseSchema:`MarkNotificationsReadResponseSchema`,cacheable:!1},{method:`POST`,path:`/read/all`,handler:`markAllNotificationsRead`,category:`notification`,public:!1,summary:`Mark all notifications as read`,description:`Marks all notifications as read for the current user`,tags:[`Notifications`],responseSchema:`MarkAllNotificationsReadResponseSchema`,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},$Y={prefix:`/api/v1/ai`,service:`ai`,category:`ai`,methods:[`aiNlq`,`aiSuggest`,`aiInsights`],authRequired:!0,endpoints:[{method:`POST`,path:`/nlq`,handler:`aiNlq`,category:`ai`,public:!1,summary:`Natural language query`,description:`Converts a natural language query to a structured query AST`,tags:[`AI`],requestSchema:`AiNlqRequestSchema`,responseSchema:`AiNlqResponseSchema`,timeout:3e4,cacheable:!1},{method:`POST`,path:`/suggest`,handler:`aiSuggest`,category:`ai`,public:!1,summary:`Get AI-powered suggestions`,description:`Returns AI-generated field value suggestions based on context`,tags:[`AI`],requestSchema:`AiSuggestRequestSchema`,responseSchema:`AiSuggestResponseSchema`,timeout:15e3,cacheable:!1},{method:`POST`,path:`/insights`,handler:`aiInsights`,category:`ai`,public:!1,summary:`Get AI-generated insights`,description:`Returns AI-generated insights (summaries, trends, anomalies, recommendations)`,tags:[`AI`],requestSchema:`AiInsightsRequestSchema`,responseSchema:`AiInsightsResponseSchema`,timeout:6e4,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},eX={prefix:`/api/v1/i18n`,service:`i18n`,category:`i18n`,methods:[`getLocales`,`getTranslations`,`getFieldLabels`],authRequired:!0,endpoints:[{method:`GET`,path:`/locales`,handler:`getLocales`,category:`i18n`,public:!1,summary:`Get available locales`,description:`Returns all available locales with their metadata`,tags:[`i18n`],responseSchema:`GetLocalesResponseSchema`,cacheable:!0,cacheTtl:86400},{method:`GET`,path:`/translations/:locale`,handler:`getTranslations`,category:`i18n`,public:!1,summary:`Get translations for a locale`,description:`Returns translation strings for the specified locale and optional namespace`,tags:[`i18n`],responseSchema:`GetTranslationsResponseSchema`,cacheable:!0,cacheTtl:3600},{method:`GET`,path:`/labels/:object/:locale`,handler:`getFieldLabels`,category:`i18n`,public:!1,summary:`Get translated field labels`,description:`Returns translated field labels, help text, and option labels for an object`,tags:[`i18n`],responseSchema:`GetFieldLabelsResponseSchema`,cacheable:!0,cacheTtl:3600}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100}]},tX={prefix:`/api/v1/analytics`,service:`analytics`,category:`analytics`,methods:[`analyticsQuery`,`getAnalyticsMeta`],authRequired:!0,endpoints:[{method:`POST`,path:`/query`,handler:`analyticsQuery`,category:`analytics`,public:!1,summary:`Execute analytics query`,description:`Executes a structured analytics query against the semantic layer`,tags:[`Analytics`],requestSchema:`AnalyticsQueryRequestSchema`,responseSchema:`AnalyticsResultResponseSchema`,permissions:[`analytics.query`],timeout:12e4,cacheable:!1},{method:`GET`,path:`/meta`,handler:`getAnalyticsMeta`,category:`analytics`,public:!1,summary:`Get analytics metadata`,description:`Returns available cubes, dimensions, measures, and segments`,tags:[`Analytics`],responseSchema:`AnalyticsMetadataResponseSchema`,cacheable:!0,cacheTtl:3600}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},nX={prefix:`/api/v1/automation`,service:`automation`,category:`automation`,methods:[`triggerAutomation`],authRequired:!0,endpoints:[{method:`POST`,path:`/trigger`,handler:`triggerAutomation`,category:`automation`,public:!1,summary:`Trigger automation`,description:`Triggers an automation flow or script by name`,tags:[`Automation`],requestSchema:`AutomationTriggerRequestSchema`,responseSchema:`AutomationTriggerResponseSchema`,permissions:[`automation.trigger`],timeout:12e4,cacheable:!1}],middleware:[{name:`auth`,type:`authentication`,enabled:!0,order:10},{name:`validation`,type:`validation`,enabled:!0,order:20},{name:`response_envelope`,type:`transformation`,enabled:!0,order:100},{name:`error_handler`,type:`error`,enabled:!0,order:200}]},ZOe=Object.assign(WY,{create:e=>e}),QOe=Object.assign(RY,{create:e=>e});function $Oe(){return[XOe,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX]}var rX=h({path:r().describe(`Full URL path (e.g. /api/v1/analytics/query)`),method:NA.describe(`HTTP method (GET, POST, etc.)`),category:FY.describe(`Route category`),handlerStatus:IY.describe(`Handler status`),service:r().describe(`Target service name`),healthCheckPassed:S().optional().describe(`Whether the health check probe succeeded`)}),eke=h({timestamp:r().describe(`ISO 8601 timestamp`),adapter:r().describe(`Adapter name (e.g. "hono", "express", "nextjs")`),summary:h({total:P().int().describe(`Total declared endpoints`),implemented:P().int().describe(`Endpoints with real handlers`),stub:P().int().describe(`Endpoints with stub handlers (501)`),planned:P().int().describe(`Endpoints not yet implemented`)}),entries:C(rX).describe(`Per-endpoint coverage entries`)}),tke=E([`rest`,`graphql`,`odata`]),iX=h({operator:r().describe(`Unified DSL operator`),rest:r().optional().describe(`REST query parameter template`),graphql:r().optional().describe(`GraphQL where clause template`),odata:r().optional().describe(`OData $filter expression template`)}),aX=h({filterStyle:E([`bracket`,`dot`,`flat`,`rsql`]).default(`bracket`).describe(`REST filter parameter encoding style`),pagination:h({limitParam:r().default(`limit`).describe(`Page size parameter name`),offsetParam:r().default(`offset`).describe(`Offset parameter name`),cursorParam:r().default(`cursor`).describe(`Cursor parameter name`),pageParam:r().default(`page`).describe(`Page number parameter name`)}).optional().describe(`Pagination parameter name mappings`),sorting:h({param:r().default(`sort`).describe(`Sort parameter name`),format:E([`comma`,`array`,`pipe`]).default(`comma`).describe(`Sort parameter encoding format`)}).optional().describe(`Sort parameter mapping`),fieldsParam:r().default(`fields`).describe(`Field selection parameter name`)}),oX=h({filterArgName:r().default(`where`).describe(`GraphQL filter argument name`),filterStyle:E([`nested`,`flat`,`array`]).default(`nested`).describe(`GraphQL filter nesting style`),pagination:h({limitArg:r().default(`limit`).describe(`Page size argument name`),offsetArg:r().default(`offset`).describe(`Offset argument name`),firstArg:r().default(`first`).describe(`Relay "first" argument name`),afterArg:r().default(`after`).describe(`Relay "after" cursor argument name`)}).optional().describe(`Pagination argument name mappings`),sorting:h({argName:r().default(`orderBy`).describe(`Sort argument name`),format:E([`enum`,`array`]).default(`enum`).describe(`Sort argument format`)}).optional().describe(`Sort argument mapping`)}),sX=h({version:E([`v2`,`v4`]).default(`v4`).describe(`OData version`),usePrefix:S().default(!0).describe(`Use $ prefix for system query options ($filter vs filter)`),stringFunctions:C(E([`contains`,`startswith`,`endswith`,`tolower`,`toupper`,`trim`,`concat`,`substring`,`length`])).optional().describe(`Supported OData string functions`),expand:h({enabled:S().default(!0).describe(`Enable $expand support`),maxDepth:P().int().min(1).default(3).describe(`Maximum expand depth`)}).optional().describe(`$expand configuration`)}),nke=h({operatorMappings:C(iX).optional().describe(`Custom operator mappings`),rest:aX.optional().describe(`REST query adapter configuration`),graphql:oX.optional().describe(`GraphQL query adapter configuration`),odata:sX.optional().describe(`OData query adapter configuration`)}),cX=h({object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID`)}),lX=cX.extend({feedId:r().describe(`Feed item ID`)}),uX=E([`all`,`comments_only`,`changes_only`,`tasks_only`]),dX=cX.extend({type:uX.default(`all`).describe(`Filter by feed item category`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of items to return`),cursor:r().optional().describe(`Cursor for pagination (opaque string from previous response)`)}),fX=J.extend({data:h({items:C(LN).describe(`Feed items in reverse chronological order`),total:P().int().optional().describe(`Total feed items matching filter`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more items are available`)})}),pX=cX.extend({type:jN.describe(`Type of feed item to create`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(MN).optional().describe(`Mentioned users, teams, or records`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),visibility:IN.default(`public`).describe(`Visibility: public, internal, or private`)}),mX=J.extend({data:LN.describe(`The created feed item`)}),hX=lX.extend({body:r().optional().describe(`Updated rich text body`),mentions:C(MN).optional().describe(`Updated mentions`),visibility:IN.optional().describe(`Updated visibility`)}),gX=J.extend({data:LN.describe(`The updated feed item`)}),_X=lX,vX=J.extend({data:h({feedId:r().describe(`ID of the deleted feed item`)})}),yX=lX.extend({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`)}),bX=J.extend({data:h({reactions:C(PN).describe(`Updated reaction list for the feed item`)})}),xX=lX.extend({emoji:r().describe(`Emoji character or shortcode to remove`)}),SX=J.extend({data:h({reactions:C(PN).describe(`Updated reaction list for the feed item`)})}),CX=lX,wX=J.extend({data:h({feedId:r().describe(`ID of the pinned feed item`),pinned:S().describe(`Whether the item is now pinned`),pinnedAt:r().datetime().describe(`Timestamp when pinned`)})}),TX=lX,EX=J.extend({data:h({feedId:r().describe(`ID of the unpinned feed item`),pinned:S().describe(`Whether the item is now pinned (should be false)`)})}),DX=lX,OX=J.extend({data:h({feedId:r().describe(`ID of the starred feed item`),starred:S().describe(`Whether the item is now starred`),starredAt:r().datetime().describe(`Timestamp when starred`)})}),kX=lX,AX=J.extend({data:h({feedId:r().describe(`ID of the unstarred feed item`),starred:S().describe(`Whether the item is now starred (should be false)`)})}),jX=cX.extend({query:r().min(1).describe(`Full-text search query against feed body content`),type:uX.optional().describe(`Filter by feed item category`),actorId:r().optional().describe(`Filter by actor user ID`),dateFrom:r().datetime().optional().describe(`Filter feed items created after this timestamp`),dateTo:r().datetime().optional().describe(`Filter feed items created before this timestamp`),hasAttachments:S().optional().describe(`Filter for items with file attachments`),pinnedOnly:S().optional().describe(`Return only pinned items`),starredOnly:S().optional().describe(`Return only starred items`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of items to return`),cursor:r().optional().describe(`Cursor for pagination`)}),MX=J.extend({data:h({items:C(LN).describe(`Matching feed items sorted by relevance`),total:P().int().optional().describe(`Total matching items`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more items are available`)})}),NX=cX.extend({field:r().optional().describe(`Filter changelog to a specific field name`),actorId:r().optional().describe(`Filter changelog by actor user ID`),dateFrom:r().datetime().optional().describe(`Filter changes after this timestamp`),dateTo:r().datetime().optional().describe(`Filter changes before this timestamp`),limit:P().int().min(1).max(200).default(50).describe(`Maximum number of changelog entries to return`),cursor:r().optional().describe(`Cursor for pagination`)}),PX=h({id:r().describe(`Changelog entry ID`),object:r().describe(`Object name`),recordId:r().describe(`Record ID`),actor:h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`)}).describe(`Who made the change`),changes:C(NN).min(1).describe(`Field-level changes`),timestamp:r().datetime().describe(`When the change occurred`),source:r().optional().describe(`Change source (e.g., "API", "UI", "automation")`)}),FX=J.extend({data:h({entries:C(PX).describe(`Changelog entries in reverse chronological order`),total:P().int().optional().describe(`Total changelog entries matching filter`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more entries are available`)})}),IX=cX.extend({events:C(zN).default([`all`]).describe(`Event types to subscribe to`),channels:C(BN).default([`in_app`]).describe(`Notification delivery channels`)}),LX=J.extend({data:VN.describe(`The created or updated subscription`)}),RX=cX,zX=J.extend({data:h({object:r().describe(`Object name`),recordId:r().describe(`Record ID`),unsubscribed:S().describe(`Whether the user was unsubscribed`)})}),rke=E([`feed_item_not_found`,`feed_permission_denied`,`feed_item_not_editable`,`feed_invalid_parent`,`reaction_already_exists`,`reaction_not_found`,`subscription_already_exists`,`subscription_not_found`,`invalid_feed_type`,`feed_already_pinned`,`feed_not_pinned`,`feed_already_starred`,`feed_not_starred`,`feed_search_query_too_short`]),ike={listFeed:{method:`GET`,path:`/api/data/:object/:recordId/feed`,input:dX,output:fX},createFeedItem:{method:`POST`,path:`/api/data/:object/:recordId/feed`,input:pX,output:mX},updateFeedItem:{method:`PUT`,path:`/api/data/:object/:recordId/feed/:feedId`,input:hX,output:gX},deleteFeedItem:{method:`DELETE`,path:`/api/data/:object/:recordId/feed/:feedId`,input:_X,output:vX},addReaction:{method:`POST`,path:`/api/data/:object/:recordId/feed/:feedId/reactions`,input:yX,output:bX},removeReaction:{method:`DELETE`,path:`/api/data/:object/:recordId/feed/:feedId/reactions/:emoji`,input:xX,output:SX},pinFeedItem:{method:`POST`,path:`/api/data/:object/:recordId/feed/:feedId/pin`,input:CX,output:wX},unpinFeedItem:{method:`DELETE`,path:`/api/data/:object/:recordId/feed/:feedId/pin`,input:TX,output:EX},starFeedItem:{method:`POST`,path:`/api/data/:object/:recordId/feed/:feedId/star`,input:DX,output:OX},unstarFeedItem:{method:`DELETE`,path:`/api/data/:object/:recordId/feed/:feedId/star`,input:kX,output:AX},searchFeed:{method:`GET`,path:`/api/data/:object/:recordId/feed/search`,input:jX,output:MX},getChangelog:{method:`GET`,path:`/api/data/:object/:recordId/changelog`,input:NX,output:FX},subscribe:{method:`POST`,path:`/api/data/:object/:recordId/subscribe`,input:IX,output:LX},unsubscribe:{method:`DELETE`,path:`/api/data/:object/:recordId/subscribe`,input:RX,output:zX}},BX=E([`csv`,`json`,`jsonl`,`xlsx`,`parquet`]),VX=E([`pending`,`processing`,`completed`,`failed`,`cancelled`,`expired`]),HX=h({object:r().describe(`Object name to export`),format:BX.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Specific fields to include (omit for all fields)`),filter:d(r(),u()).optional().describe(`Filter criteria for records to export`),sort:C(h({field:r().describe(`Field name to sort by`),direction:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`)})).optional().describe(`Sort order for exported records`),limit:P().int().min(1).optional().describe(`Maximum number of records to export`),includeHeaders:S().default(!0).describe(`Include header row (CSV/XLSX)`),encoding:r().default(`utf-8`).describe(`Character encoding for the export file`),templateId:r().optional().describe(`Export template ID for predefined field mappings`)}),UX=J.extend({data:h({jobId:r().describe(`Export job ID`),status:VX.describe(`Initial job status`),estimatedRecords:P().int().optional().describe(`Estimated total records`),createdAt:r().datetime().describe(`Job creation timestamp`)})}),WX=J.extend({data:h({jobId:r().describe(`Export job ID`),status:VX.describe(`Current job status`),format:BX.describe(`Export format`),totalRecords:P().int().optional().describe(`Total records to export`),processedRecords:P().int().describe(`Records processed so far`),percentComplete:P().min(0).max(100).describe(`Export progress percentage`),fileSize:P().int().optional().describe(`Current file size in bytes`),downloadUrl:r().optional().describe(`Presigned download URL (available when status is "completed")`),downloadExpiresAt:r().datetime().optional().describe(`Download URL expiration timestamp`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`)}).optional().describe(`Error details if job failed`),startedAt:r().datetime().optional().describe(`Processing start timestamp`),completedAt:r().datetime().optional().describe(`Completion timestamp`)})}),GX=E([`strict`,`lenient`,`dry_run`]),KX=E([`skip`,`update`,`create_new`,`fail`]),ake=h({mode:GX.default(`strict`).describe(`Validation mode for the import`),deduplication:h({strategy:KX.default(`skip`).describe(`How to handle duplicate records`),matchFields:C(r()).min(1).describe(`Fields used to identify duplicates (e.g., "email", "external_id")`)}).optional().describe(`Deduplication configuration`),maxErrors:P().int().min(1).default(100).describe(`Maximum validation errors before aborting`),trimWhitespace:S().default(!0).describe(`Trim leading/trailing whitespace from string fields`),dateFormat:r().optional().describe(`Expected date format in import data (e.g., "YYYY-MM-DD")`),nullValues:C(r()).optional().describe(`Strings to treat as null (e.g., ["", "N/A", "null"])`)}),oke=J.extend({data:h({totalRecords:P().int().describe(`Total records in import file`),validRecords:P().int().describe(`Records that passed validation`),invalidRecords:P().int().describe(`Records that failed validation`),duplicateRecords:P().int().describe(`Duplicate records detected`),errors:C(h({row:P().int().describe(`Row number in the import file`),field:r().optional().describe(`Field that failed validation`),code:r().describe(`Validation error code`),message:r().describe(`Validation error message`)})).describe(`List of validation errors`),preview:C(d(r(),u())).optional().describe(`Preview of first N valid records (for dry_run mode)`)})}),qX=h({sourceField:r().describe(`Field name in the source data (import) or object (export)`),targetField:r().describe(`Field name in the target object (import) or file column (export)`),targetLabel:r().optional().describe(`Display label for the target column (export)`),transform:E([`none`,`uppercase`,`lowercase`,`trim`,`date_format`,`lookup`]).default(`none`).describe(`Transformation to apply during mapping`),defaultValue:u().optional().describe(`Default value if source field is null/empty`),required:S().default(!1).describe(`Whether this field is required (import validation)`)}),ske=h({id:r().optional().describe(`Template ID (generated on save)`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template machine name (snake_case)`),label:r().describe(`Human-readable template label`),description:r().optional().describe(`Template description`),object:r().describe(`Target object name`),direction:E([`import`,`export`,`bidirectional`]).describe(`Template direction`),format:BX.optional().describe(`Default file format for this template`),mappings:C(qX).min(1).describe(`Field mapping entries`),createdAt:r().datetime().optional().describe(`Template creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the template`)}),cke=h({id:r().optional().describe(`Scheduled export ID`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Schedule name (snake_case)`),label:r().optional().describe(`Human-readable label`),object:r().describe(`Object name to export`),format:BX.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Fields to include`),filter:d(r(),u()).optional().describe(`Record filter criteria`),templateId:r().optional().describe(`Export template ID for field mappings`),schedule:h({cronExpression:r().describe(`Cron expression for schedule`),timezone:r().default(`UTC`).describe(`IANA timezone`)}).describe(`Schedule timing configuration`),delivery:h({method:E([`email`,`storage`,`webhook`]).describe(`How to deliver the export file`),recipients:C(r()).optional().describe(`Email recipients (for email delivery)`),storagePath:r().optional().describe(`Storage path (for storage delivery)`),webhookUrl:r().optional().describe(`Webhook URL (for webhook delivery)`)}).describe(`Export delivery configuration`),enabled:S().default(!0).describe(`Whether the scheduled export is active`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution`),createdAt:r().datetime().optional().describe(`Creation timestamp`),createdBy:r().optional().describe(`User who created the schedule`)}),JX=h({jobId:r().describe(`Export job ID`)}),YX=J.extend({data:h({jobId:r().describe(`Export job ID`),downloadUrl:r().describe(`Presigned download URL`),fileName:r().describe(`Suggested file name`),fileSize:P().int().describe(`File size in bytes`),format:BX.describe(`Export file format`),expiresAt:r().datetime().describe(`Download URL expiration timestamp`),checksum:r().optional().describe(`File checksum (SHA-256)`)})}),XX=h({object:r().optional().describe(`Filter by object name`),status:VX.optional().describe(`Filter by job status`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of jobs to return`),cursor:r().optional().describe(`Pagination cursor from a previous response`)}),ZX=h({jobId:r().describe(`Export job ID`),object:r().describe(`Object name that was exported`),status:VX.describe(`Current job status`),format:BX.describe(`Export file format`),totalRecords:P().int().optional().describe(`Total records exported`),fileSize:P().int().optional().describe(`File size in bytes`),createdAt:r().datetime().describe(`Job creation timestamp`),completedAt:r().datetime().optional().describe(`Completion timestamp`),createdBy:r().optional().describe(`User who initiated the export`)}),QX=J.extend({data:h({jobs:C(ZX).describe(`List of export jobs`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more jobs are available`)})}),$X=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Schedule name (snake_case)`),label:r().optional().describe(`Human-readable label`),object:r().describe(`Object name to export`),format:BX.default(`csv`).describe(`Export file format`),fields:C(r()).optional().describe(`Fields to include`),filter:d(r(),u()).optional().describe(`Record filter criteria`),templateId:r().optional().describe(`Export template ID for field mappings`),schedule:h({cronExpression:r().describe(`Cron expression for schedule`),timezone:r().default(`UTC`).describe(`IANA timezone`)}).describe(`Schedule timing configuration`),delivery:h({method:E([`email`,`storage`,`webhook`]).describe(`How to deliver the export file`),recipients:C(r()).optional().describe(`Email recipients (for email delivery)`),storagePath:r().optional().describe(`Storage path (for storage delivery)`),webhookUrl:r().optional().describe(`Webhook URL (for webhook delivery)`)}).describe(`Export delivery configuration`)}),eZ=J.extend({data:h({id:r().describe(`Scheduled export ID`),name:r().describe(`Schedule name`),enabled:S().describe(`Whether the schedule is active`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution`),createdAt:r().datetime().describe(`Creation timestamp`)})}),lke={createExportJob:{method:`POST`,path:`/api/v1/data/:object/export`,input:HX,output:UX},getExportJobProgress:{method:`GET`,path:`/api/v1/data/export/:jobId`,input:h({jobId:r()}),output:WX},getExportJobDownload:{method:`GET`,path:`/api/v1/data/export/:jobId/download`,input:JX,output:YX},listExportJobs:{method:`GET`,path:`/api/v1/data/export`,input:XX,output:QX},scheduleExport:{method:`POST`,path:`/api/v1/data/export/schedules`,input:$X,output:eZ},cancelExportJob:{method:`POST`,path:`/api/v1/data/export/:jobId/cancel`,input:h({jobId:r()}),output:J}},tZ=E([`start`,`end`,`decision`,`assignment`,`loop`,`create_record`,`update_record`,`delete_record`,`get_record`,`http_request`,`script`,`screen`,`wait`,`subflow`,`connector_action`,`parallel_gateway`,`join_gateway`,`boundary_event`]),nZ=h({name:r().describe(`Variable name`),type:r().describe(`Data type (text, number, boolean, object, list)`),isInput:S().default(!1).describe(`Is input parameter`),isOutput:S().default(!1).describe(`Is output parameter`)}),rZ=h({id:r().describe(`Node unique ID`),type:tZ.describe(`Action type`),label:r().describe(`Node label`),config:d(r(),u()).optional().describe(`Node configuration`),connectorConfig:h({connectorId:r(),actionId:r(),input:d(r(),u()).describe(`Mapped inputs for the action`)}).optional(),position:h({x:P(),y:P()}).optional(),timeoutMs:P().int().min(0).optional().describe(`Maximum execution time for this node in milliseconds`),inputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Parameter type`),required:S().default(!1).describe(`Whether the parameter is required`),description:r().optional().describe(`Parameter description`)})).optional().describe(`Input parameter schema for this node`),outputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Output type`),description:r().optional().describe(`Output description`)})).optional().describe(`Output schema declaration for this node`),waitEventConfig:h({eventType:E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`What kind of event resumes the execution`),timerDuration:r().optional().describe(`ISO 8601 duration (e.g., "PT1H") or wait time for timer events`),signalName:r().optional().describe(`Named signal or webhook event to wait for`),timeoutMs:P().int().min(0).optional().describe(`Maximum wait time before timeout (ms)`),onTimeout:E([`fail`,`continue`]).default(`fail`).describe(`Behavior when the wait times out`)}).optional().describe(`Configuration for wait node event resumption`),boundaryConfig:h({attachedToNodeId:r().describe(`Host node ID this boundary event monitors`),eventType:E([`error`,`timer`,`signal`,`cancel`]).describe(`Boundary event trigger type`),interrupting:S().default(!0).describe(`If true, the host activity is cancelled when this event fires`),errorCode:r().optional().describe(`Specific error code to catch (empty = catch all errors)`),timerDuration:r().optional().describe(`ISO 8601 duration for timer boundary events`),signalName:r().optional().describe(`Named signal to catch`)}).optional().describe(`Configuration for boundary events attached to host nodes`)}),iZ=h({id:r().describe(`Edge unique ID`),source:r().describe(`Source Node ID`),target:r().describe(`Target Node ID`),condition:r().optional().describe(`Expression returning boolean used for branching`),type:E([`default`,`fault`,`conditional`]).default(`default`).describe(`Connection type: default (normal flow), fault (error path), or conditional (expression-guarded)`),label:r().optional().describe(`Label on the connector`),isDefault:S().default(!1).describe(`Marks this edge as the default path when no other conditions match`)}),aZ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name`),label:r().describe(`Flow label`),description:r().optional(),version:P().int().default(1).describe(`Version number`),status:E([`draft`,`active`,`obsolete`,`invalid`]).default(`draft`).describe(`Deployment status`),template:S().default(!1).describe(`Is logic template (Subflow)`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).describe(`Flow type`),variables:C(nZ).optional().describe(`Flow variables`),nodes:C(rZ).describe(`Flow nodes`),edges:C(iZ).describe(`Flow connections`),active:S().default(!1).describe(`Is active (Deprecated: use status)`),runAs:E([`system`,`user`]).default(`user`).describe(`Execution context`),errorHandling:h({strategy:E([`fail`,`retry`,`continue`]).default(`fail`).describe(`How to handle node execution errors`),maxRetries:P().int().min(0).max(10).default(0).describe(`Number of retry attempts (only for retry strategy)`),retryDelayMs:P().int().min(0).default(1e3).describe(`Delay between retries in milliseconds`),backoffMultiplier:P().min(1).default(1).describe(`Multiplier for exponential backoff between retries`),maxRetryDelayMs:P().int().min(0).default(3e4).describe(`Maximum delay between retries in milliseconds`),jitter:S().default(!1).describe(`Add random jitter to retry delay to avoid thundering herd`),fallbackNodeId:r().optional().describe(`Node ID to jump to on unrecoverable error`)}).optional().describe(`Flow-level error handling configuration`)});function uke(e){return aZ.parse(e)}var dke=h({flowName:r().describe(`Flow machine name`),version:P().int().min(1).describe(`Version number`),definition:aZ.describe(`Complete flow definition snapshot`),createdAt:r().datetime().describe(`When this version was created`),createdBy:r().optional().describe(`User who created this version`),changeNote:r().optional().describe(`Description of what changed in this version`)}),oZ=E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]),sZ=h({nodeId:r().describe(`Node ID that was executed`),nodeType:r().describe(`Node action type (e.g., "decision", "http_request")`),nodeLabel:r().optional().describe(`Human-readable node label`),status:E([`success`,`failure`,`skipped`]).describe(`Step execution result`),startedAt:r().datetime().describe(`When the step started`),completedAt:r().datetime().optional().describe(`When the step completed`),durationMs:P().int().min(0).optional().describe(`Step execution duration in milliseconds`),input:d(r(),u()).optional().describe(`Input data passed to the node`),output:d(r(),u()).optional().describe(`Output data produced by the node`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`)}).optional().describe(`Error details if step failed`),retryAttempt:P().int().min(0).optional().describe(`Retry attempt number (0 = first try)`)}),cZ=h({id:r().describe(`Execution instance ID`),flowName:r().describe(`Machine name of the executed flow`),flowVersion:P().int().optional().describe(`Version of the flow that was executed`),status:oZ.describe(`Current execution status`),trigger:h({type:r().describe(`Trigger type (e.g., "record_change", "schedule", "api", "manual")`),recordId:r().optional().describe(`Triggering record ID`),object:r().optional().describe(`Triggering object name`),userId:r().optional().describe(`User who triggered the execution`),metadata:d(r(),u()).optional().describe(`Additional trigger context`)}).describe(`What triggered this execution`),steps:C(sZ).describe(`Ordered list of executed steps`),variables:d(r(),u()).optional().describe(`Final state of flow variables`),startedAt:r().datetime().describe(`Execution start timestamp`),completedAt:r().datetime().optional().describe(`Execution completion timestamp`),durationMs:P().int().min(0).optional().describe(`Total execution duration in milliseconds`),runAs:E([`system`,`user`]).optional().describe(`Execution context identity`),tenantId:r().optional().describe(`Tenant ID for multi-tenant isolation`)}),lZ=E([`warning`,`error`,`critical`]),fke=h({id:r().describe(`Error record ID`),executionId:r().describe(`Parent execution ID`),nodeId:r().optional().describe(`Node where the error occurred`),severity:lZ.describe(`Error severity level`),code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),stack:r().optional().describe(`Stack trace for debugging`),context:d(r(),u()).optional().describe(`Additional diagnostic context (input data, config snapshot)`),timestamp:r().datetime().describe(`When the error occurred`),retryable:S().default(!1).describe(`Whether this error can be retried`),resolvedAt:r().datetime().optional().describe(`When the error was resolved (e.g., after successful retry)`)}),pke=h({id:r().describe(`Checkpoint ID`),executionId:r().describe(`Parent execution ID`),flowName:r().describe(`Flow machine name`),currentNodeId:r().describe(`Node ID where execution is paused`),variables:d(r(),u()).describe(`Flow variable state at checkpoint`),completedNodeIds:C(r()).describe(`List of node IDs already executed`),createdAt:r().datetime().describe(`Checkpoint creation timestamp`),expiresAt:r().datetime().optional().describe(`Checkpoint expiration (auto-cleanup)`),reason:E([`wait`,`screen_input`,`approval`,`error`,`manual_pause`,`parallel_join`,`boundary_event`]).describe(`Why the execution was checkpointed`)}),mke=h({maxConcurrent:P().int().min(1).default(1).describe(`Maximum number of concurrent executions allowed`),onConflict:E([`queue`,`reject`,`cancel_existing`]).default(`queue`).describe(`queue = enqueue for later, reject = fail immediately, cancel_existing = stop running instance`),lockScope:E([`global`,`per_record`,`per_user`]).default(`global`).describe(`Scope of the concurrency lock`),queueTimeoutMs:P().int().min(0).optional().describe(`Maximum time to wait in queue before timing out (ms)`)}),hke=h({id:r().describe(`Schedule instance ID`),flowName:r().describe(`Flow machine name`),cronExpression:r().describe(`Cron expression (e.g., "0 9 * * MON-FRI")`),timezone:r().default(`UTC`).describe(`IANA timezone for cron evaluation`),status:E([`active`,`paused`,`disabled`,`expired`]).default(`active`).describe(`Current schedule status`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution timestamp`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),lastExecutionId:r().optional().describe(`Execution ID of the last run`),lastRunStatus:oZ.optional().describe(`Status of the last run`),totalRuns:P().int().min(0).default(0).describe(`Total number of executions`),consecutiveFailures:P().int().min(0).default(0).describe(`Consecutive failed executions`),startDate:r().datetime().optional().describe(`Schedule effective start date`),endDate:r().datetime().optional().describe(`Schedule expiration date`),maxRuns:P().int().min(1).optional().describe(`Maximum total executions before auto-disable`),createdAt:r().datetime().describe(`Schedule creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the schedule`)}),uZ=h({name:r().describe(`Flow machine name (snake_case)`)}),dZ=uZ.extend({runId:r().describe(`Execution run ID`)}),fZ=h({status:E([`draft`,`active`,`obsolete`,`invalid`]).optional().describe(`Filter by flow status`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).optional().describe(`Filter by flow type`),limit:P().int().min(1).max(100).default(50).describe(`Maximum number of flows to return`),cursor:r().optional().describe(`Cursor for pagination`)}),pZ=h({name:r().describe(`Flow machine name`),label:r().describe(`Flow display label`),type:r().describe(`Flow type`),status:r().describe(`Flow deployment status`),version:P().int().describe(`Flow version number`),enabled:S().describe(`Whether the flow is enabled for execution`),nodeCount:P().int().optional().describe(`Number of nodes in the flow`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`)}),mZ=J.extend({data:h({flows:C(pZ).describe(`Flow summaries`),total:P().int().optional().describe(`Total matching flows`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more flows are available`)})}),hZ=uZ,gZ=J.extend({data:aZ.describe(`Full flow definition`)}),_Z=aZ,vZ=J.extend({data:aZ.describe(`The created flow definition`)}),yZ=uZ.extend({definition:aZ.partial().describe(`Partial flow definition to update`)}),bZ=J.extend({data:aZ.describe(`The updated flow definition`)}),xZ=uZ,SZ=J.extend({data:h({name:r().describe(`Name of the deleted flow`),deleted:S().describe(`Whether the flow was deleted`)})}),CZ=uZ.extend({record:d(r(),u()).optional().describe(`Record that triggered the automation`),object:r().optional().describe(`Object name the record belongs to`),event:r().optional().describe(`Trigger event type`),userId:r().optional().describe(`User who triggered the automation`),params:d(r(),u()).optional().describe(`Additional contextual data`)}),wZ=J.extend({data:h({success:S().describe(`Whether the automation completed successfully`),output:u().optional().describe(`Output data from the automation`),error:r().optional().describe(`Error message if execution failed`),durationMs:P().optional().describe(`Execution duration in milliseconds`)})}),TZ=uZ.extend({enabled:S().describe(`Whether to enable (true) or disable (false) the flow`)}),EZ=J.extend({data:h({name:r().describe(`Flow name`),enabled:S().describe(`New enabled state`)})}),DZ=uZ.extend({status:E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]).optional().describe(`Filter by execution status`),limit:P().int().min(1).max(100).default(20).describe(`Maximum number of runs to return`),cursor:r().optional().describe(`Cursor for pagination`)}),OZ=J.extend({data:h({runs:C(cZ).describe(`Execution run logs`),total:P().int().optional().describe(`Total matching runs`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more runs are available`)})}),kZ=dZ,AZ=J.extend({data:cZ.describe(`Full execution log with step details`)}),gke=E([`flow_not_found`,`flow_already_exists`,`flow_validation_failed`,`flow_disabled`,`execution_not_found`,`execution_failed`,`execution_timeout`,`node_executor_not_found`,`concurrent_execution_limit`]),_ke={listFlows:{method:`GET`,path:`/api/automation`,input:fZ,output:mZ},getFlow:{method:`GET`,path:`/api/automation/:name`,input:hZ,output:gZ},createFlow:{method:`POST`,path:`/api/automation`,input:_Z,output:vZ},updateFlow:{method:`PUT`,path:`/api/automation/:name`,input:yZ,output:bZ},deleteFlow:{method:`DELETE`,path:`/api/automation/:name`,input:xZ,output:SZ},triggerFlow:{method:`POST`,path:`/api/automation/:name/trigger`,input:CZ,output:wZ},toggleFlow:{method:`POST`,path:`/api/automation/:name/toggle`,input:TZ,output:EZ},listRuns:{method:`GET`,path:`/api/automation/:name/runs`,input:DZ,output:OZ},getRun:{method:`GET`,path:`/api/automation/:name/runs/:runId`,input:kZ,output:AZ}},jZ=h({packageId:r().describe(`Package identifier`)}),MZ=h({status:E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).optional().describe(`Filter by package status`),enabled:S().optional().describe(`Filter by enabled state`),limit:P().int().min(1).max(100).default(50).describe(`Maximum number of packages to return`),cursor:r().optional().describe(`Cursor for pagination`)}).describe(`List installed packages request`),NZ=J.extend({data:h({packages:C(rH).describe(`Installed packages`),total:P().int().optional().describe(`Total matching packages`),nextCursor:r().optional().describe(`Cursor for the next page`),hasMore:S().describe(`Whether more packages are available`)})}).describe(`List installed packages response`),PZ=jZ,FZ=J.extend({data:rH.describe(`Installed package details`)}).describe(`Get installed package response`),IZ=h({manifest:RV.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`),artifactRef:SU.optional().describe(`Artifact reference for marketplace installation`)}).describe(`Install package request`),LZ=J.extend({data:h({package:rH.describe(`Installed package details`),dependencyResolution:QB.optional().describe(`Dependency resolution result`),namespaceConflicts:C(h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package name`),suggestion:r().optional().describe(`Suggested alternative`)})).optional().describe(`Namespace conflicts detected`),message:r().optional().describe(`Installation status message`)})}).describe(`Install package response`),RZ=h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:RV.optional().describe(`New manifest for the target version`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`),zZ=J.extend({data:h({success:S().describe(`Whether the upgrade succeeded`),phase:r().describe(`Current upgrade phase`),plan:yH.optional().describe(`Upgrade plan that was executed`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r().describe(`Conflict path`),baseValue:u().describe(`Base value`),incomingValue:u().describe(`Incoming value`),customValue:u().describe(`Custom value`)})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if failed`),message:r().optional().describe(`Human-readable status message`)})}).describe(`Upgrade package response`),BZ=h({manifest:RV.describe(`Package manifest to resolve dependencies for`),platformVersion:r().optional().describe(`Current platform version for compatibility filtering`)}).describe(`Resolve dependencies request`),VZ=J.extend({data:QB.describe(`Dependency resolution result with topological sort`)}).describe(`Resolve dependencies response`),HZ=h({artifact:UB.describe(`Package artifact metadata`),sha256:r().regex(/^[a-f0-9]{64}$/).optional().describe(`SHA256 checksum of the uploaded file`),token:r().optional().describe(`Publisher authentication token`),releaseNotes:r().optional().describe(`Release notes for this version`)}).describe(`Upload artifact request`),UZ=J.extend({data:h({success:S().describe(`Whether the upload succeeded`),artifactRef:SU.optional().describe(`Artifact reference in the registry`),submissionId:r().optional().describe(`Marketplace submission ID for review tracking`),message:r().optional().describe(`Upload status message`)})}).describe(`Upload artifact response`),WZ=jZ.extend({snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),GZ=J.extend({data:h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Restored version`),message:r().optional().describe(`Rollback status message`)})}).describe(`Rollback package response`),KZ=jZ,qZ=J.extend({data:h({packageId:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)})}).describe(`Uninstall package response`),vke=E([`package_not_found`,`package_already_installed`,`version_not_found`,`dependency_conflict`,`namespace_conflict`,`platform_incompatible`,`artifact_invalid`,`checksum_mismatch`,`signature_invalid`,`upgrade_failed`,`rollback_failed`,`snapshot_not_found`,`upload_failed`]),yke={listPackages:{method:`GET`,path:`/api/v1/packages`,input:MZ,output:NZ},getPackage:{method:`GET`,path:`/api/v1/packages/:packageId`,input:PZ,output:FZ},installPackage:{method:`POST`,path:`/api/v1/packages/install`,input:IZ,output:LZ},upgradePackage:{method:`POST`,path:`/api/v1/packages/upgrade`,input:RZ,output:zZ},resolveDependencies:{method:`POST`,path:`/api/v1/packages/resolve-dependencies`,input:BZ,output:VZ},uploadArtifact:{method:`POST`,path:`/api/v1/packages/upload`,input:HZ,output:UZ},rollbackPackage:{method:`POST`,path:`/api/v1/packages/:packageId/rollback`,input:WZ,output:GZ},uninstallPackage:{method:`DELETE`,path:`/api/v1/packages/:packageId`,input:KZ,output:qZ}};DA({},{ActionRefSchema:()=>Yj,ApprovalActionSchema:()=>QZ,ApprovalActionType:()=>ZZ,ApprovalProcess:()=>xke,ApprovalProcessSchema:()=>eQ,ApprovalStepSchema:()=>$Z,ApproverType:()=>XZ,AuthFieldSchema:()=>uQ,AuthenticationSchema:()=>fQ,AuthenticationTypeSchema:()=>lQ,BUILT_IN_BPMN_MAPPINGS:()=>Rke,BpmnDiagnosticSchema:()=>OQ,BpmnElementMappingSchema:()=>TQ,BpmnExportOptionsSchema:()=>Ike,BpmnImportOptionsSchema:()=>Fke,BpmnInteropResultSchema:()=>Lke,BpmnUnmappedStrategySchema:()=>EQ,BpmnVersionSchema:()=>DQ,CheckpointSchema:()=>pke,ConcurrencyPolicySchema:()=>mke,ConflictResolutionSchema:()=>yQ,Connector:()=>Dke,ConnectorActionRefSchema:()=>CJ,ConnectorCategorySchema:()=>cQ,ConnectorInstanceSchema:()=>Eke,ConnectorOperationSchema:()=>hQ,ConnectorSchema:()=>Tke,ConnectorTriggerSchema:()=>gQ,CustomScriptActionSchema:()=>DJ,DataDestinationConfigSchema:()=>xQ,DataSourceConfigSchema:()=>bQ,DataSyncConfigSchema:()=>Oke,ETL:()=>wke,ETLDestinationSchema:()=>rQ,ETLEndpointTypeSchema:()=>tQ,ETLPipelineRunSchema:()=>Cke,ETLPipelineSchema:()=>Ske,ETLRunStatusSchema:()=>sQ,ETLSourceSchema:()=>nQ,ETLSyncModeSchema:()=>oQ,ETLTransformationSchema:()=>aQ,ETLTransformationTypeSchema:()=>iQ,EmailAlertActionSchema:()=>SJ,EventSchema:()=>Pve,ExecutionErrorSchema:()=>fke,ExecutionErrorSeverity:()=>lZ,ExecutionLogSchema:()=>cZ,ExecutionStatus:()=>oZ,ExecutionStepLogSchema:()=>sZ,FieldUpdateActionSchema:()=>xJ,FlowEdgeSchema:()=>iZ,FlowNodeAction:()=>tZ,FlowNodeSchema:()=>rZ,FlowSchema:()=>aZ,FlowVariableSchema:()=>nZ,FlowVersionHistorySchema:()=>dke,GuardRefSchema:()=>Xj,HttpCallActionSchema:()=>wJ,NodeExecutorDescriptorSchema:()=>Nke,OAuth2ConfigSchema:()=>dQ,OperationParameterSchema:()=>mQ,OperationTypeSchema:()=>pQ,PushNotificationActionSchema:()=>EJ,ScheduleStateSchema:()=>hke,StateMachineSchema:()=>$j,StateNodeSchema:()=>Qj,Sync:()=>Ake,SyncDirectionSchema:()=>_Q,SyncExecutionResultSchema:()=>kke,SyncExecutionStatusSchema:()=>SQ,SyncModeSchema:()=>vQ,TaskCreationActionSchema:()=>TJ,TimeTriggerSchema:()=>kJ,TransitionSchema:()=>Zj,WAIT_EXECUTOR_DESCRIPTOR:()=>Pke,WaitEventTypeSchema:()=>CQ,WaitExecutorConfigSchema:()=>Mke,WaitResumePayloadSchema:()=>jke,WaitTimeoutBehaviorSchema:()=>wQ,WebhookReceiverSchema:()=>bke,WebhookSchema:()=>YZ,WebhookTriggerType:()=>JZ,WorkflowActionSchema:()=>OJ,WorkflowRuleSchema:()=>AJ,WorkflowTriggerType:()=>bJ,defineFlow:()=>uke});var JZ=E([`create`,`update`,`delete`,`undelete`,`api`]),YZ=h({name:kA.describe(`Webhook unique name (lowercase snake_case)`),label:r().optional().describe(`Human-readable webhook label`),object:r().optional().describe(`Object to listen to (optional for manual webhooks)`),triggers:C(JZ).optional().describe(`Events that trigger execution`),url:r().url().describe(`External webhook endpoint URL`),method:E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]).default(`POST`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),body:u().optional().describe(`Request body payload (if not using default record data)`),payloadFields:C(r()).optional().describe(`Fields to include. Empty = All`),includeSession:S().default(!1).describe(`Include user session info`),authentication:h({type:E([`none`,`bearer`,`basic`,`api-key`]).describe(`Authentication type`),credentials:d(r(),r()).optional().describe(`Authentication credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:h({maxRetries:P().int().min(0).max(10).default(3).describe(`Maximum retry attempts`),backoffStrategy:E([`exponential`,`linear`,`fixed`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:P().int().min(100).default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().int().min(1e3).default(6e4).describe(`Maximum retry delay in milliseconds`)}).optional().describe(`Retry policy configuration`),timeoutMs:P().int().min(1e3).max(3e5).default(3e4).describe(`Request timeout in milliseconds`),secret:r().optional().describe(`Signing secret for HMAC signature verification`),isActive:S().default(!0).describe(`Whether webhook is active`),description:r().optional().describe(`Webhook description`),tags:C(r()).optional().describe(`Tags for organization`)}),bke=h({name:kA.describe(`Webhook receiver unique name (lowercase snake_case)`),path:r().describe(`URL Path (e.g. /webhooks/stripe)`),verificationType:E([`none`,`header_token`,`hmac`,`ip_whitelist`]).default(`none`),verificationParams:h({header:r().optional(),secret:r().optional(),ips:C(r()).optional()}).optional(),action:E([`trigger_flow`,`script`,`upsert_record`]).default(`trigger_flow`),target:r().describe(`Flow ID or Script name`)}),XZ=E([`user`,`role`,`manager`,`field`,`queue`]),ZZ=E([`field_update`,`email_alert`,`webhook`,`script`,`connector_action`]),QZ=h({type:ZZ,name:r().describe(`Action name`),config:d(r(),u()).describe(`Action configuration`),connectorId:r().optional(),actionId:r().optional()}),$Z=h({name:kA.describe(`Step machine name`),label:r().describe(`Step display label`),description:r().optional(),entryCriteria:r().optional().describe(`Formula expression to enter this step`),approvers:C(h({type:XZ,value:r().describe(`User ID, Role Name, or Field Name`)})).min(1).describe(`List of allowed approvers`),behavior:E([`first_response`,`unanimous`]).default(`first_response`).describe(`How to handle multiple approvers`),rejectionBehavior:E([`reject_process`,`back_to_previous`]).default(`reject_process`).describe(`What happens if rejected`),onApprove:C(QZ).optional().describe(`Actions on step approval`),onReject:C(QZ).optional().describe(`Actions on step rejection`)}),eQ=h({name:kA.describe(`Unique process name`),label:r().describe(`Human readable label`),object:r().describe(`Target Object Name`),active:S().default(!1),description:r().optional(),entryCriteria:r().optional().describe(`Formula to allow submission`),lockRecord:S().default(!0).describe(`Lock record from editing during approval`),steps:C($Z).min(1).describe(`Sequence of approval steps`),escalation:h({enabled:S().default(!1).describe(`Enable SLA-based escalation`),timeoutHours:P().min(1).describe(`Hours before escalation triggers`),action:E([`reassign`,`auto_approve`,`auto_reject`,`notify`]).default(`notify`).describe(`Action to take on escalation timeout`),escalateTo:r().optional().describe(`User ID, role, or manager level to escalate to`),notifySubmitter:S().default(!0).describe(`Notify the original submitter on escalation`)}).optional().describe(`SLA escalation configuration for pending approval steps`),onSubmit:C(QZ).optional().describe(`Actions on initial submission`),onFinalApprove:C(QZ).optional().describe(`Actions on final approval`),onFinalReject:C(QZ).optional().describe(`Actions on final rejection`),onRecall:C(QZ).optional().describe(`Actions on recall`)}),xke=Object.assign(eQ,{create:e=>e}),tQ=E([`database`,`api`,`file`,`stream`,`object`,`warehouse`,`storage`,`spreadsheet`]),nQ=h({type:tQ.describe(`Source type`),connector:r().optional().describe(`Connector ID`),config:d(r(),u()).describe(`Source configuration`),incremental:h({enabled:S().default(!1),cursorField:r().describe(`Field to track progress (e.g., updated_at)`),cursorValue:u().optional().describe(`Last processed value`)}).optional().describe(`Incremental extraction config`)}),rQ=h({type:tQ.describe(`Destination type`),connector:r().optional().describe(`Connector ID`),config:d(r(),u()).describe(`Destination configuration`),writeMode:E([`append`,`overwrite`,`upsert`,`merge`]).default(`append`).describe(`How to write data`),primaryKey:C(r()).optional().describe(`Primary key fields`)}),iQ=E([`map`,`filter`,`aggregate`,`join`,`script`,`lookup`,`split`,`merge`,`normalize`,`deduplicate`]),aQ=h({name:r().optional().describe(`Transformation name`),type:iQ.describe(`Transformation type`),config:d(r(),u()).describe(`Transformation config`),continueOnError:S().default(!1).describe(`Continue on error`)}),oQ=E([`full`,`incremental`,`cdc`]),Ske=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Pipeline identifier (snake_case)`),label:r().optional().describe(`Pipeline display name`),description:r().optional().describe(`Pipeline description`),source:nQ.describe(`Data source`),destination:rQ.describe(`Data destination`),transformations:C(aQ).optional().describe(`Transformation pipeline`),syncMode:oQ.default(`full`).describe(`Sync mode`),schedule:r().optional().describe(`Cron schedule expression`),enabled:S().default(!0).describe(`Pipeline enabled status`),retry:h({maxAttempts:P().int().min(0).default(3).describe(`Max retry attempts`),backoffMs:P().int().min(0).default(6e4).describe(`Backoff in milliseconds`)}).optional().describe(`Retry configuration`),notifications:h({onSuccess:C(r()).optional().describe(`Email addresses for success notifications`),onFailure:C(r()).optional().describe(`Email addresses for failure notifications`)}).optional().describe(`Notification settings`),tags:C(r()).optional().describe(`Pipeline tags`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),sQ=E([`pending`,`running`,`succeeded`,`failed`,`cancelled`,`timeout`]),Cke=h({id:r().describe(`Run identifier`),pipelineName:r().describe(`Pipeline name`),status:sQ.describe(`Run status`),startedAt:r().datetime().describe(`Start time`),completedAt:r().datetime().optional().describe(`Completion time`),durationMs:P().optional().describe(`Duration in ms`),stats:h({recordsRead:P().int().default(0).describe(`Records extracted`),recordsWritten:P().int().default(0).describe(`Records loaded`),recordsErrored:P().int().default(0).describe(`Records with errors`),bytesProcessed:P().int().default(0).describe(`Bytes processed`)}).optional().describe(`Run statistics`),error:h({message:r().describe(`Error message`),code:r().optional().describe(`Error code`),details:u().optional().describe(`Error details`)}).optional().describe(`Error information`),logs:C(r()).optional().describe(`Execution logs`)}),wke={databaseSync:e=>({name:e.name,source:{type:`database`,config:{table:e.sourceTable}},destination:{type:`database`,config:{table:e.destTable},writeMode:`upsert`},syncMode:`incremental`,schedule:e.schedule,enabled:!0}),apiToDatabase:e=>({name:e.name,source:{type:`api`,connector:e.apiConnector,config:{}},destination:{type:`database`,config:{table:e.destTable},writeMode:`append`},syncMode:`full`,schedule:e.schedule,enabled:!0})},cQ=E([`crm`,`payment`,`communication`,`storage`,`analytics`,`database`,`marketing`,`accounting`,`hr`,`productivity`,`ecommerce`,`support`,`devtools`,`social`,`other`]),lQ=E([`none`,`apiKey`,`basic`,`bearer`,`oauth1`,`oauth2`,`custom`]),uQ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Field name (snake_case)`),label:r().describe(`Field label`),type:E([`text`,`password`,`url`,`select`]).default(`text`).describe(`Field type`),description:r().optional().describe(`Field description`),required:S().default(!0).describe(`Required field`),default:r().optional().describe(`Default value`),options:C(h({label:r(),value:r()})).optional().describe(`Select field options`),placeholder:r().optional().describe(`Placeholder text`)}),dQ=h({authorizationUrl:r().url().describe(`Authorization endpoint URL`),tokenUrl:r().url().describe(`Token endpoint URL`),scopes:C(r()).optional().describe(`OAuth scopes`),clientIdField:r().default(`client_id`).describe(`Client ID field name`),clientSecretField:r().default(`client_secret`).describe(`Client secret field name`)}),fQ=h({type:lQ.describe(`Authentication type`),fields:C(uQ).optional().describe(`Authentication fields`),oauth2:dQ.optional().describe(`OAuth 2.0 configuration`),test:h({url:r().optional().describe(`Test endpoint URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`]).default(`GET`).describe(`HTTP method`)}).optional().describe(`Authentication test configuration`)}),pQ=E([`read`,`write`,`delete`,`search`,`trigger`,`action`]),mQ=h({name:r().describe(`Parameter name`),label:r().describe(`Parameter label`),description:r().optional().describe(`Parameter description`),type:E([`string`,`number`,`boolean`,`array`,`object`,`date`,`file`]).describe(`Parameter type`),required:S().default(!1).describe(`Required parameter`),default:u().optional().describe(`Default value`),validation:d(r(),u()).optional().describe(`Validation rules`),dynamicOptions:r().optional().describe(`Function to load dynamic options`)}),hQ=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Operation ID (snake_case)`),name:r().describe(`Operation name`),description:r().optional().describe(`Operation description`),type:pQ.describe(`Operation type`),inputSchema:C(mQ).optional().describe(`Input parameters`),outputSchema:d(r(),u()).optional().describe(`Output schema`),sampleOutput:u().optional().describe(`Sample output`),supportsPagination:S().default(!1).describe(`Supports pagination`),supportsFiltering:S().default(!1).describe(`Supports filtering`)}),gQ=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Trigger ID (snake_case)`),name:r().describe(`Trigger name`),description:r().optional().describe(`Trigger description`),type:E([`webhook`,`polling`,`stream`]).describe(`Trigger mechanism`),config:d(r(),u()).optional().describe(`Trigger configuration`),outputSchema:d(r(),u()).optional().describe(`Event payload schema`),pollingIntervalMs:P().int().min(1e3).optional().describe(`Polling interval in ms`)}),Tke=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Connector ID (snake_case)`),name:r().describe(`Connector name`),description:r().optional().describe(`Connector description`),version:r().optional().describe(`Connector version`),icon:r().optional().describe(`Connector icon`),category:cQ.describe(`Connector category`),baseUrl:r().url().optional().describe(`API base URL`),authentication:fQ.describe(`Authentication config`),operations:C(hQ).optional().describe(`Connector operations`),triggers:C(gQ).optional().describe(`Connector triggers`),rateLimit:h({requestsPerSecond:P().optional().describe(`Max requests per second`),requestsPerMinute:P().optional().describe(`Max requests per minute`),requestsPerHour:P().optional().describe(`Max requests per hour`)}).optional().describe(`Rate limiting`),author:r().optional().describe(`Connector author`),documentation:r().url().optional().describe(`Documentation URL`),homepage:r().url().optional().describe(`Homepage URL`),license:r().optional().describe(`License (SPDX identifier)`),tags:C(r()).optional().describe(`Connector tags`),verified:S().default(!1).describe(`Verified connector`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),Eke=h({id:r().describe(`Instance ID`),connectorId:r().describe(`Connector ID`),name:r().describe(`Instance name`),description:r().optional().describe(`Instance description`),credentials:d(r(),u()).describe(`Encrypted credentials`),config:d(r(),u()).optional().describe(`Additional config`),active:S().default(!0).describe(`Instance active status`),createdAt:r().datetime().optional().describe(`Creation time`),lastTestedAt:r().datetime().optional().describe(`Last test time`),testStatus:E([`unknown`,`success`,`failed`]).default(`unknown`).describe(`Connection test status`)}),Dke={apiKey:e=>({id:e.id,name:e.name,category:e.category,baseUrl:e.baseUrl,authentication:{type:`apiKey`,fields:[{name:`api_key`,label:`API Key`,type:`password`,required:!0}]},verified:!1}),oauth2:e=>({id:e.id,name:e.name,category:e.category,baseUrl:e.baseUrl,authentication:{type:`oauth2`,oauth2:{authorizationUrl:e.authUrl,tokenUrl:e.tokenUrl,clientIdField:`client_id`,clientSecretField:`client_secret`,scopes:e.scopes}},verified:!1})},_Q=E([`push`,`pull`,`bidirectional`]),vQ=E([`full`,`incremental`,`realtime`]),yQ=E([`source_wins`,`destination_wins`,`latest_wins`,`manual`,`merge`]),bQ=h({object:r().optional().describe(`ObjectStack object name`),filters:u().optional().describe(`Filter conditions`),fields:C(r()).optional().describe(`Fields to sync`),connectorInstanceId:r().optional().describe(`Connector instance ID`),externalResource:r().optional().describe(`External resource ID`)}),xQ=h({object:r().optional().describe(`ObjectStack object name`),connectorInstanceId:r().optional().describe(`Connector instance ID`),operation:E([`insert`,`update`,`upsert`,`delete`,`sync`]).describe(`Sync operation`),mapping:l([d(r(),r()),C(MA)]).optional().describe(`Field mappings`),externalResource:r().optional().describe(`External resource ID`),matchKey:C(r()).optional().describe(`Match key fields`)}),Oke=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Sync configuration name (snake_case)`),label:r().optional().describe(`Sync display name`),description:r().optional().describe(`Sync description`),source:bQ.describe(`Data source`),destination:xQ.describe(`Data destination`),direction:_Q.default(`push`).describe(`Sync direction`),syncMode:vQ.default(`incremental`).describe(`Sync mode`),conflictResolution:yQ.default(`latest_wins`).describe(`Conflict resolution`),schedule:r().optional().describe(`Cron schedule`),enabled:S().default(!0).describe(`Sync enabled`),changeTrackingField:r().optional().describe(`Field for change tracking`),batchSize:P().int().min(1).max(1e4).default(100).describe(`Batch size for processing`),retry:h({maxAttempts:P().int().min(0).default(3).describe(`Max retries`),backoffMs:P().int().min(0).default(3e4).describe(`Backoff duration`)}).optional().describe(`Retry configuration`),validation:h({required:C(r()).optional().describe(`Required fields`),unique:C(r()).optional().describe(`Unique constraint fields`),custom:C(h({name:r(),condition:r().describe(`Validation condition`),message:r().describe(`Error message`)})).optional().describe(`Custom validation rules`)}).optional().describe(`Validation rules`),errorHandling:h({onValidationError:E([`skip`,`fail`,`log`]).default(`skip`),onSyncError:E([`skip`,`fail`,`retry`]).default(`retry`),notifyOnError:C(r()).optional().describe(`Email notifications`)}).optional().describe(`Error handling`),optimization:h({parallelBatches:S().default(!1).describe(`Process batches in parallel`),cacheEnabled:S().default(!0).describe(`Enable caching`),compressionEnabled:S().default(!1).describe(`Enable compression`)}).optional().describe(`Performance optimization`),audit:h({logLevel:E([`none`,`error`,`warn`,`info`,`debug`]).default(`info`),retainLogsForDays:P().int().min(1).default(30),trackChanges:S().default(!0).describe(`Track all changes`)}).optional().describe(`Audit configuration`),tags:C(r()).optional().describe(`Sync tags`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),SQ=E([`pending`,`running`,`completed`,`partial`,`failed`,`cancelled`]),kke=h({id:r().describe(`Execution ID`),syncName:r().describe(`Sync name`),status:SQ.describe(`Execution status`),startedAt:r().datetime().describe(`Start time`),completedAt:r().datetime().optional().describe(`Completion time`),durationMs:P().optional().describe(`Duration in ms`),stats:h({recordsProcessed:P().int().default(0).describe(`Total records processed`),recordsInserted:P().int().default(0).describe(`Records inserted`),recordsUpdated:P().int().default(0).describe(`Records updated`),recordsDeleted:P().int().default(0).describe(`Records deleted`),recordsSkipped:P().int().default(0).describe(`Records skipped`),recordsErrored:P().int().default(0).describe(`Records with errors`),conflictsDetected:P().int().default(0).describe(`Conflicts detected`),conflictsResolved:P().int().default(0).describe(`Conflicts resolved`)}).optional().describe(`Execution statistics`),errors:C(h({recordId:r().optional().describe(`Record ID`),field:r().optional().describe(`Field name`),message:r().describe(`Error message`),code:r().optional().describe(`Error code`)})).optional().describe(`Errors`),logs:C(r()).optional().describe(`Execution logs`)}),Ake={objectSync:e=>({name:e.name,source:{object:e.sourceObject},destination:{object:e.destObject,operation:`upsert`,mapping:e.mapping},direction:`push`,syncMode:`incremental`,conflictResolution:`latest_wins`,batchSize:100,schedule:e.schedule,enabled:!0}),connectorSync:e=>({name:e.name,source:{object:e.sourceObject},destination:{connectorInstanceId:e.connectorInstanceId,externalResource:e.externalResource,operation:`upsert`,mapping:e.mapping},direction:`push`,syncMode:`incremental`,conflictResolution:`latest_wins`,batchSize:100,schedule:e.schedule,enabled:!0}),bidirectionalSync:e=>({name:e.name,source:{object:e.object},destination:{connectorInstanceId:e.connectorInstanceId,externalResource:e.externalResource,operation:`sync`,mapping:e.mapping},direction:`bidirectional`,syncMode:`incremental`,conflictResolution:`latest_wins`,batchSize:100,schedule:e.schedule,enabled:!0})},CQ=E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`Wait event type determining how a paused flow is resumed`),jke=h({executionId:r().describe(`Execution ID of the paused flow`),checkpointId:r().describe(`Checkpoint ID to resume from`),nodeId:r().describe(`Wait node ID being resumed`),eventType:CQ.describe(`Event type that triggered resume`),signalName:r().optional().describe(`Signal name (when eventType is signal)`),webhookPayload:d(r(),u()).optional().describe(`Webhook request payload (when eventType is webhook)`),resumedBy:r().optional().describe(`User ID or system identifier that triggered resume`),resumedAt:r().datetime().describe(`ISO 8601 timestamp of the resume event`),variables:d(r(),u()).optional().describe(`Variables to merge into flow context upon resume`)}).describe(`Payload for resuming a paused wait node`),wQ=E([`fail`,`continue`,`fallback`]).describe(`Behavior when a wait node exceeds its timeout`),Mke=h({defaultTimeoutMs:P().int().min(0).default(864e5).describe(`Default timeout in ms (default: 24 hours)`),defaultTimeoutBehavior:wQ.default(`fail`).describe(`Default behavior when wait timeout is exceeded`),conditionPollIntervalMs:P().int().min(1e3).default(3e4).describe(`Polling interval for condition waits in ms (default: 30s)`),conditionMaxPolls:P().int().min(0).default(0).describe(`Max polling attempts for condition waits (0 = unlimited)`),webhookUrlPattern:r().default(`/api/v1/automation/resume/{executionId}/{nodeId}`).describe(`URL pattern for webhook resume endpoints`),persistCheckpoints:S().default(!0).describe(`Persist wait checkpoints to durable storage`),maxPausedExecutions:P().int().min(0).default(0).describe(`Max concurrent paused executions (0 = unlimited)`)}).describe(`Wait node executor plugin configuration`),Nke=h({id:r().describe(`Unique executor plugin identifier`),name:r().describe(`Display name`),nodeTypes:C(r()).min(1).describe(`FlowNodeAction types this executor handles`),version:r().describe(`Plugin version (semver)`),description:r().optional().describe(`Executor description`),supportsPause:S().default(!1).describe(`Whether the executor supports async pause/resume`),supportsCancellation:S().default(!1).describe(`Whether the executor supports mid-execution cancellation`),supportsRetry:S().default(!0).describe(`Whether the executor supports retry on failure`),configSchemaRef:r().optional().describe(`JSON Schema $ref for executor-specific config`)}).describe(`Node executor plugin descriptor`),Pke={id:`objectstack:wait-executor`,name:`Wait Node Executor`,nodeTypes:[`wait`],version:`1.0.0`,description:`Pauses flow execution and resumes on timer, signal, webhook, manual action, or condition events.`,supportsPause:!0,supportsCancellation:!0,supportsRetry:!0},TQ=h({bpmnType:r().describe(`BPMN XML element type (e.g., "bpmn:parallelGateway")`),flowNodeAction:r().describe(`ObjectStack FlowNodeAction value`),bidirectional:S().default(!0).describe(`Whether the mapping supports both import and export`),notes:r().optional().describe(`Notes about mapping limitations`)}).describe(`Mapping between BPMN XML element and ObjectStack FlowNodeAction`),EQ=E([`skip`,`warn`,`error`,`comment`]).describe(`Strategy for unmapped BPMN elements during import`),Fke=h({unmappedStrategy:EQ.default(`warn`).describe(`How to handle unmapped BPMN elements`),customMappings:C(TQ).optional().describe(`Custom element mappings to override or extend defaults`),importLayout:S().default(!0).describe(`Import BPMN DI layout positions into canvas node coordinates`),importDocumentation:S().default(!0).describe(`Import BPMN documentation elements as node descriptions`),flowName:r().optional().describe(`Override flow name (defaults to BPMN process name)`),validateAfterImport:S().default(!0).describe(`Validate imported flow against FlowSchema after import`)}).describe(`Options for importing BPMN 2.0 XML into an ObjectStack flow`),DQ=E([`2.0`,`2.0.2`]).describe(`BPMN specification version for export`),Ike=h({version:DQ.default(`2.0`).describe(`Target BPMN specification version`),includeLayout:S().default(!0).describe(`Include BPMN DI layout data from canvas positions`),includeExtensions:S().default(!1).describe(`Include ObjectStack extensions in BPMN extensionElements`),customMappings:C(TQ).optional().describe(`Custom element mappings for export`),prettyPrint:S().default(!0).describe(`Pretty-print XML output with indentation`),namespacePrefix:r().default(`bpmn`).describe(`XML namespace prefix for BPMN elements`)}).describe(`Options for exporting an ObjectStack flow as BPMN 2.0 XML`),OQ=h({severity:E([`info`,`warning`,`error`]).describe(`Diagnostic severity`),message:r().describe(`Diagnostic message`),bpmnElementId:r().optional().describe(`BPMN element ID related to this diagnostic`),nodeId:r().optional().describe(`ObjectStack node ID related to this diagnostic`)}).describe(`Diagnostic message from BPMN import/export`),Lke=h({success:S().describe(`Whether the operation completed successfully`),diagnostics:C(OQ).default([]).describe(`Diagnostic messages from the operation`),mappedCount:P().int().min(0).default(0).describe(`Number of elements successfully mapped`),unmappedCount:P().int().min(0).default(0).describe(`Number of elements that could not be mapped`)}).describe(`Result of a BPMN import/export operation`),Rke=[{bpmnType:`bpmn:startEvent`,flowNodeAction:`start`,bidirectional:!0},{bpmnType:`bpmn:endEvent`,flowNodeAction:`end`,bidirectional:!0},{bpmnType:`bpmn:exclusiveGateway`,flowNodeAction:`decision`,bidirectional:!0},{bpmnType:`bpmn:parallelGateway`,flowNodeAction:`parallel_gateway`,bidirectional:!0},{bpmnType:`bpmn:serviceTask`,flowNodeAction:`http_request`,bidirectional:!0,notes:`Maps HTTP/connector tasks`},{bpmnType:`bpmn:scriptTask`,flowNodeAction:`script`,bidirectional:!0},{bpmnType:`bpmn:userTask`,flowNodeAction:`screen`,bidirectional:!0},{bpmnType:`bpmn:callActivity`,flowNodeAction:`subflow`,bidirectional:!0},{bpmnType:`bpmn:intermediateCatchEvent`,flowNodeAction:`wait`,bidirectional:!0,notes:`Timer/signal/message catch events`},{bpmnType:`bpmn:boundaryEvent`,flowNodeAction:`boundary_event`,bidirectional:!0},{bpmnType:`bpmn:task`,flowNodeAction:`assignment`,bidirectional:!0,notes:`Generic BPMN task maps to assignment`}];DA({},{AckModeSchema:()=>m$,ApiVersionConfigSchema:()=>QQ,BuildConfigSchema:()=>A$,CdcConfigSchema:()=>r$,CircuitBreakerConfigSchema:()=>WQ,ConflictResolutionSchema:()=>jQ,ConnectorActionSchema:()=>JQ,ConnectorHealthSchema:()=>GQ,ConnectorSchema:()=>XQ,ConnectorStatusSchema:()=>qQ,ConnectorTriggerSchema:()=>YQ,ConnectorTypeSchema:()=>KQ,ConsumerConfigSchema:()=>g$,DataSyncConfigSchema:()=>MQ,DatabaseConnectorSchema:()=>Uke,DatabasePoolConfigSchema:()=>t$,DatabaseProviderSchema:()=>e$,DatabaseTableSchema:()=>i$,DeliveryGuaranteeSchema:()=>h$,DeploymentConfigSchema:()=>j$,DlqConfigSchema:()=>v$,DomainConfigSchema:()=>M$,EdgeFunctionConfigSchema:()=>P$,EnvironmentVariablesSchema:()=>N$,ErrorCategorySchema:()=>BQ,ErrorMappingConfigSchema:()=>HQ,ErrorMappingRuleSchema:()=>VQ,FieldMappingSchema:()=>kQ,FileAccessPatternSchema:()=>o$,FileFilterConfigSchema:()=>u$,FileMetadataConfigSchema:()=>s$,FileStorageConnectorSchema:()=>qke,FileStorageProviderSchema:()=>a$,FileVersioningConfigSchema:()=>l$,GitHubActionsWorkflowSchema:()=>w$,GitHubCommitConfigSchema:()=>S$,GitHubConnectorSchema:()=>nAe,GitHubIssueTrackingSchema:()=>E$,GitHubProviderSchema:()=>b$,GitHubPullRequestConfigSchema:()=>C$,GitHubReleaseConfigSchema:()=>T$,GitHubRepositorySchema:()=>x$,GitRepositoryConfigSchema:()=>k$,HealthCheckConfigSchema:()=>UQ,MessageFormatSchema:()=>p$,MessageQueueConnectorSchema:()=>Zke,MessageQueueProviderSchema:()=>f$,MultipartUploadConfigSchema:()=>c$,ProducerConfigSchema:()=>_$,RateLimitConfigSchema:()=>LQ,RateLimitStrategySchema:()=>IQ,RetryConfigSchema:()=>zQ,RetryStrategySchema:()=>RQ,SaasConnectorSchema:()=>Bke,SaasObjectTypeSchema:()=>$Q,SaasProviderSchema:()=>ZQ,SslConfigSchema:()=>n$,StorageBucketSchema:()=>d$,SyncStrategySchema:()=>AQ,TopicQueueSchema:()=>y$,VercelConnectorSchema:()=>aAe,VercelFrameworkSchema:()=>O$,VercelMonitoringSchema:()=>I$,VercelProjectSchema:()=>F$,VercelProviderSchema:()=>D$,VercelTeamSchema:()=>L$,WebhookConfigSchema:()=>FQ,WebhookEventSchema:()=>NQ,WebhookSignatureAlgorithmSchema:()=>PQ,azureBlobConnectorExample:()=>Xke,githubEnterpriseConnectorExample:()=>iAe,githubPublicConnectorExample:()=>rAe,googleDriveConnectorExample:()=>Yke,hubspotConnectorExample:()=>Hke,kafkaConnectorExample:()=>Qke,mongoConnectorExample:()=>Gke,postgresConnectorExample:()=>Wke,pubsubConnectorExample:()=>tAe,rabbitmqConnectorExample:()=>$ke,s3ConnectorExample:()=>Jke,salesforceConnectorExample:()=>Vke,snowflakeConnectorExample:()=>Kke,sqsConnectorExample:()=>eAe,vercelNextJsConnectorExample:()=>oAe,vercelStaticSiteConnectorExample:()=>sAe});var zke=I(`type`,[h({type:m(`oauth2`),authorizationUrl:r().url().describe(`OAuth2 authorization endpoint`),tokenUrl:r().url().describe(`OAuth2 token endpoint`),clientId:r().describe(`OAuth2 client ID`),clientSecret:r().describe(`OAuth2 client secret (typically from ENV)`),scopes:C(r()).optional().describe(`Requested OAuth2 scopes`),redirectUri:r().url().optional().describe(`OAuth2 redirect URI`),refreshToken:r().optional().describe(`Refresh token for token renewal`),tokenExpiry:P().optional().describe(`Token expiry timestamp`)}),h({type:m(`api-key`),key:r().describe(`API key value`),headerName:r().default(`X-API-Key`).describe(`HTTP header name for API key`),paramName:r().optional().describe(`Query parameter name (alternative to header)`)}),h({type:m(`basic`),username:r().describe(`Username`),password:r().describe(`Password`)}),h({type:m(`bearer`),token:r().describe(`Bearer token`)}),h({type:m(`none`)})]),kQ=MA.extend({dataType:E([`string`,`number`,`boolean`,`date`,`datetime`,`json`,`array`]).optional().describe(`Target data type`),required:S().default(!1).describe(`Field is required`),syncMode:E([`read_only`,`write_only`,`bidirectional`]).default(`bidirectional`).describe(`Sync mode`)}),AQ=E([`full`,`incremental`,`upsert`,`append_only`]).describe(`Synchronization strategy`),jQ=E([`source_wins`,`target_wins`,`latest_wins`,`manual`]).describe(`Conflict resolution strategy`),MQ=h({strategy:AQ.optional().default(`incremental`),direction:E([`import`,`export`,`bidirectional`]).optional().default(`import`).describe(`Sync direction`),schedule:r().optional().describe(`Cron expression for scheduled sync`),realtimeSync:S().optional().default(!1).describe(`Enable real-time sync`),timestampField:r().optional().describe(`Field to track last modification time`),conflictResolution:jQ.optional().default(`latest_wins`),batchSize:P().min(1).max(1e4).optional().default(1e3).describe(`Records per batch`),deleteMode:E([`hard_delete`,`soft_delete`,`ignore`]).optional().default(`soft_delete`).describe(`Delete handling mode`),filters:d(r(),u()).optional().describe(`Filter criteria for selective sync`)}),NQ=E([`record.created`,`record.updated`,`record.deleted`,`sync.started`,`sync.completed`,`sync.failed`,`auth.expired`,`rate_limit.exceeded`]).describe(`Webhook event type`),PQ=E([`hmac_sha256`,`hmac_sha512`,`none`]).describe(`Webhook signature algorithm`),FQ=YZ.extend({events:C(NQ).optional().describe(`Connector events to subscribe to`),signatureAlgorithm:PQ.optional().default(`hmac_sha256`)}),IQ=E([`fixed_window`,`sliding_window`,`token_bucket`,`leaky_bucket`]).describe(`Rate limiting strategy`),LQ=h({strategy:IQ.optional().default(`token_bucket`),maxRequests:P().min(1).describe(`Maximum requests per window`),windowSeconds:P().min(1).describe(`Time window in seconds`),burstCapacity:P().min(1).optional().describe(`Burst capacity`),respectUpstreamLimits:S().optional().default(!0).describe(`Respect external rate limit headers`),rateLimitHeaders:h({remaining:r().optional().default(`X-RateLimit-Remaining`).describe(`Header for remaining requests`),limit:r().optional().default(`X-RateLimit-Limit`).describe(`Header for rate limit`),reset:r().optional().default(`X-RateLimit-Reset`).describe(`Header for reset time`)}).optional().describe(`Custom rate limit headers`)}),RQ=E([`exponential_backoff`,`linear_backoff`,`fixed_delay`,`no_retry`]).describe(`Retry strategy`),zQ=h({strategy:RQ.optional().default(`exponential_backoff`),maxAttempts:P().min(0).max(10).optional().default(3).describe(`Maximum retry attempts`),initialDelayMs:P().min(100).optional().default(1e3).describe(`Initial retry delay in ms`),maxDelayMs:P().min(1e3).optional().default(6e4).describe(`Maximum retry delay in ms`),backoffMultiplier:P().min(1).optional().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:C(P()).optional().default([408,429,500,502,503,504]).describe(`HTTP status codes to retry`),retryOnNetworkError:S().optional().default(!0).describe(`Retry on network errors`),jitter:S().optional().default(!0).describe(`Add jitter to retry delays`)}),BQ=E([`validation`,`authorization`,`not_found`,`conflict`,`rate_limit`,`timeout`,`server_error`,`integration_error`]).describe(`Standard error category`),VQ=h({sourceCode:l([r(),P()]).describe(`External system error code`),sourceMessage:r().optional().describe(`Pattern to match against error message`),targetCode:r().describe(`ObjectStack standard error code`),targetCategory:BQ.describe(`Error category`),severity:E([`low`,`medium`,`high`,`critical`]).describe(`Error severity level`),retryable:S().describe(`Whether the error is retryable`),userMessage:r().optional().describe(`Human-readable message to show users`)}).describe(`Error mapping rule`),HQ=h({rules:C(VQ).describe(`Error mapping rules`),defaultCategory:BQ.optional().default(`integration_error`).describe(`Default category for unmapped errors`),unmappedBehavior:E([`passthrough`,`generic_error`,`throw`]).describe(`What to do with unmapped errors`),logUnmapped:S().optional().default(!0).describe(`Log unmapped errors`)}).describe(`Error mapping configuration`),UQ=h({enabled:S().describe(`Enable health checks`),intervalMs:P().optional().default(6e4).describe(`Health check interval in milliseconds`),timeoutMs:P().optional().default(5e3).describe(`Health check timeout in milliseconds`),endpoint:r().optional().describe(`Health check endpoint path`),method:E([`GET`,`HEAD`,`OPTIONS`]).optional().describe(`HTTP method for health check`),expectedStatus:P().optional().default(200).describe(`Expected HTTP status code`),unhealthyThreshold:P().optional().default(3).describe(`Consecutive failures before marking unhealthy`),healthyThreshold:P().optional().default(1).describe(`Consecutive successes before marking healthy`)}).describe(`Health check configuration`),WQ=h({enabled:S().describe(`Enable circuit breaker`),failureThreshold:P().optional().default(5).describe(`Failures before opening circuit`),resetTimeoutMs:P().optional().default(3e4).describe(`Time in open state before half-open`),halfOpenMaxRequests:P().optional().default(1).describe(`Requests allowed in half-open state`),monitoringWindow:P().optional().default(6e4).describe(`Rolling window for failure count in ms`),fallbackStrategy:E([`cache`,`default_value`,`error`,`queue`]).optional().describe(`Fallback strategy when circuit is open`)}).describe(`Circuit breaker configuration`),GQ=h({healthCheck:UQ.optional().describe(`Health check configuration`),circuitBreaker:WQ.optional().describe(`Circuit breaker configuration`)}).describe(`Connector health configuration`),KQ=E([`saas`,`database`,`file_storage`,`message_queue`,`api`,`custom`]).describe(`Connector type`),qQ=E([`active`,`inactive`,`error`,`configuring`]).describe(`Connector status`),JQ=h({key:r().describe(`Action key (machine name)`),label:r().describe(`Human readable label`),description:r().optional(),inputSchema:d(r(),u()).optional().describe(`Input parameters schema (JSON Schema)`),outputSchema:d(r(),u()).optional().describe(`Output schema (JSON Schema)`)}),YQ=h({key:r().describe(`Trigger key`),label:r().describe(`Trigger label`),description:r().optional(),type:E([`polling`,`webhook`]).describe(`Trigger type`),interval:P().optional().describe(`Polling interval in seconds`)}),XQ=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique connector identifier`),label:r().describe(`Display label`),type:KQ.describe(`Connector type`),description:r().optional().describe(`Connector description`),icon:r().optional().describe(`Icon identifier`),authentication:zke.describe(`Authentication configuration`),actions:C(JQ).optional(),triggers:C(YQ).optional(),syncConfig:MQ.optional().describe(`Data sync configuration`),fieldMappings:C(kQ).optional().describe(`Field mapping rules`),webhooks:C(FQ).optional().describe(`Webhook configurations`),rateLimitConfig:LQ.optional().describe(`Rate limiting configuration`),retryConfig:zQ.optional().describe(`Retry configuration`),connectionTimeoutMs:P().min(1e3).max(3e5).optional().default(3e4).describe(`Connection timeout in ms`),requestTimeoutMs:P().min(1e3).max(3e5).optional().default(3e4).describe(`Request timeout in ms`),status:qQ.optional().default(`inactive`).describe(`Connector status`),enabled:S().optional().default(!0).describe(`Enable connector`),errorMapping:HQ.optional().describe(`Error mapping configuration`),health:GQ.optional().describe(`Health and resilience configuration`),metadata:d(r(),u()).optional().describe(`Custom connector metadata`)}),ZQ=E([`salesforce`,`hubspot`,`stripe`,`shopify`,`zendesk`,`intercom`,`mailchimp`,`slack`,`microsoft_dynamics`,`servicenow`,`netsuite`,`custom`]).describe(`SaaS provider type`),QQ=h({version:r().describe(`API version (e.g., "v2", "2023-10-01")`),isDefault:S().default(!1).describe(`Is this the default version`),deprecationDate:r().optional().describe(`API version deprecation date (ISO 8601)`),sunsetDate:r().optional().describe(`API version sunset date (ISO 8601)`)}),$Q=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object type name (snake_case)`),label:r().describe(`Display label`),apiName:r().describe(`API name in external system`),enabled:S().default(!0).describe(`Enable sync for this object`),supportsCreate:S().default(!0).describe(`Supports record creation`),supportsUpdate:S().default(!0).describe(`Supports record updates`),supportsDelete:S().default(!0).describe(`Supports record deletion`),fieldMappings:C(kQ).optional().describe(`Object-specific field mappings`)}),Bke=XQ.extend({type:m(`saas`),provider:ZQ.describe(`SaaS provider type`),baseUrl:r().url().describe(`API base URL`),apiVersion:QQ.optional().describe(`API version configuration`),objectTypes:C($Q).describe(`Syncable object types`),oauthSettings:h({scopes:C(r()).describe(`Required OAuth scopes`),refreshTokenUrl:r().url().optional().describe(`Token refresh endpoint`),revokeTokenUrl:r().url().optional().describe(`Token revocation endpoint`),autoRefresh:S().default(!0).describe(`Automatically refresh expired tokens`)}).optional().describe(`OAuth-specific configuration`),paginationConfig:h({type:E([`cursor`,`offset`,`page`]).default(`cursor`).describe(`Pagination type`),defaultPageSize:P().min(1).max(1e3).default(100).describe(`Default page size`),maxPageSize:P().min(1).max(1e4).default(1e3).describe(`Maximum page size`)}).optional().describe(`Pagination configuration`),sandboxConfig:h({enabled:S().default(!1).describe(`Use sandbox environment`),baseUrl:r().url().optional().describe(`Sandbox API base URL`)}).optional().describe(`Sandbox environment configuration`),customHeaders:d(r(),r()).optional().describe(`Custom HTTP headers for all requests`)}),Vke={name:`salesforce_production`,label:`Salesforce Production`,type:`saas`,provider:`salesforce`,baseUrl:`https://example.my.salesforce.com`,apiVersion:{version:`v59.0`,isDefault:!0},authentication:{type:`oauth2`,clientId:"${SALESFORCE_CLIENT_ID}",clientSecret:"${SALESFORCE_CLIENT_SECRET}",authorizationUrl:`https://login.salesforce.com/services/oauth2/authorize`,tokenUrl:`https://login.salesforce.com/services/oauth2/token`,grantType:`authorization_code`,scopes:[`api`,`refresh_token`,`offline_access`]},objectTypes:[{name:`account`,label:`Account`,apiName:`Account`,enabled:!0,supportsCreate:!0,supportsUpdate:!0,supportsDelete:!0},{name:`contact`,label:`Contact`,apiName:`Contact`,enabled:!0,supportsCreate:!0,supportsUpdate:!0,supportsDelete:!0}],syncConfig:{strategy:`incremental`,direction:`bidirectional`,schedule:`0 */6 * * *`,realtimeSync:!0,conflictResolution:`latest_wins`,batchSize:200,deleteMode:`soft_delete`},rateLimitConfig:{strategy:`token_bucket`,maxRequests:100,windowSeconds:20,respectUpstreamLimits:!0},retryConfig:{strategy:`exponential_backoff`,maxAttempts:3,initialDelayMs:1e3,maxDelayMs:3e4,backoffMultiplier:2,retryableStatusCodes:[408,429,500,502,503,504],retryOnNetworkError:!0,jitter:!0},status:`active`,enabled:!0},Hke={name:`hubspot_crm`,label:`HubSpot CRM`,type:`saas`,provider:`hubspot`,baseUrl:`https://api.hubapi.com`,authentication:{type:`api_key`,apiKey:"${HUBSPOT_API_KEY}",headerName:`Authorization`},objectTypes:[{name:`company`,label:`Company`,apiName:`companies`,enabled:!0,supportsCreate:!0,supportsUpdate:!0,supportsDelete:!0},{name:`deal`,label:`Deal`,apiName:`deals`,enabled:!0,supportsCreate:!0,supportsUpdate:!0,supportsDelete:!0}],syncConfig:{strategy:`incremental`,direction:`import`,schedule:`0 */4 * * *`,conflictResolution:`source_wins`,batchSize:100},rateLimitConfig:{strategy:`token_bucket`,maxRequests:100,windowSeconds:10},status:`active`,enabled:!0},e$=E([`postgresql`,`mysql`,`mariadb`,`mssql`,`oracle`,`mongodb`,`redis`,`cassandra`,`snowflake`,`bigquery`,`redshift`,`custom`]).describe(`Database provider type`),t$=h({min:P().min(0).default(2).describe(`Minimum connections in pool`),max:P().min(1).default(10).describe(`Maximum connections in pool`),idleTimeoutMs:P().min(1e3).default(3e4).describe(`Idle connection timeout in ms`),connectionTimeoutMs:P().min(1e3).default(1e4).describe(`Connection establishment timeout in ms`),acquireTimeoutMs:P().min(1e3).default(3e4).describe(`Connection acquisition timeout in ms`),evictionRunIntervalMs:P().min(1e3).default(3e4).describe(`Connection eviction check interval in ms`),testOnBorrow:S().default(!0).describe(`Test connection before use`)}),n$=h({enabled:S().default(!1).describe(`Enable SSL/TLS`),rejectUnauthorized:S().default(!0).describe(`Reject unauthorized certificates`),ca:r().optional().describe(`Certificate Authority certificate`),cert:r().optional().describe(`Client certificate`),key:r().optional().describe(`Client private key`)}),r$=h({enabled:S().default(!1).describe(`Enable CDC`),method:E([`log_based`,`trigger_based`,`query_based`,`custom`]).describe(`CDC method`),slotName:r().optional().describe(`Replication slot name (for log-based CDC)`),publicationName:r().optional().describe(`Publication name (for PostgreSQL)`),startPosition:r().optional().describe(`Starting position/LSN for CDC stream`),batchSize:P().min(1).max(1e4).default(1e3).describe(`CDC batch size`),pollIntervalMs:P().min(100).default(1e3).describe(`CDC polling interval in ms`)}),i$=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Table name in ObjectStack (snake_case)`),label:r().describe(`Display label`),schema:r().optional().describe(`Database schema name`),tableName:r().describe(`Actual table name in database`),primaryKey:r().describe(`Primary key column`),enabled:S().default(!0).describe(`Enable sync for this table`),fieldMappings:C(kQ).optional().describe(`Table-specific field mappings`),whereClause:r().optional().describe(`SQL WHERE clause for filtering`)}),Uke=XQ.extend({type:m(`database`),provider:e$.describe(`Database provider type`),connectionConfig:h({host:r().describe(`Database host`),port:P().min(1).max(65535).describe(`Database port`),database:r().describe(`Database name`),username:r().describe(`Database username`),password:r().describe(`Database password (typically from ENV)`),options:d(r(),u()).optional().describe(`Driver-specific connection options`)}).describe(`Database connection configuration`),poolConfig:t$.optional().describe(`Connection pool configuration`),sslConfig:n$.optional().describe(`SSL/TLS configuration`),tables:C(i$).describe(`Tables to sync`),cdcConfig:r$.optional().describe(`CDC configuration`),readReplicaConfig:h({enabled:S().default(!1).describe(`Use read replicas`),hosts:C(h({host:r().describe(`Replica host`),port:P().min(1).max(65535).describe(`Replica port`),weight:P().min(0).max(1).default(1).describe(`Load balancing weight`)})).describe(`Read replica hosts`)}).optional().describe(`Read replica configuration`),queryTimeoutMs:P().min(1e3).max(3e5).optional().default(3e4).describe(`Query timeout in ms`),enableQueryLogging:S().optional().default(!1).describe(`Enable SQL query logging`)}),Wke={name:`postgres_production`,label:`Production PostgreSQL`,type:`database`,provider:`postgresql`,authentication:{type:`basic`,username:"${DB_USERNAME}",password:"${DB_PASSWORD}"},connectionConfig:{host:`db.example.com`,port:5432,database:`production`,username:"${DB_USERNAME}",password:"${DB_PASSWORD}"},poolConfig:{min:2,max:20,idleTimeoutMs:3e4,connectionTimeoutMs:1e4,acquireTimeoutMs:3e4,evictionRunIntervalMs:3e4,testOnBorrow:!0},sslConfig:{enabled:!0,rejectUnauthorized:!0},tables:[{name:`customer`,label:`Customer`,schema:`public`,tableName:`customers`,primaryKey:`id`,enabled:!0},{name:`order`,label:`Order`,schema:`public`,tableName:`orders`,primaryKey:`id`,enabled:!0,whereClause:`status != 'archived'`}],cdcConfig:{enabled:!0,method:`log_based`,slotName:`objectstack_replication_slot`,publicationName:`objectstack_publication`,batchSize:1e3,pollIntervalMs:1e3},syncConfig:{strategy:`incremental`,direction:`bidirectional`,realtimeSync:!0,conflictResolution:`latest_wins`,batchSize:1e3,deleteMode:`soft_delete`},status:`active`,enabled:!0},Gke={name:`mongodb_analytics`,label:`MongoDB Analytics`,type:`database`,provider:`mongodb`,authentication:{type:`basic`,username:"${MONGO_USERNAME}",password:"${MONGO_PASSWORD}"},connectionConfig:{host:`mongodb.example.com`,port:27017,database:`analytics`,username:"${MONGO_USERNAME}",password:"${MONGO_PASSWORD}",options:{authSource:`admin`,replicaSet:`rs0`}},tables:[{name:`event`,label:`Event`,tableName:`events`,primaryKey:`id`,enabled:!0}],cdcConfig:{enabled:!0,method:`log_based`,batchSize:1e3,pollIntervalMs:500},syncConfig:{strategy:`incremental`,direction:`import`,batchSize:1e3},status:`active`,enabled:!0},Kke={name:`snowflake_warehouse`,label:`Snowflake Data Warehouse`,type:`database`,provider:`snowflake`,authentication:{type:`basic`,username:"${SNOWFLAKE_USERNAME}",password:"${SNOWFLAKE_PASSWORD}"},connectionConfig:{host:`account.snowflakecomputing.com`,port:443,database:`ANALYTICS_DB`,username:"${SNOWFLAKE_USERNAME}",password:"${SNOWFLAKE_PASSWORD}",options:{warehouse:`COMPUTE_WH`,schema:`PUBLIC`,role:`ANALYST`}},tables:[{name:`sales_summary`,label:`Sales Summary`,schema:`PUBLIC`,tableName:`SALES_SUMMARY`,primaryKey:`ID`,enabled:!0}],syncConfig:{strategy:`full`,direction:`import`,schedule:`0 2 * * *`,batchSize:5e3},queryTimeoutMs:6e4,status:`active`,enabled:!0},a$=E([`s3`,`azure_blob`,`gcs`,`dropbox`,`box`,`onedrive`,`google_drive`,`sharepoint`,`ftp`,`local`,`custom`]).describe(`File storage provider type`),o$=E([`public_read`,`private`,`authenticated_read`,`bucket_owner_read`,`bucket_owner_full`]).describe(`File access pattern`),s$=h({extractMetadata:S().default(!0).describe(`Extract file metadata`),metadataFields:C(E([`content_type`,`file_size`,`last_modified`,`etag`,`checksum`,`creator`,`created_at`,`custom`])).optional().describe(`Metadata fields to extract`),customMetadata:d(r(),r()).optional().describe(`Custom metadata key-value pairs`)}),c$=h({enabled:S().default(!0).describe(`Enable multipart uploads`),partSize:P().min(5*1024*1024).default(5*1024*1024).describe(`Part size in bytes (min 5MB)`),maxConcurrentParts:P().min(1).max(10).default(5).describe(`Maximum concurrent part uploads`),threshold:P().min(5*1024*1024).default(100*1024*1024).describe(`File size threshold for multipart upload in bytes`)}),l$=h({enabled:S().default(!1).describe(`Enable file versioning`),maxVersions:P().min(1).max(100).optional().describe(`Maximum versions to retain`),retentionDays:P().min(1).optional().describe(`Version retention period in days`)}),u$=h({includePatterns:C(r()).optional().describe(`File patterns to include (glob)`),excludePatterns:C(r()).optional().describe(`File patterns to exclude (glob)`),minFileSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxFileSize:P().min(1).optional().describe(`Maximum file size in bytes`),allowedExtensions:C(r()).optional().describe(`Allowed file extensions`),blockedExtensions:C(r()).optional().describe(`Blocked file extensions`)}),d$=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Bucket identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),bucketName:r().describe(`Actual bucket/container name in storage system`),region:r().optional().describe(`Storage region`),enabled:S().default(!0).describe(`Enable sync for this bucket`),prefix:r().optional().describe(`Prefix/path within bucket`),accessPattern:o$.optional().describe(`Access pattern`),fileFilters:u$.optional().describe(`File filter configuration`)}),qke=XQ.extend({type:m(`file_storage`),provider:a$.describe(`File storage provider type`),storageConfig:h({endpoint:r().url().optional().describe(`Custom endpoint URL`),region:r().optional().describe(`Default region`),pathStyle:S().optional().default(!1).describe(`Use path-style URLs (for S3-compatible)`)}).optional().describe(`Storage configuration`),buckets:C(d$).describe(`Buckets/containers to sync`),metadataConfig:s$.optional().describe(`Metadata extraction configuration`),multipartConfig:c$.optional().describe(`Multipart upload configuration`),versioningConfig:l$.optional().describe(`File versioning configuration`),encryption:h({enabled:S().default(!1).describe(`Enable server-side encryption`),algorithm:E([`AES256`,`aws:kms`,`custom`]).optional().describe(`Encryption algorithm`),kmsKeyId:r().optional().describe(`KMS key ID (for aws:kms)`)}).optional().describe(`Encryption configuration`),lifecyclePolicy:h({enabled:S().default(!1).describe(`Enable lifecycle policy`),deleteAfterDays:P().min(1).optional().describe(`Delete files after N days`),archiveAfterDays:P().min(1).optional().describe(`Archive files after N days`)}).optional().describe(`Lifecycle policy`),contentProcessing:h({extractText:S().default(!1).describe(`Extract text from documents`),generateThumbnails:S().default(!1).describe(`Generate image thumbnails`),thumbnailSizes:C(h({width:P().min(1),height:P().min(1)})).optional().describe(`Thumbnail sizes`),virusScan:S().default(!1).describe(`Scan for viruses`)}).optional().describe(`Content processing configuration`),bufferSize:P().min(1024).default(64*1024).describe(`Buffer size in bytes`),transferAcceleration:S().default(!1).describe(`Enable transfer acceleration`)}),Jke={name:`s3_production_assets`,label:`Production S3 Assets`,type:`file_storage`,provider:`s3`,authentication:{type:`api_key`,apiKey:"${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}",headerName:`Authorization`},storageConfig:{region:`us-east-1`,pathStyle:!1},buckets:[{name:`product_images`,label:`Product Images`,bucketName:`my-company-product-images`,region:`us-east-1`,enabled:!0,prefix:`products/`,accessPattern:`public_read`,fileFilters:{allowedExtensions:[`.jpg`,`.jpeg`,`.png`,`.webp`],maxFileSize:10*1024*1024}},{name:`customer_documents`,label:`Customer Documents`,bucketName:`my-company-customer-docs`,region:`us-east-1`,enabled:!0,accessPattern:`private`,fileFilters:{allowedExtensions:[`.pdf`,`.docx`,`.xlsx`],maxFileSize:50*1024*1024}}],metadataConfig:{extractMetadata:!0,metadataFields:[`content_type`,`file_size`,`last_modified`,`etag`]},multipartConfig:{enabled:!0,partSize:5*1024*1024,maxConcurrentParts:5,threshold:100*1024*1024},versioningConfig:{enabled:!0,maxVersions:10},encryption:{enabled:!0,algorithm:`aws:kms`,kmsKeyId:"${AWS_KMS_KEY_ID}"},contentProcessing:{extractText:!0,generateThumbnails:!0,thumbnailSizes:[{width:150,height:150},{width:300,height:300},{width:600,height:600}],virusScan:!0},syncConfig:{strategy:`incremental`,direction:`bidirectional`,realtimeSync:!0,conflictResolution:`latest_wins`,batchSize:100},transferAcceleration:!0,status:`active`,enabled:!0},Yke={name:`google_drive_team`,label:`Google Drive Team Folder`,type:`file_storage`,provider:`google_drive`,authentication:{type:`oauth2`,clientId:"${GOOGLE_CLIENT_ID}",clientSecret:"${GOOGLE_CLIENT_SECRET}",authorizationUrl:`https://accounts.google.com/o/oauth2/v2/auth`,tokenUrl:`https://oauth2.googleapis.com/token`,grantType:`authorization_code`,scopes:[`https://www.googleapis.com/auth/drive.file`]},buckets:[{name:`team_drive`,label:`Team Drive`,bucketName:`shared-team-drive`,enabled:!0,fileFilters:{excludePatterns:[`*.tmp`,`~$*`]}}],metadataConfig:{extractMetadata:!0,metadataFields:[`content_type`,`file_size`,`last_modified`,`creator`,`created_at`]},versioningConfig:{enabled:!0,maxVersions:5},syncConfig:{strategy:`incremental`,direction:`bidirectional`,realtimeSync:!0,conflictResolution:`latest_wins`,batchSize:50},status:`active`,enabled:!0},Xke={name:`azure_blob_storage`,label:`Azure Blob Storage`,type:`file_storage`,provider:`azure_blob`,authentication:{type:`api_key`,apiKey:"${AZURE_STORAGE_ACCOUNT_KEY}",headerName:`x-ms-blob-type`},storageConfig:{endpoint:`https://myaccount.blob.core.windows.net`},buckets:[{name:`archive_container`,label:`Archive Container`,bucketName:`archive`,enabled:!0,accessPattern:`private`}],metadataConfig:{extractMetadata:!0,metadataFields:[`content_type`,`file_size`,`last_modified`,`etag`]},encryption:{enabled:!0,algorithm:`AES256`},lifecyclePolicy:{enabled:!0,archiveAfterDays:90,deleteAfterDays:365},syncConfig:{strategy:`incremental`,direction:`import`,schedule:`0 1 * * *`,batchSize:200},status:`active`,enabled:!0},f$=E([`rabbitmq`,`kafka`,`redis_pubsub`,`redis_streams`,`aws_sqs`,`aws_sns`,`google_pubsub`,`azure_service_bus`,`azure_event_hubs`,`nats`,`pulsar`,`activemq`,`custom`]).describe(`Message queue provider type`),p$=E([`json`,`xml`,`protobuf`,`avro`,`text`,`binary`]).describe(`Message format/serialization`),m$=E([`auto`,`manual`,`client`]).describe(`Message acknowledgment mode`),h$=E([`at_most_once`,`at_least_once`,`exactly_once`]).describe(`Message delivery guarantee`),g$=h({enabled:S().optional().default(!0).describe(`Enable consumer`),consumerGroup:r().optional().describe(`Consumer group ID`),concurrency:P().min(1).max(100).optional().default(1).describe(`Number of concurrent consumers`),prefetchCount:P().min(1).max(1e3).optional().default(10).describe(`Prefetch count`),ackMode:m$.optional().default(`manual`),autoCommit:S().optional().default(!1).describe(`Auto-commit offsets`),autoCommitIntervalMs:P().min(100).optional().default(5e3).describe(`Auto-commit interval in ms`),sessionTimeoutMs:P().min(1e3).optional().default(3e4).describe(`Session timeout in ms`),rebalanceTimeoutMs:P().min(1e3).optional().describe(`Rebalance timeout in ms`)}),_$=h({enabled:S().optional().default(!0).describe(`Enable producer`),acks:E([`0`,`1`,`all`]).optional().default(`all`).describe(`Acknowledgment level`),compressionType:E([`none`,`gzip`,`snappy`,`lz4`,`zstd`]).optional().default(`none`).describe(`Compression type`),batchSize:P().min(1).optional().default(16384).describe(`Batch size in bytes`),lingerMs:P().min(0).optional().default(0).describe(`Linger time in ms`),maxInFlightRequests:P().min(1).optional().default(5).describe(`Max in-flight requests`),idempotence:S().optional().default(!0).describe(`Enable idempotent producer`),transactional:S().optional().default(!1).describe(`Enable transactional producer`),transactionTimeoutMs:P().min(1e3).optional().describe(`Transaction timeout in ms`)}),v$=h({enabled:S().optional().default(!1).describe(`Enable DLQ`),queueName:r().describe(`Dead letter queue/topic name`),maxRetries:P().min(0).max(100).optional().default(3).describe(`Max retries before DLQ`),retryDelayMs:P().min(0).optional().default(6e4).describe(`Retry delay in ms`)}),y$=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Topic/queue identifier in ObjectStack (snake_case)`),label:r().describe(`Display label`),topicName:r().describe(`Actual topic/queue name in message queue system`),enabled:S().optional().default(!0).describe(`Enable sync for this topic/queue`),mode:E([`consumer`,`producer`,`both`]).optional().default(`both`).describe(`Consumer, producer, or both`),messageFormat:p$.optional().default(`json`),partitions:P().min(1).optional().describe(`Number of partitions (for Kafka)`),replicationFactor:P().min(1).optional().describe(`Replication factor (for Kafka)`),consumerConfig:g$.optional().describe(`Consumer-specific configuration`),producerConfig:_$.optional().describe(`Producer-specific configuration`),dlqConfig:v$.optional().describe(`Dead letter queue configuration`),routingKey:r().optional().describe(`Routing key pattern`),messageFilter:h({headers:d(r(),r()).optional().describe(`Filter by message headers`),attributes:d(r(),u()).optional().describe(`Filter by message attributes`)}).optional().describe(`Message filter criteria`)}),Zke=XQ.extend({type:m(`message_queue`),provider:f$.describe(`Message queue provider type`),brokerConfig:h({brokers:C(r()).describe(`Broker addresses (host:port)`),clientId:r().optional().describe(`Client ID`),connectionTimeoutMs:P().min(1e3).optional().default(3e4).describe(`Connection timeout in ms`),requestTimeoutMs:P().min(1e3).optional().default(3e4).describe(`Request timeout in ms`)}).describe(`Broker connection configuration`),topics:C(y$).describe(`Topics/queues to sync`),deliveryGuarantee:h$.optional().default(`at_least_once`),sslConfig:h({enabled:S().optional().default(!1).describe(`Enable SSL/TLS`),rejectUnauthorized:S().optional().default(!0).describe(`Reject unauthorized certificates`),ca:r().optional().describe(`CA certificate`),cert:r().optional().describe(`Client certificate`),key:r().optional().describe(`Client private key`)}).optional().describe(`SSL/TLS configuration`),saslConfig:h({mechanism:E([`plain`,`scram-sha-256`,`scram-sha-512`,`aws`]).describe(`SASL mechanism`),username:r().optional().describe(`SASL username`),password:r().optional().describe(`SASL password`)}).optional().describe(`SASL authentication configuration`),schemaRegistry:h({url:r().url().describe(`Schema registry URL`),auth:h({username:r().optional(),password:r().optional()}).optional()}).optional().describe(`Schema registry configuration`),preserveOrder:S().optional().default(!0).describe(`Preserve message ordering`),enableMetrics:S().optional().default(!0).describe(`Enable message queue metrics`),enableTracing:S().optional().default(!1).describe(`Enable distributed tracing`)}),Qke={name:`kafka_production`,label:`Production Kafka Cluster`,type:`message_queue`,provider:`kafka`,authentication:{type:`none`},brokerConfig:{brokers:[`kafka-1.example.com:9092`,`kafka-2.example.com:9092`,`kafka-3.example.com:9092`],clientId:`objectstack-client`,connectionTimeoutMs:3e4,requestTimeoutMs:3e4},topics:[{name:`order_events`,label:`Order Events`,topicName:`orders`,enabled:!0,mode:`consumer`,messageFormat:`json`,partitions:10,replicationFactor:3,consumerConfig:{enabled:!0,consumerGroup:`objectstack-consumer-group`,concurrency:5,prefetchCount:100,ackMode:`manual`,autoCommit:!1,sessionTimeoutMs:3e4},dlqConfig:{enabled:!0,queueName:`orders-dlq`,maxRetries:3,retryDelayMs:6e4}},{name:`user_activity`,label:`User Activity`,topicName:`user-activity`,enabled:!0,mode:`producer`,messageFormat:`json`,partitions:5,replicationFactor:3,producerConfig:{enabled:!0,acks:`all`,compressionType:`snappy`,batchSize:16384,lingerMs:10,maxInFlightRequests:5,idempotence:!0}}],deliveryGuarantee:`at_least_once`,saslConfig:{mechanism:`scram-sha-256`,username:"${KAFKA_USERNAME}",password:"${KAFKA_PASSWORD}"},sslConfig:{enabled:!0,rejectUnauthorized:!0},preserveOrder:!0,enableMetrics:!0,enableTracing:!0,status:`active`,enabled:!0},$ke={name:`rabbitmq_events`,label:`RabbitMQ Event Bus`,type:`message_queue`,provider:`rabbitmq`,authentication:{type:`basic`,username:"${RABBITMQ_USERNAME}",password:"${RABBITMQ_PASSWORD}"},brokerConfig:{brokers:[`amqp://rabbitmq.example.com:5672`],clientId:`objectstack-rabbitmq-client`},topics:[{name:`notifications`,label:`Notifications`,topicName:`notifications`,enabled:!0,mode:`both`,messageFormat:`json`,routingKey:`notification.*`,consumerConfig:{enabled:!0,prefetchCount:10,ackMode:`manual`},producerConfig:{enabled:!0},dlqConfig:{enabled:!0,queueName:`notifications-dlq`,maxRetries:3,retryDelayMs:3e4}}],deliveryGuarantee:`at_least_once`,status:`active`,enabled:!0},eAe={name:`aws_sqs_queue`,label:`AWS SQS Queue`,type:`message_queue`,provider:`aws_sqs`,authentication:{type:`api_key`,apiKey:"${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}",headerName:`Authorization`},brokerConfig:{brokers:[`https://sqs.us-east-1.amazonaws.com`]},topics:[{name:`task_queue`,label:`Task Queue`,topicName:`task-queue`,enabled:!0,mode:`consumer`,messageFormat:`json`,consumerConfig:{enabled:!0,concurrency:10,prefetchCount:10,ackMode:`manual`},dlqConfig:{enabled:!0,queueName:`task-queue-dlq`,maxRetries:3,retryDelayMs:12e4}}],deliveryGuarantee:`at_least_once`,retryConfig:{strategy:`exponential_backoff`,maxAttempts:3,initialDelayMs:1e3,maxDelayMs:6e4,backoffMultiplier:2},status:`active`,enabled:!0},tAe={name:`gcp_pubsub`,label:`Google Cloud Pub/Sub`,type:`message_queue`,provider:`google_pubsub`,authentication:{type:`oauth2`,clientId:"${GCP_CLIENT_ID}",clientSecret:"${GCP_CLIENT_SECRET}",authorizationUrl:`https://accounts.google.com/o/oauth2/v2/auth`,tokenUrl:`https://oauth2.googleapis.com/token`,grantType:`client_credentials`,scopes:[`https://www.googleapis.com/auth/pubsub`]},brokerConfig:{brokers:[`pubsub.googleapis.com`]},topics:[{name:`analytics_events`,label:`Analytics Events`,topicName:`projects/my-project/topics/analytics-events`,enabled:!0,mode:`both`,messageFormat:`json`,consumerConfig:{enabled:!0,consumerGroup:`objectstack-subscription`,concurrency:5,prefetchCount:100,ackMode:`manual`}}],deliveryGuarantee:`at_least_once`,enableMetrics:!0,status:`active`,enabled:!0},b$=E([`github`,`github_enterprise`]).describe(`GitHub provider type`),x$=h({owner:r().describe(`Repository owner (organization or username)`),name:r().describe(`Repository name`),defaultBranch:r().optional().default(`main`).describe(`Default branch name`),autoMerge:S().optional().default(!1).describe(`Enable auto-merge for pull requests`),branchProtection:h({requiredReviewers:P().int().min(0).optional().default(1).describe(`Required number of reviewers`),requireStatusChecks:S().optional().default(!0).describe(`Require status checks to pass`),enforceAdmins:S().optional().default(!1).describe(`Enforce protections for admins`),allowForcePushes:S().optional().default(!1).describe(`Allow force pushes`),allowDeletions:S().optional().default(!1).describe(`Allow branch deletions`)}).optional().describe(`Branch protection configuration`),topics:C(r()).optional().describe(`Repository topics`)}),S$=h({authorName:r().optional().describe(`Commit author name`),authorEmail:r().email().optional().describe(`Commit author email`),signCommits:S().optional().default(!1).describe(`Sign commits with GPG`),messageTemplate:r().optional().describe(`Commit message template`),useConventionalCommits:S().optional().default(!0).describe(`Use conventional commits format`)}),C$=h({titleTemplate:r().optional().describe(`PR title template`),bodyTemplate:r().optional().describe(`PR body template`),defaultReviewers:C(r()).optional().describe(`Default reviewers (usernames)`),defaultAssignees:C(r()).optional().describe(`Default assignees (usernames)`),defaultLabels:C(r()).optional().describe(`Default labels`),draftByDefault:S().optional().default(!1).describe(`Create draft PRs by default`),deleteHeadBranch:S().optional().default(!0).describe(`Delete head branch after merge`)}),w$=h({name:r().describe(`Workflow name`),path:r().describe(`Workflow file path (e.g., .github/workflows/ci.yml)`),enabled:S().optional().default(!0).describe(`Enable workflow`),triggers:C(E([`push`,`pull_request`,`release`,`schedule`,`workflow_dispatch`,`repository_dispatch`])).optional().describe(`Workflow triggers`),env:d(r(),r()).optional().describe(`Environment variables`),secrets:C(r()).optional().describe(`Required secrets`)}),T$=h({tagPattern:r().optional().default(`v*`).describe(`Tag name pattern (e.g., v*, release/*)`),semanticVersioning:S().optional().default(!0).describe(`Use semantic versioning`),autoReleaseNotes:S().optional().default(!0).describe(`Generate release notes automatically`),releaseNameTemplate:r().optional().describe(`Release name template`),preReleasePattern:r().optional().describe(`Pre-release pattern (e.g., *-alpha, *-beta)`),draftByDefault:S().optional().default(!1).describe(`Create draft releases by default`)}),E$=h({enabled:S().optional().default(!0).describe(`Enable issue tracking`),defaultLabels:C(r()).optional().describe(`Default issue labels`),templatePaths:C(r()).optional().describe(`Issue template paths`),autoAssign:S().optional().default(!1).describe(`Auto-assign issues`),autoCloseStale:h({enabled:S().default(!1),daysBeforeStale:P().int().min(1).optional().default(60),daysBeforeClose:P().int().min(1).optional().default(7),staleLabel:r().optional().default(`stale`)}).optional().describe(`Auto-close stale issues configuration`)}),nAe=XQ.extend({type:m(`saas`),provider:b$.describe(`GitHub provider`),baseUrl:r().url().optional().default(`https://api.github.com`).describe(`GitHub API base URL`),repositories:C(x$).describe(`Repositories to manage`),commitConfig:S$.optional().describe(`Commit configuration`),pullRequestConfig:C$.optional().describe(`Pull request configuration`),workflows:C(w$).optional().describe(`GitHub Actions workflows`),releaseConfig:T$.optional().describe(`Release configuration`),issueTracking:E$.optional().describe(`Issue tracking configuration`),enableWebhooks:S().optional().default(!0).describe(`Enable GitHub webhooks`),webhookEvents:C(E([`push`,`pull_request`,`issues`,`issue_comment`,`release`,`workflow_run`,`deployment`,`deployment_status`,`check_run`,`check_suite`,`status`])).optional().describe(`Webhook events to subscribe to`)}),rAe={name:`github_public`,label:`GitHub.com`,type:`saas`,provider:`github`,baseUrl:`https://api.github.com`,authentication:{type:`oauth2`,clientId:"${GITHUB_CLIENT_ID}",clientSecret:"${GITHUB_CLIENT_SECRET}",authorizationUrl:`https://github.com/login/oauth/authorize`,tokenUrl:`https://github.com/login/oauth/access_token`,scopes:[`repo`,`workflow`,`write:packages`]},repositories:[{owner:`objectstack-ai`,name:`spec`,defaultBranch:`main`,autoMerge:!1,branchProtection:{requiredReviewers:1,requireStatusChecks:!0,enforceAdmins:!1,allowForcePushes:!1,allowDeletions:!1},topics:[`objectstack`,`low-code`,`metadata-driven`]}],commitConfig:{authorName:`ObjectStack Bot`,authorEmail:`bot@objectstack.ai`,signCommits:!1,useConventionalCommits:!0},pullRequestConfig:{titleTemplate:`{{type}}: {{description}}`,defaultReviewers:[`team-lead`],defaultLabels:[`automated`,`ai-generated`],draftByDefault:!1,deleteHeadBranch:!0},workflows:[{name:`CI`,path:`.github/workflows/ci.yml`,enabled:!0,triggers:[`push`,`pull_request`]},{name:`Release`,path:`.github/workflows/release.yml`,enabled:!0,triggers:[`release`]}],releaseConfig:{tagPattern:`v*`,semanticVersioning:!0,autoReleaseNotes:!0,releaseNameTemplate:`Release {{version}}`,draftByDefault:!1},issueTracking:{enabled:!0,defaultLabels:[`needs-triage`],autoAssign:!1,autoCloseStale:{enabled:!0,daysBeforeStale:60,daysBeforeClose:7,staleLabel:`stale`}},enableWebhooks:!0,webhookEvents:[`push`,`pull_request`,`release`,`workflow_run`],status:`active`,enabled:!0},iAe={name:`github_enterprise`,label:`GitHub Enterprise`,type:`saas`,provider:`github_enterprise`,baseUrl:`https://github.enterprise.com/api/v3`,authentication:{type:`oauth2`,clientId:"${GITHUB_ENTERPRISE_CLIENT_ID}",clientSecret:"${GITHUB_ENTERPRISE_CLIENT_SECRET}",authorizationUrl:`https://github.enterprise.com/login/oauth/authorize`,tokenUrl:`https://github.enterprise.com/login/oauth/access_token`,scopes:[`repo`,`admin:org`,`workflow`]},repositories:[{owner:`enterprise-org`,name:`internal-app`,defaultBranch:`develop`,autoMerge:!0,branchProtection:{requiredReviewers:2,requireStatusChecks:!0,enforceAdmins:!0,allowForcePushes:!1,allowDeletions:!1}}],commitConfig:{authorName:`CI Bot`,authorEmail:`ci-bot@enterprise.com`,signCommits:!0,useConventionalCommits:!0},pullRequestConfig:{titleTemplate:`[{{branch}}] {{description}}`,bodyTemplate:`## Changes - -{{changes}} - -## Testing - -{{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},D$=E([`vercel`]).describe(`Vercel provider type`),O$=E([`nextjs`,`react`,`vue`,`nuxtjs`,`gatsby`,`remix`,`astro`,`sveltekit`,`solid`,`angular`,`static`,`other`]).describe(`Frontend framework`),k$=h({type:E([`github`,`gitlab`,`bitbucket`]).describe(`Git provider`),repo:r().describe(`Repository identifier (e.g., owner/repo)`),productionBranch:r().optional().default(`main`).describe(`Production branch name`),autoDeployProduction:S().optional().default(!0).describe(`Auto-deploy production branch`),autoDeployPreview:S().optional().default(!0).describe(`Auto-deploy preview branches`)}),A$=h({buildCommand:r().optional().describe(`Build command (e.g., npm run build)`),outputDirectory:r().optional().describe(`Output directory (e.g., .next, dist)`),installCommand:r().optional().describe(`Install command (e.g., npm install, pnpm install)`),devCommand:r().optional().describe(`Development command (e.g., npm run dev)`),nodeVersion:r().optional().describe(`Node.js version (e.g., 18.x, 20.x)`),env:d(r(),r()).optional().describe(`Build environment variables`)}),j$=h({autoDeployment:S().optional().default(!0).describe(`Enable automatic deployments`),regions:C(E([`iad1`,`sfo1`,`gru1`,`lhr1`,`fra1`,`sin1`,`syd1`,`hnd1`,`icn1`])).optional().describe(`Deployment regions`),enablePreview:S().optional().default(!0).describe(`Enable preview deployments`),previewComments:S().optional().default(!0).describe(`Post preview URLs in PR comments`),productionProtection:S().optional().default(!0).describe(`Require approval for production deployments`),deployHooks:C(h({name:r().describe(`Hook name`),url:r().url().describe(`Deploy hook URL`),branch:r().optional().describe(`Target branch`)})).optional().describe(`Deploy hooks`)}),M$=h({domain:r().describe(`Domain name (e.g., app.example.com)`),httpsRedirect:S().optional().default(!0).describe(`Redirect HTTP to HTTPS`),customCertificate:h({cert:r().describe(`SSL certificate`),key:r().describe(`Private key`),ca:r().optional().describe(`Certificate authority`)}).optional().describe(`Custom SSL certificate`),gitBranch:r().optional().describe(`Git branch to deploy to this domain`)}),N$=h({key:r().describe(`Environment variable name`),value:r().describe(`Environment variable value`),target:C(E([`production`,`preview`,`development`])).describe(`Target environments`),isSecret:S().optional().default(!1).describe(`Encrypt this variable`),gitBranch:r().optional().describe(`Specific git branch`)}),P$=h({name:r().describe(`Edge function name`),path:r().describe(`Function path (e.g., /api/*)`),regions:C(r()).optional().describe(`Specific regions for this function`),memoryLimit:P().int().min(128).max(3008).optional().default(1024).describe(`Memory limit in MB`),timeout:P().int().min(1).max(300).optional().default(10).describe(`Timeout in seconds`)}),F$=h({name:r().describe(`Vercel project name`),framework:O$.optional().describe(`Frontend framework`),gitRepository:k$.optional().describe(`Git repository configuration`),buildConfig:A$.optional().describe(`Build configuration`),deploymentConfig:j$.optional().describe(`Deployment configuration`),domains:C(M$).optional().describe(`Custom domains`),environmentVariables:C(N$).optional().describe(`Environment variables`),edgeFunctions:C(P$).optional().describe(`Edge functions`),rootDirectory:r().optional().describe(`Root directory (for monorepos)`)}),I$=h({enableWebAnalytics:S().optional().default(!1).describe(`Enable Vercel Web Analytics`),enableSpeedInsights:S().optional().default(!1).describe(`Enable Vercel Speed Insights`),logDrains:C(h({name:r().describe(`Log drain name`),url:r().url().describe(`Log drain URL`),headers:d(r(),r()).optional().describe(`Custom headers`),sources:C(E([`static`,`lambda`,`edge`])).optional().describe(`Log sources`)})).optional().describe(`Log drains configuration`)}),L$=h({teamId:r().optional().describe(`Team ID or slug`),teamName:r().optional().describe(`Team name`)}),aAe=XQ.extend({type:m(`saas`),provider:D$.describe(`Vercel provider`),baseUrl:r().url().optional().default(`https://api.vercel.com`).describe(`Vercel API base URL`),team:L$.optional().describe(`Vercel team configuration`),projects:C(F$).describe(`Vercel projects`),monitoring:I$.optional().describe(`Monitoring configuration`),enableWebhooks:S().optional().default(!0).describe(`Enable Vercel webhooks`),webhookEvents:C(E([`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`)}),oAe={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},sAe={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};DA({},{ActionContributionSchema:()=>H$,ActionLocationSchema:()=>V$,ActivationEventSchema:()=>J$,BUILT_IN_NODE_DESCRIPTORS:()=>pAe,CanvasSnapSettingsSchema:()=>f1,CanvasZoomSettingsSchema:()=>p1,CommandContributionSchema:()=>K$,ERDiagramConfigSchema:()=>r1,ERLayoutAlgorithmSchema:()=>t1,ERNodeDisplaySchema:()=>n1,ElementPaletteItemSchema:()=>m1,FieldEditorConfigSchema:()=>Q$,FieldGroupSchema:()=>Z$,FieldPropertySectionSchema:()=>X$,FlowBuilderConfigSchema:()=>x1,FlowCanvasEdgeSchema:()=>fAe,FlowCanvasEdgeStyleSchema:()=>v1,FlowCanvasNodeSchema:()=>dAe,FlowLayoutAlgorithmSchema:()=>y1,FlowLayoutDirectionSchema:()=>b1,FlowNodeRenderDescriptorSchema:()=>_1,FlowNodeShapeSchema:()=>g1,InterfaceBuilderConfigSchema:()=>uAe,MetadataIconContributionSchema:()=>U$,MetadataViewerContributionSchema:()=>z$,ObjectDesignerConfigSchema:()=>d1,ObjectDesignerDefaultViewSchema:()=>u1,ObjectFilterSchema:()=>o1,ObjectListDisplayModeSchema:()=>i1,ObjectManagerConfigSchema:()=>s1,ObjectPreviewConfigSchema:()=>l1,ObjectPreviewTabSchema:()=>c1,ObjectSortFieldSchema:()=>a1,PageBuilderConfigSchema:()=>h1,PanelContributionSchema:()=>G$,PanelLocationSchema:()=>W$,RelationshipDisplaySchema:()=>$$,RelationshipMapperConfigSchema:()=>e1,SidebarGroupContributionSchema:()=>B$,StudioPluginContributionsSchema:()=>q$,StudioPluginManifestSchema:()=>Y$,ViewModeSchema:()=>R$,defineFlowBuilderConfig:()=>mAe,defineObjectDesignerConfig:()=>lAe,defineStudioPlugin:()=>cAe});var R$=E([`preview`,`design`,`code`,`data`]),z$=h({id:r().describe(`Unique viewer identifier`),metadataTypes:C(r()).min(1).describe(`Metadata types this viewer can handle`),label:r().describe(`Viewer display label`),priority:P().default(0).describe(`Viewer priority (higher wins)`),modes:C(R$).default([`preview`]).describe(`Supported view modes`)}),B$=h({key:r().describe(`Unique group key`),label:r().describe(`Group display label`),icon:r().optional().describe(`Lucide icon name`),metadataTypes:C(r()).describe(`Metadata types in this group`),order:P().default(100).describe(`Sort order (lower = higher)`)}),V$=E([`toolbar`,`contextMenu`,`commandPalette`]),H$=h({id:r().describe(`Unique action identifier`),label:r().describe(`Action display label`),icon:r().optional().describe(`Lucide icon name`),location:V$.describe(`UI location`),metadataTypes:C(r()).default([]).describe(`Applicable metadata types`)}),U$=h({metadataType:r().describe(`Metadata type`),label:r().describe(`Display label`),icon:r().describe(`Lucide icon name`)}),W$=E([`bottom`,`right`,`modal`]),G$=h({id:r().describe(`Unique panel identifier`),label:r().describe(`Panel display label`),icon:r().optional().describe(`Lucide icon name`),location:W$.default(`bottom`).describe(`Panel location`)}),K$=h({id:r().describe(`Unique command identifier`),label:r().describe(`Command display label`),shortcut:r().optional().describe(`Keyboard shortcut`),icon:r().optional().describe(`Lucide icon name`)}),q$=h({metadataViewers:C(z$).default([]),sidebarGroups:C(B$).default([]),actions:C(H$).default([]),metadataIcons:C(U$).default([]),panels:C(G$).default([]),commands:C(K$).default([])}),J$=r().describe(`Activation event pattern`),Y$=h({id:r().regex(/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/).describe(`Plugin ID (dot-separated lowercase)`),name:r().describe(`Plugin display name`),version:r().default(`0.0.1`).describe(`Plugin version`),description:r().optional().describe(`Plugin description`),author:r().optional().describe(`Author`),contributes:q$.default({metadataViewers:[],sidebarGroups:[],actions:[],metadataIcons:[],panels:[],commands:[]}),activationEvents:C(J$).default([`*`])});function cAe(e){return Y$.parse(e)}var X$=h({key:r().describe(`Section key (e.g., "basics", "constraints", "security")`),label:r().describe(`Section display label`),icon:r().optional().describe(`Lucide icon name`),defaultExpanded:S().default(!0).describe(`Whether section is expanded by default`),order:P().default(0).describe(`Sort order (lower = higher)`)}),Z$=h({key:r().describe(`Group key matching field.group values`),label:r().describe(`Group display label`),icon:r().optional().describe(`Lucide icon name`),defaultExpanded:S().default(!0).describe(`Whether group is expanded by default`),order:P().default(0).describe(`Sort order (lower = higher)`)}),Q$=h({inlineEditing:S().default(!0).describe(`Enable inline editing of field properties`),dragReorder:S().default(!0).describe(`Enable drag-and-drop field reordering`),showFieldGroups:S().default(!0).describe(`Show field group headers`),showPropertyPanel:S().default(!0).describe(`Show the right-side property panel`),propertySections:C(X$).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:C(Z$).default([]).describe(`Field group definitions`),paginationThreshold:P().default(50).describe(`Number of fields before pagination is enabled`),batchOperations:S().default(!0).describe(`Enable batch add/remove field operations`),showUsageStats:S().default(!1).describe(`Show field usage statistics`)}),$$=h({type:E([`lookup`,`master_detail`,`tree`]).describe(`Relationship type`),lineStyle:E([`solid`,`dashed`,`dotted`]).default(`solid`).describe(`Line style in diagrams`),color:r().default(`#94a3b8`).describe(`Line color (CSS value)`),highlightColor:r().default(`#0891b2`).describe(`Highlighted color on hover/select`),cardinalityLabel:r().default(`1:N`).describe(`Cardinality label (e.g., "1:N", "1:1", "N:M")`)}),e1=h({visualCreation:S().default(!0).describe(`Enable drag-to-create relationships`),showReverseRelationships:S().default(!0).describe(`Show reverse/child-to-parent relationships`),showCascadeWarnings:S().default(!0).describe(`Show cascade delete behavior warnings`),displayConfig:C($$).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`)}),t1=E([`force`,`hierarchy`,`grid`,`circular`]).describe(`ER diagram layout algorithm`),n1=h({showFields:S().default(!0).describe(`Show field list inside entity nodes`),maxFieldsVisible:P().default(8).describe(`Max fields visible before "N more..." collapse`),showFieldTypes:S().default(!0).describe(`Show field type badges`),showRequiredIndicator:S().default(!0).describe(`Show required field indicators`),showRecordCount:S().default(!1).describe(`Show live record count on nodes`),showIcon:S().default(!0).describe(`Show object icon on node header`),showDescription:S().default(!0).describe(`Show description tooltip on hover`)}),r1=h({enabled:S().default(!0).describe(`Enable ER diagram panel`),layout:t1.default(`force`).describe(`Default layout algorithm`),nodeDisplay:n1.default({showFields:!0,maxFieldsVisible:8,showFieldTypes:!0,showRequiredIndicator:!0,showRecordCount:!1,showIcon:!0,showDescription:!0}).describe(`Node display configuration`),showMinimap:S().default(!0).describe(`Show minimap for large diagrams`),zoomControls:S().default(!0).describe(`Show zoom in/out/fit controls`),minZoom:P().default(.1).describe(`Minimum zoom level`),maxZoom:P().default(3).describe(`Maximum zoom level`),showEdgeLabels:S().default(!0).describe(`Show cardinality labels on relationship edges`),highlightOnHover:S().default(!0).describe(`Highlight connected entities on node hover`),clickToNavigate:S().default(!0).describe(`Click node to navigate to object detail`),dragToConnect:S().default(!0).describe(`Drag between nodes to create relationships`),hideOrphans:S().default(!1).describe(`Hide objects with no relationships`),autoFit:S().default(!0).describe(`Auto-fit diagram to viewport on load`),exportFormats:C(E([`png`,`svg`,`json`])).default([`png`,`svg`]).describe(`Available export formats for diagram`)}),i1=E([`table`,`cards`,`tree`]).describe(`Object list display mode`),a1=E([`name`,`label`,`fieldCount`,`updatedAt`]).describe(`Object list sort field`),o1=h({package:r().optional().describe(`Filter by owning package`),tags:C(r()).optional().describe(`Filter by object tags`),includeSystem:S().default(!0).describe(`Include system-level objects`),includeAbstract:S().default(!1).describe(`Include abstract base objects`),hasFieldType:r().optional().describe(`Filter to objects containing a specific field type`),hasRelationships:S().optional().describe(`Filter to objects with lookup/master_detail fields`),searchQuery:r().optional().describe(`Free-text search across name, label, and description`)}),s1=h({defaultDisplayMode:i1.default(`table`).describe(`Default list display mode`),defaultSortField:a1.default(`label`).describe(`Default sort field`),defaultSortDirection:E([`asc`,`desc`]).default(`asc`).describe(`Default sort direction`),defaultFilter:o1.default({includeSystem:!0,includeAbstract:!1}).describe(`Default filter configuration`),showFieldCount:S().default(!0).describe(`Show field count badge`),showRelationshipCount:S().default(!0).describe(`Show relationship count badge`),showQuickPreview:S().default(!0).describe(`Show quick field preview tooltip on hover`),enableComparison:S().default(!1).describe(`Enable side-by-side object comparison`),showERDiagramToggle:S().default(!0).describe(`Show ER diagram toggle in toolbar`),showCreateAction:S().default(!0).describe(`Show create object action`),showStatsSummary:S().default(!0).describe(`Show statistics summary bar`)}),c1=h({key:r().describe(`Tab key`),label:r().describe(`Tab display label`),icon:r().optional().describe(`Lucide icon name`),enabled:S().default(!0).describe(`Whether this tab is available`),order:P().default(0).describe(`Sort order (lower = higher)`)}),l1=h({tabs:C(c1).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:r().default(`fields`).describe(`Default active tab key`),showHeader:S().default(!0).describe(`Show object summary header`),showBreadcrumbs:S().default(!0).describe(`Show navigation breadcrumbs`)}),u1=E([`field-editor`,`relationship-mapper`,`er-diagram`,`object-manager`]).describe(`Default view when entering the Object Designer`),d1=h({defaultView:u1.default(`field-editor`).describe(`Default view`),fieldEditor:Q$.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:e1.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:r1.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:s1.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:l1.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 lAe(e){return d1.parse(e)}var f1=h({enabled:S().default(!0).describe(`Enable snap-to-grid`),gridSize:P().int().min(1).default(8).describe(`Snap grid size in pixels`),showGrid:S().default(!0).describe(`Show grid overlay on canvas`),showGuides:S().default(!0).describe(`Show alignment guides when dragging`)}),p1=h({min:P().min(.1).default(.25).describe(`Minimum zoom level`),max:P().max(10).default(3).describe(`Maximum zoom level`),default:P().default(1).describe(`Default zoom level`),step:P().default(.1).describe(`Zoom step increment`)}),m1=h({type:r().describe(`Component type (e.g. "element:button", "element:text")`),label:r().describe(`Display label in palette`),icon:r().optional().describe(`Icon name for palette display`),category:E([`content`,`interactive`,`data`,`layout`]).describe(`Palette category grouping`),defaultWidth:P().int().min(1).default(4).describe(`Default width in grid columns`),defaultHeight:P().int().min(1).default(2).describe(`Default height in grid rows`)}),h1=h({snap:f1.optional().describe(`Canvas snap settings`),zoom:p1.optional().describe(`Canvas zoom settings`),palette:C(m1).optional().describe(`Custom element palette (defaults to all registered elements)`),showLayerPanel:S().default(!0).describe(`Show layer ordering panel`),showPropertyPanel:S().default(!0).describe(`Show property inspector panel`),undoLimit:P().int().min(1).default(50).describe(`Maximum undo history steps`)}),uAe=h1,g1=E([`rounded_rect`,`circle`,`diamond`,`parallelogram`,`hexagon`,`diamond_thick`,`attached_circle`,`screen_rect`]).describe(`Visual shape for rendering a flow node on the canvas`),_1=h({action:r().describe(`FlowNodeAction value (e.g., "parallel_gateway")`),shape:g1.describe(`Shape to render`),icon:r().describe(`Lucide icon name`),defaultLabel:r().describe(`Default display label`),defaultWidth:P().int().min(20).default(120).describe(`Default width in pixels`),defaultHeight:P().int().min(20).default(60).describe(`Default height in pixels`),fillColor:r().default(`#ffffff`).describe(`Node fill color (CSS value)`),borderColor:r().default(`#94a3b8`).describe(`Node border color (CSS value)`),allowBoundaryEvents:S().default(!1).describe(`Whether boundary events can be attached to this node type`),paletteCategory:E([`event`,`gateway`,`activity`,`data`,`subflow`]).describe(`Palette category for grouping`)}).describe(`Visual render descriptor for a flow node type`),dAe=h({nodeId:r().describe(`Corresponding FlowNode.id`),x:P().describe(`X position on canvas`),y:P().describe(`Y position on canvas`),width:P().int().min(20).optional().describe(`Width override in pixels`),height:P().int().min(20).optional().describe(`Height override in pixels`),collapsed:S().default(!1).describe(`Whether the node is collapsed`),fillColor:r().optional().describe(`Fill color override`),borderColor:r().optional().describe(`Border color override`),annotation:r().optional().describe(`User annotation displayed near the node`)}).describe(`Canvas layout data for a flow node`),v1=E([`solid`,`dashed`,`dotted`,`bold`]).describe(`Edge line style`),fAe=h({edgeId:r().describe(`Corresponding FlowEdge.id`),style:v1.default(`solid`).describe(`Line style`),color:r().default(`#94a3b8`).describe(`Edge line color`),labelPosition:P().min(0).max(1).default(.5).describe(`Position of the condition label along the edge`),waypoints:C(h({x:P().describe(`Waypoint X`),y:P().describe(`Waypoint Y`)})).optional().describe(`Manual waypoints for edge routing`),animated:S().default(!1).describe(`Show animated flow indicator`)}).describe(`Canvas layout and visual data for a flow edge`),y1=E([`dagre`,`elk`,`force`,`manual`]).describe(`Auto-layout algorithm for the flow canvas`),b1=E([`TB`,`BT`,`LR`,`RL`]).describe(`Auto-layout direction`),x1=h({snap:h({enabled:S().default(!0).describe(`Enable snap-to-grid`),gridSize:P().int().min(1).default(16).describe(`Snap grid size in pixels`),showGrid:S().default(!0).describe(`Show grid overlay`)}).default({enabled:!0,gridSize:16,showGrid:!0}).describe(`Canvas snap-to-grid settings`),zoom:h({min:P().min(.1).default(.25).describe(`Minimum zoom level`),max:P().max(10).default(3).describe(`Maximum zoom level`),default:P().default(1).describe(`Default zoom level`),step:P().default(.1).describe(`Zoom step`)}).default({min:.25,max:3,default:1,step:.1}).describe(`Canvas zoom settings`),layoutAlgorithm:y1.default(`dagre`).describe(`Default auto-layout algorithm`),layoutDirection:b1.default(`TB`).describe(`Default auto-layout direction`),nodeDescriptors:C(_1).optional().describe(`Custom node render descriptors (merged with built-in defaults)`),showMinimap:S().default(!0).describe(`Show minimap panel`),showPropertyPanel:S().default(!0).describe(`Show property panel`),showPalette:S().default(!0).describe(`Show node palette sidebar`),undoLimit:P().int().min(1).default(50).describe(`Maximum undo history steps`),animateExecution:S().default(!0).describe(`Animate edges during execution preview`),connectionValidation:S().default(!0).describe(`Validate connections before creating edges`)}).describe(`Studio Flow Builder configuration`),pAe=[{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 mAe(e){return x1.parse(e)}var hAe=h({namespace:r().optional().describe(`Match objects by namespace`),package:r().optional().describe(`Match objects by package ID`),objectPattern:r().optional().describe(`Match objects by name pattern (glob-style)`),default:S().optional().describe(`Default fallback rule`),datasource:r().describe(`Target datasource name`),priority:P().optional().describe(`Rule priority (lower = higher priority)`)}).describe(`Datasource routing rule`),gAe=h({manifest:RV.optional().describe(`Project Package Configuration`),datasources:C(SN).optional().describe(`External Data Connections`),datasourceMapping:C(hAe).optional().describe(`Centralized datasource routing rules for packages/namespaces/objects`),translations:C(zz).optional().describe(`I18n Translation Bundles`),i18n:Hz.optional().describe(`Internationalization configuration`),objects:C(gM).optional().describe(`Business Objects definition (owned by this package)`),objectExtensions:C(_M).optional().describe(`Extensions to objects owned by other packages`),apps:C(NP).optional().describe(`Applications`),views:C(sF).optional().describe(`List Views`),pages:C(MF).optional().describe(`Custom Pages`),dashboards:C(gF).optional().describe(`Dashboards`),reports:C(xF).optional().describe(`Analytics Reports`),actions:C(aM).optional().describe(`Global and Object Actions`),themes:C(CI).optional().describe(`UI Themes`),workflows:C(AJ).optional().describe(`Event-driven workflows`),approvals:C(eQ).optional().describe(`Approval processes`),flows:C(aZ).optional().describe(`Screen Flows`),roles:C(KU).optional().describe(`User Roles hierarchy`),permissions:C(XN).optional().describe(`Permission Sets and Profiles`),sharingRules:C(nP).optional().describe(`Record Sharing Rules`),policies:C(cP).optional().describe(`Security & Compliance Policies`),apis:C(KK).optional().describe(`API Endpoints`),webhooks:C(YZ).optional().describe(`Outbound Webhooks`),agents:C(mW).optional().describe(`AI Agents and Assistants`),ragPipelines:C(YG).optional().describe(`RAG Pipelines`),hooks:C(yM).optional().describe(`Object Lifecycle Hooks`),mappings:C(SM).optional().describe(`Data Import/Export Mappings`),analyticsCubes:C(kN).optional().describe(`Analytics Semantic Layer Cubes`),connectors:C(XQ).optional().describe(`External System Connectors`),data:C(cN).optional().describe(`Seed Data / Fixtures for bootstrapping`),plugins:C(u()).optional().describe(`Plugins to load`),devPlugins:C(l([RV,r()])).optional().describe(`Plugins to load only in development (CLI dev command)`)});function _Ae(e){let t=new Set;if(e.objects)for(let n of e.objects)t.add(n.name);return t}function vAe(e){let t=[],n=_Ae(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 S1(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 yAe(e,t){let n=t?.strict!==!1,r=mj(e);if(!n)return S1(r);let i=gAe.safeParse(r,{error:sj});if(!i.success)throw Error(lj(i.error,`defineStack validation failed`));let a=vAe(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} - -${t.join(` -`)}`)}return S1(i.data)}h({objectConflict:E([`error`,`override`,`merge`]).default(`error`),manifest:l([E([`first`,`last`]),P().int().min(0)]).default(`last`),namespace:r().optional()});var bAe=h({queryFilters:S().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:S().default(!0).describe(`Supports GROUP BY and aggregation functions`),querySorting:S().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:S().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:S().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:S().default(!1).describe(`Supports subqueries`),queryDistinct:S().default(!0).describe(`Supports SELECT DISTINCT`),queryHaving:S().default(!1).describe(`Supports HAVING clause for aggregations`),queryJoins:S().default(!1).describe(`Supports SQL-style joins`),fullTextSearch:S().default(!1).describe(`Supports full-text search`),vectorSearch:S().default(!1).describe(`Supports vector embeddings and similarity search for AI/RAG`),geoSpatial:S().default(!1).describe(`Supports geospatial queries and location fields`),jsonFields:S().default(!0).describe(`Supports JSON field types`),arrayFields:S().default(!1).describe(`Supports array field types`),validationRules:S().default(!0).describe(`Supports validation rules`),workflows:S().default(!0).describe(`Supports workflow automation`),triggers:S().default(!0).describe(`Supports database triggers`),formulas:S().default(!0).describe(`Supports formula fields`),transactions:S().default(!0).describe(`Supports database transactions`),bulkOperations:S().default(!0).describe(`Supports bulk create/update/delete`),supportedDrivers:C(r()).optional().describe(`Available database drivers (e.g., postgresql, mongodb, excel)`)}),xAe=h({listView:S().default(!0).describe(`Supports list/grid views`),formView:S().default(!0).describe(`Supports form views`),kanbanView:S().default(!1).describe(`Supports kanban board views`),calendarView:S().default(!1).describe(`Supports calendar views`),ganttView:S().default(!1).describe(`Supports Gantt chart views`),dashboards:S().default(!0).describe(`Supports dashboard creation`),reports:S().default(!0).describe(`Supports report generation`),charts:S().default(!0).describe(`Supports chart widgets`),customPages:S().default(!0).describe(`Supports custom page creation`),customThemes:S().default(!1).describe(`Supports custom theme creation`),customComponents:S().default(!1).describe(`Supports custom UI components/widgets`),customActions:S().default(!0).describe(`Supports custom button actions`),screenFlows:S().default(!1).describe(`Supports interactive screen flows`),mobileOptimized:S().default(!1).describe(`UI optimized for mobile devices`),accessibility:S().default(!1).describe(`WCAG accessibility support`)}),SAe=h({version:r().describe(`ObjectOS Kernel Version`),environment:E([`development`,`test`,`staging`,`production`]),restApi:S().default(!0).describe(`REST API available`),graphqlApi:S().default(!1).describe(`GraphQL API available`),odataApi:S().default(!1).describe(`OData API available`),websockets:S().default(!1).describe(`WebSocket support for real-time updates`),serverSentEvents:S().default(!1).describe(`Server-Sent Events support`),eventBus:S().default(!1).describe(`Internal event bus for pub/sub`),webhooks:S().default(!0).describe(`Outbound webhook support`),apiContracts:S().default(!1).describe(`API contract definitions`),authentication:S().default(!0).describe(`Authentication system`),rbac:S().default(!0).describe(`Role-Based Access Control`),fieldLevelSecurity:S().default(!1).describe(`Field-level permissions`),rowLevelSecurity:S().default(!1).describe(`Row-level security/sharing rules`),multiTenant:S().default(!1).describe(`Multi-tenant architecture support`),backgroundJobs:S().default(!1).describe(`Background job scheduling`),auditLogging:S().default(!1).describe(`Audit trail logging`),fileStorage:S().default(!0).describe(`File upload and storage`),i18n:S().default(!0).describe(`Internationalization support`),pluginSystem:S().default(!1).describe(`Plugin/extension system`),features:C(hV).optional().describe(`Active Feature Flags`),apis:C(KK).optional().describe(`Available System & Business APIs`),network:h({graphql:S().default(!1),search:S().default(!1),websockets:S().default(!1),files:S().default(!0),analytics:S().default(!1).describe(`Is the Analytics/BI engine enabled?`),ai:S().default(!1).describe(`Is the AI engine enabled?`),workflow:S().default(!1).describe(`Is the Workflow engine enabled?`),notifications:S().default(!1).describe(`Is the Notification service enabled?`),i18n:S().default(!1).describe(`Is the i18n service enabled?`)}).optional().describe(`Network Capabilities (GraphQL, WS, etc.)`),systemObjects:C(r()).optional().describe(`List of globally available System Objects`),limits:h({maxObjects:P().optional(),maxFieldsPerObject:P().optional(),maxRecordsPerQuery:P().optional(),apiRateLimit:P().optional(),fileUploadSizeLimit:P().optional().describe(`Max file size in bytes`)}).optional()});h({data:bAe.describe(`Data Layer capabilities`),ui:xAe.describe(`UI Layer capabilities`),system:SAe.describe(`System/Runtime Layer capabilities`)});var CAe=yAe({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`}]}]}),C1=r().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)`),w1=r().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)`);r().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 wAe=I(`type`,[h({type:m(`constant`),value:u().describe(`Constant value to use`)}).describe(`Set a constant value`),h({type:m(`cast`),targetType:E([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),h({type:m(`lookup`),table:r().describe(`Lookup table name`),keyField:r().describe(`Field to match on`),valueField:r().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),h({type:m(`javascript`),expression:r().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),h({type:m(`map`),mappings:d(r(),u()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]);h({source:r().describe(`Source field name`),target:r().describe(`Target field name`),transform:wAe.optional().describe(`Transformation to apply`),defaultValue:u().optional().describe(`Default if source is null/undefined`)});var TAe=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),EAe=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]);h({url:r().describe(`API endpoint URL`),method:EAe.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)}),h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(TAe).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)}),E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var DAe=E([`asc`,`desc`]).describe(`Sort order direction`);h({field:r().describe(`Field name to sort by`),order:DAe.describe(`Sort direction`)}).describe(`Sort field and direction pair`),E([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),E([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var OAe=E([`yaml`,`json`,`typescript`,`javascript`]).describe(`Metadata file format`);h({id:r().describe(`Unique metadata record identifier`),type:r().describe(`Metadata type (e.g. "object", "view", "flow")`),name:w1.describe(`Machine name (snake_case)`),format:OAe.optional().describe(`Source file format`)}).describe(`Base metadata record fields shared across kernel and system`),w1.brand().describe(`Branded object name (snake_case, no dots)`),w1.brand().describe(`Branded field name (snake_case, no dots)`),C1.brand().describe(`Branded view name (system identifier)`),C1.brand().describe(`Branded app name (system identifier)`),C1.brand().describe(`Branded flow name (system identifier)`),C1.brand().describe(`Branded role name (system identifier)`);var kAe=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),AAe=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),jAe=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),T1=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:kAe.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:AAe.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:jAe.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:T1.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var MAe=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),E1=h({field:r().describe(`Field name to apply masking to`),strategy:MAe.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(E1).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var NAe=E(`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(`.`)),PAe=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:C1.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var FAe=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var IAe=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),LAe=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),RAe=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),zAe=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:NAe.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(PAe).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:FAe.optional().describe(`Configuration for currency field type`),vectorConfig:IAe.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:LAe.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:T1.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:E1.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:zAe.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:RAe.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)});var D1={objects:`object`,apps:`app`,pages:`page`,dashboards:`dashboard`,reports:`report`,actions:`action`,themes:`theme`,workflows:`workflow`,approvals:`approval`,flows:`flow`,roles:`role`,permissions:`permission`,profiles:`profile`,sharingRules:`sharingRule`,policies:`policy`,apis:`api`,webhooks:`webhook`,agents:`agent`,ragPipelines:`ragPipeline`,hooks:`hook`,mappings:`mapping`,analyticsCubes:`analyticsCube`,connectors:`connector`,datasources:`datasource`,views:`view`},O1=Object.fromEntries(Object.entries(D1).map(([e,t])=>[t,e]));function k1(e){return D1[e]??e}var BAe=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`}`}},VAe=`name`,HAe=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:VAe,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=k.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;n0)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}}},A1=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=this.bundle.manifest?{...this.bundle.manifest,...this.bundle}:this.bundle;e.getService(`manifest`).register(r)},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}),this.bundle.datasourceMapping&&Array.isArray(this.bundle.datasourceMapping)&&(e.logger.info(`Configuring datasource mapping rules`,{appId:n,ruleCount:this.bundle.datasourceMapping.length}),r.setDatasourceMapping(this.bundle.datasourceMapping));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 HAe(r,n,e.logger),{SeedLoaderRequestSchema:a}=await Gf(async()=>{let{SeedLoaderRequestSchema:e}=await import(`./data-CGvg7kH3.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 j1(){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 UAe=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}}}}routeNotFound(e){return{status:404,body:{success:!1,error:{code:404,message:`Route Not Found: ${e}`,type:`ROUTE_NOT_FOUND`,route:e,hint:`No route is registered for this path. Check the API discovery endpoint for available routes.`}}}}async callData(e,t){let n=await this.resolveService(`protocol`),r=await this.getObjectQLService()??await this.resolveService(`objectql`);if(e===`create`){if(r){let e=await r.insert(t.object,t.data),n={...t.data,...e};return{object:t.object,id:n.id,record:n}}throw{statusCode:503,message:`Data service not available`}}if(e===`get`){if(n&&typeof n.getData==`function`)return await n.getData({object:t.object,id:t.id,expand:t.expand,select:t.select});if(r){let e=await r.find(t.object);e||=[];let n=e.find(e=>e.id===t.id);return n?{object:t.object,id:t.id,record:n}:null}throw{statusCode:503,message:`Data service not available`}}if(e===`update`){if(r&&t.id){let e=await r.find(t.object);e&&e.value&&(e=e.value),e||=[];let n=e.find(e=>e.id===t.id);if(!n)throw Error(`[ObjectStack] Not Found`);return await r.update(t.object,t.data,{where:{id:t.id}}),{object:t.object,id:t.id,record:{...n,...t.data}}}throw{statusCode:503,message:`Data service not available`}}if(e===`delete`){if(r)return await r.delete(t.object,{where:{id:t.id}}),{object:t.object,id:t.id,deleted:!0};throw{statusCode:503,message:`Data service not available`}}if(e===`query`||e===`find`){if(n&&typeof n.findData==`function`){let e=t.query||(()=>{let{object:e,...n}=t;return n})();return await n.findData({object:t.object,query:e})}if(r){let e=await r.find(t.object);return!Array.isArray(e)&&e&&e.value&&(e=e.value),e||=[],{object:t.object,records:e,total:e.length}}throw{statusCode:503,message:`Data service not available`}}if(e===`batch`)return{object:t.object,results:[]};throw{statusCode:400,message:`Unknown data action: ${e}`}}async getDiscoveryInfo(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=await Promise.all([this.resolveService(fi.enum.auth),this.resolveService(fi.enum.graphql),this.resolveService(fi.enum.search),this.resolveService(fi.enum.realtime),this.resolveService(fi.enum[`file-storage`]),this.resolveService(fi.enum.analytics),this.resolveService(fi.enum.workflow),this.resolveService(fi.enum.ai),this.resolveService(fi.enum.notification),this.resolveService(fi.enum.i18n),this.resolveService(fi.enum.ui),this.resolveService(fi.enum.automation),this.resolveService(fi.enum.cache),this.resolveService(fi.enum.queue),this.resolveService(fi.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,D=!!f,O=!!p,ee=!!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:D?`${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`,handlerReady:!0,route:e,provider:t}),j=e=>({enabled:!1,status:`unavailable`,handlerReady:!1,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:Yf(`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`,handlerReady:!0,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:D?A(k.automation):j(`automation`),analytics:x?A(k.analytics):j(`analytics`),cache:O?A():j(`cache`),queue:ee?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(fi.enum.auth);if(i&&typeof i.handler==`function`)return{handled:!0,result:await i.handler(r.request,r.response)};let a=e.replace(/^\/+/,``);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_${j1()}`;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_${j1()}`;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=e.replace(/^\/+/,``).split(`/`).filter(Boolean);if(a[0]===`types`){let e=await this.resolveService(`metadata`);if(e&&typeof e.getRegisteredTypes==`function`)try{let t=await e.getRegisteredTypes();return{handled:!0,response:this.success({types:t})}}catch(e){console.warn(`[HttpDispatcher] MetadataService.getRegisteredTypes() failed:`,e.message)}let t=await this.resolveService(`protocol`);if(t&&typeof t.getMetaTypes==`function`){let e=await t.getMetaTypes({});return{handled:!0,response:this.success(e)}}return{handled:!0,response:this.success({types:[`object`,`app`,`plugin`]})}}if(a.length===3&&a[2]===`published`&&(!n||n===`GET`)){let[e,t]=a,n=await this.getService(fi.enum.metadata);if(n&&typeof n.getPublished==`function`){let r=await n.getPublished(e,t);return r===void 0?{handled:!0,response:this.error(`Not found`,404)}:{handled:!0,response:this.success(r)}}let r=await this.resolveService(`metadata`);if(r&&typeof r.getPublished==`function`)try{let n=await r.getPublished(e,t);if(n!==void 0)return{handled:!0,response:this.success(n)}}catch{}return{handled:!0,response:this.error(`Not found`,404)}}if(a.length===2){let[e,t]=a,o=i?.package||void 0;if(n===`PUT`&&r){let n=await this.resolveService(`protocol`);if(n&&typeof n.saveMetaItem==`function`)try{let i=await n.saveMetaItem({type:e,name:t,item:r});return{handled:!0,response:this.success(i)}}catch(e){return{handled:!0,response:this.error(e.message,400)}}let i=await this.resolveService(`metadata`);if(i&&typeof i.saveItem==`function`)try{let n=await i.saveItem(e,t,r);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`){let e=await this.getObjectQLService();if(e?.registry){let n=e.registry.getObject(t);if(n)return{handled:!0,response:this.success(n)}}return{handled:!0,response:this.error(`Not found`,404)}}let n=k1(e),r=await this.resolveService(`protocol`);if(r&&typeof r.getMetaItem==`function`)try{let e=await r.getMetaItem({type:n,name:t,packageId:o});return{handled:!0,response:this.success(e)}}catch{}let i=await this.resolveService(`metadata`);if(i&&typeof i.getItem==`function`)try{let e=await i.getItem(n,t);if(e)return{handled:!0,response:this.success(e)}}catch{}return{handled:!0,response:this.error(`Not found`,404)}}catch(e){return{handled:!0,response:this.error(e.message,404)}}}if(a.length===1){let e=a[0],t=i?.package||void 0,n=await this.resolveService(`protocol`);if(n&&typeof n.getMetaItems==`function`)try{let r=await n.getMetaItems({type:e,packageId:t});if(r&&(r.items!==void 0||Array.isArray(r)))return{handled:!0,response:this.success(r)}}catch{}let r=await this.getService(fi.enum.metadata);if(r&&typeof r.list==`function`)try{let t=await r.list(e);if(t&&t.length>0)return{handled:!0,response:this.success({type:e,items:t})}}catch(t){let n=String(e).replace(/[\r\n\t]/g,``);console.debug(`[HttpDispatcher] MetadataService.list() failed for type:`,n,`error:`,t.message)}let o=await this.getObjectQLService();if(o?.registry){if(e===`objects`){let e=o.registry.getAllObjects(t);return{handled:!0,response:this.success({type:`object`,items:e})}}let n=o.registry.listItems?.(e,t);if(n&&n.length>0)return{handled:!0,response:this.success({type:e,items:n})};let r=o.registry.getObject(e);if(r)return{handled:!0,response:this.success(r)}}return{handled:!0,response:this.error(`Not found`,404)}}if(a.length===0){let e=await this.resolveService(`metadata`);if(e&&typeof e.getRegisteredTypes==`function`)try{let t=await e.getRegisteredTypes();return{handled:!0,response:this.success({types:t})}}catch{}let t=await this.resolveService(`protocol`);if(t&&typeof t.getMetaTypes==`function`){let e=await t.getMetaTypes({});return{handled:!0,response:this.success(e)}}return{handled:!0,response:this.success({types:[`object`,`app`,`plugin`]})}}return{handled:!1}}async handleData(e,t,n,r,i){let a=e.replace(/^\/+/,``).split(`/`),o=a[0];if(!o)return{handled:!0,response:this.error(`Object name required`,400)};let s=t.toUpperCase();if(a.length>1){let e=a[1];if(e===`query`&&s===`POST`){let e=await this.callData(`query`,{object:o,...n});return{handled:!0,response:this.success(e)}}if(e===`batch`&&s===`POST`){let e=await this.callData(`batch`,{object:o,...n});return{handled:!0,response:this.success(e)}}if(a.length===2&&s===`GET`){let e=a[1],{select:t,expand:n}=r||{},i={};t!=null&&(i.select=t),n!=null&&(i.expand=n);let s=await this.callData(`get`,{object:o,id:e,...i});return{handled:!0,response:this.success(s)}}if(a.length===2&&s===`PATCH`){let e=a[1],t=await this.callData(`update`,{object:o,id:e,data:n});return{handled:!0,response:this.success(t)}}if(a.length===2&&s===`DELETE`){let e=a[1],t=await this.callData(`delete`,{object:o,id:e});return{handled:!0,response:this.success(t)}}}else{if(s===`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 this.callData(`query`,{object:o,query:e});return{handled:!0,response:this.success(t)}}if(s===`POST`){let e=await this.callData(`create`,{object:o,data:n}),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(fi.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(fi.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=ap(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=ap(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{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(fi.enum.metadata);if(t&&typeof t.publishPackage==`function`){let r=await t.publishPackage(e,n||{});return{handled:!0,response:this.success(r)}}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(fi.enum.metadata);return t&&typeof t.revertPackage==`function`?(await t.revertPackage(e),{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 handleStorage(e,t,n,r){let i=await this.getService(fi.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(fi.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}async handleAI(e,t,n,r,i){let a;try{a=await this.resolveService(`ai`)}catch{}if(!a)return{handled:!0,response:{status:404,body:{success:!1,error:{message:`AI service is not configured`,code:404}}}};let o=`/api/v1${e}`,s=(e,t)=>{let n=e.split(`/`),r=t.split(`/`);if(n.length!==r.length)return null;let i={};for(let e=0;ee});var _je=E([`full`,`partial`,`experimental`,`deprecated`]).describe(`Level of protocol conformance`),z1=h({major:P().int().min(0),minor:P().int().min(0),patch:P().int().min(0)}).describe(`Semantic version of the protocol`),vje=h({id:r().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:r(),version:z1,specification:r().optional().describe(`URL or path to protocol specification`),description:r().optional()}),yje=h({name:r().describe(`Feature identifier within the protocol`),enabled:S().default(!0),description:r().optional(),sinceVersion:r().optional().describe(`Version when this feature was added`),deprecatedSince:r().optional().describe(`Version when deprecated`)}),bje=h({protocol:vje,conformance:_je.default(`full`),implementedFeatures:C(r()).optional().describe(`List of implemented feature names`),features:C(yje).optional(),metadata:d(r(),u()).optional(),certified:S().default(!1).describe(`Has passed official conformance tests`),certificationDate:r().datetime().optional()}),xje=h({id:r().regex(/^([a-z][a-z0-9]*\.)+interface\.[a-z][a-z0-9._]+$/).describe(`Unique interface identifier`),name:r(),description:r().optional(),version:z1,methods:C(h({name:r().describe(`Method name`),description:r().optional(),parameters:C(h({name:r(),type:r().describe(`Type notation (e.g., string, number, User)`),required:S().default(!0),description:r().optional()})).optional(),returnType:r().optional().describe(`Return value type`),async:S().default(!1).describe(`Whether method returns a Promise`)})),events:C(h({name:r().describe(`Event name`),description:r().optional(),payload:r().optional().describe(`Event payload type`)})).optional(),stability:E([`stable`,`beta`,`alpha`,`experimental`]).default(`stable`)}),Sje=h({pluginId:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Required plugin identifier`),version:r().describe(`Semantic version constraint`),optional:S().default(!1),reason:r().optional(),requiredCapabilities:C(r()).optional().describe(`Protocol IDs the dependency must support`)}),Cje=h({id:r().regex(/^([a-z][a-z0-9]*\.)+extension\.[a-z][a-z0-9._]+$/).describe(`Unique extension point identifier`),name:r(),description:r().optional(),type:E([`action`,`hook`,`widget`,`provider`,`transformer`,`validator`,`decorator`]),contract:h({input:r().optional().describe(`Input type/schema`),output:r().optional().describe(`Output type/schema`),signature:r().optional().describe(`Function signature if applicable`)}).optional(),cardinality:E([`single`,`multiple`]).default(`multiple`).describe(`Whether multiple extensions can register to this point`)}),B1=h({implements:C(bje).optional().describe(`List of protocols this plugin conforms to`),provides:C(xje).optional().describe(`Services/APIs this plugin offers to others`),requires:C(Sje).optional().describe(`Required plugins and their capabilities`),extensionPoints:C(Cje).optional().describe(`Points where other plugins can extend this plugin`),extensions:C(h({targetPluginId:r().describe(`Plugin ID being extended`),extensionPointId:r().describe(`Extension point identifier`),implementation:r().describe(`Path to implementation module`),priority:P().int().default(100).describe(`Registration priority (lower = higher priority)`)})).optional().describe(`Extensions contributed to other plugins`)}),wje=E([`eager`,`lazy`,`parallel`,`deferred`,`on-demand`]).describe(`Plugin loading strategy`),Tje=h({enabled:S().default(!1),priority:P().int().min(0).default(100),resources:C(E([`metadata`,`dependencies`,`assets`,`code`,`services`])).optional(),conditions:h({routes:C(r()).optional(),roles:C(r()).optional(),deviceType:C(E([`desktop`,`mobile`,`tablet`])).optional(),minNetworkSpeed:E([`slow-2g`,`2g`,`3g`,`4g`]).optional()}).optional()}).describe(`Plugin preloading configuration`),Eje=h({enabled:S().default(!0),strategy:E([`route`,`feature`,`size`,`custom`]).default(`feature`),chunkNaming:E([`hashed`,`named`,`sequential`]).default(`hashed`),maxChunkSize:P().int().min(10).optional().describe(`Max chunk size in KB`),sharedDependencies:h({enabled:S().default(!0),minChunks:P().int().min(1).default(2)}).optional()}).describe(`Plugin code splitting configuration`),Dje=h({enabled:S().default(!0),mode:E([`async`,`sync`,`eager`,`lazy`]).default(`async`),prefetch:S().default(!1).describe(`Prefetch module in idle time`),preload:S().default(!1).describe(`Preload module in parallel with parent`),webpackChunkName:r().optional().describe(`Custom chunk name for webpack`),timeout:P().int().min(100).default(3e4).describe(`Dynamic import timeout (ms)`),retry:h({enabled:S().default(!0),maxAttempts:P().int().min(1).max(10).default(3),backoffMs:P().int().min(0).default(1e3).describe(`Exponential backoff base delay`)}).optional()}).describe(`Plugin dynamic import configuration`),Oje=h({mode:E([`sync`,`async`,`parallel`,`sequential`]).default(`async`),timeout:P().int().min(100).default(3e4),priority:P().int().min(0).default(100),critical:S().default(!1).describe(`If true, kernel bootstrap fails if plugin fails`),retry:h({enabled:S().default(!1),maxAttempts:P().int().min(1).max(5).default(3),backoffMs:P().int().min(0).default(1e3)}).optional(),healthCheckInterval:P().int().min(0).optional().describe(`Health check interval in ms (0 = disabled)`)}).describe(`Plugin initialization configuration`),kje=h({strategy:E([`strict`,`compatible`,`latest`,`pinned`]).default(`compatible`),peerDependencies:h({resolve:S().default(!0),onMissing:E([`error`,`warn`,`ignore`]).default(`warn`),onMismatch:E([`error`,`warn`,`ignore`]).default(`warn`)}).optional(),optionalDependencies:h({load:S().default(!0),onFailure:E([`warn`,`ignore`]).default(`warn`)}).optional(),conflictResolution:E([`fail`,`latest`,`oldest`,`manual`]).default(`latest`),circularDependencies:E([`error`,`warn`,`allow`]).default(`warn`)}).describe(`Plugin dependency resolution configuration`),Aje=h({enabled:S().default(!1),environment:E([`development`,`staging`,`production`]).default(`development`).describe(`Target environment controlling safety level`),strategy:E([`full`,`partial`,`state-preserve`]).default(`full`),watchPatterns:C(r()).optional().describe(`Glob patterns for files to watch`),ignorePatterns:C(r()).optional().describe(`Glob patterns for files to ignore`),debounceMs:P().int().min(0).default(300),preserveState:S().default(!1),stateSerialization:h({enabled:S().default(!1),handler:r().optional()}).optional(),hooks:h({beforeReload:r().optional().describe(`Function to call before reload`),afterReload:r().optional().describe(`Function to call after reload`),onError:r().optional().describe(`Function to call on reload error`)}).optional(),productionSafety:h({healthValidation:S().default(!0).describe(`Run health checks after reload before accepting traffic`),rollbackOnFailure:S().default(!0).describe(`Auto-rollback if reloaded plugin fails health check`),healthTimeout:P().int().min(1e3).default(3e4).describe(`Health check timeout after reload in ms`),drainConnections:S().default(!0).describe(`Gracefully drain active requests before reloading`),drainTimeout:P().int().min(0).default(15e3).describe(`Max wait time for connection draining in ms`),maxConcurrentReloads:P().int().min(1).default(1).describe(`Limit concurrent reloads to prevent system instability`),minReloadInterval:P().int().min(1e3).default(5e3).describe(`Cooldown period between reloads of the same plugin`)}).optional()}).describe(`Plugin hot reload configuration`),jje=h({enabled:S().default(!0),storage:E([`memory`,`disk`,`indexeddb`,`hybrid`]).default(`memory`),keyStrategy:E([`version`,`hash`,`timestamp`]).default(`version`),ttl:P().int().min(0).optional().describe(`Time to live in seconds (0 = infinite)`),maxSize:P().int().min(1).optional().describe(`Max cache size in MB`),invalidateOn:C(E([`version-change`,`dependency-change`,`manual`,`error`])).optional(),compression:h({enabled:S().default(!1),algorithm:E([`gzip`,`brotli`,`deflate`]).default(`gzip`)}).optional()}).describe(`Plugin caching configuration`),Mje=h({enabled:S().default(!1),scope:E([`automation-only`,`untrusted-only`,`all-plugins`]).default(`automation-only`).describe(`Which plugins are subject to isolation`),isolationLevel:E([`none`,`process`,`vm`,`iframe`,`web-worker`]).default(`none`),allowedCapabilities:C(r()).optional().describe(`List of allowed capability IDs`),resourceQuotas:h({maxMemoryMB:P().int().min(1).optional(),maxCpuTimeMs:P().int().min(100).optional(),maxFileDescriptors:P().int().min(1).optional(),maxNetworkKBps:P().int().min(1).optional()}).optional(),permissions:h({allowedAPIs:C(r()).optional(),allowedPaths:C(r()).optional(),allowedEndpoints:C(r()).optional(),allowedEnvVars:C(r()).optional()}).optional(),ipc:h({enabled:S().default(!0).describe(`Allow sandboxed plugins to communicate via IPC`),transport:E([`message-port`,`unix-socket`,`tcp`,`memory`]).default(`message-port`).describe(`IPC transport for cross-boundary communication`),maxMessageSize:P().int().min(1024).default(1048576).describe(`Maximum IPC message size in bytes (default 1MB)`),timeout:P().int().min(100).default(3e4).describe(`IPC message response timeout in ms`),allowedServices:C(r()).optional().describe(`Service names the sandboxed plugin may invoke via IPC`)}).optional()}).describe(`Plugin sandboxing configuration`),Nje=h({enabled:S().default(!1),metrics:C(E([`load-time`,`init-time`,`memory-usage`,`cpu-usage`,`api-calls`,`error-rate`,`cache-hit-rate`])).optional(),samplingRate:P().min(0).max(1).default(1),reportingInterval:P().int().min(1).default(60),budgets:h({maxLoadTimeMs:P().int().min(0).optional(),maxInitTimeMs:P().int().min(0).optional(),maxMemoryMB:P().int().min(0).optional()}).optional(),onBudgetViolation:E([`warn`,`error`,`ignore`]).default(`warn`)}).describe(`Plugin performance monitoring configuration`),Pje=h({strategy:wje.default(`lazy`),preload:Tje.optional(),codeSplitting:Eje.optional(),dynamicImport:Dje.optional(),initialization:Oje.optional(),dependencyResolution:kje.optional(),hotReload:Aje.optional(),caching:jje.optional(),sandboxing:Mje.optional(),monitoring:Nje.optional()}).describe(`Complete plugin loading configuration`);h({type:E([`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:r(),timestamp:P().int().min(0),durationMs:P().int().min(0).optional(),metadata:d(r(),u()).optional(),error:h({message:r(),code:r().optional(),stack:r().optional()}).optional()}).describe(`Plugin loading lifecycle event`),h({pluginId:r(),state:E([`pending`,`loading`,`loaded`,`initializing`,`ready`,`failed`,`reloading`,`unloading`,`unloaded`]),progress:P().min(0).max(100).default(0),startedAt:P().int().min(0).optional(),completedAt:P().int().min(0).optional(),lastError:r().optional(),retryCount:P().int().min(0).default(0)}).describe(`Plugin loading state`),h({ql:h({object:M().describe(`Get object handle for method chaining`),query:M().describe(`Execute a query`)}).passthrough().describe(`ObjectQL Engine Interface`),os:h({getCurrentUser:M().describe(`Get the current authenticated user`),getConfig:M().describe(`Get platform configuration`)}).passthrough().describe(`ObjectStack Kernel Interface`),logger:h({debug:M().describe(`Log debug message`),info:M().describe(`Log info message`),warn:M().describe(`Log warning message`),error:M().describe(`Log error message`)}).passthrough().describe(`Logger Interface`),storage:h({get:M().describe(`Get a value from storage`),set:M().describe(`Set a value in storage`),delete:M().describe(`Delete a value from storage`)}).passthrough().describe(`Storage Interface`),i18n:h({t:M().describe(`Translate a key`),getLocale:M().describe(`Get current locale`)}).passthrough().describe(`Internationalization Interface`),metadata:d(r(),u()),events:d(r(),u()),app:h({router:h({get:M().describe(`Register GET route handler`),post:M().describe(`Register POST route handler`),use:M().describe(`Register middleware`)}).passthrough()}).passthrough().describe(`App Framework Interface`),drivers:h({register:M().describe(`Register a driver`)}).passthrough().describe(`Driver Registry`)}),h({previousVersion:r().describe(`Version before upgrade`),newVersion:r().describe(`Version after upgrade`),isMajorUpgrade:S().describe(`Whether this is a major version bump`),previousMetadata:d(r(),u()).optional().describe(`Metadata snapshot before upgrade`)}).describe(`Version migration context for onUpgrade hook`);var Fje=h({onInstall:M().optional().describe(`Called when plugin is installed`),onEnable:M().optional().describe(`Called when plugin is enabled`),onDisable:M().optional().describe(`Called when plugin is disabled`),onUninstall:M().optional().describe(`Called when plugin is uninstalled`),onUpgrade:M().optional().describe(`Called when plugin is upgraded. Receives UpgradeContext with previousVersion, newVersion, and isMajorUpgrade`)}),V1=[`ui`,`driver`,`server`,`app`,`theme`,`agent`,`objectql`];Fje.extend({id:r().min(1).optional().describe(`Unique Plugin ID (e.g. com.example.crm)`),type:E([`standard`,...V1]).default(`standard`).optional().describe(`Plugin Type categorization for runtime behavior`),staticPath:r().optional().describe(`Absolute path to static assets (Required for type="ui-plugin")`),slug:r().regex(/^[a-z0-9-_]+$/).optional().describe(`URL path segment (Required for type="ui-plugin")`),default:S().optional().describe(`Serve at root path (Only one "ui-plugin" can be default)`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic Version`),description:r().optional(),author:r().optional(),homepage:r().url().optional()});var Ije=E([`insert`,`update`,`upsert`,`replace`,`ignore`]),Lje=h({object:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:r().default(`name`).describe(`Field match for uniqueness check`),mode:Ije.default(`upsert`).describe(`Conflict resolution strategy`),env:C(E([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:C(d(r(),u())).describe(`Data records`)}),H1=h({id:r().describe(`Unique package identifier (reverse domain style)`),namespace:r().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")`),defaultDatasource:r().optional().default(`default`).describe(`Default datasource for all objects in this package`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Package version (semantic versioning)`),type:E([`plugin`,...V1,`module`,`gateway`,`adapter`]).describe(`Type of package`),name:r().describe(`Human-readable package name`),description:r().optional().describe(`Package description`),permissions:C(r()).optional().describe(`Array of required permission strings`),objects:C(r()).optional().describe(`Glob patterns for ObjectQL schemas files`),datasources:C(r()).optional().describe(`Glob patterns for Datasource definitions`),dependencies:d(r(),r()).optional().describe(`Package dependencies`),configuration:h({title:r().optional(),properties:d(r(),h({type:E([`string`,`number`,`boolean`,`array`,`object`]).describe(`Data type of the setting`),default:u().optional().describe(`Default value`),description:r().optional().describe(`Tooltip description`),required:S().optional().describe(`Is this setting required?`),secret:S().optional().describe(`If true, value is encrypted/masked (e.g. API Keys)`),enum:C(r()).optional().describe(`Allowed values for select inputs`)})).describe(`Map of configuration keys to their definitions`)}).optional().describe(`Plugin configuration settings`),contributes:h({kinds:C(h({id:r().describe(`The generic identifier of the kind (e.g., "sys.bi.report")`),globs:C(r()).describe(`File patterns to watch (e.g., ["**/*.report.ts"])`),description:r().optional().describe(`Description of what this kind represents`)})).optional().describe(`New Metadata Types to recognize`),events:C(r()).optional().describe(`Events this plugin listens to`),menus:d(r(),C(h({id:r(),label:r(),command:r().optional()}))).optional().describe(`UI Menu contributions`),themes:C(h({id:r(),label:r(),path:r()})).optional().describe(`Theme contributions`),translations:C(h({locale:r(),path:r()})).optional().describe(`Translation resources`),actions:C(h({name:r().describe(`Unique action name`),label:r().optional(),description:r().optional(),input:u().optional().describe(`Input validation schema`),output:u().optional().describe(`Output schema`)})).optional().describe(`Exposed server actions`),drivers:C(h({id:r().describe(`Driver unique identifier (e.g. "postgres", "mongo")`),label:r().describe(`Human readable name`),description:r().optional()})).optional().describe(`Driver contributions`),fieldTypes:C(h({name:r().describe(`Unique field type name (e.g. "vector")`),label:r().describe(`Display label`),description:r().optional()})).optional().describe(`Field Type contributions`),functions:C(h({name:r().describe(`Function name (e.g. "distance")`),description:r().optional(),args:C(r()).optional().describe(`Argument types`),returnType:r().optional()})).optional().describe(`Query Function contributions`),routes:C(h({prefix:r().regex(/^\//).describe(`API path prefix`),service:r().describe(`Service name this plugin provides`),methods:C(r()).optional().describe(`Protocol method names implemented (e.g. ["aiNlq", "aiChat"])`)})).optional().describe(`API route contributions to HttpDispatcher`),commands:C(h({name:r().regex(/^[a-z][a-z0-9-]*$/,`Command name must be lowercase alphanumeric with hyphens`).describe(`CLI command name`),description:r().optional().describe(`Command description for help text`),module:r().optional().describe(`Module path exporting Commander.js commands`)})).optional().describe(`CLI command contributions`)}).optional().describe(`Platform contributions`),data:C(Lje).optional().describe(`Initial seed data (prefer top-level data field)`),capabilities:B1.optional().describe(`Plugin capability declarations for interoperability`),extensions:d(r(),u()).optional().describe(`Extension points and contributions`),loading:Pje.optional().describe(`Plugin loading and runtime behavior configuration`),engine:h({objectstack:r().regex(/^[><=~^]*\d+\.\d+\.\d+/).describe(`ObjectStack platform version requirement (SemVer range, e.g. ">=3.0.0")`)}).optional().describe(`Platform compatibility requirements`)});E([`package`,`admin`,`user`,`migration`,`api`]);var Rje=h({path:r().describe(`JSON path to the changed field`),originalValue:u().optional().describe(`Original value from the package`),currentValue:u().describe(`Current customized value`),changedBy:r().optional().describe(`User or admin who made this change`),changedAt:r().datetime().optional().describe(`Timestamp of the change`)});h({id:r().describe(`Overlay record ID (UUID)`),baseType:r().describe(`Metadata type being customized`),baseName:r().describe(`Metadata name being customized`),packageId:r().optional().describe(`Package ID that delivered the base metadata`),packageVersion:r().optional().describe(`Package version when overlay was created`),scope:E([`platform`,`user`]).default(`platform`).describe(`Customization scope (platform=admin, user=personal)`),tenantId:r().optional().describe(`Tenant identifier`),owner:r().optional().describe(`Owner user ID for user-scope overlays`),patch:d(r(),u()).describe(`JSON Merge Patch payload (changed fields only)`),changes:C(Rje).optional().describe(`Field-level change tracking for conflict detection`),active:S().default(!0).describe(`Whether this overlay is active`),createdAt:r().datetime().optional(),createdBy:r().optional(),updatedAt:r().datetime().optional(),updatedBy:r().optional()});var zje=h({path:r().describe(`JSON path to the conflicting field`),baseValue:u().describe(`Value in the old package version`),incomingValue:u().describe(`Value in the new package version`),customValue:u().describe(`Customer customized value`),suggestedResolution:E([`keep-custom`,`accept-incoming`,`manual`]).describe(`Suggested resolution strategy`),reason:r().optional().describe(`Explanation for the suggested resolution`)}),Bje=h({defaultStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`Default merge strategy`),alwaysAcceptIncoming:C(r()).optional().describe(`Field paths that always accept package updates`),alwaysKeepCustom:C(r()).optional().describe(`Field paths where customer customizations always win`),autoResolveNonConflicting:S().default(!0).describe(`Auto-resolve changes that do not conflict`)});h({success:S().describe(`Whether merge completed without unresolved conflicts`),mergedMetadata:d(r(),u()).optional().describe(`Merged metadata result`),updatedOverlay:d(r(),u()).optional().describe(`Updated overlay after merge`),conflicts:C(zje).optional().describe(`Unresolved merge conflicts`),autoResolved:C(h({path:r(),resolution:r(),description:r().optional()})).optional().describe(`Summary of auto-resolved changes`),stats:h({totalFields:P().int().min(0).describe(`Total fields evaluated`),unchanged:P().int().min(0).describe(`Fields with no changes`),autoResolved:P().int().min(0).describe(`Fields auto-resolved`),conflicts:P().int().min(0).describe(`Fields with conflicts`)}).optional()});var Vje=h({metadataType:r().describe(`Metadata type (e.g. "object", "view")`),allowCustomization:S().default(!0),lockedFields:C(r()).optional().describe(`Field paths that cannot be customized`),customizableFields:C(r()).optional().describe(`Field paths that can be customized (whitelist)`),allowAddFields:S().default(!0).describe(`Whether admins can add new fields to package objects`),allowDeleteFields:S().default(!1).describe(`Whether admins can delete package-delivered fields`)}),U1=E([`json`,`yaml`,`typescript`,`javascript`]),Hje=h({size:P().int().min(0).describe(`File size in bytes`),modifiedAt:r().datetime().describe(`Last modified date`),etag:r().describe(`Entity tag for cache validation`),format:U1.describe(`Serialization format`),path:r().optional().describe(`File system path`),metadata:d(r(),u()).optional().describe(`Provider-specific metadata`)});h({patterns:C(r()).optional().describe(`File glob patterns`),ifNoneMatch:r().optional().describe(`ETag for conditional request`),ifModifiedSince:r().datetime().optional().describe(`Only load if modified after this date`),validate:S().default(!0).describe(`Validate against schema`),useCache:S().default(!0).describe(`Enable caching`),filter:r().optional().describe(`Filter predicate as string`),limit:P().int().min(1).optional().describe(`Maximum items to load`),recursive:S().default(!0).describe(`Search subdirectories`)}),h({format:U1.default(`typescript`).describe(`Output format`),prettify:S().default(!0).describe(`Format with indentation`),indent:P().int().min(0).max(8).default(2).describe(`Indentation spaces`),sortKeys:S().default(!1).describe(`Sort object keys`),includeDefaults:S().default(!1).describe(`Include default values`),backup:S().default(!1).describe(`Create backup file`),overwrite:S().default(!0).describe(`Overwrite existing file`),atomic:S().default(!0).describe(`Use atomic write operation`),path:r().optional().describe(`Custom output path`)}),h({output:r().describe(`Output file path`),format:U1.default(`json`).describe(`Export format`),filter:r().optional().describe(`Filter items to export`),includeStats:S().default(!1).describe(`Include metadata statistics`),compress:S().default(!1).describe(`Compress output (gzip)`),prettify:S().default(!0).describe(`Pretty print output`)}),h({conflictResolution:E([`skip`,`overwrite`,`merge`,`fail`]).default(`merge`).describe(`How to handle existing items`),validate:S().default(!0).describe(`Validate before import`),dryRun:S().default(!1).describe(`Simulate import without saving`),continueOnError:S().default(!1).describe(`Continue if validation fails`),transform:r().optional().describe(`Transform items before import`)}),h({data:u().nullable().describe(`Loaded metadata`),fromCache:S().default(!1).describe(`Loaded from cache`),notModified:S().default(!1).describe(`Not modified since last request`),etag:r().optional().describe(`Entity tag`),stats:Hje.optional().describe(`Metadata statistics`),loadTime:P().min(0).optional().describe(`Load duration in ms`)}),h({success:S().describe(`Save successful`),path:r().describe(`Output path`),etag:r().optional().describe(`Generated entity tag`),size:P().int().min(0).optional().describe(`File size`),saveTime:P().min(0).optional().describe(`Save duration in ms`),backupPath:r().optional().describe(`Backup file path`)}),h({type:E([`added`,`changed`,`deleted`]).describe(`Event type`),metadataType:r().describe(`Type of metadata`),name:r().describe(`Item identifier`),path:r().describe(`File path`),data:u().optional().describe(`Item data`),timestamp:r().datetime().describe(`Event timestamp`)}),h({type:r().describe(`Collection type`),count:P().int().min(0).describe(`Number of items`),formats:C(U1).describe(`Formats in collection`),totalSize:P().int().min(0).optional().describe(`Total size in bytes`),lastModified:r().datetime().optional().describe(`Last modification date`),location:r().optional().describe(`Collection location`)}),h({name:r().describe(`Loader identifier`),protocol:E([`file:`,`http:`,`s3:`,`datasource:`,`memory:`]).describe(`Protocol identifier`),capabilities:h({read:S().default(!0),write:S().default(!1),watch:S().default(!1),list:S().default(!0)}).describe(`Loader capabilities`),supportedFormats:C(U1).describe(`Supported formats`),supportsWatch:S().default(!1).describe(`Supports file watching`),supportsWrite:S().default(!0).describe(`Supports write operations`),supportsCache:S().default(!0).describe(`Supports caching`)});var Uje=E([`filesystem`,`memory`,`none`]),Wje=h({datasource:r().optional().describe(`Datasource name reference for database persistence`),tableName:r().default(`sys_metadata`).describe(`Database table name for metadata storage`),fallback:Uje.default(`none`).describe(`Fallback strategy when datasource is unavailable`),rootDir:r().optional().describe(`Root directory path`),formats:C(U1).default([`typescript`,`json`,`yaml`]).describe(`Enabled formats`),cache:h({enabled:S().default(!0).describe(`Enable caching`),ttl:P().int().min(0).default(3600).describe(`Cache TTL in seconds`),maxSize:P().int().min(0).optional().describe(`Max cache size in bytes`)}).optional().describe(`Cache settings`),watch:S().default(!1).describe(`Enable file watching`),watchOptions:h({ignored:C(r()).optional().describe(`Patterns to ignore`),persistent:S().default(!0).describe(`Keep process running`),ignoreInitial:S().default(!0).describe(`Ignore initial add events`)}).optional().describe(`File watcher options`),validation:h({strict:S().default(!0).describe(`Strict validation`),throwOnError:S().default(!0).describe(`Throw on validation error`)}).optional().describe(`Validation settings`),loaderOptions:d(r(),u()).optional().describe(`Loader-specific configuration`)}),W1=E([`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`]),Gje=h({type:W1.describe(`Metadata type identifier`),label:r().describe(`Display label for the metadata type`),description:r().optional().describe(`Description of the metadata type`),filePatterns:C(r()).describe(`Glob patterns to discover files of this type`),supportsOverlay:S().default(!0).describe(`Whether overlay customization is supported`),allowRuntimeCreate:S().default(!0).describe(`Allow runtime creation via API`),supportsVersioning:S().default(!1).describe(`Whether version history is tracked`),loadOrder:P().int().min(0).default(100).describe(`Loading priority (lower = earlier)`),domain:E([`data`,`ui`,`automation`,`system`,`security`,`ai`]).describe(`Protocol domain`)});h({types:C(W1).optional().describe(`Filter by metadata types`),namespaces:C(r()).optional().describe(`Filter by namespaces`),packageId:r().optional().describe(`Filter by owning package`),search:r().optional().describe(`Full-text search query`),scope:E([`system`,`platform`,`user`]).optional().describe(`Filter by scope`),state:E([`draft`,`active`,`archived`,`deprecated`]).optional().describe(`Filter by lifecycle state`),tags:C(r()).optional().describe(`Filter by tags`),sortBy:E([`name`,`type`,`updatedAt`,`createdAt`]).default(`name`).describe(`Sort field`),sortOrder:E([`asc`,`desc`]).default(`asc`).describe(`Sort direction`),page:P().int().min(1).default(1).describe(`Page number`),pageSize:P().int().min(1).max(500).default(50).describe(`Items per page`)}),h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),namespace:r().optional().describe(`Namespace`),label:r().optional().describe(`Display label`),scope:E([`system`,`platform`,`user`]).optional(),state:E([`draft`,`active`,`archived`,`deprecated`]).optional(),packageId:r().optional(),updatedAt:r().datetime().optional()})).describe(`Matched metadata items`),total:P().int().min(0).describe(`Total matching items`),page:P().int().min(1).describe(`Current page`),pageSize:P().int().min(1).describe(`Page size`)}),h({event:E([`metadata.registered`,`metadata.updated`,`metadata.unregistered`,`metadata.validated`,`metadata.deployed`,`metadata.overlay.applied`,`metadata.overlay.removed`,`metadata.imported`,`metadata.exported`]).describe(`Event type`),metadataType:W1.describe(`Metadata type`),name:r().describe(`Metadata item name`),namespace:r().optional().describe(`Namespace`),packageId:r().optional().describe(`Owning package ID`),timestamp:r().datetime().describe(`Event timestamp`),actor:r().optional().describe(`User or system that triggered the event`),payload:d(r(),u()).optional().describe(`Event-specific payload`)}),h({valid:S().describe(`Whether the metadata is valid`),errors:C(h({path:r().describe(`JSON path to the invalid field`),message:r().describe(`Error description`),code:r().optional().describe(`Error code`)})).optional().describe(`Validation errors`),warnings:C(h({path:r().describe(`JSON path to the field`),message:r().describe(`Warning description`)})).optional().describe(`Validation warnings`)});var Kje=h({storage:Wje.describe(`Storage backend configuration`),customizationPolicies:C(Vje).optional().describe(`Default customization policies per type`),mergeStrategy:Bje.optional().describe(`Merge strategy for package upgrades`),additionalTypes:C(Gje.omit({type:!0}).extend({type:r().describe(`Custom metadata type identifier`)})).optional().describe(`Additional custom metadata types`),enableEvents:S().default(!0).describe(`Emit metadata change events`),validateOnWrite:S().default(!0).describe(`Validate metadata on write`),enableVersioning:S().default(!1).describe(`Track metadata version history`),cacheMaxItems:P().int().min(0).default(1e4).describe(`Max items in memory cache`)});h({id:m(`com.objectstack.metadata`).describe(`Metadata plugin ID`),name:m(`ObjectStack Metadata Service`).describe(`Plugin name`),version:r().regex(/^\d+\.\d+\.\d+$/).describe(`Plugin version`),type:m(`standard`).describe(`Plugin type`),description:r().default(`Core metadata management service for ObjectStack platform`).describe(`Plugin description`),capabilities:h({crud:S().default(!0).describe(`Supports metadata CRUD`),query:S().default(!0).describe(`Supports metadata query`),overlay:S().default(!0).describe(`Supports customization overlays`),watch:S().default(!1).describe(`Supports file watching`),importExport:S().default(!0).describe(`Supports import/export`),validation:S().default(!0).describe(`Supports schema validation`),versioning:S().default(!1).describe(`Supports version history`),events:S().default(!0).describe(`Emits metadata events`)}).describe(`Plugin capabilities`),config:Kje.optional().describe(`Plugin configuration`)});var G1=[{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`}];h({items:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),data:d(r(),u()).describe(`Metadata payload`),namespace:r().optional().describe(`Namespace`)})).min(1).describe(`Items to register`),continueOnError:S().default(!1).describe(`Continue if individual item fails`),validate:S().default(!0).describe(`Validate before register`)}),h({total:P().int().min(0).describe(`Total items processed`),succeeded:P().int().min(0).describe(`Successfully processed`),failed:P().int().min(0).describe(`Failed items`),errors:C(h({type:r().describe(`Metadata type`),name:r().describe(`Item name`),error:r().describe(`Error message`)})).optional().describe(`Per-item errors`)}),h({sourceType:r().describe(`Dependent metadata type`),sourceName:r().describe(`Dependent metadata name`),targetType:r().describe(`Referenced metadata type`),targetName:r().describe(`Referenced metadata name`),kind:E([`reference`,`extends`,`includes`,`triggers`]).describe(`How the dependency is formed`)});var K1=E([`installed`,`disabled`,`installing`,`upgrading`,`uninstalling`,`error`]).describe(`Package installation status`),q1=h({manifest:H1.describe(`Full package manifest`),status:K1.default(`installed`).describe(`Package state: installed, disabled, installing, upgrading, uninstalling, or error`),enabled:S().default(!0).describe(`Whether the package is currently enabled`),installedAt:r().datetime().optional().describe(`Installation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),installedVersion:r().optional().describe(`Currently installed version for quick access`),previousVersion:r().optional().describe(`Version before the last upgrade`),statusChangedAt:r().datetime().optional().describe(`Status change timestamp`),errorMessage:r().optional().describe(`Error message when status is error`),settings:d(r(),u()).optional().describe(`User-provided configuration settings`),upgradeHistory:C(h({fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Version after upgrade`),upgradedAt:r().datetime().describe(`Upgrade timestamp`),status:E([`success`,`failed`,`rolled_back`]).describe(`Upgrade outcome`),migrationLog:C(r()).optional().describe(`Migration step logs`)})).optional().describe(`Version upgrade history`),registeredNamespaces:C(r()).optional().describe(`Namespace prefixes registered by this package`)}).describe(`Installed package with runtime lifecycle state`);h({namespace:r().describe(`Namespace prefix`),packageId:r().describe(`Owning package ID`),registeredAt:r().datetime().describe(`Registration timestamp`),status:E([`active`,`disabled`,`reserved`]).describe(`Namespace status`)}).describe(`Namespace ownership entry in the registry`),h({type:m(`namespace_conflict`).describe(`Error type`),requestedNamespace:r().describe(`Requested namespace`),conflictingPackageId:r().describe(`Conflicting package ID`),conflictingPackageName:r().describe(`Conflicting package display name`),suggestion:r().optional().describe(`Suggested alternative namespace`)}).describe(`Namespace collision error during installation`),h({status:K1.optional().describe(`Filter by package status`),type:H1.shape.type.optional().describe(`Filter by package type`),enabled:S().optional().describe(`Filter by enabled state`)}).describe(`List packages request`),h({packages:C(q1).describe(`List of installed packages`),total:P().describe(`Total package count`)}).describe(`List packages response`),h({id:r().describe(`Package identifier`)}).describe(`Get package request`),h({package:q1.describe(`Package details`)}).describe(`Get package response`),h({manifest:H1.describe(`Package manifest to install`),settings:d(r(),u()).optional().describe(`User-provided settings at install time`),enableOnInstall:S().default(!0).describe(`Whether to enable immediately after install`),platformVersion:r().optional().describe(`Current platform version for compatibility verification`)}).describe(`Install package request`),h({package:q1.describe(`Installed package details`),message:r().optional().describe(`Installation status message`),dependencyResolution:eje.optional().describe(`Dependency resolution result from install analysis`)}).describe(`Install package response`),h({id:r().describe(`Package ID to uninstall`)}).describe(`Uninstall package request`),h({id:r().describe(`Uninstalled package ID`),success:S().describe(`Whether uninstall succeeded`),message:r().optional().describe(`Uninstall status message`)}).describe(`Uninstall package response`),h({id:r().describe(`Package ID to enable`)}).describe(`Enable package request`),h({package:q1.describe(`Enabled package details`),message:r().optional().describe(`Enable status message`)}).describe(`Enable package response`),h({id:r().describe(`Package ID to disable`)}).describe(`Disable package request`),h({package:q1.describe(`Disabled package details`),message:r().optional().describe(`Disable status message`)}).describe(`Disable package response`);var qje=E([`added`,`modified`,`removed`,`renamed`]).describe(`Type of metadata change between package versions`),Jje=h({type:r().describe(`Metadata type`),name:r().describe(`Metadata name`),changeType:qje.describe(`Category of metadata modification (added, modified, removed, or renamed)`),hasConflict:S().default(!1).describe(`Whether this change may conflict with customizations`),summary:r().optional().describe(`Human-readable change summary`),previousName:r().optional().describe(`Previous name if renamed`)}).describe(`Single metadata change between package versions`),Yje=E([`none`,`low`,`medium`,`high`,`critical`]).describe(`Severity of upgrade impact`),Xje=h({packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Currently installed version`),toVersion:r().describe(`Target upgrade version`),impactLevel:Yje.describe(`Severity assessment from none (seamless) to critical (breaking changes)`),changes:C(Jje).describe(`All metadata changes`),affectedCustomizations:P().int().min(0).default(0).describe(`Count of customizations that may be affected`),requiresMigration:S().default(!1).describe(`Whether data migration scripts are needed`),migrationScripts:C(r()).optional().describe(`Paths to migration scripts`),dependencyUpgrades:C(h({packageId:r(),fromVersion:r(),toVersion:r()})).optional().describe(`Dependent packages that also need upgrading`),estimatedDuration:P().int().min(0).optional().describe(`Estimated upgrade duration in seconds`),summary:r().optional().describe(`Human-readable upgrade summary`)}).describe(`Upgrade analysis plan generated before execution`);h({id:r().describe(`Snapshot identifier`),packageId:r().describe(`Package identifier`),fromVersion:r().describe(`Version before upgrade`),toVersion:r().describe(`Target upgrade version`),tenantId:r().optional().describe(`Tenant identifier`),previousManifest:H1.describe(`Complete manifest of the previous package version`),metadataSnapshot:C(h({type:r(),name:r(),metadata:d(r(),u())})).describe(`Snapshot of all package metadata`),customizationSnapshot:C(d(r(),u())).optional().describe(`Snapshot of customer customizations`),createdAt:r().datetime().describe(`Snapshot creation timestamp`),expiresAt:r().datetime().optional().describe(`Snapshot expiry timestamp`)}).describe(`Pre-upgrade state snapshot for rollback capability`),h({packageId:r().describe(`Package ID to upgrade`),targetVersion:r().optional().describe(`Target version (defaults to latest)`),manifest:H1.optional().describe(`New manifest (if installing from local)`),createSnapshot:S().default(!0).describe(`Whether to create a pre-upgrade backup snapshot`),mergeStrategy:E([`keep-custom`,`accept-incoming`,`three-way-merge`]).default(`three-way-merge`).describe(`How to handle customer customizations`),dryRun:S().default(!1).describe(`Preview upgrade without making changes`),skipValidation:S().default(!1).describe(`Skip pre-upgrade compatibility checks`)}).describe(`Upgrade package request`);var Zje=E([`pending`,`analyzing`,`snapshot`,`executing`,`migrating`,`validating`,`completed`,`failed`,`rolling-back`,`rolled-back`]).describe(`Current phase of the upgrade process`);h({success:S().describe(`Whether the upgrade succeeded`),phase:Zje.describe(`Current upgrade phase`),plan:Xje.optional().describe(`Upgrade plan`),snapshotId:r().optional().describe(`Snapshot ID for rollback`),conflicts:C(h({path:r(),baseValue:u(),incomingValue:u(),customValue:u()})).optional().describe(`Unresolved merge conflicts`),errorMessage:r().optional().describe(`Error message if upgrade failed`),message:r().optional().describe(`Human-readable status message`)}).describe(`Upgrade package response`),h({packageId:r().describe(`Package ID to rollback`),snapshotId:r().describe(`Snapshot ID to restore from`),rollbackCustomizations:S().default(!0).describe(`Whether to restore pre-upgrade customizations`)}).describe(`Rollback package request`),h({success:S().describe(`Whether the rollback succeeded`),restoredVersion:r().optional().describe(`Version restored to`),message:r().optional().describe(`Rollback status message`)}).describe(`Rollback package response`);var J1=E([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),Qje=h({interval:P().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:P().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:P().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:P().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:r().optional().describe(`Method name to call for health check`),autoRestart:S().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:P().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)});h({status:J1,timestamp:r().datetime(),message:r().optional(),metrics:h({uptime:P().describe(`Plugin uptime in milliseconds`),memoryUsage:P().optional().describe(`Memory usage in bytes`),cpuUsage:P().optional().describe(`CPU usage percentage`),activeConnections:P().optional().describe(`Number of active connections`),errorRate:P().optional().describe(`Error rate (errors per minute)`),responseTime:P().optional().describe(`Average response time in ms`)}).partial().optional(),checks:C(h({name:r().describe(`Check name`),status:E([`passed`,`failed`,`warning`]),message:r().optional(),data:d(r(),u()).optional()})).optional(),dependencies:C(h({pluginId:r(),status:J1,message:r().optional()})).optional()});var $je=h({provider:E([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:C(r()).optional().describe(`Backend connection endpoints`),keyPrefix:r().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:P().int().min(0).optional().describe(`State expiration time in seconds`),auth:h({username:r().optional(),password:r().optional(),token:r().optional(),certificate:r().optional()}).optional(),replication:h({enabled:S().default(!0),minReplicas:P().int().min(1).default(1)}).optional(),customConfig:d(r(),u()).optional().describe(`Provider-specific configuration`)}),eMe=h({enabled:S().default(!1),watchPatterns:C(r()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:P().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:S().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:E([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:$je.optional().describe(`Configuration for distributed state management`),shutdownTimeout:P().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:C(r()).optional().describe(`Hook names to call before reload`),afterReload:C(r()).optional().describe(`Hook names to call after reload`)}),tMe=h({enabled:S().default(!0),fallbackMode:E([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:C(r()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:C(r()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:C(h({feature:r().describe(`Feature name`),enabled:S().describe(`Whether feature is available in degraded mode`),reason:r().optional()})).optional(),autoRecovery:h({enabled:S().default(!0),retryInterval:P().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:P().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),nMe=h({mode:E([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:h({major:S().default(!1).describe(`Allow major version updates`),minor:S().default(!0).describe(`Allow minor version updates`),patch:S().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:h({cron:r().optional(),timezone:r().default(`UTC`),maintenanceWindow:P().int().min(1).default(60)}).optional(),rollback:h({enabled:S().default(!0),automatic:S().default(!0),keepVersions:P().int().min(1).default(3),timeout:P().int().min(1e3).default(3e4)}).optional(),validation:h({checkCompatibility:S().default(!0),runTests:S().default(!1),testSuite:r().optional()}).optional()});h({pluginId:r(),version:r(),timestamp:r().datetime(),state:d(r(),u()),metadata:h({checksum:r().optional().describe(`State checksum for verification`),compressed:S().default(!1),encryption:r().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),h({health:Qje.optional(),hotReload:eMe.optional(),degradation:tMe.optional(),updates:nMe.optional(),resources:h({maxMemory:P().int().optional().describe(`Maximum memory in bytes`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:P().int().optional().describe(`Maximum concurrent connections`),timeout:P().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:h({enableMetrics:S().default(!0),enableTracing:S().default(!0),enableProfiling:S().default(!1),metricsInterval:P().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()});var Y1=E([`init`,`start`,`destroy`]).describe(`Plugin lifecycle phase`),X1=h({pluginName:r().describe(`Name of the plugin`),timestamp:P().int().describe(`Unix timestamp in milliseconds when event occurred`)});X1.extend({version:r().optional().describe(`Plugin version`)}),X1.extend({duration:P().min(0).optional().describe(`Duration of the lifecycle phase in milliseconds`),phase:Y1.optional().describe(`Lifecycle phase`)}),X1.extend({error:h({name:r().describe(`Error class name`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`),code:r().optional().describe(`Error code`)}).describe(`Serializable error representation`),phase:Y1.describe(`Lifecycle phase where error occurred`),errorMessage:r().optional().describe(`Error message`),errorStack:r().optional().describe(`Error stack trace`)}),h({serviceName:r().describe(`Name of the registered service`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),serviceType:r().optional().describe(`Type or interface name of the service`)}),h({serviceName:r().describe(`Name of the unregistered service`),timestamp:P().int().describe(`Unix timestamp in milliseconds`)}),h({hookName:r().describe(`Name of the hook`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),handlerCount:P().int().min(0).describe(`Number of handlers registered for this hook`)}),h({hookName:r().describe(`Name of the hook`),timestamp:P().int().describe(`Unix timestamp in milliseconds`),args:C(u()).describe(`Arguments passed to the hook handlers`),handlerCount:P().int().min(0).optional().describe(`Number of handlers that will handle this event`)});var Z1=h({timestamp:P().int().describe(`Unix timestamp in milliseconds`)});Z1.extend({duration:P().min(0).optional().describe(`Total initialization duration in milliseconds`),pluginCount:P().int().min(0).optional().describe(`Number of plugins initialized`)}),Z1.extend({reason:r().optional().describe(`Reason for kernel shutdown`)}),E([`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 rMe=E([`load`,`unload`,`reload`,`enable`,`disable`]).describe(`Runtime plugin operation type`),iMe=h({type:E([`npm`,`local`,`url`,`registry`,`git`]).describe(`Plugin source type`),location:r().describe(`Package name, file path, URL, or git repository`),version:r().optional().describe(`Semver version range (e.g., "^1.0.0")`),integrity:r().optional().describe(`Subresource Integrity hash (e.g., "sha384-...")`)}).describe(`Plugin source location for dynamic resolution`),aMe=h({type:E([`onCommand`,`onRoute`,`onObject`,`onEvent`,`onService`,`onSchedule`,`onStartup`]).describe(`Trigger type for lazy activation`),pattern:r().describe(`Match pattern for the activation trigger`)}).describe(`Lazy activation trigger for a dynamic plugin`);h({pluginId:r().describe(`Unique plugin identifier`),source:iMe,activationEvents:C(aMe).optional().describe(`Lazy activation triggers; if omitted plugin starts immediately`),config:d(r(),u()).optional().describe(`Runtime configuration overrides`),priority:P().int().min(0).default(100).describe(`Loading priority (lower is higher)`),sandbox:S().default(!1).describe(`Run in an isolated sandbox`),timeout:P().int().min(1e3).default(6e4).describe(`Maximum time to complete loading in ms`)}).describe(`Request to dynamically load a plugin at runtime`),h({pluginId:r().describe(`Plugin to unload`),strategy:E([`graceful`,`forceful`,`drain`]).default(`graceful`).describe(`How to handle in-flight work during unload`),timeout:P().int().min(1e3).default(3e4).describe(`Maximum time to complete unloading in ms`),cleanupCache:S().default(!1).describe(`Remove cached code and assets after unload`),dependentAction:E([`cascade`,`warn`,`block`]).default(`block`).describe(`How to handle plugins that depend on this one`)}).describe(`Request to dynamically unload a plugin at runtime`),h({success:S(),operation:rMe,pluginId:r(),durationMs:P().int().min(0).optional(),version:r().optional(),error:h({code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),details:d(r(),u()).optional()}).optional(),warnings:C(r()).optional()}).describe(`Result of a dynamic plugin operation`);var oMe=h({type:E([`registry`,`npm`,`directory`,`url`]).describe(`Discovery source type`),endpoint:r().describe(`Registry URL, directory path, or manifest URL`),pollInterval:P().int().min(0).default(0).describe(`How often to re-scan for new plugins (0 = manual)`),filter:h({tags:C(r()).optional(),vendors:C(r()).optional(),minTrustLevel:E([`verified`,`trusted`,`community`,`untrusted`]).optional()}).optional()}).describe(`Source for runtime plugin discovery`),sMe=h({enabled:S().default(!1),sources:C(oMe).default([]),autoLoad:S().default(!1).describe(`Automatically load newly discovered plugins`),requireApproval:S().default(!0).describe(`Require admin approval before loading discovered plugins`)}).describe(`Runtime plugin discovery configuration`);h({enabled:S().default(!1).describe(`Enable runtime load/unload of plugins`),maxDynamicPlugins:P().int().min(1).default(50).describe(`Upper limit on runtime-loaded plugins`),discovery:sMe.optional(),defaultSandbox:S().default(!0).describe(`Sandbox dynamically loaded plugins by default`),allowedSources:C(E([`npm`,`local`,`url`,`registry`,`git`])).optional().describe(`Restrict which source types are permitted`),requireIntegrity:S().default(!0).describe(`Require integrity hash verification for remote sources`),operationTimeout:P().int().min(1e3).default(6e4).describe(`Default timeout for load/unload operations in ms`)}).describe(`Dynamic plugin loading subsystem configuration`);var cMe=E([`global`,`tenant`,`user`,`resource`,`plugin`]).describe(`Scope of permission application`),lMe=E([`create`,`read`,`update`,`delete`,`execute`,`manage`,`configure`,`share`,`export`,`import`,`admin`]).describe(`Type of action being permitted`),uMe=E([`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`),dMe=h({permissions:C(h({id:r().describe(`Unique permission identifier`),resource:uMe,actions:C(lMe),scope:cMe.default(`plugin`),filter:h({resourceIds:C(r()).optional(),condition:r().optional().describe(`Filter expression (e.g., owner = currentUser)`),fields:C(r()).optional().describe(`Allowed fields for data resources`)}).optional(),description:r(),required:S().default(!0),justification:r().optional().describe(`Why this permission is needed`)})),groups:C(h({name:r().describe(`Group name`),description:r(),permissions:C(r()).describe(`Permission IDs in this group`)})).optional(),defaultGrant:E([`prompt`,`allow`,`deny`,`inherit`]).default(`prompt`)}),fMe=h({engine:E([`v8-isolate`,`wasm`,`container`,`process`]).default(`v8-isolate`).describe(`Execution environment engine`),engineConfig:h({wasm:h({maxMemoryPages:P().int().min(1).max(65536).optional().describe(`Maximum WASM memory pages (64KB each)`),instructionLimit:P().int().min(1).optional().describe(`Maximum instructions before timeout`),enableSimd:S().default(!1).describe(`Enable WebAssembly SIMD support`),enableThreads:S().default(!1).describe(`Enable WebAssembly threads`),enableBulkMemory:S().default(!0).describe(`Enable bulk memory operations`)}).optional(),container:h({image:r().optional().describe(`Container image to use`),runtime:E([`docker`,`podman`,`containerd`]).default(`docker`),resources:h({cpuLimit:r().optional().describe(`CPU limit (e.g., "0.5", "2")`),memoryLimit:r().optional().describe(`Memory limit (e.g., "512m", "1g")`)}).optional(),networkMode:E([`none`,`bridge`,`host`]).default(`bridge`)}).optional(),v8Isolate:h({heapSizeMb:P().int().min(1).optional(),enableSnapshot:S().default(!0)}).optional()}).optional(),resourceLimits:h({maxMemory:P().int().optional().describe(`Maximum memory allocation`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU usage percentage`),timeout:P().int().min(0).optional().describe(`Maximum execution time`)}).optional()}),pMe=h({enabled:S().default(!0),level:E([`none`,`minimal`,`standard`,`strict`,`paranoid`]).default(`standard`),runtime:fMe.optional().describe(`Execution environment and isolation settings`),filesystem:h({mode:E([`none`,`readonly`,`restricted`,`full`]).default(`restricted`),allowedPaths:C(r()).optional().describe(`Whitelisted paths`),deniedPaths:C(r()).optional().describe(`Blacklisted paths`),maxFileSize:P().int().optional().describe(`Maximum file size in bytes`)}).optional(),network:h({mode:E([`none`,`local`,`restricted`,`full`]).default(`restricted`),allowedHosts:C(r()).optional().describe(`Whitelisted hosts`),deniedHosts:C(r()).optional().describe(`Blacklisted hosts`),allowedPorts:C(P()).optional().describe(`Allowed port numbers`),maxConnections:P().int().optional()}).optional(),process:h({allowSpawn:S().default(!1).describe(`Allow spawning child processes`),allowedCommands:C(r()).optional().describe(`Whitelisted commands`),timeout:P().int().optional().describe(`Process timeout in ms`)}).optional(),memory:h({maxHeap:P().int().optional().describe(`Maximum heap size in bytes`),maxStack:P().int().optional().describe(`Maximum stack size in bytes`)}).optional(),cpu:h({maxCpuPercent:P().min(0).max(100).optional(),maxThreads:P().int().optional()}).optional(),environment:h({mode:E([`none`,`readonly`,`restricted`,`full`]).default(`readonly`),allowedVars:C(r()).optional(),deniedVars:C(r()).optional()}).optional()}),Q1=h({cve:r().optional(),id:r(),severity:E([`critical`,`high`,`medium`,`low`,`info`]),category:r().optional(),title:r(),location:r().optional(),remediation:r().optional(),description:r(),affectedVersions:C(r()),fixedIn:C(r()).optional(),cvssScore:P().min(0).max(10).optional(),exploitAvailable:S().default(!1),patchAvailable:S().default(!1),workaround:r().optional(),references:C(r()).optional(),discoveredDate:r().datetime().optional(),publishedDate:r().datetime().optional()}),mMe=h({timestamp:r().datetime(),scanner:h({name:r(),version:r()}),status:E([`passed`,`failed`,`warning`]),vulnerabilities:C(Q1).optional(),codeIssues:C(h({severity:E([`error`,`warning`,`info`]),type:r().describe(`Issue type (e.g., sql-injection, xss)`),file:r(),line:P().int().optional(),message:r(),suggestion:r().optional()})).optional(),dependencyVulnerabilities:C(h({package:r(),version:r(),vulnerability:Q1})).optional(),licenseCompliance:h({status:E([`compliant`,`non-compliant`,`unknown`]),issues:C(h({package:r(),license:r(),reason:r()})).optional()}).optional(),summary:h({totalVulnerabilities:P().int(),criticalCount:P().int(),highCount:P().int(),mediumCount:P().int(),lowCount:P().int(),infoCount:P().int()})}),hMe=h({csp:h({directives:d(r(),C(r())).optional(),reportOnly:S().default(!1)}).optional(),cors:h({allowedOrigins:C(r()),allowedMethods:C(r()),allowedHeaders:C(r()),allowCredentials:S().default(!1),maxAge:P().int().optional()}).optional(),rateLimit:h({enabled:S().default(!0),maxRequests:P().int(),windowMs:P().int().describe(`Time window in milliseconds`),strategy:E([`fixed`,`sliding`,`token-bucket`]).default(`sliding`)}).optional(),authentication:h({required:S().default(!0),methods:C(E([`jwt`,`oauth2`,`api-key`,`session`,`certificate`])),tokenExpiration:P().int().optional().describe(`Token expiration in seconds`)}).optional(),encryption:h({dataAtRest:S().default(!1).describe(`Encrypt data at rest`),dataInTransit:S().default(!0).describe(`Enforce HTTPS/TLS`),algorithm:r().optional().describe(`Encryption algorithm`),minKeyLength:P().int().optional().describe(`Minimum key length in bits`)}).optional(),auditLog:h({enabled:S().default(!0),events:C(r()).optional().describe(`Events to log`),retention:P().int().optional().describe(`Log retention in days`)}).optional()}),gMe=E([`verified`,`trusted`,`community`,`untrusted`,`blocked`]).describe(`Trust level of the plugin`);h({pluginId:r(),trustLevel:gMe,permissions:dMe,sandbox:pMe,policy:hMe.optional(),scanResults:C(mMe).optional(),vulnerabilities:C(Q1).optional(),codeSigning:h({signed:S(),signature:r().optional(),certificate:r().optional(),algorithm:r().optional(),timestamp:r().datetime().optional()}).optional(),certifications:C(h({name:r().describe(`Certification name (e.g., SOC 2, ISO 27001)`),issuer:r(),issuedDate:r().datetime(),expiryDate:r().datetime().optional(),certificateUrl:r().url().optional()})).optional(),securityContact:h({email:r().email().optional(),url:r().url().optional(),pgpKey:r().optional()}).optional(),vulnerabilityDisclosure:h({policyUrl:r().url().optional(),responseTime:P().int().optional().describe(`Expected response time in hours`),bugBounty:S().default(!1)}).optional()});var $1=/^[a-z][a-z0-9_]*$/,_Me=r().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];$1.test(e)||t.addIssue({code:de.custom,message:`Domain directory '${e}' must be lowercase snake_case`})}let r=n[n.length-1];r===`index.ts`||r===`main.ts`||$1.test(r.split(`.`)[0])||t.addIssue({code:de.custom,message:`Filename '${r}' base name must be lowercase snake_case`})});h({name:r().regex($1).describe(`Module name (snake_case)`),files:C(r()).describe(`List of files in this module`),metadata:d(r(),u()).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:de.custom,message:`Module '${e.name}' is missing an 'index.ts' entry point.`})}),h({root:r().describe(`Root directory path of the plugin project`),files:C(r()).describe(`List of all file paths relative to root`),metadata:d(r(),u()).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:de.custom,message:`Missing 'objectstack.config.ts' configuration file.`}),e.files.filter(e=>e.startsWith(`src/`)).forEach(e=>{let n=_Me.safeParse(e);n.success||n.error.issues.forEach(n=>{t.addIssue({...n,path:[e]})})})});var vMe=h({field:r().describe(`Field name that failed validation`),message:r().describe(`Human-readable error message`),code:r().optional().describe(`Machine-readable error code`)}),yMe=h({field:r().describe(`Field name with warning`),message:r().describe(`Human-readable warning message`),code:r().optional().describe(`Machine-readable warning code`)});h({valid:S().describe(`Whether the plugin passed validation`),errors:C(vMe).optional().describe(`Validation errors`),warnings:C(yMe).optional().describe(`Validation warnings`)}),h({name:r().min(1).describe(`Unique plugin identifier`),version:r().regex(/^\d+\.\d+\.\d+$/).optional().describe(`Semantic version (e.g., 1.0.0)`),dependencies:C(r()).optional().describe(`Array of plugin names this plugin depends on`),signature:r().optional().describe(`Cryptographic signature for plugin verification`)}).passthrough().describe(`Plugin metadata for validation`);var bMe=h({major:P().int().min(0).describe(`Major version (breaking changes)`),minor:P().int().min(0).describe(`Minor version (backward compatible features)`),patch:P().int().min(0).describe(`Patch version (backward compatible fixes)`),preRelease:r().optional().describe(`Pre-release identifier (alpha, beta, rc.1)`),build:r().optional().describe(`Build metadata`)}).describe(`Semantic version number`);l([r().regex(/^[\d.]+$/).describe("Exact version: `1.2.3`"),r().regex(/^\^[\d.]+$/).describe("Compatible with: `^1.2.3` (`>=1.2.3 <2.0.0`)"),r().regex(/^~[\d.]+$/).describe("Approximately: `~1.2.3` (`>=1.2.3 <1.3.0`)"),r().regex(/^>=[\d.]+$/).describe("Greater than or equal: `>=1.2.3`"),r().regex(/^>[\d.]+$/).describe("Greater than: `>1.2.3`"),r().regex(/^<=[\d.]+$/).describe("Less than or equal: `<=1.2.3`"),r().regex(/^<[\d.]+$/).describe("Less than: `<1.2.3`"),r().regex(/^[\d.]+ - [\d.]+$/).describe("Range: `1.2.3 - 2.3.4`"),m(`*`).describe(`Any version`),m(`latest`).describe(`Latest stable version`)]);var xMe=E([`fully-compatible`,`backward-compatible`,`deprecated-compatible`,`breaking-changes`,`incompatible`]).describe(`Compatibility level between versions`),e0=h({introducedIn:r().describe(`Version that introduced this breaking change`),type:E([`api-removed`,`api-renamed`,`api-signature-changed`,`behavior-changed`,`dependency-changed`,`configuration-changed`,`protocol-changed`]),description:r(),migrationGuide:r().optional().describe(`How to migrate from old to new`),deprecatedIn:r().optional().describe(`Version where old API was deprecated`),removedIn:r().optional().describe(`Version where old API will be removed`),automatedMigration:S().default(!1).describe(`Whether automated migration tool is available`),severity:E([`critical`,`major`,`minor`]).describe(`Impact severity`)}),SMe=h({feature:r().describe(`Deprecated feature identifier`),deprecatedIn:r(),removeIn:r().optional(),reason:r(),alternative:r().optional().describe(`What to use instead`),migrationPath:r().optional().describe(`How to migrate to alternative`)}),t0=h({from:r().describe(`Version being upgraded from`),to:r().describe(`Version being upgraded to`),compatibility:xMe,breakingChanges:C(e0).optional(),migrationRequired:S().default(!1),migrationComplexity:E([`trivial`,`simple`,`moderate`,`complex`,`major`]).optional(),estimatedMigrationTime:P().optional(),migrationScript:r().optional().describe(`Path to migration script`),testCoverage:P().min(0).max(100).optional().describe(`Percentage of migration covered by tests`)});h({pluginId:r(),currentVersion:r(),compatibilityMatrix:C(t0),supportedVersions:C(h({version:r(),supported:S(),endOfLife:r().datetime().optional().describe(`End of support date`),securitySupport:S().default(!1).describe(`Still receives security updates`)})),minimumCompatibleVersion:r().optional().describe(`Oldest version that can be directly upgraded`)});var CMe=h({type:E([`version-mismatch`,`missing-dependency`,`circular-dependency`,`incompatible-versions`,`conflicting-interfaces`]),plugins:C(h({pluginId:r(),version:r(),requirement:r().optional().describe(`What this plugin requires`)})),description:r(),resolutions:C(h({strategy:E([`upgrade`,`downgrade`,`replace`,`disable`,`manual`]),description:r(),automaticResolution:S().default(!1),riskLevel:E([`low`,`medium`,`high`])})).optional(),severity:E([`critical`,`error`,`warning`,`info`])});h({success:S(),resolved:C(h({pluginId:r(),version:r(),resolvedVersion:r()})).optional(),conflicts:C(CMe).optional(),warnings:C(r()).optional(),installationOrder:C(r()).optional().describe(`Plugin IDs in order they should be installed`),dependencyGraph:d(r(),C(r())).optional().describe(`Map of plugin ID to its dependencies`)}),h({enabled:S().default(!1),maxConcurrentVersions:P().int().min(1).default(2).describe(`How many versions can run at the same time`),selectionStrategy:E([`latest`,`stable`,`compatible`,`pinned`,`canary`,`custom`]).default(`latest`),routing:C(h({condition:r().describe(`Routing condition (e.g., tenant, user, feature flag)`),version:r().describe(`Version to use when condition matches`),priority:P().int().default(100).describe(`Rule priority`)})).optional(),rollout:h({enabled:S().default(!1),strategy:E([`percentage`,`blue-green`,`canary`]),percentage:P().min(0).max(100).optional().describe(`Percentage of traffic to new version`),duration:P().int().optional().describe(`Rollout duration in milliseconds`)}).optional()}),h({pluginId:r(),version:bMe,versionString:r().describe(`Full version string (e.g., 1.2.3-beta.1+build.123)`),releaseDate:r().datetime(),releaseNotes:r().optional(),breakingChanges:C(e0).optional(),deprecations:C(SMe).optional(),compatibilityMatrix:C(t0).optional(),securityFixes:C(h({cve:r().optional().describe(`CVE identifier`),severity:E([`critical`,`high`,`medium`,`low`]),description:r(),fixedIn:r().describe(`Version where vulnerability was fixed`)})).optional(),statistics:h({downloads:P().int().min(0).optional(),installations:P().int().min(0).optional(),ratings:P().min(0).max(5).optional()}).optional(),support:h({status:E([`active`,`maintenance`,`deprecated`,`eol`]),endOfLife:r().datetime().optional(),securitySupport:S().default(!0)})});var n0=E([`singleton`,`transient`,`scoped`]).describe(`Service scope type`);h({name:r().min(1).describe(`Unique service name identifier`),scope:n0.optional().default(`singleton`).describe(`Service scope type`),type:r().optional().describe(`Service type or interface name`),registeredAt:P().int().optional().describe(`Unix timestamp in milliseconds when service was registered`),metadata:d(r(),u()).optional().describe(`Additional service-specific metadata`)}),h({strictMode:S().optional().default(!0).describe(`Throw errors on invalid operations (duplicate registration, service not found, etc.)`),allowOverwrite:S().optional().default(!1).describe(`Allow overwriting existing service registrations`),enableLogging:S().optional().default(!1).describe(`Enable logging for service registration and retrieval`),scopeTypes:C(r()).optional().describe(`Supported scope types`),maxServices:P().int().min(1).optional().describe(`Maximum number of services that can be registered`)}),h({name:r().min(1).describe(`Unique service name identifier`),scope:n0.optional().default(`singleton`).describe(`Service scope type`),factoryType:E([`sync`,`async`]).optional().default(`sync`).describe(`Whether factory is synchronous or asynchronous`),singleton:S().optional().default(!0).describe(`Whether to cache the factory result (singleton pattern)`)}),h({scopeType:r().describe(`Type of scope`),scopeId:r().optional().describe(`Unique scope identifier`),metadata:d(r(),u()).optional().describe(`Scope-specific context metadata`)}),h({scopeId:r().describe(`Unique scope identifier`),scopeType:r().describe(`Type of scope`),createdAt:P().int().describe(`Unix timestamp in milliseconds when scope was created`),serviceCount:P().int().min(0).optional().describe(`Number of services registered in this scope`),metadata:d(r(),u()).optional().describe(`Scope-specific context metadata`)}),h({timeout:P().int().min(0).optional().default(3e4).describe(`Maximum time in milliseconds to wait for each plugin to start`),rollbackOnFailure:S().optional().default(!0).describe(`Whether to rollback already-started plugins if any plugin fails`),healthCheck:S().optional().default(!1).describe(`Whether to run health checks after plugin startup`),parallel:S().optional().default(!1).describe(`Whether to start plugins in parallel when dependencies allow`),context:u().optional().describe(`Custom context object to pass to plugin lifecycle methods`)});var wMe=h({healthy:S().describe(`Whether the plugin is healthy`),timestamp:P().int().describe(`Unix timestamp in milliseconds when health check was performed`),details:d(r(),u()).optional().describe(`Optional plugin-specific health details`),message:r().optional().describe(`Error message if plugin is unhealthy`)});h({results:C(h({plugin:h({name:r(),version:r().optional()}).passthrough().describe(`Plugin metadata`),success:S().describe(`Whether the plugin started successfully`),duration:P().min(0).describe(`Time taken to start the plugin in milliseconds`),error:h({name:r().describe(`Error class name`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`),code:r().optional().describe(`Error code`)}).optional().describe(`Serializable error representation if startup failed`),health:wMe.optional().describe(`Health status after startup if health check was enabled`)})).describe(`Startup results for each plugin`),totalDuration:P().min(0).describe(`Total time taken for all plugins in milliseconds`),allSuccessful:S().describe(`Whether all plugins started successfully`),rolledBack:C(r()).optional().describe(`Names of plugins that were rolled back`)});var TMe=h({id:r().regex(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+$/).describe(`Vendor identifier (reverse domain)`),name:r(),website:r().url().optional(),email:r().email().optional(),verified:S().default(!1).describe(`Whether vendor is verified by ObjectStack`),trustLevel:E([`official`,`verified`,`community`,`unverified`]).default(`unverified`)}),EMe=h({testCoverage:P().min(0).max(100).optional(),documentationScore:P().min(0).max(100).optional(),codeQuality:P().min(0).max(100).optional(),securityScan:h({lastScanDate:r().datetime().optional(),vulnerabilities:h({critical:P().int().min(0).default(0),high:P().int().min(0).default(0),medium:P().int().min(0).default(0),low:P().int().min(0).default(0)}).optional(),passed:S().default(!1)}).optional(),conformanceTests:C(h({protocolId:r().describe(`Protocol being tested`),passed:S(),totalTests:P().int().min(0),passedTests:P().int().min(0),lastRunDate:r().datetime().optional()})).optional()}),DMe=h({downloads:P().int().min(0).default(0),downloadsLastMonth:P().int().min(0).default(0),activeInstallations:P().int().min(0).default(0),ratings:h({average:P().min(0).max(5).default(0),count:P().int().min(0).default(0),distribution:h({5:P().int().min(0).default(0),4:P().int().min(0).default(0),3:P().int().min(0).default(0),2:P().int().min(0).default(0),1:P().int().min(0).default(0)}).optional()}).optional(),stars:P().int().min(0).optional(),dependents:P().int().min(0).default(0)});h({id:r().regex(/^([a-z][a-z0-9]*\.)+[a-z][a-z0-9-]+$/).describe(`Plugin identifier (reverse domain notation)`),version:r().regex(/^\d+\.\d+\.\d+$/),name:r(),description:r().optional(),readme:r().optional(),category:E([`data`,`integration`,`ui`,`analytics`,`security`,`automation`,`ai`,`utility`,`driver`,`gateway`,`adapter`]).optional(),tags:C(r()).optional(),vendor:TMe,capabilities:B1.optional(),compatibility:h({minObjectStackVersion:r().optional(),maxObjectStackVersion:r().optional(),nodeVersion:r().optional(),platforms:C(E([`linux`,`darwin`,`win32`,`browser`])).optional()}).optional(),links:h({homepage:r().url().optional(),repository:r().url().optional(),documentation:r().url().optional(),bugs:r().url().optional(),changelog:r().url().optional()}).optional(),media:h({icon:r().url().optional(),logo:r().url().optional(),screenshots:C(r().url()).optional(),video:r().url().optional()}).optional(),quality:EMe.optional(),statistics:DMe.optional(),license:r().optional().describe(`SPDX license identifier`),pricing:h({model:E([`free`,`freemium`,`paid`,`enterprise`]),price:P().min(0).optional(),currency:r().default(`USD`).optional(),billingPeriod:E([`one-time`,`monthly`,`yearly`]).optional()}).optional(),publishedAt:r().datetime().optional(),updatedAt:r().datetime().optional(),deprecated:S().default(!1),deprecationMessage:r().optional(),replacedBy:r().optional().describe(`Plugin ID that replaces this one`),flags:h({experimental:S().default(!1),beta:S().default(!1),featured:S().default(!1),verified:S().default(!1)}).optional()}),h({query:r().optional(),category:C(r()).optional(),tags:C(r()).optional(),trustLevel:C(E([`official`,`verified`,`community`,`unverified`])).optional(),implementsProtocols:C(r()).optional(),pricingModel:C(E([`free`,`freemium`,`paid`,`enterprise`])).optional(),minRating:P().min(0).max(5).optional(),sortBy:E([`relevance`,`downloads`,`rating`,`updated`,`name`]).optional(),sortOrder:E([`asc`,`desc`]).default(`desc`).optional(),page:P().int().min(1).default(1).optional(),limit:P().int().min(1).max(100).default(20).optional()}),h({pluginId:r(),version:r().optional().describe(`Defaults to latest`),config:d(r(),u()).optional(),autoUpdate:S().default(!1).optional(),options:h({skipDependencies:S().default(!1).optional(),force:S().default(!1).optional(),target:E([`system`,`space`,`user`]).default(`space`).optional()}).optional()});var OMe=E([`critical`,`high`,`medium`,`low`,`info`]).describe(`Severity level of a security vulnerability`),kMe=h({cve:r().regex(/^CVE-\d{4}-\d+$/).optional().describe(`CVE identifier`),id:r().describe(`Vulnerability ID`),title:r().describe(`Short title summarizing the vulnerability`),description:r().describe(`Detailed description of the vulnerability`),severity:OMe.describe(`Severity level of this vulnerability`),cvss:P().min(0).max(10).optional().describe(`CVSS score ranging from 0 to 10`),package:h({name:r().describe(`Name of the affected package`),version:r().describe(`Version of the affected package`),ecosystem:r().optional().describe(`Package ecosystem (e.g., npm, pip, maven)`)}).describe(`Affected package information`),vulnerableVersions:r().describe(`Semver range of vulnerable versions`),patchedVersions:r().optional().describe(`Semver range of patched versions`),references:C(h({type:E([`advisory`,`article`,`report`,`web`]).describe(`Type of reference source`),url:r().url().describe(`URL of the reference`)})).default([]).describe(`External references related to the vulnerability`),cwe:C(r()).default([]).describe(`CWE identifiers associated with this vulnerability`),publishedAt:r().datetime().optional().describe(`ISO 8601 date when the vulnerability was published`),mitigation:r().optional().describe(`Recommended steps to mitigate the vulnerability`)}).describe(`A known security vulnerability in a package dependency`);h({scanId:r().uuid().describe(`Unique identifier for this security scan`),plugin:h({id:r().describe(`Plugin identifier`),version:r().describe(`Plugin version that was scanned`)}).describe(`Plugin that was scanned`),scannedAt:r().datetime().describe(`ISO 8601 timestamp when the scan was performed`),scanner:h({name:r().describe(`Scanner name (e.g., snyk, osv, trivy)`),version:r().describe(`Version of the scanner tool`)}).describe(`Information about the scanner tool used`),status:E([`passed`,`failed`,`warning`]).describe(`Overall result status of the security scan`),vulnerabilities:C(kMe).describe(`List of vulnerabilities discovered during the scan`),summary:h({critical:P().int().min(0).default(0).describe(`Count of critical severity vulnerabilities`),high:P().int().min(0).default(0).describe(`Count of high severity vulnerabilities`),medium:P().int().min(0).default(0).describe(`Count of medium severity vulnerabilities`),low:P().int().min(0).default(0).describe(`Count of low severity vulnerabilities`),info:P().int().min(0).default(0).describe(`Count of informational severity vulnerabilities`),total:P().int().min(0).default(0).describe(`Total count of all vulnerabilities`)}).describe(`Summary counts of vulnerabilities by severity`),licenseIssues:C(h({package:r().describe(`Name of the package with a license issue`),license:r().describe(`License identifier of the package`),reason:r().describe(`Reason the license is flagged`),severity:E([`error`,`warning`,`info`]).describe(`Severity of the license compliance issue`)})).default([]).describe(`License compliance issues found during the scan`),codeQuality:h({score:P().min(0).max(100).optional().describe(`Overall code quality score from 0 to 100`),issues:C(h({type:E([`security`,`quality`,`style`]).describe(`Category of the code quality issue`),severity:E([`error`,`warning`,`info`]).describe(`Severity of the code quality issue`),message:r().describe(`Description of the code quality issue`),file:r().optional().describe(`File path where the issue was found`),line:P().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:r().datetime().optional().describe(`ISO 8601 timestamp for the next scheduled scan`)}).describe(`Result of a security scan performed on a plugin`),h({id:r().describe(`Unique identifier for the security policy`),name:r().describe(`Human-readable name of the security policy`),autoScan:h({enabled:S().default(!0).describe(`Whether automatic scanning is enabled`),frequency:E([`on-publish`,`daily`,`weekly`,`monthly`]).default(`daily`).describe(`How often automatic scans are performed`)}).describe(`Automatic security scanning configuration`),thresholds:h({maxCritical:P().int().min(0).default(0).describe(`Maximum allowed critical vulnerabilities before blocking`),maxHigh:P().int().min(0).default(0).describe(`Maximum allowed high vulnerabilities before blocking`),maxMedium:P().int().min(0).default(5).describe(`Maximum allowed medium vulnerabilities before warning`)}).describe(`Vulnerability count thresholds for policy enforcement`),allowedLicenses:C(r()).default([`MIT`,`Apache-2.0`,`BSD-3-Clause`,`BSD-2-Clause`,`ISC`]).describe(`List of SPDX license identifiers that are permitted`),prohibitedLicenses:C(r()).default([`GPL-3.0`,`AGPL-3.0`]).describe(`List of SPDX license identifiers that are prohibited`),codeSigning:h({required:S().default(!1).describe(`Whether code signing is required for plugins`),allowedSigners:C(r()).default([]).describe(`List of trusted signer identities`)}).optional().describe(`Code signing requirements for plugin artifacts`),sandbox:h({networkAccess:E([`none`,`localhost`,`allowlist`,`all`]).default(`all`).describe(`Level of network access granted to the plugin`),allowedDestinations:C(r()).default([]).describe(`Permitted network destinations when using allowlist mode`),filesystemAccess:E([`none`,`read-only`,`temp-only`,`full`]).default(`full`).describe(`Level of file system access granted to the plugin`),maxMemoryMB:P().int().positive().optional().describe(`Maximum memory allocation in megabytes`),maxCPUSeconds:P().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 AMe=h({name:r().describe(`Package name or identifier`),versionConstraint:r().describe("Semver range (e.g., `^1.0.0`, `>=2.0.0 <3.0.0`)"),type:E([`required`,`optional`,`peer`,`dev`]).default(`required`).describe(`Category of the dependency relationship`),resolvedVersion:r().optional().describe(`Concrete version resolved during dependency resolution`)}).describe(`A package dependency with its version constraint`),jMe=h({id:r().describe(`Unique identifier of the package`),version:r().describe(`Resolved version of the package`),dependencies:C(AMe).default([]).describe(`Dependencies required by this package`),depth:P().int().min(0).describe(`Depth level in the dependency tree (0 = root)`),isDirect:S().describe(`Whether this is a direct (top-level) dependency`),metadata:h({name:r().describe(`Display name of the package`),description:r().optional().describe(`Short description of the package`),license:r().optional().describe(`SPDX license identifier of the package`),homepage:r().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`),MMe=h({root:h({id:r().describe(`Identifier of the root package`),version:r().describe(`Version of the root package`)}).describe(`Root package of the dependency graph`),nodes:C(jMe).describe(`All resolved package nodes in the dependency graph`),edges:C(h({from:r().describe(`Package ID`),to:r().describe(`Package ID`),constraint:r().describe(`Version constraint`)})).describe(`Directed edges representing dependency relationships`),stats:h({totalDependencies:P().int().min(0).describe(`Total number of resolved dependencies`),directDependencies:P().int().min(0).describe(`Number of direct (top-level) dependencies`),maxDepth:P().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`),NMe=h({package:r().describe(`Name of the package with conflicting version requirements`),conflicts:C(h({version:r().describe(`Conflicting version of the package`),requestedBy:C(r()).describe(`Packages that require this version`),constraint:r().describe(`Semver constraint that produced this version requirement`)})).describe(`List of conflicting version requirements`),resolution:h({strategy:E([`pick-highest`,`pick-lowest`,`manual`]).describe(`Strategy used to resolve the conflict`),version:r().optional().describe(`Resolved version selected by the strategy`),reason:r().optional().describe(`Explanation of why this resolution was chosen`)}).optional().describe(`Suggested resolution for the conflict`),severity:E([`error`,`warning`,`info`]).describe(`Severity level of the dependency conflict`)}).describe(`A detected conflict between dependency version requirements`);h({status:E([`success`,`conflict`,`error`]).describe(`Overall status of the dependency resolution`),graph:MMe.optional().describe(`Resolved dependency graph if resolution succeeded`),conflicts:C(NMe).default([]).describe(`List of dependency conflicts detected during resolution`),errors:C(h({package:r().describe(`Name of the package that caused the error`),error:r().describe(`Error message describing what went wrong`)})).default([]).describe(`Errors encountered during dependency resolution`),installOrder:C(r()).default([]).describe(`Topologically sorted list of package IDs for installation`),resolvedIn:P().int().min(0).optional().describe(`Time taken to resolve dependencies in milliseconds`)}).describe(`Result of a dependency resolution process`);var PMe=h({name:r().describe(`Name of the software component`),version:r().describe(`Version of the software component`),purl:r().optional().describe(`Package URL identifier`),license:r().optional().describe(`SPDX license identifier of the component`),hashes:h({sha256:r().optional().describe(`SHA-256 hash of the component artifact`),sha512:r().optional().describe(`SHA-512 hash of the component artifact`)}).optional().describe(`Cryptographic hashes for integrity verification`),supplier:h({name:r().describe(`Name of the component supplier`),url:r().url().optional().describe(`URL of the component supplier`)}).optional().describe(`Supplier information for the component`),externalRefs:C(h({type:E([`website`,`repository`,`documentation`,`issue-tracker`]).describe(`Type of external reference`),url:r().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`);h({format:E([`spdx`,`cyclonedx`]).default(`cyclonedx`).describe(`SBOM standard format used`),version:r().describe(`Version of the SBOM specification`),plugin:h({id:r().describe(`Plugin identifier`),version:r().describe(`Plugin version`),name:r().describe(`Human-readable plugin name`)}).describe(`Metadata about the plugin this SBOM describes`),components:C(PMe).describe(`List of software components included in the plugin`),generatedAt:r().datetime().describe(`ISO 8601 timestamp when the SBOM was generated`),generator:h({name:r().describe(`Name of the SBOM generator tool`),version:r().describe(`Version of the SBOM generator tool`)}).optional().describe(`Tool used to generate this SBOM`)}).describe(`Software Bill of Materials for a plugin`),h({pluginId:r().describe(`Unique identifier of the plugin`),version:r().describe(`Version of the plugin artifact`),build:h({timestamp:r().datetime().describe(`ISO 8601 timestamp when the build was produced`),environment:h({os:r().describe(`Operating system used for the build`),arch:r().describe(`CPU architecture used for the build`),nodeVersion:r().describe(`Node.js version used for the build`)}).optional().describe(`Environment details where the build was executed`),source:h({repository:r().url().describe(`URL of the source repository`),commit:r().regex(/^[a-f0-9]{40}$/).describe(`Full SHA-1 commit hash of the source`),branch:r().optional().describe(`Branch name the build was produced from`),tag:r().optional().describe(`Git tag associated with the build`)}).optional().describe(`Source repository information for the build`),builder:h({name:r().describe(`Name of the person or system that produced the build`),email:r().email().optional().describe(`Email address of the builder`)}).optional().describe(`Identity of the builder who produced the artifact`)}).describe(`Build provenance information`),artifacts:C(h({filename:r().describe(`Name of the artifact file`),sha256:r().describe(`SHA-256 hash of the artifact`),size:P().int().positive().describe(`Size of the artifact in bytes`)})).describe(`List of build artifacts with integrity hashes`),signatures:C(h({algorithm:E([`rsa`,`ecdsa`,`ed25519`]).describe(`Cryptographic algorithm used for signing`),publicKey:r().describe(`Public key used to verify the signature`),signature:r().describe(`Digital signature value`),signedBy:r().describe(`Identity of the signer`),timestamp:r().datetime().describe(`ISO 8601 timestamp when the signature was created`)})).default([]).describe(`Cryptographic signatures for the plugin artifact`),attestations:C(h({type:E([`code-review`,`security-scan`,`test-results`,`ci-build`]).describe(`Type of attestation`),status:E([`passed`,`failed`]).describe(`Result status of the attestation`),url:r().url().optional().describe(`URL with details about the attestation`),timestamp:r().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`),h({pluginId:r().describe(`Unique identifier of the plugin`),score:P().min(0).max(100).describe(`Overall trust score from 0 to 100`),components:h({vendorReputation:P().min(0).max(100).describe(`Vendor reputation score from 0 to 100`),securityScore:P().min(0).max(100).describe(`Security scan results score from 0 to 100`),codeQuality:P().min(0).max(100).describe(`Code quality score from 0 to 100`),communityScore:P().min(0).max(100).describe(`Community engagement score from 0 to 100`),maintenanceScore:P().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:E([`verified`,`trusted`,`neutral`,`untrusted`,`blocked`]).describe(`Computed trust level based on the overall score`),badges:C(E([`official`,`verified-vendor`,`security-scanned`,`code-signed`,`open-source`,`popular`])).default([]).describe(`Verification badges earned by the plugin`),updatedAt:r().datetime().describe(`ISO 8601 timestamp when the trust score was last updated`)}).describe(`Trust score and verification status for a plugin`);var FMe=h({userId:r().optional(),tenantId:r().optional(),roles:C(r()).default([]),permissions:C(r()).default([]),isSystem:S().default(!1),accessToken:r().optional(),transaction:u().optional(),traceId:r().optional()});h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var Y=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),r0=h({ariaLabel:Y.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var IMe=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),LMe=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:IMe.optional().describe(`Default number formatting rules`),dateFormat:LMe.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var i0=E(`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(`.`)),a0=h({field:r().describe(`Data field key`),title:Y.optional().describe(`Axis display title`),format:r().optional().describe(`Value format string (e.g., "$0,0.00")`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),stepSize:P().optional().describe(`Step size for ticks`),showGridLines:S().default(!0),position:E([`left`,`right`,`top`,`bottom`]).optional().describe(`Axis position`),logarithmic:S().default(!1)}),RMe=h({name:r().describe(`Field name or series identifier`),label:Y.optional().describe(`Series display label`),type:i0.optional().describe(`Override chart type for this series`),color:r().optional().describe(`Series color (hex/rgb/token)`),stack:r().optional().describe(`Stack identifier to group series`),yAxis:E([`left`,`right`]).default(`left`).describe(`Bind to specific Y-Axis`)}),zMe=h({type:E([`line`,`region`]).default(`line`),axis:E([`x`,`y`]).default(`y`),value:l([P(),r()]).describe(`Start value`),endValue:l([P(),r()]).optional().describe(`End value for regions`),color:r().optional(),label:Y.optional(),style:E([`solid`,`dashed`,`dotted`]).default(`dashed`)}),BMe=h({tooltips:S().default(!0),zoom:S().default(!1),brush:S().default(!1),clickAction:r().optional().describe(`Action ID to trigger on click`)}),o0=h({type:i0,title:Y.optional().describe(`Chart title`),subtitle:Y.optional().describe(`Chart subtitle`),description:Y.optional().describe(`Accessibility description`),xAxis:a0.optional().describe(`X-Axis configuration`),yAxis:C(a0).optional().describe(`Y-Axis configuration (support dual axis)`),series:C(RMe).optional().describe(`Defined series configuration`),colors:C(r()).optional().describe(`Color palette`),height:P().optional().describe(`Fixed height in pixels`),showLegend:S().default(!0).describe(`Display legend`),showDataLabels:S().default(!1).describe(`Display data labels`),annotations:C(zMe).optional(),interaction:BMe.optional(),aria:r0.optional().describe(`ARIA accessibility attributes`)}),s0=E([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),VMe=h({xs:P().min(1).max(12).optional(),sm:P().min(1).max(12).optional(),md:P().min(1).max(12).optional(),lg:P().min(1).max(12).optional(),xl:P().min(1).max(12).optional(),"2xl":P().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`),HMe=h({xs:P().optional(),sm:P().optional(),md:P().optional(),lg:P().optional(),xl:P().optional(),"2xl":P().optional()}).describe(`Display order per breakpoint`),c0=h({breakpoint:s0.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:C(s0).optional().describe(`Hide on these breakpoints`),columns:VMe.optional().describe(`Grid columns per breakpoint`),order:HMe.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`),l0=h({lazyLoad:S().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:h({enabled:S().default(!1).describe(`Enable virtual scrolling`),itemHeight:P().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:P().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:E([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:S().optional().describe(`Prefetch data before component is visible`),pageSize:P().optional().describe(`Number of items per page for pagination`),debounceMs:P().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`),UMe=r().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)`),u0=r().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)`);r().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 d0=h({enabled:S().default(!1).describe(`Enable public sharing`),publicLink:r().optional().describe(`Generated public share URL`),password:r().optional().describe(`Password required to access shared link`),allowedDomains:C(r()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:r().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:S().optional().default(!1).describe(`Allow access without authentication`)}),WMe=h({enabled:S().default(!1).describe(`Enable iframe embedding`),allowedOrigins:C(r()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:r().optional().default(`100%`).describe(`Embed width (CSS value)`),height:r().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:S().optional().default(!0).describe(`Show interface header in embed`),showNavigation:S().optional().default(!1).describe(`Show navigation in embed`),responsive:S().optional().default(!0).describe(`Enable responsive resizing`)}),f0=h({id:u0.describe(`Unique identifier for this navigation item (lowercase snake_case)`),label:Y.describe(`Display proper label`),icon:r().optional().describe(`Icon name`),order:P().optional().describe(`Sort order within the same level (lower = first)`),badge:l([r(),P()]).optional().describe(`Badge text or count displayed on the item`),visible:r().optional().describe(`Visibility formula condition`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this item`)}),GMe=f0.extend({type:m(`object`),objectName:r().describe(`Target object name`),viewName:r().optional().describe(`Default list view to open. Defaults to "all"`)}),KMe=f0.extend({type:m(`dashboard`),dashboardName:r().describe(`Target dashboard name`)}),qMe=f0.extend({type:m(`page`),pageName:r().describe(`Target custom page component name`),params:d(r(),u()).optional().describe(`Parameters passed to the page context`)}),JMe=f0.extend({type:m(`url`),url:r().describe(`Target external URL`),target:E([`_self`,`_blank`]).default(`_self`).describe(`Link target window`)}),YMe=f0.extend({type:m(`report`),reportName:r().describe(`Target report name`)}),XMe=f0.extend({type:m(`action`),actionDef:h({actionName:r().describe(`Action machine name to execute`),params:d(r(),u()).optional().describe(`Parameters passed to the action`)}).describe(`Action definition to execute when clicked`)}),ZMe=f0.extend({type:m(`group`),expanded:S().default(!1).describe(`Default expansion state in sidebar`)}),p0=F(()=>l([GMe.extend({children:C(p0).optional().describe(`Child navigation items (e.g. specific views)`)}),KMe,qMe,JMe,YMe,XMe,ZMe.extend({children:C(p0).describe(`Child navigation items`)})])),QMe=h({primaryColor:r().optional().describe(`Primary theme color hex code`),logo:r().optional().describe(`Custom logo URL for this app`),favicon:r().optional().describe(`Custom favicon URL for this app`)}),$Me=h({id:u0.describe(`Unique area identifier (lowercase snake_case)`),label:Y.describe(`Area display label`),icon:r().optional().describe(`Area icon name`),order:P().optional().describe(`Sort order among areas (lower = first)`),description:Y.optional().describe(`Area description`),visible:r().optional().describe(`Visibility formula condition for this area`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this area`),navigation:C(p0).describe(`Navigation items within this area`)}),eNe=h({name:u0.describe(`App unique machine name (lowercase snake_case)`),label:Y.describe(`App display label`),version:r().optional().describe(`App version`),description:Y.optional().describe(`App description`),icon:r().optional().describe(`App icon used in the App Launcher`),branding:QMe.optional().describe(`App-specific branding`),active:S().optional().default(!0).describe(`Whether the app is enabled`),isDefault:S().optional().default(!1).describe(`Is default app`),navigation:C(p0).optional().describe(`Full navigation tree for the app sidebar`),areas:C($Me).optional().describe(`Navigation areas for partitioning navigation by business domain`),homePageId:r().optional().describe(`ID of the navigation item to serve as landing page`),requiredPermissions:C(r()).optional().describe(`Permissions required to access this app`),objects:C(u()).optional().describe(`Objects belonging to this app`),apis:C(u()).optional().describe(`Custom APIs belonging to this app`),sharing:d0.optional().describe(`Public sharing configuration`),embed:WMe.optional().describe(`Iframe embedding configuration`),mobileNavigation:h({mode:E([`drawer`,`bottom_nav`,`hamburger`]).default(`drawer`).describe(`Mobile navigation mode: drawer sidebar, bottom navigation bar, or hamburger menu`),bottomNavItems:C(r()).optional().describe(`Navigation item IDs to show in bottom nav (max 5)`)}).optional().describe(`Mobile-specific navigation configuration`),aria:r0.optional().describe(`ARIA accessibility attributes for the application`)}),tNe=E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),nNe=E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),m0=h({url:r().describe(`API endpoint URL`),method:nNe.optional().default(`GET`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),params:d(r(),u()).optional().describe(`Query parameters`),body:u().optional().describe(`Request body for POST/PUT/PATCH`)});h({enabled:S().default(!0).describe(`Enable CORS`),origins:l([r(),C(r())]).default(`*`).describe(`Allowed origins (* for all)`),methods:C(tNe).optional().describe(`Allowed HTTP methods`),credentials:S().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:P().int().optional().describe(`Preflight cache duration in seconds`)}),h({enabled:S().default(!1).describe(`Enable rate limiting`),windowMs:P().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:P().int().default(100).describe(`Max requests per window`)}),h({path:r().describe(`URL path to serve from`),directory:r().describe(`Physical directory to serve`),cacheControl:r().optional().describe(`Cache-Control header value`)});var h0=I(`provider`,[h({provider:m(`object`),object:r().describe(`Target object name`)}),h({provider:m(`api`),read:m0.optional().describe(`Configuration for fetching data`),write:m0.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),h({provider:m(`value`),items:C(u()).describe(`Static data array`)})]),g0=h({field:r().describe(`Field name to filter on`),operator:r().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`),rNe=E([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`),iNe=h({field:r().describe(`Field name (snake_case)`),label:Y.optional().describe(`Display label override`),width:P().positive().optional().describe(`Column width in pixels`),align:E([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:S().optional().describe(`Hide column by default`),sortable:S().optional().describe(`Allow sorting by this column`),resizable:S().optional().describe(`Allow resizing this column`),wrap:S().optional().describe(`Allow text wrapping`),type:r().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:E([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:rNe.optional().describe(`Footer aggregation function for this column`),link:S().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:r().optional().describe(`Registered Action ID to execute when clicked`)}),aNe=h({type:E([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)}),oNe=h({pageSize:P().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:C(P().int().positive()).optional().describe(`Available page size options`)}),sNe=E([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`),cNe=h({fields:C(h({field:r().describe(`Field name to group by`),order:E([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:S().default(!1).describe(`Collapse groups by default`)})).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`),lNe=h({coverField:r().optional().describe(`Attachment/image field to display as card cover`),coverFit:E([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:E([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:r().optional().describe(`Field to display as card title`),visibleFields:C(r()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`),uNe=h({startDateField:r().describe(`Field for timeline item start date`),endDateField:r().optional().describe(`Field for timeline item end date`),titleField:r().describe(`Field to display as timeline item title`),groupByField:r().optional().describe(`Field to group timeline rows`),colorField:r().optional().describe(`Field to determine item color`),scale:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`),dNe=h({type:E([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:r().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`),fNe=h({field:r().describe(`Field to derive color from (typically a select/status field)`),colors:d(r(),r()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`),pNe=E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`),_0=h({sort:S().default(!0).describe(`Allow users to sort records`),search:S().default(!0).describe(`Allow users to search records`),filter:S().default(!0).describe(`Allow users to filter records`),rowHeight:S().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:S().default(!1).describe(`Add records through a form instead of inline`),buttons:C(r()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`),v0=h({showDescription:S().default(!0).describe(`Show the view description text`),allowedVisualizations:C(pNe).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`),y0=h({name:u0.describe(`Tab identifier (snake_case)`),label:Y.optional().describe(`Display label`),icon:r().optional().describe(`Tab icon name`),view:r().optional().describe(`Referenced list view name from listViews`),filter:C(g0).optional().describe(`Tab-specific filter criteria`),order:P().int().min(0).optional().describe(`Tab display order`),pinned:S().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:S().default(!1).describe(`Set as the default active tab`),visible:S().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`),b0=h({enabled:S().default(!0).describe(`Show the add record entry point`),position:E([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:E([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:r().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`),mNe=h({groupByField:r().describe(`Field to group columns by (usually status/select)`),summarizeField:r().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:C(r()).describe(`Fields to show on cards`)}),hNe=h({startDateField:r(),endDateField:r().optional(),titleField:r(),colorField:r().optional()}),gNe=h({startDateField:r(),endDateField:r(),titleField:r(),progressField:r().optional(),dependenciesField:r().optional()}),_Ne=h({mode:E([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`]).default(`page`),view:r().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:S().default(!1).describe(`Disable standard navigation entirely`),openNewTab:S().default(!1).describe(`Force open in new tab (applies to page mode)`),width:l([r(),P()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)}),x0=h({name:u0.optional().describe(`Internal view name (lowercase snake_case)`),label:Y.optional(),type:E([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).default(`grid`),data:h0.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:l([C(r()),C(iNe)]).describe(`Fields to display as columns`),filter:C(g0).optional().describe(`Filter criteria (JSON Rules)`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional(),searchableFields:C(r()).optional().describe(`Fields enabled for search`),filterableFields:C(r()).optional().describe(`Fields enabled for end-user filtering in the top bar`),quickFilters:C(h({field:r().describe(`Field name to filter by`),label:r().optional().describe(`Display label for the chip`),operator:E([`equals`,`not_equals`,`contains`,`in`,`is_null`,`is_not_null`]).default(`equals`).describe(`Filter operator`),value:l([r(),P(),S(),x(),C(l([r(),P()]))]).optional().describe(`Preset filter value`)})).optional().describe(`One-click filter chips for quick record filtering`),resizable:S().optional().describe(`Enable column resizing`),striped:S().optional().describe(`Striped row styling`),bordered:S().optional().describe(`Show borders`),selection:aNe.optional().describe(`Row selection configuration`),navigation:_Ne.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:oNe.optional().describe(`Pagination configuration`),kanban:mNe.optional(),calendar:hNe.optional(),gantt:gNe.optional(),gallery:lNe.optional(),timeline:uNe.optional(),description:Y.optional().describe(`View description for documentation/tooltips`),sharing:dNe.optional().describe(`View sharing and access configuration`),rowHeight:sNe.optional().describe(`Row height / density setting`),grouping:cNe.optional().describe(`Group records by one or more fields`),rowColor:fNe.optional().describe(`Color rows based on field value`),hiddenFields:C(r()).optional().describe(`Fields to hide in this specific view`),fieldOrder:C(r()).optional().describe(`Explicit field display order for this view`),rowActions:C(r()).optional().describe(`Actions available for individual row items`),bulkActions:C(r()).optional().describe(`Actions available when multiple rows are selected`),virtualScroll:S().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:C(h({condition:r().describe(`Condition expression to evaluate`),style:d(r(),r()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:S().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:C(E([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:_0.optional().describe(`User action toggles for the view toolbar`),appearance:v0.optional().describe(`Appearance and visualization configuration`),tabs:C(y0).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:b0.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at the bottom of the list`),allowPrinting:S().optional().describe(`Allow users to print the view`),emptyState:h({title:Y.optional(),message:Y.optional(),icon:r().optional()}).optional().describe(`Empty state configuration when no records found`),aria:r0.optional().describe(`ARIA accessibility attributes for the list view`),responsive:c0.optional().describe(`Responsive layout configuration`),performance:l0.optional().describe(`Performance optimization settings`)}),vNe=h({field:r().describe(`Field name (snake_case)`),label:Y.optional().describe(`Display label override`),placeholder:Y.optional().describe(`Placeholder text`),helpText:Y.optional().describe(`Help/hint text`),readonly:S().optional().describe(`Read-only override`),required:S().optional().describe(`Required override`),hidden:S().optional().describe(`Hidden override`),colSpan:P().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:r().optional().describe(`Custom widget/component name`),dependsOn:r().optional().describe(`Parent field name for cascading`),visibleOn:r().optional().describe(`Visibility condition expression`)}),S0=h({label:Y.optional(),collapsible:S().default(!1),collapsed:S().default(!1),columns:E([`1`,`2`,`3`,`4`]).default(`2`).transform(e=>parseInt(e)),fields:C(l([r(),vNe]))}),C0=h({type:E([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:h0.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:C(S0).optional(),groups:C(S0).optional(),defaultSort:C(h({field:r().describe(`Field name to sort by`),order:E([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:d0.optional().describe(`Public sharing configuration for this form`),aria:r0.optional().describe(`ARIA accessibility attributes for the form view`)});h({list:x0.optional(),form:C0.optional(),listViews:d(r(),x0).optional().describe(`Additional named list views`),formViews:d(r(),C0).optional().describe(`Additional named form views`)});var w0=h({$field:r().describe(`Field Reference/Column Name`)});h({$eq:D().optional(),$ne:D().optional()}),h({$gt:l([P(),N(),w0]).optional(),$gte:l([P(),N(),w0]).optional(),$lt:l([P(),N(),w0]).optional(),$lte:l([P(),N(),w0]).optional()}),h({$in:C(D()).optional(),$nin:C(D()).optional()}),h({$between:w([l([P(),N(),w0]),l([P(),N(),w0])]).optional()}),h({$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional()}),h({$null:S().optional(),$exists:S().optional()});var T0=h({$eq:D().optional(),$ne:D().optional(),$gt:l([P(),N(),w0]).optional(),$gte:l([P(),N(),w0]).optional(),$lt:l([P(),N(),w0]).optional(),$lte:l([P(),N(),w0]).optional(),$in:C(D()).optional(),$nin:C(D()).optional(),$between:w([l([P(),N(),w0]),l([P(),N(),w0])]).optional(),$contains:r().optional(),$notContains:r().optional(),$startsWith:r().optional(),$endsWith:r().optional(),$null:S().optional(),$exists:S().optional()}),E0=F(()=>d(r(),u()).and(h({$and:C(E0).optional(),$or:C(E0).optional(),$not:E0.optional()})));h({where:E0.optional()});var D0=F(()=>h({$and:C(l([d(r(),T0),D0])).optional(),$or:C(l([d(r(),T0),D0])).optional(),$not:l([d(r(),T0),D0]).optional()})),yNe=E([`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`]).describe(`Widget color variant`),O0=E([`script`,`url`,`modal`,`flow`,`api`]).describe(`Widget action type`),bNe=h({label:Y.describe(`Action button label`),actionUrl:r().describe(`URL or target for the action`),actionType:O0.optional().describe(`Type of action`),icon:r().optional().describe(`Icon identifier for the action button`)}).describe(`Dashboard header action`),xNe=h({showTitle:S().default(!0).describe(`Show dashboard title in header`),showDescription:S().default(!0).describe(`Show dashboard description in header`),actions:C(bNe).optional().describe(`Header action buttons`)}).describe(`Dashboard header configuration`),SNe=h({valueField:r().describe(`Field to aggregate`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).default(`count`).describe(`Aggregate function`),label:Y.optional().describe(`Measure display label`),format:r().optional().describe(`Number format string`)}).describe(`Widget measure definition`),CNe=h({id:u0.describe(`Unique widget identifier (snake_case)`),title:Y.optional().describe(`Widget title`),description:Y.optional().describe(`Widget description text below the header`),type:i0.default(`metric`).describe(`Visualization type`),chartConfig:o0.optional().describe(`Chart visualization configuration`),colorVariant:yNe.optional().describe(`Widget color variant for theming`),actionUrl:r().optional().describe(`URL or target for the widget action button`),actionType:O0.optional().describe(`Type of action for the widget action button`),actionIcon:r().optional().describe(`Icon identifier for the widget action button`),object:r().optional().describe(`Data source object name`),filter:E0.optional().describe(`Data filter criteria`),categoryField:r().optional().describe(`Field for grouping (X-Axis)`),valueField:r().optional().describe(`Field for values (Y-Axis)`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).optional().default(`count`).describe(`Aggregate function`),measures:C(SNe).optional().describe(`Multiple measures for pivot/matrix analysis`),layout:h({x:P(),y:P(),w:P(),h:P()}).describe(`Grid layout position`),options:u().optional().describe(`Widget specific configuration`),responsive:c0.optional().describe(`Responsive layout configuration`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),wNe=h({object:r().describe(`Source object name`),valueField:r().describe(`Field to use as option value`),labelField:r().describe(`Field to use as option label`),filter:E0.optional().describe(`Filter to apply to source object`)}).describe(`Dynamic filter options from object`),TNe=h({field:r().describe(`Field name to filter on`),label:Y.optional().describe(`Display label for the filter`),type:E([`text`,`select`,`date`,`number`,`lookup`]).optional().describe(`Filter input type`),options:C(h({value:l([r(),P(),S()]).describe(`Option value`),label:Y})).optional().describe(`Static filter options`),optionsFrom:wNe.optional().describe(`Dynamic filter options from object`),defaultValue:l([r(),P(),S()]).optional().describe(`Default filter value`),scope:E([`dashboard`,`widget`]).default(`dashboard`).describe(`Filter application scope`),targetWidgets:C(r()).optional().describe(`Widget IDs to apply this filter to`)});h({name:u0.describe(`Dashboard unique name`),label:Y.describe(`Dashboard label`),description:Y.optional().describe(`Dashboard description`),header:xNe.optional().describe(`Dashboard header configuration`),widgets:C(CNe).describe(`Widgets to display`),refreshInterval:P().optional().describe(`Auto-refresh interval in seconds`),dateRange:h({field:r().optional().describe(`Default date field name for time-based filtering`),defaultRange:E([`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:S().default(!0).describe(`Allow users to pick a custom date range`)}).optional().describe(`Global dashboard date range filter configuration`),globalFilters:C(TNe).optional().describe(`Global filters that apply to all widgets in the dashboard`),aria:r0.optional().describe(`ARIA accessibility attributes`),performance:l0.optional().describe(`Performance optimization settings`)});var ENe=E([`tabular`,`summary`,`matrix`,`joined`]),DNe=h({field:r().describe(`Field name`),label:Y.optional().describe(`Override label`),aggregate:E([`sum`,`avg`,`max`,`min`,`count`,`unique`]).optional().describe(`Aggregation function`),responsive:c0.optional().describe(`Responsive visibility for this column`)}),k0=h({field:r().describe(`Field to group by`),sortOrder:E([`asc`,`desc`]).default(`asc`),dateGranularity:E([`day`,`week`,`month`,`quarter`,`year`]).optional().describe(`For date fields`)}),ONe=o0.extend({xAxis:r().describe(`Grouping field for X-Axis`),yAxis:r().describe(`Summary field for Y-Axis`),groupBy:r().optional().describe(`Additional grouping field`)});h({name:u0.describe(`Report unique name`),label:Y.describe(`Report label`),description:Y.optional(),objectName:r().describe(`Primary object`),type:ENe.default(`tabular`).describe(`Report format type`),columns:C(DNe).describe(`Columns to display`),groupingsDown:C(k0).optional().describe(`Row groupings`),groupingsAcross:C(k0).optional().describe(`Column groupings (Matrix only)`),filter:E0.optional().describe(`Filter criteria`),chart:ONe.optional().describe(`Embedded chart configuration`),aria:r0.optional().describe(`ARIA accessibility attributes`),performance:l0.optional().describe(`Performance optimization settings`)});var kNe=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),ANe=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),jNe=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),A0=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:kNe.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:ANe.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:jNe.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:A0.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var MNe=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),j0=h({field:r().describe(`Field name to apply masking to`),strategy:MNe.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(j0).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var M0=E(`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(`.`)),NNe=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:UMe.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var PNe=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var FNe=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),INe=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),LNe=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),RNe=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),zNe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:M0.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(NNe).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:PNe.optional().describe(`Configuration for currency field type`),vectorConfig:FNe.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:INe.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:A0.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:j0.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:RNe.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:LNe.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),BNe=h({name:r(),label:Y,type:M0,required:S().default(!1),options:C(h({label:Y,value:r()})).optional()}),N0=E([`script`,`url`,`modal`,`flow`,`api`]),VNe=new Set(N0.options.filter(e=>e!==`script`));h({name:u0.describe(`Machine name (lowercase snake_case)`),label:Y.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:N0.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(BNe).optional().describe(`Input parameters required from user`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:Y.optional().describe(`Confirmation message before execution`),successMessage:Y.optional().describe(`Success message to show after execution`),refreshAfter:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:r0.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(VNe.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),E([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var HNe=E([`asc`,`desc`]).describe(`Sort order direction`),P0=h({field:r().describe(`Field name to sort by`),order:HNe.describe(`Sort direction`)}).describe(`Sort field and direction pair`);E([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`),E([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`),E([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var UNe=h({name:r().describe(`Region name (e.g. "sidebar", "main", "header")`),width:E([`small`,`medium`,`large`,`full`]).optional(),components:C(F(()=>KNe)).describe(`Components in this region`)}),WNe=E(`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(`.`)),GNe=h({object:r().describe(`Object to query`),view:r().optional().describe(`Named view to apply`),filter:E0.optional().describe(`Additional filter criteria`),sort:C(P0).optional().describe(`Sort order`),limit:P().int().positive().optional().describe(`Max records to display`)}),KNe=h({type:l([WNe,r()]).describe(`Component Type (Standard enum or custom string)`),id:r().optional().describe(`Unique instance ID`),label:Y.optional(),properties:d(r(),u()).describe(`Component props passed to the widget. See component.zod.ts for schemas.`),events:d(r(),r()).optional().describe(`Event handlers map`),style:d(r(),r()).optional().describe(`Inline styles or utility classes`),className:r().optional().describe(`CSS class names`),visibility:r().optional().describe(`Visibility filter/formula`),dataSource:GNe.optional().describe(`Per-element data binding for multi-object pages`),responsive:c0.optional().describe(`Responsive layout configuration`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),qNe=h({name:r().describe(`Variable name`),type:E([`string`,`number`,`boolean`,`object`,`array`,`record_id`]).default(`string`),defaultValue:u().optional(),source:r().optional().describe(`Component ID that writes to this variable`)}),JNe=h({componentId:r().describe(`Reference to a PageComponent.id in the page`),x:P().int().min(0).describe(`Grid column position (0-based)`),y:P().int().min(0).describe(`Grid row position (0-based)`),width:P().int().min(1).describe(`Width in grid columns`),height:P().int().min(1).describe(`Height in grid rows`)}),YNe=h({columns:P().int().min(1).default(12).describe(`Number of grid columns`),rowHeight:P().int().min(1).default(40).describe(`Height of each grid row in pixels`),gap:P().int().min(0).default(8).describe(`Gap between grid items in pixels`),items:C(JNe).describe(`Positioned components on the canvas`)}),XNe=E([`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`),ZNe=h({object:r().describe(`Target object for review`),filter:E0.optional().describe(`Filter criteria for review queue`),sort:C(P0).optional().describe(`Sort order for review queue`),displayFields:C(r()).optional().describe(`Fields to display on the review page`),actions:C(h({label:r().describe(`Action button label`),type:E([`approve`,`reject`,`skip`,`custom`]).describe(`Action type`),field:r().optional().describe(`Field to update on action`),value:l([r(),P(),S()]).optional().describe(`Value to set on action`),nextRecord:S().optional().default(!0).describe(`Auto-advance to next record after action`)})).describe(`Review actions`),navigation:E([`sequential`,`random`,`filtered`]).optional().default(`sequential`).describe(`Record navigation mode`),showProgress:S().optional().default(!0).describe(`Show review progress indicator`)}),QNe=h({source:r().optional().describe(`Source object name for the page`),levels:P().int().min(1).optional().describe(`Number of hierarchy levels to display`),filterBy:C(g0).optional().describe(`Page-level filter criteria`),appearance:v0.optional().describe(`Appearance and visualization configuration`),userFilters:h({elements:C(E([`grid`,`gallery`,`kanban`])).optional().describe(`Visualization element types available in user filter bar`),tabs:C(y0).optional().describe(`User-configurable tabs`)}).optional().describe(`User filter configuration`),userActions:_0.optional().describe(`User action toggles`),addRecord:b0.optional().describe(`Add record entry point configuration`),showRecordCount:S().optional().describe(`Show record count at page bottom`),allowPrinting:S().optional().describe(`Allow users to print the page`)}).describe(`Interface-level page configuration (Airtable parity)`);h({name:u0.describe(`Page unique name (lowercase snake_case)`),label:Y,description:Y.optional(),icon:r().optional().describe(`Page icon name`),type:XNe.default(`record`).describe(`Page type`),variables:C(qNe).optional().describe(`Local page state variables`),object:r().optional().describe(`Bound object (for Record pages)`),recordReview:ZNe.optional().describe(`Record review configuration (required when type is "record_review")`),blankLayout:YNe.optional().describe(`Free-form grid layout for blank pages (used when type is "blank")`),template:r().default(`default`).describe(`Layout template name (e.g. "header-sidebar-main")`),regions:C(UNe).describe(`Defined regions with components`),isDefault:S().default(!1),assignedProfiles:C(r()).optional(),interfaceConfig:QNe.optional().describe(`Interface-level page configuration (for Airtable-style interface pages)`),aria:r0.optional().describe(`ARIA accessibility attributes`)}).superRefine((e,t)=>{e.type===`record_review`&&!e.recordReview&&t.addIssue({code:de.custom,path:[`recordReview`],message:`recordReview is required when type is "record_review"`}),e.type===`blank`&&!e.blankLayout&&t.addIssue({code:de.custom,path:[`blankLayout`],message:`blankLayout is required when type is "blank"`})});var $Ne=h({onMount:r().optional().describe(`Initialization code when widget mounts`),onUpdate:r().optional().describe(`Code to run when props change`),onUnmount:r().optional().describe(`Cleanup code when widget unmounts`),onValidate:r().optional().describe(`Custom validation logic`),onFocus:r().optional().describe(`Code to run on focus`),onBlur:r().optional().describe(`Code to run on blur`),onError:r().optional().describe(`Error handling code`)}),ePe=h({name:r().describe(`Event name`),label:Y.optional().describe(`Human-readable event label`),description:Y.optional().describe(`Event description and usage`),bubbles:S().default(!1).describe(`Whether event bubbles`),cancelable:S().default(!1).describe(`Whether event is cancelable`),payload:d(r(),u()).optional().describe(`Event payload schema`)}),tPe=h({name:r().describe(`Property name (camelCase)`),label:Y.optional().describe(`Human-readable label`),type:E([`string`,`number`,`boolean`,`array`,`object`,`function`,`any`]).describe(`TypeScript type`),required:S().default(!1).describe(`Whether property is required`),default:u().optional().describe(`Default value`),description:Y.optional().describe(`Property description`),validation:d(r(),u()).optional().describe(`Validation rules`),category:r().optional().describe(`Property category`)}),nPe=I(`type`,[h({type:m(`npm`),packageName:r().describe(`NPM package name`),version:r().default(`latest`),exportName:r().optional().describe(`Named export (default: default)`)}),h({type:m(`remote`),url:r().url().describe(`Remote entry URL (.js)`),moduleName:r().describe(`Exposed module name`),scope:r().describe(`Remote scope name`)}),h({type:m(`inline`),code:r().describe(`JavaScript code body`)})]);h({name:u0.describe(`Widget identifier (snake_case)`),label:Y.describe(`Widget display name`),description:Y.optional().describe(`Widget description`),version:r().optional().describe(`Widget version (semver)`),author:r().optional().describe(`Widget author`),icon:r().optional().describe(`Widget icon`),fieldTypes:C(r()).optional().describe(`Supported field types`),category:E([`input`,`display`,`picker`,`editor`,`custom`]).default(`custom`).describe(`Widget category`),lifecycle:$Ne.optional().describe(`Lifecycle hooks`),events:C(ePe).optional().describe(`Custom events`),properties:C(tPe).optional().describe(`Configuration properties`),implementation:nPe.optional().describe(`Widget implementation source`),dependencies:C(h({name:r(),version:r().optional(),url:r().url().optional()})).optional().describe(`Widget dependencies`),screenshots:C(r().url()).optional().describe(`Screenshot URLs`),documentation:r().url().optional().describe(`Documentation URL`),license:r().optional().describe(`License (SPDX identifier)`),tags:C(r()).optional().describe(`Tags for categorization`),aria:r0.optional().describe(`ARIA accessibility attributes`),performance:l0.optional().describe(`Performance optimization settings`)}),h({value:u().describe(`Current field value`),onChange:M().input(w([u()])).output(te()).describe(`Callback to update field value`),readonly:S().default(!1).describe(`Read-only mode flag`),required:S().default(!1).describe(`Required field flag`),error:r().optional().describe(`Validation error message`),field:zNe.describe(`Field schema definition`),record:d(r(),u()).optional().describe(`Complete record data`),options:d(r(),u()).optional().describe(`Custom widget options`)});var F0=E([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),rPe=h({type:E([`user`,`team`,`record`]).describe(`Mention target type`),id:r().describe(`Target ID`),name:r().describe(`Display name for rendering`),offset:P().int().min(0).describe(`Character offset in body text`),length:P().int().min(1).describe(`Length of mention token in body text`)}),iPe=h({field:r().describe(`Field machine name`),fieldLabel:r().optional().describe(`Field display label`),oldValue:u().optional().describe(`Previous value`),newValue:u().optional().describe(`New value`),oldDisplayValue:r().optional().describe(`Human-readable old value`),newDisplayValue:r().optional().describe(`Human-readable new value`)}),aPe=h({emoji:r().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:C(r()).describe(`Users who reacted`),count:P().int().min(1).describe(`Total reaction count`)}),oPe=h({type:E([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:r().describe(`Actor ID`),name:r().optional().describe(`Actor display name`),avatarUrl:r().url().optional().describe(`Actor avatar URL`),source:r().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)}),sPe=E([`public`,`internal`,`private`]);h({id:r().describe(`Feed item ID`),type:F0.describe(`Activity type`),object:r().describe(`Object name (e.g., "account")`),recordId:r().describe(`Record ID this feed item belongs to`),actor:oPe.describe(`Who performed this action`),body:r().optional().describe(`Rich text body (Markdown supported)`),mentions:C(rPe).optional().describe(`Mentioned users/teams/records`),changes:C(iPe).optional().describe(`Field-level changes`),reactions:C(aPe).optional().describe(`Emoji reactions on this item`),parentId:r().optional().describe(`Parent feed item ID for threaded replies`),replyCount:P().int().min(0).default(0).describe(`Number of replies`),pinned:S().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:r().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:r().optional().describe(`User ID who pinned the item`),starred:S().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:r().datetime().optional().describe(`Timestamp when the item was starred`),visibility:sPe.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:r().datetime().describe(`Creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),editedAt:r().datetime().optional().describe(`When comment was last edited`),isEdited:S().default(!1).describe(`Whether comment has been edited`)});var cPe=E([`all`,`comments_only`,`changes_only`,`tasks_only`]);h({}),h({title:Y.describe(`Page title`),subtitle:Y.optional().describe(`Page subtitle`),icon:r().optional().describe(`Icon name`),breadcrumb:S().default(!0).describe(`Show breadcrumb`),actions:C(r()).optional().describe(`Action IDs to show in header`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({type:E([`line`,`card`,`pill`]).default(`line`),position:E([`top`,`left`]).default(`top`),items:C(h({label:Y,icon:r().optional(),children:C(u()).describe(`Child components`)})),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({title:Y.optional(),bordered:S().default(!0),actions:C(r()).optional(),body:C(u()).optional().describe(`Card content components (slot)`),footer:C(u()).optional().describe(`Card footer components (slot)`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({columns:E([`1`,`2`,`3`,`4`]).default(`2`).describe(`Number of columns for field layout (1-4)`),layout:E([`auto`,`custom`]).default(`auto`).describe(`Layout mode: auto uses object compactLayout, custom uses explicit sections`),sections:C(r()).optional().describe(`Section IDs to show (required when layout is "custom")`),fields:C(r()).optional().describe(`Explicit field list to display (optional, overrides compactLayout)`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({objectName:r().describe(`Related object name (e.g., "task", "opportunity")`),relationshipField:r().describe(`Field on related object that points to this record (e.g., "account_id")`),columns:C(r()).describe(`Fields to display in the related list`),sort:l([r(),C(h({field:r(),order:E([`asc`,`desc`])}))]).optional().describe(`Sort order for related records`),limit:P().int().positive().default(5).describe(`Number of records to display initially`),filter:C(g0).optional().describe(`Additional filter criteria for related records`),title:Y.optional().describe(`Custom title for the related list`),showViewAll:S().default(!0).describe(`Show "View All" link to see all related records`),actions:C(r()).optional().describe(`Action IDs available for related records`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({fields:C(r()).min(1).max(7).describe(`Key fields to highlight (1-7 fields max, typically displayed as prominent cards)`),layout:E([`horizontal`,`vertical`]).default(`horizontal`).describe(`Layout orientation for highlight fields`),aria:r0.optional().describe(`ARIA accessibility attributes`)});var lPe=h({types:C(F0).optional().describe(`Feed item types to show (default: all)`),filterMode:cPe.default(`all`).describe(`Default activity filter`),showFilterToggle:S().default(!0).describe(`Show filter dropdown in panel header`),limit:P().int().positive().default(20).describe(`Number of items to load per page`),showCompleted:S().default(!1).describe(`Include completed activities`),unifiedTimeline:S().default(!0).describe(`Mix field changes and comments in one timeline (Airtable style)`),showCommentInput:S().default(!0).describe(`Show "Leave a comment" input at the bottom`),enableMentions:S().default(!0).describe(`Enable @mentions in comments`),enableReactions:S().default(!1).describe(`Enable emoji reactions on feed items`),enableThreading:S().default(!1).describe(`Enable threaded replies on comments`),showSubscriptionToggle:S().default(!0).describe(`Show bell icon for record-level notification subscription`),aria:r0.optional().describe(`ARIA accessibility attributes`)});h({position:E([`sidebar`,`inline`,`drawer`]).default(`sidebar`).describe(`Where to render the chatter panel`),width:l([r(),P()]).optional().describe(`Panel width (e.g., "350px", "30%")`),collapsible:S().default(!0).describe(`Whether the panel can be collapsed`),defaultCollapsed:S().default(!1).describe(`Whether the panel starts collapsed`),feed:lPe.optional().describe(`Embedded activity feed configuration`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({statusField:r().describe(`Field name representing the current status/stage`),stages:C(h({value:r(),label:Y})).optional().describe(`Explicit stage definitions (if not using field metadata)`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({items:C(h({label:Y,icon:r().optional(),collapsed:S().default(!1),children:C(u()).describe(`Child components`)})),allowMultiple:S().default(!1).describe(`Allow multiple panels to be expanded simultaneously`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({mode:E([`float`,`sidebar`,`inline`]).default(`float`).describe(`Display mode for the chat window`),agentId:r().optional().describe(`Specific AI agent to use`),context:d(r(),u()).optional().describe(`Contextual data to pass to the AI`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({content:r().describe(`Text or Markdown content`),variant:E([`heading`,`subheading`,`body`,`caption`]).optional().default(`body`).describe(`Text style variant`),align:E([`left`,`center`,`right`]).optional().default(`left`).describe(`Text alignment`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({object:r().describe(`Source object`),field:r().optional().describe(`Field to aggregate`),aggregate:E([`count`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function`),filter:E0.optional().describe(`Filter criteria`),format:E([`number`,`currency`,`percent`]).optional().describe(`Number display format`),prefix:r().optional().describe(`Prefix text (e.g. "$")`),suffix:r().optional().describe(`Suffix text (e.g. "%")`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({src:r().describe(`Image URL or attachment field`),alt:r().optional().describe(`Alt text for accessibility`),fit:E([`cover`,`contain`,`fill`]).optional().default(`cover`).describe(`Image object-fit mode`),height:P().optional().describe(`Fixed height in pixels`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({label:Y.describe(`Button display label`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().default(`primary`).describe(`Button visual variant`),size:E([`small`,`medium`,`large`]).optional().default(`medium`).describe(`Button size`),icon:r().optional().describe(`Icon name (Lucide icon)`),iconPosition:E([`left`,`right`]).optional().default(`left`).describe(`Icon position relative to label`),disabled:S().optional().default(!1).describe(`Disable the button`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({object:r().describe(`Object to filter`),fields:C(r()).describe(`Filterable field names`),targetVariable:r().optional().describe(`Page variable to store filter state`),layout:E([`inline`,`dropdown`,`sidebar`]).optional().default(`inline`).describe(`Filter display layout`),showSearch:S().optional().default(!0).describe(`Show search input`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({object:r().describe(`Object for the form`),fields:C(r()).optional().describe(`Fields to display (defaults to all editable fields)`),mode:E([`create`,`edit`]).optional().default(`create`).describe(`Form mode`),submitLabel:Y.optional().describe(`Submit button label`),onSubmit:r().optional().describe(`Action expression on form submit`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({object:r().describe(`Object to pick records from`),displayField:r().describe(`Field to display as the record label`),searchFields:C(r()).optional().describe(`Fields to search against`),filter:E0.optional().describe(`Filter criteria for available records`),multiple:S().optional().default(!1).describe(`Allow multiple record selection`),targetVariable:r().optional().describe(`Page variable to bind selected record ID(s)`),placeholder:Y.optional().describe(`Placeholder text`),aria:r0.optional().describe(`ARIA accessibility attributes`)}),h({context:r().optional()});var I0=h({minWidth:P().default(44).describe(`Minimum touch target width in pixels (WCAG 2.5.5: 44px)`),minHeight:P().default(44).describe(`Minimum touch target height in pixels (WCAG 2.5.5: 44px)`),padding:P().optional().describe(`Additional padding around touch target in pixels`),hitSlop:h({top:P().optional().describe(`Extra hit area above the element`),right:P().optional().describe(`Extra hit area to the right of the element`),bottom:P().optional().describe(`Extra hit area below the element`),left:P().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)`),uPe=E([`swipe`,`pinch`,`long_press`,`double_tap`,`drag`,`rotate`,`pan`]).describe(`Touch gesture type`),dPe=h({direction:C(E([`up`,`down`,`left`,`right`])).describe(`Allowed swipe directions`),threshold:P().optional().describe(`Minimum distance in pixels to recognize swipe`),velocity:P().optional().describe(`Minimum velocity (px/ms) to trigger swipe`)}).describe(`Swipe gesture recognition settings`),fPe=h({minScale:P().optional().describe(`Minimum scale factor (e.g., 0.5 for 50%)`),maxScale:P().optional().describe(`Maximum scale factor (e.g., 3.0 for 300%)`)}).describe(`Pinch/zoom gesture recognition settings`),pPe=h({duration:P().default(500).describe(`Hold duration in milliseconds to trigger long press`),moveTolerance:P().optional().describe(`Max movement in pixels allowed during press`)}).describe(`Long press gesture recognition settings`);h({gestures:C(h({type:uPe.describe(`Gesture type to configure`),label:Y.optional().describe(`Descriptive label for the gesture action`),enabled:S().default(!0).describe(`Whether this gesture is active`),swipe:dPe.optional().describe(`Swipe gesture settings (when type is swipe)`),pinch:fPe.optional().describe(`Pinch gesture settings (when type is pinch)`),longPress:pPe.optional().describe(`Long press settings (when type is long_press)`)}).describe(`Per-gesture configuration`)).optional().describe(`Configured gesture recognizers`),touchTarget:I0.optional().describe(`Touch target sizing and hit area`),hapticFeedback:S().optional().describe(`Enable haptic feedback on touch interactions`)}).merge(r0.partial()).describe(`Touch and gesture interaction configuration`);var mPe=h({enabled:S().default(!1).describe(`Enable focus trapping within this container`),initialFocus:r().optional().describe(`CSS selector for the element to focus on activation`),returnFocus:S().default(!0).describe(`Return focus to trigger element on deactivation`),escapeDeactivates:S().default(!0).describe(`Allow Escape key to deactivate the focus trap`)}).describe(`Focus trap configuration for modal-like containers`),hPe=h({key:r().describe(`Key combination (e.g., "Ctrl+S", "Alt+N", "Escape")`),action:r().describe(`Action identifier to invoke when shortcut is triggered`),description:Y.optional().describe(`Human-readable description of what the shortcut does`),scope:E([`global`,`view`,`form`,`modal`,`list`]).default(`global`).describe(`Scope in which this shortcut is active`)}).describe(`Keyboard shortcut binding`),L0=h({tabOrder:E([`auto`,`manual`]).default(`auto`).describe(`Tab order strategy: auto (DOM order) or manual (explicit tabIndex)`),skipLinks:S().default(!1).describe(`Provide skip-to-content navigation links`),focusVisible:S().default(!0).describe(`Show visible focus indicators for keyboard users`),focusTrap:mPe.optional().describe(`Focus trap settings`),arrowNavigation:S().default(!1).describe(`Enable arrow key navigation between focusable items`)}).describe(`Focus and tab navigation management`);h({shortcuts:C(hPe).optional().describe(`Registered keyboard shortcuts`),focusManagement:L0.optional().describe(`Focus and tab order management`),rovingTabindex:S().default(!1).describe(`Enable roving tabindex pattern for composite widgets`)}).merge(r0.partial()).describe(`Keyboard navigation and shortcut configuration`);var gPe=h({primary:r().describe(`Primary brand color (hex, rgb, or hsl)`),secondary:r().optional().describe(`Secondary brand color`),accent:r().optional().describe(`Accent color for highlights`),success:r().optional().describe(`Success state color (default: green)`),warning:r().optional().describe(`Warning state color (default: yellow)`),error:r().optional().describe(`Error state color (default: red)`),info:r().optional().describe(`Info state color (default: blue)`),background:r().optional().describe(`Background color`),surface:r().optional().describe(`Surface/card background color`),text:r().optional().describe(`Primary text color`),textSecondary:r().optional().describe(`Secondary text color`),border:r().optional().describe(`Border color`),disabled:r().optional().describe(`Disabled state color`),primaryLight:r().optional().describe(`Lighter shade of primary`),primaryDark:r().optional().describe(`Darker shade of primary`),secondaryLight:r().optional().describe(`Lighter shade of secondary`),secondaryDark:r().optional().describe(`Darker shade of secondary`)}),_Pe=h({fontFamily:h({base:r().optional().describe(`Base font family (default: system fonts)`),heading:r().optional().describe(`Heading font family`),mono:r().optional().describe(`Monospace font family for code`)}).optional(),fontSize:h({xs:r().optional().describe(`Extra small font size (e.g., 0.75rem)`),sm:r().optional().describe(`Small font size (e.g., 0.875rem)`),base:r().optional().describe(`Base font size (e.g., 1rem)`),lg:r().optional().describe(`Large font size (e.g., 1.125rem)`),xl:r().optional().describe(`Extra large font size (e.g., 1.25rem)`),"2xl":r().optional().describe(`2X large font size (e.g., 1.5rem)`),"3xl":r().optional().describe(`3X large font size (e.g., 1.875rem)`),"4xl":r().optional().describe(`4X large font size (e.g., 2.25rem)`)}).optional(),fontWeight:h({light:P().optional().describe(`Light weight (default: 300)`),normal:P().optional().describe(`Normal weight (default: 400)`),medium:P().optional().describe(`Medium weight (default: 500)`),semibold:P().optional().describe(`Semibold weight (default: 600)`),bold:P().optional().describe(`Bold weight (default: 700)`)}).optional(),lineHeight:h({tight:r().optional().describe(`Tight line height (e.g., 1.25)`),normal:r().optional().describe(`Normal line height (e.g., 1.5)`),relaxed:r().optional().describe(`Relaxed line height (e.g., 1.75)`),loose:r().optional().describe(`Loose line height (e.g., 2)`)}).optional(),letterSpacing:h({tighter:r().optional().describe(`Tighter letter spacing (e.g., -0.05em)`),tight:r().optional().describe(`Tight letter spacing (e.g., -0.025em)`),normal:r().optional().describe(`Normal letter spacing (e.g., 0)`),wide:r().optional().describe(`Wide letter spacing (e.g., 0.025em)`),wider:r().optional().describe(`Wider letter spacing (e.g., 0.05em)`)}).optional()}),vPe=h({0:r().optional().describe(`0 spacing (0)`),1:r().optional().describe(`Spacing unit 1 (e.g., 0.25rem)`),2:r().optional().describe(`Spacing unit 2 (e.g., 0.5rem)`),3:r().optional().describe(`Spacing unit 3 (e.g., 0.75rem)`),4:r().optional().describe(`Spacing unit 4 (e.g., 1rem)`),5:r().optional().describe(`Spacing unit 5 (e.g., 1.25rem)`),6:r().optional().describe(`Spacing unit 6 (e.g., 1.5rem)`),8:r().optional().describe(`Spacing unit 8 (e.g., 2rem)`),10:r().optional().describe(`Spacing unit 10 (e.g., 2.5rem)`),12:r().optional().describe(`Spacing unit 12 (e.g., 3rem)`),16:r().optional().describe(`Spacing unit 16 (e.g., 4rem)`),20:r().optional().describe(`Spacing unit 20 (e.g., 5rem)`),24:r().optional().describe(`Spacing unit 24 (e.g., 6rem)`)}),yPe=h({none:r().optional().describe(`No border radius (0)`),sm:r().optional().describe(`Small border radius (e.g., 0.125rem)`),base:r().optional().describe(`Base border radius (e.g., 0.25rem)`),md:r().optional().describe(`Medium border radius (e.g., 0.375rem)`),lg:r().optional().describe(`Large border radius (e.g., 0.5rem)`),xl:r().optional().describe(`Extra large border radius (e.g., 0.75rem)`),"2xl":r().optional().describe(`2X large border radius (e.g., 1rem)`),full:r().optional().describe(`Full border radius (50%)`)}),bPe=h({none:r().optional().describe(`No shadow`),sm:r().optional().describe(`Small shadow`),base:r().optional().describe(`Base shadow`),md:r().optional().describe(`Medium shadow`),lg:r().optional().describe(`Large shadow`),xl:r().optional().describe(`Extra large shadow`),"2xl":r().optional().describe(`2X large shadow`),inner:r().optional().describe(`Inner shadow (inset)`)}),xPe=h({xs:r().optional().describe(`Extra small breakpoint (e.g., 480px)`),sm:r().optional().describe(`Small breakpoint (e.g., 640px)`),md:r().optional().describe(`Medium breakpoint (e.g., 768px)`),lg:r().optional().describe(`Large breakpoint (e.g., 1024px)`),xl:r().optional().describe(`Extra large breakpoint (e.g., 1280px)`),"2xl":r().optional().describe(`2X large breakpoint (e.g., 1536px)`)}),SPe=h({duration:h({fast:r().optional().describe(`Fast animation (e.g., 150ms)`),base:r().optional().describe(`Base animation (e.g., 300ms)`),slow:r().optional().describe(`Slow animation (e.g., 500ms)`)}).optional(),timing:h({linear:r().optional().describe(`Linear timing function`),ease:r().optional().describe(`Ease timing function`),ease_in:r().optional().describe(`Ease-in timing function`),ease_out:r().optional().describe(`Ease-out timing function`),ease_in_out:r().optional().describe(`Ease-in-out timing function`)}).optional()}),CPe=h({base:P().optional().describe(`Base z-index (e.g., 0)`),dropdown:P().optional().describe(`Dropdown z-index (e.g., 1000)`),sticky:P().optional().describe(`Sticky z-index (e.g., 1020)`),fixed:P().optional().describe(`Fixed z-index (e.g., 1030)`),modalBackdrop:P().optional().describe(`Modal backdrop z-index (e.g., 1040)`),modal:P().optional().describe(`Modal z-index (e.g., 1050)`),popover:P().optional().describe(`Popover z-index (e.g., 1060)`),tooltip:P().optional().describe(`Tooltip z-index (e.g., 1070)`)}),wPe=E([`light`,`dark`,`auto`]),TPe=E([`compact`,`regular`,`spacious`]),EPe=E([`AA`,`AAA`]);h({name:u0.describe(`Unique theme identifier (snake_case)`),label:r().describe(`Human-readable theme name`),description:r().optional().describe(`Theme description`),mode:wPe.default(`light`).describe(`Theme mode (light, dark, or auto)`),colors:gPe.describe(`Color palette configuration`),typography:_Pe.optional().describe(`Typography settings`),spacing:vPe.optional().describe(`Spacing scale`),borderRadius:yPe.optional().describe(`Border radius scale`),shadows:bPe.optional().describe(`Box shadow effects`),breakpoints:xPe.optional().describe(`Responsive breakpoints`),animation:SPe.optional().describe(`Animation settings`),zIndex:CPe.optional().describe(`Z-index scale for layering`),customVars:d(r(),r()).optional().describe(`Custom CSS variables (key-value pairs)`),logo:h({light:r().optional().describe(`Logo URL for light mode`),dark:r().optional().describe(`Logo URL for dark mode`),favicon:r().optional().describe(`Favicon URL`)}).optional().describe(`Logo assets`),extends:r().optional().describe(`Base theme to extend from`),density:TPe.optional().describe(`Display density: compact, regular, or spacious`),wcagContrast:EPe.optional().describe(`WCAG color contrast level (AA or AAA)`),rtl:S().optional().describe(`Enable right-to-left layout direction`),touchTarget:I0.optional().describe(`Touch target sizing defaults`),keyboardNavigation:L0.optional().describe(`Keyboard focus management settings`)});var R0=E([`cache_first`,`network_first`,`stale_while_revalidate`,`network_only`,`cache_only`]).describe(`Data fetching strategy for offline/online transitions`),DPe=E([`client_wins`,`server_wins`,`manual`,`last_write_wins`]).describe(`How to resolve conflicts when syncing offline changes`),OPe=h({strategy:R0.default(`network_first`).describe(`Sync fetch strategy`),conflictResolution:DPe.default(`last_write_wins`).describe(`Conflict resolution policy`),retryInterval:P().optional().describe(`Retry interval in milliseconds between sync attempts`),maxRetries:P().optional().describe(`Maximum number of sync retry attempts`),batchSize:P().optional().describe(`Number of mutations to sync per batch`)}).describe(`Offline-to-online synchronization configuration`),kPe=E([`indexeddb`,`localstorage`,`sqlite`]).describe(`Client-side storage backend for offline cache`),APe=E([`lru`,`lfu`,`fifo`]).describe(`Cache eviction policy`),jPe=h({maxSize:P().optional().describe(`Maximum cache size in bytes`),ttl:P().optional().describe(`Time-to-live for cached entries in milliseconds`),persistStorage:kPe.default(`indexeddb`).describe(`Storage backend`),evictionPolicy:APe.default(`lru`).describe(`Cache eviction policy when full`)}).describe(`Client-side offline cache configuration`);h({enabled:S().default(!1).describe(`Enable offline support`),strategy:R0.default(`network_first`).describe(`Default offline fetch strategy`),cache:jPe.optional().describe(`Cache settings for offline data`),sync:OPe.optional().describe(`Sync settings for offline mutations`),offlineIndicator:S().default(!0).describe(`Show a visual indicator when offline`),offlineMessage:Y.optional().describe(`Customizable offline status message shown to users`),queueMaxSize:P().optional().describe(`Maximum number of queued offline mutations`)}).describe(`Offline support configuration`);var z0=E([`fade`,`slide_up`,`slide_down`,`slide_left`,`slide_right`,`scale`,`rotate`,`flip`,`none`]).describe(`Transition preset type`),B0=E([`linear`,`ease`,`ease_in`,`ease_out`,`ease_in_out`,`spring`]).describe(`Animation easing function`),V0=h({preset:z0.optional().describe(`Transition preset to apply`),duration:P().optional().describe(`Transition duration in milliseconds`),easing:B0.optional().describe(`Easing function for the transition`),delay:P().optional().describe(`Delay before transition starts in milliseconds`),customKeyframes:r().optional().describe(`CSS @keyframes name for custom animations`),themeToken:r().optional().describe(`Reference to a theme animation token (e.g. "animation.duration.fast")`)}).describe(`Animation transition configuration`),MPe=E([`on_mount`,`on_unmount`,`on_hover`,`on_focus`,`on_click`,`on_scroll`,`on_visible`]).describe(`Event that triggers the animation`),NPe=h({label:Y.optional().describe(`Descriptive label for this animation configuration`),enter:V0.optional().describe(`Enter/mount animation`),exit:V0.optional().describe(`Exit/unmount animation`),hover:V0.optional().describe(`Hover state animation`),trigger:MPe.optional().describe(`When to trigger the animation`),reducedMotion:E([`respect`,`disable`,`alternative`]).default(`respect`).describe(`Accessibility: how to handle prefers-reduced-motion`)}).merge(r0.partial()).describe(`Component-level animation configuration`),PPe=h({type:z0.default(`fade`).describe(`Page transition type`),duration:P().default(300).describe(`Transition duration in milliseconds`),easing:B0.default(`ease_in_out`).describe(`Easing function for the transition`),crossFade:S().default(!1).describe(`Whether to cross-fade between pages`)}).describe(`Page-level transition configuration`);h({label:Y.optional().describe(`Descriptive label for the motion configuration`),defaultTransition:V0.optional().describe(`Default transition applied to all animations`),pageTransitions:PPe.optional().describe(`Page navigation transition settings`),componentAnimations:d(r(),NPe).optional().describe(`Component name to animation configuration mapping`),reducedMotion:S().default(!1).describe(`When true, respect prefers-reduced-motion and suppress animations globally`),enabled:S().default(!0).describe(`Enable or disable all animations globally`)}).describe(`Top-level motion and animation design configuration`);var FPe=E([`toast`,`snackbar`,`banner`,`alert`,`inline`]).describe(`Notification presentation style`),IPe=E([`info`,`success`,`warning`,`error`]).describe(`Notification severity level`),H0=E([`top_left`,`top_center`,`top_right`,`bottom_left`,`bottom_center`,`bottom_right`]).describe(`Screen position for notification placement`),LPe=h({label:Y.describe(`Action button label`),action:r().describe(`Action identifier to execute`),variant:E([`primary`,`secondary`,`link`]).default(`primary`).describe(`Button variant style`)}).describe(`Notification action button`);h({type:FPe.default(`toast`).describe(`Notification presentation style`),severity:IPe.default(`info`).describe(`Notification severity level`),title:Y.optional().describe(`Notification title`),message:Y.describe(`Notification message body`),icon:r().optional().describe(`Icon name override`),duration:P().optional().describe(`Auto-dismiss duration in ms, omit for persistent`),dismissible:S().default(!0).describe(`Allow user to dismiss the notification`),actions:C(LPe).optional().describe(`Action buttons`),position:H0.optional().describe(`Override default position`)}).merge(r0.partial()).describe(`Notification instance definition`),h({defaultPosition:H0.default(`top_right`).describe(`Default screen position for notifications`),defaultDuration:P().default(5e3).describe(`Default auto-dismiss duration in ms`),maxVisible:P().default(5).describe(`Maximum number of notifications visible at once`),stackDirection:E([`up`,`down`]).default(`down`).describe(`Stack direction for multiple notifications`),pauseOnHover:S().default(!0).describe(`Pause auto-dismiss timer on hover`)}).describe(`Global notification system configuration`);var RPe=E([`element`,`handle`,`grip_icon`]).describe(`Drag initiation method`),zPe=E([`move`,`copy`,`link`,`none`]).describe(`Drop operation effect`),BPe=h({axis:E([`x`,`y`,`both`]).default(`both`).describe(`Constrain drag axis`),bounds:E([`parent`,`viewport`,`none`]).default(`none`).describe(`Constrain within bounds`),grid:w([P(),P()]).optional().describe(`Snap to grid [x, y] in pixels`)}).describe(`Drag movement constraints`),VPe=h({label:Y.optional().describe(`Accessible label for the drop zone`),accept:C(r()).describe(`Accepted drag item types`),maxItems:P().optional().describe(`Maximum items allowed in drop zone`),highlightOnDragOver:S().default(!0).describe(`Highlight drop zone when dragging over`),dropEffect:zPe.default(`move`).describe(`Visual effect on drop`)}).merge(r0.partial()).describe(`Drop zone configuration`),HPe=h({type:r().describe(`Drag item type identifier for matching with drop zones`),label:Y.optional().describe(`Accessible label describing the draggable item`),handle:RPe.default(`element`).describe(`How to initiate drag`),constraint:BPe.optional().describe(`Drag movement constraints`),preview:E([`element`,`custom`,`none`]).default(`element`).describe(`Drag preview type`),disabled:S().default(!1).describe(`Disable dragging`)}).merge(r0.partial()).describe(`Draggable item configuration`);h({enabled:S().default(!1).describe(`Enable drag and drop`),dragItem:HPe.optional().describe(`Configuration for draggable item`),dropZone:VPe.optional().describe(`Configuration for drop target`),sortable:S().default(!1).describe(`Enable sortable list behavior`),autoScroll:S().default(!0).describe(`Auto-scroll during drag near edges`),touchDelay:P().default(200).describe(`Delay in ms before drag starts on touch devices`)}).describe(`Drag and drop interaction configuration`);var UPe=e({DEFAULT_EXTENDER_PRIORITY:()=>200,DEFAULT_OWNER_PRIORITY:()=>100,ObjectQL:()=>X0,ObjectQLPlugin:()=>$0,ObjectRepository:()=>Z0,ObjectStackProtocolImplementation:()=>J0,RESERVED_NAMESPACES:()=>U0,SchemaRegistry:()=>K0,ScopedContext:()=>Q0,computeFQN:()=>W0,parseFQN:()=>G0}),U0=new Set([`base`,`system`]);function W0(e,t){return!e||U0.has(e)?t:`${e}__${t}`}function G0(e){let t=e.indexOf(`__`);return t===-1?{namespace:void 0,shortName:e}:{namespace:e.slice(0,t),shortName:e.slice(t+2)}}function WPe(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 K0=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);n||(n=new Set,this.namespaceRegistry.set(e,n)),n.add(t),this.log(`[Registry] Registered namespace: ${e} \u2192 ${t}`)}static unregisterNamespace(e,t){let n=this.namespaceRegistry.get(e);n&&(n.delete(t),n.size===0&&this.namespaceRegistry.delete(e),this.log(`[Registry] Unregistered namespace: ${e} \u2190 ${t}`))}static getNamespaceOwner(e){let t=this.namespaceRegistry.get(e);if(!(!t||t.size===0))return t.values().next().value}static getNamespaceOwners(e){let t=this.namespaceRegistry.get(e);return t?Array.from(t):[]}static registerObject(e,t,n,r=`own`,i=r===`own`?100:200){let a=e.name,o=W0(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=WPe(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}=G0(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`?O.parse(t):e===`app`?eNe.parse(t):e===`package`?q1.parse(t):e===`plugin`?H1.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(`app`,e,`name`,t)}static getApp(e){return this.getItem(`app`,e)}static getAllApps(){return this.listItems(`app`)}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`)}};K0._logLevel=`info`,K0.objectContributors=new Map,K0.mergedObjectCache=new Map,K0.namespaceRegistry=new Map,K0.metadata=new Map;function GPe(e){let t=0;for(let n=0;n0)n=i.map(t=>{let n=typeof t.metadata==`string`?JSON.parse(t.metadata):t.metadata;return K0.registerItem(e.type,n,`name`),n});else{let t=D1[e.type]??O1[e.type];if(t){let r=await this.engine.find(`sys_metadata`,{where:{type:t,state:`active`}});r&&r.length>0&&(n=r.map(t=>{let n=typeof t.metadata==`string`?JSON.parse(t.metadata):t.metadata;return K0.registerItem(e.type,n,`name`),n}))}}}catch{}try{let t=(this.getServicesRegistry?.())?.get(`metadata`);if(t&&typeof t.list==`function`){let r=await t.list(e.type);if(r&&r.length>0){let e=new Map;for(let t of n){let n=t;n&&typeof n==`object`&&`name`in n&&e.set(n.name,n)}for(let t of r){let n=t;n&&typeof n==`object`&&`name`in n&&e.set(n.name,n)}n=Array.from(e.values())}}}catch{}return{type:e.type,items:n}}async getMetaItem(e){let t=K0.getItem(e.type,e.name);if(t===void 0){let n=D1[e.type]??O1[e.type];n&&(t=K0.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,K0.registerItem(e.type,t,`name`);else{let n=D1[e.type]??O1[e.type];if(n){let 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,K0.registerItem(e.type,t,`name`))}}}catch{}if(t===void 0)try{let n=(this.getServicesRegistry?.())?.get(`metadata`);n&&typeof n.get==`function`&&(t=await n.get(e.type,e.name))}catch{}return{type:e.type,name:e.name,item:t}}async getUiView(e){let t=K0.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{}_(e)&&(e=ee(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,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=K0.getItem(e.type,e.name);if(!t){let n=D1[e.type]??O1[e.type];n&&(t=K0.getItem(n,e.name))}if(!t)try{let n=(this.getServicesRegistry?.())?.get(`metadata`);n&&typeof n.get==`function`&&(t=await n.get(e.type,e.name))}catch{}if(!t)throw Error(`Metadata item ${e.type}/${e.name} not found`);let n=GPe(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=K0.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`);K0.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,n=D1[r.type]??r.type;n===`object`?K0.registerObject(t,r.packageId||`sys_metadata`):K0.registerItem(n,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}}}},Y0=class e{constructor(e={}){this.drivers=new Map,this.defaultDriver=null,this.datasourceMapping=[],this.manifests=new Map,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||$f({level:`info`,format:`pretty`}),this.logger.info(`ObjectQL Engine Instance Created`)}getStatus(){return{name:fi.enum.data,status:`running`,version:`0.9.0`,features:[`crud`,`query`,`aggregate`,`transactions`,`metadata`]}}get registry(){return K0}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()=>{r0){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};K0.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&&(K0.registerApp(n,t),this.logger.debug(`Registered App`,{app:e,from:t}))}}e.name&&e.navigation&&!e.apps?.length&&(K0.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)&&K0.registerItem(k1(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&&K0.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)K0.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=K0.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=K0.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{K0.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)&&K0.registerItem(k1(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}))}setRealtimeService(e){this.realtimeService=e,this.logger.info(`RealtimeService configured for data events`)}getSchema(e){return K0.getObject(e)}resolveObjectName(e){let t=K0.getObject(e);return t?t.tableName||t.name:e}getDriver(e){let t=K0.getObject(e);if(t?.datasource&&t.datasource!==`default`){if(this.drivers.has(t.datasource))return this.drivers.get(t.datasource);throw Error(`[ObjectQL] Datasource '${t.datasource}' configured for object '${e}' is not registered.`)}let n=this.resolveDatasourceFromMapping(e,t);if(n&&this.drivers.has(n))return this.logger.debug(`Resolved datasource from mapping`,{object:e,datasource:n}),this.drivers.get(n);let r=t?.name||e,i=K0.getObjectOwner(r);if(i?.packageId){let t=this.manifests.get(i.packageId);if(t?.defaultDatasource&&t.defaultDatasource!==`default`&&this.drivers.has(t.defaultDatasource))return this.logger.debug(`Resolved datasource from package manifest`,{object:e,package:i.packageId,datasource:t.defaultDatasource}),this.drivers.get(t.defaultDatasource)}if(this.defaultDriver&&this.drivers.has(this.defaultDriver))return this.drivers.get(this.defaultDriver);throw Error(`[ObjectQL] No driver available for object '${e}'`)}resolveDatasourceFromMapping(e,t){if(!this.datasourceMapping||this.datasourceMapping.length===0)return null;let n=[...this.datasourceMapping].sort((e,t)=>(e.priority??1e3)-(t.priority??1e3));for(let r of n)if(r.namespace&&t?.namespace===r.namespace||r.package&&t?.packageId===r.package||r.objectPattern&&this.matchPattern(e,r.objectPattern)||r.default)return r.datasource;return null}matchPattern(e,t){let n=t.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`).replace(/\?/g,`.`);return RegExp(`^${n}$`).test(e)}setDatasourceMapping(e){this.datasourceMapping=e,this.logger.info(`Datasource mapping rules configured`,{ruleCount:e.length})}async init(){this.logger.info(`Initializing ObjectQL engine`,{driverCount:this.drivers.size,drivers:Array.from(this.drivers.keys())});let e=[];for(let[t,n]of this.drivers)try{await n.connect(),this.logger.info(`Driver connected successfully`,{driverName:t})}catch(n){e.push(t),this.logger.error(`Failed to connect driver`,n,{driverName:t})}e.length>0&&this.logger.warn(`${e.length} of ${this.drivers.size} driver(s) failed initial connect. Operations may recover via lazy reconnection or fail at query time.`,{failedDrivers: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=K0.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;if(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),this.realtimeService)try{if(Array.isArray(n)){for(let t of n){let n={type:`data.record.created`,object:e,payload:{recordId:t.id,after:t},timestamp:new Date().toISOString()};await this.realtimeService.publish(n)}this.logger.debug(`Published ${n.length} data.record.created events`,{object:e})}else{let t={type:`data.record.created`,object:e,payload:{recordId:n.id,after:n},timestamp:new Date().toISOString()};await this.realtimeService.publish(t),this.logger.debug(`Published data.record.created event`,{object:e,recordId:n.id})}}catch(t){this.logger.warn(`Failed to publish data event`,{object:e,error:t})}return 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`);if(t.event=`afterUpdate`,t.result=i,await this.triggerHooks(`afterUpdate`,t),this.realtimeService)try{let n=typeof i==`object`&&i&&`id`in i?i.id:void 0,r=String(t.input.id||n||``),a={type:`data.record.updated`,object:e,payload:{recordId:r,changes:t.input.data,after:i},timestamp:new Date().toISOString()};await this.realtimeService.publish(a),this.logger.debug(`Published data.record.updated event`,{object:e,recordId:r})}catch(t){this.logger.warn(`Failed to publish data event`,{object:e,error:t})}return 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`);if(a.event=`afterDelete`,a.result=r,await this.triggerHooks(`afterDelete`,a),this.realtimeService)try{let t=typeof r==`object`&&r&&`id`in r?r.id:void 0,n=String(a.input.id||t||``),i={type:`data.record.deleted`,object:e,payload:{recordId:n},timestamp:new Date().toISOString()};await this.realtimeService.publish(i),this.logger.debug(`Published data.record.deleted event`,{object:e,recordId:n})}catch(t){this.logger.warn(`Failed to publish data event`,{object:e,error:t})}return 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 K0.registerObject(e,t,n)}unregisterObject(e,t){t?K0.unregisterObjectsByPackage(t):K0.unregisterItem(`object`,e)}getObject(e){return this.getSchema(e)}getConfigs(){let e={},t=K0.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),K0.unregisterObjectsByPackage(e,!0)}async close(){return this.destroy()}createContext(e){return new Q0(FMe.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}};Y0.MAX_EXPAND_DEPTH=3;var X0=Y0,Z0=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`)}},Q0=class e{constructor(e,t){this.executionContext=e,this.engine=t}object(e){return new Z0(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}};function KPe(e){return typeof e==`object`&&!!e&&typeof e.loadMetaFromDb==`function`}var $0=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 X0({...this.hostContext,logger:e.logger}),e.registerService(`objectql`,this.ql),e.registerService(`data`,this.ql);let t=this.ql;e.registerService(`manifest`,{register:n=>{t.registerApp(n),e.logger.debug(`Manifest registered via manifest service`,{id:n.id||n.name})}}),e.logger.info(`ObjectQL engine registered`,{services:[`objectql`,`data`,`manifest`]});let n=new J0(this.ql,()=>e.getServices?e.getServices():new Map);e.registerService(`protocol`,n),e.logger.info(`Protocol service registered`)},this.start=async e=>{e.logger.info(`ObjectQL engine starting...`);try{let t=e.getService(`metadata`);t&&typeof t.loadMany==`function`&&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.`)&&(e.logger.warn(`[DEPRECATED] Service "${n}" uses legacy app.* convention. Migrate to ctx.getService('manifest').register(data).`),this.ql.registerApp(r),e.logger.debug(`Discovered and registered app service (legacy)`,{serviceName:n}));try{let t=e.getService(`realtime`);t&&typeof t==`object`&&`publish`in t&&(e.logger.info(`[ObjectQLPlugin] Bridging realtime service to ObjectQL for event publishing`),this.ql.setRealtimeService(t))}catch(t){e.logger.debug(`[ObjectQLPlugin] No realtime service found — data events will not be published`,{error:t.message})}}await this.ql?.init(),await this.restoreMetadataFromDb(e),await this.syncRegisteredSchemas(e),await this.bridgeObjectsToMetadataService(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 restoreMetadataFromDb(e){let t;try{let n=e.getService(`protocol`);if(!n||!KPe(n)){e.logger.debug(`Protocol service does not support loadMetaFromDb, skipping DB restore`);return}t=n}catch(t){e.logger.debug(`Protocol service unavailable, skipping DB restore`,{error:t instanceof Error?t.message:String(t)});return}try{let{loaded:n,errors:r}=await t.loadMetaFromDb();n>0||r>0?e.logger.info(`Metadata restored from database to SchemaRegistry`,{loaded:n,errors:r}):e.logger.debug(`No persisted metadata found in database`)}catch(t){e.logger.debug(`DB metadata restore failed (non-fatal)`,{error:t instanceof Error?t.message:String(t)})}}async bridgeObjectsToMetadataService(e){try{let t=e.getService(`metadata`);if(!t||typeof t.register!=`function`){e.logger.debug(`Metadata service unavailable for bridging, skipping`);return}if(!this.ql?.registry){e.logger.debug(`SchemaRegistry unavailable for bridging, skipping`);return}let n=this.ql.registry.getAllObjects(),r=0;for(let i of n)try{await t.getObject(i.name)||(await t.register(`object`,i.name,i),r++)}catch(t){e.logger.debug(`Failed to bridge object to metadata service`,{object:i.name,error:t instanceof Error?t.message:String(t)})}r>0?e.logger.info(`Bridged objects from SchemaRegistry to metadata service`,{count:r,total:n.length}):e.logger.debug(`No objects needed bridging (all already in metadata service)`)}catch(t){e.logger.debug(`Failed to bridge objects to metadata service`,{error:t instanceof Error?t.message:String(t)})}}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`)}},qPe=16777619;function e2(e,t){return e*qPe^t>>>0}function t2(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=e2(r,e|0)}return r>>>0}function n2(e){let t=0;for(let n=0;n>>0}function JPe(e){let t=0,n=e<0n,r=n?-e:e;if(r===0n)t=e2(t,0);else for(;r>0n;){let e=Number(r&255n);t=e2(t,e),r>>=8n}return e2(t,+n)>>>0}function YPe(e){let t=n2((e.name||``)+e.toString());return t=e2(t,e.length),t>>>0}function XPe(e){let t=0;for(let n=0;n>>0}function ZPe(e){let t=n2(e.constructor.name),n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return t=e2(t,XPe(n)),t>>>0}function QPe(e,t){if(t.has(e))return 13;t.add(e);let n=1;for(let r=0;r>>0}function $Pe(e,t){if(t.has(e))return 13;t.add(e);let n=Object.keys(e).sort(),r=n2(e?.constructor?.name);for(let i of n)r=e2(r,n2(i)),r=e2(r,r2(e[i],t));return t.delete(e),r>>>0}var eFe=[3735928559,305441741].map(e=>e2(3,e)),tFe=e2(1,0),nFe=e2(2,0);function r2(e,t){if(e===null)return tFe;switch(typeof e){case`undefined`:return nFe;case`boolean`:return eFe[+e];case`number`:return e2(4,t2(e));case`string`:return e2(5,n2(e));case`bigint`:return e2(6,JPe(e));case`function`:return e2(7,YPe(e));default:return ArrayBuffer.isView(e)&&!(e instanceof DataView)?e2(12,ZPe(e)):e instanceof Date?e2(10,t2(e.getTime())):e instanceof RegExp?e2(11,e2(n2(e.source),n2(e.flags))):Array.isArray(e)?e2(8,QPe(e,t)):e2(9,$Pe(e,t))}}function i2(e){return r2(e,new WeakSet)>>>0}var a2=class extends Error{},o2=Symbol(`missing`),rFe=`mingo: cycle detected while processing object/array`,s2=e=>typeof e!=`object`&&typeof e!=`function`||e===null,c2=e=>s2(e)||C2(e)||w2(e),l2={undefined:1,null:2,number:3,string:4,symbol:5,object:6,array:7,arraybuffer:8,boolean:9,date:10,regexp:11,function:12},u2=(e,t)=>et),iFe=(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;e0)return a;return a}}let o=l2[r]??Number.MAX_VALUE,s=l2[i]??Number.MAX_VALUE;return o===s?u2(r,i):u2(o,s)}var f2=(e,t)=>d2(e,t,!0),p2=e=>e!=null&&e.toString!==Object.prototype.toString;function m2(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(C2(e))return C2(t)&&+e==+t;if(w2(e))return w2(t)&&e.source===t.source&&e.flags===t.flags;if(Z(e)&&Z(t))return e.length===t.length&&e.every((e,n)=>m2(e,t[n]));if(e?.constructor!==Object&&p2(e))return e?.toString()===t?.toString();let n=e,r=t,i=Object.keys(n),a=Object.keys(r);return i.length===a.length?i.every(e=>O2(r,e)&&m2(n[e],r[e])):!1}var h2=class e extends Map{#e=new Map;#t=e=>{let t=i2(e);return[(this.#e.get(t)??[]).find(t=>m2(t,e)),t]};constructor(){super()}static init(){return new e}clear(){super.clear(),this.#e.clear()}delete(e){if(s2(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=>!m2(e,t))),!0):!1}get(e){if(s2(e))return super.get(e);let[t,n]=this.#t(e);return super.get(t)}has(e){if(s2(e))return super.has(e);let[t,n]=this.#t(e);return super.has(t)}set(e,t){if(s2(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 X(e,t){if(!e)throw new a2(t)}function g2(e){let t=typeof e;switch(t){case`number`:case`string`:case`boolean`:case`undefined`:case`function`:case`symbol`:return t}return e===null?`null`:Z(e)?`array`:C2(e)?`date`:w2(e)?`regexp`:k2(e)?`arraybuffer`:e?.constructor===Object?`object`:e?.constructor?.name?.toLowerCase()??`object`}var _2=e=>typeof e==`boolean`,v2=e=>typeof e==`string`,y2=e=>!Number.isNaN(e)&&typeof e==`number`,b2=Number.isInteger,Z=Array.isArray,x2=e=>g2(e)===`object`,S2=e=>!s2(e),C2=e=>e instanceof Date,w2=e=>e instanceof RegExp,aFe=e=>typeof e==`function`,Q=e=>e==null,T2=(e,t=!0)=>!!e||t&&e===``,E2=e=>Q(e)||v2(e)&&!e||Z(e)&&e.length===0||x2(e)&&Object.keys(e).length===0,D2=e=>Z(e)?e:[e],O2=(e,...t)=>!!e&&t.every(t=>Object.prototype.hasOwnProperty.call(e,t)),k2=e=>typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e),A2=(e,t)=>{if(Q(e)||_2(e)||y2(e)||v2(e))return e;if(C2(e))return new Date(e);if(w2(e))return new RegExp(e);if(k2(e)){let t=e.constructor;return new t(e)}if(t instanceof WeakSet||(t=new WeakSet),t.has(e))throw Error(rFe);t.add(e);try{if(Z(e)){let n=Array(e.length);for(let r=0;r=0;r--){for(let i=0;i0||t<0)?r(e[i],Math.max(-1,t-1)):n.push(e[i])}return r(e,t),n}function N2(e){let t=h2.init();for(let n of e)t.set(n,!0);return Array.from(t.keys())}function P2(e,t){if(e.length<1)return new Map;let n=h2.init();for(let r=0;r0)break;i+=1;let r=t.slice(e);n=n.reduce((e,t)=>{let n=a(t,r);return n!==void 0&&e.push(n),e},[]);break}else n=F2(n,r);if(n===void 0)break}return n}let o=a(e,r);return Z(o)&&n?.unwrapArray?oFe(o,i):o}function L2(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=F2(e,t);o&&(r=L2(r,a,n)),n?.preserveIndex?s[t]=r:s.push(r)}else for(let r of e){let e=L2(r,t,n);n?.preserveMissing?s.push(e??o2):(e!=null||n?.preserveIndex)&&s.push(e)}return s}let s=n?.preserveKeys?{...e}:{},c=F2(e,i);if(o&&(c=L2(c,a,n)),c!==void 0)return s[i]=c,s}function R2(e){if(Z(e))for(let t=e.length-1;t>=0;t--)e[t]===o2?e.splice(t,1):R2(e[t]);else if(x2(e))for(let t of Object.keys(e))O2(e,t)&&R2(e[t])}var z2=/^\d+$/;function B2(e,t,n,r){let i=t.split(`.`),a=i[0],o=i.slice(1).join(`.`);if(i.length===1)(x2(e)||Z(e)&&z2.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&&z2.test(i[1]));Z(t)&&r?.descendArray&&!s?t.forEach((e=>B2(e,o,n,r))):B2(t,o,n,r)}}function V2(e,t,n){B2(e,t,(e,t)=>e[t]=n,{buildGraph:!0})}function H2(e,t,n){B2(e,t,((e,t)=>{Z(e)?e.splice(parseInt(t),1):x2(e)&&delete e[t]}),n)}var U2=e=>!!e&&e[0]===`$`&&/^\$[a-zA-Z0-9_]+$/.test(e);function W2(e){if(c2(e))return w2(e)?{$regex:e}:{$eq:e};if(S2(e)){if(!Object.keys(e).some(U2))return{$eq:e};if(x2(e)&&O2(e,`$regex`)){let t={...e};return t.$regex=new RegExp(e.$regex,e.$options),delete t.$options,t}}return e}function G2(e,t,n=f2){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 sFe=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}},K2=(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))(K2||{}),q2=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?Y2.from(t?.context):Y2.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(){let e=this.#e.timestamp??0;return e||(e=Date.now(),Object.assign(this.#e,{timestamp:e})),new Date(e)}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}},J2=(e=>(e.ACCUMULATOR=`accumulator`,e.EXPRESSION=`expression`,e.PIPELINE=`pipeline`,e.PROJECTION=`projection`,e.QUERY=`query`,e.WINDOW=`window`,e))(J2||{}),Y2=class e{#e;constructor(){this.#e={accumulator:{},expression:{},pipeline:{},projection:{},query:{},window:{}}}static init(t={}){let n=new e;for(let e of Object.keys(t))n.#e[e]={...t[e]};return n}static from(...t){if(t.length===1)return e.init(t[0].#e);let n=new e;for(let e of t)for(let t of Object.values(J2))n.addOps(t,e.#e[t]);return n}addOps(e,t){return this.#e[e]=Object.assign({},t,this.#e[e]),this}getOperator(e,t){return this.#e[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){return X2(e,t,!(n instanceof q2)||Q(n.local.root)?q2.init(n).update({root:e}):n)}var cFe=new Set([`$$ROOT`,`$$CURRENT`,`$$REMOVE`,`$$NOW`]);function X2(e,t,n){if(v2(t)&&t.length>0&&t[0]===`$`){if(t===`$$KEEP`||t===`$$PRUNE`||t===`$$DESCEND`)return t;let r=n.local.root,i=t.split(`.`),a=t.indexOf(`.`),o=a===-1?t:t.substring(0,a);if(cFe.has(i[0])){switch(o){case`$$ROOT`:break;case`$$CURRENT`:r=e;break;case`$$REMOVE`:r=void 0;break;case`$$NOW`:r=new Date(n.now);break}t=a===-1?``:t.substring(a+1)}else if(o.length>=2&&o[1]===`$`){r=Object.assign({},n.variables,{this:e},n?.local?.variables);let i=o.substring(2);X(O2(r,i),`Use of undefined variable: ${i}`),t=t.substring(2)}else t=t.substring(1);return t===``?r:I2(r,t)}if(Z(t))return t.map(t=>X2(e,t,n));if(x2(t)){let r=Object.keys(t);if(U2(r[0]))return X(r.length===1,`Expression must contain a single operator.`),lFe(e,t[r[0]],r[0],n);let i={};for(let a=0;a{for(;t{for(;;){let{value:e,done:r}=t.next();if(r)return{done:r};let i=!0;n++;for(let t=0;t=0,`value must be a non-negative integer`),this.filter(t=>e-- >0)}drop(e){return X(e>=0,`value must be a non-negative integer`),this.filter(t=>e--<=0)}transform(e){let t=this,n;return Z2(()=>(n||=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}},e4=class{#e;#t;constructor(e,t){this.#e=e,this.#t=q2.init(t)}stream(e,t){let n=Z2(e),r=t??this.#t,i=r.processingMode;return i&K2.CLONE_INPUT&&n.map(e=>A2(e)),n=this.#e.map((e,t)=>{let n=Object.keys(e);X(n.length===1,`aggregation stage must have single operator, got ${n.toString()}.`);let i=n[0];X(i!==`$documents`||t==0,`$documents must be first stage in pipeline.`);let a=r.context.getOperator(J2.PIPELINE,i);return X(!!a,`unregistered pipeline operator ${i}.`),[a,e[i]]}).reduce((e,[t,n])=>t(e,n,r),n),i&K2.CLONE_OUTPUT&&n.map(e=>A2(e)),n}run(e,t){return this.stream(e,t).collect()}},t4=(e,t,n)=>{if(Q(t))return e;let r=q2.init(n),i=Array(e.length);for(let n=0;n{X(n.scriptEnabled,`$accumulator requires 'scriptEnabled' option to be true`);let r=q2.init(n),i=t,a=$(r?.local?.groupId,i.initArgs||[],r.update({root:r?.local?.groupId})),o=t4(e,i.accumulateArgs,r);for(let e=0;eN2(t4(e,t,n)),mFe=(e,t,n)=>{let r=t4(e,t,n).filter(y2);return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length};function n4(e,t,n){X(x2(t)&&Object.keys(t).length>0,`$sort specification is invalid`);let r=f2,i=n.collation;return x2(i)&&v2(i.locale)&&(r=gFe(i)),e.transform(e=>{let n=Object.keys(t);for(let i of n.reverse()){let n=P2(e,e=>I2(e,i)),a=Array.from(n.keys()),o=!1;if(r===f2){let e=!0,t=!0;for(let n of a)if(e&&=v2(n),t&&=y2(n),!e&&!t)break;if(o=e||t,e)a.sort();else if(t){let e=new Float64Array(a).sort();for(let t=0;tv2(e)&&v2(t)?n.compare(e,t):f2(e,t)}var r4=(e,t,n)=>{let r=n,i=t,a=$(r?.local?.groupId,i.n,r),o=n4(Z2(e),i.sortBy,n).collect(),s=o.length;return t4(s<=a?o:o.slice(s-a),i.output,r)},_Fe=(e,t,n)=>r4(e,{...t,n:1},n),vFe=(e,t,n)=>e.length;function i4(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 a4(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 yFe=(e,t,n)=>a4(t4(e,t,n),!1),bFe=(e,t,n)=>a4(t4(e,t,n),!0),o4=(e,t,n)=>{let r=e[0];return $(r,t,q2.init(n).update({root:r}))??null},s4={int:{int:!0},pos:{min:1,int:!0},index:{min:0,int:!0},nzero:{min:0,max:0,int:!0}},xFe={int:{type:`integers`},obj:{type:`objects`}};function c4(e,t){return X(!e,t),null}function l4(e,t){let n=`${t} expression must resolve to object`;return X(!e,n),null}function u4(e,t){let n=`${t} expression must resolve to string`;return X(!e,n),null}function d4(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}`,X(!e,o),null}function f4(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 X(!e,i),null}var p4=(e,t,n)=>{let r=n.failOnError,i=n,a=e.length,o=$(i?.local?.groupId,t.n,i);return!b2(o)||o<1?d4(r,`$firstN 'n'`,s4.pos):t4(a<=o?e:e.slice(0,o),t.input,n)},m4=(e,t,n)=>{let r=e[e.length-1];return $(r,t,q2.init(n).update({root:r}))??null},h4=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,r),o=n.failOnError;return!b2(a)||a<1?d4(o,`$lastN 'n'`,s4.pos):t4(i<=a?e:e.slice(i-a),t.input,n)},SFe=(e,t,n)=>{let r=t4(e,t,n).filter(e=>!Q(e));return r.length?r.reduce((e,t)=>f2(e,t)>=0?e:t):null},g4=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,r);if(!b2(a)||a<1)return d4(n.failOnError,`$maxN 'n'`,s4.pos);let o=t4(e,t.input,n).filter(e=>!Q(e));return o.sort((e,t)=>-1*f2(e,t)),i<=a?o:o.slice(0,a)},_4=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`p`)&&Z(t.p),`$percentile expects object { input, p }`);let r=t4(e,t.input,n).filter(y2).sort(),i=t4(t.p,`$$CURRENT`,n),a=t.method||`approximate`;for(let e of i)if(!y2(e)||e<0||e>1)return c4(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]);switch(a){case`exact`:return i;case`approximate`:{let t=G2(r,i);return t/r.length>=e?r[Math.max(t-1,0)]:r[t]}}})},v4=(e,t,n)=>_4(e,{...t,p:[.5]},n)?.pop(),y4=(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},CFe=(e,t,n)=>{let r=t4(e,t,n).filter(e=>!Q(e));return r.length?r.reduce((e,t)=>f2(e,t)<=0?e:t):null},b4=(e,t,n)=>{let r=n,i=e.length,a=$(r?.local?.groupId,t.n,r);if(!b2(a)||a<1)return d4(n.failOnError,`$minN 'n'`,s4.pos);let o=t4(e,t.input,n).filter(e=>!Q(e));return o.sort(f2),i<=a?o:o.slice(0,a)},wFe=(e,t,n)=>i4(t4(e,t,n).filter(y2),!1),TFe=(e,t,n)=>i4(t4(e,t,n).filter(y2),!0),EFe=(e,t,n)=>y2(t)?e.length*t:t4(e,t,n).filter(y2).reduce((e,t)=>e+t,0),x4=(e,t,n)=>{let r=n,{n:i,sortBy:a}=$(r?.local?.groupId,t,r);return t4(n4(Z2(e),a,n).take(i).collect(),t.output,r)},DFe=(e,t,n)=>x4(e,{...t,n:1},n),OFe=e({$accumulator:()=>fFe,$addToSet:()=>pFe,$avg:()=>mFe,$bottom:()=>_Fe,$bottomN:()=>r4,$count:()=>vFe,$covariancePop:()=>yFe,$covarianceSamp:()=>bFe,$first:()=>o4,$firstN:()=>p4,$last:()=>m4,$lastN:()=>h4,$max:()=>SFe,$maxN:()=>g4,$median:()=>v4,$mergeObjects:()=>y4,$min:()=>CFe,$minN:()=>b4,$percentile:()=>_4,$push:()=>t4,$stdDevPop:()=>wFe,$stdDevSamp:()=>TFe,$sum:()=>EFe,$top:()=>DFe,$topN:()=>x4}),kFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.abs(r):d4(n.failOnError,`$abs`)},S4=`$add expression must resolve to array of numbers.`,AFe=(e,t,n)=>{let r=$(e,t,n),i=n.failOnError,a=!1,o=0;if(!Z(r))return c4(i,S4);for(let e of r){if(Q(e))return null;if(typeof e==`number`)o+=e;else if(C2(e)){if(a)return c4(i,`$add must only have one date`);a=!0,o+=+e}else return c4(i,S4)}return a?new Date(o):o},jFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.ceil(r):d4(n.failOnError,`$ceil`)},MFe=(e,t,n)=>{X(Z(t),`$divide expects array(2)`);let r=$(e,t,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=y2(e)}return a?r[1]===0?c4(i,`$divide cannot divide by zero`):r[0]/r[1]:f4(i,`$divide`,{size:2,type:`number`})},NFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.exp(r):d4(n.failOnError,`$exp`)},PFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.floor(r):d4(n.failOnError,`$floor`)},FFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.log(r):d4(n.failOnError,`$ln`)},IFe=(e,t,n)=>{let r=$(e,t,n);if(Z(r)&&r.length==2){let e=!0;for(let t of r){if(Q(t))return null;e&&=typeof t==`number`}if(e)return Math.log10(r[0])/Math.log10(r[1])}return f4(n.failOnError,`$log`,{size:2,type:`number`})},LFe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:typeof r==`number`?Math.log10(r):d4(n.failOnError,`$log10`)},RFe=(e,t,n)=>{let r=$(e,t,n),i=!Z(r)||r.length!=2;return i||=!r.every(e=>typeof e==`number`),i?f4(n.failOnError,`$mod`,{size:2,type:`number`}):r[0]%r[1]},zFe=(e,t,n)=>{X(Z(t),`$multiply expects array`);let r=$(e,t,n),i=n.failOnError;if(r.some(Q))return null;let a=1;for(let e of r){if(!y2(e))return f4(i,`$multiply`,{type:`number`});a*=e}return a},BFe=(e,t,n)=>{X(Z(t)&&t.length===2,`$pow expects array(2)`);let r=$(e,t,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=y2(e)}return a?(r[0]===0&&r[1]<0&&c4(i,`$pow cannot raise 0 to a negative exponent`),r[0]**+r[1]):f4(i,`$pow`,{size:2,type:`number`})};function C4(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(!y2(e))return d4(a,`${r} arg1 `);if(!b2(t)||t<-20||t>100)return d4(a,`${r} arg2 `,{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 VFe=(e,t,n)=>{X(Z(t),`$round expects array(2)`);let[r,i]=$(e,t,n);return C4(r,i??0,{name:`$round`,roundOff:!0,failOnError:n.failOnError})},w4=1e10,HFe=(e,t,n)=>{if(Q(t))return null;let r=$(e,t,n),{input:i,onNull:a}=x2(r)?r:{input:r};if(Q(i))return y2(a)?a:null;if(y2(i)){let e=1/(1+Math.exp(-i));return Math.round(e*w4)/w4}return d4(n.failOnError,`$sigmoid`)},UFe=(e,t,n)=>{let r=$(e,t,n),i=!n.failOnError;return Q(r)?null:typeof r!=`number`||r<0?(X(i,`$sqrt expression must resolve to non-negative number.`),null):Math.sqrt(r)},WFe=(e,t,n)=>{X(Z(t),`$subtract expects array(2)`);let r=$(e,t,n);if(r.some(Q))return null;let i=n.failOnError,[a,o]=r;return C2(a)&&y2(o)?new Date(+a-Math.round(o)):C2(a)&&C2(o)?a-+o:r.every(e=>typeof e==`number`)?a-o:y2(a)&&C2(o)?c4(i,`$subtract cannot subtract date from number`):f4(i,`$subtract`,{size:2,type:`number|date`})},GFe=(e,t,n)=>{X(Z(t),`$trunc expects array(2)`);let[r,i]=$(e,t,n);return C4(r,i??0,{name:`$trunc`,roundOff:!1,failOnError:n.failOnError})},T4=`$arrayElemAt`,KFe=(e,t,n)=>{X(Z(t)&&t.length===2,`${T4} expects array(2)`);let r=$(e,t,n);if(r.some(Q))return null;let i=n.failOnError,[a,o]=r;if(!Z(a))return f4(i,`${T4} arg1 `);if(!b2(o))return d4(i,`${T4} arg2 `,s4.int);if(o<0&&Math.abs(o)<=a.length)return a[(o+a.length)%a.length];if(o>=0&&o{let r=n.failOnError,i=$(e,t,n);if(Q(i))return null;if(!Z(i))return f4(r,`$arrayToObject`,E4.generic);let a=0,o={};for(let e of i)if(Z(e)){let t=M2(e);if(a||=1,a!==1)return f4(r,`$arrayToObject`,E4.object);let[n,i]=t;o[n]=i}else if(x2(e)&&O2(e,`k`,`v`)){if(a||=2,a!==2)return f4(r,`$arrayToObject`,E4.array);let{k:t,v:n}=e;o[t]=n}else return f4(r,`$arrayToObject`,E4.generic);return o},JFe=(e,t,n)=>{let r=$(e,t,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return f4(i,`$concatArrays`);let a=0;for(let e of r){if(Q(e))return null;if(!Z(e))return f4(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},YFe=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`cond`),`$filter expects object { input, as, cond, limit }`);let r=$(e,t.input,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return f4(i,`$filter 'input'`);let a=t.limit??Math.max(r.length,1);if(!b2(a)||a<1)return d4(i,`$filter 'limit'`,{min:1,int:!0});if(r.length===0)return[];let o=q2.init(n),s=t?.as||`this`,c={variables:{}},l=[];for(let i=0,u=0;i{if(Z(e))return o4(e,t,n);let r=$(e,t,n);return Q(r)?null:Z(r)?M2(r)[0]:f4(n.failOnError,`$first`)},ZFe=(e,t,n)=>{if(X(x2(t)&&O2(t,`input`,`n`),`$firstN expects object { input, n }`),Z(e))return p4(e,t,n);let{input:r,n:i}=$(e,t,n);return Q(r)?null:Z(r)?p4(r,{n:i,input:`$$this`},n):f4(n.failOnError,`$firstN 'input'`)},QFe=(e,t,n)=>{X(Z(t)&&t.length===2,`$in expects array(2)`);let[r,i]=$(e,t,n);if(!Z(i))return c4(n.failOnError,`$in arg2 `);for(let e of i)if(m2(e,r))return!0;return!1},D4=`$indexOfArray`,$Fe=(e,t,n)=>{X(Z(t)&&t.length>1&&t.length<5,`${D4} expects array(4)`);let r=$(e,t,n),i=n.failOnError,a=r[0];if(Q(a))return null;if(!Z(a))return f4(i,`${D4} arg1 `);let o=r[1],s=r[2]??0,c=r[3]??a.length;return!b2(s)||s<0?d4(i,`${D4} arg3 `,s4.pos):!b2(c)||c<0?d4(i,`${D4} arg4 `,s4.pos):s>c?-1:(s>0||cm2(e,o))+s},eIe=(e,t,n)=>{let r=t;return Z(t)&&(X(t.length===1,`$isArray expects array(1)`),r=t[0]),Z($(e,r,n))},tIe=(e,t,n)=>{if(Z(e))return m4(e,t,n);let r=$(e,t,n);return Q(r)?null:!Z(r)||r.length===0?f4(n.failOnError,`$last`,{size:0}):M2(r)[r.length-1]},nIe=(e,t,n)=>{if(X(x2(t)&&O2(t,`input`,`n`),`$lastN expects object { input, n }`),Z(e))return h4(e,t,n);let{input:r,n:i}=$(e,t,n);return Q(r)?null:Z(r)?h4(r,{n:i,input:`$$this`},n):f4(n.failOnError,`$lastN 'input'`)},rIe=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`in`),`$map expects object { input, as, in }`);let r=$(e,t.input,n),i=n.failOnError;if(Q(r))return null;if(!Z(r))return f4(i,`$map 'input'`);if(!Q(t.as)&&!v2(t.as))return u4(i,`$map 'as'`);let a=q2.init(n),o=t.as||`this`,s={variables:{}};return r.map(n=>(s.variables[o]=n,$(e,t.in,a.update(s))))},iIe=(e,t,n)=>{if(X(x2(t)&&O2(t,`input`,`n`),`$maxN expects object { input, n }`),Z(e))return g4(e,t,n);let{input:r,n:i}=$(e,t,n);return Q(r)?null:Z(r)?g4(r,{n:i,input:`$$this`},n):f4(n.failOnError,`$maxN 'input'`)},aIe=(e,t,n)=>{if(X(x2(t)&&O2(t,`input`,`n`),`$minN expects object { input, n }`),Z(e))return b4(e,t,n);let{input:r,n:i}=$(e,t,n);return Q(r)?null:Z(r)?b4(r,{n:i,input:`$$this`},n):f4(n.failOnError,`$minN 'input'`)},oIe=(e,t,n)=>{X(Z(t)&&t.length>1&&t.length<4,`$range expects array(3)`);let[r,i,a]=$(e,t,n),o=n.failOnError,s=a??1;if(!b2(r))return d4(o,`$range arg1 `,s4.int);if(!b2(i))return d4(o,`$range arg2 `,s4.int);if(!b2(s)||s===0)return d4(o,`$range arg3 `,s4.nzero);let c=[],l=r;for(;l0||l>i&&s<0;)c.push(l),l+=s;return c};function sIe(e,t,n){X(x2(t)&&O2(t,`input`,`initialValue`,`in`),`$reduce expects object { input, initialValue, in }`);let r=$(e,t.input,n),i=$(e,t.initialValue,n),a=t.in;if(Q(r))return null;if(!Z(r))return f4(n.failOnError,`$reduce 'input'`);let o=q2.init(n),s={variables:{value:null}},c=i;for(let e=0;e{let r=$(e,t,n);return Q(r)?null:Z(r)?r.slice().reverse():f4(n.failOnError,`$reverseArray`)},lIe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:Z(r)?r.length:d4(n.failOnError,`$size`)},O4=(e,t,n)=>{X(Z(t)&&t.length>1&&t.length<4,`$slice expects array(3)`);let r=n.failOnError,i=$(e,t,n),a=i[0],o=i[1],s=i[2];if(!Z(a))return f4(r,`$slice arg1 `);if(!b2(o))return d4(r,`$slice arg2 `,s4.int);if(!Q(s)&&!b2(s))return d4(r,`$slice arg3 `,s4.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 d4(r,`$slice arg3 `,s4.pos);s+=o}return a.slice(o,s)},uIe=(e,t,n)=>{X(x2(t)&&`input`in t&&`sortBy`in t,`$sortArray expects object { input, sortBy }`);let{input:r,sortBy:i}=$(e,t,n);if(Q(r))return null;if(!Z(r))return f4(n.failOnError,`$sortArray 'input'`);if(x2(i))return n4(Z2(r),i,n).collect();let a=r.slice().sort(f2);return i===-1&&a.reverse(),a},dIe=(e,t,n)=>{X(x2(t)&&O2(t,`inputs`),`$zip received invalid arguments`);let r=$(e,t.inputs,n),i=$(e,t.defaults,n)??[],a=t.useLongestLength??!1,o=n.failOnError;if(Q(r))return null;if(!Z(r))return f4(o,`$zip 'inputs'`);let s=0;for(let e of r){if(Q(e))return null;Z(e)||s++}if(s)return f4(o,`$zip elements of 'inputs'`);_2(a)||c4(o,`$zip 'useLongestLength' must be boolean`),Z(i)&&i.length>0&&X(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;eQ(t[e])?i[n]??null:t[e]);l.push(t)}return l};function k4(e,t,n,r,i){X(Z(t),`${r} expects array as argument`);let a=$(e,t,n),o=!0;for(let e of a){if(Q(e))return null;o&&=b2(e)}return o?i(a):c4(n.failOnError,`${r} array elements must resolve to integers`)}var fIe=(e,t,n)=>k4(e,t,n,`$bitAnd`,e=>e.reduce((e,t)=>e&t,-1)),pIe=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:b2(r)?~r:d4(n.failOnError,`$bitNot`,s4.int)},mIe=(e,t,n)=>k4(e,t,n,`$bitOr`,e=>e.reduce((e,t)=>e|t,0)),hIe=(e,t,n)=>k4(e,t,n,`$bitXor`,e=>e.reduce((e,t)=>e^t,0)),gIe=(e,t,n)=>{X(Z(t),`$and expects array`);let r=n.useStrictMode;return t.every(t=>T2($(e,t,n),r))},_Ie=(e,t,n)=>{let r=D2(t);return r.length===0?!1:r.length>1?f4(n.failOnError,`$not`,{size:1}):!$(e,r[0],n)},vIe=(e,t,n)=>{X(Z(t),`$or expects array of expressions`);let r=n.useStrictMode;for(let i of t)if(T2($(e,i,n),r))return!0;return!1},yIe=(e,t,n)=>{X(Z(t)&&t.length===2,`$cmp expects array(2)`);let[r,i]=$(e,t,n);return f2(r,i)};function A4(e,t,n){return e.take(t)}function j4(e,t,n){let r=$(null,t,n);X(Z(r),`$documents expression must resolve to an array.`);let i=Z2(r);return n.processingMode&K2.CLONE_ALL?i.map(e=>A2(e)):i}var bIe=Z2([]);function M4(e,t){if(!e)return{};let n=e[0]?.$documents;return n?{documents:j4(bIe,n,t).collect(),pipeline:e.slice(1)}:{pipeline:e}}function N4(e,t,n=!0){let r={exclusions:[],inclusions:[],positional:0},i=Object.keys(e);X(i.length,`Invalid empty sub-projection`);let a=t?.idKey,o=!1;for(let s of i){if(s.startsWith(`$`))return X(!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||y2(c)&&c===0)s===a?o=!0:r.exclusions.push(s);else if(!x2(c))r.inclusions.push(s);else{let e=N4(c,t,!1);if(!e.inclusions.length&&!e.exclusions.length)r.inclusions.includes(s)||r.inclusions.push(s);else{for(let t of e.exclusions)r.exclusions.push(`${s}.${t}`);for(let t of e.inclusions)r.inclusions.push(`${s}.${t}`)}r.positional+=e.positional}X(!(r.exclusions.length&&r.inclusions.length),`Cannot do exclusion and inclusion in projection.`),X(r.positional<=1,`Cannot specify more than one positional projection.`)}if(o&&r.exclusions.push(a),n){let e=new sFe;for(let t of r.exclusions)X(e.add(t),`Path collision at ${t}.`);for(let t of r.inclusions)X(e.add(t),`Path collision at ${t}.`);r.exclusions.sort(),r.inclusions.sort()}return r}function P4(e,t,n){v2(t)&&X(n.collectionResolver,`${e} requires 'collectionResolver' option to resolve named collection`);let r=v2(t)?n.collectionResolver(t):t;return X(Z(r),`${e} could not resolve input collection`),r}var F4=`$project`;function I4(e,t,n){if(E2(t))return e;let r=N4(t,n),i=xIe(t,q2.init(n),r);return e.map(i)}function xIe(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)=>{H2(t,e,{descendArray:!0})};for(let n of a){let r=I2(e,n)??e[n];if(n.endsWith(`.$`)&&r===1){let e=t?.local?.condition??{};X(e,`${F4}: positional operator '.$' requires array condition.`);let r=n.slice(0,-2);o[r]=wIe(r,e,t);continue}if(Z(r))o[n]=(e,i)=>{t.update({root:i}),V2(e,n,r.map(e=>$(i,e,t)??null))};else if(y2(r)||r===!0)o[n]=(e,r)=>{t.update({root:r}),R4(e,L2(r,n,s))};else if(!x2(r))o[n]=(e,i)=>{t.update({root:i}),V2(e,n,$(i,r,t))};else{let e=Object.keys(r);X(e.length===1&&U2(e[0]),`Not a valid operator`);let i=e[0],a=r[i],s=t.context.getOperator(J2.PROJECTION,i);!s||i===`$slice`&&!D2(a).every(y2)?o[n]=(e,i)=>{t.update({root:i}),V2(e,n,$(i,r,t))}:o[n]=(e,r)=>{t.update({root:r}),V2(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||R2(t),l&&!O2(t,r)&&O2(e,r)&&(t[r]=I2(e,r)),t}}var L4=(e,t,n,r)=>{let i=I2(e,t);Z(i)||(i=I2(i,n)),X(Z(i),`${F4}: field '${t}' must resolve to array`);let a=[];for(let e=0;e(t=>!e(t)),CIe={$and:1,$or:1,$nor:1};function wIe(e,t,n){let r=Object.entries(t).slice(),i={$and:[],$or:[]};for(let t=0;t{let r=[];for(let[e,t,a]of i.$and)r.push(L4(n,e,a,t));if(i.$or.length){let e=[];for(let[t,r,a]of i.$or)e.push(...L4(n,t,a,r));r.push(N2(e))}let a=j2(r).sort()[0],c=I2(n,e)[a];o!=s&&!x2(c)&&(c={[s]:c}),V2(t,o,[c])}}function R4(e,t){if(e===o2||Q(e))return t;if(Q(t))return e;let n=e,r=t;for(let e of Object.keys(t))n[e]=R4(n[e],r[e]);return n}function z4(e,t,n){return X(t>=0,`$skip value must be a non-negative integer`),e.drop(t)}var B4={$sort:n4,$skip:z4,$limit:A4},TIe=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=Z2(this.#e).filter(this.#t);let e=this.#r.processingMode;e&K2.CLONE_INPUT&&this.#a.map(e=>A2(e));for(let e of Object.keys(B4))if(O2(this.#i,e)){let t=B4[e];this.#a=t(this.#a,this.#i[e],this.#r)}return Object.keys(this.#n).length&&(this.#a=I4(this.#a,this.#n,this.#r)),e&K2.CLONE_OUTPUT&&this.#a.map(e=>A2(e)),this.#a}fetchAll(){let e=Z2(Array.from(this.#o));return this.#o.length=0,Q2(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()}},EIe=new Set([`$and`,`$or`,`$nor`,`$expr`,`$jsonSchema`]),V4=class{#e;#t;#n;constructor(e,t){this.#t=A2(e),this.#n=q2.init(t).update({condition:e}),this.#e=[],this.compile()}compile(){X(x2(this.#t),`query criteria must be an object: ${JSON.stringify(this.#t)}`);let e={};for(let t of Object.keys(this.#t)){let n=this.#t[t];if(t===`$where`)X(this.#n.scriptEnabled,`$where operator requires 'scriptEnabled' option to be true.`),Object.assign(e,{field:t,expr:n});else if(EIe.has(t))this.processOperator(t,t,n);else{X(!U2(t),`unknown top level operator: ${t}`);let e=W2(n);for(let n of Object.keys(e))this.processOperator(t,n,e[n])}e.field&&this.processOperator(e.field,e.field,e.expr)}}processOperator(e,t,n){let r=this.#n.context.getOperator(J2.QUERY,t);X(!!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 TIe(e,e=>this.test(e),t||{},this.#n)}};function H4(e,t){let n=e=>e,r=!0;for(let t of Object.keys(e))if(r&&=U2(t)&&t!==`$and`&&t!==`$or`&&t!==`$nor`,!r)break;r&&(e={field:e},n=e=>({field:e}));let i=new V4(e,t);return e=>i.test(n(e))}function U4(e,t,n,r){let i=e.split(`.`),a=Math.max(1,i.length-1),o=q2.init(n).update({depth:a}),s={unwrapArray:!0,pathArray:i};return r===Q4&&(t=H4(t,n)),n=>r(I2(n,e,s),t,o)}function W4(e,t,n,r){X(Z(t)&&t.length===2,`${r.name} expects array(2)`);let[i,a]=$(e,t,n);return r(i,a,n)}function G4(e,t,n){if(m2(e,t)||Q(e)&&Q(t))return!0;if(Z(e)){let r=n?.local?.depth??1;return e.some(e=>m2(e,t))||M2(e,r).some(e=>m2(e,t))}return!1}function K4(e,t,n){return!G4(e,t,n)}function q4(e,t,n){return Q(e)?t.some(e=>e===null):j2([D2(e),t]).length>0}function DIe(e,t,n){return!q4(e,t,n)}function J4(e,t,n){return t3(e,t,(e,t)=>f2(e,t)<0)}function Y4(e,t,n){return t3(e,t,(e,t)=>f2(e,t)<=0)}function X4(e,t,n){return t3(e,t,(e,t)=>f2(e,t)>0)}function Z4(e,t,n){return t3(e,t,(e,t)=>f2(e,t)>=0)}function OIe(e,t,n){return D2(e).some((e=>t.length===2&&e%t[0]===t[1]))}function kIe(e,t,n){let r=D2(e),i=e=>v2(e)&&T2(t.exec(e),n?.useStrictMode);return r.some(i)||M2(r,1).some(i)}function AIe(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;if(x2(i)&&Object.keys(i)[0]===`$elemMatch`){let t=i.$elemMatch;r=Q4(e,H4(t,n),n)}else r=w2(i)?e.some(e=>v2(e)&&i.test(e)):e.some(e=>m2(i,e))}return r}function jIe(e,t,n){return Array.isArray(e)&&e.length===t}function Q4(e,t,n){if(Z(e)&&!E2(e)){for(let n=0,r=e.length;ne===null,MIe={array:Z,boolean:_2,bool:_2,date:C2,number:y2,int:y2,long:y2,double:y2,decimal:y2,null:$4,object:x2,regexp:w2,regex:w2,string:v2,undefined:Q,1:y2,2:v2,3:x2,4:Z,6:Q,8:_2,9:C2,10:$4,11:w2,16:y2,18:y2,19:y2};function e3(e,t,n){let r=MIe[t];return r?r(e):!1}function NIe(e,t,n){return Z(t)?t.findIndex(t=>e3(e,t,n))>=0:e3(e,t,n)}function t3(e,t,n){for(let r of D2(e))if(g2(r)===g2(t)&&n(r,t))return!0;return!1}var PIe=(e,t,n)=>W4(e,t,n,G4),FIe=(e,t,n)=>W4(e,t,n,X4),IIe=(e,t,n)=>W4(e,t,n,Z4),LIe=(e,t,n)=>W4(e,t,n,J4),RIe=(e,t,n)=>W4(e,t,n,Y4),zIe=(e,t,n)=>W4(e,t,n,K4),n3=`$cond expects array(3) or object with 'if-then-else' expressions`,BIe=(e,t,n)=>{let r,i,a;return Z(t)?(X(t.length===3,n3),r=t[0],i=t[1],a=t[2]):(X(x2(t),n3),r=t.if,i=t.then,a=t.else),$(e,T2($(e,r,n),n.useStrictMode)?i:a,n)},r3=(e,t,n)=>{X(Z(t),`$ifNull expects an array`);let r;for(let i of t)if(r=$(e,i,n),!Q(r))return r;return r},VIe=(e,t,n)=>{X(x2(t),`$switch received invalid arguments`);for(let{case:r,then:i}of t.branches)if(T2($(e,r,n),n.useStrictMode))return $(e,i,n);return $(e,t.default,n)},i3=(e,t,n)=>{X(n.scriptEnabled,`$function requires 'scriptEnabled' option to be true`);let r=$(e,t,n);return r.body.apply(null,r.args)},a3=[`year`,`quarter`,`month`,`week`,`day`,`hour`,`minute`,`second`,`millisecond`],HIe={mon:1,tue:2,wed:3,thu:4,fri:5,sat:6,sun:7},UIe=-1e9,o3=e=>(e&3)==0&&(e%100!=0||e%400==0),WIe=[365,366],GIe=[[0,31,59,90,120,151,181,212,243,273,304,334],[0,31,60,91,121,152,182,213,244,274,305,335]],s3=e=>GIe[+o3(e.getUTCFullYear())][e.getUTCMonth()]+e.getUTCDate(),c3=(e,t)=>((e.getUTCDay()||7)-HIe[t.toLowerCase().substring(0,3)]+7)%7,l3=e=>(e+Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400))%7,u3=e=>52+Number(l3(e)==4||l3(e-1)==3);function d3(e){let t=e.getUTCDay()||7,n=Math.floor((10+s3(e)-t)/7);return n<1?u3(e.getUTCFullYear()-1):n>u3(e.getUTCFullYear())?1:n}function f3(e){let t=d3(e);return e.getUTCDay()>0&&e.getUTCDate()==1&&e.getUTCMonth()==0?0:e.getUTCDay()==0?t+1:t}function p3(e){return e.getUTCFullYear()-Number(e.getUTCMonth()===0&&e.getUTCDate()==1&&e.getUTCDay()<1)}var m3={week:6048e5,day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},h3=[[`year`,0,9999],[`month`,1,12],[`day`,1,31],[`hour`,0,23],[`minute`,0,59],[`second`,0,59],[`millisecond`,0,999]],g3={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},_3={"%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:/%%/}},v3=/(%[bBYGmdjHMSLwuUVzZ%])/g,KIe=/%[bBYGmdjHMSLwuUVzZ%]/,qIe=/^[a-zA-Z_]+\/[a-zA-Z_]+$/;function y3(e,t){if(e===void 0)return 0;if(qIe.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=_3[`%z`].re.exec(e)??[];X(!!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 JIe(e){return(e<0?`-`:`+`)+S3(Math.abs(Math.floor(e/60)),2)+S3(Math.abs(e)%60,2)}function b3(e,t){e.setUTCMinutes(e.getUTCMinutes()+t)}function x3(e,t,n){if(C2(e))return e;let r=$(e,t,n);if(C2(r))return new Date(r);if(y2(r))return new Date(r*1e3);X(!!r?.date,`cannot convert ${JSON.stringify(t)} to date`);let i=C2(r.date)?new Date(r.date):new Date(r.date*1e3);return r.timezone&&b3(i,y3(r.timezone,i)),i}function S3(e,t){return Array(Math.max(t-String(e).length+1,0)).join(`0`)+e.toString()}var C3=e=>{let t=e-UIe;return Math.trunc(t/4)-Math.trunc(t/100)+Math.trunc(t/400)};function YIe(e,t){return Math.trunc(C3(t-1)-C3(e-1)+(t-e)*WIe[0])}var w3=(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),T3=(e,t)=>t.getUTCMonth()-e.getUTCMonth()+w3(e,t)*12,E3=(e,t)=>{let n=Math.trunc(e.getUTCMonth()/3);return Math.trunc(t.getUTCMonth()/3)-n+w3(e,t)*4},D3=(e,t)=>s3(t)-s3(e)+YIe(e.getUTCFullYear(),t.getUTCFullYear()),O3=(e,t,n)=>{let r=(n||`sun`).substring(0,3);return Math.trunc((D3(e,t)+c3(e,r)-c3(t,r))/7)},XIe=(e,t)=>t.getUTCHours()-e.getUTCHours()+D3(e,t)*24,k3=(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())},A3=(e,t,n,r)=>{let i=new Date(e);switch(t){case`year`:i.setUTCFullYear(i.getUTCFullYear()+n);break;case`quarter`:k3(i,3*n);break;case`month`:k3(i,n);break;default:i.setTime(i.getTime()+m3[t]*n)}return i},j3=(e,t,n)=>{let r=$(e,t,n);return A3(r.startDate,r.unit,r.amount,r.timezone)},ZIe=(e,t,n)=>{let{startDate:r,endDate:i,unit:a,timezone:o,startOfWeek:s}=$(e,t,n),c=new Date(r),l=new Date(i);switch(b3(c,y3(o,c)),b3(l,y3(o,l)),a){case`year`:return w3(c,l);case`quarter`:return E3(c,l);case`month`:return T3(c,l);case`week`:return O3(c,l,s);case`day`:return D3(c,l);case`hour`:return XIe(c,l);case`minute`:return c.setUTCSeconds(0),c.setUTCMilliseconds(0),l.setUTCSeconds(0),l.setUTCMilliseconds(0),Math.round((l.getTime()-c.getTime())/m3[a]);default:return Math.round((l.getTime()-c.getTime())/m3[a])}},QIe=[31,28,31,30,31,30,31,31,30,31,30,31],$Ie=e=>e.month==2&&o3(e.year)?29:QIe[e.month-1],eLe=(e,t,n)=>{let r=$(e,t,n),i=y3(r.timezone,new Date);for(let e=h3.length-1,t=0;e>=0;e--){let n=h3[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),cs&&(c+=o,t=Math.trunc(c/l),c%=l);r[a]=c}return r.day=Math.min(r.day,$Ie(r)),new Date(Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond))};function tLe(e){return e===`Z`?0:e>=`A`&&e<`N`?e.charCodeAt(0)-64:77-e.charCodeAt(0)}var nLe=e=>e.replace(/^\//,``).replace(/\/$/,``).replace(/\/i/,``),rLe=[`^`,`.`,`-`,`*`,`?`,`$`];function iLe(e){for(let t of rLe)e=e.replace(t,`\\${t}`);return e}function aLe(e,t,n){let r=$(e,t,n),i=r.format||`%Y-%m-%dT%H:%M:%S.%LZ`,a=r.onNull||null,o=r.dateString;if(Q(o))return a;let s=i.split(KIe);s.reverse();let c=i.match(v3),l={},u=``;for(let e=0,t=c.length;e{let r=$(e,t,n);return A3(r.startDate,r.unit,-r.amount,r.timezone)},sLe=(e,t,n)=>{let r=$(e,t,n),i=new Date(r.date);b3(i,y3(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:p3(i),isoWeek:d3(i),isoDayOfWeek:i.getUTCDay()||7}):Object.assign(a,{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate()})},cLe={"%Y":e=>e.getUTCFullYear(),"%G":e=>e.getUTCFullYear(),"%m":e=>e.getUTCMonth()+1,"%d":e=>e.getUTCDate(),"%H":e=>e.getUTCHours(),"%M":e=>e.getUTCMinutes(),"%S":e=>e.getUTCSeconds(),"%L":e=>e.getUTCMilliseconds(),"%u":e=>e.getUTCDay()||7,"%U":f3,"%V":d3,"%j":s3,"%w":e=>e.getUTCDay()},lLe=(e,t,n)=>{let r=$(e,t,n);if(Q(r.onNull)&&(r.onNull=null),Q(r.date))return r.onNull;let i=x3(e,r.date,n),a=r.format??`%Y-%m-%dT%H:%M:%S.%LZ`,o=y3(r.timezone,i),s=a.match(v3);if(!s)return a;b3(i,o);for(let e=0,t=s.length;e{let n=e%t;return n<0&&(n+=t),n},uLe={day:D3,month:T3,quarter:E3,year:w3},dLe=/(mon(day)?|tue(sday)?|wed(nesday)?|thu(rsday)?|fri(day)?|sat(urday)?|sun(day)?)/i,fLe=(e,t,n)=>{let{date:r,unit:i,binSize:a,timezone:o,startOfWeek:s}=$(e,t,n);if(Q(r)||Q(i))return null;let c=(s??`sun`).toLowerCase().substring(0,3);X(C2(r),`$dateTrunc: 'date' must resolve to a valid Date object.`),X(a3.includes(i),`$dateTrunc: unit is invalid.`),X(i!=`week`||dLe.test(c),`$dateTrunc: startOfWeek '${c}' is not a valid.`),X(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*m3[i],t=r.getTime()-M3;return new Date(r.getTime()-N3(t,e))}default:{X(l<=1e11,`dateTrunc unsupported binSize value`);let e=new Date(r),t=new Date(M3),n=0;if(i==`week`){let r=(7-c3(t,c))%7;t.setTime(t.getTime()+r*m3.day),n=O3(t,e,c)}else n=uLe[i](t,e);let a=A3(t,i,n-N3(n,l),o);return b3(a,-y3(o,a)),a}}},pLe=(e,t,n)=>x3(e,t,n).getUTCDate(),mLe=(e,t,n)=>x3(e,t,n).getUTCDay()+1,hLe=(e,t,n)=>s3(x3(e,t,n)),gLe=(e,t,n)=>x3(e,t,n).getUTCHours(),_Le=(e,t,n)=>x3(e,t,n).getUTCDay()||7,vLe=(e,t,n)=>d3(x3(e,t,n)),yLe=(e,t,n)=>p3(x3(e,t,n)),bLe=(e,t,n)=>x3(e,t,n).getUTCMilliseconds(),xLe=(e,t,n)=>x3(e,t,n).getUTCMinutes(),SLe=(e,t,n)=>x3(e,t,n).getUTCMonth()+1,CLe=(e,t,n)=>x3(e,t,n).getUTCSeconds(),wLe=(e,t,n)=>f3(x3(e,t,n)),TLe=(e,t,n)=>x3(e,t,n).getUTCFullYear(),ELe=(e,t,n)=>t,DLe=(e,t,n)=>v4($(e,t.input,n),{input:`$$CURRENT`,method:t.method},n),OLe=(e,t,n)=>{let r=$(e,t,n),{field:i,input:a}=v2(r)?{field:r,input:e}:{field:r.field,input:r.input??e};return a[i]},kLe=(e,t,n)=>Math.random(),ALe=(e,t,n)=>Math.random()<=$(e,t,n),P3=(e,t,n)=>{let r=$(e,t,n);return Q(r)?{}:Z(r)?y4(r,t,n):f4(n.failOnError,`$mergeObjects`,xFe.obj)},jLe=(e,t,n)=>{let r=$(e,t,n);if(Q(r))return null;if(!x2(r))return l4(n.failOnError,`$objectToArray`);let i=Object.keys(r),a=Array(i.length),o=0;for(let e of i)a[o++]={k:e,v:r[e]};return a},F3=`$setField`,I3=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`field`,`value`),`$setField expects object { input, field, value }`);let{input:r,field:i,value:a}=$(e,t,n);if(Q(r))return null;let o=n.failOnError;if(!x2(r))return l4(o,`${F3} 'input'`);if(!v2(i))return u4(o,`${F3} 'field'`);let s={...r};return t.value==`$$REMOVE`?delete s[i]:s[i]=a,s},MLe=(e,t,n)=>I3(e,{...t,value:`$$REMOVE`},n),NLe=(e,t,n)=>_4($(e,t.input,n),{...t,input:`$$CURRENT`},n),PLe=(e,t,n)=>{if(Z(t)){if(t.length===0)return!0;X(t.length===1,`$allElementsTrue expects array(1)`),t=t[0]}let r=n.failOnError,i=$(e,t,n);if(!Z(i))return f4(r,`$allElementsTrue argument`);for(let e of i)if(!T2(e,n.useStrictMode))return!1;return!0},FLe=(e,t,n)=>{if(Z(t)){if(t.length===0)return!1;X(t.length===1,`$anyElementTrue expects array(1)`),t=t[0]}let r=n.failOnError,i=$(e,t,n);if(!Z(i))return f4(r,`$anyElementTrue argument`);for(let e of i)if(T2(e,n.useStrictMode))return!0;return!1},L3=`$setDifference`,ILe=(e,t,n)=>{X(Z(t)&&t.length==2,`${L3} expects array(2)`);let r=$(e,t,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=Z(e)}if(!a)return f4(i,`${L3} arguments`);let o=h2.init();for(let e of r[0])o.set(e,!0);for(let e of r[1])o.delete(e);return Array.from(o.keys())},LLe=(e,t,n)=>{X(Z(t),`$setEquals expects array`);let r=$(e,t,n),i=n.failOnError;if(!r.every(Z))return f4(i,`$setEquals arguments`);let a=h2.init(),o=r[0];for(let e=0;e{X(Z(t),`${R3} expects array`);let r=$(e,t,n),i=n.failOnError,a=!0;for(let e of r){if(Q(e))return null;a&&=Z(e)}return a?j2(r):f4(i,`${R3} arguments`)},z3=`$setIsSubset`,zLe=(e,t,n)=>{X(Z(t)&&t.length===2,`${z3} expects array(2)`);let r=$(e,t,n);if(!r.every(Z))return f4(n.failOnError,`${z3} arguments`);let[i,a]=r,o=h2.init();for(let e of a)o.set(e,0);for(let e of i)if(!o.has(e))return!1;return!0},BLe=(e,t,n)=>{let r=$(e,t,n),i=n.failOnError;return Q(r)?null:Z(r)?Z(t)?r.every(Z)?N2(M2(r)):f4(i,`$setUnion arguments`):N2(r):f4(i,`$setUnion`)},VLe=(e,t,n)=>{X(Z(t),`$concat expects array`);let r=n.failOnError,i=$(e,t,n),a=!0;for(let e of i){if(Q(e))return null;a&&=v2(e)}return a?i.join(``):f4(r,`$concat`,{type:`string`})},B3=`$indexOfBytes`,HLe=(e,t,n)=>{X(Z(t)&&t.length>1&&t.length<5,`${B3} expects array(4)`);let r=$(e,t,n),i=n.failOnError,a=r[0];if(Q(a))return null;if(!v2(a))return u4(i,`${B3} arg1 `);let o=r[1];if(!v2(o))return u4(i,`${B3} arg2 `);let s=r[2]??0,c=r[3]??a.length;if(!b2(s)||s<0)return d4(i,`${B3} arg3 `,s4.index);if(!b2(c)||c<0)return d4(i,`${B3} arg4 `,s4.index);if(s>c)return-1;let l=a.substring(s,c).indexOf(o);return l>-1?l+s:l},ULe=[0,32,9,10,11,12,13,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202];function V3(e,t,n,r){let i=$(e,t,n),a=i.input;if(Q(a))return null;let o=Q(i.chars)?ULe: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 H3(e,t,n,r){let i=$(e,t,n);if(!v2(i.input))return[];let a=i.options;a&&(X(a.indexOf(`x`)===-1,`extended capability option 'x' not supported`),X(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;tV3(e,t,n,{left:!0,right:!1}),GLe=(e,t,n)=>{let r=H3(e,t,n,{global:!1});return Z(r)&&r.length>0?r[0]:null},KLe=(e,t,n)=>H3(e,t,n,{global:!0}),qLe=(e,t,n)=>H3(e,t,n,{global:!1})?.length!=0,U3=`$replaceAll`,JLe=(e,t,n)=>{X(x2(t),`${U3} expects an object argument`);let r=n.failOnError,{input:i,find:a,replacement:o}=$(e,t,n);return Q(i)||Q(a)||Q(o)?null:v2(i)?v2(a)?v2(o)?i.replace(new RegExp(a,`g`),o):u4(r,`${U3} 'replacement'`):u4(r,`${U3} 'find'`):u4(r,`${U3} 'input'`)},W3=`$replaceOne`,YLe=(e,t,n)=>{let r=n.failOnError,i=$(e,t,n),{input:a,find:o,replacement:s}=i;return Q(a)||Q(o)||Q(s)?null:v2(a)?v2(o)?v2(s)?i.input.replace(i.find,i.replacement):u4(r,`${W3} 'replacement'`):u4(r,`${W3} 'find'`):u4(r,`${W3} 'input'`)},XLe=(e,t,n)=>V3(e,t,n,{left:!1,right:!0}),ZLe=(e,t,n)=>{X(Z(t)&&t.length===2,`$split expects array(2)`);let r=$(e,t,n),i=n.failOnError;return Q(r[0])?null:r.every(v2)?r[0].split(r[1]):f4(i,`$split `,{size:2,type:`string`})},QLe=(e,t,n)=>{X(Z(t)&&t.length===2,`$strcasecmp expects array(2)`);let r=$(e,t,n),i=n.failOnError,a=!0,o=!0;for(let e of r)a&&=Q(e),o&&=v2(e);return a?0:o?u2(r[0].toLowerCase(),r[1].toLowerCase()):f4(i,`$strcasecmp arguments`,{type:`string`})},$Le=(e,t,n)=>{let r=$(e,t,n);return v2(r)?~-encodeURI(r).split(/%..|./).length:u4(n.failOnError,`$strLenBytes`)},eRe=(e,t,n)=>{let r=$(e,t,n);return v2(r)?r.length:u4(n.failOnError,`$strLenCP`)},G3=`$substrBytes`,K3=(e,t,n)=>{X(Z(t)&&t.length===3,`${G3} expects array(3)`);let[r,i,a]=$(e,t,n),o=n.failOnError,s=Q(r);if(!s&&!v2(r))return u4(o,`${G3} arg1 `);if(!b2(i)||i<0)return d4(o,`${G3} arg2 `,s4.index);if(!b2(a)||a<0)return d4(o,`${G3} arg3 `,s4.index);if(s)return``;let c=0,l=null,u=null,d=`${G3} UTF-8 boundary falls inside a continuation byte`;for(let e=0;e65535?2:1;if(l===null){if(i>c&&ic&&f{X(Z(t)&&t.length===3,`${q3} expects array(3)`);let[r,i,a]=$(e,t,n),o=Q(r),s=n.failOnError;return!o&&!v2(r)?u4(s,`${q3} arg1 `):b2(i)?b2(a)?o||i<0?``:a<0?r.substring(i):r.substring(i,i+a):d4(s,`${q3} arg3 `):d4(s,`${q3} arg2 `)},J3=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:v2(r)?!0:!!r},Y3=(e,t,n)=>{let r=$(e,t,n);if(C2(r))return r;if(Q(r))return null;let i=new Date(r);return X(!isNaN(i.getTime()),`cannot convert '${r}' to date`),i},X3=(e,t,n)=>{let r=$(e,t,n);if(Q(r))return null;if(C2(r))return r.getTime();if(r===!0)return 1;if(r===!1)return 0;let i=Number(r);return X(y2(i),`cannot convert '${r}' to double/decimal`),i},rRe=2147483647,iRe=-2147483648,aRe=9007199254740991,oRe=-9007199254740991;function Z3(e,t,n,r,i){let a=$(e,t,n);if(a===!0)return 1;if(a===!1)return 0;if(Q(a))return null;if(C2(a))return a.getTime();let o=Number(a);return X(y2(o)&&o>=r&&o<=i&&(!v2(a)||o.toString().indexOf(`.`)===-1),`cannot convert '${a}' to ${i==2147483647?`int`:`long`}`),Math.trunc(o)}var Q3=(e,t,n)=>Z3(e,t,n,iRe,rRe),$3=(e,t,n)=>Z3(e,t,n,oRe,aRe),e6=(e,t,n)=>{let r=$(e,t,n);return Q(r)?null:C2(r)?r.toISOString():s2(r)||w2(r)?String(r):c4(n.failOnError,`$toString cannot convert from object to string`)},sRe=(e,t,n)=>{X(x2(t)&&O2(t,`input`,`to`),`$convert expects object { input, to, onError, onNull }`);let r=$(e,t.input,n);if(Q(r))return $(e,t.onNull,n)??null;let i=$(e,t.to,n);try{switch(i){case 2:case`string`:return e6(e,r,n);case 8:case`boolean`:case`bool`:return J3(e,r,n);case 9:case`date`:return Y3(e,r,n);case 1:case 19:case`double`:case`decimal`:case`number`:return X3(e,r,n);case 16:case`int`:return Q3(e,r,n);case 18:case`long`:return $3(e,r,n)}}catch{}return t.onError===void 0?c4(n.failOnError,`$convert cannot convert from object to ${t.to} with no onError value`):$(e,t.onError,n)},cRe=(e,t,n)=>y2($(e,t,n)),lRe=X3,uRe=(e,t,n)=>{let r=$(e,t,n);if(n.useStrictMode){if(r===void 0)return`missing`;if(r===!0||r===!1)return`bool`;if(y2(r))return r%1==0?r>=-2147483648&&r<=2147483647?`int`:`long`:`double`;if(w2(r))return`regex`}return g2(r)},dRe=(e,t,n)=>{Z(t)&&t.length===1&&(t=t[0]);let r=e6(e,t,n);return r===null?r:r.toLowerCase()},fRe=(e,t,n)=>{Z(t)&&t.length===1&&(t=t[0]);let r=e6(e,t,n);return r===null?r:r.toUpperCase()},pRe=(e,t,n)=>V3(e,t,n,{left:!0,right:!0}),mRe=(e,t,n)=>i2($(e,t,n));function t6(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,n);if(c in a){let e=a[c];return e instanceof Error?d4(o,`$${s} invalid input '${c}'`):e}return y2(c)?r(c):d4(o,`$${s}`)}var hRe=(e,t,n)=>t6(e,t,n,Math.acos,{Infinity:1/0,0:Error()}),gRe=(e,t,n)=>t6(e,t,n,Math.acosh,{Infinity:1/0,0:Error()}),_Re=(e,t,n)=>t6(e,t,n,Math.asin),vRe=(e,t,n)=>t6(e,t,n,Math.asinh,{Infinity:1/0,"-Infinity":-1/0}),yRe=(e,t,n)=>t6(e,t,n,Math.atan),bRe=(e,t,n)=>{let[r,i]=$(e,t,n);return isNaN(r)||Q(r)?r:isNaN(i)||Q(i)?i:Math.atan2(r,i)},xRe=(e,t,n)=>t6(e,t,n,Math.atanh,{1:1/0,"-1":-1/0}),SRe=(e,t,n)=>t6(e,t,n,Math.cos),CRe=(e,t,n)=>t6(e,t,n,Math.cosh,{"-Infinity":1/0,Infinity:1/0}),wRe=e=>Math.PI/180*e,TRe=(e,t,n)=>t6(e,t,n,wRe,{Infinity:1/0,"-Infinity":1/0}),ERe=e=>180/Math.PI*e,DRe=(e,t,n)=>t6(e,t,n,ERe,{Infinity:1/0,"-Infinity":1/0}),ORe=(e,t,n)=>t6(e,t,n,Math.sin),kRe=(e,t,n)=>t6(e,t,n,Math.sinh,{"-Infinity":-1/0,Infinity:1/0}),ARe=(e,t,n)=>t6(e,t,n,Math.tan),jRe=(e,t,n)=>t6(e,t,n,Math.tanh,{Infinity:1,"-Infinity":-1}),MRe=(e,t,n)=>{let r={};for(let i of Object.keys(t.vars))r[i]=$(e,t.vars[i],n);return $(e,t.in,q2.init(n).update({variables:r}))},NRe=e({$abs:()=>kFe,$acos:()=>hRe,$acosh:()=>gRe,$add:()=>AFe,$allElementsTrue:()=>PLe,$and:()=>gIe,$anyElementTrue:()=>FLe,$arrayElemAt:()=>KFe,$arrayToObject:()=>qFe,$asin:()=>_Re,$asinh:()=>vRe,$atan:()=>yRe,$atan2:()=>bRe,$atanh:()=>xRe,$bitAnd:()=>fIe,$bitNot:()=>pIe,$bitOr:()=>mIe,$bitXor:()=>hIe,$ceil:()=>jFe,$cmp:()=>yIe,$concat:()=>VLe,$concatArrays:()=>JFe,$cond:()=>BIe,$convert:()=>sRe,$cos:()=>SRe,$cosh:()=>CRe,$dateAdd:()=>j3,$dateDiff:()=>ZIe,$dateFromParts:()=>eLe,$dateFromString:()=>aLe,$dateSubtract:()=>oLe,$dateToParts:()=>sLe,$dateToString:()=>lLe,$dateTrunc:()=>fLe,$dayOfMonth:()=>pLe,$dayOfWeek:()=>mLe,$dayOfYear:()=>hLe,$degreesToRadians:()=>TRe,$divide:()=>MFe,$eq:()=>PIe,$exp:()=>NFe,$filter:()=>YFe,$first:()=>XFe,$firstN:()=>ZFe,$floor:()=>PFe,$function:()=>i3,$getField:()=>OLe,$gt:()=>FIe,$gte:()=>IIe,$hour:()=>gLe,$ifNull:()=>r3,$in:()=>QFe,$indexOfArray:()=>$Fe,$indexOfBytes:()=>HLe,$isArray:()=>eIe,$isNumber:()=>cRe,$isoDayOfWeek:()=>_Le,$isoWeek:()=>vLe,$isoWeekYear:()=>yLe,$last:()=>tIe,$lastN:()=>nIe,$let:()=>MRe,$literal:()=>ELe,$ln:()=>FFe,$log:()=>IFe,$log10:()=>LFe,$lt:()=>LIe,$lte:()=>RIe,$ltrim:()=>WLe,$map:()=>rIe,$maxN:()=>iIe,$median:()=>DLe,$mergeObjects:()=>P3,$millisecond:()=>bLe,$minN:()=>aIe,$minute:()=>xLe,$mod:()=>RFe,$month:()=>SLe,$multiply:()=>zFe,$ne:()=>zIe,$not:()=>_Ie,$objectToArray:()=>jLe,$or:()=>vIe,$percentile:()=>NLe,$pow:()=>BFe,$radiansToDegrees:()=>DRe,$rand:()=>kLe,$range:()=>oIe,$reduce:()=>sIe,$regexFind:()=>GLe,$regexFindAll:()=>KLe,$regexMatch:()=>qLe,$replaceAll:()=>JLe,$replaceOne:()=>YLe,$reverseArray:()=>cIe,$round:()=>VFe,$rtrim:()=>XLe,$sampleRate:()=>ALe,$second:()=>CLe,$setDifference:()=>ILe,$setEquals:()=>LLe,$setField:()=>I3,$setIntersection:()=>RLe,$setIsSubset:()=>zLe,$setUnion:()=>BLe,$sigmoid:()=>HFe,$sin:()=>ORe,$sinh:()=>kRe,$size:()=>lIe,$slice:()=>O4,$sortArray:()=>uIe,$split:()=>ZLe,$sqrt:()=>UFe,$strLenBytes:()=>$Le,$strLenCP:()=>eRe,$strcasecmp:()=>QLe,$substr:()=>tRe,$substrBytes:()=>K3,$substrCP:()=>nRe,$subtract:()=>WFe,$switch:()=>VIe,$tan:()=>ARe,$tanh:()=>jRe,$toBool:()=>J3,$toDate:()=>Y3,$toDecimal:()=>lRe,$toDouble:()=>X3,$toHashedIndexKey:()=>mRe,$toInt:()=>Q3,$toLong:()=>$3,$toLower:()=>dRe,$toString:()=>e6,$toUpper:()=>fRe,$trim:()=>pRe,$trunc:()=>GFe,$type:()=>uRe,$unsetField:()=>MLe,$week:()=>wLe,$year:()=>TLe,$zip:()=>dIe});function n6(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],n);r===void 0?H2(i,a):V2(i,a,r)}return i})}function PRe(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}};X(r.length>1,`$bucket: must specify at least two boundaries.`),X(r.every((e,t)=>t===0||g2(e)===g2(r[t-1])&&f2(e,r[t-1])>0),`$bucket: bounds must be of same type and in ascending order`),X(Q(i)||g2(i)!==g2(a)||f2(i,o)>=0||f2(i,a)<0,`$bucket: 'default' expression must be out of boundaries range`);let c=()=>{let c=new Map;for(let e=0;e{let s=$(e,t.groupBy,n);if(Q(s)||f2(s,a)<0||f2(s,o)>=0)X(!Q(i),`$bucket require a default for out of range values`),c.get(i)?.push(e);else{X(f2(s,a)>=0&&f2(s,o)<0,`$bucket 'groupBy' expression must resolve to a value in range of boundaries`);let t=G2(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)),X(c.size===r.length,`bounds and groups must be of equal size.`),Z2(r).map(e=>({...$(c.get(e),s,n),_id:e}))},l;return Z2(()=>(l||=c(),l.next()))}function FRe(e,t,n){let{buckets:r,groupBy:i,output:a,granularity:o}=t,s=a??{count:{$sum:1}};X(r>0,`$bucketAuto: 'buckets' field must be greater than 0, but found: ${r}`),o&&X(/^(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,n)??null;return X(!o||y2(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:f2(e[0],t[0]));let d;d=o?o==`POWERSOF2`?LRe(u,r):zRe(u,r,o):IRe(u,r,c);let f=!1;return Z2(()=>{if(f)return{done:!0};let{min:e,max:t,bucket:r,done:i}=d();f=i;let a=$(r,s,n);for(let e of Object.keys(a)){let t=a[e];Z(t)&&(a[e]=t.filter(e=>!Q(e)))}return{done:!1,value:{...a,_id:{min:e,max:t}}}})}function IRe(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(;a0&&m2(e[a-1][0],e[a][0]));)c.push(e[a++][1]);let l=n.get(c[0]),u;return u=a=r}}}function LRe(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=n}}}var RRe={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]},r6=(e,t)=>{if(e==0)return 0;let n=RRe[t],r=n[0],i=n[n.length-1],a=1;for(;e>=i*a;)a*=10;let o=0;for(;e=i*a)return o;X(e>=r*a&&e(t*=a,et))),c=n[s]*a;return e==c?n[s+1]*a:c};function zRe(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}}}function BRe(e,t,n){X(v2(t)&&t.trim().length>0&&!t.includes(`.`)&&t[0]!==`$`,`$count expression must evaluate to valid field name`);let r=0;return Z2(()=>r++==0?{value:{[t]:e.size()},done:!1}:{done:!0})}var i6=`$densify`;function VRe(e,t,n){let{step:r,bounds:i,unit:a}=t.range;a?(X(a3.includes(a),`${i6} 'range.unit' value is not supported.`),X(b2(r)&&r>0,`${i6} 'range.step' must resolve to integer if 'range.unit' is specified.`)):X(y2(r),`${i6} 'range.step' must resolve to number.`),Z(i)&&(X(!!i&&i.length===2,`${i6} 'range.bounds' must have exactly two elements.`),X((i.every(y2)||i.every(C2))&&i[0]y2(e)?e+r:j3({},{startDate:e,unit:a,amount:r},n),c=!!a&&a3.includes(a),l=e=>{let n=I2(e,t.field);return X(Q(n)||C2(n)&&c||y2(n)&&!c,`${i6} Densify field type must be numeric with 'unit' unspecified, or a date with 'unit' specified.`),n},u=[],d=Z2(()=>{let t=e.next();return Q(l(t.value))?t:(u.push(t),{done:!0})}),f=h2.init(),[p,m]=Z(i)?i:[i,i],h,g=e=>{h=h===void 0||h{let n=u.pop()||e.next();if(n.done)return n;let r=_;Z(o)&&(r=o.map(e=>I2(n.value,e)),X(r.every(v2),`$densify: Partition fields must evaluate to string values.`)),X(x2(n.value),`$densify: collection must contain documents`);let i=l(n.value);f.has(r)||(p==`full`?(f.has(_)||f.set(_,i),f.set(r,f.get(_))):p==`partition`?f.set(r,i):f.set(r,p));let a=f.get(r);if(i<=a||m!=`full`&&m!=`partition`&&a>=m)return a<=i&&f.set(r,s(a)),g(i),n;f.set(r,s(a)),g(a);let c={[t.field]:a};if(r)for(let e=0;e{if(y===-1){let e=f.get(_);f.delete(_),b=Array.from(f.keys()),b.length===0&&(b.push(_),f.set(_,e)),y++}do{let e=b[y],n=f.get(e);if(n{let r={};for(let i of Object.keys(t))r[i]=new e4(t[i],n).run(e);return Z2([r])})}var a6=new WeakMap;function o6(e,t,n,r){a6.has(e)||a6.set(e,{});let i=a6.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&&a6.delete(e)):a6.delete(e)}}function URe(e,t,n,r,i){return o6(t,n,()=>{let e=t4(t,`$`+Object.keys(n.parentExpr.sortBy)[0],r),i=P2(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 WRe=(e,t,n,r,i)=>t+(i-e)*((r-t)/(n-e)),GRe=(e,t,n,r)=>o6(t,n,()=>{let e=t4(t,[`$`+Object.keys(n.parentExpr.sortBy)[0],n.inputExpr],r).filter((([e,t])=>y2(+e))),i=-1,a=0;for(;a=e.length)break;for(a++;i+1t)},e=>e[n.documentNumber-1]),KRe=(e,t,n,r)=>o6(t,n,()=>{let e=t4(t,n.inputExpr,r);for(let t=1;te[n.documentNumber-1]),s6=`_id`;function c6(e,t,n){X(O2(t,s6),`$group specification must include an '_id'`);let r=t[s6],i=q2.init(n),a=Object.keys(t).filter(e=>e!=s6);return e.transform(e=>{let o=P2(e,e=>$(e,r,n)),s=-1,c=Array.from(o.keys());return Z2(()=>{if(++s===o.size)return{done:!0};let e=c[s],n={};e!==void 0&&(n[s6]=e);for(let r of a)n[r]=$(o.get(e),t[r],i.update({root:null,groupId:e}));return{value:n,done:!1}})})}var qRe=[`$denseRank`,`$documentNumber`,`$first`,`$last`,`$linearFill`,`$rank`,`$shift`],JRe=[`$denseRank`,`$expMovingAvg`,`$linearFill`,`$locf`,`$rank`,`$shift`],YRe=e=>{let t=e?.documents||e?.range;return!t||t[0]===`unbounded`&&t[1]===`unbounded`},l6=`$setWindowFields`;function XRe(e,t,n){n=q2.init(n),n.context.addExpressionOps({$function:i3});let r={},i=Object.keys(t.output);for(let e of i){let i=t.output[e],a=Object.keys(i),o=a.find(U2),s=n.context;if(X(o&&(!!s.getOperator(J2.WINDOW,o)||!!s.getOperator(J2.ACCUMULATOR,o)),`${l6} '${o}' is not a valid window operator`),X(a.length>0&&a.length<=2&&(a.length==1||a.includes(`window`)),`${l6} 'output' option should have a single window operator.`),i?.window){let{documents:e,range:t}=i.window;X((!!e^+!!t)==1,`'window' option supports only one of 'documents' or 'range'.`)}r[e]=o}return t.sortBy&&(e=n4(e,t.sortBy,n)),e=c6(e,{_id:t.partitionBy,items:{$push:`$$CURRENT`}},n),e.transform(e=>{let a=[],o=[];for(let e of i){let i=t.output[e],a=r[e],s={operatorName:a,func:{left:n.context.getOperator(J2.ACCUMULATOR,a),right:n.context.getOperator(J2.WINDOW,a)},args:i[a],field:e,window:i.window},c=YRe(s.window);if(c==0||qRe.includes(a)){let e=c?`'${a}'`:`bounded window operations`;X(t.sortBy,`${l6} 'sortBy' is required for ${e}.`)}X(c||!JRe.includes(a),`${l6} cannot use bounded window for operator '${a}'.`),o.push(s)}for(let r of e){let e=r.items,i=Z2(e),s={};for(let r of o){let{func:a,args:o,field:c,window:l}=r,u=e=>{let r=-1;return i=>{if(++r,a.left)return a.left(e(i,r),o,n);if(a.right)return a.right(i,e(i,r),{parentExpr:t,inputExpr:o,documentNumber:r+1,field:c},n)}};if(l){let{documents:r,range:i,unit:a}=l,o=r||i;if(!YRe(l)){let[i,l]=o,d=e=>i==`current`?e:i==`unbounded`?0:Math.max(i+e,0),f=t=>l==`current`?t+1:l==`unbounded`?e.length:l+t+1;s[c]=u((s,c)=>{if(r||o?.every(v2))return e.slice(d(c),f(c));let u=Object.keys(t.sortBy)[0],p,m;if(a){let e=new Date(s[u]),t=t=>j3(s,{startDate:e,unit:a,amount:t},n).getTime();p=y2(i)?t(i):-1/0,m=y2(l)?t(l):1/0}else{let e=s[u];p=y2(i)?e+i:-1/0,m=y2(l)?e+l:1/0}let h=i==`current`?c:0,g=l==`current`?c+1:e.length,_=[];for(;h=p&&n<=m&&_.push(t)}return _})}}s[c]||(s[c]=u(t=>e)),i=n6(i,{[c]:{$function:{body:e=>s[c](e),args:[`$$CURRENT`]}}},n)}a.push(i)}return Q2(...a)})}var ZRe={locf:`$locf`,linear:`$linearFill`};function QRe(e,t,n){X(!t.sortBy||x2(t.sortBy),`sortBy must be an object.`),X(!!t.sortBy||Object.values(t.output).every(e=>O2(e,`value`)),`sortBy required if any output field specifies a 'method'.`),X(!(t.partitionBy&&t.partitionByFields),`specify either partitionBy or partitionByFields.`),X(!t.partitionByFields||t?.partitionByFields?.every(e=>e[0]!==`$`),`fields in partitionByFields cannot begin with '$'.`),n.context.addExpressionOps({$ifNull:r3}),n.context.addWindowOps({$locf:KRe,$linearFill:GRe});let r=t.partitionBy||t?.partitionByFields?.map(e=>`$`+e),i={},a={};for(let e of Object.keys(t.output)){let n=t.output[e];if(O2(n,`value`)){let t=n;i[e]={$ifNull:[`$$CURRENT.${e}`,t.value]}}else{let t=n,r=ZRe[t.method];X(!!r,`invalid fill method '${t.method}'.`),a[e]={[r]:`$`+e}}}return Object.keys(a).length>0&&(e=XRe(e,{sortBy:t.sortBy||{},partitionBy:r,output:a},n)),Object.keys(i).length>0&&(e=n6(e,i,n)),e}function $Re(e,t,n){let{let:r,foreignField:i,localField:a}=t,o=e=>[!0,[]],s=v2(t.from)?P4(`$lookup`,t.from,n):t.from,{documents:c,pipeline:l}=M4(t.pipeline??[],n);if(X(!s!=!c,"$lookup: must specify single join input with `expr.from` or `expr.pipeline`."),s??=c,X(Z(s),`$lookup: join collection must resolve to an array.`),i&&a){let n=h2.init();for(let e of s)for(let t of D2(I2(e,i)??null)){let r=n.get(t),i=r??[];i.push(e),i!==r&&n.set(t,i)}if(o=e=>{let t=I2(e,a)??null;if(Z(t)){if(l?.length)return[t.some(e=>n.has(e)),[]];let e=Array.from(new Set(M2(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]:o(e).pop()}))}let u=new e4(l??[],n),d=q2.init(n);return e.map(e=>{let i=$(e,r,n);d.update({root:null,variables:i});let[a,c]=o(e);return{...e,[t.as]:a?u.run(s,d):c}})}function eze(e,t,n){let r=P4(`$graphLookup`,t.from,n);X(Z(r),`$graphLookup: expression 'from' must resolve to array`);let{connectFromField:i,connectToField:a,as:o,maxDepth:s,depthField:c,restrictSearchWithMatch:l}=t,u=l?{pipeline:[{$match:l}]}:{};return e.map(e=>{let l={};V2(l,i,$(e,t.startWith,n));let d=[l],f=-1,p=h2.init();do{f++,d=M2($Re(Z2(d),{from:r,localField:i,foreignField:a,as:o,...u},n).map(e=>e[o]).collect());let e=p.size;for(let e of d)p.set(e,p.get(e)??f);if(e==p.size)break}while(Q(s)||fr.test(e))}function nze(e,t,n){let r=P4(`$merge`,t.into,n);X(Z(r),`$merge: expression 'into' must resolve to an array`);let i=t.on||n.idKey,a=v2(i)?e=>i2(I2(e,i)):e=>i2(i.map(t=>I2(e,t))),o=h2.init();for(let e=0;e{let n=a(e);if(o.has(n)){let[i,a]=o.get(n),c=$(i,t.let||{new:`$$ROOT`},s.update({root:e}));if(Z(t.whenMatched))r[a]=new e4(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 a2(`$merge: failed due to matching as specified by 'whenMatched' option.`);case`keepExisting`:break;default:r[a]=P3(i,[i,e],s.update({root:e,variables:c}));break}}else switch(t.whenNotMatched){case`discard`:break;case`fail`:throw new a2(`$merge: failed due to matching as specified by 'whenMatched' option.`);default:r.push(e);break}return e})}function rze(e,t,n){let r=P4(`$out`,t,n);return X(Z(r),`$out: expression must resolve to an array`),e.map(e=>(r.push(A2(e)),e))}function ize(e,t,n){let r=q2.init(n);return e.map(e=>u6(e,t,r.update({root:e})))}function u6(e,t,n){let r=$(e,t,n);switch(r){case`$$KEEP`:return e;case`$$PRUNE`:return;case`$$DESCEND`:{if(!O2(t,`$cond`))return e;let r={};for(let i of Object.keys(e)){let a=e[i];if(Z(a)){let e=[];for(let r of a)x2(r)&&(r=u6(r,t,n.update({root:r}))),Q(r)||e.push(r);r[i]=e}else if(x2(a)){let e=u6(a,t,n.update({root:a}));Q(e)||(r[i]=e)}else r[i]=a}return r}default:return r}}function aze(e,t,n){return e.map(e=>(e=$(e,t.newRoot,n),X(x2(e),`$replaceRoot expression must return an object`),e))}function oze(e,t,n){return e.map(e=>(e=$(e,t,n),X(x2(e),`$replaceWith expression must return an object`),e))}function sze(e,t,n){return e.transform(e=>{let n=e.length,r=-1;return Z2(()=>++r===t.size?{done:!0}:{value:e[Math.floor(Math.random()*n)],done:!1})})}var cze=n6;function lze(e,t,n){return n4(c6(e,{_id:t,count:{$sum:1}},n),{count:-1},n)}function uze(e,t,n){let{coll:r,pipeline:i}=v2(t)||Z(t)?{coll:t}:t,a=v2(r)?P4(`$unionWith`,r,n):r,{documents:o,pipeline:s}=M4(i,n);X(a||o,"$unionWith must specify single collection input with `expr.coll` or `expr.pipeline`.");let c=a??o;return Q2(e,s?new e4(s,n).stream(c):Z2(c))}function dze(e,t,n){t=D2(t);let r={};for(let e of t)r[e]=0;return I4(e,r,n)}function fze(e,t,n){v2(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 Z2(()=>{for(;;){if(s instanceof $2){let e=s.next();if(!e.done)return e}let t=e.next();if(t.done)return t;let n=t.value;if(s=I2(n,r),Z(s)){if(s.length===0&&a===!0)return s=null,H2(n,r),{value:o(n,null),done:!1};s=Z2(s).map(((e,t)=>{let i=L2(n,r,{preserveKeys:!0});return V2(i,r,e),o(i,t)}))}else if(!E2(s)||a===!0)return{value:o(n,null),done:!1}}})}var pze=e({$addFields:()=>n6,$bucket:()=>PRe,$bucketAuto:()=>FRe,$count:()=>BRe,$densify:()=>VRe,$documents:()=>j4,$facet:()=>HRe,$fill:()=>QRe,$graphLookup:()=>eze,$group:()=>c6,$limit:()=>A4,$lookup:()=>$Re,$match:()=>tze,$merge:()=>nze,$out:()=>rze,$project:()=>I4,$redact:()=>ize,$replaceRoot:()=>aze,$replaceWith:()=>oze,$sample:()=>sze,$set:()=>cze,$setWindowFields:()=>XRe,$skip:()=>z4,$sort:()=>n4,$sortByCount:()=>lze,$unionWith:()=>uze,$unset:()=>dze,$unwind:()=>fze}),mze=(e,t,n,r)=>{let i=I2(e,n),a=new V4(t,r);if(!Z(i))return;let o=[];for(let e=0;e0?o:void 0},hze=(e,t,n,r)=>{let i=I2(e,n);return Z(i)?O4(e,Z(t)?[i,...t]:[i,t],r):i},gze=e({$elemMatch:()=>mze,$slice:()=>hze}),_ze=(e,t,n)=>U4(e,t,n,AIe),vze=(e,t,n)=>U4(e,t,n,Q4),yze=(e,t,n)=>U4(e,t,n,jIe),d6=(e,t,n)=>U4(e,t,null,(e,t)=>{let r=0;if(Z(t))for(let e of t)r|=1<d6(e,t,(e,t)=>e==0),xze=(e,t,n)=>d6(e,t,(e,t)=>e==t),Sze=(e,t,n)=>d6(e,t,(e,t)=>ed6(e,t,(e,t)=>e>0),wze=(e,t,n)=>U4(e,t,n,G4),Tze=(e,t,n)=>U4(e,t,n,X4),Eze=(e,t,n)=>U4(e,t,n,Z4),Dze=(e,t,n)=>U4(e,t,n,q4),Oze=(e,t,n)=>U4(e,t,n,J4),kze=(e,t,n)=>U4(e,t,n,Y4),Aze=(e,t,n)=>U4(e,t,n,K4),jze=(e,t,n)=>U4(e,t,n,DIe),Mze=(e,t,n)=>{let r=e.includes(`.`),i=!!t;if(!r||e.match(/\.\d+$/)){let t={pathArray:e.split(`.`)};return n=>I2(n,e,t)!==void 0===i}let a=e.substring(0,e.lastIndexOf(`.`)),o={pathArray:a.split(`.`),preserveIndex:!0};return t=>{let n=I2(L2(t,e,o),a,o);return Z(n)?n.some(e=>e!==void 0)===i:n!==void 0===i}},Nze=(e,t,n)=>U4(e,t,n,NIe);function Pze(e,t,n){return e=>T2($(e,t,n),n.useStrictMode)}function Fze(e,t,n){X(!!n?.jsonSchemaValidator,`$jsonSchema requires 'jsonSchemaValidator' option to be defined.`);let r=n.jsonSchemaValidator(t);return e=>r(e)}var Ize=(e,t,n)=>U4(e,t,n,OIe),Lze=(e,t,n)=>U4(e,t,n,kIe);function Rze(e,t,n){X(n.scriptEnabled,`$where requires 'scriptEnabled' option to be true`);let r=t;return X(aFe(r),`$where only accepts a Function objects`),e=>T2(r.call(e),n?.useStrictMode)}var zze=(e,t,n)=>{X(Z(t),`$and expects value to be an Array.`);let r=t.map(e=>new V4(e,n));return e=>r.every(t=>t.test(e))};function Bze(e,t,n){X(Z(t),`Invalid expression. $or expects value to be an Array`);let r=t.map(e=>new V4(e,n));return e=>r.some(t=>t.test(e))}function Vze(e,t,n){X(Z(t),`Invalid expression. $nor expects value to be an array.`);let r=Bze(`$or`,t,n);return e=>!r(e)}function Hze(e,t,n){let r={};r[e]=W2(t);let i=new V4(r,n);return e=>!i.test(e)}var Uze=e({$all:()=>_ze,$and:()=>zze,$bitsAllClear:()=>bze,$bitsAllSet:()=>xze,$bitsAnyClear:()=>Sze,$bitsAnySet:()=>Cze,$elemMatch:()=>vze,$eq:()=>wze,$exists:()=>Mze,$expr:()=>Pze,$gt:()=>Tze,$gte:()=>Eze,$in:()=>Dze,$jsonSchema:()=>Fze,$lt:()=>Oze,$lte:()=>kze,$mod:()=>Ize,$ne:()=>Aze,$nin:()=>jze,$nor:()=>Vze,$not:()=>Hze,$or:()=>Bze,$regex:()=>Lze,$size:()=>yze,$type:()=>Nze,$where:()=>Rze}),Wze=(e,t,n,r)=>URe(e,t,n,r,!0),Gze=(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=t4([t[0],t[t.length-1]],[o,i],r).filter((([e,t])=>y2(+e)&&y2(+t)));X(s.length===2,`$derivative arguments must resolve to numeric`);let[[c,l],[u,d]]=s,f=(u-c)/m3[a??`millisecond`];return(d-l)/f},Kze=(e,t,n,r)=>n.documentNumber,qze=(e,t,n,r)=>{let{input:i,N:a,alpha:o}=n.inputExpr;return X(!(a&&o),`$expMovingAvg: must provide either 'N' or 'alpha' field.`),X(!a||y2(a)&&a>0,`$expMovingAvg: 'N' must be greater than zero. Got ${a}.`),X(!o||y2(o)&&o>0&&o<1,`$expMovingAvg: 'alpha' must be between 0 and 1 (exclusive), found alpha: ${o}`),o6(t,n,()=>{let e=a==null?o:2/(a+1),n=t4(t,i,r);for(let t=0;te[n.documentNumber-1])},Jze=(e,t,n,r)=>{let{input:i,unit:a}=n.inputExpr,o=t4(t,[`$`+Object.keys(n.parentExpr.sortBy)[0],i],r).filter((([e,t])=>y2(+e)&&y2(+t))),s=o.length;X(t.length===s,`$integral expects an array of numeric values`);let c=0;for(let e=1;eo6(t,n,()=>{let e=n.inputExpr,i=e.min||0,a=e.max||1,o=t4(t,e.input||n.inputExpr,r);X(Z(o)&&o.length>0&&o.every(y2),`$minMaxScaler: input must be a numeric array`);let s=o[0],c=o[0];for(let e of o)ec&&(c=e);let l=a-i,u=c-s;return X(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}),Xze=(e,t,n,r)=>URe(e,t,n,r,!1),Zze=(e,t,n,r)=>{let i=n.inputExpr,a=n.documentNumber-1+i.by;return a<0||a>t.length-1?$(e,i.default,r)??null:$(t[a],i.output,r)},Qze=e({$denseRank:()=>Wze,$derivative:()=>Gze,$documentNumber:()=>Kze,$expMovingAvg:()=>qze,$integral:()=>Jze,$linearFill:()=>GRe,$locf:()=>KRe,$minMaxScaler:()=>Yze,$rank:()=>Xze,$shift:()=>Zze}),$ze=Y2.init({accumulator:OFe,expression:NRe,pipeline:pze,projection:gze,query:Uze,window:Qze}),eBe=e=>Object.assign({...e,context:e?.context?Y2.from($ze,e?.context):$ze}),f6=class extends V4{constructor(e,t){super(e,eBe(t))}},tBe=class extends e4{constructor(e,t){super(e,eBe(t))}},nBe=Object.defineProperty,rBe=Object.getOwnPropertyNames,iBe=(e,t)=>function(){return e&&(t=(0,e[rBe(e)[0]])(e=0)),t},aBe=(e,t)=>{for(var n in t)nBe(e,n,{get:t[n],enumerable:!0})},p6={};aBe(p6,{LocalStoragePersistenceAdapter:()=>oBe});var m6,oBe,h6=iBe({"src/persistence/local-storage-adapter.ts"(){m6=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(){}},m6.SIZE_WARNING_BYTES=4.5*1024*1024,oBe=m6}}),g6={};aBe(g6,{FileSystemPersistenceAdapter:()=>sBe});var sBe,_6=iBe({"src/persistence/file-adapter.ts"(){sBe=class{constructor(e){this.dirty=!1,this.timer=null,this.currentDb=null,this.filePath=e?.path||$d(`.objectstack`,`data`,`memory-driver.json`),this.autoSaveInterval=e?.autoSaveInterval??2e3}async load(){try{if(!Qd(this.filePath))return null;let e=Yd(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,this.filePath+``,JSON.stringify(e,null,2),this.filePath}}}});function v6(e,t){return t.includes(`.`)?t.split(`.`).reduce((e,t)=>e?e[t]:void 0,e):e[t]}var cBe=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||$f({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 f6(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 f6(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 f6(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 f6(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 f6(e).find(r).all())}let i=new Set;for(let e of r){let n=v6(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 tBe(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=v6(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,v6(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=>v6(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)=>te!=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=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=v6(e,i),r=v6(t,i);return n==null&&r==null?0:n==null?1:r==null?-1:nr?a===`desc`?-1:1:0})}return n}projectFields(e,t){let n={};for(let r of t){let t=v6(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(()=>(h6(),p6));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(()=>(_6(),g6));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(()=>(_6(),g6));this.persistenceAdapter=new e}else if(t===`local`){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(h6(),p6));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(()=>(h6(),p6));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(()=>(_6(),g6));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(()=>(_6(),g6));this.persistenceAdapter=new e({path:t.path,autoSaveInterval:t.autoSaveInterval})}else if(t.type===`local`){let{LocalStoragePersistenceAdapter:e}=await Promise.resolve().then(()=>(h6(),p6));this.persistenceAdapter=new e({key:t.key})}}this.persistenceAdapter&&this.logger.debug(`Persistence adapter initialized`)}}};cBe.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 lBe=cBe;_6(),h6();var uBe=/(%?)(%([sdijo]))/g;function dBe(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 y6(e,...t){if(t.length===0)return e;let n=0,r=e.replace(uBe,(e,r,i,a)=>{let o=t[n],s=dBe(o,a);return r?e:(n++,s)});return n{if(!e)throw new mBe(t,...n)};b6.as=(e,t,n,...r)=>{if(!t){let t=r.length===0?n:y6(n,...r),i;try{i=Reflect.construct(e,[t])}catch{i=e(t)}throw i}};var hBe=`[MSW]`;function x6(e,...t){return`${hBe} ${y6(e,...t)}`}function gBe(e,...t){console.warn(x6(e,...t))}function _Be(e,...t){console.error(x6(e,...t))}var S6={formatMessage:x6,warn:gBe,error:_Be},C6=class extends Error{constructor(e){super(e),this.name=`InternalError`}},vBe=class{#e;#t;constructor(){this.#e=[],this.#t=new Map}get[Symbol.iterator](){return this.#e[Symbol.iterator].bind(this.#e)}entries(){return this.#t.entries()}get(e){return this.#t.get(e)||[]}getAll(){return this.#e.map(([,e])=>e)}append(e,t){this.#e.push([e,t]),this.#n(e,e=>e.push(t))}prepend(e,t){this.#e.unshift([e,t]),this.#n(e,e=>e.unshift(t))}delete(e,t){if(this.size===0)return;this.#e=this.#e.filter(e=>e[1]!==t);let n=this.#t.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}deleteAll(e){this.size!==0&&(this.#e=this.#e.filter(t=>t[0]!==e),this.#t.delete(e))}get size(){return this.#e.length}clear(){this.size!==0&&(this.#e.length=0,this.#t.clear())}#n(e,t){t(this.#t.get(e)||this.#t.set(e,[]).get(e))}},w6=Symbol(`kDefaultPrevented`),T6=Symbol(`kPropagationStopped`),E6=Symbol(`kImmediatePropagationStopped`),D6=class extends MessageEvent{[w6];[T6];[E6];constructor(...e){super(e[0],e[1]),this[w6]=!1}get defaultPrevented(){return this[w6]}preventDefault(){super.preventDefault(),this[w6]=!0}stopImmediatePropagation(){super.stopImmediatePropagation(),this[E6]=!0}},O6=class{#e;#t;#n;#r;#i;hooks;constructor(){this.#e=new vBe,this.#t=new WeakMap,this.#n=new WeakSet,this.#r=new vBe,this.#i=new WeakMap,this.hooks={on:(e,t,n)=>{if(n?.once){let n=t,r=((...t)=>(this.#r.delete(e,r),n(...t)));t=r}this.#r.append(e,t),n&&this.#i.set(t,n),n?.signal&&n.signal.addEventListener(`abort`,()=>{this.#r.delete(e,t)},{once:!0})},removeListener:(e,t)=>{this.#r.delete(e,t)}}}on(e,t,n){return this.#a(e,t,n),this}once(e,t,n){return this.on(e,t,{...n||{},once:!0})}earlyOn(e,t,n){return this.#a(e,t,n,`prepend`),this}earlyOnce(e,t,n){return this.earlyOn(e,t,{...n||{},once:!0})}emit(e){if(this.#e.size===0)return!1;let t=this.listenerCount(e.type)>0,n=this.#o(e);for(let t of this.#c(e.type)){if(n.event[T6]!=null&&n.event[T6]!==this)return n.revoke(),!1;if(n.event[E6])break;this.#s(n.event,t)}return n.revoke(),t}async emitAsPromise(e){if(this.#e.size===0)return[];let t=[],n=this.#o(e);for(let r of this.#c(e.type)){if(n.event[T6]!=null&&n.event[T6]!==this)return n.revoke(),[];if(n.event[E6])break;let e=await Promise.resolve(this.#s(n.event,r));this.#l(r)||t.push(e)}return n.revoke(),Promise.allSettled(t).then(e=>e.map(e=>e.status===`fulfilled`?e.value:e.reason))}*emitAsGenerator(e){if(this.#e.size===0)return;let t=this.#o(e);for(let n of this.#c(e.type)){if(t.event[T6]!=null&&t.event[T6]!==this){t.revoke();return}if(t.event[E6])break;let e=this.#s(t.event,n);this.#l(n)||(yield e)}t.revoke()}removeListener(e,t){let n=this.#t.get(t);this.#e.delete(e,t);for(let r of this.#r.get(`removeListener`))r(e,t,n)}removeAllListeners(e){if(e==null){this.#e.clear();for(let[e,t]of this.#r)this.#i.get(t)?.persist||this.#r.delete(e,t);return}this.#e.deleteAll(e)}listeners(e){return e==null?this.#e.getAll():this.#e.get(e)}listenerCount(e){return e==null?this.#e.size:this.listeners(e).length}#a(e,t,n,r=`append`){for(let r of this.#r.get(`newListener`))r(e,t,n);e===`*`&&this.#n.add(t),r===`prepend`?this.#e.prepend(e,t):this.#e.append(e,t),n&&(this.#t.set(t,n),n.signal&&n.signal.addEventListener(`abort`,()=>{this.removeListener(e,t)},{once:!0}))}#o(e){let{stopPropagation:t}=e;return e.stopPropagation=()=>{e[T6]=this,t.call(e)},{event:e,revoke(){e.stopPropagation=t}}}#s(e,t){for(let t of this.#r.get(`beforeEmit`))if(t(e)===!1)return;let n=t.call(this,e),r=this.#t.get(t);if(r?.once){let n=this.#l(t)?`*`:e.type;this.#e.delete(n,t);for(let e of this.#r.get(`removeListener`))e(n,t,r)}return n}*#c(e){for(let[t,n]of this.#e)(t===`*`||t===e)&&(yield n)}#l(e){return this.#n.has(e)}};function yBe(e){let t={};for(let n of e)(t[n.kind]||=[]).push(n);return t}var bBe=class{getInitialState(e){b6(this.#e(e),S6.formatMessage(`[MSW] Failed to apply given request handlers: invalid input. Did you forget to spread the request handlers Array?`));let t=yBe(e);return{initialHandlers:t,handlers:{...t}}}currentHandlers(){return Object.values(this.getState().handlers).flat().filter(e=>e!=null)}getHandlersByKind(e){return this.getState().handlers[e]||[]}use(e){if(b6(this.#e(e),S6.formatMessage(`[MSW] Failed to call "use()" with the given request handlers: invalid input. Did you forget to spread the array of request handlers?`)),e.length===0)return;let{handlers:t}=this.getState();for(let n=e.length-1;n>=0;n--){let r=e[n];t[r.kind]=t[r.kind]?[r,...t[r.kind]]:[r]}this.setState({handlers:t})}reset(e){b6(e.length>0?this.#e(e):!0,S6.formatMessage(`Failed to replace initial handlers during reset: invalid handlers. Did you forget to spread the handlers array?`));let{initialHandlers:t}=this.getState();if(e.length===0){this.setState({handlers:{...t}});return}let n=yBe(e);this.setState({initialHandlers:n,handlers:{...n}})}#e(e){return e.every(e=>!Array.isArray(e))}},xBe=class extends bBe{#e;#t;constructor(e){super();let t=this.getInitialState(e);this.#t=t.initialHandlers,this.#e=t.handlers}getState(){return{initialHandlers:this.#t,handlers:this.#e}}setState(e){e.initialHandlers&&(this.#t=e.initialHandlers),e.handlers&&(this.#e=e.handlers)}};function SBe(e){let t=[...e];return Object.freeze(t),t}var CBe=/[/\\]msw[/\\]src[/\\](.+)/,wBe=/(node_modules)?[/\\]lib[/\\](core|browser|node|native|iife)[/\\]|^[^/\\]*$/;function TBe(e){let t=e.stack;if(!t)return;let n=t.split(` -`).slice(1).find(e=>!(CBe.test(e)||wBe.test(e)));if(n)return n.replace(/\s*at [^()]*\(([^)]+)\)/,`$1`).replace(/^@/,``)}function EBe(e){return e?Reflect.has(e,Symbol.iterator)||Reflect.has(e,Symbol.asyncIterator):!1}var DBe=class e{static cache=new WeakMap;kind=`request`;resolver;resolverIterator;resolverIteratorResult;options;info;isUsed;constructor(e){this.resolver=e.resolver,this.options=e.options;let t=TBe(Error());this.info={...e.info,callFrame:t},this.isUsed=!1}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(!EBe(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 OBe(e,t){return e.toLowerCase()===t.toLowerCase()}function kBe(e){return e<300?`#69AB32`:e<400?`#F0BB4B`:`#E95F5D`}function ABe(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 jBe(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 MBe=Object.create,NBe=Object.defineProperty,PBe=Object.getOwnPropertyDescriptor,FBe=Object.getOwnPropertyNames,IBe=Object.getPrototypeOf,LBe=Object.prototype.hasOwnProperty,RBe=(e,t)=>function(){return t||(0,e[FBe(e)[0]])((t={exports:{}}).exports,t),t.exports},zBe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of FBe(t))!LBe.call(e,i)&&i!==n&&NBe(e,i,{get:()=>t[i],enumerable:!(r=PBe(t,i))||r.enumerable});return e},BBe=(e,t,n)=>(n=e==null?{}:MBe(IBe(e)),zBe(t||!e||!e.__esModule?NBe(n,`default`,{value:e,enumerable:!0}):n,e)),VBe=RBe({"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`}}}),HBe=BBe(RBe({"node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js"(e,t){var n=VBe();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),UBe=HBe.default||HBe;UBe.message;var WBe=UBe,{message:GBe}=WBe;async function KBe(e){let t=e.clone(),n=await t.text(),r=t.status||200;return{status:r,statusText:t.statusText||GBe[r]||`OK`,headers:Object.fromEntries(t.headers.entries()),body:n}}function qBe(e){for(var t=[],n=0;n=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-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)?`[^${k6(o)}]+?`:`(?:(?!${k6(n)})[^${k6(o)}])+?`};l)?(?!\?)/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 $Be(e,t,n){var r=e.map(function(e){return nVe(e,t,n).source});return RegExp(`(?:${r.join(`|`)})`,ZBe(n))}function eVe(e,t,n){return tVe(JBe(e,n),t,n)}function tVe(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=`[${k6(p===void 0?``:p)}]|\$`,h=`[${k6(f)}]`,g=o?`^`:``,_=0,v=e;_-1:C===void 0;i||(g+=`(?:${h}(?=${m}))?`),w||(g+=`(?=${h}|${m})`)}return new RegExp(g,ZBe(n))}function nVe(e,t,n){return e instanceof RegExp?QBe(e,t):Array.isArray(e)?$Be(e,t,n):eVe(e,t,n)}function rVe(){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 iVe=class extends Promise{#e;resolve;reject;constructor(e=null){let t=rVe();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}})}},A6=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 iVe}get#e(){return this.handled}async passthrough(){b6.as(A6,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){b6.as(A6,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){b6.as(A6,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 aVe(e){try{return new URL(e),!0}catch{return!1}}function oVe(e,t){let n=Object.getOwnPropertySymbols(t).find(t=>t.description===e);if(n)return Reflect.get(t,n)}var sVe=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:`||!aVe(e))return;let n=oVe(`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{for(var n in t)lVe(e,n,{get:t[n],enumerable:!0})},j6={};uVe(j6,{blue:()=>fVe,gray:()=>M6,green:()=>mVe,red:()=>pVe,yellow:()=>dVe});function dVe(e){return`\x1B[33m${e}\x1B[0m`}function fVe(e){return`\x1B[34m${e}\x1B[0m`}function M6(e){return`\x1B[90m${e}\x1B[0m`}function pVe(e){return`\x1B[31m${e}\x1B[0m`}function mVe(e){return`\x1B[32m${e}\x1B[0m`}var N6=cVe(),hVe=class{constructor(e){this.name=e,this.prefix=`[${this.name}]`;let t=bVe(`DEBUG`),n=bVe(`LOG_LEVEL`);t===`1`||t===`true`||t!==void 0&&this.name.startsWith(t)?(this.debug=F6(n,`debug`)?P6:this.debug,this.info=F6(n,`info`)?P6:this.info,this.success=F6(n,`success`)?P6:this.success,this.warning=F6(n,`warning`)?P6:this.warning,this.error=F6(n,`error`)?P6:this.error):(this.info=P6,this.success=P6,this.warning=P6,this.error=P6,this.only=P6)}prefix;extend(e){return new hVe(`${this.name}:${e}`)}debug(e,...t){this.logEntry({level:`debug`,message:M6(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 gVe;return(e,...t)=>{n.measure(),this.logEntry({level:`info`,message:`${e} ${M6(`${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:j6[s],prefix:j6[c]};this.getWriter(t)([l.timestamp(this.formatTimestamp(o.timestamp))].concat(r==null?[]:l.prefix(r),xVe(n)).join(` `),...a.map(xVe))}formatTimestamp(e){return`${e.toLocaleTimeString(`en-GB`)}:${e.getMilliseconds()}`}getWriter(e){switch(e){case`debug`:case`success`:case`info`:return _Ve;case`warning`:return vVe;case`error`:return yVe}}},gVe=class{startTime;endTime;deltaTime;constructor(){this.startTime=performance.now()}measure(){this.endTime=performance.now(),this.deltaTime=(this.endTime-this.startTime).toFixed(2)}},P6=()=>void 0;function _Ve(e,...t){if(N6){process.stdout.write(y6(e,...t)+` -`);return}console.log(e,...t)}function vVe(e,...t){if(N6){process.stderr.write(y6(e,...t)+` -`);return}console.warn(e,...t)}function yVe(e,...t){if(N6){process.stderr.write(y6(e,...t)+` -`);return}console.error(e,...t)}function bVe(e){return N6?{}[e]:globalThis[e]?.toString()}function F6(e,t){return e!==void 0&&e!==t}function xVe(e){return e===void 0?`undefined`:e===null?`null`:typeof e==`string`?e:typeof e==`object`?JSON.stringify(e):e.toString()}var SVe=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`}},CVe=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=CVe.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 SVe(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)}},wVe=CVe;wVe.defaultMaxListeners=10;function TVe(e){return globalThis[e]||void 0}function EVe(e,t){globalThis[e]=t}function DVe(e){delete globalThis[e]}var I6=function(e){return e.INACTIVE=`INACTIVE`,e.APPLYING=`APPLYING`,e.APPLIED=`APPLIED`,e.DISPOSING=`DISPOSING`,e.DISPOSED=`DISPOSED`,e}({}),OVe=class{constructor(e){this.symbol=e,this.readyState=I6.INACTIVE,this.emitter=new wVe,this.subscriptions=[],this.logger=new hVe(e.description),this.emitter.setMaxListeners(0),this.logger.info(`constructing the interceptor...`)}checkEnvironment(){return!0}apply(){let e=this.logger.extend(`apply`);if(e.info(`applying the interceptor...`),this.readyState===I6.APPLIED){e.info(`intercepted already applied!`);return}if(!this.checkEnvironment()){e.info(`the interceptor cannot be applied in this environment!`);return}this.readyState=I6.APPLYING;let t=this.getInstance();if(t){e.info(`found a running instance, reusing...`),this.on=(n,r)=>(e.info(`proxying the "%s" listener`,n),t.emitter.addListener(n,r),this.subscriptions.push(()=>{t.emitter.removeListener(n,r),e.info(`removed proxied "%s" listener!`,n)}),this),this.readyState=I6.APPLIED;return}e.info(`no running instance found, setting up a new instance...`),this.setup(),this.setInstance(),this.readyState=I6.APPLIED}setup(){}on(e,t){let n=this.logger.extend(`on`);return this.readyState===I6.DISPOSING||this.readyState===I6.DISPOSED?(n.info(`cannot listen to events, already disposed!`),this):(n.info(`adding "%s" event listener:`,e,t),this.emitter.on(e,t),this)}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}removeAllListeners(e){return this.emitter.removeAllListeners(e),this}dispose(){let e=this.logger.extend(`dispose`);if(this.readyState===I6.DISPOSED){e.info(`cannot dispose, already disposed!`);return}if(e.info(`disposing the interceptor...`),this.readyState=I6.DISPOSING,!this.getInstance()){e.info(`no interceptors running, skipping dispose...`);return}if(this.clearInstance(),e.info(`global symbol deleted:`,TVe(this.symbol)),this.subscriptions.length>0){e.info(`disposing of %d subscriptions...`,this.subscriptions.length);for(let e of this.subscriptions)e();this.subscriptions=[],e.info(`disposed of all subscriptions!`,this.subscriptions.length)}this.emitter.removeAllListeners(),e.info(`destroyed the listener!`),this.readyState=I6.DISPOSED}getInstance(){let e=TVe(this.symbol);return this.logger.info(`retrieved global instance:`,e?.constructor?.name),e}setInstance(){EVe(this.symbol,this),this.logger.info(`set global instance!`,this.symbol.description)}clearInstance(){DVe(this.symbol),this.logger.info(`cleared global instance!`,this.symbol.description)}};function kVe(){return Math.random().toString(16).slice(2)}new TextEncoder;var AVe=class e extends OVe{constructor(t){e.symbol=Symbol(t.name),super(e.symbol),this.interceptors=t.interceptors}setup(){let e=this.logger.extend(`setup`);e.info(`applying all %d interceptors...`,this.interceptors.length);for(let t of this.interceptors)e.info(`applying "%s" interceptor...`,t.constructor.name),t.apply(),e.info(`adding interceptor dispose subscription`),this.subscriptions.push(()=>t.dispose())}on(e,t){for(let n of this.interceptors)n.on(e,t);return this}once(e,t){for(let n of this.interceptors)n.once(e,t);return this}off(e,t){for(let n of this.interceptors)n.off(e,t);return this}removeAllListeners(e){for(let t of this.interceptors)t.removeAllListeners(e);return this}};function jVe(e,t=!0){return[t&&e.origin,e.pathname].filter(Boolean).join(``)}var MVe=/[?|#].*$/g;function NVe(e){return e.endsWith(`?`)?e:e.replace(MVe,``)}function PVe(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function FVe(e,t){if(PVe(e)||e.startsWith(`*`))return e;let n=t||typeof location<`u`&&location.href;return n?decodeURI(new URL(encodeURI(e),n).href):e}function IVe(e,t){return e instanceof RegExp?e:NVe(FVe(e,t))}function LVe(e){return e.replace(/([:a-zA-Z_-]*)(\*{1,2})+/g,(e,t,n)=>{let r=`(.*)`;return t?t.startsWith(`:`)?`${t}${n}`:`${t}${r}`:r}).replace(/([^/])(:)(?=(?:\d+|\(\.\*\))(?=\/|$))/,`$1\\$2`).replace(/^([^/]+)(:)(?=\/\/)/,`$1\\$2`)}function RVe(e,t,n){let r=IVe(t,n),i=typeof r==`string`?LVe(r):r,a=jVe(e),o=YBe(i,{decode:decodeURIComponent})(a),s=o&&o.params||{};return{matches:o!==!1,params:s}}function zVe(e){let t=e instanceof URL?e:new URL(e);return typeof location<`u`&&t.origin===location.origin?t.pathname:t.origin+t.pathname}var BVe=Object.create,VVe=Object.defineProperty,HVe=Object.getOwnPropertyDescriptor,UVe=Object.getOwnPropertyNames,WVe=Object.getPrototypeOf,GVe=Object.prototype.hasOwnProperty,KVe=(e,t)=>function(){return t||(0,e[UVe(e)[0]])((t={exports:{}}).exports,t),t.exports},qVe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of UVe(t))!GVe.call(e,i)&&i!==n&&VVe(e,i,{get:()=>t[i],enumerable:!(r=HVe(t,i))||r.enumerable});return e},JVe=((e,t,n)=>(n=e==null?{}:BVe(WVe(e)),qVe(t||!e||!e.__esModule?VVe(n,`default`,{value:e,enumerable:!0}):n,e)))(KVe({"node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(e){Object.defineProperty(e,`__esModule`,{value:!0}),e.parse=s,e.serialize=u;var t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,n=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,a=Object.prototype.toString,o=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function s(e,t){let n=new o,r=e.length;if(r<2)return n;let i=t?.decode||d,a=0;do{let t=e.indexOf(`=`,a);if(t===-1)break;let o=e.indexOf(`;`,a),s=o===-1?r:o;if(t>s){a=e.lastIndexOf(`;`,t-1)+1;continue}let u=c(e,a,t),d=l(e,t,u),f=e.slice(u,d);if(n[f]===void 0){let r=c(e,t+1,s),a=l(e,s,r);n[f]=i(e.slice(r,a))}a=s+1}while(an;){let n=e.charCodeAt(--t);if(n!==32&&n!==9)return t+1}return n}function u(e,a,o){let s=o?.encode||encodeURIComponent;if(!t.test(e))throw TypeError(`argument name is invalid: ${e}`);let c=s(a);if(!n.test(c))throw TypeError(`argument val is invalid: ${a}`);let l=e+`=`+c;if(!o)return l;if(o.maxAge!==void 0){if(!Number.isInteger(o.maxAge))throw TypeError(`option maxAge is invalid: ${o.maxAge}`);l+=`; Max-Age=`+o.maxAge}if(o.domain){if(!r.test(o.domain))throw TypeError(`option domain is invalid: ${o.domain}`);l+=`; Domain=`+o.domain}if(o.path){if(!i.test(o.path))throw TypeError(`option path is invalid: ${o.path}`);l+=`; Path=`+o.path}if(o.expires){if(!f(o.expires)||!Number.isFinite(o.expires.valueOf()))throw TypeError(`option expires is invalid: ${o.expires}`);l+=`; Expires=`+o.expires.toUTCString()}if(o.httpOnly&&(l+=`; HttpOnly`),o.secure&&(l+=`; Secure`),o.partitioned&&(l+=`; Partitioned`),o.priority)switch(typeof o.priority==`string`?o.priority.toLowerCase():void 0){case`low`:l+=`; Priority=Low`;break;case`medium`:l+=`; Priority=Medium`;break;case`high`:l+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid: ${o.priority}`)}if(o.sameSite)switch(typeof o.sameSite==`string`?o.sameSite.toLowerCase():o.sameSite){case!0:case`strict`:l+=`; SameSite=Strict`;break;case`lax`:l+=`; SameSite=Lax`;break;case`none`:l+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid: ${o.sameSite}`)}return l}function d(e){if(e.indexOf(`%`)===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function f(e){return a.call(e)===`[object Date]`}}})(),1),YVe=JVe.default||JVe,XVe=YVe.parse,ZVe=YVe.serialize;function QVe(e,t){return e.endsWith(t)?e.length===t.length||e[e.length-t.length-1]===`.`:!1}function $Ve(e,t){let n=e.length-t.length-2,r=e.lastIndexOf(`.`,n);return r===-1?e:e.slice(r+1)}function eHe(e,t,n){if(n.validHosts!==null){let e=n.validHosts;for(let n of e)if(QVe(t,n))return n}let r=0;if(t.startsWith(`.`))for(;rn+1&&e.charCodeAt(r-1)<=32;)--r;if(e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47)n+=2;else{let t=e.indexOf(`:/`,n);if(t!==-1){let r=t-n,i=e.charCodeAt(n),a=e.charCodeAt(n+1),o=e.charCodeAt(n+2),s=e.charCodeAt(n+3),c=e.charCodeAt(n+4);if(!(r===5&&i===104&&a===116&&o===116&&s===112&&c===115)&&!(r===4&&i===104&&a===116&&o===116&&s===112)&&!(r===3&&i===119&&a===115&&o===115)&&!(r===2&&i===119&&a===115))for(let r=n;r=97&&t<=122||t>=48&&t<=57||t===46||t===45||t===43))return null}for(n=t+2;e.charCodeAt(n)===47;)n+=1}}let t=-1,a=-1,o=-1;for(let s=n;s=65&&n<=90&&(i=!0)}if(t!==-1&&t>n&&tn&&on+1&&e.charCodeAt(r-1)===46;)--r;let a=n!==0||r!==e.length?e.slice(n,r):e;return i?a.toLowerCase():a}function rHe(e){if(e.length<7||e.length>15)return!1;let t=0;for(let n=0;n57)return!1}return t===3&&e.charCodeAt(0)!==46&&e.charCodeAt(e.length-1)!==46}function iHe(e){if(e.length<3)return!1;let t=+!!e.startsWith(`[`),n=e.length;if(e[n-1]===`]`&&--n,n-t>39)return!1;let r=!1;for(;t=48&&n<=57||n>=97&&n<=102||n>=65&&n<=90))return!1}return r}function aHe(e){return iHe(e)||rHe(e)}function oHe(e){return e>=97&&e<=122||e>=48&&e<=57||e>127}function sHe(e){if(e.length>255||e.length===0||!oHe(e.charCodeAt(0))&&e.charCodeAt(0)!==46&&e.charCodeAt(0)!==95)return!1;let t=-1,n=-1,r=e.length;for(let i=0;i64||n===46||n===45||n===95)return!1;t=i}else if(!(oHe(r)||r===45||r===95))return!1;n=r}return r-t-1<=63&&n!==45}function cHe({allowIcannDomains:e=!0,allowPrivateDomains:t=!1,detectIp:n=!0,extractHostname:r=!0,mixedInputs:i=!0,validHosts:a=null,validateHostname:o=!0}){return{allowIcannDomains:e,allowPrivateDomains:t,detectIp:n,extractHostname:r,mixedInputs:i,validHosts:a,validateHostname:o}}var lHe=cHe({});function uHe(e){return e===void 0?lHe:cHe(e)}function dHe(e,t){return t.length===e.length?``:e.slice(0,-t.length-1)}function fHe(){return{domain:null,domainWithoutSuffix:null,hostname:null,isIcann:null,isIp:null,isPrivate:null,publicSuffix:null,subdomain:null}}function pHe(e){e.domain=null,e.domainWithoutSuffix=null,e.hostname=null,e.isIcann=null,e.isIp=null,e.isPrivate=null,e.publicSuffix=null,e.subdomain=null}function mHe(e,t,n,r,i){let a=uHe(r);return typeof e!=`string`||(a.extractHostname?a.mixedInputs?i.hostname=nHe(e,sHe(e)):i.hostname=nHe(e,!1):i.hostname=e,a.detectIp&&i.hostname!==null&&(i.isIp=aHe(i.hostname),i.isIp))?i:a.validateHostname&&a.extractHostname&&i.hostname!==null&&!sHe(i.hostname)?(i.hostname=null,i):(t===0||i.hostname===null||(n(i.hostname,a,i),t===2||i.publicSuffix===null)||(i.domain=eHe(i.publicSuffix,i.hostname,a),t===3||i.domain===null)||(i.subdomain=dHe(i.hostname,i.domain),t===4)||(i.domainWithoutSuffix=tHe(i.domain,i.publicSuffix)),i)}function hHe(e,t,n){if(!t.allowPrivateDomains&&e.length>3){let t=e.length-1,r=e.charCodeAt(t),i=e.charCodeAt(t-1),a=e.charCodeAt(t-2),o=e.charCodeAt(t-3);if(r===109&&i===111&&a===99&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`com`,!0;if(r===103&&i===114&&a===111&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`org`,!0;if(r===117&&i===100&&a===101&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`edu`,!0;if(r===118&&i===111&&a===103&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`gov`,!0;if(r===116&&i===101&&a===110&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`net`,!0;if(r===101&&i===100&&a===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`de`,!0}return!1}var gHe=(function(){let e=[1,{}],t=[0,{city:e}];return[0,{ck:[0,{www:e}],jp:[0,{kawasaki:t,kitakyushu:t,kobe:t,nagoya:t,sapporo:t,sendai:t,yokohama:t}]}]})(),_He=(function(){let e=[1,{}],t=[2,{}],n=[1,{com:e,edu:e,gov:e,net:e,org:e}],r=[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e}],i=[0,{"*":t}],a=[2,{s:i}],o=[0,{relay:t}],s=[2,{id:t}],c=[1,{gov:e}],l=[0,{airflow:i,"lambda-url":t,"transfer-webapp":t}],u=[0,{airflow:i,"transfer-webapp":t}],d=[0,{"transfer-webapp":t}],f=[0,{"transfer-webapp":t,"transfer-webapp-fips":t}],p=[0,{notebook:t,studio:t}],m=[0,{labeling:t,notebook:t,studio:t}],h=[0,{notebook:t}],g=[0,{labeling:t,notebook:t,"notebook-fips":t,studio:t}],_=[0,{notebook:t,"notebook-fips":t,studio:t,"studio-fips":t}],v=[0,{shop:t}],y=[0,{"*":e}],b=[1,{co:t}],x=[0,{objects:t}],S=[2,{"eu-west-1":t,"us-east-1":t}],C=[2,{nodes:t}],w=[0,{my:t}],T=[0,{s3:t,"s3-accesspoint":t,"s3-website":t}],E=[0,{s3:t,"s3-accesspoint":t}],D=[0,{direct:t}],O=[0,{"webview-assets":t}],ee=[0,{vfs:t,"webview-assets":t}],te=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t,"aws-cloud9":O,cloud9:ee}],k=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:E,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t,"aws-cloud9":O,cloud9:ee}],A=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t,"analytics-gateway":t,"aws-cloud9":O,cloud9:ee}],j=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t}],M=[0,{s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-fips":t,"s3-website":t}],N=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:M,s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-fips":t,"s3-object-lambda":t,"s3-website":t,"aws-cloud9":O,cloud9:ee}],P=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:M,s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-fips":t,"s3-object-lambda":t,"s3-website":t}],F=[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:M,s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-deprecated":t,"s3-fips":t,"s3-object-lambda":t,"s3-website":t,"analytics-gateway":t,"aws-cloud9":O,cloud9:ee}],I=[0,{auth:t}],ne=[0,{auth:t,"auth-fips":t}],re=[0,{"auth-fips":t}],ie=[0,{apps:t}],ae=[0,{paas:t}],oe=[2,{eu:t}],se=[0,{app:t}],ce=[0,{site:t}],le=[1,{com:e,edu:e,net:e,org:e}],L=[0,{j:t}],ue=[0,{dyn:t}],de=[2,{web:t}],fe=[1,{co:e,com:e,edu:e,gov:e,net:e,org:e}],pe=[0,{p:t}],me=[0,{user:t}],he=[1,{ms:t}],ge=[0,{cdn:t}],_e=[2,{raw:i}],ve=[0,{cust:t,reservd:t}],ye=[0,{cust:t}],be=[0,{s3:t}],xe=[1,{biz:e,com:e,edu:e,gov:e,info:e,net:e,org:e}],Se=[0,{ipfs:t}],Ce=[1,{framer:t}],we=[0,{forgot:t}],Te=[0,{core:[0,{blob:t,file:t,web:t}],servicebus:t}],Ee=[1,{gs:e}],De=[0,{nes:e}],Oe=[1,{k12:e,cc:e,lib:e}],ke=[1,{cc:e}],Ae=[1,{cc:e,lib:e}];return[0,{ac:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,drr:t,feedback:t,forms:t}],ad:e,ae:[1,{ac:e,co:e,gov:e,mil:e,net:e,org:e,sch:e}],aero:[1,{airline:e,airport:e,"accident-investigation":e,"accident-prevention":e,aerobatic:e,aeroclub:e,aerodrome:e,agents:e,"air-surveillance":e,"air-traffic-control":e,aircraft:e,airtraffic:e,ambulance:e,association:e,author:e,ballooning:e,broker:e,caa:e,cargo:e,catering:e,certification:e,championship:e,charter:e,civilaviation:e,club:e,conference:e,consultant:e,consulting:e,control:e,council:e,crew:e,design:e,dgca:e,educator:e,emergency:e,engine:e,engineer:e,entertainment:e,equipment:e,exchange:e,express:e,federation:e,flight:e,freight:e,fuel:e,gliding:e,government:e,groundhandling:e,group:e,hanggliding:e,homebuilt:e,insurance:e,journal:e,journalist:e,leasing:e,logistics:e,magazine:e,maintenance:e,marketplace:e,media:e,microlight:e,modelling:e,navigation:e,parachuting:e,paragliding:e,"passenger-association":e,pilot:e,press:e,production:e,recreation:e,repbody:e,res:e,research:e,rotorcraft:e,safety:e,scientist:e,services:e,show:e,skydiving:e,software:e,student:e,taxi:e,trader:e,trading:e,trainer:e,union:e,workinggroup:e,works:e}],af:n,ag:[1,{co:e,com:e,net:e,nom:e,org:e,obj:t}],ai:[1,{com:e,net:e,off:e,org:e,uwu:t,framer:t,kiloapps:t}],al:r,am:[1,{co:e,com:e,commune:e,net:e,org:e,radio:t}],ao:[1,{co:e,ed:e,edu:e,gov:e,gv:e,it:e,og:e,org:e,pb:e}],aq:e,ar:[1,{bet:e,com:e,coop:e,edu:e,gob:e,gov:e,int:e,mil:e,musica:e,mutual:e,net:e,org:e,seg:e,senasa:e,tur:e}],arpa:[1,{e164:e,home:e,"in-addr":e,ip6:e,iris:e,uri:e,urn:e}],as:c,asia:[1,{cloudns:t,daemon:t,dix:t}],at:[1,{4:t,ac:[1,{sth:e}],co:e,gv:e,or:e,funkfeuer:[0,{wien:t}],futurecms:[0,{"*":t,ex:i,in:i}],futurehosting:t,futuremailing:t,ortsinfo:[0,{ex:i,kunden:i}],biz:t,info:t,"123webseite":t,priv:t,my:t,myspreadshop:t,"12hp":t,"2ix":t,"4lima":t,"lima-city":t}],au:[1,{asn:e,com:[1,{cloudlets:[0,{mel:t}],myspreadshop:t}],edu:[1,{act:e,catholic:e,nsw:e,nt:e,qld:e,sa:e,tas:e,vic:e,wa:e}],gov:[1,{qld:e,sa:e,tas:e,vic:e,wa:e}],id:e,net:e,org:e,conf:e,oz:e,act:e,nsw:e,nt:e,qld:e,sa:e,tas:e,vic:e,wa:e,hrsn:[0,{vps:t}]}],aw:[1,{com:e}],ax:e,az:[1,{biz:e,co:e,com:e,edu:e,gov:e,info:e,int:e,mil:e,name:e,net:e,org:e,pp:e,pro:e}],ba:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,brendly:v,rs:t}],bb:[1,{biz:e,co:e,com:e,edu:e,gov:e,info:e,net:e,org:e,store:e,tv:e}],bd:[1,{ac:e,ai:e,co:e,com:e,edu:e,gov:e,id:e,info:e,it:e,mil:e,net:e,org:e,sch:e,tv:e}],be:[1,{ac:e,cloudns:t,webhosting:t,interhostsolutions:[0,{cloud:t}],kuleuven:[0,{ezproxy:t}],my:t,"123website":t,myspreadshop:t,transurl:i}],bf:c,bg:[1,{0:e,1:e,2:e,3:e,4:e,5:e,6:e,7:e,8:e,9:e,a:e,b:e,c:e,d:e,e,f:e,g:e,h:e,i:e,j:e,k:e,l:e,m:e,n:e,o:e,p:e,q:e,r:e,s:e,t:e,u:e,v:e,w:e,x:e,y:e,z:e,barsy:t}],bh:n,bi:[1,{co:e,com:e,edu:e,or:e,org:e}],biz:[1,{activetrail:t,"cloud-ip":t,cloudns:t,jozi:t,dyndns:t,"for-better":t,"for-more":t,"for-some":t,"for-the":t,selfip:t,webhop:t,orx:t,mmafan:t,myftp:t,"no-ip":t,dscloud:t}],bj:[1,{africa:e,agro:e,architectes:e,assur:e,avocats:e,co:e,com:e,eco:e,econo:e,edu:e,info:e,loisirs:e,money:e,net:e,org:e,ote:e,restaurant:e,resto:e,tourism:e,univ:e}],bm:n,bn:[1,{com:e,edu:e,gov:e,net:e,org:e,co:t}],bo:[1,{com:e,edu:e,gob:e,int:e,mil:e,net:e,org:e,tv:e,web:e,academia:e,agro:e,arte:e,blog:e,bolivia:e,ciencia:e,cooperativa:e,democracia:e,deporte:e,ecologia:e,economia:e,empresa:e,indigena:e,industria:e,info:e,medicina:e,movimiento:e,musica:e,natural:e,nombre:e,noticias:e,patria:e,plurinacional:e,politica:e,profesional:e,pueblo:e,revista:e,salud:e,tecnologia:e,tksat:e,transporte:e,wiki:e}],br:[1,{"9guacu":e,abc:e,adm:e,adv:e,agr:e,aju:e,am:e,anani:e,aparecida:e,api:e,app:e,arq:e,art:e,ato:e,b:e,barueri:e,belem:e,bet:e,bhz:e,bib:e,bio:e,blog:e,bmd:e,boavista:e,bsb:e,campinagrande:e,campinas:e,caxias:e,cim:e,cng:e,cnt:e,com:[1,{simplesite:t}],contagem:e,coop:e,coz:e,cri:e,cuiaba:e,curitiba:e,def:e,des:e,det:e,dev:e,ecn:e,eco:e,edu:e,emp:e,enf:e,eng:e,esp:e,etc:e,eti:e,far:e,feira:e,flog:e,floripa:e,fm:e,fnd:e,fortal:e,fot:e,foz:e,fst:e,g12:e,geo:e,ggf:e,goiania:e,gov:[1,{ac:e,al:e,am:e,ap:e,ba:e,ce:e,df:e,es:e,go:e,ma:e,mg:e,ms:e,mt:e,pa:e,pb:e,pe:e,pi:e,pr:e,rj:e,rn:e,ro:e,rr:e,rs:e,sc:e,se:e,sp:e,to:e}],gru:e,ia:e,imb:e,ind:e,inf:e,jab:e,jampa:e,jdf:e,joinville:e,jor:e,jus:e,leg:[1,{ac:t,al:t,am:t,ap:t,ba:t,ce:t,df:t,es:t,go:t,ma:t,mg:t,ms:t,mt:t,pa:t,pb:t,pe:t,pi:t,pr:t,rj:t,rn:t,ro:t,rr:t,rs:t,sc:t,se:t,sp:t,to:t}],leilao:e,lel:e,log:e,londrina:e,macapa:e,maceio:e,manaus:e,maringa:e,mat:e,med:e,mil:e,morena:e,mp:e,mus:e,natal:e,net:e,niteroi:e,nom:y,not:e,ntr:e,odo:e,ong:e,org:e,osasco:e,palmas:e,poa:e,ppg:e,pro:e,psc:e,psi:e,pvh:e,qsl:e,radio:e,rec:e,recife:e,rep:e,ribeirao:e,rio:e,riobranco:e,riopreto:e,salvador:e,sampa:e,santamaria:e,santoandre:e,saobernardo:e,saogonca:e,seg:e,sjc:e,slg:e,slz:e,social:e,sorocaba:e,srv:e,taxi:e,tc:e,tec:e,teo:e,the:e,tmp:e,trd:e,tur:e,tv:e,udi:e,vet:e,vix:e,vlog:e,wiki:e,xyz:e,zlg:e,tche:t}],bs:[1,{com:e,edu:e,gov:e,net:e,org:e,we:t}],bt:n,bv:e,bw:[1,{ac:e,co:e,gov:e,net:e,org:e}],by:[1,{gov:e,mil:e,com:e,of:e,mediatech:t}],bz:[1,{co:e,com:e,edu:e,gov:e,net:e,org:e,za:t,mydns:t,gsj:t}],ca:[1,{ab:e,bc:e,mb:e,nb:e,nf:e,nl:e,ns:e,nt:e,nu:e,on:e,pe:e,qc:e,sk:e,yk:e,gc:e,barsy:t,awdev:i,co:t,"no-ip":t,onid:t,myspreadshop:t,box:t}],cat:e,cc:[1,{cleverapps:t,"cloud-ip":t,cloudns:t,ccwu:t,ftpaccess:t,"game-server":t,myphotos:t,scrapping:t,twmail:t,csx:t,fantasyleague:t,spawn:[0,{instances:t}],ec:t,eu:t,gu:t,uk:t,us:t}],cd:[1,{gov:e,cc:t}],cf:e,cg:e,ch:[1,{square7:t,cloudns:t,cloudscale:[0,{cust:t,lpg:x,rma:x}],objectstorage:[0,{lpg:t,rma:t}],flow:[0,{ae:[0,{alp1:t}],appengine:t}],"linkyard-cloud":t,gotdns:t,dnsking:t,"123website":t,myspreadshop:t,firenet:[0,{"*":t,svc:i}],"12hp":t,"2ix":t,"4lima":t,"lima-city":t}],ci:[1,{ac:e,"xn--aroport-bya":e,aéroport:e,asso:e,co:e,com:e,ed:e,edu:e,go:e,gouv:e,int:e,net:e,or:e,org:e,us:t}],ck:y,cl:[1,{co:e,gob:e,gov:e,mil:e,cloudns:t}],cm:[1,{co:e,com:e,gov:e,net:e}],cn:[1,{ac:e,com:[1,{amazonaws:[0,{"cn-north-1":[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,rds:i,dualstack:T,s3:t,"s3-accesspoint":t,"s3-deprecated":t,"s3-object-lambda":t,"s3-website":t}],"cn-northwest-1":[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,rds:i,dualstack:E,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t}],compute:i,airflow:[0,{"cn-north-1":i,"cn-northwest-1":i}],eb:[0,{"cn-north-1":t,"cn-northwest-1":t}],elb:i}],amazonwebservices:[0,{on:[0,{"cn-north-1":u,"cn-northwest-1":u}]}],sagemaker:[0,{"cn-north-1":p,"cn-northwest-1":p}]}],edu:e,gov:e,mil:e,net:e,org:e,"xn--55qx5d":e,公司:e,"xn--od0alg":e,網絡:e,"xn--io0a7i":e,网络:e,ah:e,bj:e,cq:e,fj:e,gd:e,gs:e,gx:e,gz:e,ha:e,hb:e,he:e,hi:e,hk:e,hl:e,hn:e,jl:e,js:e,jx:e,ln:e,mo:e,nm:e,nx:e,qh:e,sc:e,sd:e,sh:[1,{as:t}],sn:e,sx:e,tj:e,tw:e,xj:e,xz:e,yn:e,zj:e,"canva-apps":t,canvasite:w,myqnapcloud:t,quickconnect:D}],co:[1,{com:e,edu:e,gov:e,mil:e,net:e,nom:e,org:e,carrd:t,crd:t,otap:i,hidns:t,leadpages:t,lpages:t,mypi:t,xmit:i,rdpa:[0,{clusters:i,srvrless:i}],firewalledreplit:s,repl:s,supabase:[2,{realtime:t,storage:t}],umso:t}],com:[1,{a2hosted:t,cpserver:t,adobeaemcloud:[2,{dev:i}],africa:t,auiusercontent:i,aivencloud:t,alibabacloudcs:t,kasserver:t,amazonaws:[0,{"af-south-1":te,"ap-east-1":k,"ap-northeast-1":A,"ap-northeast-2":A,"ap-northeast-3":te,"ap-south-1":A,"ap-south-2":j,"ap-southeast-1":A,"ap-southeast-2":A,"ap-southeast-3":j,"ap-southeast-4":j,"ap-southeast-5":[0,{"execute-api":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-deprecated":t,"s3-object-lambda":t,"s3-website":t}],"ca-central-1":N,"ca-west-1":P,"eu-central-1":A,"eu-central-2":j,"eu-north-1":k,"eu-south-1":te,"eu-south-2":j,"eu-west-1":[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-deprecated":t,"s3-object-lambda":t,"s3-website":t,"analytics-gateway":t,"aws-cloud9":O,cloud9:ee}],"eu-west-2":k,"eu-west-3":te,"il-central-1":[0,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:T,s3:t,"s3-accesspoint":t,"s3-object-lambda":t,"s3-website":t,"aws-cloud9":O,cloud9:[0,{vfs:t}]}],"me-central-1":j,"me-south-1":k,"sa-east-1":te,"us-east-1":[2,{"execute-api":t,"emrappui-prod":t,"emrnotebooks-prod":t,"emrstudio-prod":t,dualstack:M,s3:t,"s3-accesspoint":t,"s3-accesspoint-fips":t,"s3-deprecated":t,"s3-fips":t,"s3-object-lambda":t,"s3-website":t,"analytics-gateway":t,"aws-cloud9":O,cloud9:ee}],"us-east-2":F,"us-gov-east-1":P,"us-gov-west-1":P,"us-west-1":N,"us-west-2":F,compute:i,"compute-1":i,airflow:[0,{"af-south-1":i,"ap-east-1":i,"ap-northeast-1":i,"ap-northeast-2":i,"ap-northeast-3":i,"ap-south-1":i,"ap-south-2":i,"ap-southeast-1":i,"ap-southeast-2":i,"ap-southeast-3":i,"ap-southeast-4":i,"ap-southeast-5":i,"ap-southeast-7":i,"ca-central-1":i,"ca-west-1":i,"eu-central-1":i,"eu-central-2":i,"eu-north-1":i,"eu-south-1":i,"eu-south-2":i,"eu-west-1":i,"eu-west-2":i,"eu-west-3":i,"il-central-1":i,"me-central-1":i,"me-south-1":i,"sa-east-1":i,"us-east-1":i,"us-east-2":i,"us-west-1":i,"us-west-2":i}],rds:[0,{"af-south-1":i,"ap-east-1":i,"ap-east-2":i,"ap-northeast-1":i,"ap-northeast-2":i,"ap-northeast-3":i,"ap-south-1":i,"ap-south-2":i,"ap-southeast-1":i,"ap-southeast-2":i,"ap-southeast-3":i,"ap-southeast-4":i,"ap-southeast-5":i,"ap-southeast-6":i,"ap-southeast-7":i,"ca-central-1":i,"ca-west-1":i,"eu-central-1":i,"eu-central-2":i,"eu-west-1":i,"eu-west-2":i,"eu-west-3":i,"il-central-1":i,"me-central-1":i,"me-south-1":i,"mx-central-1":i,"sa-east-1":i,"us-east-1":i,"us-east-2":i,"us-gov-east-1":i,"us-gov-west-1":i,"us-northeast-1":i,"us-west-1":i,"us-west-2":i}],s3:t,"s3-1":t,"s3-ap-east-1":t,"s3-ap-northeast-1":t,"s3-ap-northeast-2":t,"s3-ap-northeast-3":t,"s3-ap-south-1":t,"s3-ap-southeast-1":t,"s3-ap-southeast-2":t,"s3-ca-central-1":t,"s3-eu-central-1":t,"s3-eu-north-1":t,"s3-eu-west-1":t,"s3-eu-west-2":t,"s3-eu-west-3":t,"s3-external-1":t,"s3-fips-us-gov-east-1":t,"s3-fips-us-gov-west-1":t,"s3-global":[0,{accesspoint:[0,{mrap:t}]}],"s3-me-south-1":t,"s3-sa-east-1":t,"s3-us-east-2":t,"s3-us-gov-east-1":t,"s3-us-gov-west-1":t,"s3-us-west-1":t,"s3-us-west-2":t,"s3-website-ap-northeast-1":t,"s3-website-ap-southeast-1":t,"s3-website-ap-southeast-2":t,"s3-website-eu-west-1":t,"s3-website-sa-east-1":t,"s3-website-us-east-1":t,"s3-website-us-gov-west-1":t,"s3-website-us-west-1":t,"s3-website-us-west-2":t,elb:i}],amazoncognito:[0,{"af-south-1":I,"ap-east-1":I,"ap-northeast-1":I,"ap-northeast-2":I,"ap-northeast-3":I,"ap-south-1":I,"ap-south-2":I,"ap-southeast-1":I,"ap-southeast-2":I,"ap-southeast-3":I,"ap-southeast-4":I,"ap-southeast-5":I,"ap-southeast-7":I,"ca-central-1":I,"ca-west-1":I,"eu-central-1":I,"eu-central-2":I,"eu-north-1":I,"eu-south-1":I,"eu-south-2":I,"eu-west-1":I,"eu-west-2":I,"eu-west-3":I,"il-central-1":I,"me-central-1":I,"me-south-1":I,"mx-central-1":I,"sa-east-1":I,"us-east-1":ne,"us-east-2":ne,"us-gov-east-1":re,"us-gov-west-1":re,"us-west-1":ne,"us-west-2":ne}],amplifyapp:t,awsapprunner:i,awsapps:t,elasticbeanstalk:[2,{"af-south-1":t,"ap-east-1":t,"ap-northeast-1":t,"ap-northeast-2":t,"ap-northeast-3":t,"ap-south-1":t,"ap-southeast-1":t,"ap-southeast-2":t,"ap-southeast-3":t,"ap-southeast-5":t,"ap-southeast-7":t,"ca-central-1":t,"eu-central-1":t,"eu-north-1":t,"eu-south-1":t,"eu-south-2":t,"eu-west-1":t,"eu-west-2":t,"eu-west-3":t,"il-central-1":t,"me-central-1":t,"me-south-1":t,"sa-east-1":t,"us-east-1":t,"us-east-2":t,"us-gov-east-1":t,"us-gov-west-1":t,"us-west-1":t,"us-west-2":t}],awsglobalaccelerator:t,siiites:t,appspacehosted:t,appspaceusercontent:t,"on-aptible":t,myasustor:t,"balena-devices":t,boutir:t,bplaced:t,cafjs:t,"canva-apps":t,"canva-hosted-embed":t,canvacode:t,"rice-labs":t,"cdn77-storage":t,br:t,cn:t,de:t,eu:t,jpn:t,mex:t,ru:t,sa:t,uk:t,us:t,za:t,"clever-cloud":[0,{services:i}],abrdns:t,dnsabr:t,"ip-ddns":t,jdevcloud:t,wpdevcloud:t,"cf-ipfs":t,"cloudflare-ipfs":t,trycloudflare:t,co:t,devinapps:i,builtwithdark:t,datadetect:[0,{demo:t,instance:t}],dattolocal:t,dattorelay:t,dattoweb:t,mydatto:t,digitaloceanspaces:i,discordsays:t,discordsez:t,drayddns:t,dreamhosters:t,durumis:t,blogdns:t,cechire:t,dnsalias:t,dnsdojo:t,doesntexist:t,dontexist:t,doomdns:t,"dyn-o-saur":t,dynalias:t,"dyndns-at-home":t,"dyndns-at-work":t,"dyndns-blog":t,"dyndns-free":t,"dyndns-home":t,"dyndns-ip":t,"dyndns-mail":t,"dyndns-office":t,"dyndns-pics":t,"dyndns-remote":t,"dyndns-server":t,"dyndns-web":t,"dyndns-wiki":t,"dyndns-work":t,"est-a-la-maison":t,"est-a-la-masion":t,"est-le-patron":t,"est-mon-blogueur":t,"from-ak":t,"from-al":t,"from-ar":t,"from-ca":t,"from-ct":t,"from-dc":t,"from-de":t,"from-fl":t,"from-ga":t,"from-hi":t,"from-ia":t,"from-id":t,"from-il":t,"from-in":t,"from-ks":t,"from-ky":t,"from-ma":t,"from-md":t,"from-mi":t,"from-mn":t,"from-mo":t,"from-ms":t,"from-mt":t,"from-nc":t,"from-nd":t,"from-ne":t,"from-nh":t,"from-nj":t,"from-nm":t,"from-nv":t,"from-oh":t,"from-ok":t,"from-or":t,"from-pa":t,"from-pr":t,"from-ri":t,"from-sc":t,"from-sd":t,"from-tn":t,"from-tx":t,"from-ut":t,"from-va":t,"from-vt":t,"from-wa":t,"from-wi":t,"from-wv":t,"from-wy":t,getmyip:t,gotdns:t,"hobby-site":t,homelinux:t,homeunix:t,iamallama:t,"is-a-anarchist":t,"is-a-blogger":t,"is-a-bookkeeper":t,"is-a-bulls-fan":t,"is-a-caterer":t,"is-a-chef":t,"is-a-conservative":t,"is-a-cpa":t,"is-a-cubicle-slave":t,"is-a-democrat":t,"is-a-designer":t,"is-a-doctor":t,"is-a-financialadvisor":t,"is-a-geek":t,"is-a-green":t,"is-a-guru":t,"is-a-hard-worker":t,"is-a-hunter":t,"is-a-landscaper":t,"is-a-lawyer":t,"is-a-liberal":t,"is-a-libertarian":t,"is-a-llama":t,"is-a-musician":t,"is-a-nascarfan":t,"is-a-nurse":t,"is-a-painter":t,"is-a-personaltrainer":t,"is-a-photographer":t,"is-a-player":t,"is-a-republican":t,"is-a-rockstar":t,"is-a-socialist":t,"is-a-student":t,"is-a-teacher":t,"is-a-techie":t,"is-a-therapist":t,"is-an-accountant":t,"is-an-actor":t,"is-an-actress":t,"is-an-anarchist":t,"is-an-artist":t,"is-an-engineer":t,"is-an-entertainer":t,"is-certified":t,"is-gone":t,"is-into-anime":t,"is-into-cars":t,"is-into-cartoons":t,"is-into-games":t,"is-leet":t,"is-not-certified":t,"is-slick":t,"is-uberleet":t,"is-with-theband":t,"isa-geek":t,"isa-hockeynut":t,issmarterthanyou:t,"likes-pie":t,likescandy:t,"neat-url":t,"saves-the-whales":t,selfip:t,"sells-for-less":t,"sells-for-u":t,servebbs:t,"simple-url":t,"space-to-rent":t,"teaches-yoga":t,writesthisblog:t,"1cooldns":t,bumbleshrimp:t,ddnsfree:t,ddnsgeek:t,ddnsguru:t,dynuddns:t,dynuhosting:t,giize:t,gleeze:t,kozow:t,loseyourip:t,ooguy:t,pivohosting:t,theworkpc:t,wiredbladehosting:t,emergentagent:[0,{preview:t}],mytuleap:t,"tuleap-partners":t,encoreapi:t,evennode:[0,{"eu-1":t,"eu-2":t,"eu-3":t,"eu-4":t,"us-1":t,"us-2":t,"us-3":t,"us-4":t}],onfabrica:t,"fastly-edge":t,"fastly-terrarium":t,"fastvps-server":t,mydobiss:t,firebaseapp:t,fldrv:t,framercanvas:t,"freebox-os":t,freeboxos:t,freemyip:t,aliases121:t,gentapps:t,gentlentapis:t,githubusercontent:t,"0emm":i,appspot:[2,{r:i}],blogspot:t,codespot:t,googleapis:t,googlecode:t,pagespeedmobilizer:t,withgoogle:t,withyoutube:t,grayjayleagues:t,hatenablog:t,hatenadiary:t,"hercules-app":t,"hercules-dev":t,herokuapp:t,gr:t,smushcdn:t,wphostedmail:t,wpmucdn:t,pixolino:t,"apps-1and1":t,"live-website":t,"webspace-host":t,dopaas:t,"hosted-by-previder":ae,hosteur:[0,{"rag-cloud":t,"rag-cloud-ch":t}],"ik-server":[0,{jcloud:t,"jcloud-ver-jpc":t}],jelastic:[0,{demo:t}],massivegrid:ae,wafaicloud:[0,{jed:t,ryd:t}],"eu1-plenit":t,"la1-plenit":t,"us1-plenit":t,webadorsite:t,"on-forge":t,"on-vapor":t,lpusercontent:t,linode:[0,{members:t,nodebalancer:i}],linodeobjects:i,linodeusercontent:[0,{ip:t}],localtonet:t,lovableproject:t,barsycenter:t,barsyonline:t,lutrausercontent:i,magicpatternsapp:t,modelscape:t,mwcloudnonprod:t,polyspace:t,miniserver:t,atmeta:t,fbsbx:ie,meteorapp:oe,routingthecloud:t,"same-app":t,"same-preview":t,mydbserver:t,mochausercontent:t,hostedpi:t,"mythic-beasts":[0,{caracal:t,customer:t,fentiger:t,lynx:t,ocelot:t,oncilla:t,onza:t,sphinx:t,vs:t,x:t,yali:t}],nospamproxy:[0,{cloud:[2,{o365:t}]}],"4u":t,nfshost:t,"3utilities":t,blogsyte:t,ciscofreak:t,damnserver:t,ddnsking:t,ditchyourip:t,dnsiskinky:t,dynns:t,geekgalaxy:t,"health-carereform":t,homesecuritymac:t,homesecuritypc:t,myactivedirectory:t,mysecuritycamera:t,myvnc:t,"net-freaks":t,onthewifi:t,point2this:t,quicksytes:t,securitytactics:t,servebeer:t,servecounterstrike:t,serveexchange:t,serveftp:t,servegame:t,servehalflife:t,servehttp:t,servehumour:t,serveirc:t,servemp3:t,servep2p:t,servepics:t,servequake:t,servesarcasm:t,stufftoread:t,unusualperson:t,workisboring:t,myiphost:t,observableusercontent:[0,{static:t}],simplesite:t,oaiusercontent:i,orsites:t,operaunite:t,"customer-oci":[0,{"*":t,oci:i,ocp:i,ocs:i}],oraclecloudapps:i,oraclegovcloudapps:i,"authgear-staging":t,authgearapps:t,outsystemscloud:t,ownprovider:t,pgfog:t,pagexl:t,gotpantheon:t,paywhirl:i,forgeblocks:t,upsunapp:t,"postman-echo":t,prgmr:[0,{xen:t}],"project-study":[0,{dev:t}],pythonanywhere:oe,qa2:t,"alpha-myqnapcloud":t,"dev-myqnapcloud":t,mycloudnas:t,mynascloud:t,myqnapcloud:t,qualifioapp:t,ladesk:t,qualyhqpartner:i,qualyhqportal:i,qbuser:t,quipelements:i,rackmaze:t,"readthedocs-hosted":t,rhcloud:t,onrender:t,render:se,"subsc-pay":t,"180r":t,dojin:t,sakuratan:t,sakuraweb:t,x0:t,code:[0,{builder:i,"dev-builder":i,"stg-builder":i}],salesforce:[0,{platform:[0,{"code-builder-stg":[0,{test:[0,{"001":i}]}]}]}],logoip:t,scrysec:t,"firewall-gateway":t,myshopblocks:t,myshopify:t,shopitsite:t,"1kapp":t,appchizi:t,applinzi:t,sinaapp:t,vipsinaapp:t,streamlitapp:t,"try-snowplow":t,"playstation-cloud":t,myspreadshop:t,"w-corp-staticblitz":t,"w-credentialless-staticblitz":t,"w-staticblitz":t,"stackhero-network":t,stdlib:[0,{api:t}],strapiapp:[2,{media:t}],"streak-link":t,streaklinks:t,streakusercontent:t,"temp-dns":t,dsmynas:t,familyds:t,mytabit:t,taveusercontent:t,"tb-hosting":ce,reservd:t,thingdustdata:t,"townnews-staging":t,typeform:[0,{pro:t}],hk:t,it:t,"deus-canvas":t,vultrobjects:i,wafflecell:t,hotelwithflight:t,"reserve-online":t,cprapid:t,pleskns:t,remotewd:t,wiardweb:[0,{pages:t}],"drive-platform":t,"base44-sandbox":t,wixsite:t,wixstudio:t,messwithdns:t,"woltlab-demo":t,wpenginepowered:[2,{js:t}],xnbay:[2,{u2:t,"u2-local":t}],xtooldevice:t,yolasite:t}],coop:e,cr:[1,{ac:e,co:e,ed:e,fi:e,go:e,or:e,sa:e}],cu:[1,{com:e,edu:e,gob:e,inf:e,nat:e,net:e,org:e}],cv:[1,{com:e,edu:e,id:e,int:e,net:e,nome:e,org:e,publ:e}],cw:le,cx:[1,{gov:e,cloudns:t,ath:t,info:t,assessments:t,calculators:t,funnels:t,paynow:t,quizzes:t,researched:t,tests:t}],cy:[1,{ac:e,biz:e,com:[1,{scaleforce:L}],ekloges:e,gov:e,ltd:e,mil:e,net:e,org:e,press:e,pro:e,tm:e}],cz:[1,{gov:e,contentproxy9:[0,{rsc:t}],realm:t,e4:t,co:t,metacentrum:[0,{cloud:i,custom:t}],muni:[0,{cloud:[0,{flt:t,usr:t}]}]}],de:[1,{bplaced:t,square7:t,"bwcloud-os-instance":i,com:t,cosidns:ue,dnsupdater:t,"dynamisches-dns":t,"internet-dns":t,"l-o-g-i-n":t,ddnss:[2,{dyn:t,dyndns:t}],"dyn-ip24":t,dyndns1:t,"home-webserver":[2,{dyn:t}],"myhome-server":t,dnshome:t,fuettertdasnetz:t,isteingeek:t,istmein:t,lebtimnetz:t,leitungsen:t,traeumtgerade:t,frusky:i,goip:t,"xn--gnstigbestellen-zvb":t,günstigbestellen:t,"xn--gnstigliefern-wob":t,günstigliefern:t,"hs-heilbronn":[0,{it:[0,{pages:t,"pages-research":t}]}],"dyn-berlin":t,"in-berlin":t,"in-brb":t,"in-butter":t,"in-dsl":t,"in-vpn":t,iservschule:t,"mein-iserv":t,schuldock:t,schulplattform:t,schulserver:t,"test-iserv":t,keymachine:t,co:t,"git-repos":t,"lcube-server":t,"svn-repos":t,barsy:t,webspaceconfig:t,"123webseite":t,rub:t,"ruhr-uni-bochum":[2,{noc:[0,{io:t}]}],logoip:t,"firewall-gateway":t,"my-gateway":t,"my-router":t,spdns:t,my:t,speedpartner:[0,{customer:t}],myspreadshop:t,"taifun-dns":t,"12hp":t,"2ix":t,"4lima":t,"lima-city":t,"virtual-user":t,virtualuser:t,"community-pro":t,diskussionsbereich:t,xenonconnect:i}],dj:e,dk:[1,{biz:t,co:t,firm:t,reg:t,store:t,"123hjemmeside":t,myspreadshop:t}],dm:fe,do:[1,{art:e,com:e,edu:e,gob:e,gov:e,mil:e,net:e,org:e,sld:e,web:e}],dz:[1,{art:e,asso:e,com:e,edu:e,gov:e,net:e,org:e,pol:e,soc:e,tm:e}],ec:[1,{abg:e,adm:e,agron:e,arqt:e,art:e,bar:e,chef:e,com:e,cont:e,cpa:e,cue:e,dent:e,dgn:e,disco:e,doc:e,edu:e,eng:e,esm:e,fin:e,fot:e,gal:e,gob:e,gov:e,gye:e,ibr:e,info:e,k12:e,lat:e,loj:e,med:e,mil:e,mktg:e,mon:e,net:e,ntr:e,odont:e,org:e,pro:e,prof:e,psic:e,psiq:e,pub:e,rio:e,rrpp:e,sal:e,tech:e,tul:e,tur:e,uio:e,vet:e,xxx:e,base:t,official:t}],edu:[1,{rit:[0,{"git-pages":t}]}],ee:[1,{aip:e,com:e,edu:e,fie:e,gov:e,lib:e,med:e,org:e,pri:e,riik:e}],eg:[1,{ac:e,com:e,edu:e,eun:e,gov:e,info:e,me:e,mil:e,name:e,net:e,org:e,sci:e,sport:e,tv:e}],er:y,es:[1,{com:e,edu:e,gob:e,nom:e,org:e,"123miweb":t,myspreadshop:t}],et:[1,{biz:e,com:e,edu:e,gov:e,info:e,name:e,net:e,org:e}],eu:[1,{amazonwebservices:[0,{on:[0,{"eusc-de-east-1":[0,{"cognito-idp":I}]}]}],cloudns:t,prvw:t,deuxfleurs:t,dogado:[0,{jelastic:t}],barsy:t,spdns:t,nxa:i,directwp:t,transurl:i}],fi:[1,{aland:e,dy:t,"xn--hkkinen-5wa":t,häkkinen:t,iki:t,cloudplatform:[0,{fi:t}],datacenter:[0,{demo:t,paas:t}],kapsi:t,"123kotisivu":t,myspreadshop:t}],fj:[1,{ac:e,biz:e,com:e,edu:e,gov:e,id:e,info:e,mil:e,name:e,net:e,org:e,pro:e}],fk:y,fm:[1,{com:e,edu:e,net:e,org:e,radio:t,user:i}],fo:e,fr:[1,{asso:e,com:e,gouv:e,nom:e,prd:e,tm:e,avoues:e,cci:e,greta:e,"huissier-justice":e,"fbx-os":t,fbxos:t,"freebox-os":t,freeboxos:t,goupile:t,kdns:t,"123siteweb":t,"on-web":t,"chirurgiens-dentistes-en-france":t,dedibox:t,aeroport:t,avocat:t,chambagri:t,"chirurgiens-dentistes":t,"experts-comptables":t,medecin:t,notaires:t,pharmacien:t,port:t,veterinaire:t,myspreadshop:t,ynh:t}],ga:e,gb:e,gd:[1,{edu:e,gov:e}],ge:[1,{com:e,edu:e,gov:e,net:e,org:e,pvt:e,school:e}],gf:e,gg:[1,{co:e,net:e,org:e,ply:[0,{at:i,d6:t}],botdash:t,kaas:t,stackit:t,panel:[2,{daemon:t}]}],gh:[1,{biz:e,com:e,edu:e,gov:e,mil:e,net:e,org:e}],gi:[1,{com:e,edu:e,gov:e,ltd:e,mod:e,org:e}],gl:[1,{co:e,com:e,edu:e,net:e,org:e}],gm:e,gn:[1,{ac:e,com:e,edu:e,gov:e,net:e,org:e}],gov:e,gp:[1,{asso:e,com:e,edu:e,mobi:e,net:e,org:e}],gq:e,gr:[1,{com:e,edu:e,gov:e,net:e,org:e,barsy:t,simplesite:t}],gs:e,gt:[1,{com:e,edu:e,gob:e,ind:e,mil:e,net:e,org:e}],gu:[1,{com:e,edu:e,gov:e,guam:e,info:e,net:e,org:e,web:e}],gw:[1,{nx:t}],gy:fe,hk:[1,{com:e,edu:e,gov:e,idv:e,net:e,org:e,"xn--ciqpn":e,个人:e,"xn--gmqw5a":e,個人:e,"xn--55qx5d":e,公司:e,"xn--mxtq1m":e,政府:e,"xn--lcvr32d":e,敎育:e,"xn--wcvs22d":e,教育:e,"xn--gmq050i":e,箇人:e,"xn--uc0atv":e,組織:e,"xn--uc0ay4a":e,組织:e,"xn--od0alg":e,網絡:e,"xn--zf0avx":e,網络:e,"xn--mk0axi":e,组織:e,"xn--tn0ag":e,组织:e,"xn--od0aq3b":e,网絡:e,"xn--io0a7i":e,网络:e,inc:t,ltd:t}],hm:e,hn:[1,{com:e,edu:e,gob:e,mil:e,net:e,org:e}],hr:[1,{com:e,from:e,iz:e,name:e,brendly:v}],ht:[1,{adult:e,art:e,asso:e,com:e,coop:e,edu:e,firm:e,gouv:e,info:e,med:e,net:e,org:e,perso:e,pol:e,pro:e,rel:e,shop:e,rt:t}],hu:[1,{2e3:e,agrar:e,bolt:e,casino:e,city:e,co:e,erotica:e,erotika:e,film:e,forum:e,games:e,hotel:e,info:e,ingatlan:e,jogasz:e,konyvelo:e,lakas:e,media:e,news:e,org:e,priv:e,reklam:e,sex:e,shop:e,sport:e,suli:e,szex:e,tm:e,tozsde:e,utazas:e,video:e}],id:[1,{ac:e,biz:e,co:e,desa:e,go:e,kop:e,mil:e,my:e,net:e,or:e,ponpes:e,sch:e,web:e,"xn--9tfky":e,ᬩᬮᬶ:e,e:t,zone:t}],ie:[1,{gov:e,myspreadshop:t}],il:[1,{ac:e,co:[1,{ravpage:t,mytabit:t,tabitorder:t}],gov:e,idf:e,k12:e,muni:e,net:e,org:e}],"xn--4dbrk0ce":[1,{"xn--4dbgdty6c":e,"xn--5dbhl8d":e,"xn--8dbq2a":e,"xn--hebda8b":e}],ישראל:[1,{אקדמיה:e,ישוב:e,צהל:e,ממשל:e}],im:[1,{ac:e,co:[1,{ltd:e,plc:e}],com:e,net:e,org:e,tt:e,tv:e}],in:[1,{"5g":e,"6g":e,ac:e,ai:e,am:e,bank:e,bihar:e,biz:e,business:e,ca:e,cn:e,co:e,com:e,coop:e,cs:e,delhi:e,dr:e,edu:e,er:e,fin:e,firm:e,gen:e,gov:e,gujarat:e,ind:e,info:e,int:e,internet:e,io:e,me:e,mil:e,net:e,nic:e,org:e,pg:e,post:e,pro:e,res:e,travel:e,tv:e,uk:e,up:e,us:e,cloudns:t,barsy:t,web:t,indevs:t,supabase:t}],info:[1,{cloudns:t,"dynamic-dns":t,"barrel-of-knowledge":t,"barrell-of-knowledge":t,dyndns:t,"for-our":t,"groks-the":t,"groks-this":t,"here-for-more":t,knowsitall:t,selfip:t,webhop:t,barsy:t,mayfirst:t,mittwald:t,mittwaldserver:t,typo3server:t,dvrcam:t,ilovecollege:t,"no-ip":t,forumz:t,nsupdate:t,dnsupdate:t,"v-info":t}],int:[1,{eu:e}],io:[1,{2038:t,co:e,com:e,edu:e,gov:e,mil:e,net:e,nom:e,org:e,"on-acorn":i,myaddr:t,apigee:t,"b-data":t,beagleboard:t,bitbucket:t,bluebite:t,boxfuse:t,brave:a,browsersafetymark:t,bubble:ge,bubbleapps:t,bigv:[0,{uk0:t}],cleverapps:t,cloudbeesusercontent:t,dappnode:[0,{dyndns:t}],darklang:t,definima:t,dedyn:t,icp0:_e,icp1:_e,qzz:t,"fh-muenster":t,gitbook:t,github:t,gitlab:t,lolipop:t,"hasura-app":t,hostyhosting:t,hypernode:t,moonscale:i,beebyte:ae,beebyteapp:[0,{sekd1:t}],jele:t,keenetic:t,kiloapps:t,webthings:t,loginline:t,barsy:t,azurecontainer:i,ngrok:[2,{ap:t,au:t,eu:t,in:t,jp:t,sa:t,us:t}],nodeart:[0,{stage:t}],pantheonsite:t,forgerock:[0,{id:t}],pstmn:[2,{mock:t}],protonet:t,qcx:[2,{sys:i}],qoto:t,vaporcloud:t,myrdbx:t,"rb-hosting":ce,"on-k3s":i,"on-rio":i,readthedocs:t,resindevice:t,resinstaging:[0,{devices:t}],hzc:t,sandcats:t,scrypted:[0,{client:t}],"mo-siemens":t,lair:ie,stolos:i,musician:t,utwente:t,edugit:t,telebit:t,thingdust:[0,{dev:ve,disrec:ve,prod:ye,testing:ve}],tickets:t,webflow:t,webflowtest:t,"drive-platform":t,editorx:t,wixstudio:t,basicserver:t,virtualserver:t}],iq:r,ir:[1,{ac:e,co:e,gov:e,id:e,net:e,org:e,sch:e,"xn--mgba3a4f16a":e,ایران:e,"xn--mgba3a4fra":e,ايران:e,arvanedge:t,vistablog:t}],is:e,it:[1,{edu:e,gov:e,abr:e,abruzzo:e,"aosta-valley":e,aostavalley:e,bas:e,basilicata:e,cal:e,calabria:e,cam:e,campania:e,"emilia-romagna":e,emiliaromagna:e,emr:e,"friuli-v-giulia":e,"friuli-ve-giulia":e,"friuli-vegiulia":e,"friuli-venezia-giulia":e,"friuli-veneziagiulia":e,"friuli-vgiulia":e,"friuliv-giulia":e,"friulive-giulia":e,friulivegiulia:e,"friulivenezia-giulia":e,friuliveneziagiulia:e,friulivgiulia:e,fvg:e,laz:e,lazio:e,lig:e,liguria:e,lom:e,lombardia:e,lombardy:e,lucania:e,mar:e,marche:e,mol:e,molise:e,piedmont:e,piemonte:e,pmn:e,pug:e,puglia:e,sar:e,sardegna:e,sardinia:e,sic:e,sicilia:e,sicily:e,taa:e,tos:e,toscana:e,"trentin-sud-tirol":e,"xn--trentin-sd-tirol-rzb":e,"trentin-süd-tirol":e,"trentin-sudtirol":e,"xn--trentin-sdtirol-7vb":e,"trentin-südtirol":e,"trentin-sued-tirol":e,"trentin-suedtirol":e,trentino:e,"trentino-a-adige":e,"trentino-aadige":e,"trentino-alto-adige":e,"trentino-altoadige":e,"trentino-s-tirol":e,"trentino-stirol":e,"trentino-sud-tirol":e,"xn--trentino-sd-tirol-c3b":e,"trentino-süd-tirol":e,"trentino-sudtirol":e,"xn--trentino-sdtirol-szb":e,"trentino-südtirol":e,"trentino-sued-tirol":e,"trentino-suedtirol":e,"trentinoa-adige":e,trentinoaadige:e,"trentinoalto-adige":e,trentinoaltoadige:e,"trentinos-tirol":e,trentinostirol:e,"trentinosud-tirol":e,"xn--trentinosd-tirol-rzb":e,"trentinosüd-tirol":e,trentinosudtirol:e,"xn--trentinosdtirol-7vb":e,trentinosüdtirol:e,"trentinosued-tirol":e,trentinosuedtirol:e,"trentinsud-tirol":e,"xn--trentinsd-tirol-6vb":e,"trentinsüd-tirol":e,trentinsudtirol:e,"xn--trentinsdtirol-nsb":e,trentinsüdtirol:e,"trentinsued-tirol":e,trentinsuedtirol:e,tuscany:e,umb:e,umbria:e,"val-d-aosta":e,"val-daosta":e,"vald-aosta":e,valdaosta:e,"valle-aosta":e,"valle-d-aosta":e,"valle-daosta":e,valleaosta:e,"valled-aosta":e,valledaosta:e,"vallee-aoste":e,"xn--valle-aoste-ebb":e,"vallée-aoste":e,"vallee-d-aoste":e,"xn--valle-d-aoste-ehb":e,"vallée-d-aoste":e,valleeaoste:e,"xn--valleaoste-e7a":e,valléeaoste:e,valleedaoste:e,"xn--valledaoste-ebb":e,valléedaoste:e,vao:e,vda:e,ven:e,veneto:e,ag:e,agrigento:e,al:e,alessandria:e,"alto-adige":e,altoadige:e,an:e,ancona:e,"andria-barletta-trani":e,"andria-trani-barletta":e,andriabarlettatrani:e,andriatranibarletta:e,ao:e,aosta:e,aoste:e,ap:e,aq:e,aquila:e,ar:e,arezzo:e,"ascoli-piceno":e,ascolipiceno:e,asti:e,at:e,av:e,avellino:e,ba:e,balsan:e,"balsan-sudtirol":e,"xn--balsan-sdtirol-nsb":e,"balsan-südtirol":e,"balsan-suedtirol":e,bari:e,"barletta-trani-andria":e,barlettatraniandria:e,belluno:e,benevento:e,bergamo:e,bg:e,bi:e,biella:e,bl:e,bn:e,bo:e,bologna:e,bolzano:e,"bolzano-altoadige":e,bozen:e,"bozen-sudtirol":e,"xn--bozen-sdtirol-2ob":e,"bozen-südtirol":e,"bozen-suedtirol":e,br:e,brescia:e,brindisi:e,bs:e,bt:e,bulsan:e,"bulsan-sudtirol":e,"xn--bulsan-sdtirol-nsb":e,"bulsan-südtirol":e,"bulsan-suedtirol":e,bz:e,ca:e,cagliari:e,caltanissetta:e,"campidano-medio":e,campidanomedio:e,campobasso:e,"carbonia-iglesias":e,carboniaiglesias:e,"carrara-massa":e,carraramassa:e,caserta:e,catania:e,catanzaro:e,cb:e,ce:e,"cesena-forli":e,"xn--cesena-forl-mcb":e,"cesena-forlì":e,cesenaforli:e,"xn--cesenaforl-i8a":e,cesenaforlì:e,ch:e,chieti:e,ci:e,cl:e,cn:e,co:e,como:e,cosenza:e,cr:e,cremona:e,crotone:e,cs:e,ct:e,cuneo:e,cz:e,"dell-ogliastra":e,dellogliastra:e,en:e,enna:e,fc:e,fe:e,fermo:e,ferrara:e,fg:e,fi:e,firenze:e,florence:e,fm:e,foggia:e,"forli-cesena":e,"xn--forl-cesena-fcb":e,"forlì-cesena":e,forlicesena:e,"xn--forlcesena-c8a":e,forlìcesena:e,fr:e,frosinone:e,ge:e,genoa:e,genova:e,go:e,gorizia:e,gr:e,grosseto:e,"iglesias-carbonia":e,iglesiascarbonia:e,im:e,imperia:e,is:e,isernia:e,kr:e,"la-spezia":e,laquila:e,laspezia:e,latina:e,lc:e,le:e,lecce:e,lecco:e,li:e,livorno:e,lo:e,lodi:e,lt:e,lu:e,lucca:e,macerata:e,mantova:e,"massa-carrara":e,massacarrara:e,matera:e,mb:e,mc:e,me:e,"medio-campidano":e,mediocampidano:e,messina:e,mi:e,milan:e,milano:e,mn:e,mo:e,modena:e,monza:e,"monza-brianza":e,"monza-e-della-brianza":e,monzabrianza:e,monzaebrianza:e,monzaedellabrianza:e,ms:e,mt:e,na:e,naples:e,napoli:e,no:e,novara:e,nu:e,nuoro:e,og:e,ogliastra:e,"olbia-tempio":e,olbiatempio:e,or:e,oristano:e,ot:e,pa:e,padova:e,padua:e,palermo:e,parma:e,pavia:e,pc:e,pd:e,pe:e,perugia:e,"pesaro-urbino":e,pesarourbino:e,pescara:e,pg:e,pi:e,piacenza:e,pisa:e,pistoia:e,pn:e,po:e,pordenone:e,potenza:e,pr:e,prato:e,pt:e,pu:e,pv:e,pz:e,ra:e,ragusa:e,ravenna:e,rc:e,re:e,"reggio-calabria":e,"reggio-emilia":e,reggiocalabria:e,reggioemilia:e,rg:e,ri:e,rieti:e,rimini:e,rm:e,rn:e,ro:e,roma:e,rome:e,rovigo:e,sa:e,salerno:e,sassari:e,savona:e,si:e,siena:e,siracusa:e,so:e,sondrio:e,sp:e,sr:e,ss:e,"xn--sdtirol-n2a":e,südtirol:e,suedtirol:e,sv:e,ta:e,taranto:e,te:e,"tempio-olbia":e,tempioolbia:e,teramo:e,terni:e,tn:e,to:e,torino:e,tp:e,tr:e,"trani-andria-barletta":e,"trani-barletta-andria":e,traniandriabarletta:e,tranibarlettaandria:e,trapani:e,trento:e,treviso:e,trieste:e,ts:e,turin:e,tv:e,ud:e,udine:e,"urbino-pesaro":e,urbinopesaro:e,va:e,varese:e,vb:e,vc:e,ve:e,venezia:e,venice:e,verbania:e,vercelli:e,verona:e,vi:e,"vibo-valentia":e,vibovalentia:e,vicenza:e,viterbo:e,vr:e,vs:e,vt:e,vv:e,ibxos:t,iliadboxos:t,neen:[0,{jc:t}],"123homepage":t,"16-b":t,"32-b":t,"64-b":t,myspreadshop:t,syncloud:t}],je:[1,{co:e,net:e,org:e,of:t}],jm:y,jo:[1,{agri:e,ai:e,com:e,edu:e,eng:e,fm:e,gov:e,mil:e,net:e,org:e,per:e,phd:e,sch:e,tv:e}],jobs:e,jp:[1,{ac:e,ad:e,co:e,ed:e,go:e,gr:e,lg:e,ne:[1,{aseinet:me,gehirn:t,ivory:t,"mail-box":t,mints:t,mokuren:t,opal:t,sakura:t,sumomo:t,topaz:t}],or:e,aichi:[1,{aisai:e,ama:e,anjo:e,asuke:e,chiryu:e,chita:e,fuso:e,gamagori:e,handa:e,hazu:e,hekinan:e,higashiura:e,ichinomiya:e,inazawa:e,inuyama:e,isshiki:e,iwakura:e,kanie:e,kariya:e,kasugai:e,kira:e,kiyosu:e,komaki:e,konan:e,kota:e,mihama:e,miyoshi:e,nishio:e,nisshin:e,obu:e,oguchi:e,oharu:e,okazaki:e,owariasahi:e,seto:e,shikatsu:e,shinshiro:e,shitara:e,tahara:e,takahama:e,tobishima:e,toei:e,togo:e,tokai:e,tokoname:e,toyoake:e,toyohashi:e,toyokawa:e,toyone:e,toyota:e,tsushima:e,yatomi:e}],akita:[1,{akita:e,daisen:e,fujisato:e,gojome:e,hachirogata:e,happou:e,higashinaruse:e,honjo:e,honjyo:e,ikawa:e,kamikoani:e,kamioka:e,katagami:e,kazuno:e,kitaakita:e,kosaka:e,kyowa:e,misato:e,mitane:e,moriyoshi:e,nikaho:e,noshiro:e,odate:e,oga:e,ogata:e,semboku:e,yokote:e,yurihonjo:e}],aomori:[1,{aomori:e,gonohe:e,hachinohe:e,hashikami:e,hiranai:e,hirosaki:e,itayanagi:e,kuroishi:e,misawa:e,mutsu:e,nakadomari:e,noheji:e,oirase:e,owani:e,rokunohe:e,sannohe:e,shichinohe:e,shingo:e,takko:e,towada:e,tsugaru:e,tsuruta:e}],chiba:[1,{abiko:e,asahi:e,chonan:e,chosei:e,choshi:e,chuo:e,funabashi:e,futtsu:e,hanamigawa:e,ichihara:e,ichikawa:e,ichinomiya:e,inzai:e,isumi:e,kamagaya:e,kamogawa:e,kashiwa:e,katori:e,katsuura:e,kimitsu:e,kisarazu:e,kozaki:e,kujukuri:e,kyonan:e,matsudo:e,midori:e,mihama:e,minamiboso:e,mobara:e,mutsuzawa:e,nagara:e,nagareyama:e,narashino:e,narita:e,noda:e,oamishirasato:e,omigawa:e,onjuku:e,otaki:e,sakae:e,sakura:e,shimofusa:e,shirako:e,shiroi:e,shisui:e,sodegaura:e,sosa:e,tako:e,tateyama:e,togane:e,tohnosho:e,tomisato:e,urayasu:e,yachimata:e,yachiyo:e,yokaichiba:e,yokoshibahikari:e,yotsukaido:e}],ehime:[1,{ainan:e,honai:e,ikata:e,imabari:e,iyo:e,kamijima:e,kihoku:e,kumakogen:e,masaki:e,matsuno:e,matsuyama:e,namikata:e,niihama:e,ozu:e,saijo:e,seiyo:e,shikokuchuo:e,tobe:e,toon:e,uchiko:e,uwajima:e,yawatahama:e}],fukui:[1,{echizen:e,eiheiji:e,fukui:e,ikeda:e,katsuyama:e,mihama:e,minamiechizen:e,obama:e,ohi:e,ono:e,sabae:e,sakai:e,takahama:e,tsuruga:e,wakasa:e}],fukuoka:[1,{ashiya:e,buzen:e,chikugo:e,chikuho:e,chikujo:e,chikushino:e,chikuzen:e,chuo:e,dazaifu:e,fukuchi:e,hakata:e,higashi:e,hirokawa:e,hisayama:e,iizuka:e,inatsuki:e,kaho:e,kasuga:e,kasuya:e,kawara:e,keisen:e,koga:e,kurate:e,kurogi:e,kurume:e,minami:e,miyako:e,miyama:e,miyawaka:e,mizumaki:e,munakata:e,nakagawa:e,nakama:e,nishi:e,nogata:e,ogori:e,okagaki:e,okawa:e,oki:e,omuta:e,onga:e,onojo:e,oto:e,saigawa:e,sasaguri:e,shingu:e,shinyoshitomi:e,shonai:e,soeda:e,sue:e,tachiarai:e,tagawa:e,takata:e,toho:e,toyotsu:e,tsuiki:e,ukiha:e,umi:e,usui:e,yamada:e,yame:e,yanagawa:e,yukuhashi:e}],fukushima:[1,{aizubange:e,aizumisato:e,aizuwakamatsu:e,asakawa:e,bandai:e,date:e,fukushima:e,furudono:e,futaba:e,hanawa:e,higashi:e,hirata:e,hirono:e,iitate:e,inawashiro:e,ishikawa:e,iwaki:e,izumizaki:e,kagamiishi:e,kaneyama:e,kawamata:e,kitakata:e,kitashiobara:e,koori:e,koriyama:e,kunimi:e,miharu:e,mishima:e,namie:e,nango:e,nishiaizu:e,nishigo:e,okuma:e,omotego:e,ono:e,otama:e,samegawa:e,shimogo:e,shirakawa:e,showa:e,soma:e,sukagawa:e,taishin:e,tamakawa:e,tanagura:e,tenei:e,yabuki:e,yamato:e,yamatsuri:e,yanaizu:e,yugawa:e}],gifu:[1,{anpachi:e,ena:e,gifu:e,ginan:e,godo:e,gujo:e,hashima:e,hichiso:e,hida:e,higashishirakawa:e,ibigawa:e,ikeda:e,kakamigahara:e,kani:e,kasahara:e,kasamatsu:e,kawaue:e,kitagata:e,mino:e,minokamo:e,mitake:e,mizunami:e,motosu:e,nakatsugawa:e,ogaki:e,sakahogi:e,seki:e,sekigahara:e,shirakawa:e,tajimi:e,takayama:e,tarui:e,toki:e,tomika:e,wanouchi:e,yamagata:e,yaotsu:e,yoro:e}],gunma:[1,{annaka:e,chiyoda:e,fujioka:e,higashiagatsuma:e,isesaki:e,itakura:e,kanna:e,kanra:e,katashina:e,kawaba:e,kiryu:e,kusatsu:e,maebashi:e,meiwa:e,midori:e,minakami:e,naganohara:e,nakanojo:e,nanmoku:e,numata:e,oizumi:e,ora:e,ota:e,shibukawa:e,shimonita:e,shinto:e,showa:e,takasaki:e,takayama:e,tamamura:e,tatebayashi:e,tomioka:e,tsukiyono:e,tsumagoi:e,ueno:e,yoshioka:e}],hiroshima:[1,{asaminami:e,daiwa:e,etajima:e,fuchu:e,fukuyama:e,hatsukaichi:e,higashihiroshima:e,hongo:e,jinsekikogen:e,kaita:e,kui:e,kumano:e,kure:e,mihara:e,miyoshi:e,naka:e,onomichi:e,osakikamijima:e,otake:e,saka:e,sera:e,seranishi:e,shinichi:e,shobara:e,takehara:e}],hokkaido:[1,{abashiri:e,abira:e,aibetsu:e,akabira:e,akkeshi:e,asahikawa:e,ashibetsu:e,ashoro:e,assabu:e,atsuma:e,bibai:e,biei:e,bifuka:e,bihoro:e,biratori:e,chippubetsu:e,chitose:e,date:e,ebetsu:e,embetsu:e,eniwa:e,erimo:e,esan:e,esashi:e,fukagawa:e,fukushima:e,furano:e,furubira:e,haboro:e,hakodate:e,hamatonbetsu:e,hidaka:e,higashikagura:e,higashikawa:e,hiroo:e,hokuryu:e,hokuto:e,honbetsu:e,horokanai:e,horonobe:e,ikeda:e,imakane:e,ishikari:e,iwamizawa:e,iwanai:e,kamifurano:e,kamikawa:e,kamishihoro:e,kamisunagawa:e,kamoenai:e,kayabe:e,kembuchi:e,kikonai:e,kimobetsu:e,kitahiroshima:e,kitami:e,kiyosato:e,koshimizu:e,kunneppu:e,kuriyama:e,kuromatsunai:e,kushiro:e,kutchan:e,kyowa:e,mashike:e,matsumae:e,mikasa:e,minamifurano:e,mombetsu:e,moseushi:e,mukawa:e,muroran:e,naie:e,nakagawa:e,nakasatsunai:e,nakatombetsu:e,nanae:e,nanporo:e,nayoro:e,nemuro:e,niikappu:e,niki:e,nishiokoppe:e,noboribetsu:e,numata:e,obihiro:e,obira:e,oketo:e,okoppe:e,otaru:e,otobe:e,otofuke:e,otoineppu:e,oumu:e,ozora:e,pippu:e,rankoshi:e,rebun:e,rikubetsu:e,rishiri:e,rishirifuji:e,saroma:e,sarufutsu:e,shakotan:e,shari:e,shibecha:e,shibetsu:e,shikabe:e,shikaoi:e,shimamaki:e,shimizu:e,shimokawa:e,shinshinotsu:e,shintoku:e,shiranuka:e,shiraoi:e,shiriuchi:e,sobetsu:e,sunagawa:e,taiki:e,takasu:e,takikawa:e,takinoue:e,teshikaga:e,tobetsu:e,tohma:e,tomakomai:e,tomari:e,toya:e,toyako:e,toyotomi:e,toyoura:e,tsubetsu:e,tsukigata:e,urakawa:e,urausu:e,uryu:e,utashinai:e,wakkanai:e,wassamu:e,yakumo:e,yoichi:e}],hyogo:[1,{aioi:e,akashi:e,ako:e,amagasaki:e,aogaki:e,asago:e,ashiya:e,awaji:e,fukusaki:e,goshiki:e,harima:e,himeji:e,ichikawa:e,inagawa:e,itami:e,kakogawa:e,kamigori:e,kamikawa:e,kasai:e,kasuga:e,kawanishi:e,miki:e,minamiawaji:e,nishinomiya:e,nishiwaki:e,ono:e,sanda:e,sannan:e,sasayama:e,sayo:e,shingu:e,shinonsen:e,shiso:e,sumoto:e,taishi:e,taka:e,takarazuka:e,takasago:e,takino:e,tamba:e,tatsuno:e,toyooka:e,yabu:e,yashiro:e,yoka:e,yokawa:e}],ibaraki:[1,{ami:e,asahi:e,bando:e,chikusei:e,daigo:e,fujishiro:e,hitachi:e,hitachinaka:e,hitachiomiya:e,hitachiota:e,ibaraki:e,ina:e,inashiki:e,itako:e,iwama:e,joso:e,kamisu:e,kasama:e,kashima:e,kasumigaura:e,koga:e,miho:e,mito:e,moriya:e,naka:e,namegata:e,oarai:e,ogawa:e,omitama:e,ryugasaki:e,sakai:e,sakuragawa:e,shimodate:e,shimotsuma:e,shirosato:e,sowa:e,suifu:e,takahagi:e,tamatsukuri:e,tokai:e,tomobe:e,tone:e,toride:e,tsuchiura:e,tsukuba:e,uchihara:e,ushiku:e,yachiyo:e,yamagata:e,yawara:e,yuki:e}],ishikawa:[1,{anamizu:e,hakui:e,hakusan:e,kaga:e,kahoku:e,kanazawa:e,kawakita:e,komatsu:e,nakanoto:e,nanao:e,nomi:e,nonoichi:e,noto:e,shika:e,suzu:e,tsubata:e,tsurugi:e,uchinada:e,wajima:e}],iwate:[1,{fudai:e,fujisawa:e,hanamaki:e,hiraizumi:e,hirono:e,ichinohe:e,ichinoseki:e,iwaizumi:e,iwate:e,joboji:e,kamaishi:e,kanegasaki:e,karumai:e,kawai:e,kitakami:e,kuji:e,kunohe:e,kuzumaki:e,miyako:e,mizusawa:e,morioka:e,ninohe:e,noda:e,ofunato:e,oshu:e,otsuchi:e,rikuzentakata:e,shiwa:e,shizukuishi:e,sumita:e,tanohata:e,tono:e,yahaba:e,yamada:e}],kagawa:[1,{ayagawa:e,higashikagawa:e,kanonji:e,kotohira:e,manno:e,marugame:e,mitoyo:e,naoshima:e,sanuki:e,tadotsu:e,takamatsu:e,tonosho:e,uchinomi:e,utazu:e,zentsuji:e}],kagoshima:[1,{akune:e,amami:e,hioki:e,isa:e,isen:e,izumi:e,kagoshima:e,kanoya:e,kawanabe:e,kinko:e,kouyama:e,makurazaki:e,matsumoto:e,minamitane:e,nakatane:e,nishinoomote:e,satsumasendai:e,soo:e,tarumizu:e,yusui:e}],kanagawa:[1,{aikawa:e,atsugi:e,ayase:e,chigasaki:e,ebina:e,fujisawa:e,hadano:e,hakone:e,hiratsuka:e,isehara:e,kaisei:e,kamakura:e,kiyokawa:e,matsuda:e,minamiashigara:e,miura:e,nakai:e,ninomiya:e,odawara:e,oi:e,oiso:e,sagamihara:e,samukawa:e,tsukui:e,yamakita:e,yamato:e,yokosuka:e,yugawara:e,zama:e,zushi:e}],kochi:[1,{aki:e,geisei:e,hidaka:e,higashitsuno:e,ino:e,kagami:e,kami:e,kitagawa:e,kochi:e,mihara:e,motoyama:e,muroto:e,nahari:e,nakamura:e,nankoku:e,nishitosa:e,niyodogawa:e,ochi:e,okawa:e,otoyo:e,otsuki:e,sakawa:e,sukumo:e,susaki:e,tosa:e,tosashimizu:e,toyo:e,tsuno:e,umaji:e,yasuda:e,yusuhara:e}],kumamoto:[1,{amakusa:e,arao:e,aso:e,choyo:e,gyokuto:e,kamiamakusa:e,kikuchi:e,kumamoto:e,mashiki:e,mifune:e,minamata:e,minamioguni:e,nagasu:e,nishihara:e,oguni:e,ozu:e,sumoto:e,takamori:e,uki:e,uto:e,yamaga:e,yamato:e,yatsushiro:e}],kyoto:[1,{ayabe:e,fukuchiyama:e,higashiyama:e,ide:e,ine:e,joyo:e,kameoka:e,kamo:e,kita:e,kizu:e,kumiyama:e,kyotamba:e,kyotanabe:e,kyotango:e,maizuru:e,minami:e,minamiyamashiro:e,miyazu:e,muko:e,nagaokakyo:e,nakagyo:e,nantan:e,oyamazaki:e,sakyo:e,seika:e,tanabe:e,uji:e,ujitawara:e,wazuka:e,yamashina:e,yawata:e}],mie:[1,{asahi:e,inabe:e,ise:e,kameyama:e,kawagoe:e,kiho:e,kisosaki:e,kiwa:e,komono:e,kumano:e,kuwana:e,matsusaka:e,meiwa:e,mihama:e,minamiise:e,misugi:e,miyama:e,nabari:e,shima:e,suzuka:e,tado:e,taiki:e,taki:e,tamaki:e,toba:e,tsu:e,udono:e,ureshino:e,watarai:e,yokkaichi:e}],miyagi:[1,{furukawa:e,higashimatsushima:e,ishinomaki:e,iwanuma:e,kakuda:e,kami:e,kawasaki:e,marumori:e,matsushima:e,minamisanriku:e,misato:e,murata:e,natori:e,ogawara:e,ohira:e,onagawa:e,osaki:e,rifu:e,semine:e,shibata:e,shichikashuku:e,shikama:e,shiogama:e,shiroishi:e,tagajo:e,taiwa:e,tome:e,tomiya:e,wakuya:e,watari:e,yamamoto:e,zao:e}],miyazaki:[1,{aya:e,ebino:e,gokase:e,hyuga:e,kadogawa:e,kawaminami:e,kijo:e,kitagawa:e,kitakata:e,kitaura:e,kobayashi:e,kunitomi:e,kushima:e,mimata:e,miyakonojo:e,miyazaki:e,morotsuka:e,nichinan:e,nishimera:e,nobeoka:e,saito:e,shiiba:e,shintomi:e,takaharu:e,takanabe:e,takazaki:e,tsuno:e}],nagano:[1,{achi:e,agematsu:e,anan:e,aoki:e,asahi:e,azumino:e,chikuhoku:e,chikuma:e,chino:e,fujimi:e,hakuba:e,hara:e,hiraya:e,iida:e,iijima:e,iiyama:e,iizuna:e,ikeda:e,ikusaka:e,ina:e,karuizawa:e,kawakami:e,kiso:e,kisofukushima:e,kitaaiki:e,komagane:e,komoro:e,matsukawa:e,matsumoto:e,miasa:e,minamiaiki:e,minamimaki:e,minamiminowa:e,minowa:e,miyada:e,miyota:e,mochizuki:e,nagano:e,nagawa:e,nagiso:e,nakagawa:e,nakano:e,nozawaonsen:e,obuse:e,ogawa:e,okaya:e,omachi:e,omi:e,ookuwa:e,ooshika:e,otaki:e,otari:e,sakae:e,sakaki:e,saku:e,sakuho:e,shimosuwa:e,shinanomachi:e,shiojiri:e,suwa:e,suzaka:e,takagi:e,takamori:e,takayama:e,tateshina:e,tatsuno:e,togakushi:e,togura:e,tomi:e,ueda:e,wada:e,yamagata:e,yamanouchi:e,yasaka:e,yasuoka:e}],nagasaki:[1,{chijiwa:e,futsu:e,goto:e,hasami:e,hirado:e,iki:e,isahaya:e,kawatana:e,kuchinotsu:e,matsuura:e,nagasaki:e,obama:e,omura:e,oseto:e,saikai:e,sasebo:e,seihi:e,shimabara:e,shinkamigoto:e,togitsu:e,tsushima:e,unzen:e}],nara:[1,{ando:e,gose:e,heguri:e,higashiyoshino:e,ikaruga:e,ikoma:e,kamikitayama:e,kanmaki:e,kashiba:e,kashihara:e,katsuragi:e,kawai:e,kawakami:e,kawanishi:e,koryo:e,kurotaki:e,mitsue:e,miyake:e,nara:e,nosegawa:e,oji:e,ouda:e,oyodo:e,sakurai:e,sango:e,shimoichi:e,shimokitayama:e,shinjo:e,soni:e,takatori:e,tawaramoto:e,tenkawa:e,tenri:e,uda:e,yamatokoriyama:e,yamatotakada:e,yamazoe:e,yoshino:e}],niigata:[1,{aga:e,agano:e,gosen:e,itoigawa:e,izumozaki:e,joetsu:e,kamo:e,kariwa:e,kashiwazaki:e,minamiuonuma:e,mitsuke:e,muika:e,murakami:e,myoko:e,nagaoka:e,niigata:e,ojiya:e,omi:e,sado:e,sanjo:e,seiro:e,seirou:e,sekikawa:e,shibata:e,tagami:e,tainai:e,tochio:e,tokamachi:e,tsubame:e,tsunan:e,uonuma:e,yahiko:e,yoita:e,yuzawa:e}],oita:[1,{beppu:e,bungoono:e,bungotakada:e,hasama:e,hiji:e,himeshima:e,hita:e,kamitsue:e,kokonoe:e,kuju:e,kunisaki:e,kusu:e,oita:e,saiki:e,taketa:e,tsukumi:e,usa:e,usuki:e,yufu:e}],okayama:[1,{akaiwa:e,asakuchi:e,bizen:e,hayashima:e,ibara:e,kagamino:e,kasaoka:e,kibichuo:e,kumenan:e,kurashiki:e,maniwa:e,misaki:e,nagi:e,niimi:e,nishiawakura:e,okayama:e,satosho:e,setouchi:e,shinjo:e,shoo:e,soja:e,takahashi:e,tamano:e,tsuyama:e,wake:e,yakage:e}],okinawa:[1,{aguni:e,ginowan:e,ginoza:e,gushikami:e,haebaru:e,higashi:e,hirara:e,iheya:e,ishigaki:e,ishikawa:e,itoman:e,izena:e,kadena:e,kin:e,kitadaito:e,kitanakagusuku:e,kumejima:e,kunigami:e,minamidaito:e,motobu:e,nago:e,naha:e,nakagusuku:e,nakijin:e,nanjo:e,nishihara:e,ogimi:e,okinawa:e,onna:e,shimoji:e,taketomi:e,tarama:e,tokashiki:e,tomigusuku:e,tonaki:e,urasoe:e,uruma:e,yaese:e,yomitan:e,yonabaru:e,yonaguni:e,zamami:e}],osaka:[1,{abeno:e,chihayaakasaka:e,chuo:e,daito:e,fujiidera:e,habikino:e,hannan:e,higashiosaka:e,higashisumiyoshi:e,higashiyodogawa:e,hirakata:e,ibaraki:e,ikeda:e,izumi:e,izumiotsu:e,izumisano:e,kadoma:e,kaizuka:e,kanan:e,kashiwara:e,katano:e,kawachinagano:e,kishiwada:e,kita:e,kumatori:e,matsubara:e,minato:e,minoh:e,misaki:e,moriguchi:e,neyagawa:e,nishi:e,nose:e,osakasayama:e,sakai:e,sayama:e,sennan:e,settsu:e,shijonawate:e,shimamoto:e,suita:e,tadaoka:e,taishi:e,tajiri:e,takaishi:e,takatsuki:e,tondabayashi:e,toyonaka:e,toyono:e,yao:e}],saga:[1,{ariake:e,arita:e,fukudomi:e,genkai:e,hamatama:e,hizen:e,imari:e,kamimine:e,kanzaki:e,karatsu:e,kashima:e,kitagata:e,kitahata:e,kiyama:e,kouhoku:e,kyuragi:e,nishiarita:e,ogi:e,omachi:e,ouchi:e,saga:e,shiroishi:e,taku:e,tara:e,tosu:e,yoshinogari:e}],saitama:[1,{arakawa:e,asaka:e,chichibu:e,fujimi:e,fujimino:e,fukaya:e,hanno:e,hanyu:e,hasuda:e,hatogaya:e,hatoyama:e,hidaka:e,higashichichibu:e,higashimatsuyama:e,honjo:e,ina:e,iruma:e,iwatsuki:e,kamiizumi:e,kamikawa:e,kamisato:e,kasukabe:e,kawagoe:e,kawaguchi:e,kawajima:e,kazo:e,kitamoto:e,koshigaya:e,kounosu:e,kuki:e,kumagaya:e,matsubushi:e,minano:e,misato:e,miyashiro:e,miyoshi:e,moroyama:e,nagatoro:e,namegawa:e,niiza:e,ogano:e,ogawa:e,ogose:e,okegawa:e,omiya:e,otaki:e,ranzan:e,ryokami:e,saitama:e,sakado:e,satte:e,sayama:e,shiki:e,shiraoka:e,soka:e,sugito:e,toda:e,tokigawa:e,tokorozawa:e,tsurugashima:e,urawa:e,warabi:e,yashio:e,yokoze:e,yono:e,yorii:e,yoshida:e,yoshikawa:e,yoshimi:e}],shiga:[1,{aisho:e,gamo:e,higashiomi:e,hikone:e,koka:e,konan:e,kosei:e,koto:e,kusatsu:e,maibara:e,moriyama:e,nagahama:e,nishiazai:e,notogawa:e,omihachiman:e,otsu:e,ritto:e,ryuoh:e,takashima:e,takatsuki:e,torahime:e,toyosato:e,yasu:e}],shimane:[1,{akagi:e,ama:e,gotsu:e,hamada:e,higashiizumo:e,hikawa:e,hikimi:e,izumo:e,kakinoki:e,masuda:e,matsue:e,misato:e,nishinoshima:e,ohda:e,okinoshima:e,okuizumo:e,shimane:e,tamayu:e,tsuwano:e,unnan:e,yakumo:e,yasugi:e,yatsuka:e}],shizuoka:[1,{arai:e,atami:e,fuji:e,fujieda:e,fujikawa:e,fujinomiya:e,fukuroi:e,gotemba:e,haibara:e,hamamatsu:e,higashiizu:e,ito:e,iwata:e,izu:e,izunokuni:e,kakegawa:e,kannami:e,kawanehon:e,kawazu:e,kikugawa:e,kosai:e,makinohara:e,matsuzaki:e,minamiizu:e,mishima:e,morimachi:e,nishiizu:e,numazu:e,omaezaki:e,shimada:e,shimizu:e,shimoda:e,shizuoka:e,susono:e,yaizu:e,yoshida:e}],tochigi:[1,{ashikaga:e,bato:e,haga:e,ichikai:e,iwafune:e,kaminokawa:e,kanuma:e,karasuyama:e,kuroiso:e,mashiko:e,mibu:e,moka:e,motegi:e,nasu:e,nasushiobara:e,nikko:e,nishikata:e,nogi:e,ohira:e,ohtawara:e,oyama:e,sakura:e,sano:e,shimotsuke:e,shioya:e,takanezawa:e,tochigi:e,tsuga:e,ujiie:e,utsunomiya:e,yaita:e}],tokushima:[1,{aizumi:e,anan:e,ichiba:e,itano:e,kainan:e,komatsushima:e,matsushige:e,mima:e,minami:e,miyoshi:e,mugi:e,nakagawa:e,naruto:e,sanagochi:e,shishikui:e,tokushima:e,wajiki:e}],tokyo:[1,{adachi:e,akiruno:e,akishima:e,aogashima:e,arakawa:e,bunkyo:e,chiyoda:e,chofu:e,chuo:e,edogawa:e,fuchu:e,fussa:e,hachijo:e,hachioji:e,hamura:e,higashikurume:e,higashimurayama:e,higashiyamato:e,hino:e,hinode:e,hinohara:e,inagi:e,itabashi:e,katsushika:e,kita:e,kiyose:e,kodaira:e,koganei:e,kokubunji:e,komae:e,koto:e,kouzushima:e,kunitachi:e,machida:e,meguro:e,minato:e,mitaka:e,mizuho:e,musashimurayama:e,musashino:e,nakano:e,nerima:e,ogasawara:e,okutama:e,ome:e,oshima:e,ota:e,setagaya:e,shibuya:e,shinagawa:e,shinjuku:e,suginami:e,sumida:e,tachikawa:e,taito:e,tama:e,toshima:e}],tottori:[1,{chizu:e,hino:e,kawahara:e,koge:e,kotoura:e,misasa:e,nanbu:e,nichinan:e,sakaiminato:e,tottori:e,wakasa:e,yazu:e,yonago:e}],toyama:[1,{asahi:e,fuchu:e,fukumitsu:e,funahashi:e,himi:e,imizu:e,inami:e,johana:e,kamiichi:e,kurobe:e,nakaniikawa:e,namerikawa:e,nanto:e,nyuzen:e,oyabe:e,taira:e,takaoka:e,tateyama:e,toga:e,tonami:e,toyama:e,unazuki:e,uozu:e,yamada:e}],wakayama:[1,{arida:e,aridagawa:e,gobo:e,hashimoto:e,hidaka:e,hirogawa:e,inami:e,iwade:e,kainan:e,kamitonda:e,katsuragi:e,kimino:e,kinokawa:e,kitayama:e,koya:e,koza:e,kozagawa:e,kudoyama:e,kushimoto:e,mihama:e,misato:e,nachikatsuura:e,shingu:e,shirahama:e,taiji:e,tanabe:e,wakayama:e,yuasa:e,yura:e}],yamagata:[1,{asahi:e,funagata:e,higashine:e,iide:e,kahoku:e,kaminoyama:e,kaneyama:e,kawanishi:e,mamurogawa:e,mikawa:e,murayama:e,nagai:e,nakayama:e,nanyo:e,nishikawa:e,obanazawa:e,oe:e,oguni:e,ohkura:e,oishida:e,sagae:e,sakata:e,sakegawa:e,shinjo:e,shirataka:e,shonai:e,takahata:e,tendo:e,tozawa:e,tsuruoka:e,yamagata:e,yamanobe:e,yonezawa:e,yuza:e}],yamaguchi:[1,{abu:e,hagi:e,hikari:e,hofu:e,iwakuni:e,kudamatsu:e,mitou:e,nagato:e,oshima:e,shimonoseki:e,shunan:e,tabuse:e,tokuyama:e,toyota:e,ube:e,yuu:e}],yamanashi:[1,{chuo:e,doshi:e,fuefuki:e,fujikawa:e,fujikawaguchiko:e,fujiyoshida:e,hayakawa:e,hokuto:e,ichikawamisato:e,kai:e,kofu:e,koshu:e,kosuge:e,"minami-alps":e,minobu:e,nakamichi:e,nanbu:e,narusawa:e,nirasaki:e,nishikatsura:e,oshino:e,otsuki:e,showa:e,tabayama:e,tsuru:e,uenohara:e,yamanakako:e,yamanashi:e}],"xn--ehqz56n":e,三重:e,"xn--1lqs03n":e,京都:e,"xn--qqqt11m":e,佐賀:e,"xn--f6qx53a":e,兵庫:e,"xn--djrs72d6uy":e,北海道:e,"xn--mkru45i":e,千葉:e,"xn--0trq7p7nn":e,和歌山:e,"xn--5js045d":e,埼玉:e,"xn--kbrq7o":e,大分:e,"xn--pssu33l":e,大阪:e,"xn--ntsq17g":e,奈良:e,"xn--uisz3g":e,宮城:e,"xn--6btw5a":e,宮崎:e,"xn--1ctwo":e,富山:e,"xn--6orx2r":e,山口:e,"xn--rht61e":e,山形:e,"xn--rht27z":e,山梨:e,"xn--nit225k":e,岐阜:e,"xn--rht3d":e,岡山:e,"xn--djty4k":e,岩手:e,"xn--klty5x":e,島根:e,"xn--kltx9a":e,広島:e,"xn--kltp7d":e,徳島:e,"xn--c3s14m":e,愛媛:e,"xn--vgu402c":e,愛知:e,"xn--efvn9s":e,新潟:e,"xn--1lqs71d":e,東京:e,"xn--4pvxs":e,栃木:e,"xn--uuwu58a":e,沖縄:e,"xn--zbx025d":e,滋賀:e,"xn--8pvr4u":e,熊本:e,"xn--5rtp49c":e,石川:e,"xn--ntso0iqx3a":e,神奈川:e,"xn--elqq16h":e,福井:e,"xn--4it168d":e,福岡:e,"xn--klt787d":e,福島:e,"xn--rny31h":e,秋田:e,"xn--7t0a264c":e,群馬:e,"xn--uist22h":e,茨城:e,"xn--8ltr62k":e,長崎:e,"xn--2m4a15e":e,長野:e,"xn--32vp30h":e,青森:e,"xn--4it797k":e,静岡:e,"xn--5rtq34k":e,香川:e,"xn--k7yn95e":e,高知:e,"xn--tor131o":e,鳥取:e,"xn--d5qv7z876c":e,鹿児島:e,kawasaki:y,kitakyushu:y,kobe:y,nagoya:y,sapporo:y,sendai:y,yokohama:y,buyshop:t,fashionstore:t,handcrafted:t,kawaiishop:t,supersale:t,theshop:t,"0am":t,"0g0":t,"0j0":t,"0t0":t,mydns:t,pgw:t,wjg:t,usercontent:t,angry:t,babyblue:t,babymilk:t,backdrop:t,bambina:t,bitter:t,blush:t,boo:t,boy:t,boyfriend:t,but:t,candypop:t,capoo:t,catfood:t,cheap:t,chicappa:t,chillout:t,chips:t,chowder:t,chu:t,ciao:t,cocotte:t,coolblog:t,cranky:t,cutegirl:t,daa:t,deca:t,deci:t,digick:t,egoism:t,fakefur:t,fem:t,flier:t,floppy:t,fool:t,frenchkiss:t,girlfriend:t,girly:t,gloomy:t,gonna:t,greater:t,hacca:t,heavy:t,her:t,hiho:t,hippy:t,holy:t,hungry:t,icurus:t,itigo:t,jellybean:t,kikirara:t,kill:t,kilo:t,kuron:t,littlestar:t,lolipopmc:t,lolitapunk:t,lomo:t,lovepop:t,lovesick:t,main:t,mods:t,mond:t,mongolian:t,moo:t,namaste:t,nikita:t,nobushi:t,noor:t,oops:t,parallel:t,parasite:t,pecori:t,peewee:t,penne:t,pepper:t,perma:t,pigboat:t,pinoko:t,punyu:t,pupu:t,pussycat:t,pya:t,raindrop:t,readymade:t,sadist:t,schoolbus:t,secret:t,staba:t,stripper:t,sub:t,sunnyday:t,thick:t,tonkotsu:t,under:t,upper:t,velvet:t,verse:t,versus:t,vivian:t,watson:t,weblike:t,whitesnow:t,zombie:t,hateblo:t,hatenablog:t,hatenadiary:t,"2-d":t,bona:t,crap:t,daynight:t,eek:t,flop:t,halfmoon:t,jeez:t,matrix:t,mimoza:t,netgamers:t,nyanta:t,o0o0:t,rdy:t,rgr:t,rulez:t,sakurastorage:[0,{isk01:be,isk02:be}],saloon:t,sblo:t,skr:t,tank:t,"uh-oh":t,undo:t,webaccel:[0,{rs:t,user:t}],websozai:t,xii:t}],ke:[1,{ac:e,co:e,go:e,info:e,me:e,mobi:e,ne:e,or:e,sc:e}],kg:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,us:t,xx:t,ae:t}],kh:n,ki:xe,km:[1,{ass:e,com:e,edu:e,gov:e,mil:e,nom:e,org:e,prd:e,tm:e,asso:e,coop:e,gouv:e,medecin:e,notaires:e,pharmaciens:e,presse:e,veterinaire:e}],kn:[1,{edu:e,gov:e,net:e,org:e}],kp:[1,{com:e,edu:e,gov:e,org:e,rep:e,tra:e}],kr:[1,{ac:e,ai:e,co:e,es:e,go:e,hs:e,io:e,it:e,kg:e,me:e,mil:e,ms:e,ne:e,or:e,pe:e,re:e,sc:e,busan:e,chungbuk:e,chungnam:e,daegu:e,daejeon:e,gangwon:e,gwangju:e,gyeongbuk:e,gyeonggi:e,gyeongnam:e,incheon:e,jeju:e,jeonbuk:e,jeonnam:e,seoul:e,ulsan:e,c01:t,"eliv-api":t,"eliv-cdn":t,"eliv-dns":t,mmv:t,vki:t}],kw:[1,{com:e,edu:e,emb:e,gov:e,ind:e,net:e,org:e}],ky:le,kz:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,jcloud:t}],la:[1,{com:e,edu:e,gov:e,info:e,int:e,net:e,org:e,per:e,bnr:t}],lb:n,lc:[1,{co:e,com:e,edu:e,gov:e,net:e,org:e,oy:t}],li:e,lk:[1,{ac:e,assn:e,com:e,edu:e,gov:e,grp:e,hotel:e,int:e,ltd:e,net:e,ngo:e,org:e,sch:e,soc:e,web:e}],lr:n,ls:[1,{ac:e,biz:e,co:e,edu:e,gov:e,info:e,net:e,org:e,sc:e}],lt:c,lu:[1,{"123website":t}],lv:[1,{asn:e,com:e,conf:e,edu:e,gov:e,id:e,mil:e,net:e,org:e}],ly:[1,{com:e,edu:e,gov:e,id:e,med:e,net:e,org:e,plc:e,sch:e}],ma:[1,{ac:e,co:e,gov:e,net:e,org:e,press:e}],mc:[1,{asso:e,tm:e}],md:[1,{ir:t}],me:[1,{ac:e,co:e,edu:e,gov:e,its:e,net:e,org:e,priv:e,c66:t,craft:t,edgestack:t,mybox:t,filegear:t,"filegear-sg":t,lohmus:t,barsy:t,mcdir:t,brasilia:t,ddns:t,dnsfor:t,hopto:t,loginto:t,noip:t,webhop:t,soundcast:t,tcp4:t,vp4:t,diskstation:t,dscloud:t,i234:t,myds:t,synology:t,transip:ce,nohost:t}],mg:[1,{co:e,com:e,edu:e,gov:e,mil:e,nom:e,org:e,prd:e}],mh:e,mil:e,mk:[1,{com:e,edu:e,gov:e,inf:e,name:e,net:e,org:e}],ml:[1,{ac:e,art:e,asso:e,com:e,edu:e,gouv:e,gov:e,info:e,inst:e,net:e,org:e,pr:e,presse:e}],mm:y,mn:[1,{edu:e,gov:e,org:e,nyc:t}],mo:n,mobi:[1,{barsy:t,dscloud:t}],mp:[1,{ju:t}],mq:e,mr:c,ms:[1,{com:e,edu:e,gov:e,net:e,org:e,minisite:t}],mt:le,mu:[1,{ac:e,co:e,com:e,gov:e,net:e,or:e,org:e}],museum:e,mv:[1,{aero:e,biz:e,com:e,coop:e,edu:e,gov:e,info:e,int:e,mil:e,museum:e,name:e,net:e,org:e,pro:e}],mw:[1,{ac:e,biz:e,co:e,com:e,coop:e,edu:e,gov:e,int:e,net:e,org:e}],mx:[1,{com:e,edu:e,gob:e,net:e,org:e}],my:[1,{biz:e,com:e,edu:e,gov:e,mil:e,name:e,net:e,org:e}],mz:[1,{ac:e,adv:e,co:e,edu:e,gov:e,mil:e,net:e,org:e}],na:[1,{alt:e,co:e,com:e,gov:e,net:e,org:e}],name:[1,{her:we,his:we,ispmanager:t,keenetic:t}],nc:[1,{asso:e,nom:e}],ne:e,net:[1,{adobeaemcloud:t,"adobeio-static":t,adobeioruntime:t,akadns:t,akamai:t,"akamai-staging":t,akamaiedge:t,"akamaiedge-staging":t,akamaihd:t,"akamaihd-staging":t,akamaiorigin:t,"akamaiorigin-staging":t,akamaized:t,"akamaized-staging":t,edgekey:t,"edgekey-staging":t,edgesuite:t,"edgesuite-staging":t,alwaysdata:t,myamaze:t,cloudfront:t,appudo:t,"atlassian-dev":[0,{prod:ge}],myfritz:t,shopselect:t,blackbaudcdn:t,boomla:t,bplaced:t,square7:t,cdn77:[0,{r:t}],"cdn77-ssl":t,gb:t,hu:t,jp:t,se:t,uk:t,clickrising:t,"ddns-ip":t,"dns-cloud":t,"dns-dynamic":t,cloudaccess:t,cloudflare:[2,{cdn:t}],cloudflareanycast:ge,cloudflarecn:ge,cloudflareglobal:ge,ctfcloud:t,"feste-ip":t,"knx-server":t,"static-access":t,cryptonomic:i,dattolocal:t,mydatto:t,debian:t,definima:t,deno:[2,{sandbox:t}],icp:i,de5:t,"at-band-camp":t,blogdns:t,"broke-it":t,buyshouses:t,dnsalias:t,dnsdojo:t,"does-it":t,dontexist:t,dynalias:t,dynathome:t,endofinternet:t,"from-az":t,"from-co":t,"from-la":t,"from-ny":t,"gets-it":t,"ham-radio-op":t,homeftp:t,homeip:t,homelinux:t,homeunix:t,"in-the-band":t,"is-a-chef":t,"is-a-geek":t,"isa-geek":t,"kicks-ass":t,"office-on-the":t,podzone:t,"scrapper-site":t,selfip:t,"sells-it":t,servebbs:t,serveftp:t,thruhere:t,webhop:t,casacam:t,dynu:t,dynuddns:t,mysynology:t,opik:t,spryt:t,dynv6:t,twmail:t,ru:t,channelsdvr:[2,{u:t}],fastly:[0,{freetls:t,map:t,prod:[0,{a:t,global:t}],ssl:[0,{a:t,b:t,global:t}]}],fastlylb:[2,{map:t}],"keyword-on":t,"live-on":t,"server-on":t,"cdn-edges":t,heteml:t,cloudfunctions:t,"grafana-dev":t,iobb:t,moonscale:t,"in-dsl":t,"in-vpn":t,oninferno:t,botdash:t,"apps-1and1":t,ipifony:t,cloudjiffy:[2,{"fra1-de":t,"west1-us":t}],elastx:[0,{"jls-sto1":t,"jls-sto2":t,"jls-sto3":t}],massivegrid:[0,{paas:[0,{"fr-1":t,"lon-1":t,"lon-2":t,"ny-1":t,"ny-2":t,"sg-1":t}]}],saveincloud:[0,{jelastic:t,"nordeste-idc":t}],scaleforce:L,kinghost:t,uni5:t,krellian:t,ggff:t,localto:i,barsy:t,luyani:t,memset:t,"azure-api":t,"azure-mobile":t,azureedge:t,azurefd:t,azurestaticapps:[2,{1:t,2:t,3:t,4:t,5:t,6:t,7:t,centralus:t,eastasia:t,eastus2:t,westeurope:t,westus2:t}],azurewebsites:t,cloudapp:t,trafficmanager:t,usgovcloudapi:Te,usgovcloudapp:t,usgovtrafficmanager:t,windows:Te,mynetname:[0,{sn:t}],routingthecloud:t,bounceme:t,ddns:t,"eating-organic":t,mydissent:t,myeffect:t,mymediapc:t,mypsx:t,mysecuritycamera:t,nhlfan:t,"no-ip":t,pgafan:t,privatizehealthinsurance:t,redirectme:t,serveblog:t,serveminecraft:t,sytes:t,dnsup:t,hicam:t,"now-dns":t,ownip:t,vpndns:t,cloudycluster:t,ovh:[0,{hosting:i,webpaas:i}],rackmaze:t,myradweb:t,in:t,"subsc-pay":t,squares:t,schokokeks:t,"firewall-gateway":t,seidat:t,senseering:t,siteleaf:t,mafelo:t,myspreadshop:t,"vps-host":[2,{jelastic:[0,{atl:t,njs:t,ric:t}]}],srcf:[0,{soc:t,user:t}],supabase:t,dsmynas:t,familyds:t,ts:[2,{c:i}],torproject:[2,{pages:t}],tunnelmole:t,vusercontent:t,"reserve-online":t,localcert:t,"community-pro":t,meinforum:t,yandexcloud:[2,{storage:t,website:t}],za:t,zabc:t}],nf:[1,{arts:e,com:e,firm:e,info:e,net:e,other:e,per:e,rec:e,store:e,web:e}],ng:[1,{com:e,edu:e,gov:e,i:e,mil:e,mobi:e,name:e,net:e,org:e,sch:e,biz:[2,{co:t,dl:t,go:t,lg:t,on:t}],col:t,firm:t,gen:t,ltd:t,ngo:t,plc:t}],ni:[1,{ac:e,biz:e,co:e,com:e,edu:e,gob:e,in:e,info:e,int:e,mil:e,net:e,nom:e,org:e,web:e}],nl:[1,{co:t,"hosting-cluster":t,gov:t,khplay:t,"123website":t,myspreadshop:t,transurl:i,cistron:t,demon:t}],no:[1,{fhs:e,folkebibl:e,fylkesbibl:e,idrett:e,museum:e,priv:e,vgs:e,dep:e,herad:e,kommune:e,mil:e,stat:e,aa:Ee,ah:Ee,bu:Ee,fm:Ee,hl:Ee,hm:Ee,"jan-mayen":Ee,mr:Ee,nl:Ee,nt:Ee,of:Ee,ol:Ee,oslo:Ee,rl:Ee,sf:Ee,st:Ee,svalbard:Ee,tm:Ee,tr:Ee,va:Ee,vf:Ee,akrehamn:e,"xn--krehamn-dxa":e,åkrehamn:e,algard:e,"xn--lgrd-poac":e,ålgård:e,arna:e,bronnoysund:e,"xn--brnnysund-m8ac":e,brønnøysund:e,brumunddal:e,bryne:e,drobak:e,"xn--drbak-wua":e,drøbak:e,egersund:e,fetsund:e,floro:e,"xn--flor-jra":e,florø:e,fredrikstad:e,hokksund:e,honefoss:e,"xn--hnefoss-q1a":e,hønefoss:e,jessheim:e,jorpeland:e,"xn--jrpeland-54a":e,jørpeland:e,kirkenes:e,kopervik:e,krokstadelva:e,langevag:e,"xn--langevg-jxa":e,langevåg:e,leirvik:e,mjondalen:e,"xn--mjndalen-64a":e,mjøndalen:e,"mo-i-rana":e,mosjoen:e,"xn--mosjen-eya":e,mosjøen:e,nesoddtangen:e,orkanger:e,osoyro:e,"xn--osyro-wua":e,osøyro:e,raholt:e,"xn--rholt-mra":e,råholt:e,sandnessjoen:e,"xn--sandnessjen-ogb":e,sandnessjøen:e,skedsmokorset:e,slattum:e,spjelkavik:e,stathelle:e,stavern:e,stjordalshalsen:e,"xn--stjrdalshalsen-sqb":e,stjørdalshalsen:e,tananger:e,tranby:e,vossevangen:e,aarborte:e,aejrie:e,afjord:e,"xn--fjord-lra":e,åfjord:e,agdenes:e,akershus:De,aknoluokta:e,"xn--koluokta-7ya57h":e,ákŋoluokta:e,al:e,"xn--l-1fa":e,ål:e,alaheadju:e,"xn--laheadju-7ya":e,álaheadju:e,alesund:e,"xn--lesund-hua":e,ålesund:e,alstahaug:e,alta:e,"xn--lt-liac":e,áltá:e,alvdal:e,amli:e,"xn--mli-tla":e,åmli:e,amot:e,"xn--mot-tla":e,åmot:e,andasuolo:e,andebu:e,andoy:e,"xn--andy-ira":e,andøy:e,ardal:e,"xn--rdal-poa":e,årdal:e,aremark:e,arendal:e,"xn--s-1fa":e,ås:e,aseral:e,"xn--seral-lra":e,åseral:e,asker:e,askim:e,askoy:e,"xn--asky-ira":e,askøy:e,askvoll:e,asnes:e,"xn--snes-poa":e,åsnes:e,audnedaln:e,aukra:e,aure:e,aurland:e,"aurskog-holand":e,"xn--aurskog-hland-jnb":e,"aurskog-høland":e,austevoll:e,austrheim:e,averoy:e,"xn--avery-yua":e,averøy:e,badaddja:e,"xn--bdddj-mrabd":e,bådåddjå:e,"xn--brum-voa":e,bærum:e,bahcavuotna:e,"xn--bhcavuotna-s4a":e,báhcavuotna:e,bahccavuotna:e,"xn--bhccavuotna-k7a":e,báhccavuotna:e,baidar:e,"xn--bidr-5nac":e,báidár:e,bajddar:e,"xn--bjddar-pta":e,bájddar:e,balat:e,"xn--blt-elab":e,bálát:e,balestrand:e,ballangen:e,balsfjord:e,bamble:e,bardu:e,barum:e,batsfjord:e,"xn--btsfjord-9za":e,båtsfjord:e,bearalvahki:e,"xn--bearalvhki-y4a":e,bearalváhki:e,beardu:e,beiarn:e,berg:e,bergen:e,berlevag:e,"xn--berlevg-jxa":e,berlevåg:e,bievat:e,"xn--bievt-0qa":e,bievát:e,bindal:e,birkenes:e,bjerkreim:e,bjugn:e,bodo:e,"xn--bod-2na":e,bodø:e,bokn:e,bomlo:e,"xn--bmlo-gra":e,bømlo:e,bremanger:e,bronnoy:e,"xn--brnny-wuac":e,brønnøy:e,budejju:e,buskerud:De,bygland:e,bykle:e,cahcesuolo:e,"xn--hcesuolo-7ya35b":e,čáhcesuolo:e,davvenjarga:e,"xn--davvenjrga-y4a":e,davvenjárga:e,davvesiida:e,deatnu:e,dielddanuorri:e,divtasvuodna:e,divttasvuotna:e,donna:e,"xn--dnna-gra":e,dønna:e,dovre:e,drammen:e,drangedal:e,dyroy:e,"xn--dyry-ira":e,dyrøy:e,eid:e,eidfjord:e,eidsberg:e,eidskog:e,eidsvoll:e,eigersund:e,elverum:e,enebakk:e,engerdal:e,etne:e,etnedal:e,evenassi:e,"xn--eveni-0qa01ga":e,evenášši:e,evenes:e,"evje-og-hornnes":e,farsund:e,fauske:e,fedje:e,fet:e,finnoy:e,"xn--finny-yua":e,finnøy:e,fitjar:e,fjaler:e,fjell:e,fla:e,"xn--fl-zia":e,flå:e,flakstad:e,flatanger:e,flekkefjord:e,flesberg:e,flora:e,folldal:e,forde:e,"xn--frde-gra":e,førde:e,forsand:e,fosnes:e,"xn--frna-woa":e,fræna:e,frana:e,frei:e,frogn:e,froland:e,frosta:e,froya:e,"xn--frya-hra":e,frøya:e,fuoisku:e,fuossko:e,fusa:e,fyresdal:e,gaivuotna:e,"xn--givuotna-8ya":e,gáivuotna:e,galsa:e,"xn--gls-elac":e,gálsá:e,gamvik:e,gangaviika:e,"xn--ggaviika-8ya47h":e,gáŋgaviika:e,gaular:e,gausdal:e,giehtavuoatna:e,gildeskal:e,"xn--gildeskl-g0a":e,gildeskål:e,giske:e,gjemnes:e,gjerdrum:e,gjerstad:e,gjesdal:e,gjovik:e,"xn--gjvik-wua":e,gjøvik:e,gloppen:e,gol:e,gran:e,grane:e,granvin:e,gratangen:e,grimstad:e,grong:e,grue:e,gulen:e,guovdageaidnu:e,ha:e,"xn--h-2fa":e,hå:e,habmer:e,"xn--hbmer-xqa":e,hábmer:e,hadsel:e,"xn--hgebostad-g3a":e,hægebostad:e,hagebostad:e,halden:e,halsa:e,hamar:e,hamaroy:e,hammarfeasta:e,"xn--hmmrfeasta-s4ac":e,hámmárfeasta:e,hammerfest:e,hapmir:e,"xn--hpmir-xqa":e,hápmir:e,haram:e,hareid:e,harstad:e,hasvik:e,hattfjelldal:e,haugesund:e,hedmark:[0,{os:e,valer:e,"xn--vler-qoa":e,våler:e}],hemne:e,hemnes:e,hemsedal:e,hitra:e,hjartdal:e,hjelmeland:e,hobol:e,"xn--hobl-ira":e,hobøl:e,hof:e,hol:e,hole:e,holmestrand:e,holtalen:e,"xn--holtlen-hxa":e,holtålen:e,hordaland:[0,{os:e}],hornindal:e,horten:e,hoyanger:e,"xn--hyanger-q1a":e,høyanger:e,hoylandet:e,"xn--hylandet-54a":e,høylandet:e,hurdal:e,hurum:e,hvaler:e,hyllestad:e,ibestad:e,inderoy:e,"xn--indery-fya":e,inderøy:e,iveland:e,ivgu:e,jevnaker:e,jolster:e,"xn--jlster-bya":e,jølster:e,jondal:e,kafjord:e,"xn--kfjord-iua":e,kåfjord:e,karasjohka:e,"xn--krjohka-hwab49j":e,kárášjohka:e,karasjok:e,karlsoy:e,karmoy:e,"xn--karmy-yua":e,karmøy:e,kautokeino:e,klabu:e,"xn--klbu-woa":e,klæbu:e,klepp:e,kongsberg:e,kongsvinger:e,kraanghke:e,"xn--kranghke-b0a":e,kråanghke:e,kragero:e,"xn--krager-gya":e,kragerø:e,kristiansand:e,kristiansund:e,krodsherad:e,"xn--krdsherad-m8a":e,krødsherad:e,"xn--kvfjord-nxa":e,kvæfjord:e,"xn--kvnangen-k0a":e,kvænangen:e,kvafjord:e,kvalsund:e,kvam:e,kvanangen:e,kvinesdal:e,kvinnherad:e,kviteseid:e,kvitsoy:e,"xn--kvitsy-fya":e,kvitsøy:e,laakesvuemie:e,"xn--lrdal-sra":e,lærdal:e,lahppi:e,"xn--lhppi-xqa":e,láhppi:e,lardal:e,larvik:e,lavagis:e,lavangen:e,leangaviika:e,"xn--leagaviika-52b":e,leaŋgaviika:e,lebesby:e,leikanger:e,leirfjord:e,leka:e,leksvik:e,lenvik:e,lerdal:e,lesja:e,levanger:e,lier:e,lierne:e,lillehammer:e,lillesand:e,lindas:e,"xn--linds-pra":e,lindås:e,lindesnes:e,loabat:e,"xn--loabt-0qa":e,loabát:e,lodingen:e,"xn--ldingen-q1a":e,lødingen:e,lom:e,loppa:e,lorenskog:e,"xn--lrenskog-54a":e,lørenskog:e,loten:e,"xn--lten-gra":e,løten:e,lund:e,lunner:e,luroy:e,"xn--lury-ira":e,lurøy:e,luster:e,lyngdal:e,lyngen:e,malatvuopmi:e,"xn--mlatvuopmi-s4a":e,málatvuopmi:e,malselv:e,"xn--mlselv-iua":e,målselv:e,malvik:e,mandal:e,marker:e,marnardal:e,masfjorden:e,masoy:e,"xn--msy-ula0h":e,måsøy:e,"matta-varjjat":e,"xn--mtta-vrjjat-k7af":e,"mátta-várjjat":e,meland:e,meldal:e,melhus:e,meloy:e,"xn--mely-ira":e,meløy:e,meraker:e,"xn--merker-kua":e,meråker:e,midsund:e,"midtre-gauldal":e,moareke:e,"xn--moreke-jua":e,moåreke:e,modalen:e,modum:e,molde:e,"more-og-romsdal":[0,{heroy:e,sande:e}],"xn--mre-og-romsdal-qqb":[0,{"xn--hery-ira":e,sande:e}],"møre-og-romsdal":[0,{herøy:e,sande:e}],moskenes:e,moss:e,muosat:e,"xn--muost-0qa":e,muosát:e,naamesjevuemie:e,"xn--nmesjevuemie-tcba":e,nååmesjevuemie:e,"xn--nry-yla5g":e,nærøy:e,namdalseid:e,namsos:e,namsskogan:e,nannestad:e,naroy:e,narviika:e,narvik:e,naustdal:e,navuotna:e,"xn--nvuotna-hwa":e,návuotna:e,"nedre-eiker":e,nesna:e,nesodden:e,nesseby:e,nesset:e,nissedal:e,nittedal:e,"nord-aurdal":e,"nord-fron":e,"nord-odal":e,norddal:e,nordkapp:e,nordland:[0,{bo:e,"xn--b-5ga":e,bø:e,heroy:e,"xn--hery-ira":e,herøy:e}],"nordre-land":e,nordreisa:e,"nore-og-uvdal":e,notodden:e,notteroy:e,"xn--nttery-byae":e,nøtterøy:e,odda:e,oksnes:e,"xn--ksnes-uua":e,øksnes:e,omasvuotna:e,oppdal:e,oppegard:e,"xn--oppegrd-ixa":e,oppegård:e,orkdal:e,orland:e,"xn--rland-uua":e,ørland:e,orskog:e,"xn--rskog-uua":e,ørskog:e,orsta:e,"xn--rsta-fra":e,ørsta:e,osen:e,osteroy:e,"xn--ostery-fya":e,osterøy:e,ostfold:[0,{valer:e}],"xn--stfold-9xa":[0,{"xn--vler-qoa":e}],østfold:[0,{våler:e}],"ostre-toten":e,"xn--stre-toten-zcb":e,"østre-toten":e,overhalla:e,"ovre-eiker":e,"xn--vre-eiker-k8a":e,"øvre-eiker":e,oyer:e,"xn--yer-zna":e,øyer:e,oygarden:e,"xn--ygarden-p1a":e,øygarden:e,"oystre-slidre":e,"xn--ystre-slidre-ujb":e,"øystre-slidre":e,porsanger:e,porsangu:e,"xn--porsgu-sta26f":e,porsáŋgu:e,porsgrunn:e,rade:e,"xn--rde-ula":e,råde:e,radoy:e,"xn--rady-ira":e,radøy:e,"xn--rlingen-mxa":e,rælingen:e,rahkkeravju:e,"xn--rhkkervju-01af":e,ráhkkerávju:e,raisa:e,"xn--risa-5na":e,ráisa:e,rakkestad:e,ralingen:e,rana:e,randaberg:e,rauma:e,rendalen:e,rennebu:e,rennesoy:e,"xn--rennesy-v1a":e,rennesøy:e,rindal:e,ringebu:e,ringerike:e,ringsaker:e,risor:e,"xn--risr-ira":e,risør:e,rissa:e,roan:e,rodoy:e,"xn--rdy-0nab":e,rødøy:e,rollag:e,romsa:e,romskog:e,"xn--rmskog-bya":e,rømskog:e,roros:e,"xn--rros-gra":e,røros:e,rost:e,"xn--rst-0na":e,røst:e,royken:e,"xn--ryken-vua":e,røyken:e,royrvik:e,"xn--ryrvik-bya":e,røyrvik:e,ruovat:e,rygge:e,salangen:e,salat:e,"xn--slat-5na":e,sálat:e,"xn--slt-elab":e,sálát:e,saltdal:e,samnanger:e,sandefjord:e,sandnes:e,sandoy:e,"xn--sandy-yua":e,sandøy:e,sarpsborg:e,sauda:e,sauherad:e,sel:e,selbu:e,selje:e,seljord:e,siellak:e,sigdal:e,siljan:e,sirdal:e,skanit:e,"xn--sknit-yqa":e,skánit:e,skanland:e,"xn--sknland-fxa":e,skånland:e,skaun:e,skedsmo:e,ski:e,skien:e,skierva:e,"xn--skierv-uta":e,skiervá:e,skiptvet:e,skjak:e,"xn--skjk-soa":e,skjåk:e,skjervoy:e,"xn--skjervy-v1a":e,skjervøy:e,skodje:e,smola:e,"xn--smla-hra":e,smøla:e,snaase:e,"xn--snase-nra":e,snåase:e,snasa:e,"xn--snsa-roa":e,snåsa:e,snillfjord:e,snoasa:e,sogndal:e,sogne:e,"xn--sgne-gra":e,søgne:e,sokndal:e,sola:e,solund:e,somna:e,"xn--smna-gra":e,sømna:e,"sondre-land":e,"xn--sndre-land-0cb":e,"søndre-land":e,songdalen:e,"sor-aurdal":e,"xn--sr-aurdal-l8a":e,"sør-aurdal":e,"sor-fron":e,"xn--sr-fron-q1a":e,"sør-fron":e,"sor-odal":e,"xn--sr-odal-q1a":e,"sør-odal":e,"sor-varanger":e,"xn--sr-varanger-ggb":e,"sør-varanger":e,sorfold:e,"xn--srfold-bya":e,sørfold:e,sorreisa:e,"xn--srreisa-q1a":e,sørreisa:e,sortland:e,sorum:e,"xn--srum-gra":e,sørum:e,spydeberg:e,stange:e,stavanger:e,steigen:e,steinkjer:e,stjordal:e,"xn--stjrdal-s1a":e,stjørdal:e,stokke:e,"stor-elvdal":e,stord:e,stordal:e,storfjord:e,strand:e,stranda:e,stryn:e,sula:e,suldal:e,sund:e,sunndal:e,surnadal:e,sveio:e,svelvik:e,sykkylven:e,tana:e,telemark:[0,{bo:e,"xn--b-5ga":e,bø:e}],time:e,tingvoll:e,tinn:e,tjeldsund:e,tjome:e,"xn--tjme-hra":e,tjøme:e,tokke:e,tolga:e,tonsberg:e,"xn--tnsberg-q1a":e,tønsberg:e,torsken:e,"xn--trna-woa":e,træna:e,trana:e,tranoy:e,"xn--trany-yua":e,tranøy:e,troandin:e,trogstad:e,"xn--trgstad-r1a":e,trøgstad:e,tromsa:e,tromso:e,"xn--troms-zua":e,tromsø:e,trondheim:e,trysil:e,tvedestrand:e,tydal:e,tynset:e,tysfjord:e,tysnes:e,"xn--tysvr-vra":e,tysvær:e,tysvar:e,ullensaker:e,ullensvang:e,ulvik:e,unjarga:e,"xn--unjrga-rta":e,unjárga:e,utsira:e,vaapste:e,vadso:e,"xn--vads-jra":e,vadsø:e,"xn--vry-yla5g":e,værøy:e,vaga:e,"xn--vg-yiab":e,vågå:e,vagan:e,"xn--vgan-qoa":e,vågan:e,vagsoy:e,"xn--vgsy-qoa0j":e,vågsøy:e,vaksdal:e,valle:e,vang:e,vanylven:e,vardo:e,"xn--vard-jra":e,vardø:e,varggat:e,"xn--vrggt-xqad":e,várggát:e,varoy:e,vefsn:e,vega:e,vegarshei:e,"xn--vegrshei-c0a":e,vegårshei:e,vennesla:e,verdal:e,verran:e,vestby:e,vestfold:[0,{sande:e}],vestnes:e,"vestre-slidre":e,"vestre-toten":e,vestvagoy:e,"xn--vestvgy-ixa6o":e,vestvågøy:e,vevelstad:e,vik:e,vikna:e,vindafjord:e,voagat:e,volda:e,voss:e,co:t,"123hjemmeside":t,myspreadshop:t}],np:y,nr:xe,nu:[1,{merseine:t,mine:t,shacknet:t,enterprisecloud:t}],nz:[1,{ac:e,co:e,cri:e,geek:e,gen:e,govt:e,health:e,iwi:e,kiwi:e,maori:e,"xn--mori-qsa":e,māori:e,mil:e,net:e,org:e,parliament:e,school:e,cloudns:t}],om:[1,{co:e,com:e,edu:e,gov:e,med:e,museum:e,net:e,org:e,pro:e}],onion:e,org:[1,{altervista:t,pimienta:t,poivron:t,potager:t,sweetpepper:t,cdn77:[0,{c:t,rsc:t}],"cdn77-secure":[0,{origin:[0,{ssl:t}]}],ae:t,cloudns:t,"ip-dynamic":t,ddnss:t,dpdns:t,duckdns:t,tunk:t,blogdns:t,blogsite:t,boldlygoingnowhere:t,dnsalias:t,dnsdojo:t,doesntexist:t,dontexist:t,doomdns:t,dvrdns:t,dynalias:t,dyndns:[2,{go:t,home:t}],endofinternet:t,endoftheinternet:t,"from-me":t,"game-host":t,gotdns:t,"hobby-site":t,homedns:t,homeftp:t,homelinux:t,homeunix:t,"is-a-bruinsfan":t,"is-a-candidate":t,"is-a-celticsfan":t,"is-a-chef":t,"is-a-geek":t,"is-a-knight":t,"is-a-linux-user":t,"is-a-patsfan":t,"is-a-soxfan":t,"is-found":t,"is-lost":t,"is-saved":t,"is-very-bad":t,"is-very-evil":t,"is-very-good":t,"is-very-nice":t,"is-very-sweet":t,"isa-geek":t,"kicks-ass":t,misconfused:t,podzone:t,readmyblog:t,selfip:t,sellsyourhome:t,servebbs:t,serveftp:t,servegame:t,"stuff-4-sale":t,webhop:t,accesscam:t,camdvr:t,freeddns:t,mywire:t,roxa:t,webredirect:t,twmail:t,eu:[2,{al:t,asso:t,at:t,au:t,be:t,bg:t,ca:t,cd:t,ch:t,cn:t,cy:t,cz:t,de:t,dk:t,edu:t,ee:t,es:t,fi:t,fr:t,gr:t,hr:t,hu:t,ie:t,il:t,in:t,int:t,is:t,it:t,jp:t,kr:t,lt:t,lu:t,lv:t,me:t,mk:t,mt:t,my:t,net:t,ng:t,nl:t,no:t,nz:t,pl:t,pt:t,ro:t,ru:t,se:t,si:t,sk:t,tr:t,uk:t,us:t}],fedorainfracloud:t,fedorapeople:t,fedoraproject:[0,{cloud:t,os:se,stg:[0,{os:se}]}],freedesktop:t,hatenadiary:t,hepforge:t,"in-dsl":t,"in-vpn":t,js:t,barsy:t,mayfirst:t,routingthecloud:t,bmoattachments:t,"cable-modem":t,collegefan:t,couchpotatofries:t,hopto:t,mlbfan:t,myftp:t,mysecuritycamera:t,nflfan:t,"no-ip":t,"read-books":t,ufcfan:t,zapto:t,dynserv:t,"now-dns":t,"is-local":t,httpbin:t,pubtls:t,jpn:t,"my-firewall":t,myfirewall:t,spdns:t,"small-web":t,dsmynas:t,familyds:t,teckids:be,tuxfamily:t,hk:t,us:t,toolforge:t,wmcloud:[2,{beta:t}],wmflabs:t,za:t}],pa:[1,{abo:e,ac:e,com:e,edu:e,gob:e,ing:e,med:e,net:e,nom:e,org:e,sld:e}],pe:[1,{com:e,edu:e,gob:e,mil:e,net:e,nom:e,org:e}],pf:[1,{com:e,edu:e,org:e}],pg:y,ph:[1,{com:e,edu:e,gov:e,i:e,mil:e,net:e,ngo:e,org:e,cloudns:t}],pk:[1,{ac:e,biz:e,com:e,edu:e,fam:e,gkp:e,gob:e,gog:e,gok:e,gop:e,gos:e,gov:e,net:e,org:e,web:e}],pl:[1,{com:e,net:e,org:e,agro:e,aid:e,atm:e,auto:e,biz:e,edu:e,gmina:e,gsm:e,info:e,mail:e,media:e,miasta:e,mil:e,nieruchomosci:e,nom:e,pc:e,powiat:e,priv:e,realestate:e,rel:e,sex:e,shop:e,sklep:e,sos:e,szkola:e,targi:e,tm:e,tourism:e,travel:e,turystyka:e,gov:[1,{ap:e,griw:e,ic:e,is:e,kmpsp:e,konsulat:e,kppsp:e,kwp:e,kwpsp:e,mup:e,mw:e,oia:e,oirm:e,oke:e,oow:e,oschr:e,oum:e,pa:e,pinb:e,piw:e,po:e,pr:e,psp:e,psse:e,pup:e,rzgw:e,sa:e,sdn:e,sko:e,so:e,sr:e,starostwo:e,ug:e,ugim:e,um:e,umig:e,upow:e,uppo:e,us:e,uw:e,uzs:e,wif:e,wiih:e,winb:e,wios:e,witd:e,wiw:e,wkz:e,wsa:e,wskr:e,wsse:e,wuoz:e,wzmiuw:e,zp:e,zpisdn:e}],augustow:e,"babia-gora":e,bedzin:e,beskidy:e,bialowieza:e,bialystok:e,bielawa:e,bieszczady:e,boleslawiec:e,bydgoszcz:e,bytom:e,cieszyn:e,czeladz:e,czest:e,dlugoleka:e,elblag:e,elk:e,glogow:e,gniezno:e,gorlice:e,grajewo:e,ilawa:e,jaworzno:e,"jelenia-gora":e,jgora:e,kalisz:e,karpacz:e,kartuzy:e,kaszuby:e,katowice:e,"kazimierz-dolny":e,kepno:e,ketrzyn:e,klodzko:e,kobierzyce:e,kolobrzeg:e,konin:e,konskowola:e,kutno:e,lapy:e,lebork:e,legnica:e,lezajsk:e,limanowa:e,lomza:e,lowicz:e,lubin:e,lukow:e,malbork:e,malopolska:e,mazowsze:e,mazury:e,mielec:e,mielno:e,mragowo:e,naklo:e,nowaruda:e,nysa:e,olawa:e,olecko:e,olkusz:e,olsztyn:e,opoczno:e,opole:e,ostroda:e,ostroleka:e,ostrowiec:e,ostrowwlkp:e,pila:e,pisz:e,podhale:e,podlasie:e,polkowice:e,pomorskie:e,pomorze:e,prochowice:e,pruszkow:e,przeworsk:e,pulawy:e,radom:e,"rawa-maz":e,rybnik:e,rzeszow:e,sanok:e,sejny:e,skoczow:e,slask:e,slupsk:e,sosnowiec:e,"stalowa-wola":e,starachowice:e,stargard:e,suwalki:e,swidnica:e,swiebodzin:e,swinoujscie:e,szczecin:e,szczytno:e,tarnobrzeg:e,tgory:e,turek:e,tychy:e,ustka:e,walbrzych:e,warmia:e,warszawa:e,waw:e,wegrow:e,wielun:e,wlocl:e,wloclawek:e,wodzislaw:e,wolomin:e,wroclaw:e,zachpomor:e,zagan:e,zarow:e,zgora:e,zgorzelec:e,art:t,gliwice:t,krakow:t,poznan:t,wroc:t,zakopane:t,beep:t,"ecommerce-shop":t,cfolks:t,dfirma:t,dkonto:t,you2:t,shoparena:t,homesklep:t,sdscloud:t,unicloud:t,lodz:t,pabianice:t,plock:t,sieradz:t,skierniewice:t,zgierz:t,krasnik:t,leczna:t,lubartow:t,lublin:t,poniatowa:t,swidnik:t,co:t,torun:t,simplesite:t,myspreadshop:t,gda:t,gdansk:t,gdynia:t,med:t,sopot:t,bielsko:t}],pm:[1,{own:t,name:t}],pn:[1,{co:e,edu:e,gov:e,net:e,org:e}],post:e,pr:[1,{biz:e,com:e,edu:e,gov:e,info:e,isla:e,name:e,net:e,org:e,pro:e,ac:e,est:e,prof:e}],pro:[1,{aaa:e,aca:e,acct:e,avocat:e,bar:e,cpa:e,eng:e,jur:e,law:e,med:e,recht:e,cloudns:t,keenetic:t,barsy:t,ngrok:t}],ps:[1,{com:e,edu:e,gov:e,net:e,org:e,plo:e,sec:e}],pt:[1,{com:e,edu:e,gov:e,int:e,net:e,nome:e,org:e,publ:e,"123paginaweb":t}],pw:[1,{gov:e,cloudns:t,x443:t}],py:[1,{com:e,coop:e,edu:e,gov:e,mil:e,net:e,org:e}],qa:[1,{com:e,edu:e,gov:e,mil:e,name:e,net:e,org:e,sch:e}],re:[1,{asso:e,com:e,netlib:t,can:t}],ro:[1,{arts:e,com:e,firm:e,info:e,nom:e,nt:e,org:e,rec:e,store:e,tm:e,www:e,co:t,shop:t,barsy:t}],rs:[1,{ac:e,co:e,edu:e,gov:e,in:e,org:e,brendly:v,barsy:t,ox:t}],ru:[1,{ac:t,edu:t,gov:t,int:t,mil:t,eurodir:t,adygeya:t,bashkiria:t,bir:t,cbg:t,com:t,dagestan:t,grozny:t,kalmykia:t,kustanai:t,marine:t,mordovia:t,msk:t,mytis:t,nalchik:t,nov:t,pyatigorsk:t,spb:t,vladikavkaz:t,vladimir:t,na4u:t,mircloud:t,myjino:[2,{hosting:i,landing:i,spectrum:i,vps:i}],cldmail:[0,{hb:t}],mcdir:[2,{vps:t}],mcpre:t,net:t,org:t,pp:t,ras:t}],rw:[1,{ac:e,co:e,coop:e,gov:e,mil:e,net:e,org:e}],sa:[1,{com:e,edu:e,gov:e,med:e,net:e,org:e,pub:e,sch:e}],sb:n,sc:n,sd:[1,{com:e,edu:e,gov:e,info:e,med:e,net:e,org:e,tv:e}],se:[1,{a:e,ac:e,b:e,bd:e,brand:e,c:e,d:e,e,f:e,fh:e,fhsk:e,fhv:e,g:e,h:e,i:e,k:e,komforb:e,kommunalforbund:e,komvux:e,l:e,lanbib:e,m:e,n:e,naturbruksgymn:e,o:e,org:e,p:e,parti:e,pp:e,press:e,r:e,s:e,t:e,tm:e,u:e,w:e,x:e,y:e,z:e,com:t,iopsys:t,"123minsida":t,itcouldbewor:t,myspreadshop:t}],sg:[1,{com:e,edu:e,gov:e,net:e,org:e,enscaled:t}],sh:[1,{com:e,gov:e,mil:e,net:e,org:e,hashbang:t,botda:t,lovable:t,platform:[0,{ent:t,eu:t,us:t}],teleport:t,now:t}],si:[1,{f5:t,gitapp:t,gitpage:t}],sj:e,sk:[1,{org:e}],sl:n,sm:e,sn:[1,{art:e,com:e,edu:e,gouv:e,org:e,univ:e}],so:[1,{com:e,edu:e,gov:e,me:e,net:e,org:e,surveys:t}],sr:e,ss:[1,{biz:e,co:e,com:e,edu:e,gov:e,me:e,net:e,org:e,sch:e}],st:[1,{co:e,com:e,consulado:e,edu:e,embaixada:e,mil:e,net:e,org:e,principe:e,saotome:e,store:e,helioho:t,cn:i,kirara:t,noho:t}],su:[1,{abkhazia:t,adygeya:t,aktyubinsk:t,arkhangelsk:t,armenia:t,ashgabad:t,azerbaijan:t,balashov:t,bashkiria:t,bryansk:t,bukhara:t,chimkent:t,dagestan:t,"east-kazakhstan":t,exnet:t,georgia:t,grozny:t,ivanovo:t,jambyl:t,kalmykia:t,kaluga:t,karacol:t,karaganda:t,karelia:t,khakassia:t,krasnodar:t,kurgan:t,kustanai:t,lenug:t,mangyshlak:t,mordovia:t,msk:t,murmansk:t,nalchik:t,navoi:t,"north-kazakhstan":t,nov:t,obninsk:t,penza:t,pokrovsk:t,sochi:t,spb:t,tashkent:t,termez:t,togliatti:t,troitsk:t,tselinograd:t,tula:t,tuva:t,vladikavkaz:t,vladimir:t,vologda:t}],sv:[1,{com:e,edu:e,gob:e,org:e,red:e}],sx:c,sy:r,sz:[1,{ac:e,co:e,org:e}],tc:e,td:e,tel:e,tf:[1,{sch:t}],tg:e,th:[1,{ac:e,co:e,go:e,in:e,mi:e,net:e,or:e,online:t,shop:t}],tj:[1,{ac:e,biz:e,co:e,com:e,edu:e,go:e,gov:e,int:e,mil:e,name:e,net:e,nic:e,org:e,test:e,web:e}],tk:e,tl:c,tm:[1,{co:e,com:e,edu:e,gov:e,mil:e,net:e,nom:e,org:e}],tn:[1,{com:e,ens:e,fin:e,gov:e,ind:e,info:e,intl:e,mincom:e,nat:e,net:e,org:e,perso:e,tourism:e,orangecloud:t}],to:[1,{611:t,com:e,edu:e,gov:e,mil:e,net:e,org:e,oya:t,x0:t,quickconnect:D,vpnplus:t,nett:t}],tr:[1,{av:e,bbs:e,bel:e,biz:e,com:e,dr:e,edu:e,gen:e,gov:e,info:e,k12:e,kep:e,mil:e,name:e,net:e,org:e,pol:e,tel:e,tsk:e,tv:e,web:e,nc:c}],tt:[1,{biz:e,co:e,com:e,edu:e,gov:e,info:e,mil:e,name:e,net:e,org:e,pro:e}],tv:[1,{"better-than":t,dyndns:t,"on-the-web":t,"worse-than":t,from:t,sakura:t}],tw:[1,{club:e,com:[1,{mymailer:t}],ebiz:e,edu:e,game:e,gov:e,idv:e,mil:e,net:e,org:e,url:t,mydns:t}],tz:[1,{ac:e,co:e,go:e,hotel:e,info:e,me:e,mil:e,mobi:e,ne:e,or:e,sc:e,tv:e}],ua:[1,{com:e,edu:e,gov:e,in:e,net:e,org:e,cherkassy:e,cherkasy:e,chernigov:e,chernihiv:e,chernivtsi:e,chernovtsy:e,ck:e,cn:e,cr:e,crimea:e,cv:e,dn:e,dnepropetrovsk:e,dnipropetrovsk:e,donetsk:e,dp:e,if:e,"ivano-frankivsk":e,kh:e,kharkiv:e,kharkov:e,kherson:e,khmelnitskiy:e,khmelnytskyi:e,kiev:e,kirovograd:e,km:e,kr:e,kropyvnytskyi:e,krym:e,ks:e,kv:e,kyiv:e,lg:e,lt:e,lugansk:e,luhansk:e,lutsk:e,lv:e,lviv:e,mk:e,mykolaiv:e,nikolaev:e,od:e,odesa:e,odessa:e,pl:e,poltava:e,rivne:e,rovno:e,rv:e,sb:e,sebastopol:e,sevastopol:e,sm:e,sumy:e,te:e,ternopil:e,uz:e,uzhgorod:e,uzhhorod:e,vinnica:e,vinnytsia:e,vn:e,volyn:e,yalta:e,zakarpattia:e,zaporizhzhe:e,zaporizhzhia:e,zhitomir:e,zhytomyr:e,zp:e,zt:e,cc:t,inf:t,ltd:t,cx:t,biz:t,co:t,pp:t,v:t}],ug:[1,{ac:e,co:e,com:e,edu:e,go:e,gov:e,mil:e,ne:e,or:e,org:e,sc:e,us:e}],uk:[1,{ac:e,co:[1,{bytemark:[0,{dh:t,vm:t}],layershift:L,barsy:t,barsyonline:t,retrosnub:ye,"nh-serv":t,"no-ip":t,adimo:t,myspreadshop:t}],gov:[1,{api:t,campaign:t,service:t}],ltd:e,me:e,net:e,nhs:e,org:[1,{glug:t,lug:t,lugs:t,affinitylottery:t,raffleentry:t,weeklylottery:t}],plc:e,police:e,sch:y,conn:t,copro:t,hosp:t,"independent-commission":t,"independent-inquest":t,"independent-inquiry":t,"independent-panel":t,"independent-review":t,"public-inquiry":t,"royal-commission":t,pymnt:t,barsy:t,nimsite:t,oraclegovcloudapps:i}],us:[1,{dni:e,isa:e,nsn:e,ak:Oe,al:Oe,ar:Oe,as:Oe,az:Oe,ca:Oe,co:Oe,ct:Oe,dc:Oe,de:ke,fl:Oe,ga:Oe,gu:Oe,hi:Ae,ia:Oe,id:Oe,il:Oe,in:Oe,ks:Oe,ky:Oe,la:Oe,ma:[1,{k12:[1,{chtr:e,paroch:e,pvt:e}],cc:e,lib:e}],md:Oe,me:Oe,mi:[1,{k12:e,cc:e,lib:e,"ann-arbor":e,cog:e,dst:e,eaton:e,gen:e,mus:e,tec:e,washtenaw:e}],mn:Oe,mo:Oe,ms:[1,{k12:e,cc:e}],mt:Oe,nc:Oe,nd:Ae,ne:Oe,nh:Oe,nj:Oe,nm:Oe,nv:Oe,ny:Oe,oh:Oe,ok:Oe,or:Oe,pa:Oe,pr:Oe,ri:Ae,sc:Oe,sd:Ae,tn:Oe,tx:Oe,ut:Oe,va:Oe,vi:Oe,vt:Oe,wa:Oe,wi:Oe,wv:ke,wy:Oe,cloudns:t,"is-by":t,"land-4-sale":t,"stuff-4-sale":t,heliohost:t,enscaled:[0,{phx:t}],mircloud:t,"azure-api":t,azurewebsites:t,ngo:t,golffan:t,noip:t,pointto:t,freeddns:t,srv:[2,{gh:t,gl:t}],servername:t}],uy:[1,{com:e,edu:e,gub:e,mil:e,net:e,org:e,gv:t}],uz:[1,{co:e,com:e,net:e,org:e}],va:e,vc:[1,{com:e,edu:e,gov:e,mil:e,net:e,org:e,gv:[2,{d:t}],"0e":i,mydns:t}],ve:[1,{arts:e,bib:e,co:e,com:e,e12:e,edu:e,emprende:e,firm:e,gob:e,gov:e,ia:e,info:e,int:e,mil:e,net:e,nom:e,org:e,rar:e,rec:e,store:e,tec:e,web:e}],vg:[1,{edu:e}],vi:[1,{co:e,com:e,k12:e,net:e,org:e}],vn:[1,{ac:e,ai:e,biz:e,com:e,edu:e,gov:e,health:e,id:e,info:e,int:e,io:e,name:e,net:e,org:e,pro:e,angiang:e,bacgiang:e,backan:e,baclieu:e,bacninh:e,"baria-vungtau":e,bentre:e,binhdinh:e,binhduong:e,binhphuoc:e,binhthuan:e,camau:e,cantho:e,caobang:e,daklak:e,daknong:e,danang:e,dienbien:e,dongnai:e,dongthap:e,gialai:e,hagiang:e,haiduong:e,haiphong:e,hanam:e,hanoi:e,hatinh:e,haugiang:e,hoabinh:e,hue:e,hungyen:e,khanhhoa:e,kiengiang:e,kontum:e,laichau:e,lamdong:e,langson:e,laocai:e,longan:e,namdinh:e,nghean:e,ninhbinh:e,ninhthuan:e,phutho:e,phuyen:e,quangbinh:e,quangnam:e,quangngai:e,quangninh:e,quangtri:e,soctrang:e,sonla:e,tayninh:e,thaibinh:e,thainguyen:e,thanhhoa:e,thanhphohochiminh:e,thuathienhue:e,tiengiang:e,travinh:e,tuyenquang:e,vinhlong:e,vinhphuc:e,yenbai:e}],vu:le,wf:[1,{biz:t,sch:t}],ws:[1,{com:e,edu:e,gov:e,net:e,org:e,advisor:i,cloud66:t,dyndns:t,mypets:t}],yt:[1,{org:t}],"xn--mgbaam7a8h":e,امارات:e,"xn--y9a3aq":e,հայ:e,"xn--54b7fta0cc":e,বাংলা:e,"xn--90ae":e,бг:e,"xn--mgbcpq6gpa1a":e,البحرين:e,"xn--90ais":e,бел:e,"xn--fiqs8s":e,中国:e,"xn--fiqz9s":e,中國:e,"xn--lgbbat1ad8j":e,الجزائر:e,"xn--wgbh1c":e,مصر:e,"xn--e1a4c":e,ею:e,"xn--qxa6a":e,ευ:e,"xn--mgbah1a3hjkrd":e,موريتانيا:e,"xn--node":e,გე:e,"xn--qxam":e,ελ:e,"xn--j6w193g":[1,{"xn--gmqw5a":e,"xn--55qx5d":e,"xn--mxtq1m":e,"xn--wcvs22d":e,"xn--uc0atv":e,"xn--od0alg":e}],香港:[1,{個人:e,公司:e,政府:e,教育:e,組織:e,網絡:e}],"xn--2scrj9c":e,ಭಾರತ:e,"xn--3hcrj9c":e,ଭାରତ:e,"xn--45br5cyl":e,ভাৰত:e,"xn--h2breg3eve":e,भारतम्:e,"xn--h2brj9c8c":e,भारोत:e,"xn--mgbgu82a":e,ڀارت:e,"xn--rvc1e0am3e":e,ഭാരതം:e,"xn--h2brj9c":e,भारत:e,"xn--mgbbh1a":e,بارت:e,"xn--mgbbh1a71e":e,بھارت:e,"xn--fpcrj9c3d":e,భారత్:e,"xn--gecrj9c":e,ભારત:e,"xn--s9brj9c":e,ਭਾਰਤ:e,"xn--45brj9c":e,ভারত:e,"xn--xkc2dl3a5ee0h":e,இந்தியா:e,"xn--mgba3a4f16a":e,ایران:e,"xn--mgba3a4fra":e,ايران:e,"xn--mgbtx2b":e,عراق:e,"xn--mgbayh7gpa":e,الاردن:e,"xn--3e0b707e":e,한국:e,"xn--80ao21a":e,қаз:e,"xn--q7ce6a":e,ລາວ:e,"xn--fzc2c9e2c":e,ලංකා:e,"xn--xkc2al3hye2a":e,இலங்கை:e,"xn--mgbc0a9azcg":e,المغرب:e,"xn--d1alf":e,мкд:e,"xn--l1acc":e,мон:e,"xn--mix891f":e,澳門:e,"xn--mix082f":e,澳门:e,"xn--mgbx4cd0ab":e,مليسيا:e,"xn--mgb9awbf":e,عمان:e,"xn--mgbai9azgqp6j":e,پاکستان:e,"xn--mgbai9a5eva00b":e,پاكستان:e,"xn--ygbi2ammx":e,فلسطين:e,"xn--90a3ac":[1,{"xn--80au":e,"xn--90azh":e,"xn--d1at":e,"xn--c1avg":e,"xn--o1ac":e,"xn--o1ach":e}],срб:[1,{ак:e,обр:e,од:e,орг:e,пр:e,упр:e}],"xn--p1ai":e,рф:e,"xn--wgbl6a":e,قطر:e,"xn--mgberp4a5d4ar":e,السعودية:e,"xn--mgberp4a5d4a87g":e,السعودیة:e,"xn--mgbqly7c0a67fbc":e,السعودیۃ:e,"xn--mgbqly7cvafr":e,السعوديه:e,"xn--mgbpl2fh":e,سودان:e,"xn--yfro4i67o":e,新加坡:e,"xn--clchc0ea0b2g2a9gcd":e,சிங்கப்பூர்:e,"xn--ogbpf8fl":e,سورية:e,"xn--mgbtf8fl":e,سوريا:e,"xn--o3cw4h":[1,{"xn--o3cyx2a":e,"xn--12co0c3b4eva":e,"xn--m3ch0j3a":e,"xn--h3cuzk1di":e,"xn--12c1fe0br":e,"xn--12cfi8ixb8l":e}],ไทย:[1,{ทหาร:e,ธุรกิจ:e,เน็ต:e,รัฐบาล:e,ศึกษา:e,องค์กร:e}],"xn--pgbs0dh":e,تونس:e,"xn--kpry57d":e,台灣:e,"xn--kprw13d":e,台湾:e,"xn--nnx388a":e,臺灣:e,"xn--j1amh":e,укр:e,"xn--mgb2ddes":e,اليمن:e,xxx:e,ye:r,za:[0,{ac:e,agric:e,alt:e,co:e,edu:e,gov:e,grondar:e,law:e,mil:e,net:e,ngo:e,nic:e,nis:e,nom:e,org:e,school:e,tm:e,web:e}],zm:[1,{ac:e,biz:e,co:e,com:e,edu:e,gov:e,info:e,mil:e,net:e,org:e,sch:e}],zw:[1,{ac:e,co:e,gov:e,mil:e,org:e}],aaa:e,aarp:e,abb:e,abbott:e,abbvie:e,abc:e,able:e,abogado:e,abudhabi:e,academy:[1,{official:t}],accenture:e,accountant:e,accountants:e,aco:e,actor:e,ads:e,adult:e,aeg:e,aetna:e,afl:e,africa:e,agakhan:e,agency:e,aig:e,airbus:e,airforce:e,airtel:e,akdn:e,alibaba:e,alipay:e,allfinanz:e,allstate:e,ally:e,alsace:e,alstom:e,amazon:e,americanexpress:e,americanfamily:e,amex:e,amfam:e,amica:e,amsterdam:e,analytics:e,android:e,anquan:e,anz:e,aol:e,apartments:e,app:[1,{adaptable:t,aiven:t,beget:i,brave:a,clerk:t,clerkstage:t,cloudflare:t,wnext:t,csb:[2,{preview:t}],convex:t,corespeed:t,deta:t,ondigitalocean:t,easypanel:t,encr:[2,{frontend:t}],evervault:o,expo:[2,{on:t,staging:[2,{on:t}]}],edgecompute:t,"on-fleek":t,flutterflow:t,sprites:t,e2b:t,framer:t,gadget:t,github:t,hosted:i,run:[0,{"*":t,mtls:i}],web:t,hackclub:t,hasura:t,onhercules:t,botdash:t,shiptoday:t,leapcell:t,loginline:t,lovable:t,luyani:t,magicpatterns:t,medusajs:t,messerli:t,miren:t,mocha:t,netlify:t,ngrok:t,"ngrok-free":t,developer:i,noop:t,northflank:i,pplx:t,upsun:i,railway:[0,{up:t}],replit:s,nyat:t,snowflake:[0,{"*":t,privatelink:i}],streamlit:t,spawnbase:t,telebit:t,typedream:t,vercel:t,wal:t,wasmer:t,bookonline:t,windsurf:t,base44:t,zeabur:t,zerops:i}],apple:[1,{int:[2,{cloud:[0,{"*":t,r:[0,{"*":t,"ap-north-1":i,"ap-south-1":i,"ap-south-2":i,"eu-central-1":i,"eu-north-1":i,"us-central-1":i,"us-central-2":i,"us-east-1":i,"us-east-2":i,"us-west-1":i,"us-west-2":i,"us-west-3":i}]}]}]}],aquarelle:e,arab:e,aramco:e,archi:e,army:e,art:e,arte:e,asda:e,associates:e,athleta:e,attorney:e,auction:e,audi:e,audible:e,audio:e,auspost:e,author:e,auto:e,autos:e,aws:[1,{on:[0,{"af-south-1":l,"ap-east-1":l,"ap-northeast-1":l,"ap-northeast-2":l,"ap-northeast-3":l,"ap-south-1":l,"ap-south-2":u,"ap-southeast-1":l,"ap-southeast-2":l,"ap-southeast-3":l,"ap-southeast-4":u,"ap-southeast-5":u,"ca-central-1":l,"ca-west-1":u,"eu-central-1":l,"eu-central-2":u,"eu-north-1":l,"eu-south-1":l,"eu-south-2":u,"eu-west-1":l,"eu-west-2":l,"eu-west-3":l,"il-central-1":u,"me-central-1":u,"me-south-1":l,"sa-east-1":l,"us-east-1":l,"us-east-2":l,"us-west-1":l,"us-west-2":l,"ap-southeast-7":d,"mx-central-1":d,"us-gov-east-1":f,"us-gov-west-1":f}],sagemaker:[0,{"ap-northeast-1":m,"ap-northeast-2":m,"ap-south-1":m,"ap-southeast-1":m,"ap-southeast-2":m,"ca-central-1":g,"eu-central-1":m,"eu-west-1":m,"eu-west-2":m,"us-east-1":g,"us-east-2":g,"us-west-2":g,"af-south-1":p,"ap-east-1":p,"ap-northeast-3":p,"ap-south-2":h,"ap-southeast-3":p,"ap-southeast-4":h,"ca-west-1":[0,{notebook:t,"notebook-fips":t}],"eu-central-2":p,"eu-north-1":p,"eu-south-1":p,"eu-south-2":p,"eu-west-3":p,"il-central-1":p,"me-central-1":p,"me-south-1":p,"sa-east-1":p,"us-gov-east-1":_,"us-gov-west-1":_,"us-west-1":[0,{notebook:t,"notebook-fips":t,studio:t}],experiments:i}],repost:[0,{private:i}]}],axa:e,azure:e,baby:e,baidu:e,banamex:e,band:e,bank:e,bar:e,barcelona:e,barclaycard:e,barclays:e,barefoot:e,bargains:e,baseball:e,basketball:[1,{aus:t,nz:t}],bauhaus:e,bayern:e,bbc:e,bbt:e,bbva:e,bcg:e,bcn:e,beats:e,beauty:e,beer:e,berlin:e,best:e,bestbuy:e,bet:e,bharti:e,bible:e,bid:e,bike:e,bing:e,bingo:e,bio:e,black:e,blackfriday:e,blockbuster:e,blog:e,bloomberg:e,blue:e,bms:e,bmw:e,bnpparibas:e,boats:e,boehringer:e,bofa:e,bom:e,bond:e,boo:e,book:e,booking:e,bosch:e,bostik:e,boston:e,bot:e,boutique:e,box:e,bradesco:e,bridgestone:e,broadway:e,broker:e,brother:e,brussels:e,build:[1,{shiptoday:t,v0:t,windsurf:t}],builders:[1,{cloudsite:t}],business:b,buy:e,buzz:e,bzh:e,cab:e,cafe:e,cal:e,call:e,calvinklein:e,cam:e,camera:e,camp:[1,{emf:[0,{at:t}]}],canon:e,capetown:e,capital:e,capitalone:e,car:e,caravan:e,cards:e,care:e,career:e,careers:e,cars:e,casa:[1,{nabu:[0,{ui:t}]}],case:[1,{sav:t}],cash:e,casino:e,catering:e,catholic:e,cba:e,cbn:e,cbre:e,center:e,ceo:e,cern:e,cfa:e,cfd:e,chanel:e,channel:e,charity:e,chase:e,chat:e,cheap:e,chintai:e,christmas:e,chrome:e,church:e,cipriani:e,circle:e,cisco:e,citadel:e,citi:e,citic:e,city:e,claims:e,cleaning:e,click:e,clinic:e,clinique:e,clothing:e,cloud:[1,{antagonist:t,begetcdn:i,convex:S,elementor:t,emergent:t,encoway:[0,{eu:t}],statics:i,ravendb:t,axarnet:[0,{"es-1":t}],diadem:t,jelastic:[0,{vip:t}],jele:t,"jenv-aruba":[0,{aruba:[0,{eur:[0,{it1:t}]}],it1:t}],keliweb:[2,{cs:t}],oxa:[2,{tn:t,uk:t}],primetel:[2,{uk:t}],reclaim:[0,{ca:t,uk:t,us:t}],trendhosting:[0,{ch:t,de:t}],jote:t,jotelulu:t,kuleuven:t,laravel:t,linkyard:t,magentosite:i,matlab:t,observablehq:t,perspecta:t,vapor:t,"on-rancher":i,scw:[0,{baremetal:[0,{"fr-par-1":t,"fr-par-2":t,"nl-ams-1":t}],"fr-par":[0,{cockpit:t,ddl:t,dtwh:t,fnc:[2,{functions:t}],ifr:t,k8s:C,kafk:t,mgdb:t,rdb:t,s3:t,"s3-website":t,scbl:t,whm:t}],instances:[0,{priv:t,pub:t}],k8s:t,"nl-ams":[0,{cockpit:t,ddl:t,dtwh:t,ifr:t,k8s:C,kafk:t,mgdb:t,rdb:t,s3:t,"s3-website":t,scbl:t,whm:t}],"pl-waw":[0,{cockpit:t,ddl:t,dtwh:t,ifr:t,k8s:C,kafk:t,mgdb:t,rdb:t,s3:t,"s3-website":t,scbl:t}],scalebook:t,smartlabeling:t}],servebolt:t,onstackit:[0,{runs:t}],trafficplex:t,"unison-services":t,urown:t,voorloper:t,zap:t}],club:[1,{cloudns:t,jele:t,barsy:t}],clubmed:e,coach:e,codes:[1,{owo:i}],coffee:e,college:e,cologne:e,commbank:e,community:[1,{nog:t,ravendb:t,myforum:t}],company:[1,{mybox:t}],compare:e,computer:e,comsec:e,condos:e,construction:e,consulting:e,contact:e,contractors:e,cooking:e,cool:[1,{elementor:t,de:t}],corsica:e,country:e,coupon:e,coupons:e,courses:e,cpa:e,credit:e,creditcard:e,creditunion:e,cricket:e,crown:e,crs:e,cruise:e,cruises:e,cuisinella:e,cymru:e,cyou:e,dad:e,dance:e,data:e,date:e,dating:e,datsun:e,day:e,dclk:e,dds:e,deal:e,dealer:e,deals:e,degree:e,delivery:e,dell:e,deloitte:e,delta:e,democrat:e,dental:e,dentist:e,desi:e,design:[1,{graphic:t,bss:t}],dev:[1,{myaddr:t,panel:t,bearblog:t,brave:a,lcl:i,lclstage:i,stg:i,stgstage:i,pages:t,r2:t,workers:t,deno:t,"deno-staging":t,deta:t,lp:[2,{api:t,objects:t}],evervault:o,payload:t,fly:t,githubpreview:t,gateway:i,grebedoc:t,botdash:t,inbrowser:i,"is-a-good":t,iserv:t,leapcell:t,runcontainers:t,localcert:[0,{user:i}],loginline:t,barsy:t,mediatech:t,"mocha-sandbox":t,modx:t,ngrok:t,"ngrok-free":t,"is-a-fullstack":t,"is-cool":t,"is-not-a":t,localplayer:t,xmit:t,"platter-app":t,replit:[2,{archer:t,bones:t,canary:t,global:t,hacker:t,id:t,janeway:t,kim:t,kira:t,kirk:t,odo:t,paris:t,picard:t,pike:t,prerelease:t,reed:t,riker:t,sisko:t,spock:t,staging:t,sulu:t,tarpit:t,teams:t,tucker:t,wesley:t,worf:t}],crm:[0,{aa:i,ab:i,ac:i,ad:i,ae:i,af:i,ci:i,d:i,pa:i,pb:i,pc:i,pd:i,pe:i,pf:i,w:i,wa:i,wb:i,wc:i,wd:i,we:i,wf:i}],erp:de,vercel:t,webhare:i,hrsn:t,"is-a":t}],dhl:e,diamonds:e,diet:e,digital:[1,{cloudapps:[2,{london:t}]}],direct:[1,{libp2p:t}],directory:e,discount:e,discover:e,dish:e,diy:[1,{discourse:t,imagine:t}],dnp:e,docs:e,doctor:e,dog:e,domains:e,dot:e,download:e,drive:e,dtv:e,dubai:e,dupont:e,durban:e,dvag:e,dvr:e,earth:e,eat:e,eco:e,edeka:e,education:b,email:[1,{crisp:[0,{on:t}],intouch:t,tawk:pe,tawkto:pe}],emerck:e,energy:e,engineer:e,engineering:e,enterprises:e,epson:e,equipment:e,ericsson:e,erni:e,esq:e,estate:[1,{compute:i}],eurovision:e,eus:[1,{party:me}],events:[1,{koobin:t,co:t}],exchange:e,expert:e,exposed:e,express:e,extraspace:e,fage:e,fail:e,fairwinds:e,faith:e,family:e,fan:e,fans:e,farm:[1,{storj:t}],farmers:e,fashion:e,fast:e,fedex:e,feedback:e,ferrari:e,ferrero:e,fidelity:e,fido:e,film:e,final:e,finance:e,financial:b,fire:e,firestone:e,firmdale:e,fish:e,fishing:e,fit:e,fitness:e,flickr:e,flights:e,flir:e,florist:e,flowers:e,fly:e,foo:e,food:e,football:e,ford:e,forex:e,forsale:e,forum:e,foundation:e,fox:e,free:e,fresenius:e,frl:e,frogans:e,frontier:e,ftr:e,fujitsu:e,fun:he,fund:e,furniture:e,futbol:e,fyi:e,gal:e,gallery:e,gallo:e,gallup:e,game:e,games:[1,{pley:t,sheezy:t}],gap:e,garden:e,gay:[1,{pages:t}],gbiz:e,gdn:[1,{cnpy:t}],gea:e,gent:e,genting:e,george:e,ggee:e,gift:e,gifts:e,gives:e,giving:e,glass:e,gle:e,global:[1,{appwrite:t}],globo:e,gmail:e,gmbh:e,gmo:e,gmx:e,godaddy:e,gold:e,goldpoint:e,golf:e,goodyear:e,goog:[1,{cloud:t,translate:t,usercontent:i}],google:e,gop:e,got:e,grainger:e,graphics:e,gratis:e,green:e,gripe:e,grocery:e,group:[1,{discourse:t}],gucci:e,guge:e,guide:e,guitars:e,guru:e,hair:e,hamburg:e,hangout:e,haus:e,hbo:e,hdfc:e,hdfcbank:e,health:[1,{hra:t}],healthcare:e,help:e,helsinki:e,here:e,hermes:e,hiphop:e,hisamitsu:e,hitachi:e,hiv:e,hkt:e,hockey:e,holdings:e,holiday:e,homedepot:e,homegoods:e,homes:e,homesense:e,honda:e,horse:e,hospital:e,host:[1,{cloudaccess:t,freesite:t,easypanel:t,emergent:t,fastvps:t,myfast:t,gadget:t,tempurl:t,wpmudev:t,iserv:t,jele:t,mircloud:t,bolt:t,wp2:t,half:t}],hosting:[1,{opencraft:t}],hot:e,hotel:e,hotels:e,hotmail:e,house:e,how:e,hsbc:e,hughes:e,hyatt:e,hyundai:e,ibm:e,icbc:e,ice:e,icu:e,ieee:e,ifm:e,ikano:e,imamat:e,imdb:e,immo:e,immobilien:e,inc:e,industries:e,infiniti:e,ing:e,ink:e,institute:e,insurance:e,insure:e,international:e,intuit:e,investments:e,ipiranga:e,irish:e,ismaili:e,ist:e,istanbul:e,itau:e,itv:e,jaguar:e,java:e,jcb:e,jeep:e,jetzt:e,jewelry:e,jio:e,jll:e,jmp:e,jnj:e,joburg:e,jot:e,joy:e,jpmorgan:e,jprs:e,juegos:e,juniper:e,kaufen:e,kddi:e,kerryhotels:e,kerryproperties:e,kfh:e,kia:e,kids:e,kim:e,kindle:e,kitchen:e,kiwi:e,koeln:e,komatsu:e,kosher:e,kpmg:e,kpn:e,krd:[1,{co:t,edu:t}],kred:e,kuokgroup:e,kyoto:e,lacaixa:e,lamborghini:e,lamer:e,land:e,landrover:e,lanxess:e,lasalle:e,lat:e,latino:e,latrobe:e,law:e,lawyer:e,lds:e,lease:e,leclerc:e,lefrak:e,legal:e,lego:e,lexus:e,lgbt:e,lidl:e,life:e,lifeinsurance:e,lifestyle:e,lighting:e,like:e,lilly:e,limited:e,limo:e,lincoln:e,link:[1,{myfritz:t,cyon:t,joinmc:t,dweb:i,inbrowser:i,keenetic:t,nftstorage:Se,mypep:t,storacha:Se,w3s:Se}],live:[1,{aem:t,hlx:t,ewp:i}],living:e,llc:e,llp:e,loan:e,loans:e,locker:e,locus:e,lol:[1,{omg:t}],london:e,lotte:e,lotto:e,love:e,lpl:e,lplfinancial:e,ltd:e,ltda:e,lundbeck:e,luxe:e,luxury:e,madrid:e,maif:e,maison:e,makeup:e,man:e,management:e,mango:e,map:e,market:e,marketing:e,markets:e,marriott:e,marshalls:e,mattel:e,mba:e,mckinsey:e,med:e,media:Ce,meet:e,melbourne:e,meme:e,memorial:e,men:e,menu:[1,{barsy:t,barsyonline:t}],merck:e,merckmsd:e,miami:e,microsoft:e,mini:e,mint:e,mit:e,mitsubishi:e,mlb:e,mls:e,mma:e,mobile:e,moda:e,moe:e,moi:e,mom:e,monash:e,money:e,monster:e,mormon:e,mortgage:e,moscow:e,moto:e,motorcycles:e,mov:e,movie:e,msd:e,mtn:e,mtr:e,music:e,nab:e,nagoya:e,navy:e,nba:e,nec:e,netbank:e,netflix:e,network:[1,{aem:t,alces:i,appwrite:t,co:t,arvo:t,azimuth:t,tlon:t}],neustar:e,new:e,news:[1,{noticeable:t}],next:e,nextdirect:e,nexus:e,nfl:e,ngo:e,nhk:e,nico:e,nike:e,nikon:e,ninja:e,nissan:e,nissay:e,nokia:e,norton:e,now:e,nowruz:e,nowtv:e,nra:e,nrw:e,ntt:e,nyc:e,obi:e,observer:e,office:e,okinawa:e,olayan:e,olayangroup:e,ollo:e,omega:e,one:[1,{kin:i,service:t,website:t}],ong:e,onl:e,online:[1,{eero:t,"eero-stage":t,websitebuilder:t,leapcell:t,barsy:t}],ooo:e,open:e,oracle:e,orange:[1,{tech:t}],organic:e,origins:e,osaka:e,otsuka:e,ott:e,ovh:[1,{nerdpol:t}],page:[1,{aem:t,hlx:t,codeberg:t,deuxfleurs:t,mybox:t,heyflow:t,prvcy:t,rocky:t,statichost:t,pdns:t,plesk:t}],panasonic:e,paris:e,pars:e,partners:e,parts:e,party:e,pay:e,pccw:e,pet:e,pfizer:e,pharmacy:e,phd:e,philips:e,phone:e,photo:e,photography:e,photos:Ce,physio:e,pics:e,pictet:e,pictures:[1,{1337:t}],pid:e,pin:e,ping:e,pink:e,pioneer:e,pizza:[1,{ngrok:t}],place:b,play:e,playstation:e,plumbing:e,plus:[1,{playit:[2,{at:i,with:t}]}],pnc:e,pohl:e,poker:e,politie:e,porn:e,praxi:e,press:e,prime:e,prod:e,productions:e,prof:e,progressive:e,promo:e,properties:e,property:e,protection:e,pru:e,prudential:e,pub:[1,{id:i,kin:i,barsy:t}],pwc:e,qpon:e,quebec:e,quest:e,racing:e,radio:e,read:e,realestate:e,realtor:e,realty:e,recipes:e,red:e,redumbrella:e,rehab:e,reise:e,reisen:e,reit:e,reliance:e,ren:e,rent:e,rentals:e,repair:e,report:e,republican:e,rest:e,restaurant:e,review:e,reviews:[1,{aem:t}],rexroth:e,rich:e,richardli:e,ricoh:e,ril:e,rio:e,rip:[1,{clan:t}],rocks:[1,{myddns:t,stackit:t,"lima-city":t,webspace:t}],rodeo:e,rogers:e,room:e,rsvp:e,rugby:e,ruhr:e,run:[1,{appwrite:i,canva:t,development:t,ravendb:t,liara:[2,{iran:t}],lovable:t,needle:t,build:i,code:i,database:i,migration:i,onporter:t,repl:t,stackit:t,val:de,vercel:t,wix:t}],rwe:e,ryukyu:e,saarland:e,safe:e,safety:e,sakura:e,sale:e,salon:e,samsclub:e,samsung:e,sandvik:e,sandvikcoromant:e,sanofi:e,sap:e,sarl:e,sas:e,save:e,saxo:e,sbi:e,sbs:e,scb:e,schaeffler:e,schmidt:e,scholarships:e,school:e,schule:e,schwarz:e,science:e,scot:[1,{co:t,me:t,org:t,gov:[2,{service:t}]}],search:e,seat:e,secure:e,security:e,seek:e,select:e,sener:e,services:[1,{loginline:t}],seven:e,sew:e,sex:e,sexy:e,sfr:e,shangrila:e,sharp:e,shell:e,shia:e,shiksha:e,shoes:e,shop:[1,{base:t,hoplix:t,barsy:t,barsyonline:t,shopware:t}],shopping:e,shouji:e,show:he,silk:e,sina:e,singles:e,site:[1,{square:t,canva:w,cloudera:i,convex:S,cyon:t,caffeine:t,fastvps:t,figma:t,"figma-gov":t,preview:t,heyflow:t,jele:t,jouwweb:t,loginline:t,barsy:t,co:t,notion:t,omniwe:t,opensocial:t,madethis:t,support:t,platformsh:i,tst:i,byen:t,sol:t,srht:t,novecore:t,cpanel:t,wpsquared:t,sourcecraft:t}],ski:e,skin:e,sky:e,skype:e,sling:e,smart:e,smile:e,sncf:e,soccer:e,social:e,softbank:e,software:e,sohu:e,solar:e,solutions:e,song:e,sony:e,soy:e,spa:e,space:[1,{myfast:t,heiyu:t,hf:[2,{static:t}],"app-ionos":t,project:t,uber:t,xs4all:t}],sport:e,spot:e,srl:e,stada:e,staples:e,star:e,statebank:e,statefarm:e,stc:e,stcgroup:e,stockholm:e,storage:e,store:[1,{barsy:t,sellfy:t,shopware:t,storebase:t}],stream:e,studio:e,study:e,style:e,sucks:e,supplies:e,supply:e,support:[1,{barsy:t}],surf:e,surgery:e,suzuki:e,swatch:e,swiss:e,sydney:e,systems:[1,{knightpoint:t,miren:t}],tab:e,taipei:e,talk:e,taobao:e,target:e,tatamotors:e,tatar:e,tattoo:e,tax:e,taxi:e,tci:e,tdk:e,team:[1,{discourse:t,jelastic:t}],tech:[1,{cleverapps:t}],technology:b,temasek:e,tennis:e,teva:e,thd:e,theater:e,theatre:e,tiaa:e,tickets:e,tienda:e,tips:e,tires:e,tirol:e,tjmaxx:e,tjx:e,tkmaxx:e,tmall:e,today:[1,{prequalifyme:t}],tokyo:e,tools:[1,{addr:ue,myaddr:t}],top:[1,{ntdll:t,wadl:i}],toray:e,toshiba:e,total:e,tours:e,town:e,toyota:e,toys:e,trade:e,trading:e,training:e,travel:e,travelers:e,travelersinsurance:e,trust:e,trv:e,tube:e,tui:e,tunes:e,tushu:e,tvs:e,ubank:e,ubs:e,unicom:e,university:e,uno:e,uol:e,ups:e,vacations:e,vana:e,vanguard:e,vegas:e,ventures:e,verisign:e,versicherung:e,vet:e,viajes:e,video:e,vig:e,viking:e,villas:e,vin:e,vip:[1,{hidns:t}],virgin:e,visa:e,vision:e,viva:e,vivo:e,vlaanderen:e,vodka:e,volvo:e,vote:e,voting:e,voto:e,voyage:e,wales:e,walmart:e,walter:e,wang:e,wanggou:e,watch:e,watches:e,weather:e,weatherchannel:e,webcam:e,weber:e,website:Ce,wed:e,wedding:e,weibo:e,weir:e,whoswho:e,wien:e,wiki:Ce,williamhill:e,win:e,windows:e,wine:e,winners:e,wme:e,woodside:e,work:[1,{"imagine-proxy":t}],works:e,world:e,wow:e,wtc:e,wtf:e,xbox:e,xerox:e,xihuan:e,xin:e,"xn--11b4c3d":e,कॉम:e,"xn--1ck2e1b":e,セール:e,"xn--1qqw23a":e,佛山:e,"xn--30rr7y":e,慈善:e,"xn--3bst00m":e,集团:e,"xn--3ds443g":e,在线:e,"xn--3pxu8k":e,点看:e,"xn--42c2d9a":e,คอม:e,"xn--45q11c":e,八卦:e,"xn--4gbrim":e,موقع:e,"xn--55qw42g":e,公益:e,"xn--55qx5d":e,公司:e,"xn--5su34j936bgsg":e,香格里拉:e,"xn--5tzm5g":e,网站:e,"xn--6frz82g":e,移动:e,"xn--6qq986b3xl":e,我爱你:e,"xn--80adxhks":e,москва:e,"xn--80aqecdr1a":e,католик:e,"xn--80asehdb":e,онлайн:e,"xn--80aswg":e,сайт:e,"xn--8y0a063a":e,联通:e,"xn--9dbq2a":e,קום:e,"xn--9et52u":e,时尚:e,"xn--9krt00a":e,微博:e,"xn--b4w605ferd":e,淡马锡:e,"xn--bck1b9a5dre4c":e,ファッション:e,"xn--c1avg":e,орг:e,"xn--c2br7g":e,नेट:e,"xn--cck2b3b":e,ストア:e,"xn--cckwcxetd":e,アマゾン:e,"xn--cg4bki":e,삼성:e,"xn--czr694b":e,商标:e,"xn--czrs0t":e,商店:e,"xn--czru2d":e,商城:e,"xn--d1acj3b":e,дети:e,"xn--eckvdtc9d":e,ポイント:e,"xn--efvy88h":e,新闻:e,"xn--fct429k":e,家電:e,"xn--fhbei":e,كوم:e,"xn--fiq228c5hs":e,中文网:e,"xn--fiq64b":e,中信:e,"xn--fjq720a":e,娱乐:e,"xn--flw351e":e,谷歌:e,"xn--fzys8d69uvgm":e,電訊盈科:e,"xn--g2xx48c":e,购物:e,"xn--gckr3f0f":e,クラウド:e,"xn--gk3at1e":e,通販:e,"xn--hxt814e":e,网店:e,"xn--i1b6b1a6a2e":e,संगठन:e,"xn--imr513n":e,餐厅:e,"xn--io0a7i":e,网络:e,"xn--j1aef":e,ком:e,"xn--jlq480n2rg":e,亚马逊:e,"xn--jvr189m":e,食品:e,"xn--kcrx77d1x4a":e,飞利浦:e,"xn--kput3i":e,手机:e,"xn--mgba3a3ejt":e,ارامكو:e,"xn--mgba7c0bbn0a":e,العليان:e,"xn--mgbab2bd":e,بازار:e,"xn--mgbca7dzdo":e,ابوظبي:e,"xn--mgbi4ecexp":e,كاثوليك:e,"xn--mgbt3dhd":e,همراه:e,"xn--mk1bu44c":e,닷컴:e,"xn--mxtq1m":e,政府:e,"xn--ngbc5azd":e,شبكة:e,"xn--ngbe9e0a":e,بيتك:e,"xn--ngbrx":e,عرب:e,"xn--nqv7f":e,机构:e,"xn--nqv7fs00ema":e,组织机构:e,"xn--nyqy26a":e,健康:e,"xn--otu796d":e,招聘:e,"xn--p1acf":[1,{"xn--90amc":t,"xn--j1aef":t,"xn--j1ael8b":t,"xn--h1ahn":t,"xn--j1adp":t,"xn--c1avg":t,"xn--80aaa0cvac":t,"xn--h1aliz":t,"xn--90a1af":t,"xn--41a":t}],рус:[1,{биз:t,ком:t,крым:t,мир:t,мск:t,орг:t,самара:t,сочи:t,спб:t,я:t}],"xn--pssy2u":e,大拿:e,"xn--q9jyb4c":e,みんな:e,"xn--qcka1pmc":e,グーグル:e,"xn--rhqv96g":e,世界:e,"xn--rovu88b":e,書籍:e,"xn--ses554g":e,网址:e,"xn--t60b56a":e,닷넷:e,"xn--tckwe":e,コム:e,"xn--tiq49xqyj":e,天主教:e,"xn--unup4y":e,游戏:e,"xn--vermgensberater-ctb":e,vermögensberater:e,"xn--vermgensberatung-pwb":e,vermögensberatung:e,"xn--vhquv":e,企业:e,"xn--vuq861b":e,信息:e,"xn--w4r85el8fhu5dnra":e,嘉里大酒店:e,"xn--w4rs40l":e,嘉里:e,"xn--xhq521b":e,广东:e,"xn--zfr164b":e,政务:e,xyz:[1,{caffeine:t,exe:t,botdash:t,telebit:i}],yachts:e,yahoo:e,yamaxun:e,yandex:e,yodobashi:e,yoga:e,yokohama:e,you:e,youtube:e,yun:e,zappos:e,zara:e,zero:e,zip:e,zone:[1,{stackit:t,lima:t,triton:i}],zuerich:e}]})();function vHe(e,t,n,r){let i=null,a=t;for(;a!==void 0&&((a[0]&r)!==0&&(i={index:n+1,isIcann:(a[0]&1)!=0,isPrivate:(a[0]&2)!=0}),n!==-1);){let t=a[1];a=Object.prototype.hasOwnProperty.call(t,e[n])?t[e[n]]:t[`*`],--n}return i}function yHe(e,t,n){if(hHe(e,t,n))return;let r=e.split(`.`),i=(t.allowPrivateDomains?2:0)|!!t.allowIcannDomains,a=vHe(r,gHe,r.length-1,i);if(a!==null){n.isIcann=a.isIcann,n.isPrivate=a.isPrivate,n.publicSuffix=r.slice(a.index+1).join(`.`);return}let o=vHe(r,_He,r.length-1,i);if(o!==null){n.isIcann=o.isIcann,n.isPrivate=o.isPrivate,n.publicSuffix=r.slice(o.index).join(`.`);return}n.isIcann=!1,n.isPrivate=!1,n.publicSuffix=r[r.length-1]??null}var bHe=fHe();function xHe(e,t={}){return pHe(bHe),mHe(e,3,yHe,t,bHe).domain}function SHe(e,t){return!!(t===e||e.indexOf(t)===0&&(t[t.length-1]===`/`||e.startsWith(t)&&e[t.length]===`/`))}var CHe=[`local`,`example`,`invalid`,`localhost`,`test`],wHe=[`localhost`,`invalid`],THe={allowSpecialUseDomain:!1,ignoreError:!1};function L6(e,t={}){t={...THe,...t};let n=e.split(`.`),r=n[n.length-1],i=!!t.allowSpecialUseDomain,a=!!t.ignoreError;if(i&&r!==void 0&&CHe.includes(r)){if(n.length>1)return`${n[n.length-2]}.${r}`;if(wHe.includes(r))return r}if(!a&&r!==void 0&&CHe.includes(r))throw Error(`Cookie has domain set to the public suffix "${r}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`);let o=xHe(e,{allowIcannDomains:!0,allowPrivateDomains:!0});if(o)return o}function EHe(e,t){let n=L6(e,{allowSpecialUseDomain:t});if(!n)return;if(n==e)return[e];e.slice(-1)==`.`&&(e=e.slice(0,-1));let r=e.slice(0,-(n.length+1)).split(`.`).reverse(),i=n,a=[i];for(;r.length;)i=`${r.shift()}.${i}`,a.push(i);return a}var DHe=class{constructor(){this.synchronous=!1}findCookie(e,t,n,r){throw Error(`findCookie is not implemented`)}findCookies(e,t,n=!1,r){throw Error(`findCookies is not implemented`)}putCookie(e,t){throw Error(`putCookie is not implemented`)}updateCookie(e,t,n){throw Error(`updateCookie is not implemented`)}removeCookie(e,t,n,r){throw Error(`removeCookie is not implemented`)}removeCookies(e,t,n){throw Error(`removeCookies is not implemented`)}removeAllCookies(e){throw Error(`removeAllCookies is not implemented`)}getAllCookies(e){throw Error(`getAllCookies is not implemented (therefore jar cannot be serialized)`)}},R6=e=>Object.prototype.toString.call(e),OHe=(e,t)=>typeof e.join==`function`?(t.add(e),e.map(e=>e==null||t.has(e)?``:kHe(e,t)).join()):R6(e),kHe=(e,t=new WeakSet)=>typeof e!=`object`||!e?String(e):typeof e.toString==`function`?Array.isArray(e)?OHe(e,t):String(e):R6(e),z6=e=>kHe(e);function B6(e){let t,n,r,i=new Promise((e,t)=>{n=e,r=t});return t=typeof e==`function`?(t,n)=>{try{t?e(t):e(null,n)}catch(e){r(e instanceof Error?e:Error())}}:(e,t)=>{try{e?r(e):n(t)}catch(e){r(e instanceof Error?e:Error())}},{promise:i,callback:t,resolve:e=>(t(null,e),i),reject:e=>(t(e),i)}}function V6(e,t){return e in t}var AHe=class extends DHe{constructor(){super(),this.synchronous=!0,this.idx=Object.create(null)}findCookie(e,t,n,r){let i=B6(r);if(e==null||t==null||n==null)return i.resolve(void 0);let a=this.idx[e]?.[t]?.[n];return i.resolve(a)}findCookies(e,t,n=!1,r){typeof n==`function`&&(r=n,n=!0);let i=[],a=B6(r);if(!e)return a.resolve([]);let o;o=t?function(e){for(let n in e)if(SHe(t,n)){let t=e[n];for(let e in t){let n=t[e];n&&i.push(n)}}}:function(e){for(let t in e){let n=e[t];for(let e in n){let t=n[e];t&&i.push(t)}}};let s=EHe(e,n)||[e],c=this.idx;return s.forEach(e=>{let t=c[e];t&&o(t)}),a.resolve(i)}putCookie(e,t){let n=B6(t),{domain:r,path:i,key:a}=e;if(r==null||i==null||a==null)return n.resolve(void 0);let o=this.idx[r]??Object.create(null);this.idx[r]=o;let s=o[i]??Object.create(null);return o[i]=s,s[a]=e,n.resolve(void 0)}updateCookie(e,t,n){if(n)this.putCookie(t,n);else return this.putCookie(t)}removeCookie(e,t,n,r){let i=B6(r);return delete this.idx[e]?.[t]?.[n],i.resolve(void 0)}removeCookies(e,t,n){let r=B6(n),i=this.idx[e];return i&&(t?delete i[t]:delete this.idx[e]),r.resolve(void 0)}removeAllCookies(e){let t=B6(e);return this.idx=Object.create(null),t.resolve(void 0)}getAllCookies(e){let t=B6(e),n=[],r=this.idx;return Object.keys(r).forEach(e=>{let t=r[e]??{};Object.keys(t).forEach(e=>{let r=t[e]??{};Object.keys(r).forEach(e=>{let t=r[e];t!=null&&n.push(t)})})}),n.sort((e,t)=>(e.creationIndex||0)-(t.creationIndex||0)),t.resolve(n)}};function H6(e){return jHe(e)&&e!==``}function U6(e){return e===``||e instanceof String&&e.toString()===``}function jHe(e){return typeof e==`string`||e instanceof String}function W6(e){return R6(e)===`[object Object]`}function G6(e,t,n){if(e)return;let r=typeof t==`function`?t:void 0,i=typeof t==`function`?n:t;W6(i)||(i=`[object Object]`);let a=new MHe(z6(i));if(r)r(a);else throw a}var MHe=class extends Error{},NHe=`6.0.1`,K6={SILENT:`silent`,STRICT:`strict`,DISABLED:`unsafe-disabled`};Object.freeze(K6);var PHe=` -\\[?(?: -(?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)| -(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)| -(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,2}|:)| -(?:[a-fA-F\\d]{1,4}:){4}(?:(?::[a-fA-F\\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,3}|:)| -(?:[a-fA-F\\d]{1,4}:){3}(?:(?::[a-fA-F\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,4}|:)| -(?:[a-fA-F\\d]{1,4}:){2}(?:(?::[a-fA-F\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,5}|:)| -(?:[a-fA-F\\d]{1,4}:){1}(?:(?::[a-fA-F\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,6}|:)| -(?::(?:(?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:)) -)(?:%[0-9a-zA-Z]{1,})?\\]? -`.replace(/\s*\/\/.*$/gm,``).replace(/\n/g,``).trim(),q6=RegExp(`^${PHe}$`),FHe=RegExp(`^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$`);function IHe(e){return new URL(`http://${e}`).hostname}function J6(e){if(e==null)return;let t=e.trim().replace(/^\./,``);return q6.test(t)?(t.startsWith(`[`)||(t=`[`+t),t.endsWith(`]`)||(t+=`]`),IHe(t).slice(1,-1)):/[^\u0001-\u007f]/.test(t)?IHe(t):t.toLowerCase()}function LHe(e){return e.toUTCString()}function Y6(e){if(!e)return;let t={foundTime:void 0,foundDayOfMonth:void 0,foundMonth:void 0,foundYear:void 0},n=e.split(zHe).filter(e=>e.length>0);for(let e of n){if(t.foundTime===void 0){let[,n,r,i]=BHe.exec(e)||[];if(n!=null&&r!=null&&i!=null){let e=parseInt(n,10),a=parseInt(r,10),o=parseInt(i,10);if(!isNaN(e)&&!isNaN(a)&&!isNaN(o)){t.foundTime={hours:e,minutes:a,seconds:o};continue}}}if(t.foundDayOfMonth===void 0&&VHe.test(e)){let n=parseInt(e,10);if(!isNaN(n)){t.foundDayOfMonth=n;continue}}if(t.foundMonth===void 0&&HHe.test(e)){let n=RHe.indexOf(e.substring(0,3).toLowerCase());if(n>=0&&n<=11){t.foundMonth=n;continue}}if(t.foundYear===void 0&&UHe.test(e)){let n=parseInt(e,10);if(!isNaN(n)){t.foundYear=n;continue}}}if(t.foundYear!==void 0&&t.foundYear>=70&&t.foundYear<=99&&(t.foundYear+=1900),t.foundYear!==void 0&&t.foundYear>=0&&t.foundYear<=69&&(t.foundYear+=2e3),t.foundDayOfMonth===void 0||t.foundMonth===void 0||t.foundYear===void 0||t.foundTime===void 0||t.foundDayOfMonth<1||t.foundDayOfMonth>31||t.foundYear<1601||t.foundTime.hours>23||t.foundTime.minutes>59||t.foundTime.seconds>59)return;let r=new Date(Date.UTC(t.foundYear,t.foundMonth,t.foundDayOfMonth,t.foundTime.hours,t.foundTime.minutes,t.foundTime.seconds));if(!(r.getUTCFullYear()!==t.foundYear||r.getUTCMonth()!==t.foundMonth||r.getUTCDate()!==t.foundDayOfMonth))return r}var RHe=[`jan`,`feb`,`mar`,`apr`,`may`,`jun`,`jul`,`aug`,`sep`,`oct`,`nov`,`dec`],zHe=/[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/,BHe=/^(\d{1,2}):(\d{1,2}):(\d{1,2})(?:[\x00-\x2F\x3A-\xFF][\x00-\xFF]*)?$/,VHe=/^[0-9]{1,2}(?:[\x00-\x2F\x3A-\xFF][\x00-\xFF]*)?$/,HHe=/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[\x00-\xFF]*$/i,UHe=/^[\x30-\x39]{2,4}(?:[\x00-\x2F\x3A-\xFF][\x00-\xFF]*)?$/,WHe=/^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/,GHe=/[\x20-\x3A\x3C-\x7E]+/,KHe=/[\x00-\x1F]/,qHe=[` -`,`\r`,`\0`];function JHe(e){if(U6(e))return e;for(let t=0;t{if(t&&typeof t==`object`&&V6(e,t)){let r=t[e];if(r===void 0||V6(e,X6)&&r===X6[e])return;switch(e){case`key`:case`value`:case`sameSite`:typeof r==`string`&&(n[e]=r);break;case`expires`:case`creation`:case`lastAccessed`:typeof r==`number`||typeof r==`string`||r instanceof Date?n[e]=t[e]==`Infinity`?`Infinity`:new Date(r):r===null&&(n[e]=null);break;case`maxAge`:(typeof r==`number`||r===`Infinity`||r===`-Infinity`)&&(n[e]=r);break;case`domain`:case`path`:(typeof r==`string`||r===null)&&(n[e]=r);break;case`secure`:case`httpOnly`:typeof r==`boolean`&&(n[e]=r);break;case`extensions`:Array.isArray(r)&&r.every(e=>typeof e==`string`)&&(n[e]=r);break;case`hostOnly`:case`pathIsDefault`:(typeof r==`boolean`||r===null)&&(n[e]=r);break}}}),n}var X6={key:``,value:``,expires:`Infinity`,maxAge:null,domain:null,path:null,secure:!1,httpOnly:!1,extensions:null,hostOnly:null,pathIsDefault:null,creation:null,lastAccessed:null,sameSite:void 0},Z6=class e{constructor(t={}){this.key=t.key??X6.key,this.value=t.value??X6.value,this.expires=t.expires??X6.expires,this.maxAge=t.maxAge??X6.maxAge,this.domain=t.domain??X6.domain,this.path=t.path??X6.path,this.secure=t.secure??X6.secure,this.httpOnly=t.httpOnly??X6.httpOnly,this.extensions=t.extensions??X6.extensions,this.creation=t.creation??X6.creation,this.hostOnly=t.hostOnly??X6.hostOnly,this.pathIsDefault=t.pathIsDefault??X6.pathIsDefault,this.lastAccessed=t.lastAccessed??X6.lastAccessed,this.sameSite=t.sameSite??X6.sameSite,this.creation=t.creation??new Date,Object.defineProperty(this,`creationIndex`,{configurable:!1,enumerable:!1,writable:!0,value:++e.cookiesCreated}),this.creationIndex=e.cookiesCreated}[Symbol.for(`nodejs.util.inspect.custom`)](){let e=Date.now(),t=this.hostOnly==null?`?`:this.hostOnly.toString(),n=this.creation&&this.creation!==`Infinity`?`${String(e-this.creation.getTime())}ms`:`?`,r=this.lastAccessed&&this.lastAccessed!==`Infinity`?`${String(e-this.lastAccessed.getTime())}ms`:`?`;return`Cookie="${this.toString()}; hostOnly=${t}; aAge=${r}; cAge=${n}"`}toJSON(){let t={};for(let n of e.serializableProperties){let e=this[n];if(e!==X6[n])switch(n){case`key`:case`value`:case`sameSite`:typeof e==`string`&&(t[n]=e);break;case`expires`:case`creation`:case`lastAccessed`:typeof e==`number`||typeof e==`string`||e instanceof Date?t[n]=e==`Infinity`?`Infinity`:new Date(e).toISOString():e===null&&(t[n]=null);break;case`maxAge`:(typeof e==`number`||e===`Infinity`||e===`-Infinity`)&&(t[n]=e);break;case`domain`:case`path`:(typeof e==`string`||e===null)&&(t[n]=e);break;case`secure`:case`httpOnly`:typeof e==`boolean`&&(t[n]=e);break;case`extensions`:Array.isArray(e)&&(t[n]=e);break;case`hostOnly`:case`pathIsDefault`:(typeof e==`boolean`||e===null)&&(t[n]=e);break}}return t}clone(){return ZHe(this.toJSON())}validate(){if(!this.value||!WHe.test(this.value)||this.expires!=`Infinity`&&!(this.expires instanceof Date)&&!Y6(this.expires)||this.maxAge!=null&&this.maxAge!==`Infinity`&&(this.maxAge===`-Infinity`||this.maxAge<=0)||this.path!=null&&!GHe.test(this.path))return!1;let e=this.cdomain();return!(e&&(e.match(/\.$/)||L6(e)==null))}setExpires(e){e instanceof Date?this.expires=e:this.expires=Y6(e)||`Infinity`}setMaxAge(e){e===1/0?this.maxAge=`Infinity`:e===-1/0?this.maxAge=`-Infinity`:this.maxAge=e}cookieString(){let e=this.value||``;return this.key?`${this.key}=${e}`:e}toString(){let t=this.cookieString();return this.expires!=`Infinity`&&this.expires instanceof Date&&(t+=`; Expires=${LHe(this.expires)}`),this.maxAge!=null&&this.maxAge!=1/0&&(t+=`; Max-Age=${String(this.maxAge)}`),this.domain&&!this.hostOnly&&(t+=`; Domain=${this.domain}`),this.path&&(t+=`; Path=${this.path}`),this.secure&&(t+=`; Secure`),this.httpOnly&&(t+=`; HttpOnly`),this.sameSite&&this.sameSite!==`none`&&(this.sameSite.toLowerCase()===e.sameSiteCanonical.lax.toLowerCase()?t+=`; SameSite=${e.sameSiteCanonical.lax}`:this.sameSite.toLowerCase()===e.sameSiteCanonical.strict.toLowerCase()?t+=`; SameSite=${e.sameSiteCanonical.strict}`:t+=`; SameSite=${this.sameSite}`),this.extensions&&this.extensions.forEach(e=>{t+=`; ${e}`}),t}TTL(e=Date.now()){if(this.maxAge!=null&&typeof this.maxAge==`number`)return this.maxAge<=0?0:this.maxAge*1e3;let t=this.expires;return t===`Infinity`?1/0:(t?.getTime()??e)-(e||Date.now())}expiryTime(e){if(this.maxAge!=null){let t=e||this.lastAccessed||new Date,n=typeof this.maxAge==`number`?this.maxAge:-1/0,r=n<=0?-1/0:n*1e3;return t===`Infinity`?1/0:t.getTime()+r}return this.expires==`Infinity`?1/0:this.expires?this.expires.getTime():void 0}expiryDate(e){let t=this.expiryTime(e);return t==1/0?new Date(2147483647e3):t==-1/0?new Date(0):t==null?void 0:new Date(t)}isPersistent(){return this.maxAge!=null||this.expires!=`Infinity`}canonicalizedDomain(){return J6(this.domain)}cdomain(){return J6(this.domain)}static parse(e,t){return XHe(e,t)}static fromJSON(e){return ZHe(e)}};Z6.cookiesCreated=0,Z6.sameSiteLevel={strict:3,lax:2,none:1},Z6.sameSiteCanonical={strict:`Strict`,lax:`Lax`},Z6.serializableProperties=[`key`,`value`,`expires`,`maxAge`,`domain`,`path`,`secure`,`httpOnly`,`extensions`,`hostOnly`,`pathIsDefault`,`creation`,`lastAccessed`,`sameSite`];var Q6=Z6,QHe=2147483647e3;function $He(e,t){let n,r=e.path?e.path.length:0;return n=(t.path?t.path.length:0)-r,n!==0||(n=(e.creation&&e.creation instanceof Date?e.creation.getTime():QHe)-(t.creation&&t.creation instanceof Date?t.creation.getTime():QHe),n!==0)||(n=(e.creationIndex||0)-(t.creationIndex||0)),n}function eUe(e){if(!e||e.slice(0,1)!==`/`)return`/`;if(e===`/`)return e;let t=e.lastIndexOf(`/`);return t===0?`/`:e.slice(0,t)}var tUe=/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-f\d]{1,4}:){7}(?:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,2}|:)|(?:[a-f\d]{1,4}:){4}(?:(?::[a-f\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,3}|:)|(?:[a-f\d]{1,4}:){3}(?:(?::[a-f\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,4}|:)|(?:[a-f\d]{1,4}:){2}(?:(?::[a-f\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,5}|:)|(?:[a-f\d]{1,4}:){1}(?:(?::[a-f\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,6}|:)|(?::(?:(?::[a-f\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,7}|:)))$)/;function nUe(e,t,n){if(e==null||t==null)return;let r,i;if(n===!1?(r=e,i=t):(r=J6(e),i=J6(t)),r==null||i==null)return;if(r==i)return!0;let a=r.lastIndexOf(i);return a<=0||r.length!==i.length+a||r.substring(a-1,a)!==`.`?!1:!tUe.test(r)}function rUe(e){let t=e.split(`.`);return t.length===4&&t[0]!==void 0&&parseInt(t[0],10)===127}function iUe(e){return e===`::1`}function aUe(e){return e.endsWith(`.localhost`)}function oUe(e){let t=e.toLowerCase();return t===`localhost`||aUe(t)}function sUe(e){return e.length>=2&&e.startsWith(`[`)&&e.endsWith(`]`)?e.substring(1,e.length-1):e}function cUe(e,t=!0){let n;if(typeof e==`string`)try{n=new URL(e)}catch{return!1}else n=e;let r=n.protocol.replace(`:`,``).toLowerCase(),i=sUe(n.hostname).replace(/\.+$/,``);return r===`https`||r===`wss`?!0:t?FHe.test(i)?rUe(i):q6.test(i)?iUe(i):oUe(i):!1}var lUe={loose:!1,sameSiteContext:void 0,ignoreError:!1,http:!0},uUe={http:!0,expire:!0,allPaths:!1,sameSiteContext:void 0,sort:void 0},dUe=`Invalid sameSiteContext option for getCookies(); expected one of "strict", "lax", or "none"`;function fUe(e){if(e&&typeof e==`object`&&`hostname`in e&&typeof e.hostname==`string`&&`pathname`in e&&typeof e.pathname==`string`&&`protocol`in e&&typeof e.protocol==`string`)return{hostname:e.hostname,pathname:e.pathname,protocol:e.protocol};if(typeof e==`string`)try{return new URL(decodeURI(e))}catch{return new URL(e)}else throw new MHe("`url` argument is not a string or URL.")}function pUe(e){let t=String(e).toLowerCase();if(t===`none`||t===`lax`||t===`strict`)return t}function mUe(e){return!(typeof e.key==`string`&&e.key.startsWith(`__Secure-`))||e.secure}function hUe(e){return!(typeof e.key==`string`&&e.key.startsWith(`__Host-`))||!!(e.secure&&e.hostOnly&&e.path!=null&&e.path===`/`)}function $6(e){let t=e.toLowerCase();switch(t){case K6.STRICT:case K6.SILENT:case K6.DISABLED:return t;default:return K6.SILENT}}var gUe=class e{constructor(e,t){typeof t==`boolean`&&(t={rejectPublicSuffixes:t}),this.rejectPublicSuffixes=t?.rejectPublicSuffixes??!0,this.enableLooseMode=t?.looseMode??!1,this.allowSpecialUseDomain=t?.allowSpecialUseDomain??!0,this.allowSecureOnLocal=t?.allowSecureOnLocal??!0,this.prefixSecurity=$6(t?.prefixSecurity??`silent`),this.store=e??new AHe}callSync(e){if(!this.store.synchronous)throw Error(`CookieJar store is not synchronous; use async API instead.`);let t=null,n;try{e.call(this,(e,r)=>{t=e,n=r})}catch(e){t=e}if(t)throw t;return n}setCookie(e,t,n,r){typeof n==`function`&&(r=n,n=void 0);let i=B6(r),a=i.callback,o;try{if(typeof t==`string`&&G6(H6(t),r,z6(n)),o=fUe(t),typeof t==`function`)return i.reject(Error(`No URL was specified`));if(typeof n==`function`&&(n=lUe),G6(typeof a==`function`,a),!H6(e)&&!W6(e)&&e instanceof String&&e.length==0)return i.resolve(void 0)}catch(e){return i.reject(e)}let s=J6(o.hostname)??null,c=n?.loose||this.enableLooseMode,l=null;if(n?.sameSiteContext&&(l=pUe(n.sameSiteContext),!l))return i.reject(Error(dUe));if(typeof e==`string`||e instanceof String){let t=Q6.parse(e.toString(),{loose:c});if(!t){let e=Error(`Cookie failed to parse`);return n?.ignoreError?i.resolve(void 0):i.reject(e)}e=t}else if(!(e instanceof Q6)){let e=Error(`First argument to setCookie must be a Cookie object or string`);return n?.ignoreError?i.resolve(void 0):i.reject(e)}let u=n?.now||new Date;if(this.rejectPublicSuffixes&&e.domain)try{let t=e.cdomain();if((typeof t==`string`?L6(t,{allowSpecialUseDomain:this.allowSpecialUseDomain,ignoreError:n?.ignoreError}):null)==null&&!q6.test(e.domain)){let e=Error(`Cookie has domain set to a public suffix`);return n?.ignoreError?i.resolve(void 0):i.reject(e)}}catch(e){return n?.ignoreError?i.resolve(void 0):i.reject(e)}if(e.domain){if(!nUe(s??void 0,e.cdomain()??void 0,!1)){let t=Error(`Cookie not in this host's domain. Cookie:${e.cdomain()??`null`} Request:${s??`null`}`);return n?.ignoreError?i.resolve(void 0):i.reject(t)}e.hostOnly??=!1}else e.hostOnly=!0,e.domain=s;if((!e.path||e.path[0]!==`/`)&&(e.path=eUe(o.pathname),e.pathIsDefault=!0),n?.http===!1&&e.httpOnly){let e=Error(`Cookie is HttpOnly and this isn't an HTTP API`);return n.ignoreError?i.resolve(void 0):i.reject(e)}if(e.sameSite!==`none`&&e.sameSite!==void 0&&l&&l===`none`){let e=Error(`Cookie is SameSite but this is a cross-origin request`);return n?.ignoreError?i.resolve(void 0):i.reject(e)}let d=this.prefixSecurity===K6.SILENT;if(this.prefixSecurity!==K6.DISABLED){let t=!1,r;if(mUe(e)?hUe(e)||(t=!0,r=`Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'`):(t=!0,r=`Cookie has __Secure prefix but Secure attribute is not set`),t)return n?.ignoreError||d?i.resolve(void 0):i.reject(Error(r))}let f=this.store;return f.updateCookie||=async function(e,t,n){return this.putCookie(t).then(()=>n?.(null),e=>n?.(e))},f.findCookie(e.domain,e.path,e.key,function(t,r){if(t){a(t);return}let i=function(t){t?a(t):typeof e==`string`?a(null,void 0):a(null,e)};if(r){if(n&&`http`in n&&n.http===!1&&r.httpOnly){t=Error(`old Cookie is HttpOnly and this isn't an HTTP API`),n.ignoreError?a(null,void 0):a(t);return}e instanceof Q6&&(e.creation=r.creation,e.creationIndex=r.creationIndex,e.lastAccessed=u,f.updateCookie(r,e,i))}else e instanceof Q6&&(e.creation=e.lastAccessed=u,f.putCookie(e,i))}),i.promise}setCookieSync(e,t,n){let r=n?this.setCookie.bind(this,e,t,n):this.setCookie.bind(this,e,t);return this.callSync(r)}getCookies(e,t,n){typeof t==`function`?(n=t,t=uUe):t===void 0&&(t=uUe);let r=B6(n),i=r.callback,a;try{typeof e==`string`&&G6(H6(e),i,e),a=fUe(e),G6(W6(t),i,z6(t)),G6(typeof i==`function`,i)}catch(e){return r.reject(e)}let o=J6(a.hostname),s=a.pathname||`/`,c=cUe(e,this.allowSecureOnLocal),l=0;if(t.sameSiteContext){let e=pUe(t.sameSiteContext);if(e==null||(l=Q6.sameSiteLevel[e],!l))return r.reject(Error(dUe))}let u=t.http??!0,d=Date.now(),f=t.expire??!0,p=t.allPaths??!1,m=this.store;function h(e){if(e.hostOnly){if(e.domain!=o)return!1}else if(!nUe(o??void 0,e.domain??void 0,!1))return!1;if(!p&&typeof e.path==`string`&&!SHe(s,e.path)||e.secure&&!c||e.httpOnly&&!u)return!1;if(l){let t;if(t=e.sameSite===`lax`?Q6.sameSiteLevel.lax:e.sameSite===`strict`?Q6.sameSiteLevel.strict:Q6.sameSiteLevel.none,t>l)return!1}let t=e.expiryTime();return f&&t!=null&&t<=d?(m.removeCookie(e.domain,e.path,e.key,()=>{}),!1):!0}return m.findCookies(o,p?null:s,this.allowSpecialUseDomain,(e,n)=>{if(e){i(e);return}if(n==null){i(null,[]);return}n=n.filter(h),`sort`in t&&t.sort!==!1&&(n=n.sort($He));let r=new Date;for(let e of n)e.lastAccessed=r;i(null,n)}),r.promise}getCookiesSync(e,t){return this.callSync(this.getCookies.bind(this,e,t))??[]}getCookieString(e,t,n){typeof t==`function`&&(n=t,t=void 0);let r=B6(n);return this.getCookies(e,t,function(e,t){e?r.callback(e):r.callback(null,t?.sort($He).map(e=>e.cookieString()).join(`; `))}),r.promise}getCookieStringSync(e,t){return this.callSync(t?this.getCookieString.bind(this,e,t):this.getCookieString.bind(this,e))??``}getSetCookieStrings(e,t,n){typeof t==`function`&&(n=t,t=void 0);let r=B6(n);return this.getCookies(e,t,function(e,t){e?r.callback(e):r.callback(null,t?.map(e=>e.toString()))}),r.promise}getSetCookieStringsSync(e,t={}){return this.callSync(this.getSetCookieStrings.bind(this,e,t))??[]}serialize(e){let t=B6(e),n=this.store.constructor.name;W6(n)&&(n=null);let r={version:`tough-cookie@${NHe}`,storeType:n,rejectPublicSuffixes:this.rejectPublicSuffixes,enableLooseMode:this.enableLooseMode,allowSpecialUseDomain:this.allowSpecialUseDomain,prefixSecurity:$6(this.prefixSecurity),cookies:[]};return typeof this.store.getAllCookies==`function`?(this.store.getAllCookies((e,n)=>{if(e){t.callback(e);return}if(n==null){t.callback(null,r);return}r.cookies=n.map(e=>{let t=e.toJSON();return delete t.creationIndex,t}),t.callback(null,r)}),t.promise):t.reject(Error(`store does not support getAllCookies and cannot be serialized`))}serializeSync(){return this.callSync(e=>{this.serialize(e)})}toJSON(){return this.serializeSync()}_importCookies(e,t){let n;if(e&&typeof e==`object`&&V6(`cookies`,e)&&Array.isArray(e.cookies)&&(n=e.cookies),!n){t(Error(`serialized jar has no cookies array`),void 0);return}n=n.slice();let r=e=>{if(e){t(e,void 0);return}if(Array.isArray(n)){if(!n.length){t(e,this);return}let i;try{i=Q6.fromJSON(n.shift())}catch(e){t(e instanceof Error?e:Error(),void 0);return}if(i===void 0){r(null);return}this.store.putCookie(i,r)}};r(null)}_importCookiesSync(e){this.callSync(this._importCookies.bind(this,e))}clone(t,n){typeof t==`function`&&(n=t,t=void 0);let r=B6(n),i=r.callback;return this.serialize((n,a)=>n?r.reject(n):e.deserialize(a??``,t,i)),r.promise}_cloneSync(e){let t=e&&typeof e!=`function`?this.clone.bind(this,e):this.clone.bind(this);return this.callSync(e=>{t(e)})}cloneSync(e){if(!e)return this._cloneSync();if(!e.synchronous)throw Error(`CookieJar clone destination store is not synchronous; use async API instead.`);return this._cloneSync(e)}removeAllCookies(e){let t=B6(e),n=t.callback,r=this.store;return typeof r.removeAllCookies==`function`&&r.removeAllCookies!==DHe.prototype.removeAllCookies?(r.removeAllCookies(n),t.promise):(r.getAllCookies((e,t)=>{if(e){n(e);return}if(t||=[],t.length===0){n(null,void 0);return}let i=0,a=[],o=function(e){if(e&&a.push(e),i++,i===t.length){a[0]?n(a[0]):n(null,void 0);return}};t.forEach(e=>{r.removeCookie(e.domain,e.path,e.key,o)})}),t.promise)}removeAllCookiesSync(){this.callSync(e=>{this.removeAllCookies(e)})}static deserialize(t,n,r){typeof n==`function`&&(r=n,n=void 0);let i=B6(r),a;if(typeof t==`string`)try{a=JSON.parse(t)}catch(e){return i.reject(e instanceof Error?e:Error())}else a=t;let o=e=>a&&typeof a==`object`&&V6(e,a)?a[e]:void 0,s=e=>{let t=o(e);return typeof t==`boolean`?t:void 0},c=new e(n,{rejectPublicSuffixes:s(`rejectPublicSuffixes`),looseMode:s(`enableLooseMode`),allowSpecialUseDomain:s(`allowSpecialUseDomain`),prefixSecurity:$6((e=>{let t=o(e);return typeof t==`string`?t:void 0})(`prefixSecurity`)??`silent`)});return c._importCookies(a,e=>{if(e){i.callback(e);return}i.callback(null,c)}),i.promise}static deserializeSync(t,n){let r=typeof t==`string`?JSON.parse(t):t,i=e=>r&&typeof r==`object`&&V6(e,r)?r[e]:void 0,a=e=>{let t=i(e);return typeof t==`boolean`?t:void 0},o=new e(n,{rejectPublicSuffixes:a(`rejectPublicSuffixes`),looseMode:a(`enableLooseMode`),allowSpecialUseDomain:a(`allowSpecialUseDomain`),prefixSecurity:$6((e=>{let t=i(e);return typeof t==`string`?t:void 0})(`prefixSecurity`)??`silent`)});if(!o.store.synchronous)throw Error(`CookieJar store is not synchronous; use async API instead.`);return o._importCookiesSync(r),o}static fromJSON(t,n){return e.deserializeSync(t,n)}};function _Ue(e){try{return JSON.parse(e)}catch{return}}var vUe=new class{#e=`__msw-cookie-store__`;#t;#n;constructor(){cVe()||b6(typeof localStorage<`u`,"Failed to create a CookieStore: `localStorage` is not available in this environment. This is likely an issue with your environment, which has been detected as browser (or browser-like) environment and must implement global browser APIs correctly."),this.#n=new AHe,this.#n.idx=this.getCookieStoreIndex(),this.#t=new gUe(this.#n)}getCookies(e){return this.#t.getCookiesSync(e)}async setCookie(e,t){await this.#t.setCookie(e,t),this.persist()}getCookieStoreIndex(){if(typeof localStorage>`u`||typeof localStorage.getItem!=`function`)return{};let e=localStorage.getItem(this.#e);if(e==null)return{};let t=_Ue(e);if(t==null)return{};let n={};for(let e of t){let t=Q6.fromJSON(e);t!=null&&t.domain!=null&&t.path!=null&&(n[t.domain]||={},n[t.domain][t.path]||={},n[t.domain][t.path][t.key]=t)}return n}persist(){if(typeof localStorage>`u`||typeof localStorage.setItem!=`function`)return;let e=[],{idx:t}=this.#n;for(let n in t)for(let r in t[n])for(let i in t[n][r])e.push(t[n][r][i].toJSON());localStorage.setItem(this.#e,JSON.stringify(e))}};function yUe(e){let t=XVe(e),n={};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function bUe(){return yUe(document.cookie)}function xUe(e){if(typeof document>`u`||typeof location>`u`)return{};switch(e.credentials){case`same-origin`:{let t=new URL(e.url);return location.origin===t.origin?bUe():{}}case`include`:return bUe();default:return{}}}function SUe(e){let t=e.headers.get(`cookie`),n=t?yUe(t):{},r=xUe(e);for(let t in r)e.headers.append(`cookie`,ZVe(t,r[t]));let i=vUe.getCookies(e.url),a=Object.fromEntries(i.map(e=>[e.key,e.value]));for(let t of i)e.headers.append(`cookie`,t.toString());return{...r,...a,...n}}var e8=(e=>(e.HEAD=`HEAD`,e.GET=`GET`,e.POST=`POST`,e.PUT=`PUT`,e.PATCH=`PATCH`,e.OPTIONS=`OPTIONS`,e.DELETE=`DELETE`,e))(e8||{}),CUe=class extends DBe{constructor(e,t,n,r){let i=typeof t==`function`?`[custom predicate]`:t;super({info:{header:`${e}${i?` ${i}`:``}`,path:t,method:e},resolver:n,options:r}),this.checkRedundantQueryParameters()}checkRedundantQueryParameters(){let{method:e,path:t}=this.info;!t||t instanceof RegExp||typeof t==`function`||NVe(t)!==t&&S6.warn(`Found a redundant usage of query parameters in the request handler URL for "${e} ${t}". Please match against a path instead and access query parameters using "new URL(request.url).searchParams" instead. Learn more: https://mswjs.io/docs/http/intercepting-requests#querysearch-parameters`)}async parse(e){let t=new URL(e.request.url),n=SUe(e.request);if(typeof this.info.path==`function`){let t=await this.info.path({request:e.request,cookies:n});return{match:typeof t==`boolean`?{matches:t,params:{}}:t,cookies:n}}return{match:this.info.path?RVe(t,this.info.path,e.resolutionContext?.baseUrl):{matches:!1,params:{}},cookies:n}}async predicate(e){let t=this.matchMethod(e.request.method),n=e.parsedResult.match.matches;return t&&n}matchMethod(e){return this.info.method instanceof RegExp?this.info.method.test(e):OBe(this.info.method,e)}extendResolverArgs(e){return{params:e.parsedResult.match?.params||{},cookies:e.parsedResult.cookies}}async log(e){let t=zVe(e.request.url),n=await jBe(e.request),r=await KBe(e.response),i=kBe(r.status);console.groupCollapsed(S6.formatMessage(`${ABe()} ${e.request.method} ${t} (%c${r.status} ${r.statusText}%c)`),`color:${i}`,`color:inherit`),console.log(`Request`,n),console.log(`Handler:`,this),console.log(`Response`,r),console.groupEnd()}};function t8(e){return(t,n,r={})=>new CUe(e,t,n,r)}var n8={all:t8(/.+/),head:t8(e8.HEAD),get:t8(e8.GET),post:t8(e8.POST),put:t8(e8.PUT),delete:t8(e8.DELETE),patch:t8(e8.PATCH),options:t8(e8.OPTIONS)},wUe=Object.create,TUe=Object.defineProperty,EUe=Object.getOwnPropertyDescriptor,DUe=Object.getOwnPropertyNames,OUe=Object.getPrototypeOf,kUe=Object.prototype.hasOwnProperty,AUe=(e,t)=>function(){return t||(0,e[DUe(e)[0]])((t={exports:{}}).exports,t),t.exports},jUe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of DUe(t))!kUe.call(e,i)&&i!==n&&TUe(e,i,{get:()=>t[i],enumerable:!(r=EUe(t,i))||r.enumerable});return e},MUe=((e,t,n)=>(n=e==null?{}:wUe(OUe(e)),jUe(t||!e||!e.__esModule?TUe(n,`default`,{value:e,enumerable:!0}):n,e)))(AUe({"node_modules/set-cookie-parser/lib/set-cookie.js"(e,t){var n={decodeValues:!0,map:!1,silent:!1};function r(e){return typeof e==`string`&&!!e.trim()}function i(e,t){var i=e.split(`;`).filter(r),o=a(i.shift()),s=o.name,c=o.value;t=t?Object.assign({},n,t):n;try{c=t.decodeValues?decodeURIComponent(c):c}catch(e){console.error(`set-cookie-parser encountered an error while decoding a cookie with value '`+c+`'. Set options.decodeValues to false to disable this feature.`,e)}var l={name:s,value:c};return i.forEach(function(e){var t=e.split(`=`),n=t.shift().trimLeft().toLowerCase(),r=t.join(`=`);n===`expires`?l.expires=new Date(r):n===`max-age`?l.maxAge=parseInt(r,10):n===`secure`?l.secure=!0:n===`httponly`?l.httpOnly=!0:n===`samesite`?l.sameSite=r:l[n]=r}),l}function a(e){var t=``,n=``,r=e.split(`=`);return r.length>1?(t=r.shift(),n=r.join(`=`)):n=e,{name:t,value:n}}function o(e,t){if(t=t?Object.assign({},n,t):n,!e)return t.map?{}:[];if(e.headers)if(typeof e.headers.getSetCookie==`function`)e=e.headers.getSetCookie();else if(e.headers[`set-cookie`])e=e.headers[`set-cookie`];else{var a=e.headers[Object.keys(e.headers).find(function(e){return e.toLowerCase()===`set-cookie`})];!a&&e.headers.cookie&&!t.silent&&console.warn(`Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning.`),e=a}return Array.isArray(e)||(e=[e]),t=t?Object.assign({},n,t):n,t.map?e.filter(r).reduce(function(e,n){var r=i(n,t);return e[r.name]=r,e},{}):e.filter(r).map(function(e){return i(e,t)})}function s(e){if(Array.isArray(e))return e;if(typeof e!=`string`)return[];var t=[],n=0,r,i,a,o,s;function c(){for(;n=e.length)&&t.push(e.substring(r,e.length))}return t}t.exports=o,t.exports.parse=o,t.exports.parseString=i,t.exports.splitCookiesString=s}})()),NUe=/[^a-z0-9\-#$%&'*+.^_`|~]/i;function r8(e){if(NUe.test(e)||e.trim()===``)throw TypeError(`Invalid character in header field name`);return e.trim().toLowerCase()}var PUe=[` -`,`\r`,` `,` `],FUe=RegExp(`(^[${PUe.join(``)}]|$[${PUe.join(``)}])`,`g`);function i8(e){return e.replace(FUe,``)}function a8(e){if(typeof e!=`string`||e.length===0)return!1;for(let t=0;t127||!IUe(n))return!1}return!0}function IUe(e){return![127,32,`(`,`)`,`<`,`>`,`@`,`,`,`;`,`:`,`\\`,`"`,`/`,`[`,`]`,`?`,`=`,`{`,`}`].includes(e)}function LUe(e){if(typeof e!=`string`||e.trim()!==e)return!1;for(let t=0;t{this.append(t,e)},this):Array.isArray(t)?t.forEach(([e,t])=>{this.append(e,Array.isArray(t)?t.join(RUe):t)}):t&&Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e];this.append(e,Array.isArray(n)?n.join(RUe):n)})}[(zUe=o8,BUe=s8,VUe=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[e]of this.entries())yield e}*values(){for(let[,e]of this.entries())yield e}*entries(){let e=Object.keys(this[o8]).sort((e,t)=>e.localeCompare(t));for(let t of e)if(t===`set-cookie`)for(let e of this.getSetCookie())yield[t,e];else yield[t,this.get(t)]}has(e){if(!a8(e))throw TypeError(`Invalid header name "${e}"`);return this[o8].hasOwnProperty(r8(e))}get(e){if(!a8(e))throw TypeError(`Invalid header name "${e}"`);return this[o8][r8(e)]??null}set(e,t){if(!a8(e)||!LUe(t))return;let n=r8(e),r=i8(t);this[o8][n]=i8(r),this[s8].set(n,e)}append(e,t){if(!a8(e)||!LUe(t))return;let n=r8(e),r=i8(t),i=this.has(n)?`${this.get(n)}, ${r}`:r;this.set(e,i)}delete(e){if(!a8(e)||!this.has(e))return;let t=r8(e);delete this[o8][t],this[s8].delete(t)}forEach(e,t){for(let[n,r]of this.entries())e.call(t,r,n,this)}getSetCookie(){let e=this.get(`set-cookie`);return e===null?[]:e===``?[``]:(0,MUe.splitCookiesString)(e)}},{message:UUe}=WBe,WUe=Symbol(`kSetCookie`);function c8(e={}){let t=e?.status||200,n=e?.statusText||UUe[t]||``,r=new Headers(e?.headers);return{...e,headers:r,status:t,statusText:n}}function GUe(e,t){t.type&&Object.defineProperty(e,`type`,{value:t.type,enumerable:!0,writable:!1});let n=t.headers.get(`set-cookie`);if(n&&(Object.defineProperty(e,WUe,{value:n,enumerable:!1,writable:!1}),typeof document<`u`)){let e=HUe.prototype.getSetCookie.call(t.headers);for(let t of e)document.cookie=t}return e}var KUe=Symbol(`bodyType`),l8=Symbol.for(`kDefaultContentType`),u8=class e extends sVe{[KUe]=null;constructor(e,t){let n=c8(t);super(e,n),GUe(this,n)}static error(){return super.error()}static text(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`text/plain`),r.headers.has(`Content-Length`)||r.headers.set(`Content-Length`,t?new Blob([t]).size.toString():`0`);let a=new e(t,r);return i||Object.defineProperty(a,l8,{value:!0,enumerable:!1}),a}static json(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`application/json`);let a=JSON.stringify(t);r.headers.has(`Content-Length`)||r.headers.set(`Content-Length`,a?new Blob([a]).size.toString():`0`);let o=new e(a,r);return i||Object.defineProperty(o,l8,{value:!0,enumerable:!1}),o}static xml(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`text/xml`);let a=new e(t,r);return i||Object.defineProperty(a,l8,{value:!0,enumerable:!1}),a}static html(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`text/html`);let a=new e(t,r);return i||Object.defineProperty(a,l8,{value:!0,enumerable:!1}),a}static arrayBuffer(t,n){let r=c8(n),i=r.headers.has(`Content-Type`);i||r.headers.set(`Content-Type`,`application/octet-stream`),t&&!r.headers.has(`Content-Length`)&&r.headers.set(`Content-Length`,t.byteLength.toString());let a=new e(t,r);return i||Object.defineProperty(a,l8,{value:!0,enumerable:!1}),a}static formData(t,n){return new e(t,c8(n))}};function qUe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var JUe=Symbol(`kConnect`),YUe=Symbol(`kAutoConnect`);async function XUe(e){try{return[null,await e().catch(e=>{throw e})]}catch(e){return[e,null]}}var ZUe=async({request:e,requestId:t,handlers:n,resolutionContext:r})=>{let i=null,a=null;for(let o of n)if(a=await o.run({request:e,requestId:t,resolutionContext:r}),a!==null&&(i=o),a?.response)break;return i?{handler:i,parsedResult:a?.parsedResult,response:a?.response}:null};function QUe(e){let t=new URL(e.url);return t.protocol===`file:`||/(fonts\.googleapis\.com)/.test(t.hostname)||/node_modules/.test(t.pathname)||t.pathname.includes(`@vite`)?!0:/\.(s?css|less|m?jsx?|m?tsx?|html|ttf|otf|woff|woff2|eot|gif|jpe?g|png|avif|webp|svg|mp4|webm|ogg|mov|mp3|wav|ogg|flac|aac|pdf|txt|csv|json|xml|md|zip|tar|gz|rar|7z)$/i.test(t.pathname)}async function $Ue(e,t){let n=Reflect.get(t,WUe);n&&await vUe.setCookie(n,e.url)}function eWe(e){let t=[];for(let n of e)n instanceof Promise&&t.push(n);if(t.length>0)return Promise.all(t).then(()=>{})}var d8=(e=>(e[e.DISABLED=0]=`DISABLED`,e[e.ENABLED=1]=`ENABLED`,e))(d8||{});function tWe(e){let t=0,n=new O6,r=e=>e instanceof bBe?e:new xBe(e||[]),i={...e},a=r(i.handlers),o;return{get readyState(){return t},events:n,configure(e){b6(t===0,``),e.handlers&&!Object.is(e.handlers,i.handlers)&&(a=r(e.handlers)),i={...i,...e}},enable(){return b6(t===0,`Failed to call "enable" on the network: already enabled`),o=new AbortController,t=1,eWe(i.sources.map(e=>(e.on(`frame`,async({frame:e})=>{e.events.on(`*`,e=>n.emit(e),{signal:o.signal});let t=e.getHandlers(a);await e.resolve(t,i.onUnhandledFrame||`warn`,i.context)}),e.enable())))},disable(){return b6(t===1,`Failed to call "disable" on the network: already disabled`),o.abort(),t=0,eWe(i.sources.map(e=>e.disable()))},use(...e){a.use(e)},resetHandlers(...e){a.reset(e)},restoreHandlers(){for(let e of a.currentHandlers())`isUsed`in e&&(e.isUsed=!1)},listHandlers(){return SBe(a.currentHandlers())}}}var nWe=class extends D6{frame;constructor(e,t){super(e,{}),this.frame=t}},rWe=class{emitter;constructor(){this.emitter=new O6}async queue(e){await this.emitter.emitAsPromise(new nWe(`frame`,e))}on(e,t,n){this.emitter.on(e,t,n)}disable(){this.emitter.removeAllListeners()}},iWe=class{constructor(e,t){this.protocol=e,this.data=t,this.events=new O6}events};function aWe(e){return!!e.headers.get(`accept`)?.includes(`msw/passthrough`)}function oWe(e){return e.status===302&&e.headers.get(`x-msw-intention`)===`passthrough`}function sWe(e){let t=e.headers.get(`accept`);if(t){let n=t.replace(/(,\s+)?msw\/passthrough/,``);n?e.headers.set(`accept`,n):e.headers.delete(`accept`)}}async function f8(e,t){let n=async t=>{if(t===`bypass`)return;let n=await e.getUnhandledMessage();switch(t){case`warn`:return S6.warn(`Warning: %s`,n);case`error`:return S6.error(`Error: %s`,n)}},r=async e=>{if(b6.as(C6,e===`bypass`||e===`warn`||e===`error`,S6.formatMessage(`Failed to react to an unhandled network frame: unknown strategy "%s". Please provide one of the supported strategies ("bypass", "warn", "error") or a custom callback function as the value of the "onUnhandledRequest" option.`,e)),e!==`bypass`&&(await n(e),e===`error`))return Promise.reject(new C6(S6.formatMessage(`Cannot bypass a request when using the "error" strategy for the "onUnhandledRequest" option.`)))};if(typeof t==`function`)return t({frame:e,defaults:{warn:n.bind(null,`warn`),error:n.bind(null,`error`)}});if(!(e instanceof m8&&QUe(e.data.request)))return r(t)}var p8=class extends D6{requestId;request;constructor(e,t){super(e,{}),this.requestId=t.requestId,this.request=t.request}},cWe=class extends D6{requestId;request;response;constructor(e,t){super(e,{}),this.requestId=t.requestId,this.request=t.request,this.response=t.response}},lWe=class extends D6{error;requestId;request;constructor(e,t){super(e,{}),this.error=t.error,this.requestId=t.requestId,this.request=t.request}},m8=class extends iWe{constructor(e){let t=e.id||kVe();super(`http`,{id:t,request:e.request})}getHandlers(e){return e.getHandlersByKind(`request`)}async getUnhandledMessage(){let{request:e}=this.data,t=new URL(e.url),n=zVe(t)+t.search,r=e.body==null?null:await e.clone().text();return`intercepted a request without a matching request handler:${` - - \u2022 ${e.method} ${n} - -${r?` \u2022 Request body: ${r} - -`:``}`}If you still wish to intercept this unhandled request, please create a request handler for it. -Read more: https://mswjs.io/docs/http/intercepting-requests`}async resolve(e,t,n){let{id:r,request:i}=this.data,a=n?.quiet?null:i.clone();if(this.events.emit(new p8(`request:start`,{requestId:r,request:i})),aWe(i))return this.events.emit(new p8(`request:end`,{requestId:r,request:i})),this.passthrough(),null;let[o,s]=await XUe(()=>ZUe({requestId:r,request:i,handlers:e,resolutionContext:{baseUrl:n?.baseUrl?.toString(),quiet:n?.quiet}}));if(o!=null)return this.events.emit(new lWe(`unhandledException`,{error:o,requestId:r,request:i}))||(console.error(o),S6.error(`Encountered an unhandled exception during the handler lookup for "%s %s". Please see the original error above.`,i.method,i.url)),this.errorWith(o),null;if(s==null)return this.events.emit(new p8(`request:unhandled`,{requestId:r,request:i})),await f8(this,t).then(()=>this.passthrough(),e=>this.errorWith(e)),this.events.emit(new p8(`request:end`,{requestId:r,request:i})),!1;let{response:c,handler:l,parsedResult:u}=s;return this.events.emit(new p8(`request:match`,{requestId:r,request:i})),c==null||oWe(c)?(this.events.emit(new p8(`request:end`,{requestId:r,request:i})),this.passthrough(),null):(await $Ue(i,c),this.respondWith(c.clone()),this.events.emit(new p8(`request:end`,{requestId:r,request:i})),n?.quiet||l.log({request:a,response:c,parsedResult:u}),!0)}},uWe=class extends D6{url;protocols;constructor(e,t){super(e,{}),this.url=t.url,this.protocols=t.protocols}},dWe=class extends D6{url;protocols;error;constructor(e,t){super(e,{}),this.url=t.url,this.protocols=t.protocols,this.error=t.error}},fWe=class extends iWe{constructor(e){super(`ws`,{connection:e.connection})}getHandlers(e){return e.getHandlersByKind(`websocket`)}async resolve(e,t,n){let{connection:r}=this.data;if(this.events.emit(new uWe(`connection`,{url:r.client.url,protocols:r.info.protocols})),e.length===0)return await f8(this,t).then(()=>this.passthrough(),e=>this.errorWith(e)),!1;let i=!1;for(let t of e){let e=await t.run(r,{baseUrl:n?.baseUrl?.toString(),[YUe]:!1});if(!e)continue;i=!0;let a=n?.quiet?void 0:t.log(r);try{t[JUe](e)||a?.()}catch(e){throw this.events.emit(new dWe(`unhandledException`,{error:e,url:r.client.url,protocols:r.info.protocols}))||(console.error(e),S6.error(`Encountered an unhandled exception during the handler lookup for "%s". Please see the original error above.`,r.client.url)),e}}return i?!0:(await f8(this,t).then(()=>this.passthrough(),e=>this.errorWith(e)),!1)}async getUnhandledMessage(){let{connection:e}=this.data;return`intercepted a WebSocket connection without a matching event handler:${` - - \u2022 ${e.client.url} - -`}If you still wish to intercept this unhandled connection, please create an event handler for it. -Read more: https://mswjs.io/docs/websocket`}},pWe=class extends rWe{#e;#t;constructor(e){super(),this.#e=new AVe({name:`interceptor-source`,interceptors:e.interceptors}),this.#t=new Map}enable(){this.#e.apply(),this.#e.on(`request`,this.#n.bind(this)).on(`response`,this.#r.bind(this)).on(`connection`,this.#i.bind(this))}disable(){super.disable(),this.#e.dispose(),this.#t.clear()}async#n({requestId:e,request:t,controller:n}){let r=new mWe({id:e,request:t,controller:n});this.#t.set(e,r),await this.queue(r)}async#r({requestId:e,request:t,response:n,isMockedResponse:r}){let i=this.#t.get(e);this.#t.delete(e),i!=null&&queueMicrotask(()=>{i.events.emit(new cWe(r?`response:mocked`:`response:bypass`,{requestId:e,request:t,response:n}))})}async#i(e){await this.queue(new hWe({connection:e}))}},mWe=class extends m8{#e;constructor(e){super({id:e.id,request:e.request}),this.#e=e.controller}passthrough(){sWe(this.data.request)}respondWith(e){e&&this.#e.respondWith(e)}errorWith(e){if(e instanceof Response)return this.respondWith(e);throw e instanceof C6&&this.#e.errorWith(e),e}},hWe=class extends fWe{constructor(e){super({connection:e.connection})}errorWith(e){if(e instanceof Error){let{client:t}=this.data.connection,n=new Event(`error`);Object.defineProperty(n,`cause`,{enumerable:!0,configurable:!1,value:e}),t.socket.dispatchEvent(n)}}passthrough(){this.data.connection.server.connect()}};function gWe(e){return({frame:t,defaults:n})=>{let r=e();if(r!=null){if(typeof r==`function`){let e=t instanceof m8?t.data.request:t instanceof fWe?new Request(t.data.connection.client.url,{headers:{connection:`upgrade`,upgrade:`websocket`}}):null;return b6(e!=null,'Failed to coerce a network frame to a legacy `onUnhandledRequest` strategy: unknown frame protocol "%s"',t.protocol),r(e,{warning:n.warn,error:n.error})}return f8(t,r)}}}function _We(e){return{status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries())}}var vWe=/(%?)(%([sdijo]))/g;function yWe(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 h8(e,...t){if(t.length===0)return e;let n=0,r=e.replace(vWe,(e,r,i,a)=>{let o=t[n],s=yWe(o,a);return r?e:(n++,s)});return n{if(!e)throw new SWe(t,...n)};g8.as=(e,t,n,...r)=>{if(!t){let t=r.length===0?n:h8(n,...r),i;try{i=Reflect.construct(e,[t])}catch{i=e(t)}throw i}};function _8(){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 CWe=Object.defineProperty,wWe=(e,t)=>{for(var n in t)CWe(e,n,{get:t[n],enumerable:!0})},v8={};wWe(v8,{blue:()=>EWe,gray:()=>y8,green:()=>OWe,red:()=>DWe,yellow:()=>TWe});function TWe(e){return`\x1B[33m${e}\x1B[0m`}function EWe(e){return`\x1B[34m${e}\x1B[0m`}function y8(e){return`\x1B[90m${e}\x1B[0m`}function DWe(e){return`\x1B[31m${e}\x1B[0m`}function OWe(e){return`\x1B[32m${e}\x1B[0m`}var b8=_8(),kWe=class{constructor(e){this.name=e,this.prefix=`[${this.name}]`;let t=PWe(`DEBUG`),n=PWe(`LOG_LEVEL`);t===`1`||t===`true`||t!==void 0&&this.name.startsWith(t)?(this.debug=S8(n,`debug`)?x8:this.debug,this.info=S8(n,`info`)?x8:this.info,this.success=S8(n,`success`)?x8:this.success,this.warning=S8(n,`warning`)?x8:this.warning,this.error=S8(n,`error`)?x8:this.error):(this.info=x8,this.success=x8,this.warning=x8,this.error=x8,this.only=x8)}prefix;extend(e){return new kWe(`${this.name}:${e}`)}debug(e,...t){this.logEntry({level:`debug`,message:y8(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 AWe;return(e,...t)=>{n.measure(),this.logEntry({level:`info`,message:`${e} ${y8(`${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:v8[s],prefix:v8[c]};this.getWriter(t)([l.timestamp(this.formatTimestamp(o.timestamp))].concat(r==null?[]:l.prefix(r),FWe(n)).join(` `),...a.map(FWe))}formatTimestamp(e){return`${e.toLocaleTimeString(`en-GB`)}:${e.getMilliseconds()}`}getWriter(e){switch(e){case`debug`:case`success`:case`info`:return jWe;case`warning`:return MWe;case`error`:return NWe}}},AWe=class{startTime;endTime;deltaTime;constructor(){this.startTime=performance.now()}measure(){this.endTime=performance.now(),this.deltaTime=(this.endTime-this.startTime).toFixed(2)}},x8=()=>void 0;function jWe(e,...t){if(b8){process.stdout.write(h8(e,...t)+` -`);return}console.log(e,...t)}function MWe(e,...t){if(b8){process.stderr.write(h8(e,...t)+` -`);return}console.warn(e,...t)}function NWe(e,...t){if(b8){process.stderr.write(h8(e,...t)+` -`);return}console.error(e,...t)}function PWe(e){return b8?{}[e]:globalThis[e]?.toString()}function S8(e,t){return e!==void 0&&e!==t}function FWe(e){return e===void 0?`undefined`:e===null?`null`:typeof e==`string`?e:typeof e==`object`?JSON.stringify(e):e.toString()}var IWe=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`}},LWe=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=LWe.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 IWe(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)}},RWe=LWe;RWe.defaultMaxListeners=10;var zWe=`x-interceptors-internal-request-id`;function BWe(e){return globalThis[e]||void 0}function VWe(e,t){globalThis[e]=t}function HWe(e){delete globalThis[e]}var C8=(function(e){return e.INACTIVE=`INACTIVE`,e.APPLYING=`APPLYING`,e.APPLIED=`APPLIED`,e.DISPOSING=`DISPOSING`,e.DISPOSED=`DISPOSED`,e})({}),w8=class{constructor(e){this.symbol=e,this.readyState=C8.INACTIVE,this.emitter=new RWe,this.subscriptions=[],this.logger=new kWe(e.description),this.emitter.setMaxListeners(0),this.logger.info(`constructing the interceptor...`)}checkEnvironment(){return!0}apply(){let e=this.logger.extend(`apply`);if(e.info(`applying the interceptor...`),this.readyState===C8.APPLIED){e.info(`intercepted already applied!`);return}if(!this.checkEnvironment()){e.info(`the interceptor cannot be applied in this environment!`);return}this.readyState=C8.APPLYING;let t=this.getInstance();if(t){e.info(`found a running instance, reusing...`),this.on=(n,r)=>(e.info(`proxying the "%s" listener`,n),t.emitter.addListener(n,r),this.subscriptions.push(()=>{t.emitter.removeListener(n,r),e.info(`removed proxied "%s" listener!`,n)}),this),this.readyState=C8.APPLIED;return}e.info(`no running instance found, setting up a new instance...`),this.setup(),this.setInstance(),this.readyState=C8.APPLIED}setup(){}on(e,t){let n=this.logger.extend(`on`);return this.readyState===C8.DISPOSING||this.readyState===C8.DISPOSED?(n.info(`cannot listen to events, already disposed!`),this):(n.info(`adding "%s" event listener:`,e,t),this.emitter.on(e,t),this)}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}removeAllListeners(e){return this.emitter.removeAllListeners(e),this}dispose(){let e=this.logger.extend(`dispose`);if(this.readyState===C8.DISPOSED){e.info(`cannot dispose, already disposed!`);return}if(e.info(`disposing the interceptor...`),this.readyState=C8.DISPOSING,!this.getInstance()){e.info(`no interceptors running, skipping dispose...`);return}if(this.clearInstance(),e.info(`global symbol deleted:`,BWe(this.symbol)),this.subscriptions.length>0){e.info(`disposing of %d subscriptions...`,this.subscriptions.length);for(let e of this.subscriptions)e();this.subscriptions=[],e.info(`disposed of all subscriptions!`,this.subscriptions.length)}this.emitter.removeAllListeners(),e.info(`destroyed the listener!`),this.readyState=C8.DISPOSED}getInstance(){let e=BWe(this.symbol);return this.logger.info(`retrieved global instance:`,e?.constructor?.name),e}setInstance(){VWe(this.symbol,this),this.logger.info(`set global instance!`,this.symbol.description)}clearInstance(){HWe(this.symbol),this.logger.info(`cleared global instance!`,this.symbol.description)}};function T8(){return Math.random().toString(16).slice(2)}function UWe(e){if(typeof e==`string`)return UWe(new URL(e,typeof location<`u`?location.href:void 0));if(e.protocol===`http:`?e.protocol=`ws:`:e.protocol===`https:`&&(e.protocol=`wss:`),e.protocol!==`ws:`&&e.protocol!==`wss:`)throw SyntaxError(`Failed to construct 'WebSocket': The URL's scheme must be either 'http', 'https', 'ws', or 'wss'. '${e.protocol}' is not allowed.`);if(e.hash!==``)throw SyntaxError(`Failed to construct 'WebSocket': The URL contains a fragment identifier ('${e.hash}'). Fragment identifiers are not allowed in WebSocket URLs.`);return e.href}async function E8(e,t,...n){let r=e.listeners(t);if(r.length!==0)for(let t of r)await t.apply(e,n)}function D8(e){let t=Object.getOwnPropertyDescriptor(globalThis,e);return t===void 0||typeof t.get==`function`&&t.get()===void 0||t.get===void 0&&t.value==null?!1:t.set===void 0&&!t.configurable?(console.error(`[MSW] Failed to apply interceptor: the global \`${e}\` property is non-configurable. This is likely an issue with your environment. If you are using a framework, please open an issue about this in their repository.`),!1):!0}function WWe(){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 O8=class extends Promise{#e;resolve;reject;constructor(e=null){let t=WWe();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}})}};function k8(e,t){return Object.defineProperties(t,{target:{value:e,enumerable:!0,writable:!0},currentTarget:{value:e,enumerable:!0,writable:!0}}),t}var A8=Symbol(`kCancelable`),j8=Symbol(`kDefaultPrevented`),M8=class extends MessageEvent{constructor(e,t){super(e,t),this[A8]=!!t.cancelable,this[j8]=!1}get cancelable(){return this[A8]}set cancelable(e){this[A8]=e}get defaultPrevented(){return this[j8]}set defaultPrevented(e){this[j8]=e}preventDefault(){this.cancelable&&!this[j8]&&(this[j8]=!0)}},N8=class extends Event{constructor(e,t={}){super(e,t),this.code=t.code===void 0?0:t.code,this.reason=t.reason===void 0?``:t.reason,this.wasClean=t.wasClean===void 0?!1:t.wasClean}},GWe=class extends N8{constructor(e,t={}){super(e,t),this[A8]=!!t.cancelable,this[j8]=!1}get cancelable(){return this[A8]}set cancelable(e){this[A8]=e}get defaultPrevented(){return this[j8]}set defaultPrevented(e){this[j8]=e}preventDefault(){this.cancelable&&!this[j8]&&(this[j8]=!0)}},P8=Symbol(`kEmitter`),F8=Symbol(`kBoundListener`),KWe=class{constructor(e,t){this.socket=e,this.transport=t,this.id=T8(),this.url=new URL(e.url),this[P8]=new EventTarget,this.transport.addEventListener(`outgoing`,e=>{let t=k8(this.socket,new M8(`message`,{data:e.data,origin:e.origin,cancelable:!0}));this[P8].dispatchEvent(t),t.defaultPrevented&&e.preventDefault()}),this.transport.addEventListener(`close`,e=>{this[P8].dispatchEvent(k8(this.socket,new N8(`close`,e)))})}addEventListener(e,t,n){if(!Reflect.has(t,F8)){let e=t.bind(this.socket);Object.defineProperty(t,F8,{value:e,enumerable:!1,configurable:!1})}this[P8].addEventListener(e,Reflect.get(t,F8),n)}removeEventListener(e,t,n){this[P8].removeEventListener(e,Reflect.get(t,F8),n)}send(e){this.transport.send(e)}close(e,t){this.transport.close(e,t)}},qWe=`InvalidAccessError: close code out of user configurable range`,I8=Symbol(`kPassthroughPromise`),JWe=Symbol(`kOnSend`),L8=Symbol(`kClose`),YWe=class extends EventTarget{static{this.CONNECTING=0}static{this.OPEN=1}static{this.CLOSING=2}static{this.CLOSED=3}constructor(e,t){super(),this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,this._onopen=null,this._onmessage=null,this._onerror=null,this._onclose=null,this.url=UWe(e),this.protocol=``,this.extensions=``,this.binaryType=`blob`,this.readyState=this.CONNECTING,this.bufferedAmount=0,this[I8]=new O8,queueMicrotask(async()=>{await this[I8]||(this.protocol=typeof t==`string`?t:Array.isArray(t)&&t.length>0?t[0]:``,this.readyState===this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent(k8(this,new Event(`open`)))))})}set onopen(e){this.removeEventListener(`open`,this._onopen),this._onopen=e,e!==null&&this.addEventListener(`open`,e)}get onopen(){return this._onopen}set onmessage(e){this.removeEventListener(`message`,this._onmessage),this._onmessage=e,e!==null&&this.addEventListener(`message`,e)}get onmessage(){return this._onmessage}set onerror(e){this.removeEventListener(`error`,this._onerror),this._onerror=e,e!==null&&this.addEventListener(`error`,e)}get onerror(){return this._onerror}set onclose(e){this.removeEventListener(`close`,this._onclose),this._onclose=e,e!==null&&this.addEventListener(`close`,e)}get onclose(){return this._onclose}send(e){if(this.readyState===this.CONNECTING)throw this.close(),new DOMException(`InvalidStateError`);this.readyState===this.CLOSING||this.readyState===this.CLOSED||(this.bufferedAmount+=XWe(e),queueMicrotask(()=>{this.bufferedAmount=0,this[JWe]?.(e)}))}close(e=1e3,t){g8(e,qWe),g8(e===1e3||e>=3e3&&e<=4999,qWe),this[L8](e,t)}[L8](e=1e3,t,n=!0){this.readyState===this.CLOSING||this.readyState===this.CLOSED||(this.readyState=this.CLOSING,queueMicrotask(()=>{this.readyState=this.CLOSED,this.dispatchEvent(k8(this,new N8(`close`,{code:e,reason:t,wasClean:n}))),this._onopen=null,this._onmessage=null,this._onerror=null,this._onclose=null}))}addEventListener(e,t,n){return super.addEventListener(e,t,n)}removeEventListener(e,t,n){return super.removeEventListener(e,t,n)}};function XWe(e){return typeof e==`string`?e.length:e instanceof Blob?e.size:e.byteLength}var R8=Symbol(`kEmitter`),z8=Symbol(`kBoundListener`),B8=Symbol(`kSend`),ZWe=class{constructor(e,t,n){this.client=e,this.transport=t,this.createConnection=n,this[R8]=new EventTarget,this.mockCloseController=new AbortController,this.realCloseController=new AbortController,this.transport.addEventListener(`outgoing`,e=>{this.realWebSocket!==void 0&&queueMicrotask(()=>{e.defaultPrevented||this[B8](e.data)})}),this.transport.addEventListener(`incoming`,this.handleIncomingMessage.bind(this))}get socket(){return g8(this.realWebSocket,'Cannot access "socket" on the original WebSocket server object: the connection is not open. Did you forget to call `server.connect()`?'),this.realWebSocket}connect(){g8(!this.realWebSocket||this.realWebSocket.readyState!==WebSocket.OPEN,`Failed to call "connect()" on the original WebSocket instance: the connection already open`);let e=this.createConnection();e.binaryType=this.client.binaryType,e.addEventListener(`open`,e=>{this[R8].dispatchEvent(k8(this.realWebSocket,new Event(`open`,e)))},{once:!0}),e.addEventListener(`message`,e=>{this.transport.dispatchEvent(k8(this.realWebSocket,new MessageEvent(`incoming`,{data:e.data,origin:e.origin})))}),this.client.addEventListener(`close`,e=>{this.handleMockClose(e)},{signal:this.mockCloseController.signal}),e.addEventListener(`close`,e=>{this.handleRealClose(e)},{signal:this.realCloseController.signal}),e.addEventListener(`error`,()=>{let t=k8(e,new Event(`error`,{cancelable:!0}));this[R8].dispatchEvent(t),t.defaultPrevented||this.client.dispatchEvent(k8(this.client,new Event(`error`)))}),this.realWebSocket=e}addEventListener(e,t,n){if(!Reflect.has(t,z8)){let e=t.bind(this.client);Object.defineProperty(t,z8,{value:e,enumerable:!1})}this[R8].addEventListener(e,Reflect.get(t,z8),n)}removeEventListener(e,t,n){this[R8].removeEventListener(e,Reflect.get(t,z8),n)}send(e){this[B8](e)}[B8](e){let{realWebSocket:t}=this;if(g8(t,`Failed to call "server.send()" for "%s": the connection is not open. Did you forget to call "server.connect()"?`,this.client.url),!(t.readyState===WebSocket.CLOSING||t.readyState===WebSocket.CLOSED)){if(t.readyState===WebSocket.CONNECTING){t.addEventListener(`open`,()=>{t.send(e)},{once:!0});return}t.send(e)}}close(){let{realWebSocket:e}=this;g8(e,`Failed to close server connection for "%s": the connection is not open. Did you forget to call "server.connect()"?`,this.client.url),this.realCloseController.abort(),!(e.readyState===WebSocket.CLOSING||e.readyState===WebSocket.CLOSED)&&(e.close(),queueMicrotask(()=>{this[R8].dispatchEvent(k8(this.realWebSocket,new GWe(`close`,{code:1e3,cancelable:!0})))}))}handleIncomingMessage(e){let t=k8(e.target,new M8(`message`,{data:e.data,origin:e.origin,cancelable:!0}));this[R8].dispatchEvent(t),t.defaultPrevented||this.client.dispatchEvent(k8(this.client,new MessageEvent(`message`,{data:e.data,origin:e.origin})))}handleMockClose(e){this.realWebSocket&&this.realWebSocket.close()}handleRealClose(e){this.mockCloseController.abort();let t=k8(this.realWebSocket,new GWe(`close`,{code:e.code,reason:e.reason,wasClean:e.wasClean,cancelable:!0}));this[R8].dispatchEvent(t),t.defaultPrevented||this.client[L8](e.code,e.reason)}},QWe=class extends EventTarget{constructor(e){super(),this.socket=e,this.socket.addEventListener(`close`,e=>{this.dispatchEvent(k8(this.socket,new N8(`close`,e)))}),this.socket[JWe]=e=>{this.dispatchEvent(k8(this.socket,new M8(`outgoing`,{data:e,origin:this.socket.url,cancelable:!0})))}}addEventListener(e,t,n){return super.addEventListener(e,t,n)}dispatchEvent(e){return super.dispatchEvent(e)}send(e){queueMicrotask(()=>{if(this.socket.readyState===this.socket.CLOSING||this.socket.readyState===this.socket.CLOSED)return;let t=()=>{this.socket.dispatchEvent(k8(this.socket,new MessageEvent(`message`,{data:e,origin:this.socket.url})))};this.socket.readyState===this.socket.CONNECTING?this.socket.addEventListener(`open`,()=>{t()},{once:!0}):t()})}close(e,t){this.socket[L8](e,t)}},$We=class e extends w8{static{this.symbol=Symbol(`websocket`)}constructor(){super(e.symbol)}checkEnvironment(){return D8(`WebSocket`)}setup(){let e=Object.getOwnPropertyDescriptor(globalThis,`WebSocket`),t=new Proxy(globalThis.WebSocket,{construct:(e,t,n)=>{let[r,i]=t,a=()=>Reflect.construct(e,t,n),o=new YWe(r,i),s=new QWe(o);return queueMicrotask(async()=>{try{let e=new ZWe(o,s,a),t=this.emitter.listenerCount(`connection`)>0;await E8(this.emitter,`connection`,{client:new KWe(o,s),server:e,info:{protocols:i}}),t?o[I8].resolve(!1):(o[I8].resolve(!0),e.connect(),e.addEventListener(`open`,()=>{o.dispatchEvent(k8(o,new Event(`open`))),e.realWebSocket&&(o.protocol=e.realWebSocket.protocol)}))}catch(e){e instanceof Error&&(o.dispatchEvent(new Event(`error`)),o.readyState!==WebSocket.CLOSING&&o.readyState!==WebSocket.CLOSED&&o[L8](1011,e.message,!1),console.error(e))}}),o}});Object.defineProperty(globalThis,`WebSocket`,{value:t,configurable:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis,`WebSocket`,e)})}};function V8(){return typeof navigator<`u`&&`serviceWorker`in navigator&&typeof location<`u`&&location.protocol!==`file:`}function eGe(){try{let e=new ReadableStream({start:e=>e.close()});return new MessageChannel().port1.postMessage(e,[e]),!0}catch{return!1}}var H8=Symbol(`isPatchedModule`),U8=class e extends Error{constructor(t){super(t),this.name=`InterceptorError`,Object.setPrototypeOf(this,e.prototype)}},W8=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 O8}get#e(){return this.handled}async passthrough(){g8.as(U8,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){g8.as(U8,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){g8.as(U8,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 tGe(e){try{return new URL(e),!0}catch{return!1}}function nGe(e,t){let n=Object.getOwnPropertySymbols(t).find(t=>t.description===e);if(n)return Reflect.get(t,n)}var G8=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:`||!tGe(e))return;let n=nGe(`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{throw e})]}catch(e){return[e,null]}}function uGe(e){return new URL(e,location.href).href}function K8(e,t,n){return[e.active,e.installing,e.waiting].filter(e=>e!=null).find(e=>n(e.scriptURL,t))||null}var dGe=async(e,t={},n)=>{let r=uGe(e),i=await navigator.serviceWorker.getRegistrations().then(e=>e.filter(e=>K8(e,r,n)));!navigator.serviceWorker.controller&&i.length>0&&location.reload();let[a]=i;if(a)return a.update(),[K8(a,r,n),a];let[o,s]=await lGe(async()=>{let i=await navigator.serviceWorker.register(e,t);return[K8(i,r,n),i]});if(o){if(o.message.includes(`(404)`)){let e=new URL(t?.scope||`/`,location.href);throw Error(S6.formatMessage(`Failed to register a Service Worker for scope ('${e.href}') with script ('${r}'): Service Worker script does not exist at the given path. - -Did you forget to run "npx msw init "? - -Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init`))}throw Error(S6.formatMessage(`Failed to register the Service Worker: - -%s`,o.message))}return s},fGe=class{#e;#t;constructor(){this.#e=[],this.#t=new Map}get[Symbol.iterator](){return this.#e[Symbol.iterator].bind(this.#e)}entries(){return this.#t.entries()}get(e){return this.#t.get(e)||[]}getAll(){return this.#e.map(([,e])=>e)}append(e,t){this.#e.push([e,t]),this.#n(e,e=>e.push(t))}prepend(e,t){this.#e.unshift([e,t]),this.#n(e,e=>e.unshift(t))}delete(e,t){if(this.size===0)return;this.#e=this.#e.filter(e=>e[1]!==t);let n=this.#t.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}deleteAll(e){this.size!==0&&(this.#e=this.#e.filter(t=>t[0]!==e),this.#t.delete(e))}get size(){return this.#e.length}clear(){this.size!==0&&(this.#e.length=0,this.#t.clear())}#n(e,t){t(this.#t.get(e)||this.#t.set(e,[]).get(e))}},q8=Symbol(`kDefaultPrevented`),J8=Symbol(`kPropagationStopped`),Y8=Symbol(`kImmediatePropagationStopped`),pGe=class extends MessageEvent{[q8];[J8];[Y8];constructor(...e){super(e[0],e[1]),this[q8]=!1}get defaultPrevented(){return this[q8]}preventDefault(){super.preventDefault(),this[q8]=!0}stopImmediatePropagation(){super.stopImmediatePropagation(),this[Y8]=!0}},mGe=class{#e;#t;#n;#r;#i;hooks;constructor(){this.#e=new fGe,this.#t=new WeakMap,this.#n=new WeakSet,this.#r=new fGe,this.#i=new WeakMap,this.hooks={on:(e,t,n)=>{if(n?.once){let n=t,r=((...t)=>(this.#r.delete(e,r),n(...t)));t=r}this.#r.append(e,t),n&&this.#i.set(t,n),n?.signal&&n.signal.addEventListener(`abort`,()=>{this.#r.delete(e,t)},{once:!0})},removeListener:(e,t)=>{this.#r.delete(e,t)}}}on(e,t,n){return this.#a(e,t,n),this}once(e,t,n){return this.on(e,t,{...n||{},once:!0})}earlyOn(e,t,n){return this.#a(e,t,n,`prepend`),this}earlyOnce(e,t,n){return this.earlyOn(e,t,{...n||{},once:!0})}emit(e){if(this.#e.size===0)return!1;let t=this.listenerCount(e.type)>0,n=this.#o(e);for(let t of this.#c(e.type)){if(n.event[J8]!=null&&n.event[J8]!==this)return n.revoke(),!1;if(n.event[Y8])break;this.#s(n.event,t)}return n.revoke(),t}async emitAsPromise(e){if(this.#e.size===0)return[];let t=[],n=this.#o(e);for(let r of this.#c(e.type)){if(n.event[J8]!=null&&n.event[J8]!==this)return n.revoke(),[];if(n.event[Y8])break;let e=await Promise.resolve(this.#s(n.event,r));this.#l(r)||t.push(e)}return n.revoke(),Promise.allSettled(t).then(e=>e.map(e=>e.status===`fulfilled`?e.value:e.reason))}*emitAsGenerator(e){if(this.#e.size===0)return;let t=this.#o(e);for(let n of this.#c(e.type)){if(t.event[J8]!=null&&t.event[J8]!==this){t.revoke();return}if(t.event[Y8])break;let e=this.#s(t.event,n);this.#l(n)||(yield e)}t.revoke()}removeListener(e,t){let n=this.#t.get(t);this.#e.delete(e,t);for(let r of this.#r.get(`removeListener`))r(e,t,n)}removeAllListeners(e){if(e==null){this.#e.clear();for(let[e,t]of this.#r)this.#i.get(t)?.persist||this.#r.delete(e,t);return}this.#e.deleteAll(e)}listeners(e){return e==null?this.#e.getAll():this.#e.get(e)}listenerCount(e){return e==null?this.#e.size:this.listeners(e).length}#a(e,t,n,r=`append`){for(let r of this.#r.get(`newListener`))r(e,t,n);e===`*`&&this.#n.add(t),r===`prepend`?this.#e.prepend(e,t):this.#e.append(e,t),n&&(this.#t.set(t,n),n.signal&&n.signal.addEventListener(`abort`,()=>{this.removeListener(e,t)},{once:!0}))}#o(e){let{stopPropagation:t}=e;return e.stopPropagation=()=>{e[J8]=this,t.call(e)},{event:e,revoke(){e.stopPropagation=t}}}#s(e,t){for(let t of this.#r.get(`beforeEmit`))if(t(e)===!1)return;let n=t.call(this,e),r=this.#t.get(t);if(r?.once){let n=this.#l(t)?`*`:e.type;this.#e.delete(n,t);for(let e of this.#r.get(`removeListener`))e(n,t,r)}return n}*#c(e){for(let[t,n]of this.#e)(t===`*`||t===e)&&(yield n)}#l(e){return this.#n.has(e)}},hGe=V8(),gGe=class extends pGe{#e;constructor(e){let t=e.data.type,n=e.data.payload;super(t,{data:n}),this.#e=e}get ports(){return this.#e.ports}postMessage(e,...t){this.#e.ports[0].postMessage({type:e,data:t[0]},{transfer:t[1]})}},_Ge=class extends mGe{constructor(e){super(),this.options=e,hGe&&navigator.serviceWorker.addEventListener(`message`,async e=>{let t=await this.options.worker;e.source!=null&&e.source!==t||e.data&&qUe(e.data)&&`type`in e.data&&this.emit(new gGe(e))})}postMessage(e){g8(hGe,`Failed to post message on a WorkerChannel: the Service Worker API is unavailable in this context. This is likely an issue with MSW. Please report it on GitHub: https://github.com/mswjs/msw/issues`),this.options.worker.then(t=>{t.postMessage(e)})}};function vGe(e){if(![`HEAD`,`GET`].includes(e.method))return e.body}function yGe(e){return new Request(e.url,{...e,body:vGe(e)})}function bGe(e){location.href.startsWith(e.scope)||S6.warn(`Cannot intercept requests on this page because it's outside of the worker's scope ("${e.scope}"). If you wish to mock API requests on this page, you must resolve this scope issue. - -- (Recommended) Register the worker at the root level ("/") of your application. -- Set the "Service-Worker-Allowed" response header to allow out-of-scope workers.`)}var xGe=class extends rWe{constructor(e){super(),this.options=e,g8(V8(),`Failed to use Service Worker as the network source: the Service Worker API is not supported in this environment`),this.#e=new Map,this.workerPromise=new O8,this.#t=new _Ge({worker:this.workerPromise.then(([e])=>e)})}#e;#t;#n;#r;#i;workerPromise;async enable(){if(this.#i=void 0,this.workerPromise.state!==`pending`)return S6.warn(`Found a redundant "worker.start()" call. Note that starting the worker while mocking is already enabled will have no effect. Consider removing this "worker.start()" call.`),this.workerPromise.then(([,e])=>e);this.#t.removeAllListeners();let[e,t]=await this.#a();if(e.state!==`activated`){let t=new AbortController,n=new O8;n.then(()=>t.abort()),e.addEventListener(`statechange`,()=>{e.state===`activated`&&n.resolve()},{signal:t.signal}),await n}this.#t.postMessage(`MOCK_ACTIVATE`);let n=new O8;return this.#n=n,this.#t.once(`MOCKING_ENABLED`,e=>{n.resolve(e.data.client)}),await n,this.options.quiet||this.#u(),t}disable(){if(this.#i!==void 0){S6.warn(`Found a redundant "worker.stop()" call. Notice that stopping the worker after it has already been stopped has no effect. Consider removing this "worker.stop()" call.`);return}this.#i=Date.now(),this.#e.clear(),this.workerPromise=new O8,this.options.quiet||this.#d()}async#a(){this.#r&&clearInterval(this.#r);let e=this.options.serviceWorker.url,[t,n]=await dGe(e,this.options.serviceWorker.options,this.options.findWorker||this.#c);if(t==null){let t=this.options?.findWorker?S6.formatMessage(`Failed to locate the Service Worker registration using a custom "findWorker" predicate. - -Please ensure that the custom predicate properly locates the Service Worker registration at "%s". -More details: https://mswjs.io/docs/api/setup-worker/start#findworker - `,e):S6.formatMessage(`Failed to locate the Service Worker registration. - -This most likely means that the worker script URL "%s" cannot resolve against the actual public hostname (%s). This may happen if your application runs behind a proxy, or has a dynamic hostname. - -Please consider using a custom "serviceWorker.url" option to point to the actual worker script location, or a custom "findWorker" option to resolve the Service Worker registration manually. More details: https://mswjs.io/docs/api/setup-worker/start`,e,location.host);throw Error(t)}return this.workerPromise.resolve([t,n]),this.#t.on(`REQUEST`,this.#o.bind(this)),this.#t.on(`RESPONSE`,this.#s.bind(this)),window.addEventListener(`beforeunload`,()=>{t.state!==`redundant`&&this.#t.postMessage(`CLIENT_CLOSED`),clearInterval(this.#r),window.postMessage({type:`msw/worker:stop`})}),await this.#l().catch(e=>{S6.error(`Error while checking the worker script integrity. Please report this on GitHub (https://github.com/mswjs/msw/issues) and include the original error below.`),console.error(e)}),this.#r=window.setInterval(()=>{this.#t.postMessage(`KEEPALIVE_REQUEST`)},5e3),this.options.quiet||bGe(n),[t,n]}async#o(e){if(this.#i&&e.data.interceptedAt>this.#i)return e.postMessage(`PASSTHROUGH`);let t=yGe(e.data);DBe.cache.set(t,t.clone());let n=new SGe({event:e,request:t});this.#e.set(e.data.id,n),await this.queue(n)}async#s(e){let{request:t,response:n,isMockedResponse:r}=e.data;if(n.type?.includes(`opaque`)){this.#e.delete(t.id);return}let i=this.#e.get(t.id);if(this.#e.delete(t.id),i==null)return;let a=yGe(t),o=n.status===0?Response.error():new G8(G8.isResponseWithBody(n.status)?n.body:null,{...n,url:t.url});i.events.emit(new cWe(r?`response:mocked`:`response:bypass`,{requestId:i.data.id,request:a,response:o,isMockedResponse:r}))}#c=(e,t)=>e===t;async#l(){let e=new O8;return this.#t.postMessage(`INTEGRITY_CHECK_REQUEST`),this.#t.once(`INTEGRITY_CHECK_RESPONSE`,t=>{let{checksum:n,packageVersion:r}=t.data;n!==`4db4a41e972cec1b64cc569c66952d82`&&S6.warn(`The currently registered Service Worker has been generated by a different version of MSW (${r}) and may not be fully compatible with the installed version. - -It's recommended you update your worker script by running this command: - - \u2022 npx msw init - -You can also automate this process and make the worker script update automatically upon the library installations. Read more: https://mswjs.io/docs/cli/init.`),e.resolve()}),e}async#u(){if(this.workerPromise.state===`rejected`)return;g8(this.#n!=null,`[ServiceWorkerSource] Failed to print a start message: client confirmation not received`);let e=await this.#n,[t,n]=await this.workerPromise;console.groupCollapsed(`%c${S6.formatMessage(`Mocking enabled.`)}`,`color:orangered;font-weight:bold;`),console.log(`%cDocumentation: %chttps://mswjs.io/docs`,`font-weight:bold`,`font-weight:normal`),console.log(`Found an issue? https://github.com/mswjs/msw/issues`),console.log(`Worker script URL:`,t.scriptURL),console.log(`Worker scope:`,n.scope),e&&console.log(`Client ID: %s (%s)`,e.id,e.frameType),console.groupEnd()}#d(){console.log(`%c${S6.formatMessage(`Mocking disabled.`)}`,`color:orangered;font-weight:bold;`)}},SGe=class extends m8{#e;constructor(e){super({request:e.request}),this.#e=e.event}passthrough(){this.#e.postMessage(`PASSTHROUGH`)}respondWith(e){e&&this.#t(e)}errorWith(e){if(e instanceof Response)return this.respondWith(e);S6.warn(`Uncaught exception in the request handler for "%s %s". This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/http/mocking-responses/error-responses`,this.data.request.method,this.data.request.url);let t=e instanceof Error?e:Error(e?.toString()||`Request failure`);this.respondWith(u8.json({name:t.name,message:t.message,stack:t.stack},{status:500,statusText:`Request Handler Error`}))}async#t(e){let t,n,r=_We(e);eGe()?(t=e.body,n=e.body==null?void 0:[e.body]):t=e.body==null?null:await e.clone().arrayBuffer(),this.#e.postMessage(`MOCK_RESPONSE`,{...r,body:t},n)}},CGe=async e=>{try{return{error:null,data:await e().catch(e=>{throw e})}}catch(e){return{error:e,data:null}}};function wGe(e,t=!1){return t?Object.prototype.toString.call(e).startsWith(`[object `):Object.prototype.toString.call(e)===`[object Object]`}function X8(e,t){try{return e[t],!0}catch{return!1}}function TGe(e){return new Response(JSON.stringify(e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:e),{status:500,statusText:`Unhandled Exception`,headers:{"Content-Type":`application/json`}})}function Z8(e){return e!=null&&e instanceof Response&&X8(e,`type`)&&e.type===`error`}function EGe(e){return wGe(e,!0)&&X8(e,`status`)&&X8(e,`statusText`)&&X8(e,`bodyUsed`)}function DGe(e){return e==null||!(e instanceof Error)?!1:`code`in e&&`errno`in e}async function OGe(e){let t=async t=>t instanceof Error?(await e.controller.errorWith(t),!0):Z8(t)||EGe(t)?(await e.controller.respondWith(t),!0):wGe(t)?(await e.controller.errorWith(t),!0):!1,n=async n=>{if(n instanceof U8)throw i.error;return DGe(n)?(await e.controller.errorWith(n),!0):n instanceof Response?await t(n):!1},r=new O8;if(e.request.signal){if(e.request.signal.aborted){await e.controller.errorWith(e.request.signal.reason);return}e.request.signal.addEventListener(`abort`,()=>{r.reject(e.request.signal.reason)},{once:!0})}let i=await CGe(async()=>{let t=E8(e.emitter,`request`,{requestId:e.requestId,request:e.request,controller:e.controller});await Promise.race([r,t,e.controller.handled])});if(r.state===`rejected`){await e.controller.errorWith(r.rejectionReason);return}if(i.error){if(await n(i.error))return;if(e.emitter.listenerCount(`unhandledException`)>0){let n=new W8(e.request,{passthrough(){},async respondWith(e){await t(e)},async errorWith(t){await e.controller.errorWith(t)}});if(await E8(e.emitter,`unhandledException`,{error:i.error,request:e.request,requestId:e.requestId,controller:n}),n.readyState!==W8.PENDING)return}await e.controller.respondWith(TGe(i.error));return}return e.controller.readyState===W8.PENDING?await e.controller.passthrough():e.controller.handled}function Q8(e){return Object.assign(TypeError(`Failed to fetch`),{cause:e})}var kGe=[`content-encoding`,`content-language`,`content-location`,`content-type`,`content-length`],$8=Symbol(`kRedirectCount`);async function AGe(e,t){if(t.status!==303&&e.body!=null)return Promise.reject(Q8());let n=new URL(e.url),r;try{r=new URL(t.headers.get(`location`),e.url)}catch(e){return Promise.reject(Q8(e))}if(!(r.protocol===`http:`||r.protocol===`https:`))return Promise.reject(Q8(`URL scheme must be a HTTP(S) scheme`));if(Reflect.get(e,$8)>20)return Promise.reject(Q8(`redirect count exceeded`));if(Object.defineProperty(e,$8,{value:(Reflect.get(e,$8)||0)+1}),e.mode===`cors`&&(r.username||r.password)&&!jGe(n,r))return Promise.reject(Q8(`cross origin not allowed for request mode "cors"`));let i={};([301,302].includes(t.status)&&e.method===`POST`||t.status===303&&![`HEAD`,`GET`].includes(e.method))&&(i.method=`GET`,i.body=null,kGe.forEach(t=>{e.headers.delete(t)})),jGe(n,r)||(e.headers.delete(`authorization`),e.headers.delete(`proxy-authorization`),e.headers.delete(`cookie`),e.headers.delete(`host`)),i.headers=e.headers;let a=await fetch(new Request(r,i));return Object.defineProperty(a,`redirected`,{value:!0,configurable:!0}),a}function jGe(e,t){return e.origin===t.origin&&e.origin===`null`||e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port}var MGe=class extends TransformStream{constructor(){console.warn(`[Interceptors]: Brotli decompression of response streams is not supported in the browser`),super({transform(e,t){t.enqueue(e)}})}},NGe=class extends TransformStream{constructor(e,...t){super({},...t);let n=[super.readable,...e].reduce((e,t)=>e.pipeThrough(t));Object.defineProperty(this,`readable`,{get(){return n}})}};function PGe(e){return e.toLowerCase().split(`,`).map(e=>e.trim())}function FGe(e){if(e===``)return null;let t=PGe(e);return t.length===0?null:new NGe(t.reduceRight((e,t)=>t===`gzip`||t===`x-gzip`?e.concat(new DecompressionStream(`gzip`)):t===`deflate`?e.concat(new DecompressionStream(`deflate`)):t===`br`?e.concat(new MGe):(e.length=0,e),[]))}function IGe(e){if(e.body===null)return null;let t=FGe(e.headers.get(`content-encoding`)||``);return t?(e.body.pipeTo(t.writable),t.readable):null}var LGe=class e extends w8{static{this.symbol=Symbol(`fetch`)}constructor(){super(e.symbol)}checkEnvironment(){return D8(`fetch`)}async setup(){let e=globalThis.fetch;g8(!e[H8],`Failed to patch the "fetch" module: already patched.`),globalThis.fetch=async(t,n)=>{let r=T8(),i=typeof t==`string`&&typeof location<`u`&&!tGe(t)?new URL(t,location.href):t,a=new Request(i,n);t instanceof Request&&iGe(a,t);let o=new O8,s=new W8(a,{passthrough:async()=>{this.logger.info(`request has not been handled, passthrough...`);let t=a.clone(),{error:n,data:i}=await CGe(()=>e(a));if(n)return o.reject(n);if(this.logger.info(`original fetch performed`,i),this.emitter.listenerCount(`response`)>0){this.logger.info(`emitting the "response" event...`);let e=i.clone();await E8(this.emitter,`response`,{response:e,isMockedResponse:!1,request:t,requestId:r})}o.resolve(i)},respondWith:async e=>{if(Z8(e)){this.logger.info(`request has errored!`,{response:e}),o.reject(Q8(e));return}this.logger.info(`received mocked response!`,{rawResponse:e});let t=IGe(e),n=t===null?e:new G8(t,e);if(G8.setUrl(a.url,n),G8.isRedirectResponse(n.status)){if(a.redirect===`error`){o.reject(Q8(`unexpected redirect`));return}if(a.redirect===`follow`){AGe(a,n).then(e=>{o.resolve(e)},e=>{o.reject(e)});return}}this.emitter.listenerCount(`response`)>0&&(this.logger.info(`emitting the "response" event...`),await E8(this.emitter,`response`,{response:n.clone(),isMockedResponse:!0,request:a,requestId:r})),o.resolve(n)},errorWith:e=>{this.logger.info(`request has been aborted!`,{reason:e}),o.reject(e)}});return this.logger.info(`[%s] %s`,a.method,a.url),this.logger.info(`awaiting for the mocked response...`),this.logger.info(`emitting the "request" event for %s listener(s)...`,this.emitter.listenerCount(`request`)),await OGe({request:a,requestId:r,emitter:this.emitter,controller:s}),o},Object.defineProperty(globalThis.fetch,H8,{enumerable:!0,configurable:!0,value:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis.fetch,H8,{value:void 0}),globalThis.fetch=e,this.logger.info(`restored native "globalThis.fetch"!`,globalThis.fetch.name)})}};function RGe(e,t){let n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}var zGe=class{constructor(e,t){this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.type=``,this.srcElement=null,this.currentTarget=null,this.eventPhase=0,this.isTrusted=!0,this.composed=!1,this.cancelable=!0,this.defaultPrevented=!1,this.bubbles=!0,this.lengthComputable=!0,this.loaded=0,this.total=0,this.cancelBubble=!1,this.returnValue=!0,this.type=e,this.target=t?.target||null,this.currentTarget=t?.currentTarget||null,this.timeStamp=Date.now()}composedPath(){return[]}initEvent(e,t,n){this.type=e,this.bubbles=!!t,this.cancelable=!!n}preventDefault(){this.defaultPrevented=!0}stopPropagation(){}stopImmediatePropagation(){}},BGe=class extends zGe{constructor(e,t){super(e),this.lengthComputable=t?.lengthComputable||!1,this.composed=t?.composed||!1,this.loaded=t?.loaded||0,this.total=t?.total||0}},VGe=typeof ProgressEvent<`u`;function HGe(e,t,n){let r=[`error`,`progress`,`loadstart`,`loadend`,`load`,`timeout`,`abort`],i=VGe?ProgressEvent:BGe;return r.includes(t)?new i(t,{lengthComputable:!0,loaded:n?.loaded||0,total:n?.total||0}):new zGe(t,{target:e,currentTarget:e})}function UGe(e,t){if(!(t in e))return null;if(Object.prototype.hasOwnProperty.call(e,t))return e;let n=Reflect.getPrototypeOf(e);return n?UGe(n,t):null}function e5(e,t){return new Proxy(e,WGe(t))}function WGe(e){let{constructorCall:t,methodCall:n,getProperty:r,setProperty:i}=e,a={};return t!==void 0&&(a.construct=function(e,n,r){let i=Reflect.construct.bind(null,e,n,r);return t.call(r,n,i)}),a.set=function(e,t,n){let r=()=>{let r=UGe(e,t)||e,i=Reflect.getOwnPropertyDescriptor(r,t);return i?.set===void 0?Reflect.defineProperty(r,t,{writable:!0,enumerable:!0,configurable:!0,value:n}):(i.set.apply(e,[n]),!0)};return i===void 0?r():i.call(e,[t,n],r)},a.get=function(e,t,i){let a=()=>e[t],o=r===void 0?a():r.call(e,[t,i],a);return typeof o==`function`?(...r)=>{let i=o.bind(e,...r);return n===void 0?i():n.call(e,[t,r],i)}:o},a}function GGe(e){return[`application/xhtml+xml`,`application/xml`,`image/svg+xml`,`text/html`,`text/xml`].some(t=>e.startsWith(t))}function KGe(e){try{return JSON.parse(e)}catch{return null}}function qGe(e,t){return new G8(G8.isResponseWithBody(e.status)?t:null,{url:e.responseURL,status:e.status,statusText:e.statusText,headers:JGe(e.getAllResponseHeaders())})}function JGe(e){let t=new Headers,n=e.split(/[\r\n]+/);for(let e of n){if(e.trim()===``)continue;let[n,...r]=e.split(`: `),i=r.join(`: `);t.append(n,i)}return t}async function YGe(e){let t=e.headers.get(`content-length`);return t!=null&&t!==``?Number(t):(await e.arrayBuffer()).byteLength}var t5=Symbol(`kIsRequestHandled`),XGe=_8(),n5=Symbol(`kFetchRequest`),ZGe=class{constructor(e,t){this.initialRequest=e,this.logger=t,this.method=`GET`,this.url=null,this[t5]=!1,this.events=new Map,this.uploadEvents=new Map,this.requestId=T8(),this.requestHeaders=new Headers,this.responseBuffer=new Uint8Array,this.request=e5(e,{setProperty:([e,t],n)=>{switch(e){case`ontimeout`:{let r=e.slice(2);return this.request.addEventListener(r,t),n()}default:return n()}},methodCall:([e,t],n)=>{switch(e){case`open`:{let[e,r]=t;return r===void 0?(this.method=`GET`,this.url=QGe(e)):(this.method=e,this.url=QGe(r)),this.logger=this.logger.extend(`${this.method} ${this.url.href}`),this.logger.info(`open`,this.method,this.url.href),n()}case`addEventListener`:{let[e,r]=t;return this.registerEvent(e,r),this.logger.info(`addEventListener`,e,r),n()}case`setRequestHeader`:{let[e,r]=t;return this.requestHeaders.set(e,r),this.logger.info(`setRequestHeader`,e,r),n()}case`send`:{let[e]=t;this.request.addEventListener(`load`,()=>{if(this.onResponse!==void 0){let e=qGe(this.request,this.request.response);this.onResponse.call(this,{response:e,isMockedResponse:this[t5],request:i,requestId:this.requestId})}});let r=typeof e==`string`?oGe(e):e,i=this.toFetchApiRequest(r);this[n5]=i.clone(),queueMicrotask(()=>{(this.onRequest?.call(this,{request:i,requestId:this.requestId})||Promise.resolve()).finally(()=>{if(!this[t5])return this.logger.info(`request callback settled but request has not been handled (readystate %d), performing as-is...`,this.request.readyState),XGe&&this.request.setRequestHeader(zWe,this.requestId),n()})});break}default:return n()}}}),r5(this.request,`upload`,e5(this.request.upload,{setProperty:([e,t],n)=>{switch(e){case`onloadstart`:case`onprogress`:case`onaboart`:case`onerror`:case`onload`:case`ontimeout`:case`onloadend`:{let n=e.slice(2);this.registerUploadEvent(n,t)}}return n()},methodCall:([e,t],n)=>{switch(e){case`addEventListener`:{let[e,r]=t;return this.registerUploadEvent(e,r),this.logger.info(`upload.addEventListener`,e,r),n()}}}}))}registerEvent(e,t){let n=(this.events.get(e)||[]).concat(t);this.events.set(e,n),this.logger.info(`registered event "%s"`,e,t)}registerUploadEvent(e,t){let n=(this.uploadEvents.get(e)||[]).concat(t);this.uploadEvents.set(e,n),this.logger.info(`registered upload event "%s"`,e,t)}async respondWith(e){if(this[t5]=!0,this[n5]){let e=await YGe(this[n5]);this.trigger(`loadstart`,this.request.upload,{loaded:0,total:e}),this.trigger(`progress`,this.request.upload,{loaded:e,total:e}),this.trigger(`load`,this.request.upload,{loaded:e,total:e}),this.trigger(`loadend`,this.request.upload,{loaded:e,total:e})}this.logger.info(`responding with a mocked response: %d %s`,e.status,e.statusText),r5(this.request,`status`,e.status),r5(this.request,`statusText`,e.statusText),r5(this.request,`responseURL`,this.url.href),this.request.getResponseHeader=new Proxy(this.request.getResponseHeader,{apply:(t,n,r)=>{if(this.logger.info(`getResponseHeader`,r[0]),this.request.readyState{if(this.logger.info(`getAllResponseHeaders`),this.request.readyState`${e}: ${t}`).join(`\r -`);return this.logger.info(`resolved all response headers to`,t),t}}),Object.defineProperties(this.request,{response:{enumerable:!0,configurable:!1,get:()=>this.response},responseText:{enumerable:!0,configurable:!1,get:()=>this.responseText},responseXML:{enumerable:!0,configurable:!1,get:()=>this.responseXML}});let t=await YGe(e.clone());this.logger.info(`calculated response body length`,t),this.trigger(`loadstart`,this.request,{loaded:0,total:t}),this.setReadyState(this.request.HEADERS_RECEIVED),this.setReadyState(this.request.LOADING);let n=()=>{this.logger.info(`finalizing the mocked response...`),this.setReadyState(this.request.DONE),this.trigger(`load`,this.request,{loaded:this.responseBuffer.byteLength,total:t}),this.trigger(`loadend`,this.request,{loaded:this.responseBuffer.byteLength,total:t})};if(e.body){this.logger.info(`mocked response has body, streaming...`);let r=e.body.getReader(),i=async()=>{let{value:e,done:a}=await r.read();if(a){this.logger.info(`response body stream done!`),n();return}e&&(this.logger.info(`read response body chunk:`,e),this.responseBuffer=RGe(this.responseBuffer,e),this.trigger(`progress`,this.request,{loaded:this.responseBuffer.byteLength,total:t})),i()};i()}else n()}responseBufferToText(){return sGe(this.responseBuffer)}get response(){if(this.logger.info(`getResponse (responseType: %s)`,this.request.responseType),this.request.readyState!==this.request.DONE)return null;switch(this.request.responseType){case`json`:{let e=KGe(this.responseBufferToText());return this.logger.info(`resolved response JSON`,e),e}case`arraybuffer`:{let e=cGe(this.responseBuffer);return this.logger.info(`resolved response ArrayBuffer`,e),e}case`blob`:{let e=this.request.getResponseHeader(`Content-Type`)||`text/plain`,t=new Blob([this.responseBufferToText()],{type:e});return this.logger.info(`resolved response Blob (mime type: %s)`,t,e),t}default:{let e=this.responseBufferToText();return this.logger.info(`resolving "%s" response type as text`,this.request.responseType,e),e}}}get responseText(){if(g8(this.request.responseType===``||this.request.responseType===`text`,`InvalidStateError: The object is in invalid state.`),this.request.readyState!==this.request.LOADING&&this.request.readyState!==this.request.DONE)return``;let e=this.responseBufferToText();return this.logger.info(`getResponseText: "%s"`,e),e}get responseXML(){if(g8(this.request.responseType===``||this.request.responseType===`document`,`InvalidStateError: The object is in invalid state.`),this.request.readyState!==this.request.DONE)return null;let e=this.request.getResponseHeader(`Content-Type`)||``;return typeof DOMParser>`u`?(console.warn(`Cannot retrieve XMLHttpRequest response body as XML: DOMParser is not defined. You are likely using an environment that is not browser or does not polyfill browser globals correctly.`),null):GGe(e)?new DOMParser().parseFromString(this.responseBufferToText(),e):null}errorWith(e){this[t5]=!0,this.logger.info(`responding with an error`),this.setReadyState(this.request.DONE),this.trigger(`error`,this.request),this.trigger(`loadend`,this.request)}setReadyState(e){if(this.logger.info(`setReadyState: %d -> %d`,this.request.readyState,e),this.request.readyState===e){this.logger.info(`ready state identical, skipping transition...`);return}r5(this.request,`readyState`,e),this.logger.info(`set readyState to: %d`,e),e!==this.request.UNSENT&&(this.logger.info(`triggering "readystatechange" event...`),this.trigger(`readystatechange`,this.request))}trigger(e,t,n){let r=t[`on${e}`],i=HGe(t,e,n);this.logger.info(`trigger "%s"`,e,n||``),typeof r==`function`&&(this.logger.info(`found a direct "%s" callback, calling...`,e),r.call(t,i));let a=t instanceof XMLHttpRequestUpload?this.uploadEvents:this.events;for(let[n,r]of a)n===e&&(this.logger.info(`found %d listener(s) for "%s" event, calling...`,r.length,e),r.forEach(e=>e.call(t,i)))}toFetchApiRequest(e){this.logger.info(`converting request to a Fetch API Request...`);let t=e instanceof Document?e.documentElement.innerText:e,n=new Request(this.url.href,{method:this.method,headers:this.requestHeaders,credentials:this.request.withCredentials?`include`:`same-origin`,body:[`GET`,`HEAD`].includes(this.method.toUpperCase())?null:t});return r5(n,`headers`,e5(n.headers,{methodCall:([e,t],r)=>{switch(e){case`append`:case`set`:{let[e,n]=t;this.request.setRequestHeader(e,n);break}case`delete`:{let[e]=t;console.warn(`XMLHttpRequest: Cannot remove a "${e}" header from the Fetch API representation of the "${n.method} ${n.url}" request. XMLHttpRequest headers cannot be removed.`);break}}return r()}})),iGe(n,this.request),this.logger.info(`converted request to a Fetch API Request!`,n),n}};function QGe(e){return typeof location>`u`?new URL(e):new URL(e.toString(),location.href)}function r5(e,t,n){Reflect.defineProperty(e,t,{writable:!0,enumerable:!0,value:n})}function $Ge({emitter:e,logger:t}){return new Proxy(globalThis.XMLHttpRequest,{construct(n,r,i){t.info(`constructed new XMLHttpRequest`);let a=Reflect.construct(n,r,i),o=Object.getOwnPropertyDescriptors(n.prototype);for(let e in o)Reflect.defineProperty(a,e,o[e]);let s=new ZGe(a,t);return s.onRequest=async function({request:t,requestId:n}){let r=new W8(t,{passthrough:()=>{this.logger.info(`no mocked response received, performing request as-is...`)},respondWith:async e=>{if(Z8(e)){this.errorWith(TypeError(`Network error`));return}await this.respondWith(e)},errorWith:e=>{this.logger.info(`request errored!`,{error:e}),e instanceof Error&&this.errorWith(e)}});this.logger.info(`awaiting mocked response...`),this.logger.info(`emitting the "request" event for %s listener(s)...`,e.listenerCount(`request`)),await OGe({request:t,requestId:n,controller:r,emitter:e})},s.onResponse=async function({response:t,isMockedResponse:n,request:r,requestId:i}){this.logger.info(`emitting the "response" event for %s listener(s)...`,e.listenerCount(`response`)),e.emit(`response`,{response:t,isMockedResponse:n,request:r,requestId:i})},s.request}})}var eKe=class e extends w8{static{this.interceptorSymbol=Symbol(`xhr`)}constructor(){super(e.interceptorSymbol)}checkEnvironment(){return D8(`XMLHttpRequest`)}setup(){let e=this.logger.extend(`setup`);e.info(`patching "XMLHttpRequest" module...`);let t=globalThis.XMLHttpRequest;g8(!t[H8],`Failed to patch the "XMLHttpRequest" module: already patched.`),globalThis.XMLHttpRequest=$Ge({emitter:this.emitter,logger:this.logger}),e.info(`native "XMLHttpRequest" module patched!`,globalThis.XMLHttpRequest.name),Object.defineProperty(globalThis.XMLHttpRequest,H8,{enumerable:!0,configurable:!0,value:!0}),this.subscriptions.push(()=>{Object.defineProperty(globalThis.XMLHttpRequest,H8,{value:void 0}),globalThis.XMLHttpRequest=t,e.info(`native "XMLHttpRequest" module restored!`,globalThis.XMLHttpRequest.name)})}},tKe=class extends pWe{constructor(e){super({interceptors:[new eKe,new LGe]}),this.options=e}enable(){super.enable(),this.options.quiet||this.#e()}disable(){super.disable(),this.options.quiet||this.#t()}#e(){console.groupCollapsed(`%c${S6.formatMessage(`Mocking enabled (fallback mode).`)}`,`color:orangered;font-weight:bold;`),console.log(`%cDocumentation: %chttps://mswjs.io/docs`,`font-weight:bold`,`font-weight:normal`),console.log(`Found an issue? https://github.com/mswjs/msw/issues`),console.groupEnd()}#t(){console.log(`%c${S6.formatMessage(`Mocking disabled.`)}`,`color:orangered;font-weight:bold;`)}},nKe=`/mockServiceWorker.js`;function rKe(...e){g8(!_8(),S6.formatMessage("Failed to execute `setupWorker` in a non-browser environment"));let t=tWe({sources:[],handlers:e});return{async start(e){if(e?.waitUntilReady!=null&&S6.warn(`The "waitUntilReady" option has been deprecated. Please remove it from this "worker.start()" call. Follow the recommended Browser integration (https://mswjs.io/docs/integrations/browser) to eliminate any race conditions between the Service Worker registration and any requests made by your application on initial render.`),t.readyState===d8.ENABLED){S6.warn(`Found a redundant "worker.start()" call. Note that starting the worker while mocking is already enabled will have no effect. Consider removing this "worker.start()" call.`);return}let n=V8()?new xGe({serviceWorker:{url:e?.serviceWorker?.url?.toString()||nKe,options:e?.serviceWorker?.options},findWorker:e?.findWorker,quiet:e?.quiet}):new tKe({quiet:e?.quiet});if(t.configure({sources:[n,new pWe({interceptors:[new $We]})],onUnhandledFrame:gWe(()=>e?.onUnhandledRequest||`warn`),context:{quiet:e?.quiet}}),await t.enable(),n instanceof xGe){let[,e]=await n.workerPromise;return e}},stop(){if(t.readyState===d8.DISABLED){S6.warn(`Found a redundant "worker.stop()" call. Notice that stopping the worker after it has already been stopped has no effect. Consider removing this "worker.stop()" call.`);return}t.disable(),window.postMessage({type:`msw/worker:stop`})},events:t.events,use:t.use.bind(t),resetHandlers:t.resetHandlers.bind(t),restoreHandlers:t.restoreHandlers.bind(t),listHandlers:t.listHandlers.bind(t)}}function iKe(e){let t={},n=Array.from(new Set(e.searchParams.keys()));for(let r of n){let n=e.searchParams.getAll(r),i=n.length===1?n[0]:n,a=e=>{if(e===`true`)return!0;if(e===`false`)return!1;if(e===`null`)return null;if(e===`undefined`)return;let t=Number(e);if(!isNaN(t)&&e.trim()!==``&&String(t)===e)return t;if(e.startsWith(`{`)&&e.endsWith(`}`)||e.startsWith(`[`)&&e.endsWith(`]`))try{return JSON.parse(e)}catch{}return e};Array.isArray(i)?t[r]=i.map(a):t[r]=a(i)}return t}var aKe=class{constructor(e={}){this.name=`com.objectstack.plugin.msw`,this.type=`server`,this.version=`0.9.0`,this.handlers=[],this.init=async e=>{e.logger.debug(`Initializing MSW plugin`,{enableBrowser:this.options.enableBrowser,baseUrl:this.options.baseUrl,logRequests:this.options.logRequests}),e.logger.info(`MSW plugin initialized`)},this.start=async e=>{e.logger.debug(`Starting MSW plugin`);try{try{this.protocol=e.getService(`protocol`),e.logger.debug(`Protocol service found from context`)}catch{}if(!this.protocol)try{let t=e.getService(`objectql`),{ObjectStackProtocolImplementation:n}=await Gf(async()=>{let{ObjectStackProtocolImplementation:e}=await Promise.resolve().then(()=>UPe);return{ObjectStackProtocolImplementation:e}},void 0,import.meta.url);this.protocol=new n(t),e.logger.debug(`Protocol implementation created dynamically`)}catch(t){if(t.code===`ERR_MODULE_NOT_FOUND`)e.logger.warn(`Module @objectstack/objectql not found. Protocol not initialized.`);else throw t}this.protocol||e.logger.warn(`No ObjectStackProtocol service available. MSW will only serve static/custom handlers if configured.`)}catch(t){throw e.logger.error(`Failed to initialize protocol`,t),Error(`[MSWPlugin] Failed to initialize protocol`)}this.setupHandlers(e),await this.startWorker(e)},this.options={enableBrowser:!0,baseUrl:`/api/v1`,logRequests:!0,...e}}async destroy(){await this.stopWorker()}setupHandlers(e){try{this.dispatcher=new UAe(e.getKernel())}catch{e.logger.warn(`[MSWPlugin] Could not initialize HttpDispatcher via Kernel. Falling back to simple handlers.`)}let t=this.options.baseUrl||`/api/v1`;if(this.handlers=[...this.options.customHandlers||[]],this.handlers.push(n8.get(`*/.well-known/objectstack`,async()=>this.dispatcher?u8.json({data:await this.dispatcher.getDiscoveryInfo(t)}):u8.json({data:{version:`v1`,apiName:`ObjectStack API`,url:t,capabilities:{graphql:!1,search:!1,websockets:!1,files:!1,analytics:!1,hub:!1}}}))),this.handlers.push(n8.get(`*${t}`,async()=>this.dispatcher?u8.json({data:await this.dispatcher.getDiscoveryInfo(t)}):u8.json({data:{version:`v1`,url:t}})),n8.get(`*${t}/discovery`,async()=>this.dispatcher?u8.json({data:await this.dispatcher.getDiscoveryInfo(t)}):u8.json({data:{version:`v1`,url:t}}))),this.dispatcher){let n=this.dispatcher,r=async({request:e,params:r})=>{let i=new URL(e.url),a=i.pathname;a.startsWith(t)&&(a=a.slice(t.length)),this.options.logRequests&&console.log(`[MSW] Intercepted: ${e.method} ${i.pathname}`,{path:a});let o;if(e.method!==`GET`&&e.method!==`HEAD`)try{o=await e.clone().json()}catch{}let s=iKe(i),c=await n.dispatch(e.method,a,o,s,{request:e},t);if(c.handled){if(c.response)return u8.json(c.response.body,{status:c.response.status,headers:c.response.headers});if(c.result)return c.result.type===`redirect`?u8.redirect(c.result.url):u8.json(c.result)}};this.handlers.push(n8.all(`*${t}/*`,r),n8.all(`*${t}`,r)),e.logger.info(`MSW handlers set up using HttpDispatcher`,{baseUrl:t})}else e.logger.warn(`[MSWPlugin] No dispatcher available. No API routes registered.`)}async startWorker(e){this.options.enableBrowser&&typeof window<`u`?(e.logger.debug(`Starting MSW in browser mode`),this.worker=rKe(...this.handlers),await this.worker.start({onUnhandledRequest:`bypass`}),e.logger.info(`MSW started in browser mode`)):e.logger.debug(`MSW browser mode disabled or not in browser environment`)}async stopWorker(){this.worker&&(this.worker.stop(),console.log(`[MSWPlugin] Stopped MSW worker`))}getWorker(){return this.worker}getHandlers(){return this.handlers}},i5={administration:`area_administration`,platform:`area_platform`,system:`area_system`,ai:`area_ai`},oKe=[{id:i5.administration,label:`Administration`,icon:`shield`,order:10,description:`User management, roles, permissions, and security settings`,navigation:[]},{id:i5.platform,label:`Platform`,icon:`layers`,order:20,description:`Objects, fields, layouts, automation, and extensibility settings`,navigation:[]},{id:i5.system,label:`System`,icon:`settings`,order:30,description:`Datasources, integrations, jobs, logs, and environment configuration`,navigation:[]},{id:i5.ai,label:`AI`,icon:`brain`,order:40,description:`AI agents, model registry, RAG pipelines, and intelligence settings`,navigation:[]}],sKe={name:`setup`,label:`Setup`,description:`Platform settings and administration`,icon:`settings`,active:!0,isDefault:!1,branding:{primaryColor:`#475569`},requiredPermissions:[`setup.access`],areas:[]},cKe=class{constructor(){this.name=`com.objectstack.setup`,this.type=`standard`,this.version=`1.0.0`,this.dependencies=[`com.objectstack.engine.objectql`],this.contributions=[]}async init(e){e.logger.info(`Initializing Setup Plugin...`),e.registerService(`setupNav`,{contribute:e=>{this.contributions.push(e)}}),e.logger.info(`Setup Plugin initialized — setupNav service registered`)}async start(e){e.logger.info(`Starting Setup Plugin — finalizing Setup App...`);let t=this.mergeAreas(this.contributions),n={...sKe,areas:t.length>0?t:void 0};e.getService(`manifest`).register({id:`com.objectstack.setup`,name:`Setup`,version:`1.0.0`,type:`plugin`,namespace:`sys`,objects:[],apps:[n]}),e.logger.info(`Setup App registered with ${t.length} area(s) and ${this.contributions.length} contribution(s)`)}async destroy(){this.contributions=[]}mergeAreas(e){let t=new Map(oKe.map(e=>[e.id,{...e,navigation:[...e.navigation]}]));for(let n of e){let e=t.get(n.areaId);e?e.navigation.push(...n.items):t.set(n.areaId,{id:n.areaId,label:n.areaId,order:100,navigation:[...n.items]})}return Array.from(t.values()).filter(e=>e.navigation.length>0).sort((e,t)=>(e.order??0)-(t.order??0))}};r().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 a5=r().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)`);r().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 lKe=E([`on_create`,`on_update`,`on_create_or_update`,`on_delete`,`schedule`]),uKe=h({name:r().describe(`Action name`),type:m(`field_update`),field:r().describe(`Field to update`),value:u().describe(`Value or Formula to set`)}),dKe=h({name:r().describe(`Action name`),type:m(`email_alert`),template:r().describe(`Email template ID/DevName`),recipients:C(r()).describe(`List of recipient emails or user IDs`)}),fKe=h({name:r().describe(`Action name`),type:m(`connector_action`),connectorId:r().describe(`Target Connector ID (e.g. slack, twilio)`),actionId:r().describe(`Target Action ID (e.g. send_message)`),input:d(r(),u()).describe(`Input parameters matching the action schema`)}),pKe=I(`type`,[uKe,dKe,h({name:r().describe(`Action name`),type:m(`http_call`),url:r().describe(`Target URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`]).default(`POST`).describe(`HTTP Method`),headers:d(r(),r()).optional().describe(`HTTP Headers`),body:r().optional().describe(`Request body (JSON or text)`)}),fKe,h({name:r().describe(`Action name`),type:m(`task_creation`),taskObject:r().describe(`Task object name (e.g., "task", "project_task")`),subject:r().describe(`Task subject/title`),description:r().optional().describe(`Task description`),assignedTo:r().optional().describe(`User ID or field reference for assignee`),dueDate:r().optional().describe(`Due date (ISO string or formula)`),priority:r().optional().describe(`Task priority`),relatedTo:r().optional().describe(`Related record ID or field reference`),additionalFields:d(r(),u()).optional().describe(`Additional custom fields`)}),h({name:r().describe(`Action name`),type:m(`push_notification`),title:r().describe(`Notification title`),body:r().describe(`Notification body text`),recipients:C(r()).describe(`User IDs or device tokens`),data:d(r(),u()).optional().describe(`Additional data payload`),badge:P().optional().describe(`Badge count (iOS)`),sound:r().optional().describe(`Notification sound`),clickAction:r().optional().describe(`Action/URL when notification is clicked`)}),h({name:r().describe(`Action name`),type:m(`custom_script`),language:E([`javascript`,`typescript`,`python`]).default(`javascript`).describe(`Script language`),code:r().describe(`Script code to execute`),timeout:P().default(3e4).describe(`Execution timeout in milliseconds`),context:d(r(),u()).optional().describe(`Additional context variables`)})]),mKe=h({id:r().optional().describe(`Unique identifier`),timeLength:P().int().describe(`Duration amount (e.g. 1, 30)`),timeUnit:E([`minutes`,`hours`,`days`]).describe(`Unit of time`),offsetDirection:E([`before`,`after`]).describe(`Before or After the reference date`),offsetFrom:E([`trigger_date`,`date_field`]).describe(`Basis for calculation`),dateField:r().optional().describe(`Date field to calculate from (required if offsetFrom is date_field)`),actions:C(pKe).describe(`Actions to execute at the scheduled time`)});h({name:a5.describe(`Unique workflow name (lowercase snake_case)`),objectName:r().describe(`Target Object`),triggerType:lKe.describe(`When to evaluate`),criteria:r().optional().describe(`Formula condition. If TRUE, actions execute.`),actions:C(pKe).optional().describe(`Immediate actions`),timeTriggers:C(mKe).optional().describe(`Scheduled actions relative to trigger or date field`),active:S().default(!0).describe(`Whether this workflow is active`),executionOrder:P().int().min(0).default(100).describe(`Deterministic execution order when multiple workflows match (lower runs first)`),reevaluateOnChange:S().default(!1).describe(`Re-evaluate rule if field updates change the record validity`)});var hKe=E([`start`,`end`,`decision`,`assignment`,`loop`,`create_record`,`update_record`,`delete_record`,`get_record`,`http_request`,`script`,`screen`,`wait`,`subflow`,`connector_action`,`parallel_gateway`,`join_gateway`,`boundary_event`]),gKe=h({name:r().describe(`Variable name`),type:r().describe(`Data type (text, number, boolean, object, list)`),isInput:S().default(!1).describe(`Is input parameter`),isOutput:S().default(!1).describe(`Is output parameter`)}),_Ke=h({id:r().describe(`Node unique ID`),type:hKe.describe(`Action type`),label:r().describe(`Node label`),config:d(r(),u()).optional().describe(`Node configuration`),connectorConfig:h({connectorId:r(),actionId:r(),input:d(r(),u()).describe(`Mapped inputs for the action`)}).optional(),position:h({x:P(),y:P()}).optional(),timeoutMs:P().int().min(0).optional().describe(`Maximum execution time for this node in milliseconds`),inputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Parameter type`),required:S().default(!1).describe(`Whether the parameter is required`),description:r().optional().describe(`Parameter description`)})).optional().describe(`Input parameter schema for this node`),outputSchema:d(r(),h({type:E([`string`,`number`,`boolean`,`object`,`array`]).describe(`Output type`),description:r().optional().describe(`Output description`)})).optional().describe(`Output schema declaration for this node`),waitEventConfig:h({eventType:E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`What kind of event resumes the execution`),timerDuration:r().optional().describe(`ISO 8601 duration (e.g., "PT1H") or wait time for timer events`),signalName:r().optional().describe(`Named signal or webhook event to wait for`),timeoutMs:P().int().min(0).optional().describe(`Maximum wait time before timeout (ms)`),onTimeout:E([`fail`,`continue`]).default(`fail`).describe(`Behavior when the wait times out`)}).optional().describe(`Configuration for wait node event resumption`),boundaryConfig:h({attachedToNodeId:r().describe(`Host node ID this boundary event monitors`),eventType:E([`error`,`timer`,`signal`,`cancel`]).describe(`Boundary event trigger type`),interrupting:S().default(!0).describe(`If true, the host activity is cancelled when this event fires`),errorCode:r().optional().describe(`Specific error code to catch (empty = catch all errors)`),timerDuration:r().optional().describe(`ISO 8601 duration for timer boundary events`),signalName:r().optional().describe(`Named signal to catch`)}).optional().describe(`Configuration for boundary events attached to host nodes`)}),vKe=h({id:r().describe(`Edge unique ID`),source:r().describe(`Source Node ID`),target:r().describe(`Target Node ID`),condition:r().optional().describe(`Expression returning boolean used for branching`),type:E([`default`,`fault`,`conditional`]).default(`default`).describe(`Connection type: default (normal flow), fault (error path), or conditional (expression-guarded)`),label:r().optional().describe(`Label on the connector`),isDefault:S().default(!1).describe(`Marks this edge as the default path when no other conditions match`)}),yKe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name`),label:r().describe(`Flow label`),description:r().optional(),version:P().int().default(1).describe(`Version number`),status:E([`draft`,`active`,`obsolete`,`invalid`]).default(`draft`).describe(`Deployment status`),template:S().default(!1).describe(`Is logic template (Subflow)`),type:E([`autolaunched`,`record_change`,`schedule`,`screen`,`api`]).describe(`Flow type`),variables:C(gKe).optional().describe(`Flow variables`),nodes:C(_Ke).describe(`Flow nodes`),edges:C(vKe).describe(`Flow connections`),active:S().default(!1).describe(`Is active (Deprecated: use status)`),runAs:E([`system`,`user`]).default(`user`).describe(`Execution context`),errorHandling:h({strategy:E([`fail`,`retry`,`continue`]).default(`fail`).describe(`How to handle node execution errors`),maxRetries:P().int().min(0).max(10).default(0).describe(`Number of retry attempts (only for retry strategy)`),retryDelayMs:P().int().min(0).default(1e3).describe(`Delay between retries in milliseconds`),backoffMultiplier:P().min(1).default(1).describe(`Multiplier for exponential backoff between retries`),maxRetryDelayMs:P().int().min(0).default(3e4).describe(`Maximum delay between retries in milliseconds`),jitter:S().default(!1).describe(`Add random jitter to retry delay to avoid thundering herd`),fallbackNodeId:r().optional().describe(`Node ID to jump to on unrecoverable error`)}).optional().describe(`Flow-level error handling configuration`)});h({flowName:r().describe(`Flow machine name`),version:P().int().min(1).describe(`Version number`),definition:yKe.describe(`Complete flow definition snapshot`),createdAt:r().datetime().describe(`When this version was created`),createdBy:r().optional().describe(`User who created this version`),changeNote:r().optional().describe(`Description of what changed in this version`)});var bKe=E([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`,`timed_out`,`retrying`]),xKe=h({nodeId:r().describe(`Node ID that was executed`),nodeType:r().describe(`Node action type (e.g., "decision", "http_request")`),nodeLabel:r().optional().describe(`Human-readable node label`),status:E([`success`,`failure`,`skipped`]).describe(`Step execution result`),startedAt:r().datetime().describe(`When the step started`),completedAt:r().datetime().optional().describe(`When the step completed`),durationMs:P().int().min(0).optional().describe(`Step execution duration in milliseconds`),input:d(r(),u()).optional().describe(`Input data passed to the node`),output:d(r(),u()).optional().describe(`Output data produced by the node`),error:h({code:r().describe(`Error code`),message:r().describe(`Error message`),stack:r().optional().describe(`Stack trace`)}).optional().describe(`Error details if step failed`),retryAttempt:P().int().min(0).optional().describe(`Retry attempt number (0 = first try)`)});h({id:r().describe(`Execution instance ID`),flowName:r().describe(`Machine name of the executed flow`),flowVersion:P().int().optional().describe(`Version of the flow that was executed`),status:bKe.describe(`Current execution status`),trigger:h({type:r().describe(`Trigger type (e.g., "record_change", "schedule", "api", "manual")`),recordId:r().optional().describe(`Triggering record ID`),object:r().optional().describe(`Triggering object name`),userId:r().optional().describe(`User who triggered the execution`),metadata:d(r(),u()).optional().describe(`Additional trigger context`)}).describe(`What triggered this execution`),steps:C(xKe).describe(`Ordered list of executed steps`),variables:d(r(),u()).optional().describe(`Final state of flow variables`),startedAt:r().datetime().describe(`Execution start timestamp`),completedAt:r().datetime().optional().describe(`Execution completion timestamp`),durationMs:P().int().min(0).optional().describe(`Total execution duration in milliseconds`),runAs:E([`system`,`user`]).optional().describe(`Execution context identity`),tenantId:r().optional().describe(`Tenant ID for multi-tenant isolation`)});var SKe=E([`warning`,`error`,`critical`]);h({id:r().describe(`Error record ID`),executionId:r().describe(`Parent execution ID`),nodeId:r().optional().describe(`Node where the error occurred`),severity:SKe.describe(`Error severity level`),code:r().describe(`Machine-readable error code`),message:r().describe(`Human-readable error message`),stack:r().optional().describe(`Stack trace for debugging`),context:d(r(),u()).optional().describe(`Additional diagnostic context (input data, config snapshot)`),timestamp:r().datetime().describe(`When the error occurred`),retryable:S().default(!1).describe(`Whether this error can be retried`),resolvedAt:r().datetime().optional().describe(`When the error was resolved (e.g., after successful retry)`)}),h({id:r().describe(`Checkpoint ID`),executionId:r().describe(`Parent execution ID`),flowName:r().describe(`Flow machine name`),currentNodeId:r().describe(`Node ID where execution is paused`),variables:d(r(),u()).describe(`Flow variable state at checkpoint`),completedNodeIds:C(r()).describe(`List of node IDs already executed`),createdAt:r().datetime().describe(`Checkpoint creation timestamp`),expiresAt:r().datetime().optional().describe(`Checkpoint expiration (auto-cleanup)`),reason:E([`wait`,`screen_input`,`approval`,`error`,`manual_pause`,`parallel_join`,`boundary_event`]).describe(`Why the execution was checkpointed`)}),h({maxConcurrent:P().int().min(1).default(1).describe(`Maximum number of concurrent executions allowed`),onConflict:E([`queue`,`reject`,`cancel_existing`]).default(`queue`).describe(`queue = enqueue for later, reject = fail immediately, cancel_existing = stop running instance`),lockScope:E([`global`,`per_record`,`per_user`]).default(`global`).describe(`Scope of the concurrency lock`),queueTimeoutMs:P().int().min(0).optional().describe(`Maximum time to wait in queue before timing out (ms)`)}),h({id:r().describe(`Schedule instance ID`),flowName:r().describe(`Flow machine name`),cronExpression:r().describe(`Cron expression (e.g., "0 9 * * MON-FRI")`),timezone:r().default(`UTC`).describe(`IANA timezone for cron evaluation`),status:E([`active`,`paused`,`disabled`,`expired`]).default(`active`).describe(`Current schedule status`),nextRunAt:r().datetime().optional().describe(`Next scheduled execution timestamp`),lastRunAt:r().datetime().optional().describe(`Last execution timestamp`),lastExecutionId:r().optional().describe(`Execution ID of the last run`),lastRunStatus:bKe.optional().describe(`Status of the last run`),totalRuns:P().int().min(0).default(0).describe(`Total number of executions`),consecutiveFailures:P().int().min(0).default(0).describe(`Consecutive failed executions`),startDate:r().datetime().optional().describe(`Schedule effective start date`),endDate:r().datetime().optional().describe(`Schedule expiration date`),maxRuns:P().int().min(1).optional().describe(`Maximum total executions before auto-disable`),createdAt:r().datetime().describe(`Schedule creation timestamp`),updatedAt:r().datetime().optional().describe(`Last update timestamp`),createdBy:r().optional().describe(`User who created the schedule`)});var CKe=E([`create`,`update`,`delete`,`undelete`,`api`]);h({name:a5.describe(`Webhook unique name (lowercase snake_case)`),label:r().optional().describe(`Human-readable webhook label`),object:r().optional().describe(`Object to listen to (optional for manual webhooks)`),triggers:C(CKe).optional().describe(`Events that trigger execution`),url:r().url().describe(`External webhook endpoint URL`),method:E([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]).default(`POST`).describe(`HTTP method`),headers:d(r(),r()).optional().describe(`Custom HTTP headers`),body:u().optional().describe(`Request body payload (if not using default record data)`),payloadFields:C(r()).optional().describe(`Fields to include. Empty = All`),includeSession:S().default(!1).describe(`Include user session info`),authentication:h({type:E([`none`,`bearer`,`basic`,`api-key`]).describe(`Authentication type`),credentials:d(r(),r()).optional().describe(`Authentication credentials`)}).optional().describe(`Authentication configuration`),retryPolicy:h({maxRetries:P().int().min(0).max(10).default(3).describe(`Maximum retry attempts`),backoffStrategy:E([`exponential`,`linear`,`fixed`]).default(`exponential`).describe(`Backoff strategy`),initialDelayMs:P().int().min(100).default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:P().int().min(1e3).default(6e4).describe(`Maximum retry delay in milliseconds`)}).optional().describe(`Retry policy configuration`),timeoutMs:P().int().min(1e3).max(3e5).default(3e4).describe(`Request timeout in milliseconds`),secret:r().optional().describe(`Signing secret for HMAC signature verification`),isActive:S().default(!0).describe(`Whether webhook is active`),description:r().optional().describe(`Webhook description`),tags:C(r()).optional().describe(`Tags for organization`)}),h({name:a5.describe(`Webhook receiver unique name (lowercase snake_case)`),path:r().describe(`URL Path (e.g. /webhooks/stripe)`),verificationType:E([`none`,`header_token`,`hmac`,`ip_whitelist`]).default(`none`),verificationParams:h({header:r().optional(),secret:r().optional(),ips:C(r()).optional()}).optional(),action:E([`trigger_flow`,`script`,`upsert_record`]).default(`trigger_flow`),target:r().describe(`Flow ID or Script name`)});var wKe=E([`user`,`role`,`manager`,`field`,`queue`]),o5=h({type:E([`field_update`,`email_alert`,`webhook`,`script`,`connector_action`]),name:r().describe(`Action name`),config:d(r(),u()).describe(`Action configuration`),connectorId:r().optional(),actionId:r().optional()}),TKe=h({name:a5.describe(`Step machine name`),label:r().describe(`Step display label`),description:r().optional(),entryCriteria:r().optional().describe(`Formula expression to enter this step`),approvers:C(h({type:wKe,value:r().describe(`User ID, Role Name, or Field Name`)})).min(1).describe(`List of allowed approvers`),behavior:E([`first_response`,`unanimous`]).default(`first_response`).describe(`How to handle multiple approvers`),rejectionBehavior:E([`reject_process`,`back_to_previous`]).default(`reject_process`).describe(`What happens if rejected`),onApprove:C(o5).optional().describe(`Actions on step approval`),onReject:C(o5).optional().describe(`Actions on step rejection`)}),EKe=h({name:a5.describe(`Unique process name`),label:r().describe(`Human readable label`),object:r().describe(`Target Object Name`),active:S().default(!1),description:r().optional(),entryCriteria:r().optional().describe(`Formula to allow submission`),lockRecord:S().default(!0).describe(`Lock record from editing during approval`),steps:C(TKe).min(1).describe(`Sequence of approval steps`),escalation:h({enabled:S().default(!1).describe(`Enable SLA-based escalation`),timeoutHours:P().min(1).describe(`Hours before escalation triggers`),action:E([`reassign`,`auto_approve`,`auto_reject`,`notify`]).default(`notify`).describe(`Action to take on escalation timeout`),escalateTo:r().optional().describe(`User ID, role, or manager level to escalate to`),notifySubmitter:S().default(!0).describe(`Notify the original submitter on escalation`)}).optional().describe(`SLA escalation configuration for pending approval steps`),onSubmit:C(o5).optional().describe(`Actions on initial submission`),onFinalApprove:C(o5).optional().describe(`Actions on final approval`),onFinalReject:C(o5).optional().describe(`Actions on final rejection`),onRecall:C(o5).optional().describe(`Actions on recall`)});Object.assign(EKe,{create:e=>e});var DKe=E([`database`,`api`,`file`,`stream`,`object`,`warehouse`,`storage`,`spreadsheet`]),OKe=h({type:DKe.describe(`Source type`),connector:r().optional().describe(`Connector ID`),config:d(r(),u()).describe(`Source configuration`),incremental:h({enabled:S().default(!1),cursorField:r().describe(`Field to track progress (e.g., updated_at)`),cursorValue:u().optional().describe(`Last processed value`)}).optional().describe(`Incremental extraction config`)}),kKe=h({type:DKe.describe(`Destination type`),connector:r().optional().describe(`Connector ID`),config:d(r(),u()).describe(`Destination configuration`),writeMode:E([`append`,`overwrite`,`upsert`,`merge`]).default(`append`).describe(`How to write data`),primaryKey:C(r()).optional().describe(`Primary key fields`)}),AKe=E([`map`,`filter`,`aggregate`,`join`,`script`,`lookup`,`split`,`merge`,`normalize`,`deduplicate`]),jKe=h({name:r().optional().describe(`Transformation name`),type:AKe.describe(`Transformation type`),config:d(r(),u()).describe(`Transformation config`),continueOnError:S().default(!1).describe(`Continue on error`)}),MKe=E([`full`,`incremental`,`cdc`]);h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Pipeline identifier (snake_case)`),label:r().optional().describe(`Pipeline display name`),description:r().optional().describe(`Pipeline description`),source:OKe.describe(`Data source`),destination:kKe.describe(`Data destination`),transformations:C(jKe).optional().describe(`Transformation pipeline`),syncMode:MKe.default(`full`).describe(`Sync mode`),schedule:r().optional().describe(`Cron schedule expression`),enabled:S().default(!0).describe(`Pipeline enabled status`),retry:h({maxAttempts:P().int().min(0).default(3).describe(`Max retry attempts`),backoffMs:P().int().min(0).default(6e4).describe(`Backoff in milliseconds`)}).optional().describe(`Retry configuration`),notifications:h({onSuccess:C(r()).optional().describe(`Email addresses for success notifications`),onFailure:C(r()).optional().describe(`Email addresses for failure notifications`)}).optional().describe(`Notification settings`),tags:C(r()).optional().describe(`Pipeline tags`),metadata:d(r(),u()).optional().describe(`Custom metadata`)});var NKe=E([`pending`,`running`,`succeeded`,`failed`,`cancelled`,`timeout`]);h({id:r().describe(`Run identifier`),pipelineName:r().describe(`Pipeline name`),status:NKe.describe(`Run status`),startedAt:r().datetime().describe(`Start time`),completedAt:r().datetime().optional().describe(`Completion time`),durationMs:P().optional().describe(`Duration in ms`),stats:h({recordsRead:P().int().default(0).describe(`Records extracted`),recordsWritten:P().int().default(0).describe(`Records loaded`),recordsErrored:P().int().default(0).describe(`Records with errors`),bytesProcessed:P().int().default(0).describe(`Bytes processed`)}).optional().describe(`Run statistics`),error:h({message:r().describe(`Error message`),code:r().optional().describe(`Error code`),details:u().optional().describe(`Error details`)}).optional().describe(`Error information`),logs:C(r()).optional().describe(`Execution logs`)});var PKe=E([`crm`,`payment`,`communication`,`storage`,`analytics`,`database`,`marketing`,`accounting`,`hr`,`productivity`,`ecommerce`,`support`,`devtools`,`social`,`other`]),FKe=E([`none`,`apiKey`,`basic`,`bearer`,`oauth1`,`oauth2`,`custom`]),IKe=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Field name (snake_case)`),label:r().describe(`Field label`),type:E([`text`,`password`,`url`,`select`]).default(`text`).describe(`Field type`),description:r().optional().describe(`Field description`),required:S().default(!0).describe(`Required field`),default:r().optional().describe(`Default value`),options:C(h({label:r(),value:r()})).optional().describe(`Select field options`),placeholder:r().optional().describe(`Placeholder text`)}),LKe=h({authorizationUrl:r().url().describe(`Authorization endpoint URL`),tokenUrl:r().url().describe(`Token endpoint URL`),scopes:C(r()).optional().describe(`OAuth scopes`),clientIdField:r().default(`client_id`).describe(`Client ID field name`),clientSecretField:r().default(`client_secret`).describe(`Client secret field name`)}),RKe=h({type:FKe.describe(`Authentication type`),fields:C(IKe).optional().describe(`Authentication fields`),oauth2:LKe.optional().describe(`OAuth 2.0 configuration`),test:h({url:r().optional().describe(`Test endpoint URL`),method:E([`GET`,`POST`,`PUT`,`DELETE`]).default(`GET`).describe(`HTTP method`)}).optional().describe(`Authentication test configuration`)}),zKe=E([`read`,`write`,`delete`,`search`,`trigger`,`action`]),BKe=h({name:r().describe(`Parameter name`),label:r().describe(`Parameter label`),description:r().optional().describe(`Parameter description`),type:E([`string`,`number`,`boolean`,`array`,`object`,`date`,`file`]).describe(`Parameter type`),required:S().default(!1).describe(`Required parameter`),default:u().optional().describe(`Default value`),validation:d(r(),u()).optional().describe(`Validation rules`),dynamicOptions:r().optional().describe(`Function to load dynamic options`)}),VKe=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Operation ID (snake_case)`),name:r().describe(`Operation name`),description:r().optional().describe(`Operation description`),type:zKe.describe(`Operation type`),inputSchema:C(BKe).optional().describe(`Input parameters`),outputSchema:d(r(),u()).optional().describe(`Output schema`),sampleOutput:u().optional().describe(`Sample output`),supportsPagination:S().default(!1).describe(`Supports pagination`),supportsFiltering:S().default(!1).describe(`Supports filtering`)}),HKe=h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Trigger ID (snake_case)`),name:r().describe(`Trigger name`),description:r().optional().describe(`Trigger description`),type:E([`webhook`,`polling`,`stream`]).describe(`Trigger mechanism`),config:d(r(),u()).optional().describe(`Trigger configuration`),outputSchema:d(r(),u()).optional().describe(`Event payload schema`),pollingIntervalMs:P().int().min(1e3).optional().describe(`Polling interval in ms`)});h({id:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Connector ID (snake_case)`),name:r().describe(`Connector name`),description:r().optional().describe(`Connector description`),version:r().optional().describe(`Connector version`),icon:r().optional().describe(`Connector icon`),category:PKe.describe(`Connector category`),baseUrl:r().url().optional().describe(`API base URL`),authentication:RKe.describe(`Authentication config`),operations:C(VKe).optional().describe(`Connector operations`),triggers:C(HKe).optional().describe(`Connector triggers`),rateLimit:h({requestsPerSecond:P().optional().describe(`Max requests per second`),requestsPerMinute:P().optional().describe(`Max requests per minute`),requestsPerHour:P().optional().describe(`Max requests per hour`)}).optional().describe(`Rate limiting`),author:r().optional().describe(`Connector author`),documentation:r().url().optional().describe(`Documentation URL`),homepage:r().url().optional().describe(`Homepage URL`),license:r().optional().describe(`License (SPDX identifier)`),tags:C(r()).optional().describe(`Connector tags`),verified:S().default(!1).describe(`Verified connector`),metadata:d(r(),u()).optional().describe(`Custom metadata`)}),h({id:r().describe(`Instance ID`),connectorId:r().describe(`Connector ID`),name:r().describe(`Instance name`),description:r().optional().describe(`Instance description`),credentials:d(r(),u()).describe(`Encrypted credentials`),config:d(r(),u()).optional().describe(`Additional config`),active:S().default(!0).describe(`Instance active status`),createdAt:r().datetime().optional().describe(`Creation time`),lastTestedAt:r().datetime().optional().describe(`Last test time`),testStatus:E([`unknown`,`success`,`failed`]).default(`unknown`).describe(`Connection test status`)});var UKe=I(`type`,[h({type:m(`constant`),value:u().describe(`Constant value to use`)}).describe(`Set a constant value`),h({type:m(`cast`),targetType:E([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),h({type:m(`lookup`),table:r().describe(`Lookup table name`),keyField:r().describe(`Field to match on`),valueField:r().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),h({type:m(`javascript`),expression:r().describe(`JavaScript expression (e.g., "value.toUpperCase()")`)}).describe(`Custom JavaScript transformation`),h({type:m(`map`),mappings:d(r(),u()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)]),WKe=h({source:r().describe(`Source field name`),target:r().describe(`Target field name`),transform:UKe.optional().describe(`Transformation to apply`),defaultValue:u().optional().describe(`Default if source is null/undefined`)}),GKe=E([`push`,`pull`,`bidirectional`]),KKe=E([`full`,`incremental`,`realtime`]),qKe=E([`source_wins`,`destination_wins`,`latest_wins`,`manual`,`merge`]),JKe=h({object:r().optional().describe(`ObjectStack object name`),filters:u().optional().describe(`Filter conditions`),fields:C(r()).optional().describe(`Fields to sync`),connectorInstanceId:r().optional().describe(`Connector instance ID`),externalResource:r().optional().describe(`External resource ID`)}),YKe=h({object:r().optional().describe(`ObjectStack object name`),connectorInstanceId:r().optional().describe(`Connector instance ID`),operation:E([`insert`,`update`,`upsert`,`delete`,`sync`]).describe(`Sync operation`),mapping:l([d(r(),r()),C(WKe)]).optional().describe(`Field mappings`),externalResource:r().optional().describe(`External resource ID`),matchKey:C(r()).optional().describe(`Match key fields`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Sync configuration name (snake_case)`),label:r().optional().describe(`Sync display name`),description:r().optional().describe(`Sync description`),source:JKe.describe(`Data source`),destination:YKe.describe(`Data destination`),direction:GKe.default(`push`).describe(`Sync direction`),syncMode:KKe.default(`incremental`).describe(`Sync mode`),conflictResolution:qKe.default(`latest_wins`).describe(`Conflict resolution`),schedule:r().optional().describe(`Cron schedule`),enabled:S().default(!0).describe(`Sync enabled`),changeTrackingField:r().optional().describe(`Field for change tracking`),batchSize:P().int().min(1).max(1e4).default(100).describe(`Batch size for processing`),retry:h({maxAttempts:P().int().min(0).default(3).describe(`Max retries`),backoffMs:P().int().min(0).default(3e4).describe(`Backoff duration`)}).optional().describe(`Retry configuration`),validation:h({required:C(r()).optional().describe(`Required fields`),unique:C(r()).optional().describe(`Unique constraint fields`),custom:C(h({name:r(),condition:r().describe(`Validation condition`),message:r().describe(`Error message`)})).optional().describe(`Custom validation rules`)}).optional().describe(`Validation rules`),errorHandling:h({onValidationError:E([`skip`,`fail`,`log`]).default(`skip`),onSyncError:E([`skip`,`fail`,`retry`]).default(`retry`),notifyOnError:C(r()).optional().describe(`Email notifications`)}).optional().describe(`Error handling`),optimization:h({parallelBatches:S().default(!1).describe(`Process batches in parallel`),cacheEnabled:S().default(!0).describe(`Enable caching`),compressionEnabled:S().default(!1).describe(`Enable compression`)}).optional().describe(`Performance optimization`),audit:h({logLevel:E([`none`,`error`,`warn`,`info`,`debug`]).default(`info`),retainLogsForDays:P().int().min(1).default(30),trackChanges:S().default(!0).describe(`Track all changes`)}).optional().describe(`Audit configuration`),tags:C(r()).optional().describe(`Sync tags`),metadata:d(r(),u()).optional().describe(`Custom metadata`)});var XKe=E([`pending`,`running`,`completed`,`partial`,`failed`,`cancelled`]);h({id:r().describe(`Execution ID`),syncName:r().describe(`Sync name`),status:XKe.describe(`Execution status`),startedAt:r().datetime().describe(`Start time`),completedAt:r().datetime().optional().describe(`Completion time`),durationMs:P().optional().describe(`Duration in ms`),stats:h({recordsProcessed:P().int().default(0).describe(`Total records processed`),recordsInserted:P().int().default(0).describe(`Records inserted`),recordsUpdated:P().int().default(0).describe(`Records updated`),recordsDeleted:P().int().default(0).describe(`Records deleted`),recordsSkipped:P().int().default(0).describe(`Records skipped`),recordsErrored:P().int().default(0).describe(`Records with errors`),conflictsDetected:P().int().default(0).describe(`Conflicts detected`),conflictsResolved:P().int().default(0).describe(`Conflicts resolved`)}).optional().describe(`Execution statistics`),errors:C(h({recordId:r().optional().describe(`Record ID`),field:r().optional().describe(`Field name`),message:r().describe(`Error message`),code:r().optional().describe(`Error code`)})).optional().describe(`Errors`),logs:C(r()).optional().describe(`Execution logs`)});var s5=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),ZKe=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),c5=h({target:r().optional().describe(`Target State ID`),cond:ZKe.optional().describe(`Condition (Guard) required to take this path`),actions:C(s5).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)});h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)});var QKe=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(s5).optional().describe(`Actions to run when entering this state`),exit:C(s5).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),c5,C(c5)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(c5).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),QKe).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()}));h({id:a5.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),QKe).describe(`State Nodes`),on:d(r(),l([r(),c5,C(c5)])).optional()});var $Ke=E([`timer`,`signal`,`webhook`,`manual`,`condition`]).describe(`Wait event type determining how a paused flow is resumed`);h({executionId:r().describe(`Execution ID of the paused flow`),checkpointId:r().describe(`Checkpoint ID to resume from`),nodeId:r().describe(`Wait node ID being resumed`),eventType:$Ke.describe(`Event type that triggered resume`),signalName:r().optional().describe(`Signal name (when eventType is signal)`),webhookPayload:d(r(),u()).optional().describe(`Webhook request payload (when eventType is webhook)`),resumedBy:r().optional().describe(`User ID or system identifier that triggered resume`),resumedAt:r().datetime().describe(`ISO 8601 timestamp of the resume event`),variables:d(r(),u()).optional().describe(`Variables to merge into flow context upon resume`)}).describe(`Payload for resuming a paused wait node`);var eqe=E([`fail`,`continue`,`fallback`]).describe(`Behavior when a wait node exceeds its timeout`);h({defaultTimeoutMs:P().int().min(0).default(864e5).describe(`Default timeout in ms (default: 24 hours)`),defaultTimeoutBehavior:eqe.default(`fail`).describe(`Default behavior when wait timeout is exceeded`),conditionPollIntervalMs:P().int().min(1e3).default(3e4).describe(`Polling interval for condition waits in ms (default: 30s)`),conditionMaxPolls:P().int().min(0).default(0).describe(`Max polling attempts for condition waits (0 = unlimited)`),webhookUrlPattern:r().default(`/api/v1/automation/resume/{executionId}/{nodeId}`).describe(`URL pattern for webhook resume endpoints`),persistCheckpoints:S().default(!0).describe(`Persist wait checkpoints to durable storage`),maxPausedExecutions:P().int().min(0).default(0).describe(`Max concurrent paused executions (0 = unlimited)`)}).describe(`Wait node executor plugin configuration`),h({id:r().describe(`Unique executor plugin identifier`),name:r().describe(`Display name`),nodeTypes:C(r()).min(1).describe(`FlowNodeAction types this executor handles`),version:r().describe(`Plugin version (semver)`),description:r().optional().describe(`Executor description`),supportsPause:S().default(!1).describe(`Whether the executor supports async pause/resume`),supportsCancellation:S().default(!1).describe(`Whether the executor supports mid-execution cancellation`),supportsRetry:S().default(!0).describe(`Whether the executor supports retry on failure`),configSchemaRef:r().optional().describe(`JSON Schema $ref for executor-specific config`)}).describe(`Node executor plugin descriptor`);var tqe=h({bpmnType:r().describe(`BPMN XML element type (e.g., "bpmn:parallelGateway")`),flowNodeAction:r().describe(`ObjectStack FlowNodeAction value`),bidirectional:S().default(!0).describe(`Whether the mapping supports both import and export`),notes:r().optional().describe(`Notes about mapping limitations`)}).describe(`Mapping between BPMN XML element and ObjectStack FlowNodeAction`);h({unmappedStrategy:E([`skip`,`warn`,`error`,`comment`]).describe(`Strategy for unmapped BPMN elements during import`).default(`warn`).describe(`How to handle unmapped BPMN elements`),customMappings:C(tqe).optional().describe(`Custom element mappings to override or extend defaults`),importLayout:S().default(!0).describe(`Import BPMN DI layout positions into canvas node coordinates`),importDocumentation:S().default(!0).describe(`Import BPMN documentation elements as node descriptions`),flowName:r().optional().describe(`Override flow name (defaults to BPMN process name)`),validateAfterImport:S().default(!0).describe(`Validate imported flow against FlowSchema after import`)}).describe(`Options for importing BPMN 2.0 XML into an ObjectStack flow`),h({version:E([`2.0`,`2.0.2`]).describe(`BPMN specification version for export`).default(`2.0`).describe(`Target BPMN specification version`),includeLayout:S().default(!0).describe(`Include BPMN DI layout data from canvas positions`),includeExtensions:S().default(!1).describe(`Include ObjectStack extensions in BPMN extensionElements`),customMappings:C(tqe).optional().describe(`Custom element mappings for export`),prettyPrint:S().default(!0).describe(`Pretty-print XML output with indentation`),namespacePrefix:r().default(`bpmn`).describe(`XML namespace prefix for BPMN elements`)}).describe(`Options for exporting an ObjectStack flow as BPMN 2.0 XML`);var nqe=h({severity:E([`info`,`warning`,`error`]).describe(`Diagnostic severity`),message:r().describe(`Diagnostic message`),bpmnElementId:r().optional().describe(`BPMN element ID related to this diagnostic`),nodeId:r().optional().describe(`ObjectStack node ID related to this diagnostic`)}).describe(`Diagnostic message from BPMN import/export`);h({success:S().describe(`Whether the operation completed successfully`),diagnostics:C(nqe).default([]).describe(`Diagnostic messages from the operation`),mappedCount:P().int().min(0).default(0).describe(`Number of elements successfully mapped`),unmappedCount:P().int().min(0).default(0).describe(`Number of elements that could not be mapped`)}).describe(`Result of a BPMN import/export operation`);var rqe=class{constructor(e){this.flows=new Map,this.flowEnabled=new Map,this.flowVersionHistory=new Map,this.nodeExecutors=new Map,this.triggers=new Map,this.executionLogs=[],this.maxLogSize=1e3,this.runCounter=0,this.logger=e}registerNodeExecutor(e){this.nodeExecutors.has(e.type)&&this.logger.warn(`Node executor '${e.type}' replaced`),this.nodeExecutors.set(e.type,e),this.logger.info(`Node executor registered: ${e.type}`)}unregisterNodeExecutor(e){this.nodeExecutors.delete(e),this.logger.info(`Node executor unregistered: ${e}`)}registerTrigger(e){this.triggers.set(e.type,e),this.logger.info(`Trigger registered: ${e.type}`)}unregisterTrigger(e){this.triggers.delete(e),this.logger.info(`Trigger unregistered: ${e}`)}getRegisteredNodeTypes(){return[...this.nodeExecutors.keys()]}getRegisteredTriggerTypes(){return[...this.triggers.keys()]}registerFlow(e,t){let n=yKe.parse(t);this.detectCycles(n);let r=this.flowVersionHistory.get(e)??[];r.push({version:n.version,definition:n,createdAt:new Date().toISOString()}),this.flowVersionHistory.set(e,r),this.flows.set(e,n),this.flowEnabled.has(e)||this.flowEnabled.set(e,!0),this.logger.info(`Flow registered: ${e} (version ${n.version})`)}unregisterFlow(e){this.flows.delete(e),this.flowEnabled.delete(e),this.flowVersionHistory.delete(e),this.logger.info(`Flow unregistered: ${e}`)}async listFlows(){return[...this.flows.keys()]}async getFlow(e){return this.flows.get(e)??null}async toggleFlow(e,t){if(!this.flows.has(e))throw Error(`Flow '${e}' not found`);this.flowEnabled.set(e,t),this.logger.info(`Flow '${e}' ${t?`enabled`:`disabled`}`)}getFlowVersionHistory(e){return this.flowVersionHistory.get(e)??[]}rollbackFlow(e,t){let n=this.flowVersionHistory.get(e);if(!n)throw Error(`Flow '${e}' has no version history`);let r=n.find(e=>e.version===t);if(!r)throw Error(`Version ${t} not found for flow '${e}'`);this.flows.set(e,r.definition),this.logger.info(`Flow '${e}' rolled back to version ${t}`)}async listRuns(e,t){let n=t?.limit??20;return this.executionLogs.filter(t=>t.flowName===e).slice(-n).reverse()}async getRun(e){return this.executionLogs.find(t=>t.id===e)??null}async execute(e,t){let n=Date.now(),r=this.flows.get(e);if(!r)return{success:!1,error:`Flow '${e}' not found`};if(this.flowEnabled.get(e)===!1)return{success:!1,error:`Flow '${e}' is disabled`};let i=new Map;if(r.variables)for(let e of r.variables)e.isInput&&t?.params?.[e.name]!==void 0&&i.set(e.name,t.params[e.name]);t?.record&&i.set(`$record`,t.record);let a=`run_${++this.runCounter}`,o=new Date().toISOString(),s=[];try{let c=r.nodes.find(e=>e.type===`start`);if(!c)return{success:!1,error:`Flow has no start node`};this.validateNodeInputSchemas(r,i),await this.executeNode(c,r,i,t??{},s);let l={};if(r.variables)for(let e of r.variables)e.isOutput&&(l[e.name]=i.get(e.name));let u=Date.now()-n;return this.recordLog({id:a,flowName:e,flowVersion:r.version,status:`completed`,startedAt:o,completedAt:new Date().toISOString(),durationMs:u,trigger:{type:t?.event??`manual`,userId:t?.userId,object:t?.object},steps:s,output:l}),{success:!0,output:l,durationMs:u}}catch(i){let c=i instanceof Error?i.message:String(i),l=Date.now()-n;return this.recordLog({id:a,flowName:e,flowVersion:r.version,status:`failed`,startedAt:o,completedAt:new Date().toISOString(),durationMs:l,trigger:{type:t?.event??`manual`,userId:t?.userId,object:t?.object},steps:s,error:c}),r.errorHandling?.strategy===`retry`?this.retryExecution(e,t,n,r.errorHandling):{success:!1,error:c,durationMs:l}}}recordLog(e){this.executionLogs.push(e),this.executionLogs.length>this.maxLogSize&&this.executionLogs.splice(0,this.executionLogs.length-this.maxLogSize)}detectCycles(e){let t=new Map,n=new Map,r=new Map;for(let n of e.nodes)t.set(n.id,0),r.set(n.id,[]);for(let t of e.edges){let e=r.get(t.source);e&&e.push(t.target)}let i=e=>{t.set(e,1);for(let a of r.get(e)??[]){if(t.get(a)===1){let t=[a,e],r=e;for(;r!==a&&(r=n.get(r),r);)t.push(r);return t.reverse()}if(t.get(a)===0){n.set(a,e);let t=i(a);if(t)return t}}return t.set(e,2),null};for(let n of e.nodes)if(t.get(n.id)===0){let e=i(n.id);if(e)throw Error(`Flow contains a cycle: ${e.join(` → `)}. Only DAG flows are allowed.`)}}getValueType(e){return Array.isArray(e)?`array`:typeof e==`object`&&e?`object`:typeof e}validateNodeInputSchemas(e,t){for(let t of e.nodes)if(t.inputSchema&&t.config)for(let[e,n]of Object.entries(t.inputSchema)){if(n.required&&!(e in t.config))throw Error(`Node '${t.id}' missing required input parameter '${e}'`);let r=t.config[e];if(r!==void 0){let i=this.getValueType(r);if(i!==n.type)throw Error(`Node '${t.id}' parameter '${e}' expected type '${n.type}' but got '${i}'`)}}}async executeNode(e,t,n,r,i){if(e.type===`end`)return;let a=Date.now(),o=new Date().toISOString(),s=this.nodeExecutors.get(e.type);if(s){let c;try{c=e.timeoutMs&&e.timeoutMs>0?await this.executeWithTimeout(s.execute(e,n,r),e.timeoutMs,e.id):await s.execute(e,n,r)}catch(s){let c=s instanceof Error?s.message:String(s);i.push({nodeId:e.id,nodeType:e.type,status:`failure`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a,error:{code:`EXECUTION_ERROR`,message:c}});let l=t.edges.find(t=>t.source===e.id&&t.type===`fault`);if(l){n.set(`$error`,{nodeId:e.id,message:c});let a=t.nodes.find(e=>e.id===l.target);if(a){await this.executeNode(a,t,n,r,i);return}}throw s}if(!c.success){let s=c.error??`Unknown error`;i.push({nodeId:e.id,nodeType:e.type,status:`failure`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a,error:{code:`NODE_FAILURE`,message:s}}),n.set(`$error`,{nodeId:e.id,message:s,output:c.output});let l=t.edges.find(t=>t.source===e.id&&t.type===`fault`);if(l){let e=t.nodes.find(e=>e.id===l.target);if(e){await this.executeNode(e,t,n,r,i);return}}throw Error(`Node '${e.id}' failed: ${s}`)}if(i.push({nodeId:e.id,nodeType:e.type,status:`success`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a}),c.output)for(let[t,r]of Object.entries(c.output))n.set(`${e.id}.${t}`,r)}else{if(e.type!==`start`)throw i.push({nodeId:e.id,nodeType:e.type,status:`failure`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a,error:{code:`NO_EXECUTOR`,message:`No executor registered for node type '${e.type}'`}}),Error(`No executor registered for node type '${e.type}'`);i.push({nodeId:e.id,nodeType:e.type,status:`success`,startedAt:o,completedAt:new Date().toISOString(),durationMs:Date.now()-a})}let c=t.edges.filter(t=>t.source===e.id&&t.type!==`fault`),l=[],u=[];for(let e of c)e.condition?l.push(e):u.push(e);for(let e of l)if(this.evaluateCondition(e.condition,n)){let a=t.nodes.find(t=>t.id===e.target);a&&await this.executeNode(a,t,n,r,i)}if(u.length>0){let e=u.map(e=>t.nodes.find(t=>t.id===e.target)).filter(e=>e!=null).map(e=>this.executeNode(e,t,n,r,i));await Promise.all(e)}}executeWithTimeout(e,t,n){return Promise.race([e,new Promise((e,r)=>setTimeout(()=>r(Error(`Node '${n}' timed out after ${t}ms`)),t))])}evaluateCondition(e,t){let n=e;for(let[e,r]of t)n=n.split(`{${e}}`).join(String(r));n=n.trim();try{if(n===`true`)return!0;if(n===`false`)return!1;for(let e of[`===`,`!==`,`>=`,`<=`,`!=`,`==`,`>`,`<`]){let t=n.indexOf(e);if(t!==-1){let r=n.slice(0,t).trim(),i=n.slice(t+e.length).trim();return this.compareValues(r,e,i)}}let e=Number(n);return isNaN(e)?!1:e!==0}catch{return!1}}compareValues(e,t,n){let r=Number(e),i=Number(n);if(!isNaN(r)&&!isNaN(i)&&e!==``&&n!==``)switch(t){case`>`:return r>i;case`<`:return r=`:return r>=i;case`<=`:return r<=i;case`==`:case`===`:return r===i;case`!=`:case`!==`:return r!==i;default:return!1}switch(t){case`==`:case`===`:return e===n;case`!=`:case`!==`:return e!==n;case`>`:return e>n;case`<`:return e=`:return e>=n;case`<=`:return e<=n;default:return!1}}async retryExecution(e,t,n,r){let i=r.maxRetries??3,a=r.retryDelayMs??1e3,o=r.backoffMultiplier??1,s=r.maxRetryDelayMs??3e4,c=r.jitter??!1,l=`Max retries exceeded`;for(let n=0;nsetTimeout(e,r));let i=await this.executeWithoutRetry(e,t);if(i.success)return i;l=i.error??`Unknown error`}return{success:!1,error:l,durationMs:Date.now()-n}}async executeWithoutRetry(e,t){let n=Date.now(),r=this.flows.get(e);if(!r)return{success:!1,error:`Flow '${e}' not found`};if(this.flowEnabled.get(e)===!1)return{success:!1,error:`Flow '${e}' is disabled`};let i=new Map;if(r.variables)for(let e of r.variables)e.isInput&&t?.params?.[e.name]!==void 0&&i.set(e.name,t.params[e.name]);t?.record&&i.set(`$record`,t.record);let a=`run_${++this.runCounter}`,o=new Date().toISOString(),s=[];try{let c=r.nodes.find(e=>e.type===`start`);if(!c)return{success:!1,error:`Flow has no start node`};await this.executeNode(c,r,i,t??{},s);let l={};if(r.variables)for(let e of r.variables)e.isOutput&&(l[e.name]=i.get(e.name));let u=Date.now()-n;return this.recordLog({id:a,flowName:e,flowVersion:r.version,status:`completed`,startedAt:o,completedAt:new Date().toISOString(),durationMs:u,trigger:{type:t?.event??`manual`,userId:t?.userId,object:t?.object},steps:s,output:l}),{success:!0,output:l,durationMs:u}}catch(i){let c=i instanceof Error?i.message:String(i),l=Date.now()-n;return this.recordLog({id:a,flowName:e,flowVersion:r.version,status:`failed`,startedAt:o,completedAt:new Date().toISOString(),durationMs:l,trigger:{type:t?.event??`manual`,userId:t?.userId,object:t?.object},steps:s,error:c}),{success:!1,error:c,durationMs:l}}}},iqe=class{constructor(e={}){this.name=`com.objectstack.service-automation`,this.version=`1.0.0`,this.type=`standard`,this.dependencies=[],this.options=e}async init(e){this.engine=new rqe(e.logger),e.registerService(`automation`,this.engine),this.options.debug&&e.hook(`automation:beforeExecute`,async t=>{e.logger.debug(`[Automation] Before execute: ${t}`)}),e.logger.info(`[Automation] Engine initialized`)}async start(e){if(!this.engine)return;await e.trigger(`automation:ready`,this.engine);let t=this.engine.getRegisteredNodeTypes();e.logger.info(`[Automation] Engine started with ${t.length} node types: ${t.join(`, `)||`(none)`}`)}async destroy(){this.engine=void 0}},aqe=class{constructor(){this.cubes=new Map}register(e){this.cubes.set(e.name,e)}registerAll(e){for(let t of e)this.register(t)}get(e){return this.cubes.get(e)}has(e){return this.cubes.has(e)}getAll(){return Array.from(this.cubes.values())}names(){return Array.from(this.cubes.keys())}get size(){return this.cubes.size}clear(){this.cubes.clear()}inferFromObject(e,t){let n={count:{name:`count`,label:`Count`,type:`count`,sql:`*`}},r={};for(let e of t){let t=e.label||e.name,i=this.fieldTypeToDimensionType(e.type);r[e.name]={name:e.name,label:t,type:i,sql:e.name,...i===`time`?{granularities:[`day`,`week`,`month`,`quarter`,`year`]}:{}},(e.type===`number`||e.type===`currency`||e.type===`percent`)&&(n[`${e.name}_sum`]={name:`${e.name}_sum`,label:`${t} (Sum)`,type:`sum`,sql:e.name},n[`${e.name}_avg`]={name:`${e.name}_avg`,label:`${t} (Avg)`,type:`avg`,sql:e.name})}let i={name:e,title:e,sql:e,measures:n,dimensions:r,public:!1};return this.register(i),i}fieldTypeToDimensionType(e){switch(e){case`number`:case`currency`:case`percent`:return`number`;case`boolean`:return`boolean`;case`date`:case`datetime`:return`time`;default:return`string`}}},oqe=class{constructor(){this.name=`NativeSQLStrategy`,this.priority=10}canHandle(e,t){return e.cube?t.queryCapabilities(e.cube).nativeSql&&typeof t.executeRawSql==`function`:!1}async execute(e,t){let{sql:n,params:r}=await this.generateSql(e,t),i=t.getCube(e.cube),a=this.extractObjectName(i);return{rows:await t.executeRawSql(a,n,r),fields:this.buildFieldMeta(e,i),sql:n}}async generateSql(e,t){let n=t.getCube(e.cube);if(!n)throw Error(`Cube not found: ${e.cube}`);let r=[],i=[],a=[];if(e.dimensions&&e.dimensions.length>0)for(let t of e.dimensions){let e=this.resolveDimensionSql(n,t);i.push(`${e} AS "${t}"`),a.push(e)}if(e.measures&&e.measures.length>0)for(let t of e.measures){let e=this.resolveMeasureSql(n,t);i.push(`${e} AS "${t}"`)}let o=[];if(e.filters&&e.filters.length>0)for(let t of e.filters){let e=this.resolveFieldSql(n,t.member),i=this.buildFilterClause(e,t.operator,t.values,r);i&&o.push(i)}if(e.timeDimensions&&e.timeDimensions.length>0)for(let t of e.timeDimensions){let e=this.resolveFieldSql(n,t.dimension);if(t.dateRange){let n=Array.isArray(t.dateRange)?t.dateRange:[t.dateRange,t.dateRange];n.length===2&&(r.push(n[0],n[1]),o.push(`${e} BETWEEN $${r.length-1} AND $${r.length}`))}}let s=this.extractObjectName(n),c=`SELECT ${i.join(`, `)} FROM "${s}"`;if(o.length>0&&(c+=` WHERE ${o.join(` AND `)}`),a.length>0&&(c+=` GROUP BY ${a.join(`, `)}`),e.order&&Object.keys(e.order).length>0){let t=Object.entries(e.order).map(([e,t])=>`"${e}" ${t.toUpperCase()}`);c+=` ORDER BY ${t.join(`, `)}`}return e.limit!=null&&(c+=` LIMIT ${e.limit}`),e.offset!=null&&(c+=` OFFSET ${e.offset}`),{sql:c,params:r}}resolveDimensionSql(e,t){let n=t.includes(`.`)?t.split(`.`)[1]:t,r=e.dimensions[n];return r?r.sql:n}resolveMeasureSql(e,t){let n=t.includes(`.`)?t.split(`.`)[1]:t,r=e.measures[n];if(!r)return`COUNT(*)`;let i=r.sql;switch(r.type){case`count`:return`COUNT(*)`;case`sum`:return`SUM(${i})`;case`avg`:return`AVG(${i})`;case`min`:return`MIN(${i})`;case`max`:return`MAX(${i})`;case`count_distinct`:return`COUNT(DISTINCT ${i})`;default:return`COUNT(*)`}}resolveFieldSql(e,t){let n=t.includes(`.`)?t.split(`.`)[1]:t,r=e.dimensions[n];if(r)return r.sql;let i=e.measures[n];return i?i.sql:n}buildFilterClause(e,t,n,r){let i={equals:`=`,notEquals:`!=`,gt:`>`,gte:`>=`,lt:`<`,lte:`<=`,contains:`LIKE`,notContains:`NOT LIKE`};if(t===`set`)return`${e} IS NOT NULL`;if(t===`notSet`)return`${e} IS NULL`;let a=i[t];return!a||!n||n.length===0?null:(t===`contains`||t===`notContains`?r.push(`%${n[0]}%`):r.push(n[0]),`${e} ${a} $${r.length}`)}extractObjectName(e){return e.sql.trim()}buildFieldMeta(e,t){let n=[];if(e.dimensions)for(let r of e.dimensions){let e=r.includes(`.`)?r.split(`.`)[1]:r,i=t.dimensions[e];n.push({name:r,type:i?.type||`string`})}if(e.measures)for(let t of e.measures)n.push({name:t,type:`number`});return n}},sqe=class{constructor(){this.name=`ObjectQLStrategy`,this.priority=20}canHandle(e,t){return e.cube?t.queryCapabilities(e.cube).objectqlAggregate&&typeof t.executeAggregate==`function`:!1}async execute(e,t){let n=t.getCube(e.cube),r=this.extractObjectName(n),i=[];if(e.dimensions&&e.dimensions.length>0)for(let t of e.dimensions)i.push(this.resolveFieldName(n,t,`dimension`));let a=[];if(e.measures&&e.measures.length>0)for(let t of e.measures){let{field:e,method:r}=this.resolveMeasureAggregation(n,t);a.push({field:e,method:r,alias:t})}let o={};if(e.filters&&e.filters.length>0)for(let t of e.filters){let e=this.resolveFieldName(n,t.member,`any`);o[e]=this.convertFilter(t.operator,t.values)}return{rows:(await t.executeAggregate(r,{groupBy:i.length>0?i:void 0,aggregations:a.length>0?a:void 0,filter:Object.keys(o).length>0?o:void 0})).map(t=>{let r={};if(e.dimensions)for(let i of e.dimensions){let e=this.resolveFieldName(n,i,`dimension`);e in t&&(r[i]=t[e])}if(e.measures)for(let n of e.measures)n in t&&(r[n]=t[n]);return r}),fields:this.buildFieldMeta(e,n)}}async generateSql(e,t){let n=t.getCube(e.cube);if(!n)throw Error(`Cube not found: ${e.cube}`);let r=[],i=[];if(e.dimensions)for(let t of e.dimensions){let e=this.resolveFieldName(n,t,`dimension`);r.push(`${e} AS "${t}"`),i.push(e)}if(e.measures)for(let t of e.measures){let{field:e,method:i}=this.resolveMeasureAggregation(n,t),a=i===`count`?`COUNT(*)`:`${i.toUpperCase()}(${e})`;r.push(`${a} AS "${t}"`)}let a=this.extractObjectName(n),o=`SELECT ${r.join(`, `)} FROM "${a}"`;return i.length>0&&(o+=` GROUP BY ${i.join(`, `)}`),{sql:o,params:[]}}resolveFieldName(e,t,n){let r=t.includes(`.`)?t.split(`.`)[1]:t;if(n===`dimension`||n===`any`){let t=e.dimensions[r];if(t)return t.sql.replace(/^\$/,``)}if(n===`measure`||n===`any`){let t=e.measures[r];if(t)return t.sql.replace(/^\$/,``)}return r}resolveMeasureAggregation(e,t){let n=t.includes(`.`)?t.split(`.`)[1]:t,r=e.measures[n];return r?{field:r.sql.replace(/^\$/,``),method:r.type===`count_distinct`?`count_distinct`:r.type}:{field:`*`,method:`count`}}convertFilter(e,t){if(e===`set`)return{$ne:null};if(e===`notSet`)return null;if(!(!t||t.length===0))switch(e){case`equals`:return t[0];case`notEquals`:return{$ne:t[0]};case`gt`:return{$gt:t[0]};case`gte`:return{$gte:t[0]};case`lt`:return{$lt:t[0]};case`lte`:return{$lte:t[0]};case`contains`:return{$regex:t[0]};default:return t[0]}}extractObjectName(e){return e.sql.trim()}buildFieldMeta(e,t){let n=[];if(e.dimensions)for(let r of e.dimensions){let e=r.includes(`.`)?r.split(`.`)[1]:r,i=t.dimensions[e];n.push({name:r,type:i?.type||`string`})}if(e.measures)for(let t of e.measures)n.push({name:t,type:`number`});return n}},cqe={nativeSql:!1,objectqlAggregate:!1,inMemory:!0},lqe=class{constructor(e={}){this.logger=e.logger||$f({level:`info`,format:`pretty`}),this.cubeRegistry=new aqe,e.cubes&&this.cubeRegistry.registerAll(e.cubes),this.strategyCtx={getCube:e=>this.cubeRegistry.get(e),queryCapabilities:e.queryCapabilities||(()=>cqe),executeRawSql:e.executeRawSql,executeAggregate:e.executeAggregate,fallbackService:e.fallbackService};let t=[new oqe,new sqe];e.fallbackService&&t.push(new uqe);let n=e.strategies||[];this.strategies=[...t,...n].sort((e,t)=>e.priority-t.priority),this.logger.info(`[Analytics] Initialized with ${this.cubeRegistry.size} cubes, ${this.strategies.length} strategies: ${this.strategies.map(e=>e.name).join(` → `)}`)}async query(e){if(!e.cube)throw Error(`Cube name is required in analytics query`);let t=this.resolveStrategy(e);return this.logger.debug(`[Analytics] Query on cube "${e.cube}" \u2192 ${t.name}`),t.execute(e,this.strategyCtx)}async getMeta(e){return(e?[this.cubeRegistry.get(e)].filter(Boolean):this.cubeRegistry.getAll()).map(e=>({name:e.name,title:e.title,measures:Object.entries(e.measures).map(([t,n])=>({name:`${e.name}.${t}`,type:n.type,title:n.label})),dimensions:Object.entries(e.dimensions).map(([t,n])=>({name:`${e.name}.${t}`,type:n.type,title:n.label}))}))}async generateSql(e){if(!e.cube)throw Error(`Cube name is required for SQL generation`);let t=this.resolveStrategy(e);return this.logger.debug(`[Analytics] generateSql on cube "${e.cube}" \u2192 ${t.name}`),t.generateSql(e,this.strategyCtx)}resolveStrategy(e){for(let t of this.strategies)if(t.canHandle(e,this.strategyCtx))return t;throw Error(`[Analytics] No strategy can handle query for cube "${e.cube}". Checked: ${this.strategies.map(e=>e.name).join(`, `)}. Ensure a compatible driver is configured or a fallback service is registered.`)}},uqe=class{constructor(){this.name=`FallbackDelegateStrategy`,this.priority=30}canHandle(e,t){return e.cube?!!t.fallbackService:!1}async execute(e,t){return t.fallbackService.query(e)}async generateSql(e,t){return t.fallbackService?.generateSql?t.fallbackService.generateSql(e):{sql:`-- FallbackDelegateStrategy: SQL generation not supported for cube "${e.cube}"`,params:[]}}},dqe=class{constructor(e={}){this.name=`com.objectstack.service-analytics`,this.version=`1.0.0`,this.type=`standard`,this.dependencies=[],this.options=e}async init(e){let t;try{let n=e.getService(`analytics`);n&&typeof n.query==`function`&&(t=n,e.logger.debug(`[Analytics] Found existing analytics service, using as fallback`))}catch{}this.service=new lqe({cubes:this.options.cubes,logger:e.logger,queryCapabilities:this.options.queryCapabilities,executeRawSql:this.options.executeRawSql,executeAggregate:this.options.executeAggregate,fallbackService:t}),t?e.replaceService(`analytics`,this.service):e.registerService(`analytics`,this.service),this.options.debug&&e.hook(`analytics:beforeQuery`,async t=>{e.logger.debug(`[Analytics] Before query`,{query:t})}),e.logger.info(`[Analytics] Service initialized`)}async start(e){this.service&&(await e.trigger(`analytics:ready`,this.service),e.logger.info(`[Analytics] Service started with ${this.service.cubeRegistry.size} cubes: ${this.service.cubeRegistry.names().join(`, `)||`(none)`}`))}async destroy(){this.service=void 0}};function fqe(e){return e==null}function pqe(e){return typeof e==`object`&&!!e}function mqe(e){return Array.isArray(e)?e:fqe(e)?[]:[e]}function hqe(e,t){var n,r,i,a;if(t)for(a=Object.keys(t),n=0,r=a.length;ns&&(a=` ... `,t=r-s+a.length),n-r>s&&(o=` ...`,n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,`→`)+o,pos:r-t+a.length}}function p5(e,t){return l5.repeat(` `,t-e.length)+e}function yqe(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||=79,typeof t.indent!=`number`&&(t.indent=1),typeof t.linesBefore!=`number`&&(t.linesBefore=3),typeof t.linesAfter!=`number`&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],i=[],a,o=-1;a=n.exec(e.buffer);)i.push(a.index),r.push(a.index+a[0].length),e.position<=a.index&&o<0&&(o=r.length-2);o<0&&(o=r.length-1);var s=``,c,l,u=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(o-c<0);c++)l=f5(e.buffer,r[o-c],i[o-c],e.position-(r[o]-r[o-c]),d),s=l5.repeat(` `,t.indent)+p5((e.line-c+1).toString(),u)+` | `+l.str+` -`+s;for(l=f5(e.buffer,r[o],i[o],e.position,d),s+=l5.repeat(` `,t.indent)+p5((e.line+1).toString(),u)+` | `+l.str+` -`,s+=l5.repeat(`-`,t.indent+u+3+l.pos)+`^ -`,c=1;c<=t.linesAfter&&!(o+c>=i.length);c++)l=f5(e.buffer,r[o+c],i[o+c],e.position-(r[o]-r[o+c]),d),s+=l5.repeat(` `,t.indent)+p5((e.line+c+1).toString(),u)+` | `+l.str+` -`;return s.replace(/\n$/,``)}var bqe=yqe,xqe=[`kind`,`multi`,`resolve`,`construct`,`instanceOf`,`predicate`,`represent`,`representName`,`defaultStyle`,`styleAliases`],Sqe=[`scalar`,`sequence`,`mapping`];function Cqe(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}function wqe(e,t){if(t||={},Object.keys(t).forEach(function(t){if(xqe.indexOf(t)===-1)throw new d5(`Unknown option "`+t+`" is met in definition of "`+e+`" YAML type.`)}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Cqe(t.styleAliases||null),Sqe.indexOf(this.kind)===-1)throw new d5(`Unknown kind "`+this.kind+`" is specified for "`+e+`" YAML type.`)}var m5=wqe;function Tqe(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)}),n[t]=e}),n}function Eqe(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(t=0,n=arguments.length;t=0?`0b`+e.toString(2):`-0b`+e.toString(2).slice(1)},octal:function(e){return e>=0?`0o`+e.toString(8):`-0o`+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?`0x`+e.toString(16).toUpperCase():`-0x`+e.toString(16).toUpperCase().slice(1)}},defaultStyle:`decimal`,styleAliases:{binary:[2,`bin`],octal:[8,`oct`],decimal:[10,`dec`],hexadecimal:[16,`hex`]}}),Uqe=RegExp(`^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function Wqe(e){return!(e===null||!Uqe.test(e)||e[e.length-1]===`_`)}function Gqe(e){var t=e.replace(/_/g,``).toLowerCase(),n=t[0]===`-`?-1:1;return`+-`.indexOf(t[0])>=0&&(t=t.slice(1)),t===`.inf`?n===1?1/0:-1/0:t===`.nan`?NaN:n*parseFloat(t,10)}var Kqe=/^[-+]?[0-9]+e/;function qqe(e,t){var n;if(isNaN(e))switch(t){case`lowercase`:return`.nan`;case`uppercase`:return`.NAN`;case`camelcase`:return`.NaN`}else if(e===1/0)switch(t){case`lowercase`:return`.inf`;case`uppercase`:return`.INF`;case`camelcase`:return`.Inf`}else if(e===-1/0)switch(t){case`lowercase`:return`-.inf`;case`uppercase`:return`-.INF`;case`camelcase`:return`-.Inf`}else if(l5.isNegativeZero(e))return`-0.0`;return n=e.toString(10),Kqe.test(n)?n.replace(`e`,`.e`):n}function Jqe(e){return Object.prototype.toString.call(e)===`[object Number]`&&(e%1!=0||l5.isNegativeZero(e))}var Yqe=new m5(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:Wqe,construct:Gqe,predicate:Jqe,represent:qqe,defaultStyle:`lowercase`}),Xqe=Dqe.extend({implicit:[jqe,Fqe,Hqe,Yqe]}),Zqe=Xqe,Qqe=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),$qe=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function eJe(e){return e===null?!1:Qqe.exec(e)!==null||$qe.exec(e)!==null}function tJe(e){var t,n,r,i,a,o,s,c=0,l=null,u,d,f;if(t=Qqe.exec(e),t===null&&(t=$qe.exec(e)),t===null)throw Error(`Date resolve error`);if(n=+t[1],r=t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,r,i));if(a=+t[4],o=+t[5],s=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+=`0`;c=+c}return t[9]&&(u=+t[10],d=+(t[11]||0),l=(u*60+d)*6e4,t[9]===`-`&&(l=-l)),f=new Date(Date.UTC(n,r,i,a,o,s,c)),l&&f.setTime(f.getTime()-l),f}function nJe(e){return e.toISOString()}var rJe=new m5(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:eJe,construct:tJe,instanceOf:Date,represent:nJe});function iJe(e){return e===`<<`||e===null}var aJe=new m5(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:iJe}),g5=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= -\r`;function oJe(e){if(e===null)return!1;var t,n,r=0,i=e.length,a=g5;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0}function sJe(e){var t,n,r=e.replace(/[\r\n=]/g,``),i=r.length,a=g5,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(o&255)),o=o<<6|a.indexOf(r.charAt(t));return n=i%4*6,n===0?(s.push(o>>16&255),s.push(o>>8&255),s.push(o&255)):n===18?(s.push(o>>10&255),s.push(o>>2&255)):n===12&&s.push(o>>4&255),new Uint8Array(s)}function cJe(e){var t=``,n=0,r,i,a=e.length,o=g5;for(r=0;r>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]),n=(n<<8)+e[r];return i=a%3,i===0?(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]):i===2?(t+=o[n>>10&63],t+=o[n>>4&63],t+=o[n<<2&63],t+=o[64]):i===1&&(t+=o[n>>2&63],t+=o[n<<4&63],t+=o[64],t+=o[64]),t}function lJe(e){return Object.prototype.toString.call(e)===`[object Uint8Array]`}var uJe=new m5(`tag:yaml.org,2002:binary`,{kind:`scalar`,resolve:oJe,construct:sJe,predicate:lJe,represent:cJe}),dJe=Object.prototype.hasOwnProperty,fJe=Object.prototype.toString;function pJe(e){if(e===null)return!0;var t=[],n,r,i,a,o,s=e;for(n=0,r=s.length;n>10)+55296,(e-65536&1023)+56320)}function BJe(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}for(var VJe=Array(256),HJe=Array(256),T5=0;T5<256;T5++)VJe[T5]=+!!RJe(T5),HJe[T5]=RJe(T5);function UJe(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||wJe,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function WJe(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=bqe(n),new d5(t,n)}function E5(e,t){throw WJe(e,t)}function D5(e,t){e.onWarning&&e.onWarning.call(null,WJe(e,t))}var GJe={YAML:function(e,t,n){var r,i,a;e.version!==null&&E5(e,`duplication of %YAML directive`),n.length!==1&&E5(e,`YAML directive accepts exactly one argument`),r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),r===null&&E5(e,`ill-formed argument of the YAML directive`),i=parseInt(r[1],10),a=parseInt(r[2],10),i!==1&&E5(e,`unacceptable YAML version of the document`),e.version=n[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&D5(e,`unsupported YAML version of the document`)},TAG:function(e,t,n){var r,i;n.length!==2&&E5(e,`TAG directive accepts exactly two arguments`),r=n[0],i=n[1],MJe.test(r)||E5(e,`ill-formed tag handle (first argument) of the TAG directive`),_5.call(e.tagMap,r)&&E5(e,`there is a previously declared suffix for "`+r+`" tag handle`),NJe.test(i)||E5(e,`ill-formed tag prefix (second argument) of the TAG directive`);try{i=decodeURIComponent(i)}catch{E5(e,`tag prefix is malformed: `+i)}e.tagMap[r]=i}};function O5(e,t,n,r){var i,a,o,s;if(t1&&(e.result+=l5.repeat(` -`,t-1))}function qJe(e,t,n){var r,i,a,o,s,c,l,u,d=e.kind,f=e.result,p=e.input.charCodeAt(e.position);if(C5(p)||w5(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=e.input.charCodeAt(e.position+1),C5(i)||n&&w5(i)))return!1;for(e.kind=`scalar`,e.result=``,a=o=e.position,s=!1;p!==0;){if(p===58){if(i=e.input.charCodeAt(e.position+1),C5(i)||n&&w5(i))break}else if(p===35){if(r=e.input.charCodeAt(e.position-1),C5(r))break}else if(e.position===e.lineStart&&M5(e)||n&&w5(p))break;else if(x5(p))if(c=e.line,l=e.lineStart,u=e.lineIndent,j5(e,!1,-1),e.lineIndent>=t){s=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=c,e.lineStart=l,e.lineIndent=u;break}s&&=(O5(e,a,o,!1),N5(e,e.line-c),a=o=e.position,!1),S5(p)||(o=e.position+1),p=e.input.charCodeAt(++e.position)}return O5(e,a,o,!1),e.result?!0:(e.kind=d,e.result=f,!1)}function JJe(e,t){var n=e.input.charCodeAt(e.position),r,i;if(n!==39)return!1;for(e.kind=`scalar`,e.result=``,e.position++,r=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(O5(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,i=e.position;else return!0;else x5(n)?(O5(e,r,i,!0),N5(e,j5(e,!1,t)),r=i=e.position):e.position===e.lineStart&&M5(e)?E5(e,`unexpected end of the document within a single quoted scalar`):(e.position++,i=e.position);E5(e,`unexpected end of the stream within a single quoted scalar`)}function YJe(e,t){var n,r,i,a,o,s=e.input.charCodeAt(e.position);if(s!==34)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(s=e.input.charCodeAt(e.position))!==0;)if(s===34)return O5(e,n,e.position,!0),e.position++,!0;else if(s===92){if(O5(e,n,e.position,!0),s=e.input.charCodeAt(++e.position),x5(s))j5(e,!1,t);else if(s<256&&VJe[s])e.result+=HJe[s],e.position++;else if((o=IJe(s))>0){for(i=o,a=0;i>0;i--)s=e.input.charCodeAt(++e.position),(o=FJe(s))>=0?a=(a<<4)+o:E5(e,`expected hexadecimal character`);e.result+=zJe(a),e.position++}else E5(e,`unknown escape sequence`);n=r=e.position}else x5(s)?(O5(e,n,r,!0),N5(e,j5(e,!1,t)),n=r=e.position):e.position===e.lineStart&&M5(e)?E5(e,`unexpected end of the document within a double quoted scalar`):(e.position++,r=e.position);E5(e,`unexpected end of the stream within a double quoted scalar`)}function XJe(e,t){var n=!0,r,i,a,o=e.tag,s,c=e.anchor,l,u,d,f,p,m=Object.create(null),h,g,_,v=e.input.charCodeAt(e.position);if(v===91)u=93,p=!1,s=[];else if(v===123)u=125,p=!0,s={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),v=e.input.charCodeAt(++e.position);v!==0;){if(j5(e,!0,t),v=e.input.charCodeAt(e.position),v===u)return e.position++,e.tag=o,e.anchor=c,e.kind=p?`mapping`:`sequence`,e.result=s,!0;n?v===44&&E5(e,`expected the node content, but found ','`):E5(e,`missed comma between flow collection entries`),g=h=_=null,d=f=!1,v===63&&(l=e.input.charCodeAt(e.position+1),C5(l)&&(d=f=!0,e.position++,j5(e,!0,t))),r=e.line,i=e.lineStart,a=e.position,P5(e,t,v5,!1,!0),g=e.tag,h=e.result,j5(e,!0,t),v=e.input.charCodeAt(e.position),(f||e.line===r)&&v===58&&(d=!0,v=e.input.charCodeAt(++e.position),j5(e,!0,t),P5(e,t,v5,!1,!0),_=e.result),p?k5(e,s,m,g,h,_,r,i,a):d?s.push(k5(e,null,m,g,h,_,r,i,a)):s.push(h),j5(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}E5(e,`unexpected end of the stream within a flow collection`)}function ZJe(e,t){var n,r,i=b5,a=!1,o=!1,s=t,c=0,l=!1,u,d=e.input.charCodeAt(e.position);if(d===124)r=!1;else if(d===62)r=!0;else return!1;for(e.kind=`scalar`,e.result=``;d!==0;)if(d=e.input.charCodeAt(++e.position),d===43||d===45)b5===i?i=d===43?OJe:DJe:E5(e,`repeat of a chomping mode identifier`);else if((u=LJe(d))>=0)u===0?E5(e,`bad explicit indentation width of a block scalar; it cannot be less than one`):o?E5(e,`repeat of an indentation width identifier`):(s=t+u-1,o=!0);else break;if(S5(d)){do d=e.input.charCodeAt(++e.position);while(S5(d));if(d===35)do d=e.input.charCodeAt(++e.position);while(!x5(d)&&d!==0)}for(;d!==0;){for(A5(e),e.lineIndent=0,d=e.input.charCodeAt(e.position);(!o||e.lineIndents&&(s=e.lineIndent),x5(d)){c++;continue}if(e.lineIndentt)&&c!==0)E5(e,`bad indentation of a sequence entry`);else if(e.lineIndentt)&&(g&&(o=e.line,s=e.lineStart,c=e.position),P5(e,t,y5,!0,i)&&(g?m=e.result:h=e.result),g||(k5(e,d,f,p,m,h,o,s,c),p=m=h=null),j5(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&v!==0)E5(e,`bad indentation of a mapping entry`);else if(e.lineIndentt?c=1:e.lineIndent===t?c=0:e.lineIndentt?c=1:e.lineIndent===t?c=0:e.lineIndent tag; it should be "scalar", not "`+e.kind+`"`),d=0,f=e.implicitTypes.length;d`),e.result!==null&&m.kind!==e.kind&&E5(e,`unacceptable node kind for !<`+e.tag+`> tag; it should be "`+m.kind+`", not "`+e.kind+`"`),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):E5(e,`cannot resolve a node with !<`+e.tag+`> explicit tag`)}return e.listener!==null&&e.listener(`close`,e),e.tag!==null||e.anchor!==null||u}function rYe(e){var t=e.position,n,r,i,a=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(j5(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(a=!0,o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!C5(o);)o=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),i=[],r.length<1&&E5(e,`directive name must not be less than one character in length`);o!==0;){for(;S5(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!x5(o));break}if(x5(o))break;for(n=e.position;o!==0&&!C5(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&A5(e),_5.call(GJe,r)?GJe[r](e,r,i):D5(e,`unknown document directive "`+r+`"`)}if(j5(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,j5(e,!0,-1)):a&&E5(e,`directives end mark is expected`),P5(e,e.lineIndent-1,y5,!1,!0),j5(e,!0,-1),e.checkLineBreaks&&AJe.test(e.input.slice(t,e.position))&&D5(e,`non-ASCII line breaks are interpreted as content`),e.documents.push(e.result),e.position===e.lineStart&&M5(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,j5(e,!0,-1));return}if(e.position=55296&&n<=56319&&t+1=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function UYe(e){return/^\n* /.test(e)}var WYe=1,G5=2,GYe=3,KYe=4,K5=5;function qYe(e,t,n,r,i,a,o,s){var c,l=0,u=null,d=!1,f=!1,p=r!==-1,m=-1,h=VYe(W5(e,0))&&HYe(W5(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(l=W5(e,c),!U5(l))return K5;h&&=BYe(l,u,s),u=l}else{for(c=0;c=65536?c+=2:c++){if(l=W5(e,c),l===I5)d=!0,p&&(f||=c-m-1>r&&e[m+1]!==` `,m=c);else if(!U5(l))return K5;h&&=BYe(l,u,s),u=l}f||=p&&c-m-1>r&&e[m+1]!==` `}return!d&&!f?h&&!o&&!i(e)?WYe:a===B5?K5:G5:n>9&&UYe(e)?K5:o?a===B5?K5:G5:f?KYe:GYe}function JYe(e,t,n,r,i){e.dump=function(){if(t.length===0)return e.quotingType===B5?`""`:`''`;if(!e.noCompatMode&&(jYe.indexOf(t)!==-1||MYe.test(t)))return e.quotingType===B5?`"`+t+`"`:`'`+t+`'`;var a=e.indent*Math.max(1,n),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),s=r||e.flowLevel>-1&&n>=e.flowLevel;function c(t){return RYe(e,t)}switch(qYe(t,s,e.indent,o,c,e.quotingType,e.forceQuotes&&!r,i)){case WYe:return t;case G5:return`'`+t.replace(/'/g,`''`)+`'`;case GYe:return`|`+YYe(t,e.indent)+XYe(LYe(t,a));case KYe:return`>`+YYe(t,e.indent)+XYe(LYe(ZYe(t,o),a));case K5:return`"`+$Ye(t)+`"`;default:throw new d5(`impossible error: invalid scalar style`)}}()}function YYe(e,t){var n=UYe(e)?String(t):``,r=e[e.length-1]===` -`;return n+(r&&(e[e.length-2]===` -`||e===` -`)?`+`:r?``:`-`)+` -`}function XYe(e){return e[e.length-1]===` -`?e.slice(0,-1):e}function ZYe(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var r=e.indexOf(` -`);return r=r===-1?e.length:r,n.lastIndex=r,QYe(e.slice(0,r),t)}(),i=e[0]===` -`||e[0]===` `,a,o;o=n.exec(e);){var s=o[1],c=o[2];a=c[0]===` `,r+=s+(!i&&!a&&c!==``?` -`:``)+QYe(c,t),i=a}return r}function QYe(e,t){if(e===``||e[0]===` `)return e;for(var n=/ [^ ]/g,r,i=0,a,o=0,s=0,c=``;r=n.exec(e);)s=r.index,s-i>t&&(a=o>i?o:s,c+=` -`+e.slice(i,a),i=a+1),o=s;return c+=` -`,e.length-i>t&&o>i?c+=e.slice(i,o)+` -`+e.slice(o+1):c+=e.slice(i),c.slice(1)}function $Ye(e){for(var t=``,n=0,r,i=0;i=65536?i+=2:i++)n=W5(e,i),r=z5[n],!r&&U5(n)?(t+=e[i],n>=65536&&(t+=e[i+1])):t+=r||PYe(n);return t}function eXe(e,t,n){var r=``,i=e.tag,a,o,s;for(a=0,o=n.length;a1024&&(u+=`? `),u+=e.dump+(e.condenseFlow?`"`:``)+`:`+(e.condenseFlow?``:` `),q5(e,t,l,!1,!1)&&(u+=e.dump,r+=u));e.tag=i,e.dump=`{`+r+`}`}function rXe(e,t,n,r){var i=``,a=e.tag,o=Object.keys(n),s,c,l,u,d,f;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys==`function`)o.sort(e.sortKeys);else if(e.sortKeys)throw new d5(`sortKeys must be a boolean or a function`);for(s=0,c=o.length;s1024,d&&(e.dump&&I5===e.dump.charCodeAt(0)?f+=`?`:f+=`? `),f+=e.dump,d&&(f+=V5(e,t)),q5(e,t+1,u,!0,d)&&(e.dump&&I5===e.dump.charCodeAt(0)?f+=`:`:f+=`: `,f+=e.dump,i+=f));e.tag=a,e.dump=i||`{}`}function iXe(e,t,n){var r,i=n?e.explicitTypes:e.implicitTypes,a,o,s,c;for(a=0,o=i.length;a tag resolver accepts not "`+c+`" style`);e.dump=r}return!0}return!1}function q5(e,t,n,r,i,a,o){e.tag=null,e.dump=n,iXe(e,n,!1)||iXe(e,n,!0);var s=cYe.call(e.dump),c=r,l;r&&=e.flowLevel<0||e.flowLevel>t;var u=s===`[object Object]`||s===`[object Array]`,d,f;if(u&&(d=e.duplicates.indexOf(n),f=d!==-1),(e.tag!==null&&e.tag!==`?`||f||e.indent!==2&&t>0)&&(i=!1),f&&e.usedDuplicates[d])e.dump=`*ref_`+d;else{if(u&&f&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),s===`[object Object]`)r&&Object.keys(e.dump).length!==0?(rXe(e,t,e.dump,i),f&&(e.dump=`&ref_`+d+e.dump)):(nXe(e,t,e.dump),f&&(e.dump=`&ref_`+d+` `+e.dump));else if(s===`[object Array]`)r&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?tXe(e,t-1,e.dump,i):tXe(e,t,e.dump,i),f&&(e.dump=`&ref_`+d+e.dump)):(eXe(e,t,e.dump),f&&(e.dump=`&ref_`+d+` `+e.dump));else if(s===`[object String]`)e.tag!==`?`&&JYe(e,e.dump,t,a,c);else if(s===`[object Undefined]`)return!1;else{if(e.skipInvalid)return!1;throw new d5(`unacceptable kind of an object to dump `+s)}e.tag!==null&&e.tag!==`?`&&(l=encodeURI(e.tag[0]===`!`?e.tag.slice(1):e.tag).replace(/!/g,`%21`),l=e.tag[0]===`!`?`!`+l:l.slice(0,18)===`tag:yaml.org,2002:`?`!!`+l.slice(18):`!<`+l+`>`,e.dump=l+` `+e.dump)}return!0}function aXe(e,t){var n=[],r=[],i,a;for(J5(e,n,r),i=0,a=r.length;i({on:()=>{},close:()=>{}}),fXe=(e,t,n)=>{let r=e instanceof RegExp?pXe(e,n):e,i=t instanceof RegExp?pXe(t,n):t,a=r!==null&&i!=null&&mXe(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},pXe=(e,t)=>{let n=t.match(e);return n?n[0]:null},mXe=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},hXe=`\0SLASH`+Math.random()+`\0`,gXe=`\0OPEN`+Math.random()+`\0`,Y5=`\0CLOSE`+Math.random()+`\0`,_Xe=`\0COMMA`+Math.random()+`\0`,vXe=`\0PERIOD`+Math.random()+`\0`,yXe=new RegExp(hXe,`g`),bXe=new RegExp(gXe,`g`),xXe=new RegExp(Y5,`g`),SXe=new RegExp(_Xe,`g`),CXe=new RegExp(vXe,`g`),wXe=/\\\\/g,TXe=/\\{/g,EXe=/\\}/g,DXe=/\\,/g,OXe=/\\./g,kXe=1e5;function X5(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function AXe(e){return e.replace(wXe,hXe).replace(TXe,gXe).replace(EXe,Y5).replace(DXe,_Xe).replace(OXe,vXe)}function jXe(e){return e.replace(yXe,`\\`).replace(bXe,`{`).replace(xXe,`}`).replace(SXe,`,`).replace(CXe,`.`)}function MXe(e){if(!e)return[``];let t=[],n=fXe(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=MXe(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function NXe(e,t={}){if(!e)return[];let{max:n=kXe}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),Z5(AXe(e),n,!0).map(jXe)}function PXe(e){return`{`+e+`}`}function FXe(e){return/^-?0\d/.test(e)}function IXe(e,t){return e<=t}function LXe(e,t){return e>=t}function Z5(e,t,n){let r=[],i=fXe(`{`,`}`,e);if(!i)return[e];let a=i.pre,o=i.post.length?Z5(i.post,t,!1):[``];if(/\$$/.test(i.pre))for(let e=0;e=0;if(!l&&!u)return i.post.match(/,(?!,).*\}/)?(e=i.pre+`{`+i.body+Y5+i.post,Z5(e,t,!0)):[e];let d;if(l)d=i.body.split(/\.\./);else if(d=MXe(i.body),d.length===1&&d[0]!==void 0&&(d=Z5(d[0],t,!1).map(PXe),d.length===1))return o.map(e=>i.pre+d[0]+e);let f;if(l&&d[0]!==void 0&&d[1]!==void 0){let e=X5(d[0]),t=X5(d[1]),n=Math.max(d[0].length,d[1].length),r=d.length===3&&d[2]!==void 0?Math.abs(X5(d[2])):1,i=IXe;t0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},RXe={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},$5=e=>e.replace(/[[\]\\-]/g,`\\$&`),zXe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),BXe=e=>e.join(``),VXe=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;t:for(;ad?r.push($5(d)+`-`+$5(t)):t===d&&r.push($5(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push($5(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push($5(t)),a++}if(un?t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`):t?e.replace(/\[([^\/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,`$1$2`).replace(/\\([^\/{}])/g,`$1`),HXe=new Set([`!`,`?`,`+`,`*`,`@`]),UXe=e=>HXe.has(e),WXe=`(?!(?:^|/)\\.\\.?(?:$|/))`,t7=`(?!\\.)`,GXe=new Set([`[`,`.`]),KXe=new Set([`..`,`.`]),qXe=new Set(`().*{}+?[]^$\\!`),JXe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),n7=`[^/]`,YXe=n7+`*?`,XXe=n7+`+?`,ZXe=class e{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&rtypeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let t=this.#i;for(let n=0;ntypeof e!=`string`),i=this.#r.map(n=>{let[i,a,o,s]=typeof n==`string`?e.#m(n,this.#t,r):n.toRegExpSource(t);return this.#t=this.#t||o,this.#n=this.#n||s,i}).join(``),a=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&KXe.has(this.#r[0]))){let e=GXe,r=n&&e.has(i.charAt(0))||i.startsWith(`\\.`)&&e.has(i.charAt(2))||i.startsWith(`\\.\\.`)&&e.has(i.charAt(4)),o=!n&&!t&&e.has(i.charAt(0));a=r?WXe:o?t7:``}let o=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(o=`(?:$|\\/)`),[a+i+o,e7(i),this.#t=!!this.#t,this.#n]}let r=this.type===`*`||this.type===`+`,i=this.type===`!`?`(?:(?!(?:`:`(?:`,a=this.#p(n);if(this.isStart()&&this.isEnd()&&!a&&this.type!==`!`){let e=this.toString();return this.#r=[e],this.type=null,this.#t=void 0,[e,e7(this.toString()),!1,!1]}let o=!r||t||n||!t7?``:this.#p(!0);o===a&&(o=``),o&&(a=`(?:${a})(?:${o})*?`);let s=``;if(this.type===`!`&&this.#u)s=(this.isStart()&&!n?t7:``)+XXe;else{let e=this.type===`!`?`))`+(this.isStart()&&!n&&!t?t7:``)+YXe+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&o?`)`:this.type===`*`&&o?`)?`:`)${this.type}`;s=i+a+e}return[s,e7(a),this.#t=!!this.#t,this.#n]}#p(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#m(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;sn?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),r7=(e,t,n={})=>(Q5(t),!n.nocomment&&t.charAt(0)===`#`?!1:new o7(t,n).match(e)),$Xe=/^\*+([^+@!?\*\[\(]*)$/,eZe=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),tZe=e=>t=>t.endsWith(e),nZe=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),rZe=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),iZe=/^\*+\.\*+$/,aZe=e=>!e.startsWith(`.`)&&e.includes(`.`),oZe=e=>e!==`.`&&e!==`..`&&e.includes(`.`),sZe=/^\.\*+$/,cZe=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),lZe=/^\*+$/,uZe=e=>e.length!==0&&!e.startsWith(`.`),dZe=e=>e.length!==0&&e!==`.`&&e!==`..`,fZe=/^\?+([^+@!?\*\[\(]*)?$/,pZe=([e,t=``])=>{let n=_Ze([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},mZe=([e,t=``])=>{let n=vZe([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},hZe=([e,t=``])=>{let n=vZe([e]);return t?e=>n(e)&&e.endsWith(t):n},gZe=([e,t=``])=>{let n=_Ze([e]);return t?e=>n(e)&&e.endsWith(t):n},_Ze=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},vZe=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},yZe=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,bZe={win32:{sep:`\\`},posix:{sep:`/`}};r7.sep=yZe===`win32`?bZe.win32.sep:bZe.posix.sep;var i7=Symbol(`globstar **`);r7.GLOBSTAR=i7;var xZe=`[^/]*?`,SZe=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,CZe=`(?:(?!(?:\\/|^)\\.).)*?`;r7.filter=(e,t={})=>n=>r7(n,e,t);var a7=(e,t={})=>Object.assign({},e,t);r7.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return r7;let t=r7;return Object.assign((n,r,i={})=>t(n,r,a7(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,a7(e,n))}static defaults(n){return t.defaults(a7(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,a7(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,a7(e,r))}},unescape:(n,r={})=>t.unescape(n,a7(e,r)),escape:(n,r={})=>t.escape(n,a7(e,r)),filter:(n,r={})=>t.filter(n,a7(e,r)),defaults:n=>t.defaults(a7(e,n)),makeRe:(n,r={})=>t.makeRe(n,a7(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,a7(e,r)),match:(n,r,i={})=>t.match(n,r,a7(e,i)),sep:t.sep,GLOBSTAR:i7})};var wZe=(e,t={})=>(Q5(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:NXe(e,{max:t.braceExpandMax}));r7.braceExpand=wZe,r7.makeRe=(e,t={})=>new o7(e,t).makeRe(),r7.match=(e,t,n={})=>{let r=new o7(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var TZe=/[?*]|[+@!]\(.*?\)|\[|\]/,EZe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),o7=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){Q5(e),t||={},this.options=t,this.pattern=e,this.platform=t.platform||yZe,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!TZe.test(e[2]))&&!TZe.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;nr&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;ee.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;ro?t=t.slice(s):o>s&&(e=e.slice(o)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(e=this.levelTwoFileOptimize(e)),this.debug(`matchOne`,this,{file:e,pattern:t}),this.debug(`matchOne`,e.length,t.length);for(var a=0,o=0,s=e.length,c=t.length;a>> no match, partial?`,e,d,t,f),d===s))}let i;if(typeof l==`string`?(i=u===l,this.debug(`string match`,l,u,i)):(i=l.test(u),this.debug(`pattern match`,l,u,i)),!i)return!1}if(a===s&&o===c)return!0;if(a===s)return n;if(o===c)return a===s-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return wZe(this.pattern,this.options)}parse(e){Q5(e);let t=this.options;if(e===`**`)return i7;if(e===``)return``;let n,r=null;(n=e.match(lZe))?r=t.dot?dZe:uZe:(n=e.match($Xe))?r=(t.nocase?t.dot?rZe:nZe:t.dot?tZe:eZe)(n[1]):(n=e.match(fZe))?r=(t.nocase?t.dot?mZe:pZe:t.dot?hZe:gZe)(n):(n=e.match(iZe))?r=t.dot?oZe:aZe:(n=e.match(sZe))&&(r=cZe);let i=ZXe.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,`test`,{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?xZe:t.dot?SZe:CZe,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?EZe(e):e===i7?i7:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==i7||a===i7||(a===void 0?i!==void 0&&i!==i7?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==i7&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=i7))});let i=t.filter(e=>e!==i7);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e{typeof s7.emitWarning==`function`?s7.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},c7=globalThis.AbortController,AZe=globalThis.AbortSignal;if(typeof c7>`u`){AZe=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},c7=class{constructor(){t()}signal=new AZe;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(let t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e=s7.env?.LRU_CACHE_IGNORE_AC_WARNING!==`1`,t=()=>{e&&(e=!1,kZe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.",`NO_ABORT_CONTROLLER`,`ENOTSUP`,t))}}var jZe=e=>!OZe.has(e),l7=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),MZe=e=>l7(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?u7:null:null,u7=class extends Array{constructor(e){super(e),this.fill(0)}},NZe=class e{heap;length;static#e=!1;static create(t){let n=MZe(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},d7=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#V(t),backgroundFetch:(t,n,r,i)=>e.#B(t,n,r,i),moveToTail:t=>e.#U(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:S,ignoreFetchAbort:C,perf:w}=t;if(w!==void 0&&typeof w?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=w??DZe,n!==0&&!l7(n))throw TypeError(`max option must be a nonnegative integer`);let T=n?MZe(n):Array;if(!T)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=new Map,this.#d=Array(n).fill(void 0),this.#f=Array(n).fill(void 0),this.#p=new T(n),this.#m=new T(n),this.#h=0,this.#g=0,this.#_=NZe.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#t!==0&&!l7(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!l7(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=l7(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!l7(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;jZe(t)&&(OZe.add(t),kZe(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new u7(this.#e),t=new u7(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array(this.#e):void 0;this.#S=n,this.#A=(r,i,a=this.#s.now())=>{if(t[r]=i===0?0:a,e[r]=i,n?.[r]&&(clearTimeout(n[r]),n[r]=void 0),i!==0&&n){let e=setTimeout(()=>{this.#j(r)&&this.#W(this.#d[r],`expire`)},i+1);e.unref&&e.unref(),n[r]=e}},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now()},this.#k=(n,a)=>{if(e[a]){let o=e[a],s=t[a];if(!o||!s)return;n.ttl=o,n.start=s,n.now=r||i(),n.remainingTTL=o-(n.now-s)}};let r=0,i=()=>{let e=this.#s.now();if(this.ttlResolution>0){r=e;let t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{let a=this.#u.get(n);if(a===void 0)return 0;let o=e[a],s=t[a];return!o||!s?1/0:o-((r||i())-s)},this.#j=n=>{let a=t[n],o=e[n];return!!o&&!!a&&(r||i())-a>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new u7(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(this.#V(t))return 0;if(!l7(n))if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!l7(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`);return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#z(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;!(!this.#R(t)||((e||!this.#j(t))&&(yield t),t===this.#h));)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;!(!this.#R(t)||((e||!this.#j(t))&&(yield t),t===this.#g));)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#V(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#V(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#V(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#V(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#V(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#V(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.get(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#W(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#V(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#V(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:i,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:s}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,l=this.#F(e,t,n.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return s&&(s.set=`miss`,s.maxEntrySizeExceeded=!0),this.#W(e,`set`),this;let u=this.#c===0?void 0:this.#u.get(e);if(u===void 0)u=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#z(!1):this.#c:this.#_.pop(),this.#d[u]=e,this.#f[u]=t,this.#u.set(e,u),this.#p[this.#g]=u,this.#m[u]=this.#g,this.#g=u,this.#c++,this.#P(u,l,s),s&&(s.set=`add`),c=!1,this.#E&&this.#r?.(t,e,`add`);else{this.#U(u);let n=this.#f[u];if(t!==n){if(this.#w&&this.#V(n)){n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:t}=n;t!==void 0&&!a&&(this.#C&&this.#n?.(t,e,`set`),this.#T&&this.#v?.push([t,e,`set`]))}else a||(this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`]));if(this.#N(u),this.#P(u,l,s),this.#f[u]=t,s){s.set=`replace`;let e=n&&this.#V(n)?n.__staleWhileFetching:n;e!==void 0&&(s.oldValue=e)}}else s&&(s.set=`update`);this.#E&&this.onInsert?.(t,e,t===n?`update`:`replace`)}if(r!==0&&!this.#x&&this.#D(),this.#x&&(c||this.#A(u,r,i),s&&this.#k(s,u)),!a&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#z(!0),this.#V(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#z(e){let t=this.#h,n=this.#d[t],r=this.#f[t];return this.#w&&this.#V(r)?r.__abortController.abort(Error(`evicted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(r,n,`evict`),this.#T&&this.#v?.push([r,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#V(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#u.get(e);if(r===void 0||!n&&this.#j(r))return;let i=this.#f[r];return this.#V(i)?i.__staleWhileFetching:i}#B(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#V(i))return i;let a=new c7,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||c&&i&&p===void 0)&&(r===void 0?d.__staleWhileFetching===void 0?this.#W(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,s.options))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#W(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);o&&o instanceof Promise&&o.then(e=>t(e===void 0?void 0:e),r),a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.set(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#V(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof c7}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(!this.#w)return g&&(g.fetch=`get`),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#B(e,y,v,m);return t.__returned=t}else{let t=this.#f[y];if(this.#V(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#U(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#B(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,forceRefresh:i,...a}=t,o=this.get(e,a);if(!i&&o!==void 0)return o;let s=n(e,o,{options:a,context:r});return this.set(e,s,a),s}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o!==void 0){let t=this.#f[o],s=this.#V(t);return a&&this.#k(a,o),this.#j(o)?(a&&(a.get=`stale`),s?(a&&n&&t.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?t.__staleWhileFetching:void 0):(i||this.#W(e,`expire`),a&&n&&(a.returnedStale=!0),n?t:void 0)):(a&&(a.get=`hit`),s?t.__staleWhileFetching:(this.#U(o),r&&this.#O(o),t))}else a&&(a.get=`miss`)}#H(e,t){this.#m[t]=e,this.#p[e]=t}#U(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#H(this.#m[e],this.#p[e]),this.#H(this.#g,e),this.#g=e)}delete(e){return this.#W(e,`delete`)}#W(e,t){let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0)if(this.#S?.[r]&&(clearTimeout(this.#S?.[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#G(t);else{this.#N(r);let n=this.#f[r];if(this.#V(n)?n.__abortController.abort(Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#G(`delete`)}#G(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#V(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}},PZe=typeof process==`object`&&process?process:{stdout:null,stderr:null},FZe=e=>!!e&&typeof e==`object`&&(e instanceof V7||e instanceof Fd||IZe(e)||LZe(e)),IZe=e=>!!e&&typeof e==`object`&&e instanceof Pd&&typeof e.pipe==`function`&&e.pipe!==Fd.Writable.prototype.pipe,LZe=e=>!!e&&typeof e==`object`&&e instanceof Pd&&typeof e.write==`function`&&typeof e.end==`function`,f7=Symbol(`EOF`),p7=Symbol(`maybeEmitEnd`),m7=Symbol(`emittedEnd`),h7=Symbol(`emittingEnd`),g7=Symbol(`emittedError`),_7=Symbol(`closed`),RZe=Symbol(`read`),v7=Symbol(`flush`),zZe=Symbol(`flushChunk`),y7=Symbol(`encoding`),b7=Symbol(`decoder`),x7=Symbol(`flowing`),S7=Symbol(`paused`),C7=Symbol(`resume`),w7=Symbol(`buffer`),T7=Symbol(`pipes`),E7=Symbol(`bufferLength`),D7=Symbol(`bufferPush`),O7=Symbol(`bufferShift`),k7=Symbol(`objectMode`),A7=Symbol(`destroyed`),j7=Symbol(`error`),M7=Symbol(`emitData`),BZe=Symbol(`emitEnd`),N7=Symbol(`emitEnd2`),P7=Symbol(`async`),F7=Symbol(`abort`),I7=Symbol(`aborted`),L7=Symbol(`signal`),R7=Symbol(`dataListeners`),z7=Symbol(`discarded`),B7=e=>Promise.resolve().then(e),VZe=e=>e(),HZe=e=>e===`end`||e===`finish`||e===`prefinish`,UZe=e=>e instanceof ArrayBuffer||!!e&&typeof e==`object`&&e.constructor&&e.constructor.name===`ArrayBuffer`&&e.byteLength>=0,WZe=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),GZe=class{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[C7](),this.dest.on(`drain`,this.ondrain)}unpipe(){this.dest.removeListener(`drain`,this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},KZe=class extends GZe{unpipe(){this.src.removeListener(`error`,this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=e=>this.dest.emit(`error`,e),e.on(`error`,this.proxyErrors)}},qZe=e=>!!e.objectMode,JZe=e=>!e.objectMode&&!!e.encoding&&e.encoding!==`buffer`,V7=class extends Pd{[x7]=!1;[S7]=!1;[T7]=[];[w7]=[];[k7];[y7];[P7];[b7];[f7]=!1;[m7]=!1;[h7]=!1;[_7]=!1;[g7]=null;[E7]=0;[A7]=!1;[L7];[I7]=!1;[R7]=0;[z7]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding==`string`)throw TypeError(`Encoding and objectMode may not be used together`);qZe(t)?(this[k7]=!0,this[y7]=null):JZe(t)?(this[y7]=t.encoding,this[k7]=!1):(this[k7]=!1,this[y7]=null),this[P7]=!!t.async,this[b7]=this[y7]?new Bd(this[y7]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,`buffer`,{get:()=>this[w7]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,`pipes`,{get:()=>this[T7]});let{signal:n}=t;n&&(this[L7]=n,n.aborted?this[F7]():n.addEventListener(`abort`,()=>this[F7]()))}get bufferLength(){return this[E7]}get encoding(){return this[y7]}set encoding(e){throw Error(`Encoding must be set at instantiation time`)}setEncoding(e){throw Error(`Encoding must be set at instantiation time`)}get objectMode(){return this[k7]}set objectMode(e){throw Error(`objectMode must be set at instantiation time`)}get async(){return this[P7]}set async(e){this[P7]=this[P7]||!!e}[F7](){this[I7]=!0,this.emit(`abort`,this[L7]?.reason),this.destroy(this[L7]?.reason)}get aborted(){return this[I7]}set aborted(e){}write(e,t,n){if(this[I7])return!1;if(this[f7])throw Error(`write after end`);if(this[A7])return this.emit(`error`,Object.assign(Error(`Cannot call write after a stream was destroyed`),{code:`ERR_STREAM_DESTROYED`})),!0;typeof t==`function`&&(n=t,t=`utf8`),t||=`utf8`;let r=this[P7]?B7:VZe;if(!this[k7]&&!Buffer.isBuffer(e)){if(WZe(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(UZe(e))e=Buffer.from(e);else if(typeof e!=`string`)throw Error(`Non-contiguous data written to non-objectMode stream`)}return this[k7]?(this[x7]&&this[E7]!==0&&this[v7](!0),this[x7]?this.emit(`data`,e):this[D7](e),this[E7]!==0&&this.emit(`readable`),n&&r(n),this[x7]):e.length?(typeof e==`string`&&!(t===this[y7]&&!this[b7]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[y7]&&(e=this[b7].write(e)),this[x7]&&this[E7]!==0&&this[v7](!0),this[x7]?this.emit(`data`,e):this[D7](e),this[E7]!==0&&this.emit(`readable`),n&&r(n),this[x7]):(this[E7]!==0&&this.emit(`readable`),n&&r(n),this[x7])}read(e){if(this[A7])return null;if(this[z7]=!1,this[E7]===0||e===0||e&&e>this[E7])return this[p7](),null;this[k7]&&(e=null),this[w7].length>1&&!this[k7]&&(this[w7]=[this[y7]?this[w7].join(``):Buffer.concat(this[w7],this[E7])]);let t=this[RZe](e||null,this[w7][0]);return this[p7](),t}[RZe](e,t){if(this[k7])this[O7]();else{let n=t;e===n.length||e===null?this[O7]():typeof n==`string`?(this[w7][0]=n.slice(e),t=n.slice(0,e),this[E7]-=e):(this[w7][0]=n.subarray(e),t=n.subarray(0,e),this[E7]-=e)}return this.emit(`data`,t),!this[w7].length&&!this[f7]&&this.emit(`drain`),t}end(e,t,n){return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=`utf8`),e!==void 0&&this.write(e,t),n&&this.once(`end`,n),this[f7]=!0,this.writable=!1,(this[x7]||!this[S7])&&this[p7](),this}[C7](){this[A7]||(!this[R7]&&!this[T7].length&&(this[z7]=!0),this[S7]=!1,this[x7]=!0,this.emit(`resume`),this[w7].length?this[v7]():this[f7]?this[p7]():this.emit(`drain`))}resume(){return this[C7]()}pause(){this[x7]=!1,this[S7]=!0,this[z7]=!1}get destroyed(){return this[A7]}get flowing(){return this[x7]}get paused(){return this[S7]}[D7](e){this[k7]?this[E7]+=1:this[E7]+=e.length,this[w7].push(e)}[O7](){return this[k7]?--this[E7]:this[E7]-=this[w7][0].length,this[w7].shift()}[v7](e=!1){do;while(this[zZe](this[O7]())&&this[w7].length);!e&&!this[w7].length&&!this[f7]&&this.emit(`drain`)}[zZe](e){return this.emit(`data`,e),this[x7]}pipe(e,t){if(this[A7])return e;this[z7]=!1;let n=this[m7];return t||={},e===PZe.stdout||e===PZe.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[T7].push(t.proxyErrors?new KZe(this,e,t):new GZe(this,e,t)),this[P7]?B7(()=>this[C7]()):this[C7]()),e}unpipe(e){let t=this[T7].find(t=>t.dest===e);t&&(this[T7].length===1?(this[x7]&&this[R7]===0&&(this[x7]=!1),this[T7]=[]):this[T7].splice(this[T7].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e===`data`)this[z7]=!1,this[R7]++,!this[T7].length&&!this[x7]&&this[C7]();else if(e===`readable`&&this[E7]!==0)super.emit(`readable`);else if(HZe(e)&&this[m7])super.emit(e),this.removeAllListeners(e);else if(e===`error`&&this[g7]){let e=t;this[P7]?B7(()=>e.call(this,this[g7])):e.call(this,this[g7])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e===`data`&&(this[R7]=this.listeners(`data`).length,this[R7]===0&&!this[z7]&&!this[T7].length&&(this[x7]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e===`data`||e===void 0)&&(this[R7]=0,!this[z7]&&!this[T7].length&&(this[x7]=!1)),t}get emittedEnd(){return this[m7]}[p7](){!this[h7]&&!this[m7]&&!this[A7]&&this[w7].length===0&&this[f7]&&(this[h7]=!0,this.emit(`end`),this.emit(`prefinish`),this.emit(`finish`),this[_7]&&this.emit(`close`),this[h7]=!1)}emit(e,...t){let n=t[0];if(e!==`error`&&e!==`close`&&e!==A7&&this[A7])return!1;if(e===`data`)return!this[k7]&&!n?!1:this[P7]?(B7(()=>this[M7](n)),!0):this[M7](n);if(e===`end`)return this[BZe]();if(e===`close`){if(this[_7]=!0,!this[m7]&&!this[A7])return!1;let e=super.emit(`close`);return this.removeAllListeners(`close`),e}else if(e===`error`){this[g7]=n,super.emit(j7,n);let e=!this[L7]||this.listeners(`error`).length?super.emit(`error`,n):!1;return this[p7](),e}else if(e===`resume`){let e=super.emit(`resume`);return this[p7](),e}else if(e===`finish`||e===`prefinish`){let t=super.emit(e);return this.removeAllListeners(e),t}let r=super.emit(e,...t);return this[p7](),r}[M7](e){for(let t of this[T7])t.dest.write(e)===!1&&this.pause();let t=this[z7]?!1:super.emit(`data`,e);return this[p7](),t}[BZe](){return this[m7]?!1:(this[m7]=!0,this.readable=!1,this[P7]?(B7(()=>this[N7]()),!0):this[N7]())}[N7](){if(this[b7]){let e=this[b7].end();if(e){for(let t of this[T7])t.dest.write(e);this[z7]||super.emit(`data`,e)}}for(let e of this[T7])e.end();let e=super.emit(`end`);return this.removeAllListeners(`end`),e}async collect(){let e=Object.assign([],{dataLength:0});this[k7]||(e.dataLength=0);let t=this.promise();return this.on(`data`,t=>{e.push(t),this[k7]||(e.dataLength+=t.length)}),await t,e}async concat(){if(this[k7])throw Error(`cannot concat in objectMode`);let e=await this.collect();return this[y7]?e.join(``):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(A7,()=>t(Error(`stream destroyed`))),this.on(`error`,e=>t(e)),this.on(`end`,()=>e())})}[Symbol.asyncIterator](){this[z7]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[f7])return t();let r,i,a=e=>{this.off(`data`,o),this.off(`end`,s),this.off(A7,c),t(),i(e)},o=e=>{this.off(`error`,a),this.off(`end`,s),this.off(A7,c),this.pause(),r({value:e,done:!!this[f7]})},s=()=>{this.off(`error`,a),this.off(`data`,o),this.off(A7,c),t(),r({done:!0,value:void 0})},c=()=>a(Error(`stream destroyed`));return new Promise((e,t)=>{i=t,r=e,this.once(A7,c),this.once(`error`,a),this.once(`end`,s),this.once(`data`,o)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[z7]=!1;let e=!1,t=()=>(this.pause(),this.off(j7,t),this.off(A7,t),this.off(`end`,t),e=!0,{done:!0,value:void 0});return this.once(`end`,t),this.once(j7,t),this.once(A7,t),{next:()=>{if(e)return t();let n=this.read();return n===null?t():{done:!1,value:n}},throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[A7])return e?this.emit(`error`,e):this.emit(A7),this;this[A7]=!0,this[z7]=!0,this[w7].length=0,this[E7]=0;let t=this;return typeof t.close==`function`&&!this[_7]&&t.close(),e?this.emit(`error`,e):this.emit(A7),this}static get isStream(){return FZe}},H7={lstatSync:Zd,readdir:mf,readdirSync:hf,readlinkSync:_f,realpathSync:yf.native,promises:{lstat:xf,readdir:mf,readlink:gf,realpath:vf}},YZe=e=>!e||e===H7||e===Nd?H7:{...H7,...e,promises:{...H7.promises,...e.promises||{}}},XZe=/^\\\\\?\\([a-z]:)\\?$/i,ZZe=e=>e.replace(/\//g,`\\`).replace(XZe,`$1\\`),QZe=/[\\\/]/,U7=0,$Ze=1,eQe=2,W7=4,tQe=6,nQe=8,G7=10,rQe=12,K7=15,q7=~K7,J7=16,iQe=32,Y7=64,X7=128,Z7=256,Q7=512,aQe=Y7|X7|Q7,oQe=1023,$7=e=>e.isFile()?nQe:e.isDirectory()?W7:e.isSymbolicLink()?G7:e.isCharacterDevice()?eQe:e.isBlockDevice()?tQe:e.isSocket()?rQe:e.isFIFO()?$Ze:U7,sQe=new d7({max:2**12}),e9=e=>{let t=sQe.get(e);if(t)return t;let n=e.normalize(`NFKD`);return sQe.set(e,n),n},cQe=new d7({max:2**12}),t9=e=>{let t=cQe.get(e);if(t)return t;let n=e9(e.toLowerCase());return cQe.set(e,n),n},lQe=class extends d7{constructor(){super({max:256})}},uQe=class extends d7{constructor(e=16*1024){super({maxSize:e,sizeCalculation:e=>e.length+1})}},dQe=Symbol(`PathScurry setAsCwd`),n9=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#i;get uid(){return this.#i}#a;get gid(){return this.#a}#o;get rdev(){return this.#o}#s;get blksize(){return this.#s}#c;get ino(){return this.#c}#l;get size(){return this.#l}#u;get blocks(){return this.#u}#d;get atimeMs(){return this.#d}#f;get mtimeMs(){return this.#f}#p;get ctimeMs(){return this.#p}#m;get birthtimeMs(){return this.#m}#h;get atime(){return this.#h}#g;get mtime(){return this.#g}#_;get ctime(){return this.#_}#v;get birthtime(){return this.#v}#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=U7,n,r,i,a,o){this.name=e,this.#y=i?t9(e):e9(e),this.#T=t&oQe,this.nocase=i,this.roots=r,this.root=n||this,this.#E=a,this.#x=o.fullpath,this.#C=o.relative,this.#w=o.relativePosix,this.parent=o.parent,this.parent?this.#e=this.parent.#e:this.#e=YZe(o.fs)}depth(){return this.#b===void 0?this.parent?this.#b=this.parent.depth()+1:this.#b=0:this.#b}childrenCache(){return this.#E}resolve(e){if(!e)return this;let t=this.getRootString(e),n=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#k(n):this.#k(n)}#k(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#E.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#E.set(this,t),this.#T&=~J7,t}child(e,t){if(e===``||e===`.`)return this;if(e===`..`)return this.parent||this;let n=this.children(),r=this.nocase?t9(e):e9(e);for(let e of n)if(e.#y===r)return e;let i=this.parent?this.sep:``,a=this.#x?this.#x+i+e:void 0,o=this.newChild(e,U7,{...t,parent:this,fullpath:a});return this.canReaddir()||(o.#T|=X7),n.push(o),o}relative(){if(this.isCWD)return``;if(this.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.name;let n=t.relative();return n+(!n||!t.parent?``:this.sep)+e}relativePosix(){if(this.sep===`/`)return this.relative();if(this.isCWD)return``;if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?``:`/`)+e}fullpath(){if(this.#x!==void 0)return this.#x;let e=this.name,t=this.parent;return t?this.#x=t.fullpath()+(t.parent?this.sep:``)+e:this.#x=this.name}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep===`/`)return this.#S=this.fullpath();if(!this.parent){let e=this.fullpath().replace(/\\/g,`/`);return/^[a-z]:\//i.test(e)?this.#S=`//?/${e}`:this.#S=e}let e=this.parent,t=e.fullpathPosix();return this.#S=t+(!t||!e.parent?``:`/`)+this.name}isUnknown(){return(this.#T&K7)===U7}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?`Unknown`:this.isDirectory()?`Directory`:this.isFile()?`File`:this.isSymbolicLink()?`SymbolicLink`:this.isFIFO()?`FIFO`:this.isCharacterDevice()?`CharacterDevice`:this.isBlockDevice()?`BlockDevice`:this.isSocket()?`Socket`:`Unknown`}isFile(){return(this.#T&K7)===nQe}isDirectory(){return(this.#T&K7)===W7}isCharacterDevice(){return(this.#T&K7)===eQe}isBlockDevice(){return(this.#T&K7)===tQe}isFIFO(){return(this.#T&K7)===$Ze}isSocket(){return(this.#T&K7)===rQe}isSymbolicLink(){return(this.#T&G7)===G7}lstatCached(){return this.#T&iQe?this:void 0}readlinkCached(){return this.#D}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#D)return!0;if(!this.parent)return!1;let e=this.#T&K7;return!(e!==U7&&e!==G7||this.#T&Z7||this.#T&X7)}calledReaddir(){return!!(this.#T&J7)}isENOENT(){return!!(this.#T&X7)}isNamed(e){return this.nocase?this.#y===t9(e):this.#y===e9(e)}async readlink(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=await this.#e.promises.readlink(this.fullpath()),t=(await this.parent.realpath())?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}readlinkSync(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=this.#e.readlinkSync(this.fullpath()),t=this.parent.realpathSync()?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}#A(e){this.#T|=J7;for(let t=e.provisional;tt(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let r=n.slice(0,n.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#U.push(e),this.#W)return;this.#W=!0;let r=this.fullpath();this.#e.readdir(r,{withFileTypes:!0},(e,t)=>{if(e)this.#F(e.code),n.provisional=0;else{for(let e of t)this.#R(e,n);this.#A(n)}this.#G(n.slice(0,n.provisional))})}#K;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#K)await this.#K;else{let n=()=>{};this.#K=new Promise(e=>n=e);try{for(let n of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}this.#K=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#e.readdirSync(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#T&aQe)return!1;let e=K7&this.#T;return e===U7||e===W7||e===G7}shouldWalk(e,t){return(this.#T&W7)===W7&&!(this.#T&aQe)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((Q7|Z7|X7)&this.#T))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}realpathSync(){if(this.#O)return this.#O;if(!((Q7|Z7|X7)&this.#T))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}[dQe](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),n=[],r=this;for(;r&&r.parent;)t.add(r),r.#C=n.join(this.sep),r.#w=n.join(`/`),r=r.parent,n.push(`..`);for(r=e;r&&r.parent&&!t.has(r);)r.#C=void 0,r.#w=void 0,r=r.parent}},fQe=class e extends n9{sep=`\\`;splitSep=QZe;constructor(e,t=U7,n,r,i,a,o){super(e,t,n,r,i,a,o)}newChild(t,n=U7,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return cf.parse(e).root}getRoot(e){if(e=ZZe(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new r9(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,`\\`).replace(XZe,`$1\\`),e===t}},pQe=class e extends n9{splitSep=`/`;sep=`/`;constructor(e,t=U7,n,r,i,a,o){super(e,t,n,r,i,a,o)}getRootString(e){return e.startsWith(`/`)?`/`:``}getRoot(e){return this.root}newChild(t,n=U7,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}},mQe=class{root;rootPath;roots;cwd;#e;#t;#n;nocase;#r;constructor(e=process.cwd(),t,n,{nocase:r,childrenCacheSize:i=16*1024,fs:a=H7}={}){this.#r=YZe(a),(e instanceof URL||e.startsWith(`file://`))&&(e=ff(e));let o=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#e=new lQe,this.#t=new lQe,this.#n=new uQe(i);let s=o.substring(this.rootPath.length).split(n);if(s.length===1&&!s[0]&&s.pop(),r===void 0)throw TypeError(`must provide nocase setting to PathScurryBase ctor`);this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let c=this.root,l=s.length-1,u=t.sep,d=this.rootPath,f=!1;for(let e of s){let t=l--;c=c.child(e,{relative:Array(t).fill(`..`).join(u),relativePosix:Array(t).fill(`..`).join(`/`),fullpath:d+=(f?``:u)+e}),f=!0}this.cwd=c}depth(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(!(!r||r===`.`)&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#e.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpath();return this.#e.set(t,r),r}resolvePosix(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(!(!r||r===`.`)&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#t.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpathPosix();return this.#t.set(t,r),r}relative(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let t=await e.readdir();return n?t:t.map(e=>e.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(e=>e.name):[]}async lstat(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=new Set,c=(e,t)=>{s.add(e),e.readdirCB((e,l)=>{if(e)return t(e);let u=l.length;if(!u)return t();let d=()=>{--u===0&&t()};for(let e of l)(!i||i(e))&&o.push(n?e:e.fullpath()),r&&e.isSymbolicLink()?e.realpath().then(e=>e?.isUnknown()?e.lstat():e).then(e=>e?.shouldWalk(s,a)?c(e,d):d()):e.shouldWalk(s,a)?c(e,d):d()},!0)},l=e;return new Promise((e,t)=>{c(l,n=>{if(n)return t(n);e(o)})})}walkSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=new Set([e]);for(let e of s){let t=e.readdirSync();for(let e of t){(!i||i(e))&&o.push(n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&s.add(t)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t;(!i||i(e))&&(yield n?e:e.fullpath());let o=new Set([e]);for(let e of o){let t=e.readdirSync();for(let e of t){(!i||i(e))&&(yield n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(o,a)&&o.add(t)}}}stream(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new V7({objectMode:!0});(!i||i(e))&&o.write(n?e:e.fullpath());let s=new Set,c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let d=(t,p,m=!1)=>{if(t)return o.emit(`error`,t);if(r&&!m){let e=[];for(let t of p)t.isSymbolicLink()&&e.push(t.realpath().then(e=>e?.isUnknown()?e.lstat():e));if(e.length){Promise.all(e).then(()=>d(null,p,!0));return}}for(let t of p)t&&(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of p){let t=e.realpathCached()||e;t.shouldWalk(s,a)&&c.push(t)}e&&!o.flowing?o.once(`drain`,u):f||u()},f=!0;t.readdirCB(d,!0),f=!1}};return u(),o}streamSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof n9||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new V7({objectMode:!0}),s=new Set;(!i||i(e))&&o.write(n?e:e.fullpath());let c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let u=t.readdirSync();for(let t of u)(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of u){let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&c.push(t)}}e&&!o.flowing&&o.once(`drain`,u)};return u(),o}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e==`string`?this.cwd.resolve(e):e,this.cwd[dQe](t)}},r9=class extends mQe{sep=`\\`;constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,cf,`\\`,{...t,nocase:n}),this.nocase=n;for(let e=this.cwd;e;e=e.parent)e.nocase=this.nocase}parseRootPath(e){return cf.parse(e).root.toUpperCase()}newRoot(e){return new fQe(this.rootPath,W7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)||e.startsWith(`\\`)||/^[a-z]:(\/|\\)/i.test(e)}},i9=class extends mQe{sep=`/`;constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,sf,`/`,{...t,nocase:n}),this.nocase=n}parseRootPath(e){return`/`}newRoot(e){return new pQe(this.rootPath,W7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)}},hQe=class extends i9{constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}};process.platform;var gQe=process.platform===`win32`?r9:process.platform===`darwin`?hQe:i9,_Qe=e=>e.length>=1,vQe=e=>e.length>=1,yQe=Symbol.for(`nodejs.util.inspect.custom`),bQe=class e{#e;#t;#n;length;#r;#i;#a;#o;#s;#c;#l=!0;constructor(e,t,n,r){if(!_Qe(e))throw TypeError(`empty pattern list`);if(!vQe(t))throw TypeError(`empty glob list`);if(t.length!==e.length)throw TypeError(`mismatched pattern list and glob list lengths`);if(this.length=e.length,n<0||n>=this.length)throw TypeError(`index out of range`);if(this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#n===0){if(this.isUNC()){let[e,t,n,r,...i]=this.#e,[a,o,s,c,...l]=this.#t;i[0]===``&&(i.shift(),l.shift());let u=[e,t,n,r,``].join(`/`),d=[a,o,s,c,``].join(`/`);this.#e=[u,...i],this.#t=[d,...l],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[e,...t]=this.#e,[n,...r]=this.#t;t[0]===``&&(t.shift(),r.shift());let i=e+`/`,a=n+`/`;this.#e=[i,...t],this.#t=[a,...r],this.length=this.#e.length}}}[yQe](){return`Pattern <`+this.#t.slice(this.#n).join(`/`)+`>`}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]==`string`}isGlobstar(){return this.#e[this.#n]===i7}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#a=this.#a||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join(`/`):this.#t.join(`/`):this.#t.slice(this.#n).join(`/`))}hasMore(){return this.length>this.#n+1}rest(){return this.#i===void 0?this.hasMore()?(this.#i=new e(this.#e,this.#t,this.#n+1,this.#r),this.#i.#c=this.#c,this.#i.#s=this.#s,this.#i.#o=this.#o,this.#i):this.#i=null:this.#i}isUNC(){let e=this.#e;return this.#s===void 0?this.#s=this.#r===`win32`&&this.#n===0&&e[0]===``&&e[1]===``&&typeof e[2]==`string`&&!!e[2]&&typeof e[3]==`string`&&!!e[3]:this.#s}isDrive(){let e=this.#e;return this.#o===void 0?this.#o=this.#r===`win32`&&this.#n===0&&this.length>1&&typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]):this.#o}isAbsolute(){let e=this.#e;return this.#c===void 0?this.#c=e[0]===``&&e.length>1||this.isDrive()||this.isUNC():this.#c}root(){let e=this.#e[0];return typeof e==`string`&&this.isAbsolute()&&this.#n===0?e:``}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}},xQe=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`,SQe=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:r,noglobstar:i,platform:a=xQe}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:r,noglobstar:i,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let t of e)this.add(t)}add(e){let t=new o7(e,this.mmopts);for(let e=0;e[e,!!(t&2),!!(t&1)])}},TQe=class{store=new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(e=>e.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw Error(`attempting to walk unknown path`);return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},EQe=class e{hasWalkedCache;matches=new wQe;subwalks=new TQe;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new CQe}processPatterns(e,t){this.patterns=t;let n=t.map(t=>[e,t]);for(let[e,t]of n){this.hasWalkedCache.storeWalked(e,t);let n=t.root(),r=t.isAbsolute()&&this.opts.absolute!==!1;if(n){e=e.resolve(n===`/`&&this.opts.root!==void 0?this.opts.root:n);let r=t.rest();if(r)t=r;else{this.matches.add(e,!0,!1);continue}}if(e.isENOENT())continue;let i,a,o=!1;for(;typeof(i=t.pattern())==`string`&&(a=t.rest());)e=e.resolve(i),t=a,o=!0;if(i=t.pattern(),a=t.rest(),o){if(this.hasWalkedCache.hasWalked(e,t))continue;this.hasWalkedCache.storeWalked(e,t)}if(typeof i==`string`){let t=i===`..`||i===``||i===`.`;this.matches.add(e.resolve(i),r,t);continue}else if(i===i7){(!e.isSymbolicLink()||this.follow||t.checkFollowGlobstar())&&this.subwalks.add(e,t);let n=a?.pattern(),i=a?.rest();if(!a||(n===``||n===`.`)&&!i)this.matches.add(e,r,n===``||n===`.`);else if(n===`..`){let t=e.parent||e;i?this.hasWalkedCache.hasWalked(t,i)||this.subwalks.add(t,i):this.matches.add(t,r,!0)}}else i instanceof RegExp&&this.subwalks.add(e,t)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),r=this.child();for(let e of t)for(let t of n){let n=t.isAbsolute(),i=t.pattern(),a=t.rest();i===i7?r.testGlobstar(e,t,a,n):i instanceof RegExp?r.testRegExp(e,i,a,n):r.testString(e,i,a,n)}return r}testGlobstar(e,t,n,r){if((this.dot||!e.name.startsWith(`.`))&&(t.hasMore()||this.matches.add(e,r,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let t=n.pattern();if(typeof t==`string`&&t!==`..`&&t!==``&&t!==`.`)this.testString(e,t,n.rest(),r);else if(t===`..`){let t=e.parent||e;this.subwalks.add(t,n)}else t instanceof RegExp&&this.testRegExp(e,t,n.rest(),r)}}testRegExp(e,t,n,r){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}testString(e,t,n,r){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}},DQe=(e,t)=>typeof e==`string`?new SQe([e],t):Array.isArray(e)?new SQe(e,t):e,OQe=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#t;#n;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#n=!n.posix&&n.platform===`win32`?`\\`:`/`,this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#t=DQe(n.ignore??[],n),!this.includeChildMatches&&typeof this.#t.add!=`function`))throw Error(`cannot ignore child matches, ignore lacks add() method.`);this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener(`abort`,()=>{this.#e.length=0}))}#r(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#i(e){return!!this.#t?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=await r.realpath();e&&(e.isUnknown()||this.opts.stat)&&await e.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#r(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=r.realpathSync();e&&(e?.isUnknown()||this.opts.stat)&&e.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#r(e))return;if(!this.includeChildMatches&&this.#t?.add){let t=`${e.relativePosix()}/**`;this.#t.add(t)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let r=this.opts.mark&&e.isDirectory()?this.#n:``;if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let t=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(t+r)}else{let t=this.opts.posix?e.relativePosix():e.relative(),n=this.opts.dotRelative&&!t.startsWith(`..`+this.#n)?`.`+this.#n:``;this.matchEmit(t?n+t+r:`.`+r)}}async match(e,t,n){let r=await this.matchCheck(e,n);r&&this.matchFinish(r,t)}matchSync(e,t,n){let r=this.matchCheckSync(e,n);r&&this.matchFinish(r,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new EQe(this.opts),n)}walkCB2(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirCached();e.calledReaddir()?this.walkCB3(e,t,n,a):e.readdirCB((t,r)=>this.walkCB3(e,r,n,a),!0)}a()}walkCB3(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let[e,t]of n.subwalks.entries())i++,this.walkCB2(e,t,n.child(),a);a()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new EQe(this.opts),n)}walkCB2Sync(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirSync();this.walkCB3Sync(e,t,n,a)}a()}walkCB3Sync(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let[e,t]of n.subwalks.entries())i++,this.walkCB2Sync(e,t,n.child(),a);a()}},kQe=class extends OQe{matches=new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},AQe=class extends OQe{results;constructor(e,t,n){super(e,t,n),this.results=new V7({signal:this.signal,objectMode:!0}),this.results.on(`drain`,()=>this.resume()),this.results.on(`resume`,()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},jQe=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`,a9=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw TypeError(`glob options required`);if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith(`file://`))&&(t.cwd=ff(t.cwd)):this.cwd=``,this.cwd=t.cwd||``,this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth==`number`?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error(`cannot set absolute and withFileTypes:true`);if(typeof e==`string`&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(e=>e.replace(/\\/g,`/`))),this.matchBase){if(t.noglobstar)throw TypeError(`base matching requires globstar`);e=e.map(e=>e.includes(`/`)?e:`./**/${e}`)}if(this.pattern=e,this.platform=t.platform||jQe,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw Error(`nocase option contradicts provided scurry option`)}else this.scurry=new(t.platform===`win32`?r9:t.platform===`darwin`?hQe:t.platform?i9:gQe)(this.cwd,{nocase:t.nocase,fs:t.fs});this.nocase=this.scurry.nocase;let n=this.platform===`darwin`||this.platform===`win32`,r={braceExpandMax:1e4,...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[i,a]=this.pattern.map(e=>new o7(e,r)).reduce((e,t)=>(e[0].push(...t.set),e[1].push(...t.globParts),e),[[],[]]);this.patterns=i.map((e,t)=>{let n=a[t];if(!n)throw Error(`invalid pattern object`);return new bQe(e,n,0,this.platform)})}async walk(){return[...await new kQe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new kQe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new AQe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new AQe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}},MQe=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let n of e)if(new o7(n,t).hasMagic())return!0;return!1};function o9(e,t={}){return new a9(e,t).streamSync()}function NQe(e,t={}){return new a9(e,t).stream()}function PQe(e,t={}){return new a9(e,t).walkSync()}async function FQe(e,t={}){return new a9(e,t).walk()}function s9(e,t={}){return new a9(e,t).iterateSync()}function IQe(e,t={}){return new a9(e,t).iterate()}var LQe=o9,RQe=Object.assign(NQe,{sync:o9}),zQe=s9,BQe=Object.assign(IQe,{sync:s9}),VQe=Object.assign(PQe,{stream:o9,iterate:s9}),c9=Object.assign(FQe,{glob:FQe,globSync:PQe,sync:VQe,globStream:NQe,stream:RQe,globStreamSync:o9,streamSync:LQe,globIterate:IQe,iterate:BQe,globIterateSync:s9,iterateSync:zQe,Glob:a9,hasMagic:MQe,escape:QXe,unescape:e7});c9.glob=c9;var HQe=Object.defineProperty,UQe=(e,t)=>{for(var n in t)HQe(e,n,{get:t[n],enumerable:!0})},WQe=class{serialize(e,t){let{prettify:n=!0,indent:r=2,sortKeys:i=!1}=t||{};if(i){let t=this.sortObjectKeys(e);return n?JSON.stringify(t,null,r):JSON.stringify(t)}return n?JSON.stringify(e,null,r):JSON.stringify(e)}deserialize(e,t){let n=JSON.parse(e);return t?t.parse(n):n}getExtension(){return`.json`}canHandle(e){return e===`json`}getFormat(){return`json`}sortObjectKeys(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>this.sortObjectKeys(e));let t={},n=Object.keys(e).sort();for(let r of n)t[r]=this.sortObjectKeys(e[r]);return t}},GQe=class{serialize(e,t){let{indent:n=2,sortKeys:r=!1}=t||{};return uXe(e,{indent:n,sortKeys:r,lineWidth:-1,noRefs:!0})}deserialize(e,t){let n=lXe(e,{schema:cXe});return t?t.parse(n):n}getExtension(){return`.yaml`}canHandle(e){return e===`yaml`}getFormat(){return`yaml`}},KQe=class{constructor(e=`typescript`){this.format=e}serialize(e,t){let{prettify:n=!0,indent:r=2}=t||{},i=JSON.stringify(e,null,n?r:0);return this.format===`typescript`?`import type { ServiceObject } from '@objectstack/spec/data'; - -export const metadata: ServiceObject = ${i}; - -export default metadata; -`:`export const metadata = ${i}; - -export default metadata; -`}deserialize(e,t){let n=e.indexOf(`export const`);if(n===-1&&(n=e.indexOf(`export default`)),n===-1)throw Error(`Could not parse TypeScript/JavaScript module. Expected export pattern: "export const metadata = {...};" or "export default {...};"`);let r=e.indexOf(`{`,n);if(r===-1)throw Error(`Could not find object literal in export statement`);let i=0,a=-1,o=!1,s=``;for(let t=r;t0?e[t-1]:``;if((n===`"`||n===`'`)&&r!==`\\`&&(o?n===s&&(o=!1,s=``):(o=!0,s=n)),!o&&(n===`{`&&i++,n===`}`&&(i--,i===0))){a=t;break}}if(a===-1)throw Error(`Could not find matching closing brace for object literal`);let c=e.substring(r,a+1);try{let e=JSON.parse(c);return t?t.parse(e):e}catch(e){throw Error(`Failed to parse object literal as JSON: ${e instanceof Error?e.message:String(e)}. Make sure the TypeScript/JavaScript object uses JSON-compatible syntax (no functions, comments, or trailing commas).`)}}getExtension(){return this.format===`typescript`?`.ts`:`.js`}canHandle(e){return e===`typescript`||e===`javascript`}getFormat(){return this.format}},qQe=O.create({namespace:`sys`,name:`metadata`,label:`System Metadata`,pluralLabel:`System Metadata`,icon:`settings`,isSystem:!0,description:`Stores platform and user-scope metadata records (objects, views, flows, etc.)`,fields:{id:j.text({label:`ID`,required:!0,readonly:!0}),name:j.text({label:`Name`,required:!0,searchable:!0,maxLength:255}),type:j.text({label:`Metadata Type`,required:!0,searchable:!0,maxLength:100}),namespace:j.text({label:`Namespace`,required:!1,defaultValue:`default`,maxLength:100}),package_id:j.text({label:`Package ID`,required:!1,maxLength:255}),managed_by:j.select([`package`,`platform`,`user`],{label:`Managed By`,required:!1}),scope:j.select([`system`,`platform`,`user`],{label:`Scope`,required:!0,defaultValue:`platform`}),metadata:j.textarea({label:`Metadata`,required:!0,description:`JSON-serialized metadata payload`}),extends:j.text({label:`Extends`,required:!1,maxLength:255}),strategy:j.select([`merge`,`replace`],{label:`Strategy`,required:!1,defaultValue:`merge`}),owner:j.text({label:`Owner`,required:!1,maxLength:255}),state:j.select([`draft`,`active`,`archived`,`deprecated`],{label:`State`,required:!1,defaultValue:`active`}),tenant_id:j.text({label:`Tenant ID`,required:!1,maxLength:255}),version:j.number({label:`Version`,required:!1,defaultValue:1}),checksum:j.text({label:`Checksum`,required:!1,maxLength:64}),source:j.select([`filesystem`,`database`,`api`,`migration`],{label:`Source`,required:!1}),tags:j.textarea({label:`Tags`,required:!1,description:`JSON-serialized array of classification tags`}),created_by:j.text({label:`Created By`,required:!1,readonly:!0,maxLength:255}),created_at:j.datetime({label:`Created At`,required:!1,readonly:!0}),updated_by:j.text({label:`Updated By`,required:!1,maxLength:255}),updated_at:j.datetime({label:`Updated At`,required:!1})},indexes:[{fields:[`type`,`name`],unique:!0},{fields:[`type`,`scope`]},{fields:[`tenant_id`]},{fields:[`state`]},{fields:[`namespace`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1}}),JQe=O.create({namespace:`sys`,name:`metadata_history`,label:`Metadata History`,pluralLabel:`Metadata History`,icon:`history`,isSystem:!0,description:`Version history and audit trail for metadata changes`,fields:{id:j.text({label:`ID`,required:!0,readonly:!0}),metadata_id:j.text({label:`Metadata ID`,required:!0,readonly:!0,maxLength:255}),name:j.text({label:`Name`,required:!0,searchable:!0,readonly:!0,maxLength:255}),type:j.text({label:`Metadata Type`,required:!0,searchable:!0,readonly:!0,maxLength:100}),version:j.number({label:`Version`,required:!0,readonly:!0}),operation_type:j.select([`create`,`update`,`publish`,`revert`,`delete`],{label:`Operation Type`,required:!0,readonly:!0}),metadata:j.textarea({label:`Metadata`,required:!0,readonly:!0,description:`JSON-serialized metadata snapshot at this version`}),checksum:j.text({label:`Checksum`,required:!0,readonly:!0,maxLength:64}),previous_checksum:j.text({label:`Previous Checksum`,required:!1,readonly:!0,maxLength:64}),change_note:j.textarea({label:`Change Note`,required:!1,readonly:!0,description:`Description of what changed in this version`}),tenant_id:j.text({label:`Tenant ID`,required:!1,readonly:!0,maxLength:255}),recorded_by:j.text({label:`Recorded By`,required:!1,readonly:!0,maxLength:255}),recorded_at:j.datetime({label:`Recorded At`,required:!0,readonly:!0})},indexes:[{fields:[`metadata_id`,`version`],unique:!0},{fields:[`metadata_id`,`recorded_at`]},{fields:[`type`,`name`]},{fields:[`recorded_at`]},{fields:[`operation_type`]},{fields:[`tenant_id`]}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`],trash:!1}});async function l9(e){let t=u9(e),n=JSON.stringify(t);if(globalThis.crypto!==void 0&&globalThis.crypto.subtle){let e=new TextEncoder().encode(n),t=await globalThis.crypto.subtle.digest(`SHA-256`,e);return Array.from(new Uint8Array(t)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}return YQe(n)}function u9(e){if(e==null)return e;if(Array.isArray(e))return e.map(u9);if(typeof e==`object`){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=u9(e[r]);return t}return e}function YQe(e){let t=5381;for(let n=0;ne.op===`add`).length,r=e.filter(e=>e.op===`remove`).length,i=e.filter(e=>e.op===`replace`).length;return n>0&&t.push(`${n} field${n>1?`s`:``} added`),r>0&&t.push(`${r} field${r>1?`s`:``} removed`),i>0&&t.push(`${i} field${i>1?`s`:``} modified`),t.join(`, `)}var ZQe=class{constructor(e){this.contract={name:`database`,protocol:`datasource:`,capabilities:{read:!0,write:!0,watch:!1,list:!0}},this.schemaReady=!1,this.historySchemaReady=!1,this.driver=e.driver,this.tableName=e.tableName??`sys_metadata`,this.historyTableName=e.historyTableName??`sys_metadata_history`,this.tenantId=e.tenantId,this.trackHistory=e.trackHistory!==!1}async ensureSchema(){if(!this.schemaReady)try{await this.driver.syncSchema(this.tableName,{...qQe,name:this.tableName}),this.schemaReady=!0}catch{this.schemaReady=!0}}async ensureHistorySchema(){if(!(!this.trackHistory||this.historySchemaReady))try{await this.driver.syncSchema(this.historyTableName,{...JQe,name:this.historyTableName}),this.historySchemaReady=!0}catch(e){console.error(`Failed to ensure history schema, will retry on next operation:`,e)}}baseFilter(e,t){let n={type:e};return t!==void 0&&(n.name=t),this.tenantId&&(n.tenant_id=this.tenantId),n}async createHistoryRecord(e,t,n,r,i,a,o,s,c){if(!this.trackHistory)return;await this.ensureHistorySchema();let l=new Date().toISOString(),u=await l9(i);if(o&&u===o&&a===`update`)return;let d={id:QQe(),metadataId:e,name:n,type:t,version:r,operationType:a,metadata:JSON.stringify(i),checksum:u,previousChecksum:o,changeNote:s,recordedBy:c,recordedAt:l,...this.tenantId?{tenantId:this.tenantId}:{}};try{await this.driver.create(this.historyTableName,{id:d.id,metadata_id:d.metadataId,name:d.name,type:d.type,version:d.version,operation_type:d.operationType,metadata:d.metadata,checksum:d.checksum,previous_checksum:d.previousChecksum,change_note:d.changeNote,recorded_by:d.recordedBy,recorded_at:d.recordedAt,...this.tenantId?{tenant_id:this.tenantId}:{}})}catch(e){console.error(`Failed to create history record for ${t}/${n}:`,e)}}rowToData(e){return!e||!e.metadata?null:typeof e.metadata==`string`?JSON.parse(e.metadata):e.metadata}rowToRecord(e){return{id:e.id,name:e.name,type:e.type,namespace:e.namespace??`default`,packageId:e.package_id,managedBy:e.managed_by,scope:e.scope??`platform`,metadata:this.rowToData(e)??{},extends:e.extends,strategy:e.strategy??`merge`,owner:e.owner,state:e.state??`active`,tenantId:e.tenant_id,version:e.version??1,checksum:e.checksum,source:e.source,tags:e.tags?typeof e.tags==`string`?JSON.parse(e.tags):e.tags:void 0,createdBy:e.created_by,createdAt:e.created_at,updatedBy:e.updated_by,updatedAt:e.updated_at}}async load(e,t,n){let r=Date.now();await this.ensureSchema();try{let n=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});return n?{data:this.rowToData(n),source:`database`,format:`json`,etag:this.rowToRecord(n).checksum,loadTime:Date.now()-r}:{data:null,loadTime:Date.now()-r}}catch{return{data:null,loadTime:Date.now()-r}}}async loadMany(e,t){await this.ensureSchema();try{return(await this.driver.find(this.tableName,{object:this.tableName,where:this.baseFilter(e)})).map(e=>this.rowToData(e)).filter(e=>e!==null)}catch{return[]}}async exists(e,t){await this.ensureSchema();try{return await this.driver.count(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)})>0}catch{return!1}}async stat(e,t){await this.ensureSchema();try{let n=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});if(!n)return null;let r=this.rowToRecord(n);return{size:(typeof n.metadata==`string`?n.metadata:JSON.stringify(n.metadata)).length,mtime:r.updatedAt??r.createdAt??new Date().toISOString(),format:`json`,etag:r.checksum}}catch{return null}}async list(e){await this.ensureSchema();try{return(await this.driver.find(this.tableName,{object:this.tableName,where:this.baseFilter(e),fields:[`name`]})).map(e=>e.name).filter(e=>typeof e==`string`)}catch{return[]}}async getHistoryRecord(e,t,n){if(!this.trackHistory)return null;await this.ensureHistorySchema();let r=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});if(!r)return null;let i={metadata_id:r.id,version:n};this.tenantId&&(i.tenant_id=this.tenantId);let a=await this.driver.findOne(this.historyTableName,{object:this.historyTableName,where:i});return a?{id:a.id,metadataId:a.metadata_id,name:a.name,type:a.type,version:a.version,operationType:a.operation_type,metadata:typeof a.metadata==`string`?JSON.parse(a.metadata):a.metadata,checksum:a.checksum,previousChecksum:a.previous_checksum,changeNote:a.change_note,tenantId:a.tenant_id,recordedBy:a.recorded_by,recordedAt:a.recorded_at}:null}async registerRollback(e,t,n,r,i,a){await this.ensureSchema();let o=new Date().toISOString(),s=JSON.stringify(n),c=await l9(n),l=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});if(!l)throw Error(`Metadata ${e}/${t} not found for rollback`);let u=l.checksum,d=(l.version??0)+1;await this.driver.update(this.tableName,l.id,{metadata:s,version:d,checksum:c,updated_at:o,state:`active`}),await this.createHistoryRecord(l.id,e,t,d,n,`revert`,u,i??`Rolled back to version ${r}`,a)}async save(e,t,n,r){let i=Date.now();await this.ensureSchema();let a=new Date().toISOString(),o=JSON.stringify(n),s=await l9(n);try{let r=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});if(r){let c=r.checksum;if(s===c)return{success:!0,path:`datasource://${this.tableName}/${e}/${t}`,size:o.length,saveTime:Date.now()-i};let l=(r.version??0)+1;return await this.driver.update(this.tableName,r.id,{metadata:o,version:l,checksum:s,updated_at:a,state:`active`}),await this.createHistoryRecord(r.id,e,t,l,n,`update`,c),{success:!0,path:`datasource://${this.tableName}/${e}/${t}`,size:o.length,saveTime:Date.now()-i}}else{let r=QQe();return await this.driver.create(this.tableName,{id:r,name:t,type:e,namespace:`default`,scope:n?.scope??`platform`,metadata:o,checksum:s,strategy:`merge`,state:`active`,version:1,source:`database`,...this.tenantId?{tenant_id:this.tenantId}:{},created_at:a,updated_at:a}),await this.createHistoryRecord(r,e,t,1,n,`create`),{success:!0,path:`datasource://${this.tableName}/${e}/${t}`,size:o.length,saveTime:Date.now()-i}}}catch(n){throw Error(`DatabaseLoader save failed for ${e}/${t}: ${n instanceof Error?n.message:String(n)}`)}}async delete(e,t){await this.ensureSchema();let n=await this.driver.findOne(this.tableName,{object:this.tableName,where:this.baseFilter(e,t)});n&&await this.driver.delete(this.tableName,n.id)}};function QQe(){return globalThis.crypto!==void 0&&typeof globalThis.crypto.randomUUID==`function`?globalThis.crypto.randomUUID():`meta_${Date.now()}_${Math.random().toString(36).substring(2,10)}`}var $Qe=class{constructor(e){this.loaders=new Map,this.watchCallbacks=new Map,this.registry=new Map,this.overlays=new Map,this.typeRegistry=[],this.dependencies=new Map,this.config=e,this.logger=$f({level:`info`,format:`pretty`}),this.serializers=new Map;let t=e.formats||[`typescript`,`json`,`yaml`];t.includes(`json`)&&this.serializers.set(`json`,new WQe),t.includes(`yaml`)&&this.serializers.set(`yaml`,new GQe),t.includes(`typescript`)&&this.serializers.set(`typescript`,new KQe(`typescript`)),t.includes(`javascript`)&&this.serializers.set(`javascript`,new KQe(`javascript`)),e.loaders&&e.loaders.length>0&&e.loaders.forEach(e=>this.registerLoader(e)),e.datasource&&e.driver&&this.setDatabaseDriver(e.driver)}setTypeRegistry(e){this.typeRegistry=e}setDatabaseDriver(e){let t=this.config.tableName??`sys_metadata`,n=new ZQe({driver:e,tableName:t});this.registerLoader(n),this.logger.info(`DatabaseLoader configured`,{datasource:this.config.datasource,tableName:t})}setRealtimeService(e){this.realtimeService=e,this.logger.info(`RealtimeService configured for metadata events`)}registerLoader(e){this.loaders.set(e.contract.name,e),this.logger.info(`Registered metadata loader: ${e.contract.name} (${e.contract.protocol})`)}async register(e,t,n){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,n);for(let r of this.loaders.values())r.save&&r.contract.protocol===`datasource:`&&r.contract.capabilities.write&&await r.save(e,t,n);if(this.realtimeService){let r={type:`metadata.${e}.created`,object:e,payload:{metadataType:e,name:t,definition:n,packageId:n?.packageId},timestamp:new Date().toISOString()};try{await this.realtimeService.publish(r),this.logger.debug(`Published metadata.${e}.created event`,{name:t})}catch(n){this.logger.warn(`Failed to publish metadata event`,{type:e,name:t,error:n})}}}async get(e,t){let n=this.registry.get(e);return n?.has(t)?n.get(t):await this.load(e,t)??void 0}async list(e){let t=new Map,n=this.registry.get(e);if(n)for(let[e,r]of n)t.set(e,r);for(let n of this.loaders.values())try{let r=await n.loadMany(e);for(let e of r){let n=e;n&&typeof n.name==`string`&&!t.has(n.name)&&t.set(n.name,e)}}catch(t){this.logger.warn(`Loader ${n.contract.name} failed to loadMany ${e}`,{error:t})}return Array.from(t.values())}async unregister(e,t){let n=this.registry.get(e);n&&(n.delete(t),n.size===0&&this.registry.delete(e));for(let n of this.loaders.values())if(!(n.contract.protocol!==`datasource:`||!n.contract.capabilities.write)&&typeof n.delete==`function`)try{await n.delete(e,t)}catch(r){this.logger.warn(`Failed to delete ${e}/${t} from loader ${n.contract.name}`,{error:r})}if(this.realtimeService){let n={type:`metadata.${e}.deleted`,object:e,payload:{metadataType:e,name:t},timestamp:new Date().toISOString()};try{await this.realtimeService.publish(n),this.logger.debug(`Published metadata.${e}.deleted event`,{name:t})}catch(n){this.logger.warn(`Failed to publish metadata event`,{type:e,name:t,error:n})}}}async exists(e,t){if(this.registry.get(e)?.has(t))return!0;for(let n of this.loaders.values())if(await n.exists(e,t))return!0;return!1}async listNames(e){let t=new Set,n=this.registry.get(e);if(n)for(let e of n.keys())t.add(e);for(let n of this.loaders.values())(await n.list(e)).forEach(e=>t.add(e));return Array.from(t)}async getObject(e){return this.get(`object`,e)}async listObjects(){return this.list(`object`)}async getView(e){return this.get(`view`,e)}async listViews(e){let t=await this.list(`view`);return e?t.filter(t=>t?.object===e):t}async getDashboard(e){return this.get(`dashboard`,e)}async listDashboards(){return this.list(`dashboard`)}async unregisterPackage(e){let t=[];for(let[n,r]of this.registry)for(let[i,a]of r){let r=a;(r?.packageId===e||r?.package===e)&&t.push({type:n,name:i})}for(let{type:e,name:n}of t)await this.unregister(e,n)}async publishPackage(e,t){let n=new Date().toISOString(),r=t?.validate!==!1,i=t?.publishedBy,a=[];for(let[t,n]of this.registry)for(let[r,i]of n){let n=i;(n?.packageId===e||n?.package===e)&&a.push({type:t,name:r,data:n})}if(a.length===0)return{success:!1,packageId:e,version:0,publishedAt:n,itemsPublished:0,validationErrors:[{type:``,name:``,message:`No metadata items found for package '${e}'`}]};if(r){let t=[];for(let e of a){let n=await this.validate(e.type,e.data);if(!n.valid&&n.errors)for(let r of n.errors)t.push({type:e.type,name:e.name,message:r.message})}let r=new Set(a.map(e=>`${e.type}:${e.name}`));for(let e of a){let n=await this.getDependencies(e.type,e.name);for(let i of n){let n=`${i.targetType}:${i.targetName}`;if(r.has(n))continue;let a=await this.get(i.targetType,i.targetName);if(!a)t.push({type:e.type,name:e.name,message:`Dependency '${i.targetType}:${i.targetName}' not found`});else{let n=a;n.publishedDefinition===void 0&&n.state!==`active`&&t.push({type:e.type,name:e.name,message:`Dependency '${i.targetType}:${i.targetName}' is not published`})}}}if(t.length>0)return{success:!1,packageId:e,version:0,publishedAt:n,itemsPublished:0,validationErrors:t}}let o=0;for(let e of a){let t=typeof e.data.version==`number`?e.data.version:0;t>o&&(o=t)}let s=o+1;for(let e of a){let t={...e.data,publishedDefinition:structuredClone(e.data.metadata??e.data),publishedAt:n,publishedBy:i??e.data.publishedBy,version:s,state:`active`};await this.register(e.type,e.name,t)}return{success:!0,packageId:e,version:s,publishedAt:n,itemsPublished:a.length}}async revertPackage(e){let t=[];for(let[n,r]of this.registry)for(let[i,a]of r){let r=a;(r?.packageId===e||r?.package===e)&&t.push({type:n,name:i,data:r})}if(t.length===0)throw Error(`No metadata items found for package '${e}'`);if(!t.some(e=>e.data.publishedDefinition!==void 0))throw Error(`Package '${e}' has never been published`);for(let e of t)if(e.data.publishedDefinition!==void 0){let t={...e.data,metadata:structuredClone(e.data.publishedDefinition),state:`active`};await this.register(e.type,e.name,t)}}async getPublished(e,t){let n=await this.get(e,t);if(!n)return;let r=n;return r.publishedDefinition===void 0?r.metadata??n:r.publishedDefinition}async query(e){let{types:t,search:n,page:r=1,pageSize:i=50,sortBy:a=`name`,sortOrder:o=`asc`}=e,s=[],c=t&&t.length>0?t:Array.from(this.registry.keys());for(let e of c){let t=await this.list(e);for(let n of t){let t=n;s.push({type:e,name:t?.name??``,namespace:t?.namespace,label:t?.label,scope:t?.scope,state:t?.state,packageId:t?.packageId,updatedAt:t?.updatedAt})}}let l=s;if(n){let e=n.toLowerCase();l=l.filter(t=>t.name.toLowerCase().includes(e)||t.label&&t.label.toLowerCase().includes(e))}e.scope&&(l=l.filter(t=>t.scope===e.scope)),e.state&&(l=l.filter(t=>t.state===e.state)),e.namespaces&&e.namespaces.length>0&&(l=l.filter(t=>t.namespace&&e.namespaces.includes(t.namespace))),e.packageId&&(l=l.filter(t=>t.packageId===e.packageId)),e.tags&&e.tags.length>0&&(l=l.filter(t=>{let n=t;return n?.tags&&e.tags.some(e=>n.tags.includes(e))})),l.sort((e,t)=>{let n=e[a]??``,r=t[a]??``,i=String(n).localeCompare(String(r));return o===`desc`?-i:i});let u=l.length,d=(r-1)*i;return{items:l.slice(d,d+i),total:u,page:r,pageSize:i}}async bulkRegister(e,t){let{continueOnError:n=!1}=t??{},r=0,i=0,a=[];for(let t of e)try{await this.register(t.type,t.name,t.data),r++}catch(e){if(i++,a.push({type:t.type,name:t.name,error:e instanceof Error?e.message:String(e)}),!n)break}return{total:e.length,succeeded:r,failed:i,errors:a.length>0?a:void 0}}async bulkUnregister(e){let t=0,n=0,r=[];for(let i of e)try{await this.unregister(i.type,i.name),t++}catch(e){n++,r.push({type:i.type,name:i.name,error:e instanceof Error?e.message:String(e)})}return{total:e.length,succeeded:t,failed:n,errors:r.length>0?r:void 0}}overlayKey(e,t,n=`platform`){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}:${n}`}async getOverlay(e,t,n){return this.overlays.get(this.overlayKey(e,t,n??`platform`))}async saveOverlay(e){let t=this.overlayKey(e.baseType,e.baseName,e.scope);this.overlays.set(t,e)}async removeOverlay(e,t,n){this.overlays.delete(this.overlayKey(e,t,n??`platform`))}async getEffective(e,t,n){let r=await this.get(e,t);if(!r)return;let i={...r},a=await this.getOverlay(e,t,`platform`);if(a?.active&&a.patch&&(i={...i,...a.patch}),n?.userId){let r=this.overlayKey(e,t,`user`)+`:${n.userId}`,a=this.overlays.get(r)??await this.getOverlay(e,t,`user`);a?.active&&a.patch&&(!a.owner||a.owner===n.userId)&&(i={...i,...a.patch})}else{let n=await this.getOverlay(e,t,`user`);n?.active&&n.patch&&!n.owner&&(i={...i,...n.patch})}return i}watchService(e,t){let n=n=>{t({type:n.type===`added`?`registered`:n.type===`deleted`?`unregistered`:`updated`,metadataType:n.metadataType??e,name:n.name??``,data:n.data})};return this.addWatchCallback(e,n),{unsubscribe:()=>this.removeWatchCallback(e,n)}}async exportMetadata(e){let t={},n=e?.types??Array.from(this.registry.keys());for(let e of n){let n=await this.list(e);n.length>0&&(t[e]=n)}return t}async importMetadata(e,t){let{conflictResolution:n=`skip`,validate:r=!0,dryRun:i=!1}=t??{},a=e,o=0,s=0,c=0,l=0,u=[];for(let[e,t]of Object.entries(a))if(Array.isArray(t))for(let r of t){o++;let t=r?.name;if(!t){l++,u.push({type:e,name:`(unknown)`,error:`Item missing name field`});continue}try{let a=await this.exists(e,t);if(a&&n===`skip`){c++;continue}if(!i)if(a&&n===`merge`){let n={...await this.get(e,t),...r};await this.register(e,t,n)}else await this.register(e,t,r);s++}catch(n){l++,u.push({type:e,name:t,error:n instanceof Error?n.message:String(n)})}}return{total:o,imported:s,skipped:c,failed:l,errors:u.length>0?u:void 0}}async validate(e,t){if(t==null)return{valid:!1,errors:[{path:``,message:`Metadata data cannot be null or undefined`}]};if(typeof t!=`object`)return{valid:!1,errors:[{path:``,message:`Metadata data must be an object`}]};let n=t,r=[];return n.name?(n.label||r.push({path:`label`,message:`Missing label field (recommended)`}),{valid:!0,warnings:r.length>0?r:void 0}):{valid:!1,errors:[{path:`name`,message:`Metadata item must have a name field`}]}}async getRegisteredTypes(){let e=new Set;for(let t of this.typeRegistry)e.add(t.type);for(let t of this.registry.keys())e.add(t);return Array.from(e)}async getTypeInfo(e){let t=this.typeRegistry.find(t=>t.type===e);if(t)return{type:t.type,label:t.label,description:t.description,filePatterns:t.filePatterns,supportsOverlay:t.supportsOverlay,domain:t.domain}}async getDependencies(e,t){return this.dependencies.get(`${encodeURIComponent(e)}:${encodeURIComponent(t)}`)??[]}async getDependents(e,t){let n=[];for(let r of this.dependencies.values())for(let i of r)i.targetType===e&&i.targetName===t&&n.push(i);return n}addDependency(e){let t=`${encodeURIComponent(e.sourceType)}:${encodeURIComponent(e.sourceName)}`;this.dependencies.has(t)||this.dependencies.set(t,[]);let n=this.dependencies.get(t);n.some(t=>t.targetType===e.targetType&&t.targetName===e.targetName&&t.kind===e.kind)||n.push(e)}async load(e,t,n){for(let r of this.loaders.values())try{let i=await r.load(e,t,n);if(i.data)return i.data}catch(n){this.logger.warn(`Loader ${r.contract.name} failed to load ${e}:${t}`,{error:n})}return null}async loadMany(e,t){let n=[];for(let r of this.loaders.values())try{let i=await r.loadMany(e,t);for(let e of i){let t=e;t&&typeof t.name==`string`&&n.some(e=>e&&e.name===t.name)||n.push(e)}}catch(t){this.logger.warn(`Loader ${r.contract.name} failed to loadMany ${e}`,{error:t})}return n}async save(e,t,n,r){let i=r?.loader,a;if(i){if(a=this.loaders.get(i),!a)throw Error(`Loader not found: ${i}`)}else{for(let n of this.loaders.values())if(n.save)try{if(await n.exists(e,t)){a=n,this.logger.info(`Updating existing metadata in loader: ${n.contract.name}`);break}}catch{}if(!a){let e=this.loaders.get(`filesystem`);e&&e.save&&(a=e)}if(!a){for(let e of this.loaders.values())if(e.save){a=e;break}}}if(!a)throw Error(`No loader available for saving type: ${e}`);if(!a.save)throw Error(`Loader '${a.contract?.name}' does not support saving`);return a.save(e,t,n,r)}addWatchCallback(e,t){this.watchCallbacks.has(e)||this.watchCallbacks.set(e,new Set),this.watchCallbacks.get(e).add(t)}removeWatchCallback(e,t){let n=this.watchCallbacks.get(e);n&&(n.delete(t),n.size===0&&this.watchCallbacks.delete(e))}async stopWatching(){}notifyWatchers(e,t){let n=this.watchCallbacks.get(e);if(n)for(let r of n)try{r(t)}catch(t){this.logger.error(`Watch callback error`,void 0,{type:e,error:t instanceof Error?t.message:String(t)})}}getDatabaseLoader(){let e=this.loaders.get(`database`);if(e&&e instanceof ZQe)return e}async getHistory(e,t,n){let r=this.getDatabaseLoader();if(!r)throw Error(`History tracking requires a database loader to be configured`);let i=r.driver,a=r.tableName,o=r.historyTableName,s=r.tenantId,c={type:e,name:t};s&&(c.tenant_id=s);let l=await i.findOne(a,{object:a,where:c});if(!l)return{records:[],total:0,hasMore:!1};let u={metadata_id:l.id};s&&(u.tenant_id=s),n?.operationType&&(u.operation_type=n.operationType),n?.since&&(u.recorded_at={$gte:n.since}),n?.until&&(u.recorded_at?u.recorded_at.$lte=n.until:u.recorded_at={$lte:n.until});let d=n?.limit??50,f=n?.offset??0,p=await i.find(o,{object:o,where:u,orderBy:[{field:`recorded_at`,order:`desc`}],limit:d+1,offset:f}),m=p.length>d,h=p.slice(0,d),g=await i.count(o,{object:o,where:u}),_=n?.includeMetadata!==!1;return{records:h.map(e=>{let t=typeof e.metadata==`string`?JSON.parse(e.metadata):e.metadata;return{id:e.id,metadataId:e.metadata_id,name:e.name,type:e.type,version:e.version,operationType:e.operation_type,metadata:_?t:null,checksum:e.checksum,previousChecksum:e.previous_checksum,changeNote:e.change_note,tenantId:e.tenant_id,recordedBy:e.recorded_by,recordedAt:e.recorded_at}}),total:g,hasMore:m}}async rollback(e,t,n,r){let i=this.getDatabaseLoader();if(!i)throw Error(`Rollback requires a database loader to be configured`);let a=await i.getHistoryRecord(e,t,n);if(!a)throw Error(`Version ${n} not found in history for ${e}/${t}`);if(!a.metadata)throw Error(`Version ${n} metadata snapshot not available`);let o=a.metadata;return await i.registerRollback(e,t,o,n,r?.changeNote,r?.recordedBy),this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,o),o}async diff(e,t,n,r){let i=this.getDatabaseLoader();if(!i)throw Error(`Diff requires a database loader to be configured`);let a=await i.getHistoryRecord(e,t,n),o=await i.getHistoryRecord(e,t,r);if(!a)throw Error(`Version ${n} not found in history for ${e}/${t}`);if(!o)throw Error(`Version ${r} not found in history for ${e}/${t}`);if(!a.metadata||!o.metadata)throw Error(`Version metadata snapshots not available`);let s=d9(a.metadata,o.metadata),c=s.length===0,l=XQe(s);return{type:e,name:t,version1:n,version2:r,checksum1:a.checksum,checksum2:o.checksum,identical:c,patch:s,summary:l}}},e$e=class{constructor(e,t,n){this.rootDir=e,this.serializers=t,this.logger=n,this.contract={name:`filesystem`,protocol:`file:`,capabilities:{read:!0,write:!0,watch:!0,list:!0},supportedFormats:[`json`,`yaml`,`typescript`,`javascript`],supportsWatch:!0,supportsWrite:!0,supportsCache:!0},this.cache=new Map}async load(e,t,n){let r=Date.now(),{validate:i=!0,useCache:a=!0,ifNoneMatch:o}=n||{};try{let n=await this.findFile(e,t);if(!n)return{data:null,fromCache:!1,notModified:!1,loadTime:Date.now()-r};let i=await this.stat(e,t);if(!i)return{data:null,fromCache:!1,notModified:!1,loadTime:Date.now()-r};if(a&&o&&i.etag===o)return{data:null,fromCache:!0,notModified:!0,etag:i.etag,stats:i,loadTime:Date.now()-r};let s=`${e}:${t}`;if(a&&this.cache.has(s)){let e=this.cache.get(s);if(e.etag===i.etag)return{data:e.data,fromCache:!0,notModified:!1,etag:i.etag,stats:i,loadTime:Date.now()-r}}let c=await If(n,`utf-8`),l=this.getSerializer(i.format);if(!l)throw Error(`No serializer found for format: ${i.format}`);let u=l.deserialize(c);return a&&this.cache.set(s,{data:u,etag:i.etag||``,timestamp:Date.now()}),{data:u,fromCache:!1,notModified:!1,etag:i.etag,stats:i,loadTime:Date.now()-r}}catch(n){throw this.logger?.error(`Failed to load metadata`,void 0,{type:e,name:t,error:n instanceof Error?n.message:String(n)}),n}}async loadMany(e,t){let{patterns:n=[`**/*`],recursive:r=!0,limit:i}=t||{},a=$d(this.rootDir,e),o=[];try{let e=n.map(e=>$d(a,e));for(let t of e){let e=await c9(t,{ignore:[`**/node_modules/**`,`**/*.test.*`,`**/*.spec.*`],nodir:!0});for(let t of e){if(i&&o.length>=i)break;try{let e=await If(t,`utf-8`),n=this.detectFormat(t),r=this.getSerializer(n);if(r){let t=r.deserialize(e);o.push(t)}}catch(e){this.logger?.warn(`Failed to load file`,{file:t,error:e instanceof Error?e.message:String(e)})}}if(i&&o.length>=i)break}return o}catch(t){throw this.logger?.error(`Failed to load many`,void 0,{type:e,patterns:n,error:t instanceof Error?t.message:String(t)}),t}}async exists(e,t){return await this.findFile(e,t)!==null}async stat(e,t){let n=await this.findFile(e,t);if(!n)return null;try{let e=await Sf(n),t=await If(n,`utf-8`),r=this.generateETag(t),i=this.detectFormat(n);return{size:e.size,modifiedAt:e.mtime.toISOString(),etag:r,format:i,path:n}}catch(r){return this.logger?.error(`Failed to stat file`,void 0,{type:e,name:t,filePath:n,error:r instanceof Error?r.message:String(r)}),null}}async list(e){let t=$d(this.rootDir,e);try{return(await c9(`**/*`,{cwd:t,ignore:[`**/node_modules/**`,`**/*.test.*`,`**/*.spec.*`],nodir:!0})).map(e=>tf(e,nf(e)))}catch(t){return this.logger?.error(`Failed to list`,void 0,{type:e,error:t instanceof Error?t.message:String(t)}),[]}}async save(e,t,n,r){let i=Date.now(),{format:a=`typescript`,prettify:o=!0,indent:s=2,sortKeys:c=!1,backup:l=!1,overwrite:u=!0,atomic:d=!0,path:f}=r||{};try{let r=this.getSerializer(a);if(!r)throw Error(`No serializer found for format: ${a}`);let p=$d(this.rootDir,e),m=`${t}${r.getExtension()}`,h=f||$d(p,m);if(!u)try{throw await Cf(h),Error(`File already exists: ${h}`)}catch(e){if(e.code!==`ENOENT`)throw e}await void 0;let g;if(l)try{await Cf(h),g=`${h}.bak`,await void 0}catch{}let _=r.serialize(n,{prettify:o,indent:s,sortKeys:c});if(d){let e=`${h}.tmp`;await Lf(e,_,`utf-8`),await Rf(e,h)}else await Lf(h,_,`utf-8`);return{success:!0,path:h,size:Buffer.byteLength(_,`utf-8`),backupPath:g,saveTime:Date.now()-i}}catch(n){throw this.logger?.error(`Failed to save metadata`,void 0,{type:e,name:t,error:n instanceof Error?n.message:String(n)}),n}}async findFile(e,t){let n=$d(this.rootDir,e);for(let e of[`.json`,`.yaml`,`.yml`,`.ts`,`.js`]){let r=$d(n,`${t}${e}`);try{return await Cf(r),r}catch{}}return null}detectFormat(e){switch(nf(e).toLowerCase()){case`.json`:return`json`;case`.yaml`:case`.yml`:return`yaml`;case`.ts`:return`typescript`;case`.js`:return`javascript`;default:return`json`}}getSerializer(e){return this.serializers.get(e)}generateETag(e){return`"${Bf(`sha256`).update(e).digest(`hex`).substring(0,32)}"`}},t$e=class extends $Qe{constructor(e){if(super(e),!e.loaders||e.loaders.length===0){let t=e.rootDir||process.cwd();this.registerLoader(new e$e(t,this.serializers,this.logger))}e.watch&&this.startWatching()}async stopWatching(){this.watcher&&=(await this.watcher.close(),void 0)}startWatching(){let e=this.config.rootDir||process.cwd(),{ignored:t=[`**/node_modules/**`,`**/*.test.*`],persistent:n=!0}=this.config.watchOptions||{};this.watcher=dXe(e,{ignored:t,persistent:n,ignoreInitial:!0}),this.watcher.on(`add`,async e=>{await this.handleFileEvent(`added`,e)}),this.watcher.on(`change`,async e=>{await this.handleFileEvent(`changed`,e)}),this.watcher.on(`unlink`,async e=>{await this.handleFileEvent(`deleted`,e)}),this.logger.info(`File watcher started`,{rootDir:e})}async handleFileEvent(e,t){let n=rf(this.config.rootDir||process.cwd(),t).split(`/`);if(n.length<2)return;let r=n[0],i=n[n.length-1],a=tf(i,nf(i)),o;if(e!==`deleted`)try{o=await this.load(r,a,{useCache:!1})}catch(e){this.logger.error(`Failed to load changed file`,void 0,{filePath:t,error:e instanceof Error?e.message:String(e)});return}let s={type:e,metadataType:r,name:a,path:t,data:o,timestamp:new Date().toISOString()};this.notifyWatchers(r,s)}},n$e=class{constructor(e={}){this.name=`com.objectstack.metadata`,this.type=`standard`,this.version=`1.0.0`,this.init=async e=>{e.logger.info(`Initializing Metadata Manager`,{root:this.options.rootDir||process.cwd(),watch:this.options.watch}),e.registerService(`metadata`,this.manager),console.log(`[MetadataPlugin] Registered metadata service, has getRegisteredTypes:`,typeof this.manager.getRegisteredTypes);try{e.getService(`manifest`).register({id:`com.objectstack.metadata`,name:`Metadata`,version:`1.0.0`,type:`plugin`,namespace:`sys`,objects:[qQe]})}catch{}e.logger.info(`MetadataPlugin providing metadata service (primary mode)`,{mode:`file-system`,features:[`watch`,`persistence`,`multi-format`,`query`,`overlay`,`type-registry`]})},this.start=async e=>{e.logger.info(`Loading metadata from file system...`);let t=[...G1].sort((e,t)=>e.loadOrder-t.loadOrder),n=0;for(let r of t)try{let t=await this.manager.loadMany(r.type,{recursive:!0});if(t.length>0){for(let e of t){let t=e;t?.name&&await this.manager.register(r.type,t.name,e)}e.logger.info(`Loaded ${t.length} ${r.type} from file system`),n+=t.length}}catch(t){e.logger.debug(`No ${r.type} metadata found`,{error:t.message})}e.logger.info(`Metadata loading complete`,{totalItems:n,registeredTypes:t.length});try{let t=e.getServices();for(let[n,r]of t)if(n.startsWith(`driver.`)&&r){e.logger.info(`[MetadataPlugin] Bridging driver to MetadataManager for database-backed persistence`,{driverService:n}),this.manager.setDatabaseDriver(r);break}}catch(t){e.logger.debug(`[MetadataPlugin] No driver service found — database metadata persistence not available`,{error:t.message})}try{let t=e.getService(`realtime`);t&&typeof t==`object`&&`publish`in t&&(e.logger.info(`[MetadataPlugin] Bridging realtime service to MetadataManager for event publishing`),this.manager.setRealtimeService(t))}catch(t){e.logger.debug(`[MetadataPlugin] No realtime service found — metadata events will not be published`,{error:t.message})}},this.options={watch:!0,...e},this.manager=new t$e({rootDir:this.options.rootDir||process.cwd(),watch:this.options.watch??!0,formats:[`yaml`,`json`,`typescript`,`javascript`]}),this.manager.setTypeRegistry(G1)}};UQe({},{MigrationExecutor:()=>r$e});var r$e=class{constructor(e){this.driver=e}async executeChangeSet(e){console.log(`Executing ChangeSet: ${e.name} (${e.id})`);for(let t of e.operations)try{await this.executeOperation(t)}catch(e){throw console.error(`Failed to execute operation ${t.type}:`,e),e}}async executeOperation(e){switch(e.type){case`create_object`:console.log(` > Create Object: ${e.object.name}`),await this.driver.createCollection(e.object.name,e.object);break;case`add_field`:console.log(` > Add Field: ${e.objectName}.${e.fieldName}`),await this.driver.addColumn(e.objectName,e.fieldName,e.field);break;case`remove_field`:console.log(` > Remove Field: ${e.objectName}.${e.fieldName}`),await this.driver.dropColumn(e.objectName,e.fieldName);break;case`delete_object`:console.log(` > Delete Object: ${e.objectName}`),await this.driver.dropCollection(e.objectName);break;case`execute_sql`:console.log(` > Execute SQL`),await this.driver.executeRaw(e.sql);break;case`modify_field`:console.warn(` ! Modify Field: ${e.objectName}.${e.fieldName} (Not fully implemented)`);break;case`rename_object`:console.warn(` ! Rename Object: ${e.oldName} -> ${e.newName} (Not fully implemented)`);break;default:throw Error(`Unknown operation type`)}}},i$e=r().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)`),a$e=r().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)`);r().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 f9=l([r().describe(`Action Name`),h({type:r(),params:d(r(),u()).optional()})]),o$e=l([r().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),h({type:r(),params:d(r(),u()).optional()})]),p9=h({target:r().optional().describe(`Target State ID`),cond:o$e.optional().describe(`Condition (Guard) required to take this path`),actions:C(f9).optional().describe(`Actions to execute during transition`),description:r().optional().describe(`Human readable description of this rule`)});h({type:r().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:d(r(),u()).optional().describe(`Expected event payload structure`)});var s$e=F(()=>h({type:E([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:C(f9).optional().describe(`Actions to run when entering this state`),exit:C(f9).optional().describe(`Actions to run when leaving this state`),on:d(r(),l([r(),p9,C(p9)])).optional().describe(`Map of Event Type -> Transition Definition`),always:C(p9).optional(),initial:r().optional().describe(`Initial child state (if compound)`),states:d(r(),s$e).optional(),meta:h({label:r().optional(),description:r().optional(),color:r().optional(),aiInstructions:r().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),c$e=h({id:a$e.describe(`Unique Machine ID`),description:r().optional(),contextSchema:d(r(),u()).optional().describe(`Zod Schema for the machine context/memory`),initial:r().describe(`Initial State ID`),states:d(r(),s$e).describe(`State Nodes`),on:d(r(),l([r(),p9,C(p9)])).optional()}),l$e=h({provider:E([`openai`,`azure_openai`,`anthropic`,`local`]).default(`openai`),model:r().describe(`Model name (e.g. gpt-4, claude-3-opus)`),temperature:P().min(0).max(2).default(.7),maxTokens:P().optional(),topP:P().optional()}),u$e=h({type:E([`action`,`flow`,`query`,`vector_search`]),name:r().describe(`Reference name (Action Name, Flow Name)`),description:r().optional().describe(`Override description for the LLM`)}),d$e=h({topics:C(r()).describe(`Topics/Tags to recruit knowledge from`),indexes:C(r()).describe(`Vector Store Indexes`)}),f$e=E([`json_object`,`json_schema`,`regex`,`grammar`,`xml`]).describe(`Output format for structured agent responses`),p$e=E([`trim`,`parse_json`,`validate`,`coerce_types`]).describe(`Post-processing step for structured output`),m$e=h({format:f$e.describe(`Expected output format`),schema:d(r(),u()).optional().describe(`JSON Schema definition for output`),strict:S().default(!1).describe(`Enforce exact schema compliance`),retryOnValidationFailure:S().default(!0).describe(`Retry generation when output fails validation`),maxRetries:P().int().min(0).default(3).describe(`Maximum retries on validation failure`),fallbackFormat:f$e.optional().describe(`Fallback format if primary format fails`),transformPipeline:C(p$e).optional().describe(`Post-processing steps applied to output`)}).describe(`Structured output configuration for agent responses`),m9=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Agent unique identifier`),label:r().describe(`Agent display name`),avatar:r().optional(),role:r().describe(`The persona/role (e.g. "Senior Support Engineer")`),instructions:r().describe(`System Prompt / Prime Directives`),model:l$e.optional(),lifecycle:c$e.optional().describe(`State machine defining the agent conversation follow and constraints`),skills:C(r().regex(/^[a-z_][a-z0-9_]*$/)).optional().describe(`Skill names to attach (Agent→Skill→Tool architecture)`),tools:C(u$e).optional().describe(`Direct tool references (legacy fallback)`),knowledge:d$e.optional().describe(`RAG access`),active:S().default(!0),access:C(r()).optional().describe(`Who can chat with this agent`),permissions:C(r()).optional().describe(`Required permissions or roles`),tenantId:r().optional().describe(`Tenant/Organization ID`),visibility:E([`global`,`organization`,`private`]).default(`organization`),planning:h({strategy:E([`react`,`plan_and_execute`,`reflexion`,`tree_of_thought`]).default(`react`).describe(`Autonomous reasoning strategy`),maxIterations:P().int().min(1).max(100).default(10).describe(`Maximum planning loop iterations`),allowReplan:S().default(!0).describe(`Allow dynamic re-planning based on intermediate results`)}).optional().describe(`Autonomous reasoning and planning configuration`),memory:h({shortTerm:h({maxMessages:P().int().min(1).default(50).describe(`Max recent messages in working memory`),maxTokens:P().int().min(100).optional().describe(`Max tokens for short-term context window`)}).optional().describe(`Short-term / working memory`),longTerm:h({enabled:S().default(!1).describe(`Enable long-term memory persistence`),store:E([`vector`,`database`,`redis`]).default(`vector`).describe(`Long-term memory storage backend`),maxEntries:P().int().min(1).optional().describe(`Max entries in long-term memory`)}).optional().describe(`Long-term / persistent memory`),reflectionInterval:P().int().min(1).optional().describe(`Reflect every N interactions to improve behavior`)}).optional().describe(`Agent memory management`),guardrails:h({maxTokensPerInvocation:P().int().min(1).optional().describe(`Token budget per single invocation`),maxExecutionTimeSec:P().int().min(1).optional().describe(`Max execution time in seconds`),blockedTopics:C(r()).optional().describe(`Forbidden topics or action names`)}).optional().describe(`Safety guardrails for the agent`),structuredOutput:m$e.optional().describe(`Structured output format and validation configuration`)}),h$e=E([`data`,`action`,`flow`,`integration`,`vector_search`,`analytics`,`utility`]).describe(`Tool operational category`),g$e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool unique identifier (snake_case)`),label:r().describe(`Tool display name`),description:r().describe(`Tool description for LLM function calling`),category:h$e.optional().describe(`Tool category for grouping and filtering`),parameters:d(r(),u()).describe(`JSON Schema for tool parameters`),outputSchema:d(r(),u()).optional().describe(`JSON Schema for tool output`),objectName:r().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object name (snake_case)`),requiresConfirmation:S().default(!1).describe(`Require user confirmation before execution`),permissions:C(r()).optional().describe(`Required permissions or roles`),active:S().default(!0).describe(`Whether the tool is enabled`),builtIn:S().default(!1).describe(`Platform built-in tool flag`)});function h9(e){return g$e.parse(e)}var _$e=h({field:r().describe(`Context field to evaluate`),operator:E([`eq`,`neq`,`in`,`not_in`,`contains`]).describe(`Comparison operator`),value:l([r(),C(r())]).describe(`Expected value or values`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Skill unique identifier (snake_case)`),label:r().describe(`Skill display name`),description:r().optional().describe(`Skill description`),instructions:r().optional().describe(`LLM instructions when skill is active`),tools:C(r().regex(/^[a-z_][a-z0-9_]*$/)).describe(`Tool names belonging to this skill`),triggerPhrases:C(r()).optional().describe(`Phrases that activate this skill`),triggerConditions:C(_$e).optional().describe(`Programmatic activation conditions`),permissions:C(r()).optional().describe(`Required permissions or roles`),active:S().default(!0).describe(`Whether the skill is enabled`)});var v$e=E([`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`]),y$e=E([`change_view_mode`,`apply_filter`,`clear_filter`,`apply_sort`,`change_grouping`,`show_columns`,`expand_record`,`collapse_record`,`refresh_view`,`export_data`]),b$e=E([`create_record`,`update_record`,`delete_record`,`fill_field`,`clear_field`,`submit_form`,`cancel_form`,`validate_form`,`save_draft`]),x$e=E([`select_record`,`deselect_record`,`select_all`,`deselect_all`,`bulk_update`,`bulk_delete`,`bulk_export`]),S$e=E([`trigger_flow`,`trigger_approval`,`trigger_webhook`,`run_report`,`send_email`,`send_notification`,`schedule_task`]),C$e=E([`open_modal`,`close_modal`,`open_sidebar`,`close_sidebar`,`show_notification`,`hide_notification`,`open_dropdown`,`close_dropdown`,`toggle_section`]),w$e=l([v$e,y$e,b$e,x$e,S$e,C$e]),T$e=h({object:r().optional().describe(`Object name (for object-specific navigation)`),recordId:r().optional().describe(`Record ID (for detail page)`),viewType:E([`list`,`form`,`detail`,`kanban`,`calendar`,`gantt`]).optional(),dashboardId:r().optional().describe(`Dashboard ID`),reportId:r().optional().describe(`Report ID`),appName:r().optional().describe(`App name`),mode:E([`new`,`edit`,`view`]).optional().describe(`Form mode`),openInNewTab:S().optional().describe(`Open in new tab`)}),E$e=h({viewMode:E([`list`,`kanban`,`calendar`,`gantt`,`pivot`]).optional(),filters:d(r(),u()).optional().describe(`Filter conditions`),sort:C(h({field:r(),order:E([`asc`,`desc`])})).optional(),groupBy:r().optional().describe(`Field to group by`),columns:C(r()).optional().describe(`Columns to show/hide`),recordId:r().optional().describe(`Record to expand/collapse`),exportFormat:E([`csv`,`xlsx`,`pdf`,`json`]).optional()}),D$e=h({object:r().optional().describe(`Object name`),recordId:r().optional().describe(`Record ID (for edit/delete)`),fieldValues:d(r(),u()).optional().describe(`Field name-value pairs`),fieldName:r().optional().describe(`Specific field to fill/clear`),fieldValue:u().optional().describe(`Value to set`),validateOnly:S().optional().describe(`Validate without saving`)}),O$e=h({recordIds:C(r()).optional().describe(`Record IDs to select/operate on`),filters:d(r(),u()).optional().describe(`Filter for bulk operations`),updateData:d(r(),u()).optional().describe(`Data for bulk update`),exportFormat:E([`csv`,`xlsx`,`pdf`,`json`]).optional()}),k$e=h({flowName:r().optional().describe(`Flow/workflow name`),approvalProcessName:r().optional().describe(`Approval process name`),webhookUrl:r().optional().describe(`Webhook URL`),reportName:r().optional().describe(`Report name`),emailTemplate:r().optional().describe(`Email template`),recipients:C(r()).optional().describe(`Email recipients`),subject:r().optional().describe(`Email subject`),message:r().optional().describe(`Notification/email message`),taskData:d(r(),u()).optional().describe(`Task creation data`),scheduleTime:r().optional().describe(`Schedule time (ISO 8601)`),contextData:d(r(),u()).optional().describe(`Additional context data`)}),A$e=h({componentId:r().optional().describe(`Component ID`),modalConfig:h({title:r().optional(),content:u().optional(),size:E([`small`,`medium`,`large`,`fullscreen`]).optional()}).optional(),notificationConfig:h({type:E([`info`,`success`,`warning`,`error`]).optional(),message:r(),duration:P().optional().describe(`Duration in ms`)}).optional(),sidebarConfig:h({position:E([`left`,`right`]).optional(),width:r().optional(),content:u().optional()}).optional()}),g9=h({id:r().optional().describe(`Unique action ID`),type:w$e.describe(`Type of UI action to perform`),params:l([T$e,E$e,D$e,O$e,k$e,A$e]).describe(`Action-specific parameters`),requireConfirmation:S().default(!1).describe(`Require user confirmation before executing`),confirmationMessage:r().optional().describe(`Message to show in confirmation dialog`),successMessage:r().optional().describe(`Message to show on success`),onError:E([`retry`,`skip`,`abort`]).default(`abort`).describe(`Error handling strategy`),metadata:h({intent:r().optional().describe(`Original user intent/query`),confidence:P().min(0).max(1).optional().describe(`Confidence score (0-1)`),agentName:r().optional().describe(`Agent that generated this action`),timestamp:r().datetime().optional().describe(`Generation timestamp (ISO 8601)`)}).optional()});l([g9.extend({type:v$e,params:T$e}),g9.extend({type:y$e,params:E$e}),g9.extend({type:b$e,params:D$e}),g9.extend({type:x$e,params:O$e}),g9.extend({type:S$e,params:k$e}),g9.extend({type:C$e,params:A$e})]),h({id:r().optional().describe(`Unique sequence ID`),actions:C(g9).describe(`Ordered list of actions`),mode:E([`sequential`,`parallel`]).default(`sequential`).describe(`Execution mode`),stopOnError:S().default(!0).describe(`Stop sequence on first error`),atomic:S().default(!1).describe(`Transaction mode (all-or-nothing)`),startTime:r().datetime().optional().describe(`Execution start time (ISO 8601)`),endTime:r().datetime().optional().describe(`Execution end time (ISO 8601)`),metadata:h({intent:r().optional().describe(`Original user intent`),confidence:P().min(0).max(1).optional().describe(`Overall confidence score`),agentName:r().optional().describe(`Agent that generated this sequence`)}).optional()});var j$e=h({actionId:r().describe(`ID of the executed action`),status:E([`success`,`error`,`cancelled`,`pending`]).describe(`Execution status`),data:u().optional().describe(`Action result data`),error:h({code:r(),message:r(),details:u().optional()}).optional().describe(`Error details if status is "error"`),metadata:h({startTime:r().optional().describe(`Execution start time (ISO 8601)`),endTime:r().optional().describe(`Execution end time (ISO 8601)`),duration:P().optional().describe(`Execution duration in ms`)}).optional()});h({sequenceId:r().describe(`ID of the executed sequence`),status:E([`success`,`partial_success`,`error`,`cancelled`]).describe(`Overall execution status`),results:C(j$e).describe(`Results for each action`),summary:h({total:P().describe(`Total number of actions`),successful:P().describe(`Number of successful actions`),failed:P().describe(`Number of failed actions`),cancelled:P().describe(`Number of cancelled actions`)}),metadata:h({startTime:r().optional(),endTime:r().optional(),totalDuration:P().optional().describe(`Total execution time in ms`)}).optional()}),h({intent:r().describe(`Intent pattern (e.g., "open_new_record_form")`),examples:C(r()).optional().describe(`Example user queries`),actionTemplate:g9.describe(`Action to execute`),paramExtraction:d(r(),h({type:E([`entity`,`slot`,`context`]),required:S().default(!1),default:u().optional()})).optional().describe(`Rules for extracting parameters from user input`),minConfidence:P().min(0).max(1).default(.7).describe(`Minimum confidence to execute`)});var M$e=E([`frontend`,`backend`,`api`,`database`,`tests`,`documentation`,`infrastructure`]).describe(`Code generation target`),N$e=h({enabled:S().optional().default(!0).describe(`Enable code generation`),targets:C(M$e).describe(`Code generation targets`),templateRepo:r().optional().describe(`Template repository for scaffolding`),styleGuide:r().optional().describe(`Code style guide to follow`),includeTests:S().optional().default(!0).describe(`Generate tests with code`),includeDocumentation:S().optional().default(!0).describe(`Generate documentation`),validationMode:E([`strict`,`moderate`,`permissive`]).optional().default(`strict`).describe(`Code validation strictness`)}),P$e=h({enabled:S().optional().default(!0).describe(`Enable automated testing`),testTypes:C(E([`unit`,`integration`,`e2e`,`performance`,`security`,`accessibility`])).optional().default([`unit`,`integration`]).describe(`Types of tests to run`),coverageThreshold:P().min(0).max(100).optional().default(80).describe(`Minimum test coverage percentage`),framework:r().optional().describe(`Testing framework (e.g., vitest, jest, playwright)`),preCommitTests:S().optional().default(!0).describe(`Run tests before committing`),autoFix:S().optional().default(!1).describe(`Attempt to auto-fix failing tests`)}),F$e=h({name:r().describe(`Pipeline stage name`),type:E([`build`,`test`,`lint`,`security_scan`,`deploy`,`smoke_test`,`rollback`]).describe(`Stage type`),order:P().int().min(0).describe(`Execution order`),parallel:S().optional().default(!1).describe(`Can run in parallel with other stages`),commands:C(r()).describe(`Commands to execute`),env:d(r(),r()).optional().describe(`Stage-specific environment variables`),timeout:P().int().min(60).optional().default(600).describe(`Stage timeout in seconds`),retryOnFailure:S().optional().default(!1).describe(`Retry stage on failure`),maxRetries:P().int().min(0).max(5).optional().default(0).describe(`Maximum retry attempts`)}),I$e=h({name:r().describe(`Pipeline name`),trigger:E([`push`,`pull_request`,`release`,`schedule`,`manual`]).describe(`Pipeline trigger`),branches:C(r()).optional().describe(`Branches to run pipeline on`),stages:C(F$e).describe(`Pipeline stages`),notifications:h({onSuccess:S().optional().default(!1),onFailure:S().optional().default(!0),channels:C(r()).optional().describe(`Notification channels (e.g., slack, email)`)}).optional().describe(`Pipeline notifications`)}),L$e=h({scheme:E([`semver`,`calver`,`custom`]).optional().default(`semver`).describe(`Versioning scheme`),autoIncrement:E([`major`,`minor`,`patch`,`none`]).optional().default(`patch`).describe(`Auto-increment strategy`),prefix:r().optional().default(`v`).describe(`Version tag prefix`),generateChangelog:S().optional().default(!0).describe(`Generate changelog automatically`),changelogFormat:E([`conventional`,`keepachangelog`,`custom`]).optional().default(`conventional`).describe(`Changelog format`),tagReleases:S().optional().default(!0).describe(`Create Git tags for releases`)}),R$e=h({type:E([`rolling`,`blue_green`,`canary`,`recreate`]).optional().default(`rolling`).describe(`Deployment strategy`),canaryPercentage:P().min(0).max(100).optional().default(10).describe(`Canary deployment percentage`),healthCheckUrl:r().optional().describe(`Health check endpoint`),healthCheckTimeout:P().int().min(10).optional().default(60).describe(`Health check timeout in seconds`),autoRollback:S().optional().default(!0).describe(`Automatically rollback on failure`),smokeTests:C(r()).optional().describe(`Smoke test commands to run post-deployment`)}),z$e=h({enabled:S().optional().default(!0).describe(`Enable monitoring`),metrics:C(E([`performance`,`errors`,`usage`,`availability`,`latency`])).optional().default([`performance`,`errors`,`availability`]).describe(`Metrics to monitor`),alerts:C(h({name:r().describe(`Alert name`),metric:r().describe(`Metric to monitor`),threshold:P().describe(`Alert threshold`),severity:E([`info`,`warning`,`critical`]).describe(`Alert severity`)})).optional().describe(`Alert configurations`),integrations:C(r()).optional().describe(`Monitoring service integrations`)}),B$e=h({specificationSource:r().describe(`Path to ObjectStack specification`),codeGeneration:N$e.describe(`Code generation settings`),testing:P$e.optional().describe(`Testing configuration`),linting:h({enabled:S().optional().default(!0),autoFix:S().optional().default(!0),rules:d(r(),u()).optional()}).optional().describe(`Code linting configuration`),formatting:h({enabled:S().optional().default(!0),autoFormat:S().optional().default(!0),config:d(r(),u()).optional()}).optional().describe(`Code formatting configuration`)}),V$e=h({connector:r().describe(`GitHub connector name`),repository:h({owner:r().describe(`Repository owner`),name:r().describe(`Repository name`)}).describe(`Repository configuration`),featureBranch:r().optional().default(`develop`).describe(`Default feature branch`),pullRequest:h({autoCreate:S().optional().default(!0).describe(`Automatically create PRs`),autoMerge:S().optional().default(!1).describe(`Automatically merge PRs when checks pass`),requireReviews:S().optional().default(!0).describe(`Require reviews before merge`),deleteBranchOnMerge:S().optional().default(!0).describe(`Delete feature branch after merge`)}).optional().describe(`Pull request settings`)}),H$e=h({connector:r().describe(`Vercel connector name`),project:r().describe(`Vercel project name`),environments:h({production:r().optional().default(`main`).describe(`Production branch`),preview:C(r()).optional().default([`develop`,`feature/*`]).describe(`Preview branches`)}).optional().describe(`Environment mapping`),deployment:h({autoDeployProduction:S().optional().default(!1).describe(`Auto-deploy to production`),autoDeployPreview:S().optional().default(!0).describe(`Auto-deploy preview environments`),requireApproval:S().optional().default(!0).describe(`Require approval for production deployments`)}).optional().describe(`Deployment settings`)}),U$e=h({github:V$e.describe(`GitHub integration configuration`),vercel:H$e.describe(`Vercel integration configuration`),additional:d(r(),u()).optional().describe(`Additional integration configurations`)});m9.extend({developmentConfig:B$e.describe(`Development configuration`),pipelines:C(I$e).optional().describe(`CI/CD pipelines`),versionManagement:L$e.optional().describe(`Version management configuration`),deploymentStrategy:R$e.optional().describe(`Deployment strategy`),monitoring:z$e.optional().describe(`Monitoring configuration`),integrations:U$e.describe(`Integration configurations`),selfIteration:h({enabled:S().optional().default(!0).describe(`Enable self-iteration`),iterationFrequency:r().optional().describe(`Iteration frequency (cron expression)`),optimizationGoals:C(E([`performance`,`security`,`code_quality`,`test_coverage`,`documentation`])).optional().describe(`Optimization goals`),learningMode:E([`conservative`,`balanced`,`aggressive`]).optional().default(`balanced`).describe(`Learning mode`)}).optional().describe(`Self-iteration configuration`)}),u$e.extend({type:E([`action`,`flow`,`query`,`vector_search`,`git_operation`,`code_generation`,`test_execution`,`deployment`,`monitoring`])}),h({description:r().describe(`What the plugin should do`),pluginType:E([`driver`,`app`,`widget`,`integration`,`automation`,`analytics`,`ai-agent`,`custom`]),outputFormat:E([`source-code`,`low-code-schema`,`dsl`]).default(`source-code`).describe(`Format of the generated output`),language:E([`typescript`,`javascript`,`python`]).default(`typescript`),framework:h({runtime:E([`node`,`browser`,`edge`,`universal`]).optional(),uiFramework:E([`react`,`vue`,`svelte`,`none`]).optional(),testing:E([`vitest`,`jest`,`mocha`,`none`]).optional()}).optional(),capabilities:C(r()).optional().describe(`Protocol IDs to implement`),dependencies:C(r()).optional().describe(`Required plugin IDs`),examples:C(h({input:r(),expectedOutput:r(),description:r().optional()})).optional(),style:h({indentation:E([`tab`,`2spaces`,`4spaces`]).default(`2spaces`),quotes:E([`single`,`double`]).default(`single`),semicolons:S().default(!0),trailingComma:S().default(!0)}).optional(),schemaOptions:h({format:E([`json`,`yaml`,`typescript`]).default(`typescript`).describe(`Output schema format`),includeExamples:S().default(!0),strictValidation:S().default(!0),generateUI:S().default(!0).describe(`Generate view, dashboard, and page definitions`),generateDataModels:S().default(!0).describe(`Generate object and field definitions`)}).optional(),context:h({existingCode:r().optional(),documentationUrls:C(r()).optional(),referencePlugins:C(r()).optional()}).optional(),options:h({generateTests:S().default(!0),generateDocs:S().default(!0),generateExamples:S().default(!0),targetCoverage:P().min(0).max(100).default(80),optimizationLevel:E([`none`,`basic`,`aggressive`]).default(`basic`)}).optional()}),h({outputFormat:E([`source-code`,`low-code-schema`,`dsl`]),code:r().optional(),language:r().optional(),schemas:C(h({type:E([`object`,`view`,`dashboard`,`app`,`workflow`,`api`,`page`]),path:r().describe(`File path for the schema`),content:r().describe(`Schema content (JSON/YAML/TypeScript)`),description:r().optional()})).optional().describe(`Generated low-code schema files`),files:C(h({path:r(),content:r(),description:r().optional()})),tests:C(h({path:r(),content:r(),coverage:P().min(0).max(100).optional()})).optional(),documentation:h({readme:r().optional(),api:r().optional(),usage:r().optional()}).optional(),package:h({name:r(),version:r(),dependencies:d(r(),r()).optional(),devDependencies:d(r(),r()).optional()}).optional(),quality:h({complexity:P().optional().describe(`Cyclomatic complexity`),maintainability:P().min(0).max(100).optional(),testCoverage:P().min(0).max(100).optional(),lintScore:P().min(0).max(100).optional()}).optional(),confidence:P().min(0).max(100).describe(`AI confidence in generated code`),suggestions:C(r()).optional(),warnings:C(r()).optional()}),h({id:r(),name:r(),description:r(),pluginType:r(),structure:C(h({type:E([`file`,`directory`]),path:r(),template:r().optional().describe(`Template content with variables`),optional:S().default(!1)})),variables:C(h({name:r(),description:r(),type:E([`string`,`number`,`boolean`,`array`,`object`]),required:S().default(!0),default:u().optional(),validation:r().optional().describe(`Validation regex or rule`)})),scripts:C(h({name:r(),command:r(),description:r().optional(),optional:S().default(!1)})).optional()}),h({assessment:E([`excellent`,`good`,`acceptable`,`needs-improvement`,`poor`]),score:P().min(0).max(100),issues:C(h({severity:E([`critical`,`error`,`warning`,`info`,`style`]),category:E([`bug`,`security`,`performance`,`maintainability`,`style`,`documentation`,`testing`,`type-safety`,`best-practice`]),file:r(),line:P().int().optional(),column:P().int().optional(),message:r(),suggestion:r().optional(),autoFixable:S().default(!1),autoFix:r().optional().describe(`Automated fix code`)})),highlights:C(h({category:r(),description:r(),file:r().optional()})).optional(),metrics:h({complexity:P().optional(),maintainability:P().min(0).max(100).optional(),testCoverage:P().min(0).max(100).optional(),duplicateCode:P().min(0).max(100).optional(),technicalDebt:r().optional().describe(`Estimated technical debt`)}).optional(),recommendations:C(h({priority:E([`high`,`medium`,`low`]),title:r(),description:r(),effort:E([`trivial`,`small`,`medium`,`large`]).optional()})),security:h({vulnerabilities:C(h({severity:E([`critical`,`high`,`medium`,`low`]),type:r(),description:r(),remediation:r().optional()})).optional(),score:P().min(0).max(100).optional()}).optional()}),h({goal:r().describe(`What should the composed plugins achieve`),availablePlugins:C(h({pluginId:r(),version:r(),capabilities:C(r()).optional(),description:r().optional()})),constraints:h({maxPlugins:P().int().min(1).optional(),requiredPlugins:C(r()).optional(),excludedPlugins:C(r()).optional(),performance:h({maxLatency:P().optional().describe(`Maximum latency in ms`),maxMemory:P().optional().describe(`Maximum memory in bytes`)}).optional()}).optional(),optimize:E([`performance`,`reliability`,`simplicity`,`cost`,`security`]).optional()}),h({plugins:C(h({pluginId:r(),version:r(),role:r().describe(`Role in the composition`),configuration:d(r(),u()).optional()})),integration:h({code:r(),config:d(r(),u()).optional(),initOrder:C(r())}),dataFlow:C(h({from:r(),to:r(),data:r().describe(`Data type or description`)})),performance:h({estimatedLatency:P().optional().describe(`Estimated latency in ms`),estimatedMemory:P().optional().describe(`Estimated memory in bytes`)}).optional(),confidence:P().min(0).max(100),alternatives:C(h({description:r(),plugins:C(r()),tradeoffs:r()})).optional(),warnings:C(r()).optional()}),h({context:h({installedPlugins:C(r()).optional(),industry:r().optional(),useCases:C(r()).optional(),teamSize:P().int().optional(),budget:E([`free`,`low`,`medium`,`high`,`unlimited`]).optional()}),criteria:h({prioritize:E([`popularity`,`rating`,`compatibility`,`features`,`cost`,`support`]).optional(),certifiedOnly:S().default(!1),minRating:P().min(0).max(5).optional(),maxResults:P().int().min(1).max(50).default(10)}).optional()}),h({recommendations:C(h({pluginId:r(),name:r(),description:r(),score:P().min(0).max(100).describe(`Relevance score`),reasons:C(r()).describe(`Why this plugin is recommended`),benefits:C(r()),considerations:C(r()).optional(),alternatives:C(r()).optional(),estimatedValue:r().optional().describe(`Expected value/ROI`)})),combinations:C(h({plugins:C(r()),description:r(),synergies:C(r()).describe(`How these plugins work well together`),totalScore:P().min(0).max(100)})).optional(),learningPath:C(h({step:P().int(),plugin:r(),reason:r(),resources:C(r()).optional()})).optional()});var _9=E([`healthy`,`degraded`,`unhealthy`,`failed`,`recovering`,`unknown`]).describe(`Current health status of the plugin`),W$e=h({interval:P().int().min(1e3).default(3e4).describe(`How often to perform health checks (default: 30s)`),timeout:P().int().min(100).default(5e3).describe(`Maximum time to wait for health check response`),failureThreshold:P().int().min(1).default(3).describe(`Consecutive failures needed to mark unhealthy`),successThreshold:P().int().min(1).default(1).describe(`Consecutive successes needed to mark healthy`),checkMethod:r().optional().describe(`Method name to call for health check`),autoRestart:S().default(!1).describe(`Automatically restart plugin on health check failure`),maxRestartAttempts:P().int().min(0).default(3).describe(`Maximum restart attempts before giving up`),restartBackoff:E([`fixed`,`linear`,`exponential`]).default(`exponential`).describe(`Backoff strategy for restart delays`)});h({status:_9,timestamp:r().datetime(),message:r().optional(),metrics:h({uptime:P().describe(`Plugin uptime in milliseconds`),memoryUsage:P().optional().describe(`Memory usage in bytes`),cpuUsage:P().optional().describe(`CPU usage percentage`),activeConnections:P().optional().describe(`Number of active connections`),errorRate:P().optional().describe(`Error rate (errors per minute)`),responseTime:P().optional().describe(`Average response time in ms`)}).partial().optional(),checks:C(h({name:r().describe(`Check name`),status:E([`passed`,`failed`,`warning`]),message:r().optional(),data:d(r(),u()).optional()})).optional(),dependencies:C(h({pluginId:r(),status:_9,message:r().optional()})).optional()});var G$e=h({provider:E([`redis`,`etcd`,`custom`]).describe(`Distributed state backend provider`),endpoints:C(r()).optional().describe(`Backend connection endpoints`),keyPrefix:r().optional().describe(`Prefix for all keys (e.g., "plugin:my-plugin:")`),ttl:P().int().min(0).optional().describe(`State expiration time in seconds`),auth:h({username:r().optional(),password:r().optional(),token:r().optional(),certificate:r().optional()}).optional(),replication:h({enabled:S().default(!0),minReplicas:P().int().min(1).default(1)}).optional(),customConfig:d(r(),u()).optional().describe(`Provider-specific configuration`)}),K$e=h({enabled:S().default(!1),watchPatterns:C(r()).optional().describe(`Glob patterns to watch for changes`),debounceDelay:P().int().min(0).default(1e3).describe(`Wait time after change detection before reload`),preserveState:S().default(!0).describe(`Keep plugin state across reloads`),stateStrategy:E([`memory`,`disk`,`distributed`,`none`]).default(`memory`).describe(`How to preserve state during reload`),distributedConfig:G$e.optional().describe(`Configuration for distributed state management`),shutdownTimeout:P().int().min(0).default(3e4).describe(`Maximum time to wait for graceful shutdown`),beforeReload:C(r()).optional().describe(`Hook names to call before reload`),afterReload:C(r()).optional().describe(`Hook names to call after reload`)}),q$e=h({enabled:S().default(!0),fallbackMode:E([`minimal`,`cached`,`readonly`,`offline`,`disabled`]).default(`minimal`),criticalDependencies:C(r()).optional().describe(`Plugin IDs that are required for operation`),optionalDependencies:C(r()).optional().describe(`Plugin IDs that are nice to have but not required`),degradedFeatures:C(h({feature:r().describe(`Feature name`),enabled:S().describe(`Whether feature is available in degraded mode`),reason:r().optional()})).optional(),autoRecovery:h({enabled:S().default(!0),retryInterval:P().int().min(1e3).default(6e4).describe(`Interval between recovery attempts (ms)`),maxAttempts:P().int().min(0).default(5).describe(`Maximum recovery attempts before giving up`)}).optional()}),J$e=h({mode:E([`manual`,`automatic`,`scheduled`,`rolling`]).default(`manual`),autoUpdateConstraints:h({major:S().default(!1).describe(`Allow major version updates`),minor:S().default(!0).describe(`Allow minor version updates`),patch:S().default(!0).describe(`Allow patch version updates`)}).optional(),schedule:h({cron:r().optional(),timezone:r().default(`UTC`),maintenanceWindow:P().int().min(1).default(60)}).optional(),rollback:h({enabled:S().default(!0),automatic:S().default(!0),keepVersions:P().int().min(1).default(3),timeout:P().int().min(1e3).default(3e4)}).optional(),validation:h({checkCompatibility:S().default(!0),runTests:S().default(!1),testSuite:r().optional()}).optional()});h({pluginId:r(),version:r(),timestamp:r().datetime(),state:d(r(),u()),metadata:h({checksum:r().optional().describe(`State checksum for verification`),compressed:S().default(!1),encryption:r().optional().describe(`Encryption algorithm if encrypted`)}).optional()}),h({health:W$e.optional(),hotReload:K$e.optional(),degradation:q$e.optional(),updates:J$e.optional(),resources:h({maxMemory:P().int().optional().describe(`Maximum memory in bytes`),maxCpu:P().min(0).max(100).optional().describe(`Maximum CPU percentage`),maxConnections:P().int().optional().describe(`Maximum concurrent connections`),timeout:P().int().optional().describe(`Operation timeout in milliseconds`)}).optional(),observability:h({enableMetrics:S().default(!0),enableTracing:S().default(!0),enableProfiling:S().default(!1),metricsInterval:P().int().min(1e3).default(6e4).describe(`Metrics collection interval in ms`)}).optional()});var Y$e=h({enabled:S().default(!0),metrics:C(E([`cpu-usage`,`memory-usage`,`response-time`,`error-rate`,`throughput`,`latency`,`connection-count`,`queue-depth`])),algorithm:E([`statistical`,`machine-learning`,`heuristic`,`hybrid`]).default(`hybrid`),sensitivity:E([`low`,`medium`,`high`]).default(`medium`).describe(`How aggressively to detect anomalies`),timeWindow:P().int().min(60).default(300).describe(`Historical data window for anomaly detection`),confidenceThreshold:P().min(0).max(100).default(80).describe(`Minimum confidence to flag as anomaly`),alertOnDetection:S().default(!0)}),X$e=h({id:r(),type:E([`restart`,`scale`,`rollback`,`clear-cache`,`adjust-config`,`execute-script`,`notify`]),trigger:h({healthStatus:C(_9).optional(),anomalyTypes:C(r()).optional(),errorPatterns:C(r()).optional(),customCondition:r().optional().describe(`Custom trigger condition (e.g., "errorRate > 0.1")`)}),parameters:d(r(),u()).optional(),maxAttempts:P().int().min(1).default(3),cooldown:P().int().min(0).default(60),timeout:P().int().min(1).default(300),requireApproval:S().default(!1),priority:P().int().min(1).default(5).describe(`Action priority (lower number = higher priority)`)}),Z$e=h({enabled:S().default(!0),strategy:E([`conservative`,`moderate`,`aggressive`]).default(`moderate`),actions:C(X$e),anomalyDetection:Y$e.optional(),maxConcurrentHealing:P().int().min(1).default(1).describe(`Maximum number of simultaneous healing attempts`),learning:h({enabled:S().default(!0).describe(`Learn from successful/failed healing attempts`),feedbackLoop:S().default(!0).describe(`Adjust strategy based on outcomes`)}).optional()}),Q$e=h({enabled:S().default(!1),metric:E([`cpu-usage`,`memory-usage`,`request-rate`,`response-time`,`queue-depth`,`custom`]),customMetric:r().optional(),targetValue:P().describe(`Desired metric value (e.g., 70 for 70% CPU)`),bounds:h({minInstances:P().int().min(1).default(1),maxInstances:P().int().min(1).default(10),minResources:h({cpu:r().optional().describe(`CPU limit (e.g., "0.5", "1")`),memory:r().optional().describe(`Memory limit (e.g., "512Mi", "1Gi")`)}).optional(),maxResources:h({cpu:r().optional(),memory:r().optional()}).optional()}),scaleUp:h({threshold:P().describe(`Metric value that triggers scale up`),stabilizationWindow:P().int().min(0).default(60).describe(`How long metric must exceed threshold`),cooldown:P().int().min(0).default(300).describe(`Minimum time between scale-up operations`),stepSize:P().int().min(1).default(1).describe(`Number of instances to add`)}),scaleDown:h({threshold:P().describe(`Metric value that triggers scale down`),stabilizationWindow:P().int().min(0).default(300).describe(`How long metric must be below threshold`),cooldown:P().int().min(0).default(600).describe(`Minimum time between scale-down operations`),stepSize:P().int().min(1).default(1).describe(`Number of instances to remove`)}),predictive:h({enabled:S().default(!1).describe(`Use ML to predict future load`),lookAhead:P().int().min(60).default(300).describe(`How far ahead to predict (seconds)`),confidence:P().min(0).max(100).default(80).describe(`Minimum confidence for prediction-based scaling`)}).optional()});h({incidentId:r(),pluginId:r(),symptoms:C(h({type:r().describe(`Symptom type`),description:r(),severity:E([`low`,`medium`,`high`,`critical`]),timestamp:r().datetime()})),timeRange:h({start:r().datetime(),end:r().datetime()}),analyzeLogs:S().default(!0),analyzeMetrics:S().default(!0),analyzeDependencies:S().default(!0),context:d(r(),u()).optional()}),h({analysisId:r(),incidentId:r(),rootCauses:C(h({id:r(),description:r(),confidence:P().min(0).max(100),category:E([`code-defect`,`configuration`,`resource-exhaustion`,`dependency-failure`,`network-issue`,`data-corruption`,`security-breach`,`other`]),evidence:C(h({type:E([`log`,`metric`,`trace`,`event`]),content:r(),timestamp:r().datetime().optional()})),impact:E([`low`,`medium`,`high`,`critical`]),recommendations:C(r())})),contributingFactors:C(h({description:r(),confidence:P().min(0).max(100)})).optional(),timeline:C(h({timestamp:r().datetime(),event:r(),significance:E([`low`,`medium`,`high`])})).optional(),remediation:h({immediate:C(r()),shortTerm:C(r()),longTerm:C(r())}).optional(),overallConfidence:P().min(0).max(100),timestamp:r().datetime()}),h({id:r(),pluginId:r(),type:E([`caching`,`query-optimization`,`resource-allocation`,`code-refactoring`,`architecture-change`,`configuration-tuning`]),description:r(),expectedImpact:h({performanceGain:P().min(0).max(100).describe(`Expected performance improvement (%)`),resourceSavings:h({cpu:P().optional().describe(`CPU reduction (%)`),memory:P().optional().describe(`Memory reduction (%)`),network:P().optional().describe(`Network reduction (%)`)}).optional(),costReduction:P().optional().describe(`Estimated cost reduction (%)`)}),difficulty:E([`trivial`,`easy`,`moderate`,`complex`,`very-complex`]),steps:C(r()),risks:C(r()).optional(),confidence:P().min(0).max(100),priority:E([`low`,`medium`,`high`,`critical`])}),h({agentId:r(),pluginId:r(),selfHealing:Z$e.optional(),autoScaling:C(Q$e).optional(),monitoring:h({enabled:S().default(!0),interval:P().int().min(1e3).default(6e4).describe(`Monitoring interval in milliseconds`),metrics:C(r()).optional()}).optional(),optimization:h({enabled:S().default(!0),scanInterval:P().int().min(3600).default(86400).describe(`How often to scan for optimization opportunities`),autoApply:S().default(!1).describe(`Automatically apply low-risk optimizations`)}).optional(),incidentResponse:h({enabled:S().default(!0),autoRCA:S().default(!0),notifications:C(h({channel:E([`email`,`slack`,`webhook`,`sms`]),config:d(r(),u())})).optional()}).optional()});var $$e=E([`openai`,`azure_openai`,`anthropic`,`google`,`cohere`,`huggingface`,`local`,`custom`]),e1e=h({textGeneration:S().optional().default(!0).describe(`Supports text generation`),textEmbedding:S().optional().default(!1).describe(`Supports text embedding`),imageGeneration:S().optional().default(!1).describe(`Supports image generation`),imageUnderstanding:S().optional().default(!1).describe(`Supports image understanding`),functionCalling:S().optional().default(!1).describe(`Supports function calling`),codeGeneration:S().optional().default(!1).describe(`Supports code generation`),reasoning:S().optional().default(!1).describe(`Supports advanced reasoning`)}),t1e=h({maxTokens:P().int().positive().describe(`Maximum tokens per request`),contextWindow:P().int().positive().describe(`Context window size`),maxOutputTokens:P().int().positive().optional().describe(`Maximum output tokens`),rateLimit:h({requestsPerMinute:P().int().positive().optional(),tokensPerMinute:P().int().positive().optional()}).optional()}),n1e=h({currency:r().optional().default(`USD`),inputCostPer1kTokens:P().optional().describe(`Cost per 1K input tokens`),outputCostPer1kTokens:P().optional().describe(`Cost per 1K output tokens`),embeddingCostPer1kTokens:P().optional().describe(`Cost per 1K embedding tokens`)}),r1e=h({id:r().describe(`Unique model identifier`),name:r().describe(`Model display name`),version:r().describe(`Model version (e.g., "gpt-4-turbo-2024-04-09")`),provider:$$e,capabilities:e1e,limits:t1e,pricing:n1e.optional(),endpoint:r().url().optional().describe(`Custom API endpoint`),apiKey:r().optional().describe(`API key (Warning: Prefer secretRef)`),secretRef:r().optional().describe(`Reference to stored secret (e.g. system:openai_api_key)`),region:r().optional().describe(`Deployment region (e.g., "us-east-1")`),description:r().optional(),tags:C(r()).optional().describe(`Tags for categorization`),deprecated:S().optional().default(!1),recommendedFor:C(r()).optional().describe(`Use case recommendations`)}),i1e=h({name:r().describe(`Variable name (e.g., "user_name", "context")`),type:E([`string`,`number`,`boolean`,`object`,`array`]).default(`string`),required:S().default(!1),defaultValue:u().optional(),description:r().optional(),validation:h({minLength:P().optional(),maxLength:P().optional(),pattern:r().optional(),enum:C(u()).optional()}).optional()}),a1e=h({id:r().describe(`Unique template identifier`),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template name (snake_case)`),label:r().describe(`Display name`),system:r().optional().describe(`System prompt`),user:r().describe(`User prompt template with variables`),assistant:r().optional().describe(`Assistant message prefix`),variables:C(i1e).optional().describe(`Template variables`),modelId:r().optional().describe(`Recommended model ID`),temperature:P().min(0).max(2).optional(),maxTokens:P().optional(),topP:P().optional(),frequencyPenalty:P().optional(),presencePenalty:P().optional(),stopSequences:C(r()).optional(),version:r().optional().default(`1.0.0`),description:r().optional(),category:r().optional().describe(`Template category (e.g., "code_generation", "support")`),tags:C(r()).optional(),examples:C(h({input:d(r(),u()).describe(`Example variable values`),output:r().describe(`Expected output`)})).optional()}),o1e=h({model:r1e,status:E([`active`,`deprecated`,`experimental`,`disabled`]).default(`active`),priority:P().int().default(0).describe(`Priority for model selection`),fallbackModels:C(r()).optional().describe(`Fallback model IDs`),healthCheck:h({enabled:S().default(!0),intervalSeconds:P().int().default(300),lastChecked:r().optional().describe(`ISO timestamp`),status:E([`healthy`,`unhealthy`,`unknown`]).default(`unknown`)}).optional()});h({name:r().describe(`Registry name`),models:d(r(),o1e).describe(`Model entries by ID`),promptTemplates:d(r(),a1e).optional().describe(`Prompt templates by name`),defaultModel:r().optional().describe(`Default model ID`),enableAutoFallback:S().default(!0).describe(`Auto-fallback on errors`)}),h({capabilities:C(r()).optional().describe(`Required capabilities`),maxCostPer1kTokens:P().optional().describe(`Maximum acceptable cost`),minContextWindow:P().optional().describe(`Minimum context window size`),provider:$$e.optional(),tags:C(r()).optional(),excludeDeprecated:S().default(!0)});var s1e=h({type:E([`stdio`,`http`,`websocket`,`grpc`]),url:r().url().optional().describe(`Server URL (for HTTP/WebSocket/gRPC)`),headers:d(r(),r()).optional().describe(`Custom headers for requests`),auth:h({type:E([`none`,`bearer`,`api_key`,`oauth2`,`custom`]).default(`none`),token:r().optional().describe(`Bearer token or API key`),secretRef:r().optional().describe(`Reference to stored secret`),headerName:r().optional().describe(`Custom auth header name`)}).optional(),timeout:P().int().positive().optional().default(3e4).describe(`Request timeout in milliseconds`),retryAttempts:P().int().min(0).max(5).optional().default(3),retryDelay:P().int().positive().optional().default(1e3).describe(`Delay between retries in milliseconds`),command:r().optional().describe(`Command to execute (for stdio transport)`),args:C(r()).optional().describe(`Command arguments`),env:d(r(),r()).optional().describe(`Environment variables`),workingDirectory:r().optional().describe(`Working directory for the process`)}),c1e=E([`text`,`json`,`binary`,`stream`]),l1e=h({uri:r().describe(`Unique resource identifier (e.g., "objectstack://objects/account/ABC123")`),name:r().describe(`Human-readable resource name`),description:r().optional().describe(`Resource description for AI consumption`),mimeType:r().optional().describe(`MIME type (e.g., "application/json", "text/plain")`),resourceType:c1e.default(`json`),content:u().optional().describe(`Resource content (for static resources)`),contentUrl:r().url().optional().describe(`URL to fetch content dynamically`),size:P().int().nonnegative().optional().describe(`Resource size in bytes`),lastModified:r().datetime().optional().describe(`Last modification timestamp (ISO 8601)`),tags:C(r()).optional().describe(`Tags for resource categorization`),permissions:h({read:S().default(!0),write:S().default(!1),delete:S().default(!1)}).optional(),cacheable:S().default(!0).describe(`Whether this resource can be cached`),cacheMaxAge:P().int().nonnegative().optional().describe(`Cache max age in seconds`)}),u1e=h({uriPattern:r().describe(`URI pattern with variables (e.g., "objectstack://objects/{objectName}/{recordId}")`),name:r().describe(`Template name`),description:r().optional(),parameters:C(h({name:r().describe(`Parameter name`),type:E([`string`,`number`,`boolean`]).default(`string`),required:S().default(!0),description:r().optional(),pattern:r().optional().describe(`Regex validation pattern`),default:u().optional()})).describe(`URI parameters`),handler:r().optional().describe(`Handler function name for dynamic generation`),mimeType:r().optional(),resourceType:c1e.default(`json`)}),v9=h({name:r().describe(`Parameter name`),type:E([`string`,`number`,`boolean`,`object`,`array`]),description:r().describe(`Parameter description for AI consumption`),required:S().default(!1),default:u().optional(),enum:C(u()).optional().describe(`Allowed values`),pattern:r().optional().describe(`Regex validation pattern (for strings)`),minimum:P().optional().describe(`Minimum value (for numbers)`),maximum:P().optional().describe(`Maximum value (for numbers)`),minLength:P().int().nonnegative().optional().describe(`Minimum length (for strings/arrays)`),maxLength:P().int().nonnegative().optional().describe(`Maximum length (for strings/arrays)`),properties:d(r(),F(()=>v9)).optional().describe(`Properties for object types`),items:F(()=>v9).optional().describe(`Item schema for array types`)}),d1e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Tool function name (snake_case)`),description:r().describe(`Tool description for AI consumption (be detailed and specific)`),parameters:C(v9).describe(`Tool parameters`),returns:h({type:E([`string`,`number`,`boolean`,`object`,`array`,`void`]),description:r().optional(),schema:v9.optional().describe(`Return value schema`)}).optional(),handler:r().describe(`Handler function or endpoint reference`),async:S().default(!0).describe(`Whether the tool executes asynchronously`),timeout:P().int().positive().optional().describe(`Execution timeout in milliseconds`),sideEffects:E([`none`,`read`,`write`,`delete`]).default(`read`).describe(`Tool side effects`),requiresConfirmation:S().default(!1).describe(`Require user confirmation before execution`),confirmationMessage:r().optional(),examples:C(h({description:r(),parameters:d(r(),u()),result:u().optional()})).optional().describe(`Usage examples for AI learning`),category:r().optional().describe(`Tool category (e.g., "data", "workflow", "analytics")`),tags:C(r()).optional(),deprecated:S().default(!1),version:r().optional().default(`1.0.0`)}),f1e=h({name:r().describe(`Argument name`),description:r().optional(),type:E([`string`,`number`,`boolean`]).default(`string`),required:S().default(!1),default:u().optional()}),p1e=h({role:E([`system`,`user`,`assistant`]).describe(`Message role`),content:r().describe(`Message content (can include {{variable}} placeholders)`)}),m1e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Prompt template name (snake_case)`),description:r().optional().describe(`Prompt description`),messages:C(p1e).describe(`Prompt message sequence`),arguments:C(f1e).optional().describe(`Dynamic arguments for the prompt`),category:r().optional(),tags:C(r()).optional(),version:r().optional().default(`1.0.0`)}),h1e=h({enabled:S().describe(`Enable streaming for MCP communication`),chunkSize:P().int().positive().optional().describe(`Size of each streamed chunk in bytes`),heartbeatIntervalMs:P().int().positive().optional().default(3e4).describe(`Heartbeat interval in milliseconds`),backpressure:E([`drop`,`buffer`,`block`]).optional().describe(`Backpressure handling strategy`)}).describe(`Streaming configuration for MCP communication`),g1e=h({requireApproval:S().default(!1).describe(`Require approval before tool execution`),approvalStrategy:E([`human_in_loop`,`auto_approve`,`policy_based`]).describe(`Approval strategy for tool execution`),dangerousToolPatterns:C(r()).optional().describe(`Regex patterns for tools needing approval`),autoApproveTimeout:P().int().positive().optional().describe(`Auto-approve timeout in seconds`)}).describe(`Tool approval configuration for MCP`),_1e=h({enabled:S().describe(`Enable LLM sampling`),maxTokens:P().int().positive().describe(`Maximum tokens to generate`),temperature:P().min(0).max(2).optional().describe(`Sampling temperature`),stopSequences:C(r()).optional().describe(`Stop sequences to end generation`),modelPreferences:C(r()).optional().describe(`Preferred model IDs in priority order`),systemPrompt:r().optional().describe(`System prompt for sampling context`)}).describe(`Sampling configuration for MCP`),v1e=h({roots:C(h({uri:r().describe(`Root URI (e.g., file:///path/to/project)`),name:r().optional().describe(`Human-readable root name`),readOnly:S().optional().describe(`Whether the root is read-only`)}).describe(`A single root directory or resource`)).describe(`Root directories or resources available to the client`),watchForChanges:S().default(!1).describe(`Watch root directories for filesystem changes`),notifyOnChange:S().default(!0).describe(`Notify server when root contents change`)}).describe(`Roots configuration for MCP client`),y1e=h({resources:S().default(!1).describe(`Supports resource listing and retrieval`),resourceTemplates:S().default(!1).describe(`Supports dynamic resource templates`),tools:S().default(!1).describe(`Supports tool/function calling`),prompts:S().default(!1).describe(`Supports prompt templates`),sampling:S().default(!1).describe(`Supports sampling from LLMs`),logging:S().default(!1).describe(`Supports logging and debugging`)}),b1e=h({name:r().describe(`Server name`),version:r().describe(`Server version (semver)`),description:r().optional(),capabilities:y1e,protocolVersion:r().default(`2024-11-05`).describe(`MCP protocol version`),vendor:r().optional().describe(`Server vendor/provider`),homepage:r().url().optional().describe(`Server homepage URL`),documentation:r().url().optional().describe(`Documentation URL`)}),x1e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Server unique identifier (snake_case)`),label:r().describe(`Display name`),description:r().optional(),serverInfo:b1e,transport:s1e,resources:C(l1e).optional().describe(`Static resources`),resourceTemplates:C(u1e).optional().describe(`Dynamic resource templates`),tools:C(d1e).optional().describe(`Available tools`),prompts:C(m1e).optional().describe(`Prompt templates`),autoStart:S().default(!1).describe(`Auto-start server on system boot`),restartOnFailure:S().default(!0).describe(`Auto-restart on failure`),healthCheck:h({enabled:S().default(!0),interval:P().int().positive().default(6e4).describe(`Health check interval in milliseconds`),timeout:P().int().positive().default(5e3).describe(`Health check timeout in milliseconds`),endpoint:r().optional().describe(`Health check endpoint (for HTTP servers)`)}).optional(),permissions:h({allowedAgents:C(r()).optional().describe(`Agent names allowed to use this server`),allowedUsers:C(r()).optional().describe(`User IDs allowed to use this server`),requireAuth:S().default(!0)}).optional(),rateLimit:h({enabled:S().default(!1),requestsPerMinute:P().int().positive().optional(),requestsPerHour:P().int().positive().optional(),burstSize:P().int().positive().optional()}).optional(),tags:C(r()).optional(),status:E([`active`,`inactive`,`maintenance`,`deprecated`]).default(`active`),version:r().optional().default(`1.0.0`),createdAt:r().datetime().optional(),updatedAt:r().datetime().optional(),streaming:h1e.optional().describe(`Streaming configuration`),toolApproval:g1e.optional().describe(`Tool approval configuration`),sampling:_1e.optional().describe(`LLM sampling configuration`)});h({uri:r().describe(`Resource URI to fetch`),parameters:d(r(),u()).optional().describe(`URI template parameters`)}),h({resource:l1e,content:u().describe(`Resource content`)}),h({toolName:r().describe(`Tool to invoke`),parameters:d(r(),u()).describe(`Tool parameters`),timeout:P().int().positive().optional(),confirmationProvided:S().optional().describe(`User confirmation for tools that require it`),context:h({userId:r().optional(),sessionId:r().optional(),agentName:r().optional(),metadata:d(r(),u()).optional()}).optional()}),h({toolName:r(),status:E([`success`,`error`,`timeout`,`cancelled`]),result:u().optional().describe(`Tool execution result`),error:h({code:r(),message:r(),details:u().optional()}).optional(),executionTime:P().nonnegative().optional().describe(`Execution time in milliseconds`),timestamp:r().datetime().optional()}),h({promptName:r().describe(`Prompt template to use`),arguments:d(r(),u()).optional().describe(`Prompt arguments`)}),h({promptName:r(),messages:C(p1e).describe(`Rendered prompt messages`)}),h({servers:C(x1e).describe(`MCP servers to connect to`),defaultTimeout:P().int().positive().default(3e4).describe(`Default timeout for requests`),enableCaching:S().default(!0).describe(`Enable client-side caching`),cacheMaxAge:P().int().nonnegative().default(300).describe(`Cache max age in seconds`),retryAttempts:P().int().min(0).max(5).default(3),retryDelay:P().int().positive().default(1e3),enableLogging:S().default(!0),logLevel:E([`debug`,`info`,`warn`,`error`]).default(`info`),roots:v1e.optional().describe(`Root directories/resources configuration`)});var y9=h({prompt:P().int().nonnegative().describe(`Input tokens`),completion:P().int().nonnegative().describe(`Output tokens`),total:P().int().nonnegative().describe(`Total tokens`)});h({operationId:r(),operationType:E([`conversation`,`orchestration`,`prediction`,`rag`,`nlq`]),agentName:r().optional().describe(`Agent that performed the operation`),modelId:r(),tokens:y9,cost:P().nonnegative().describe(`Cost in USD`),timestamp:r().datetime(),metadata:d(r(),u()).optional()}),E([`token`,`request`,`character`,`second`,`image`,`embedding`]);var S1e=E([`hourly`,`daily`,`weekly`,`monthly`,`quarterly`,`yearly`,`custom`]);h({id:r().describe(`Unique cost entry ID`),timestamp:r().datetime().describe(`ISO 8601 timestamp`),modelId:r().describe(`AI model used`),provider:r().describe(`AI provider (e.g., "openai", "anthropic")`),operation:r().describe(`Operation type (e.g., "chat_completion", "embedding")`),tokens:y9.optional().describe(`Standardized token usage`),requestCount:P().int().positive().default(1),promptCost:P().nonnegative().optional().describe(`Cost of prompt tokens`),completionCost:P().nonnegative().optional().describe(`Cost of completion tokens`),totalCost:P().nonnegative().describe(`Total cost in base currency`),currency:r().default(`USD`),sessionId:r().optional().describe(`Conversation session ID`),userId:r().optional().describe(`User who triggered the request`),agentId:r().optional().describe(`AI agent ID`),object:r().optional().describe(`Related object (e.g., "case", "project")`),recordId:r().optional().describe(`Related record ID`),tags:C(r()).optional(),metadata:d(r(),u()).optional()});var b9=E([`global`,`user`,`agent`,`object`,`project`,`department`]);h({type:b9,scope:r().optional().describe(`Scope identifier (userId, agentId, etc.)`),maxCost:P().nonnegative().describe(`Maximum cost limit`),currency:r().default(`USD`),period:S1e,customPeriodDays:P().int().positive().optional().describe(`Custom period in days`),softLimit:P().nonnegative().optional().describe(`Soft limit for warnings`),warnThresholds:C(P().min(0).max(1)).optional().describe(`Warning thresholds (e.g., [0.5, 0.8, 0.95])`),enforced:S().default(!0).describe(`Block requests when exceeded`),gracePeriodSeconds:P().int().nonnegative().default(0).describe(`Grace period after limit exceeded`),allowRollover:S().default(!1).describe(`Allow unused budget to rollover`),maxRolloverPercentage:P().min(0).max(1).optional().describe(`Max rollover as % of limit`),name:r().optional().describe(`Budget name`),description:r().optional(),active:S().default(!0),tags:C(r()).optional()});var C1e=h({budgetId:r(),type:b9,scope:r().optional(),periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),currentCost:P().nonnegative().default(0),maxCost:P().nonnegative(),currency:r().default(`USD`),percentageUsed:P().nonnegative().describe(`Usage as percentage (can exceed 1.0 if over budget)`),remainingCost:P().describe(`Remaining budget (can be negative if exceeded)`),isExceeded:S().default(!1),isWarning:S().default(!1),projectedCost:P().nonnegative().optional().describe(`Projected cost for period`),projectedOverage:P().nonnegative().optional().describe(`Projected overage`),lastUpdated:r().datetime().describe(`ISO 8601 timestamp`)}),w1e=E([`threshold_warning`,`threshold_critical`,`limit_exceeded`,`anomaly_detected`,`projection_exceeded`]),T1e=h({id:r(),timestamp:r().datetime().describe(`ISO 8601 timestamp`),type:w1e,severity:E([`info`,`warning`,`critical`]),budgetId:r().optional(),budgetType:b9.optional(),scope:r().optional(),message:r().describe(`Alert message`),currentCost:P().nonnegative(),maxCost:P().nonnegative().optional(),threshold:P().min(0).max(1).optional(),currency:r().default(`USD`),recommendations:C(r()).optional(),acknowledged:S().default(!1),acknowledgedBy:r().optional(),acknowledgedAt:r().datetime().optional(),resolved:S().default(!1),metadata:d(r(),u()).optional()}),E1e=E([`model`,`provider`,`user`,`agent`,`object`,`operation`,`date`,`hour`,`tag`]),x9=h({dimension:E1e,value:r().describe(`Dimension value (e.g., model ID, user ID)`),totalCost:P().nonnegative(),requestCount:P().int().nonnegative(),totalTokens:P().int().nonnegative().optional(),percentageOfTotal:P().min(0).max(1),periodStart:r().datetime().optional(),periodEnd:r().datetime().optional()}),D1e=h({periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),totalCost:P().nonnegative(),totalRequests:P().int().nonnegative(),totalTokens:P().int().nonnegative().optional(),currency:r().default(`USD`),averageCostPerRequest:P().nonnegative(),averageCostPerToken:P().nonnegative().optional(),averageRequestsPerDay:P().nonnegative(),costTrend:E([`increasing`,`decreasing`,`stable`]).optional(),trendPercentage:P().optional().describe(`% change vs previous period`),byModel:C(x9).optional(),byProvider:C(x9).optional(),byUser:C(x9).optional(),byAgent:C(x9).optional(),byOperation:C(x9).optional(),byDate:C(x9).optional(),topModels:C(x9).optional(),topUsers:C(x9).optional(),topAgents:C(x9).optional(),tokensPerDollar:P().nonnegative().optional(),requestsPerDollar:P().nonnegative().optional()}),O1e=h({id:r(),type:E([`switch_model`,`reduce_tokens`,`batch_requests`,`cache_results`,`adjust_parameters`,`limit_usage`]),title:r(),description:r(),estimatedSavings:P().nonnegative().optional(),savingsPercentage:P().min(0).max(1).optional(),priority:E([`low`,`medium`,`high`]),effort:E([`low`,`medium`,`high`]),actionable:S().default(!0),actionSteps:C(r()).optional(),targetModel:r().optional(),alternativeModel:r().optional(),affectedUsers:C(r()).optional(),status:E([`pending`,`accepted`,`rejected`,`implemented`]).default(`pending`),implementedAt:r().datetime().optional()});h({id:r(),name:r(),generatedAt:r().datetime().describe(`ISO 8601 timestamp`),periodStart:r().datetime().describe(`ISO 8601 timestamp`),periodEnd:r().datetime().describe(`ISO 8601 timestamp`),period:S1e,analytics:D1e,budgets:C(C1e).optional(),alerts:C(T1e).optional(),activeAlertCount:P().int().nonnegative().default(0),recommendations:C(O1e).optional(),previousPeriodCost:P().nonnegative().optional(),costChange:P().optional().describe(`Change vs previous period`),costChangePercentage:P().optional(),forecastedCost:P().nonnegative().optional(),forecastedBudgetStatus:E([`under`,`at`,`over`]).optional(),format:E([`summary`,`detailed`,`executive`]).default(`summary`),currency:r().default(`USD`)}),h({startDate:r().datetime().optional().describe(`ISO 8601 timestamp`),endDate:r().datetime().optional().describe(`ISO 8601 timestamp`),modelIds:C(r()).optional(),providers:C(r()).optional(),userIds:C(r()).optional(),agentIds:C(r()).optional(),operations:C(r()).optional(),sessionIds:C(r()).optional(),minCost:P().nonnegative().optional(),maxCost:P().nonnegative().optional(),tags:C(r()).optional(),groupBy:C(E1e).optional(),orderBy:E([`timestamp`,`cost`,`tokens`]).optional().default(`timestamp`),orderDirection:E([`asc`,`desc`]).optional().default(`desc`),limit:P().int().positive().optional(),offset:P().int().nonnegative().optional()});var k1e=E([`pinecone`,`weaviate`,`qdrant`,`milvus`,`chroma`,`pgvector`,`redis`,`opensearch`,`elasticsearch`,`custom`]),A1e=h({provider:E([`openai`,`cohere`,`huggingface`,`azure_openai`,`local`,`custom`]),model:r().describe(`Model name (e.g., "text-embedding-3-large")`),dimensions:P().int().positive().describe(`Embedding vector dimensions`),maxTokens:P().int().positive().optional().describe(`Maximum tokens per embedding`),batchSize:P().int().positive().optional().default(100).describe(`Batch size for embedding`),endpoint:r().url().optional().describe(`Custom endpoint URL`),apiKey:r().optional().describe(`API key`),secretRef:r().optional().describe(`Reference to stored secret`)}),j1e=I(`type`,[h({type:m(`fixed`),chunkSize:P().int().positive().describe(`Fixed chunk size in tokens/chars`),chunkOverlap:P().int().min(0).default(0).describe(`Overlap between chunks`),unit:E([`tokens`,`characters`]).default(`tokens`)}),h({type:m(`semantic`),model:r().optional().describe(`Model for semantic chunking`),minChunkSize:P().int().positive().default(100),maxChunkSize:P().int().positive().default(1e3)}),h({type:m(`recursive`),separators:C(r()).default([` - -`,` -`,` `,``]),chunkSize:P().int().positive(),chunkOverlap:P().int().min(0).default(0)}),h({type:m(`markdown`),maxChunkSize:P().int().positive().default(1e3),respectHeaders:S().default(!0).describe(`Keep headers with content`),respectCodeBlocks:S().default(!0).describe(`Keep code blocks intact`)})]),M1e=h({source:r().describe(`Document source (file path, URL, etc.)`),sourceType:E([`file`,`url`,`api`,`database`,`custom`]).optional(),title:r().optional(),author:r().optional().describe(`Document author`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`),tags:C(r()).optional(),category:r().optional(),language:r().optional().describe(`Document language (ISO 639-1 code)`),custom:d(r(),u()).optional().describe(`Custom metadata fields`)});h({id:r().describe(`Unique chunk identifier`),content:r().describe(`Chunk text content`),embedding:C(P()).optional().describe(`Embedding vector`),metadata:M1e,chunkIndex:P().int().min(0).describe(`Chunk position in document`),tokens:P().int().optional().describe(`Token count`)});var N1e=I(`type`,[h({type:m(`similarity`),topK:P().int().positive().default(5).describe(`Number of results to retrieve`),scoreThreshold:P().min(0).max(1).optional().describe(`Minimum similarity score`)}),h({type:m(`mmr`),topK:P().int().positive().default(5),fetchK:P().int().positive().default(20).describe(`Initial fetch size`),lambda:P().min(0).max(1).default(.5).describe(`Diversity vs relevance (0=diverse, 1=relevant)`)}),h({type:m(`hybrid`),topK:P().int().positive().default(5),vectorWeight:P().min(0).max(1).default(.7).describe(`Weight for vector search`),keywordWeight:P().min(0).max(1).default(.3).describe(`Weight for keyword search`)}),h({type:m(`parent_document`),topK:P().int().positive().default(5),retrieveParent:S().default(!0).describe(`Retrieve full parent document`)})]),P1e=h({enabled:S().default(!1),model:r().optional().describe(`Reranking model name`),provider:E([`cohere`,`huggingface`,`custom`]).optional(),topK:P().int().positive().default(3).describe(`Final number of results after reranking`)}),F1e=h({provider:k1e,indexName:r().describe(`Index/collection name`),namespace:r().optional().describe(`Namespace for multi-tenancy`),host:r().optional().describe(`Vector store host`),port:P().int().optional().describe(`Vector store port`),secretRef:r().optional().describe(`Reference to stored secret`),apiKey:r().optional().describe(`API key or reference to secret`),dimensions:P().int().positive().describe(`Vector dimensions`),metric:E([`cosine`,`euclidean`,`dotproduct`]).optional().default(`cosine`),batchSize:P().int().positive().optional().default(100),connectionPoolSize:P().int().positive().optional().default(10),timeout:P().int().positive().optional().default(3e4).describe(`Timeout in milliseconds`)}),I1e=h({type:E([`file`,`directory`,`url`,`api`,`database`,`custom`]),source:r().describe(`Source path, URL, or identifier`),fileTypes:C(r()).optional().describe(`Accepted file extensions (e.g., [".pdf", ".md"])`),recursive:S().optional().default(!1).describe(`Process directories recursively`),maxFileSize:P().int().optional().describe(`Maximum file size in bytes`),excludePatterns:C(r()).optional().describe(`Patterns to exclude`),extractImages:S().optional().default(!1).describe(`Extract text from images (OCR)`),extractTables:S().optional().default(!1).describe(`Extract and format tables`),loaderConfig:d(r(),u()).optional().describe(`Custom loader-specific config`)}),L1e=h({field:r().describe(`Metadata field to filter`),operator:E([`eq`,`neq`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`,`contains`]).default(`eq`),value:l([r(),P(),S(),C(l([r(),P()]))]).describe(`Filter value`)}),R1e=h({logic:E([`and`,`or`]).default(`and`),filters:C(l([L1e,F(()=>R1e)]))}),z1e=l([L1e,R1e,d(r(),l([r(),P(),S(),C(l([r(),P()]))]))]);h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Pipeline name (snake_case)`),label:r().describe(`Display name`),description:r().optional(),embedding:A1e,vectorStore:F1e,chunking:j1e,retrieval:N1e,reranking:P1e.optional(),loaders:C(I1e).optional().describe(`Document loaders`),maxContextTokens:P().int().positive().default(4e3).describe(`Maximum tokens in context`),contextWindow:P().int().positive().optional().describe(`LLM context window size`),metadataFilters:z1e.optional().describe(`Global filters for retrieval`),enableCache:S().default(!0),cacheTTL:P().int().positive().default(3600).describe(`Cache TTL in seconds`),cacheInvalidationStrategy:E([`time_based`,`manual`,`on_update`]).default(`time_based`).optional()}),h({query:r().describe(`User query`),pipelineName:r().describe(`Pipeline to use`),topK:P().int().positive().optional(),metadataFilters:d(r(),u()).optional(),conversationHistory:C(h({role:E([`user`,`assistant`,`system`]),content:r()})).optional(),includeMetadata:S().default(!0),includeSources:S().default(!0)}),h({query:r(),results:C(h({content:r(),score:P(),metadata:M1e.optional(),chunkId:r().optional()})),context:r().describe(`Assembled context for LLM`),tokens:y9.optional().describe(`Token usage for this query`),cost:P().nonnegative().optional().describe(`Cost for this query in USD`),retrievalTime:P().optional().describe(`Retrieval time in milliseconds`)}),h({name:r(),status:E([`active`,`indexing`,`error`,`disabled`]),documentsIndexed:P().int().min(0),lastIndexed:r().datetime().optional().describe(`ISO timestamp`),errorMessage:r().optional(),health:h({vectorStore:E([`healthy`,`unhealthy`,`unknown`]),embeddingService:E([`healthy`,`unhealthy`,`unknown`])}).optional()});var S9=E([`select`,`aggregate`,`filter`,`sort`,`compare`,`trend`,`insight`,`create`,`update`,`delete`]),B1e=h({type:E([`object`,`field`,`value`,`operator`,`function`,`timeframe`]),text:r().describe(`Original text from query`),value:u().describe(`Normalized value`),confidence:P().min(0).max(1).describe(`Confidence score`),span:w([P(),P()]).optional().describe(`Character span in query`)}),V1e=h({type:E([`absolute`,`relative`]),start:r().optional().describe(`Start date (ISO format)`),end:r().optional().describe(`End date (ISO format)`),relative:h({unit:E([`hour`,`day`,`week`,`month`,`quarter`,`year`]),value:P().int(),direction:E([`past`,`future`,`current`]).default(`past`)}).optional(),text:r().describe(`Original timeframe text`)}),H1e=h({naturalLanguage:r().describe(`NL field name (e.g., "customer name")`),objectField:r().describe(`Actual field name (e.g., "account.name")`),object:r().describe(`Object name`),field:r().describe(`Field name`),confidence:P().min(0).max(1)}),U1e=h({userId:r().optional(),userRole:r().optional(),currentObject:r().optional().describe(`Current object being viewed`),currentRecordId:r().optional().describe(`Current record ID`),conversationHistory:C(h({query:r(),timestamp:r(),intent:S9.optional()})).optional(),defaultLimit:P().int().default(100),timezone:r().default(`UTC`),locale:r().default(`en-US`)}),W1e=h({originalQuery:r(),intent:S9,intentConfidence:P().min(0).max(1),entities:C(B1e),targetObject:r().optional().describe(`Primary object to query`),fields:C(H1e).optional(),timeframe:V1e.optional(),ast:d(r(),u()).describe(`Generated ObjectQL AST`),confidence:P().min(0).max(1).describe(`Overall confidence`),ambiguities:C(h({type:r(),description:r(),suggestions:C(r()).optional()})).optional().describe(`Detected ambiguities requiring clarification`),alternatives:C(h({interpretation:r(),confidence:P(),ast:u()})).optional()});h({query:r().describe(`Natural language query`),context:U1e.optional(),includeAlternatives:S().default(!1).describe(`Include alternative interpretations`),maxAlternatives:P().int().default(3),minConfidence:P().min(0).max(1).default(.5).describe(`Minimum confidence threshold`),executeQuery:S().default(!1).describe(`Execute query and return results`),maxResults:P().int().optional().describe(`Maximum results to return`)}),h({parseResult:W1e,results:C(d(r(),u())).optional().describe(`Query results`),totalCount:P().int().optional(),executionTime:P().optional().describe(`Execution time in milliseconds`),needsClarification:S().describe(`Whether query needs clarification`),tokens:y9.optional().describe(`Token usage for this query`),cost:P().nonnegative().optional().describe(`Cost for this query in USD`),suggestions:C(r()).optional().describe(`Query refinement suggestions`)}),h({query:r().describe(`Natural language query`),context:U1e.optional(),expectedIntent:S9,expectedObject:r().optional(),expectedAST:d(r(),u()).describe(`Expected ObjectQL AST`),category:r().optional().describe(`Example category`),tags:C(r()).optional(),notes:r().optional()}),h({modelId:r().describe(`Model from registry`),systemPrompt:r().optional().describe(`System prompt override`),includeSchema:S().default(!0).describe(`Include object schema in prompt`),includeExamples:S().default(!0).describe(`Include examples in prompt`),enableIntentDetection:S().default(!0),intentThreshold:P().min(0).max(1).default(.7),enableEntityRecognition:S().default(!0),entityRecognitionModel:r().optional(),enableFuzzyMatching:S().default(!0).describe(`Fuzzy match field names`),fuzzyMatchThreshold:P().min(0).max(1).default(.8),enableTimeframeDetection:S().default(!0),defaultTimeframe:r().optional().describe(`Default timeframe if not specified`),enableCaching:S().default(!0),cacheTTL:P().int().default(3600).describe(`Cache TTL in seconds`)}),h({totalQueries:P().int(),successfulQueries:P().int(),failedQueries:P().int(),averageConfidence:P().min(0).max(1),intentDistribution:d(r(),P().int()).describe(`Count by intent type`),topQueries:C(h({query:r(),count:P().int(),averageConfidence:P()})),averageParseTime:P().describe(`Average parse time in milliseconds`),averageExecutionTime:P().optional(),lowConfidenceQueries:C(h({query:r(),confidence:P(),timestamp:r().datetime()})),startDate:r().datetime().describe(`ISO timestamp`),endDate:r().datetime().describe(`ISO timestamp`)}),h({object:r().describe(`Object name`),field:r().describe(`Field name`),synonyms:C(r()).describe(`Natural language synonyms`),examples:C(r()).optional().describe(`Example queries using synonyms`)}),h({id:r(),name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Template name (snake_case)`),label:r(),pattern:r().describe(`Query pattern with placeholders`),variables:C(h({name:r(),type:E([`object`,`field`,`value`,`timeframe`]),required:S().default(!1)})),astTemplate:d(r(),u()).describe(`AST template with variable placeholders`),category:r().optional(),examples:C(r()).optional(),tags:C(r()).optional()});var G1e=E([`record_created`,`record_updated`,`field_changed`,`scheduled`,`manual`,`webhook`,`batch`]),K1e=E([`classify`,`extract`,`summarize`,`generate`,`predict`,`translate`,`sentiment`,`entity_recognition`,`anomaly_detection`,`recommendation`]),q1e=h({id:r().optional().describe(`Optional task ID for referencing`),name:r().describe(`Human-readable task name`),type:K1e,model:r().optional().describe(`Model ID from registry (uses default if not specified)`),promptTemplate:r().optional().describe(`Prompt template ID for this task`),inputFields:C(r()).describe(`Source fields to process (e.g., ["description", "comments"])`),inputSchema:d(r(),u()).optional().describe(`Validation schema for inputs`),inputContext:d(r(),u()).optional().describe(`Additional context for the AI model`),outputField:r().describe(`Target field to store the result`),outputSchema:d(r(),u()).optional().describe(`Validation schema for output`),outputFormat:E([`text`,`json`,`number`,`boolean`,`array`]).optional().default(`text`),classes:C(r()).optional().describe(`Valid classes for classification tasks`),multiClass:S().optional().default(!1).describe(`Allow multiple classes to be selected`),extractionSchema:d(r(),u()).optional().describe(`JSON schema for structured extraction`),maxLength:P().optional().describe(`Maximum length for generated content`),temperature:P().min(0).max(2).optional().describe(`Model temperature override`),fallbackValue:u().optional().describe(`Fallback value if AI task fails`),retryAttempts:P().int().min(0).max(5).optional().default(1),condition:r().optional().describe(`Formula condition - task only runs if TRUE`),description:r().optional(),active:S().optional().default(!0)}),J1e=h({field:r().describe(`Field name to monitor`),operator:E([`changed`,`changed_to`,`changed_from`,`is`,`is_not`]).optional().default(`changed`),value:u().optional().describe(`Value to compare against (for changed_to/changed_from/is/is_not)`)}),Y1e=h({type:E([`cron`,`interval`,`daily`,`weekly`,`monthly`]).default(`cron`),cron:r().optional().describe(`Cron expression (required if type is "cron")`),interval:P().optional().describe(`Interval in minutes (required if type is "interval")`),time:r().optional().describe(`Time of day for daily schedules (HH:MM format)`),dayOfWeek:P().int().min(0).max(6).optional().describe(`Day of week for weekly (0=Sunday)`),dayOfMonth:P().int().min(1).max(31).optional().describe(`Day of month for monthly`),timezone:r().optional().default(`UTC`)}),X1e=h({type:E([`field_update`,`send_email`,`create_record`,`update_related`,`trigger_flow`,`webhook`]),name:r().describe(`Action name`),config:d(r(),u()).describe(`Action-specific configuration`),condition:r().optional().describe(`Execute only if condition is TRUE`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Orchestration unique identifier (snake_case)`),label:r().describe(`Display name`),description:r().optional(),objectName:r().describe(`Target object for this orchestration`),trigger:G1e,fieldConditions:C(J1e).optional().describe(`Fields to monitor (for field_changed trigger)`),schedule:Y1e.optional().describe(`Schedule configuration (for scheduled trigger)`),webhookConfig:h({secret:r().optional().describe(`Webhook verification secret`),headers:d(r(),r()).optional().describe(`Expected headers`)}).optional().describe(`Webhook configuration (for webhook trigger)`),entryCriteria:r().optional().describe(`Formula condition - workflow only runs if TRUE`),aiTasks:C(q1e).describe(`AI tasks to execute in sequence`),postActions:C(X1e).optional().describe(`Actions after AI tasks complete`),executionMode:E([`sequential`,`parallel`]).optional().default(`sequential`).describe(`How to execute multiple AI tasks`),stopOnError:S().optional().default(!1).describe(`Stop workflow if any task fails`),timeout:P().optional().describe(`Maximum execution time in seconds`),priority:E([`low`,`normal`,`high`,`critical`]).optional().default(`normal`),enableLogging:S().optional().default(!0),enableMetrics:S().optional().default(!0),notifyOnFailure:C(r()).optional().describe(`User IDs to notify on failure`),active:S().optional().default(!0),version:r().optional().default(`1.0.0`),tags:C(r()).optional(),category:r().optional().describe(`Workflow category (e.g., "support", "sales", "hr")`),owner:r().optional().describe(`User ID of workflow owner`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`)}),h({workflowName:r().describe(`Orchestration to execute`),recordIds:C(r()).describe(`Records to process`),batchSize:P().int().min(1).max(1e3).optional().default(10),parallelism:P().int().min(1).max(10).optional().default(3),priority:E([`low`,`normal`,`high`]).optional().default(`normal`)}),h({workflowName:r(),recordId:r(),status:E([`success`,`partial_success`,`failed`,`skipped`]),executionTime:P().describe(`Execution time in milliseconds`),tasksExecuted:P().int().describe(`Number of tasks executed`),tasksSucceeded:P().int().describe(`Number of tasks succeeded`),tasksFailed:P().int().describe(`Number of tasks failed`),taskResults:C(h({taskId:r().optional(),taskName:r(),status:E([`success`,`failed`,`skipped`]),output:u().optional(),error:r().optional(),executionTime:P().optional().describe(`Task execution time in milliseconds`),modelUsed:r().optional(),tokensUsed:P().optional()})).optional(),tokens:y9.optional().describe(`Total token usage for this execution`),cost:P().nonnegative().optional().describe(`Total cost for this execution in USD`),error:r().optional(),startedAt:r().datetime().describe(`ISO timestamp`),completedAt:r().datetime().optional().describe(`ISO timestamp`)});var Z1e=E([`message_passing`,`shared_memory`,`blackboard`]),Q1e=E([`coordinator`,`specialist`,`critic`,`executor`]),$1e=h({agentId:r().describe(`Agent identifier (reference to AgentSchema.name)`),role:Q1e.describe(`Agent role within the group`),capabilities:C(r()).optional().describe(`List of capabilities this agent contributes`),dependencies:C(r()).optional().describe(`Agent IDs this agent depends on for input`),priority:P().int().min(0).optional().describe(`Execution priority (0 = highest)`)});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Group unique identifier (snake_case)`),label:r().describe(`Group display name`),description:r().optional(),strategy:E([`sequential`,`parallel`,`debate`,`hierarchical`,`swarm`]).describe(`Multi-agent orchestration strategy`),agents:C($1e).min(2).describe(`Agent members (minimum 2)`),communication:h({protocol:Z1e.describe(`Inter-agent communication protocol`),messageQueue:r().optional().describe(`Message queue identifier for async communication`),maxRounds:P().int().min(1).optional().describe(`Maximum communication rounds before forced termination`)}).describe(`Communication configuration`),conflictResolution:E([`voting`,`priorityBased`,`consensusBased`,`coordinatorDecides`]).optional().describe(`How conflicts between agents are resolved`),timeout:P().int().min(1).optional().describe(`Maximum execution time in seconds for the group`),active:S().default(!0).describe(`Whether this agent group is active`)});var e0e=E([`classification`,`regression`,`clustering`,`forecasting`,`anomaly_detection`,`recommendation`,`ranking`]),t0e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Feature name (snake_case)`),label:r().optional().describe(`Human-readable label`),field:r().describe(`Source field name`),object:r().optional().describe(`Source object (if different from target)`),dataType:E([`numeric`,`categorical`,`text`,`datetime`,`boolean`]).describe(`Feature data type`),transformation:E([`none`,`normalize`,`standardize`,`one_hot_encode`,`label_encode`,`log_transform`,`binning`,`embedding`]).optional().default(`none`),required:S().optional().default(!0),defaultValue:u().optional(),description:r().optional(),importance:P().optional().describe(`Feature importance score (0-1)`)}),n0e=h({learningRate:P().optional().describe(`Learning rate for training`),epochs:P().int().optional().describe(`Number of training epochs`),batchSize:P().int().optional().describe(`Training batch size`),maxDepth:P().int().optional().describe(`Maximum tree depth`),numTrees:P().int().optional().describe(`Number of trees in ensemble`),minSamplesSplit:P().int().optional().describe(`Minimum samples to split node`),minSamplesLeaf:P().int().optional().describe(`Minimum samples in leaf node`),hiddenLayers:C(P().int()).optional().describe(`Hidden layer sizes`),activation:r().optional().describe(`Activation function`),dropout:P().optional().describe(`Dropout rate`),l1Regularization:P().optional().describe(`L1 regularization strength`),l2Regularization:P().optional().describe(`L2 regularization strength`),numClusters:P().int().optional().describe(`Number of clusters (k-means, etc.)`),seasonalPeriod:P().int().optional().describe(`Seasonal period for time series`),forecastHorizon:P().int().optional().describe(`Number of periods to forecast`),custom:d(r(),u()).optional().describe(`Algorithm-specific parameters`)}),r0e=h({trainingDataRatio:P().min(0).max(1).optional().default(.8).describe(`Proportion of data for training`),validationDataRatio:P().min(0).max(1).optional().default(.1).describe(`Proportion for validation`),testDataRatio:P().min(0).max(1).optional().default(.1).describe(`Proportion for testing`),dataFilter:r().optional().describe(`Formula to filter training data`),minRecords:P().int().optional().default(100).describe(`Minimum records required`),maxRecords:P().int().optional().describe(`Maximum records to use`),strategy:E([`full`,`incremental`,`online`,`transfer_learning`]).optional().default(`full`),crossValidation:S().optional().default(!0),folds:P().int().min(2).max(10).optional().default(5).describe(`Cross-validation folds`),earlyStoppingEnabled:S().optional().default(!0),earlyStoppingPatience:P().int().optional().default(10).describe(`Epochs without improvement before stopping`),maxTrainingTime:P().optional().describe(`Maximum training time in seconds`),gpuEnabled:S().optional().default(!1),randomSeed:P().int().optional().describe(`Random seed for reproducibility`)}).superRefine((e,t)=>{if(e.trainingDataRatio&&e.validationDataRatio&&e.testDataRatio){let n=e.trainingDataRatio+e.validationDataRatio+e.testDataRatio;Math.abs(n-1)>.01&&t.addIssue({code:de.custom,message:`Data split ratios must sum to 1. Current sum: ${n}`,path:[`trainingDataRatio`]})}}),i0e=h({accuracy:P().optional(),precision:P().optional(),recall:P().optional(),f1Score:P().optional(),auc:P().optional().describe(`Area Under ROC Curve`),mse:P().optional().describe(`Mean Squared Error`),rmse:P().optional().describe(`Root Mean Squared Error`),mae:P().optional().describe(`Mean Absolute Error`),r2Score:P().optional().describe(`R-squared score`),silhouetteScore:P().optional(),daviesBouldinIndex:P().optional(),mape:P().optional().describe(`Mean Absolute Percentage Error`),smape:P().optional().describe(`Symmetric MAPE`),custom:d(r(),P()).optional()});h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Model unique identifier (snake_case)`),label:r().describe(`Model display name`),description:r().optional(),type:e0e,algorithm:r().optional().describe(`Specific algorithm (e.g., "random_forest", "xgboost", "lstm")`),objectName:r().describe(`Target object for predictions`),target:r().describe(`Target field to predict`),targetType:E([`numeric`,`categorical`,`binary`]).optional().describe(`Target field type`),features:C(t0e).describe(`Input features for the model`),hyperparameters:n0e.optional(),training:r0e.optional(),metrics:i0e.optional().describe(`Evaluation metrics from last training`),deploymentStatus:E([`draft`,`training`,`trained`,`deployed`,`deprecated`]).optional().default(`draft`),version:r().optional().default(`1.0.0`),predictionField:r().optional().describe(`Field to store predictions`),confidenceField:r().optional().describe(`Field to store confidence scores`),updateTrigger:E([`on_create`,`on_update`,`manual`,`scheduled`]).optional().default(`on_create`),autoRetrain:S().optional().default(!1),retrainSchedule:r().optional().describe(`Cron expression for auto-retraining`),retrainThreshold:P().optional().describe(`Performance threshold to trigger retraining`),enableExplainability:S().optional().default(!1).describe(`Generate feature importance & explanations`),enableMonitoring:S().optional().default(!0),alertOnDrift:S().optional().default(!0).describe(`Alert when model drift is detected`),active:S().optional().default(!0),owner:r().optional().describe(`User ID of model owner`),permissions:C(r()).optional().describe(`User/group IDs with access`),tags:C(r()).optional(),category:r().optional().describe(`Model category (e.g., "sales", "marketing", "operations")`),lastTrainedAt:r().datetime().optional().describe(`ISO timestamp`),createdAt:r().datetime().optional().describe(`ISO timestamp`),updatedAt:r().datetime().optional().describe(`ISO timestamp`)}),h({modelName:r().describe(`Model to use for prediction`),recordIds:C(r()).optional().describe(`Specific records to predict (if not provided, uses all)`),inputData:d(r(),u()).optional().describe(`Direct input data (alternative to recordIds)`),returnConfidence:S().optional().default(!0),returnExplanation:S().optional().default(!1)}),h({modelName:r(),modelVersion:r(),recordId:r().optional(),prediction:u().describe(`The predicted value`),confidence:P().optional().describe(`Confidence score (0-1)`),probabilities:d(r(),P()).optional().describe(`Class probabilities (for classification)`),explanation:h({topFeatures:C(h({feature:r(),importance:P(),value:u()})).optional(),reasoning:r().optional()}).optional(),tokens:y9.optional().describe(`Token usage for this prediction (if AI-powered)`),cost:P().nonnegative().optional().describe(`Cost for this prediction in USD`),metadata:h({executionTime:P().optional().describe(`Execution time in milliseconds`),timestamp:r().datetime().optional().describe(`ISO timestamp`)}).optional()}),h({modelName:r(),driftType:E([`feature_drift`,`prediction_drift`,`performance_drift`]),severity:E([`low`,`medium`,`high`,`critical`]),detectedAt:r().datetime().describe(`ISO timestamp`),metrics:h({driftScore:P().describe(`Drift magnitude (0-1)`),affectedFeatures:C(r()).optional(),performanceChange:P().optional().describe(`Change in performance metric`)}),recommendation:r().optional(),autoRetrainTriggered:S().optional().default(!1)});var a0e=E([`system`,`user`,`assistant`,`function`,`tool`]);E([`text`,`image`,`file`,`code`,`structured`]);var o0e=l([h({type:m(`text`),text:r().describe(`Text content`),metadata:d(r(),u()).optional()}),h({type:m(`image`),imageUrl:r().url().describe(`Image URL`),detail:E([`low`,`high`,`auto`]).optional().default(`auto`),metadata:d(r(),u()).optional()}),h({type:m(`file`),fileUrl:r().url().describe(`File attachment URL`),mimeType:r().describe(`MIME type`),fileName:r().optional(),metadata:d(r(),u()).optional()}),h({type:m(`code`),text:r().describe(`Code snippet`),language:r().optional().default(`text`),metadata:d(r(),u()).optional()})]),s0e=h({name:r().describe(`Function name`),arguments:r().describe(`JSON string of function arguments`),result:r().optional().describe(`Function execution result`)}),c0e=h({id:r().describe(`Tool call ID`),type:E([`function`]).default(`function`),function:s0e}),l0e=h({id:r().describe(`Unique message ID`),timestamp:r().datetime().describe(`ISO 8601 timestamp`),role:a0e,content:C(o0e).describe(`Message content (multimodal array)`),functionCall:s0e.optional().describe(`Legacy function call`),toolCalls:C(c0e).optional().describe(`Tool calls`),toolCallId:r().optional().describe(`Tool call ID this message responds to`),name:r().optional().describe(`Name of the function/user`),tokens:y9.optional().describe(`Token usage for this message`),cost:P().nonnegative().optional().describe(`Cost for this message in USD`),pinned:S().optional().default(!1).describe(`Prevent removal during pruning`),importance:P().min(0).max(1).optional().describe(`Importance score for pruning`),embedding:C(P()).optional().describe(`Vector embedding for semantic search`),metadata:d(r(),u()).optional()}),u0e=E([`fifo`,`importance`,`semantic`,`sliding_window`,`summary`]),d0e=h({maxTokens:P().int().positive().describe(`Maximum total tokens`),maxPromptTokens:P().int().positive().optional().describe(`Max tokens for prompt`),maxCompletionTokens:P().int().positive().optional().describe(`Max tokens for completion`),reserveTokens:P().int().nonnegative().default(500).describe(`Reserve tokens for system messages`),bufferPercentage:P().min(0).max(1).default(.1).describe(`Buffer percentage (0.1 = 10%)`),strategy:u0e.default(`sliding_window`),slidingWindowSize:P().int().positive().optional().describe(`Number of recent messages to keep`),minImportanceScore:P().min(0).max(1).optional().describe(`Minimum importance to keep`),semanticThreshold:P().min(0).max(1).optional().describe(`Semantic similarity threshold`),enableSummarization:S().default(!1).describe(`Enable context summarization`),summarizationThreshold:P().int().positive().optional().describe(`Trigger summarization at N tokens`),summaryModel:r().optional().describe(`Model ID for summarization`),warnThreshold:P().min(0).max(1).default(.8).describe(`Warn at % of budget (0.8 = 80%)`)}),f0e=h({promptTokens:P().int().nonnegative().default(0),completionTokens:P().int().nonnegative().default(0),totalTokens:P().int().nonnegative().default(0),budgetLimit:P().int().positive(),budgetUsed:P().int().nonnegative().default(0),budgetRemaining:P().int().nonnegative(),budgetPercentage:P().min(0).max(1).describe(`Usage as percentage of budget`),messageCount:P().int().nonnegative().default(0),prunedMessageCount:P().int().nonnegative().default(0),summarizedMessageCount:P().int().nonnegative().default(0)}),p0e=h({sessionId:r().describe(`Conversation session ID`),userId:r().optional().describe(`User identifier`),agentId:r().optional().describe(`AI agent identifier`),object:r().optional().describe(`Related object (e.g., "case", "project")`),recordId:r().optional().describe(`Related record ID`),scope:d(r(),u()).optional().describe(`Additional context scope`),systemMessage:r().optional().describe(`System prompt/instructions`),metadata:d(r(),u()).optional()});h({id:r().describe(`Unique session ID`),name:r().optional().describe(`Session name/title`),context:p0e,modelId:r().optional().describe(`AI model ID`),tokenBudget:d0e,messages:C(l0e).default([]),tokens:f0e.optional(),totalTokens:y9.optional().describe(`Total tokens across all messages`),totalCost:P().nonnegative().optional().describe(`Total cost for this session in USD`),status:E([`active`,`paused`,`completed`,`archived`]).default(`active`),createdAt:r().datetime().describe(`ISO 8601 timestamp`),updatedAt:r().datetime().describe(`ISO 8601 timestamp`),expiresAt:r().datetime().optional().describe(`ISO 8601 timestamp`),metadata:d(r(),u()).optional()}),h({summary:r().describe(`Conversation summary`),keyPoints:C(r()).optional().describe(`Key discussion points`),originalTokens:P().int().nonnegative().describe(`Original token count`),summaryTokens:P().int().nonnegative().describe(`Summary token count`),tokensSaved:P().int().nonnegative().describe(`Tokens saved`),messageRange:h({startIndex:P().int().nonnegative(),endIndex:P().int().nonnegative()}).describe(`Range of messages summarized`),generatedAt:r().datetime().describe(`ISO 8601 timestamp`),modelId:r().optional().describe(`Model used for summarization`)}),h({timestamp:r().datetime().describe(`Event timestamp`),prunedMessages:C(h({messageId:r(),role:a0e,tokens:P().int().nonnegative(),importance:P().min(0).max(1).optional()})),tokensFreed:P().int().nonnegative(),messagesRemoved:P().int().nonnegative(),remainingTokens:P().int().nonnegative(),remainingMessages:P().int().nonnegative()}),h({sessionId:r(),totalMessages:P().int().nonnegative(),userMessages:P().int().nonnegative(),assistantMessages:P().int().nonnegative(),systemMessages:P().int().nonnegative(),totalTokens:P().int().nonnegative(),averageTokensPerMessage:P().nonnegative(),peakTokenUsage:P().int().nonnegative(),pruningEvents:P().int().nonnegative().default(0),summarizationEvents:P().int().nonnegative().default(0),tokensSavedByPruning:P().int().nonnegative().default(0),tokensSavedBySummarization:P().int().nonnegative().default(0),duration:P().nonnegative().optional().describe(`Session duration in seconds`),firstMessageAt:r().datetime().optional().describe(`ISO 8601 timestamp`),lastMessageAt:r().datetime().optional().describe(`ISO 8601 timestamp`)});var m0e=E([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`),h0e=E([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`),g0e=h({enabled:S().default(!1).describe(`Enable automatic key rotation`),frequencyDays:P().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:P().default(3).describe(`Number of old key versions to retain`),autoRotate:S().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`),_0e=h({enabled:S().default(!1).describe(`Enable field-level encryption`),algorithm:m0e.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:h({provider:h0e.describe(`Key management service provider`),keyId:r().optional().describe(`Key identifier in the provider`),rotationPolicy:g0e.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:E([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:S().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:S().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`);h({fieldName:r().describe(`Name of the field to encrypt`),encryptionConfig:_0e.describe(`Encryption settings for this field`),indexable:S().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`);var v0e=E([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`),y0e=h({field:r().describe(`Field name to apply masking to`),strategy:v0e.describe(`Masking strategy to use`),pattern:r().optional().describe(`Regex pattern for partial masking`),preserveFormat:S().default(!0).describe(`Keep the original data format after masking`),preserveLength:S().default(!0).describe(`Keep the original data length after masking`),roles:C(r()).optional().describe(`Roles that see masked data`),exemptRoles:C(r()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`);h({enabled:S().default(!1).describe(`Enable data masking`),rules:C(y0e).describe(`List of field-level masking rules`),auditUnmasking:S().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`);var b0e=E(`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(`.`)),x0e=h({label:r().describe(`Display label (human-readable, any case allowed)`),value:i$e.describe(`Stored value (lowercase machine identifier)`),color:r().optional().describe(`Color code for badges/charts`),default:S().optional().describe(`Is default option`)});h({latitude:P().min(-90).max(90).describe(`Latitude coordinate`),longitude:P().min(-180).max(180).describe(`Longitude coordinate`),altitude:P().optional().describe(`Altitude in meters`),accuracy:P().optional().describe(`Accuracy in meters`)});var S0e=h({precision:P().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:E([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:r().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)});h({value:P().describe(`Monetary amount`),currency:r().length(3).describe(`Currency code (ISO 4217)`)}),h({street:r().optional().describe(`Street address`),city:r().optional().describe(`City name`),state:r().optional().describe(`State/Province`),postalCode:r().optional().describe(`Postal/ZIP code`),country:r().optional().describe(`Country name or code`),countryCode:r().optional().describe(`ISO country code (e.g., US, GB)`),formatted:r().optional().describe(`Formatted address string`)});var C0e=h({dimensions:P().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:E([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:S().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:S().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:E([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)}),w0e=h({minSize:P().min(0).optional().describe(`Minimum file size in bytes`),maxSize:P().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:C(r()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:C(r()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:C(r()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:C(r()).optional().describe(`Blocked MIME types`),virusScan:S().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:E([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:S().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:S().default(!0).describe(`Quarantine files if threat detected`),storageProvider:r().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:r().optional().describe(`Target bucket name`),storagePrefix:r().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:h({minWidth:P().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:P().min(1).optional().describe(`Maximum image width in pixels`),minHeight:P().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:P().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:r().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:S().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:C(h({name:r().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:P().min(1).describe(`Thumbnail width in pixels`),height:P().min(1).describe(`Thumbnail height in pixels`),crop:S().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:S().default(!1).describe(`Preserve EXIF metadata`),autoRotate:S().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:S().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:S().default(!0).describe(`Allow replacing existing files`),allowDelete:S().default(!0).describe(`Allow deleting uploaded files`),requireUpload:S().default(!1).describe(`Require at least one file when field is required`),extractMetadata:S().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:S().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:S().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:P().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:S().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:P().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`}),T0e=h({uniqueness:S().default(!1).describe(`Enforce unique values across all records`),completeness:P().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:h({source:r().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:P().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)}),E0e=h({enabled:S().describe(`Enable caching for computed field results`),ttl:P().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:C(r()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)}),C9=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:r().optional().describe(`Human readable label`),type:b0e.describe(`Field Data Type`),description:r().optional().describe(`Tooltip/Help text`),format:r().optional().describe(`Format string (e.g. email, phone)`),columnName:r().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:S().default(!1).describe(`Is required`),searchable:S().default(!1).describe(`Is searchable`),multiple:S().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:S().default(!1).describe(`Is unique constraint`),defaultValue:u().optional().describe(`Default value`),maxLength:P().optional().describe(`Max character length`),minLength:P().optional().describe(`Min character length`),precision:P().optional().describe(`Total digits`),scale:P().optional().describe(`Decimal places`),min:P().optional().describe(`Minimum value`),max:P().optional().describe(`Maximum value`),options:C(x0e).optional().describe(`Static options for select/multiselect`),reference:r().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:C(r()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:S().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:E([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:r().optional().describe(`Formula expression`),summaryOperations:h({object:r().describe(`Source child object name for roll-up`),field:r().describe(`Field on child object to aggregate`),function:E([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:r().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:r().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:S().optional().describe(`Show line numbers in code editor`),maxRating:P().optional().describe(`Maximum rating value (default: 5)`),allowHalf:S().optional().describe(`Allow half-star ratings`),displayMap:S().optional().describe(`Display map widget for location field`),allowGeocoding:S().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:E([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:E([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:S().optional().describe(`Allow transparency/alpha channel`),presetColors:C(r()).optional().describe(`Preset color options`),step:P().optional().describe(`Step increment for slider (default: 1)`),showValue:S().optional().describe(`Display current value on slider`),marks:d(r(),r()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:E([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:E([`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:S().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:S().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:S0e.optional().describe(`Configuration for currency field type`),vectorConfig:C0e.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:w0e.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:_0e.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:y0e.optional().describe(`Data masking rules for PII protection`),auditTrail:S().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:C(r()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:E0e.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:T0e.optional().describe(`Data quality validation and monitoring rules`),group:r().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:r().optional().describe(`Formula expression that makes this field required when TRUE (e.g., "status = 'closed_won'")`),hidden:S().default(!1).describe(`Hidden from default UI`),readonly:S().default(!1).describe(`Read-only in UI`),sortable:S().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:r().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:S().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:S().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:r().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:S().default(!1).describe(`Create standard database index`),externalId:S().default(!1).describe(`Is external ID for upsert operations`)}),w9=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:r().optional().describe(`Human-readable label for the rule listing`),description:r().optional().describe(`Administrative notes explaining the business reason`),active:S().default(!0),events:C(E([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:P().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:C(r()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:E([`error`,`warning`,`info`]).default(`error`),message:r().describe(`Error message to display to the user`)}),D0e=w9.extend({type:m(`script`),condition:r().describe(`Formula expression. If TRUE, validation fails. (e.g. amount < 0)`)}),O0e=w9.extend({type:m(`unique`),fields:C(r()).describe(`Fields that must be combined unique`),scope:r().optional().describe(`Formula condition for scope (e.g. active = true)`),caseSensitive:S().default(!0)}),k0e=w9.extend({type:m(`state_machine`),field:r().describe(`State field (e.g. status)`),transitions:d(r(),C(r())).describe(`Map of { OldState: [AllowedNewStates] }`)}),A0e=w9.extend({type:m(`format`),field:r(),regex:r().optional(),format:E([`email`,`url`,`phone`,`json`]).optional()}),j0e=w9.extend({type:m(`cross_field`),condition:r().describe(`Formula expression comparing fields (e.g. "end_date > start_date")`),fields:C(r()).describe(`Fields involved in the validation`)}),M0e=w9.extend({type:m(`json_schema`),field:r().describe(`JSON field to validate`),schema:d(r(),u()).describe(`JSON Schema object definition`)}),N0e=w9.extend({type:m(`async`),field:r().describe(`Field to validate`),validatorUrl:r().optional().describe(`External API endpoint for validation`),method:E([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:d(r(),r()).optional().describe(`Custom headers for the request`),validatorFunction:r().optional().describe(`Reference to custom validator function`),timeout:P().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:P().optional().describe(`Debounce delay in milliseconds`),params:d(r(),u()).optional().describe(`Additional parameters to pass to validator`)}),P0e=w9.extend({type:m(`custom`),handler:r().describe(`Name of the custom validation function registered in the system`),params:d(r(),u()).optional().describe(`Parameters passed to the custom handler`)}),T9=F(()=>I(`type`,[D0e,O0e,k0e,A0e,j0e,M0e,N0e,P0e,F0e])),F0e=w9.extend({type:m(`conditional`),when:r().describe(`Condition formula (e.g. "type = 'enterprise'")`),then:T9.describe(`Validation rule to apply when condition is true`),otherwise:T9.optional().describe(`Validation rule to apply when condition is false`)});h({key:r().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:r().optional().describe(`Fallback value when translation key is not found`),params:d(r(),l([r(),P(),S()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)});var E9=r().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`),I0e=h({ariaLabel:E9.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:r().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:r().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`);h({key:r().describe(`Translation key`),zero:r().optional().describe(`Zero form (e.g., "No items")`),one:r().optional().describe(`Singular form (e.g., "{count} item")`),two:r().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:r().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:r().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:r().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`);var L0e=h({style:E([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:r().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:r().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:P().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:P().optional().describe(`Maximum number of fraction digits`),useGrouping:S().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`),R0e=h({dateStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:E([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:r().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:S().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`);h({code:r().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:C(r()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:E([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:L0e.optional().describe(`Default number formatting rules`),dateFormat:R0e.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`);var z0e=h({name:r(),label:E9,type:b0e,required:S().default(!1),options:C(h({label:E9,value:r()})).optional()}),B0e=E([`script`,`url`,`modal`,`flow`,`api`]),V0e=new Set(B0e.options.filter(e=>e!==`script`)),H0e=h({name:a$e.describe(`Machine name (lowercase snake_case)`),label:E9.describe(`Display label`),objectName:r().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:r().optional().describe(`Icon name`),locations:C(E([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`global_nav`])).optional().describe(`Locations where this action is visible`),component:E([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:B0e.default(`script`).describe(`Action functionality type`),target:r().optional().describe(`URL, Script Name, Flow ID, or API Endpoint`),execute:r().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:C(z0e).optional().describe(`Input parameters required from user`),variant:E([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:E9.optional().describe(`Confirmation message before execution`),successMessage:E9.optional().describe(`Success message to show after execution`),refreshAfter:S().default(!1).describe(`Refresh view after execution`),visible:r().optional().describe(`Formula returning boolean`),disabled:l([S(),r()]).optional().describe(`Whether the action is disabled, or a condition expression string`),shortcut:r().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:S().optional().describe(`Whether this action can be applied to multiple selected records`),timeout:P().optional().describe(`Maximum execution time in milliseconds for the action`),aria:I0e.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(V0e.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', or 'api'.`,path:[`target`]}),U0e=E([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),W0e=h({trackHistory:S().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:S().default(!0).describe(`Index records for global search`),apiEnabled:S().default(!0).describe(`Expose object via automatic APIs`),apiMethods:C(U0e).optional().describe(`Whitelist of allowed API operations`),files:S().default(!1).describe(`Enable file attachments and document management`),feeds:S().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:S().default(!1).describe(`Enable standard tasks and events tracking`),trash:S().default(!0).describe(`Enable soft-delete with restore capability`),mru:S().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:S().default(!0).describe(`Allow record deep cloning`)}),G0e=h({name:r().optional().describe(`Index name (auto-generated if not provided)`),fields:C(r()).describe(`Fields included in the index`),type:E([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:S().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:r().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)}),K0e=h({fields:C(r()).describe(`Fields to index for full-text search weighting`),displayFields:C(r()).optional().describe(`Fields to display in search result cards`),filters:C(r()).optional().describe(`Default filters for search results`)}),q0e=h({enabled:S().describe(`Enable multi-tenancy for this object`),strategy:E([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:r().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:S().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)}),J0e=h({enabled:S().describe(`Enable soft delete (trash/recycle bin)`),field:r().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:S().default(!1).describe(`Cascade soft delete to related records`)}),Y0e=h({enabled:S().describe(`Enable record versioning`),strategy:E([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:P().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:r().default(`version`).describe(`Field name for version number/timestamp`)}),X0e=h({enabled:S().describe(`Enable table partitioning`),strategy:E([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:r().describe(`Field name to partition by`),interval:r().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"`}),Z0e=h({enabled:S().describe(`Enable Change Data Capture`),events:C(E([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:r().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)}),Q0e=h({name:r().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:r().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:r().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:r().optional().describe(`Developer documentation / description`),icon:r().optional().describe(`Icon name (Lucide/Material) for UI representation`),namespace:r().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:C(r()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:S().optional().default(!0).describe(`Is the object active and usable`),isSystem:S().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:S().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),datasource:r().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),tableName:r().optional().describe(`Physical table/collection name in the target datasource. Auto-derived as {namespace}_{name} when namespace is set.`),fields:d(r().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),C9).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:C(G0e).optional().describe(`Database performance indexes`),tenancy:q0e.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:J0e.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:Y0e.optional().describe(`Record versioning and history tracking configuration`),partitioning:X0e.optional().describe(`Table partitioning configuration for performance`),cdc:Z0e.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:C(T9).optional().describe(`Object-level validation rules`),stateMachines:d(r(),c$e).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:r().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:h({type:E([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:r().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:P().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:r().optional().describe(`Title expression (e.g. "{name} - {code}"). Overrides displayNameField.`),compactLayout:C(r()).optional().describe(`Primary fields for hover/cards/lookups`),search:K0e.optional().describe(`Search engine configuration`),enable:W0e.optional().describe(`Enabled system features modules`),recordTypes:C(r()).optional().describe(`Record type names for this object`),sharingModel:E([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),keyPrefix:r().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),actions:C(H0e).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`)});function $0e(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var e2e=Object.assign(Q0e,{create:e=>{let t={...e,label:e.label??$0e(e.name),tableName:e.tableName??(e.namespace?`${e.namespace}_${e.name}`:void 0)};return Q0e.parse(t)}});E([`own`,`extend`]),h({extend:r().describe(`Target object name (FQN) to extend`),fields:d(r(),C9).optional().describe(`Fields to add/override`),label:r().optional().describe(`Override label for the extended object`),pluralLabel:r().optional().describe(`Override plural label for the extended object`),description:r().optional().describe(`Override description for the extended object`),validations:C(T9).optional().describe(`Additional validation rules to merge into the target object`),indexes:C(G0e).optional().describe(`Additional indexes to merge into the target object`),priority:P().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)});var t2e=I(`type`,[h({type:m(`add_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to add`),field:C9.describe(`Full field definition to add`)}).describe(`Add a new field to an existing object`),h({type:m(`modify_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to modify`),changes:d(r(),u()).describe(`Partial field definition updates`)}).describe(`Modify properties of an existing field`),h({type:m(`remove_field`),objectName:r().describe(`Target object name`),fieldName:r().describe(`Name of the field to remove`)}).describe(`Remove a field from an existing object`),h({type:m(`create_object`),object:e2e.describe(`Full object definition to create`)}).describe(`Create a new object`),h({type:m(`rename_object`),oldName:r().describe(`Current object name`),newName:r().describe(`New object name`)}).describe(`Rename an existing object`),h({type:m(`delete_object`),objectName:r().describe(`Name of the object to delete`)}).describe(`Delete an existing object`),h({type:m(`execute_sql`),sql:r().describe(`Raw SQL statement to execute`),description:r().optional().describe(`Human-readable description of the SQL`)}).describe(`Execute a raw SQL statement`)]),n2e=h({migrationId:r().describe(`ID of the migration this depends on`),package:r().optional().describe(`Package that owns the dependency migration`)}).describe(`Dependency reference to another migration that must run first`),r2e=h({id:r().uuid().describe(`Unique identifier for this change set`),name:r().describe(`Human readable name for the migration`),description:r().optional().describe(`Detailed description of what this migration does`),author:r().optional().describe(`Author who created this migration`),createdAt:r().datetime().optional().describe(`ISO 8601 timestamp when the migration was created`),dependencies:C(n2e).optional().describe(`Migrations that must run before this one`),operations:C(t2e).describe(`Ordered list of atomic migration operations`),rollback:C(t2e).optional().describe(`Operations to reverse this migration`)}).describe(`A versioned set of atomic schema migration operations`),i2e=h({file:r().optional(),line:P().optional(),column:P().optional(),package:r().optional(),object:r().optional(),field:r().optional(),component:r().optional()}),a2e=h({id:r(),severity:E([`critical`,`error`,`warning`,`info`]),message:r(),stackTrace:r().optional(),timestamp:r().datetime(),userId:r().optional(),context:d(r(),u()).optional(),source:i2e.optional()}),o2e=h({issueId:r(),reasoning:r().describe(`Explanation of why this fix is needed`),confidence:P().min(0).max(1),fix:I(`type`,[h({type:m(`metadata_change`),changeSet:r2e}),h({type:m(`manual_intervention`),instructions:r()})])});h({issue:a2e,analysis:r().optional().describe(`AI analysis of the root cause`),resolutions:C(o2e).optional(),status:E([`open`,`analyzing`,`resolved`,`ignored`]).default(`open`)});var s2e=Object.defineProperty,c2e=Object.getOwnPropertyNames,D9=(e,t)=>function(){return e&&(t=(0,e[c2e(e)[0]])(e=0)),t},l2e=(e,t)=>{for(var n in t)s2e(e,n,{get:t[n],enumerable:!0})},u2e={};l2e(u2e,{AGGREGATE_DATA_TOOL:()=>M9,DATA_TOOL_DEFINITIONS:()=>h2e,GET_RECORD_TOOL:()=>j9,QUERY_RECORDS_TOOL:()=>A9,registerDataTools:()=>m2e});function d2e(e){return async t=>{let{objectName:n,where:r,fields:i,orderBy:a,limit:o,offset:s}=t,c=o??k9,l=Number.isFinite(c)&&c>0?Math.min(Math.floor(c),O9):k9,u=Number.isFinite(s)&&s>=0?Math.floor(s):void 0,d=await e.dataEngine.find(n,{where:r,fields:i,orderBy:a,limit:l,offset:u});return JSON.stringify({count:d.length,records:d})}}function f2e(e){return async t=>{let{objectName:n,recordId:r,fields:i}=t,a=await e.dataEngine.findOne(n,{where:{id:r},fields:i});return JSON.stringify(a||{error:`Record "${r}" not found in "${n}"`})}}function p2e(e){return async t=>{let{objectName:n,aggregations:r,groupBy:i,where:a}=t;for(let e of r)if(!N9.has(e.function))return JSON.stringify({error:`Invalid aggregation function "${e.function}". Allowed: ${[...N9].join(`, `)}`});let o=await e.dataEngine.aggregate(n,{where:a,groupBy:i,aggregations:r.map(e=>({function:e.function,field:e.field,alias:e.alias}))});return JSON.stringify(o)}}function m2e(e,t){e.register(A9,d2e(t)),e.register(j9,f2e(t)),e.register(M9,p2e(t))}var O9,k9,A9,j9,M9,h2e,N9,P9=D9({"src/tools/data-tools.ts"(){O9=200,k9=20,A9={name:`query_records`,description:`Query records from a data object with optional filters, field selection, sorting, and pagination. Returns an array of matching records.`,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`The snake_case name of the object to query`},where:{type:`object`,description:`Filter conditions as key-value pairs (e.g. { "status": "active" }) or MongoDB-style operators (e.g. { "amount": { "$gt": 100 } })`},fields:{type:`array`,items:{type:`string`},description:`List of field names to return (omit for all fields)`},orderBy:{type:`array`,items:{type:`object`,properties:{field:{type:`string`},order:{type:`string`,enum:[`asc`,`desc`]}}},description:`Sort order (e.g. [{ "field": "created_at", "order": "desc" }])`},limit:{type:`number`,description:`Maximum number of records to return (default ${k9}, max ${O9})`},offset:{type:`number`,description:`Number of records to skip for pagination`}},required:[`objectName`],additionalProperties:!1}},j9={name:`get_record`,description:`Get a single record by its ID from a data object.`,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`The snake_case name of the object`},recordId:{type:`string`,description:`The unique ID of the record`},fields:{type:`array`,items:{type:`string`},description:`List of field names to return (omit for all fields)`}},required:[`objectName`,`recordId`],additionalProperties:!1}},M9={name:`aggregate_data`,description:`Perform aggregation/statistical operations on a data object. Supports count, sum, avg, min, max with optional groupBy and where filters.`,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`The snake_case name of the object to aggregate`},aggregations:{type:`array`,items:{type:`object`,properties:{function:{type:`string`,enum:[`count`,`sum`,`avg`,`min`,`max`,`count_distinct`],description:`Aggregation function`},field:{type:`string`,description:`Field to aggregate (optional for count)`},alias:{type:`string`,description:`Result column alias`}},required:[`function`,`alias`]},description:`Aggregation definitions`},groupBy:{type:`array`,items:{type:`string`},description:`Fields to group by`},where:{type:`object`,description:`Filter conditions applied before aggregation`}},required:[`objectName`,`aggregations`],additionalProperties:!1}},h2e=[A9,j9,M9],N9=new Set([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`])}}),F9,g2e=D9({"src/tools/create-object.tool.ts"(){F9=h9({name:`create_object`,label:`Create Object`,description:`Creates a new data object (table) with the specified name, label, and optional field definitions. Use this when the user wants to create a new entity, table, or data model.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{name:{type:`string`,description:`Machine name for the object (snake_case, e.g. project_task)`},label:{type:`string`,description:`Human-readable display name (e.g. Project Task)`},fields:{type:`array`,description:`Initial fields to create with the object`,items:{type:`object`,properties:{name:{type:`string`,description:`Field machine name (snake_case)`},label:{type:`string`,description:`Field display name`},type:{type:`string`,description:`Field data type`,enum:[`text`,`textarea`,`number`,`boolean`,`date`,`datetime`,`select`,`lookup`,`formula`,`autonumber`]},required:{type:`boolean`,description:`Whether the field is required`}},required:[`name`,`type`]}},enableFeatures:{type:`object`,description:`Object capability flags`,properties:{trackHistory:{type:`boolean`},apiEnabled:{type:`boolean`}}}},required:[`name`,`label`],additionalProperties:!1}})}}),I9,_2e=D9({"src/tools/add-field.tool.ts"(){I9=h9({name:`add_field`,label:`Add Field`,description:`Adds a new field (column) to an existing data object. Use this when the user wants to add a property, column, or attribute to a table.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`Target object machine name (snake_case)`},name:{type:`string`,description:`Field machine name (snake_case, e.g. due_date)`},label:{type:`string`,description:`Human-readable field label (e.g. Due Date)`},type:{type:`string`,description:`Field data type`,enum:[`text`,`textarea`,`number`,`boolean`,`date`,`datetime`,`select`,`lookup`,`formula`,`autonumber`]},required:{type:`boolean`,description:`Whether the field is required`},defaultValue:{description:`Default value for the field`},options:{type:`array`,description:`Options for select/picklist fields`,items:{type:`object`,properties:{label:{type:`string`},value:{type:`string`,description:`Option machine identifier (lowercase snake_case, e.g. high_priority)`,pattern:`^[a-z_][a-z0-9_]*$`}}}},reference:{type:`string`,description:`Referenced object name for lookup fields (snake_case, e.g. account)`}},required:[`objectName`,`name`,`type`],additionalProperties:!1}})}}),L9,v2e=D9({"src/tools/modify-field.tool.ts"(){L9=h9({name:`modify_field`,label:`Modify Field`,description:`Modifies an existing field definition (label, type, required, default value, etc.) on a data object. Use this when the user wants to change or reconfigure an existing column or attribute (not rename it).`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`Target object machine name (snake_case)`},fieldName:{type:`string`,description:`Existing field machine name to modify (snake_case)`},changes:{type:`object`,description:`Field properties to update (partial patch)`,properties:{label:{type:`string`,description:`New display label`},type:{type:`string`,description:`New field type`},required:{type:`boolean`,description:`Update required constraint`},defaultValue:{description:`New default value`}}}},required:[`objectName`,`fieldName`,`changes`],additionalProperties:!1}})}}),R9,y2e=D9({"src/tools/delete-field.tool.ts"(){R9=h9({name:`delete_field`,label:`Delete Field`,description:`Removes a field (column) from an existing data object. This is a destructive operation. Use this when the user explicitly wants to remove an attribute or column from a table.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`Target object machine name (snake_case)`},fieldName:{type:`string`,description:`Field machine name to delete (snake_case)`}},required:[`objectName`,`fieldName`],additionalProperties:!1}})}}),z9,b2e=D9({"src/tools/list-objects.tool.ts"(){z9=h9({name:`list_objects`,label:`List Objects`,description:`Lists all registered data objects (tables) in the current environment. Use this when the user wants to see what tables, entities, or data models are available.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{filter:{type:`string`,description:`Optional name or label substring to filter objects`},includeFields:{type:`boolean`,description:`Whether to include field summaries for each object (default: false)`}},additionalProperties:!1}})}}),B9,x2e=D9({"src/tools/describe-object.tool.ts"(){B9=h9({name:`describe_object`,label:`Describe Object`,description:`Returns the full schema details of a data object, including all fields, types, relationships, and configuration. Use this to understand the structure of a table before querying or modifying it.`,category:`data`,builtIn:!0,parameters:{type:`object`,properties:{objectName:{type:`string`,description:`Object machine name to describe (snake_case)`}},required:[`objectName`],additionalProperties:!1}})}}),S2e={};l2e(S2e,{METADATA_TOOL_DEFINITIONS:()=>A2e,addFieldTool:()=>I9,createObjectTool:()=>F9,deleteFieldTool:()=>R9,describeObjectTool:()=>B9,listObjectsTool:()=>z9,modifyFieldTool:()=>L9,registerMetadataTools:()=>k2e});function V9(e){return j2e.test(e)}function C2e(e){return async t=>{let{name:n,label:r,fields:i,enableFeatures:a}=t;if(!n||!r)return JSON.stringify({error:`Both "name" and "label" are required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});if(await e.metadataService.getObject(n))return JSON.stringify({error:`Object "${n}" already exists`});let o={};if(i&&Array.isArray(i)){let e=new Set;for(let t of i){if(!t.name)return JSON.stringify({error:`Each field must have a "name" property`});if(!V9(t.name))return JSON.stringify({error:`Invalid field name "${t.name}". Must be snake_case.`});if(e.has(t.name))return JSON.stringify({error:`Duplicate field name "${t.name}" in initial fields`});e.add(t.name),o[t.name]={type:t.type,...t.label?{label:t.label}:{},...t.required===void 0?{}:{required:t.required}}}}let s={name:n,label:r,...Object.keys(o).length>0?{fields:o}:{},...a?{enable:a}:{}};return await e.metadataService.register(`object`,n,s),JSON.stringify({name:n,label:r,fieldCount:Object.keys(o).length})}}function w2e(e){return async t=>{let{objectName:n,name:r,label:i,type:a,required:o,defaultValue:s,options:c,reference:l}=t;if(!n||!r||!a)return JSON.stringify({error:`"objectName", "name", and "type" are required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});if(!V9(r))return JSON.stringify({error:`Invalid field name "${r}". Must be snake_case.`});if(l&&!V9(l))return JSON.stringify({error:`Invalid reference "${l}". Must be a snake_case object name.`});if(c&&Array.isArray(c)){for(let e of c)if(e.value&&!V9(e.value))return JSON.stringify({error:`Invalid option value "${e.value}". Must be lowercase snake_case.`})}let u=await e.metadataService.getObject(n);if(!u)return JSON.stringify({error:`Object "${n}" not found`});let d=u;if(d.fields&&d.fields[r])return JSON.stringify({error:`Field "${r}" already exists on object "${n}"`});let f={type:a,...i?{label:i}:{},...o===void 0?{}:{required:o},...s===void 0?{}:{defaultValue:s},...c?{options:c}:{},...l?{reference:l}:{}},p={...d.fields??{},[r]:f};return await e.metadataService.register(`object`,n,{...d,fields:p}),JSON.stringify({objectName:n,fieldName:r,fieldType:a})}}function T2e(e){return async t=>{let{objectName:n,fieldName:r,changes:i}=t;if(!n||!r||!i)return JSON.stringify({error:`"objectName", "fieldName", and "changes" are required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});if(!V9(r))return JSON.stringify({error:`Invalid field name "${r}". Must be snake_case.`});let a=await e.metadataService.getObject(n);if(!a)return JSON.stringify({error:`Object "${n}" not found`});let o=a;if(!o.fields||!o.fields[r])return JSON.stringify({error:`Field "${r}" not found on object "${n}"`});let s={...o.fields[r],...i},c={...o.fields,[r]:s};return await e.metadataService.register(`object`,n,{...o,fields:c}),JSON.stringify({objectName:n,fieldName:r,updatedProperties:Object.keys(i)})}}function E2e(e){return async t=>{let{objectName:n,fieldName:r}=t;if(!n||!r)return JSON.stringify({error:`"objectName" and "fieldName" are required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});if(!V9(r))return JSON.stringify({error:`Invalid field name "${r}". Must be snake_case.`});let i=await e.metadataService.getObject(n);if(!i)return JSON.stringify({error:`Object "${n}" not found`});let a=i;if(!a.fields||!a.fields[r])return JSON.stringify({error:`Field "${r}" not found on object "${n}"`});let{[r]:o,...s}=a.fields;return await e.metadataService.register(`object`,n,{...a,fields:s}),JSON.stringify({objectName:n,fieldName:r,success:!0})}}function D2e(e){return async t=>{let{filter:n,includeFields:r}=t??{},i=(await e.metadataService.listObjects()).map(e=>{let t={name:e.name,label:e.label??e.name,fieldCount:e.fields?Object.keys(e.fields).length:0};return r&&e.fields&&(t.fields=Object.entries(e.fields).map(([e,t])=>({name:e,type:t.type,label:t.label??e}))),t});if(n){let e=n.toLowerCase();i=i.filter(t=>t.name.toLowerCase().includes(e)||t.label.toLowerCase().includes(e))}return JSON.stringify({objects:i,totalCount:i.length})}}function O2e(e){return async t=>{let{objectName:n}=t;if(!n)return JSON.stringify({error:`"objectName" is required`});if(!V9(n))return JSON.stringify({error:`Invalid object name "${n}". Must be snake_case.`});let r=await e.metadataService.getObject(n);if(!r)return JSON.stringify({error:`Object "${n}" not found`});let i=r,a=i.fields??{},o=Object.entries(a).map(([e,t])=>({name:e,type:t.type,label:t.label??e,required:t.required??!1,...t.reference?{reference:t.reference}:{},...t.options?{options:t.options}:{}}));return JSON.stringify({name:i.name,label:i.label??i.name,fields:o,enableFeatures:i.enable??{}})}}function k2e(e,t){e.register(F9,C2e(t)),e.register(I9,w2e(t)),e.register(L9,T2e(t)),e.register(R9,E2e(t)),e.register(z9,D2e(t)),e.register(B9,O2e(t))}var A2e,j2e,H9=D9({"src/tools/metadata-tools.ts"(){g2e(),_2e(),v2e(),y2e(),b2e(),x2e(),g2e(),_2e(),v2e(),y2e(),b2e(),x2e(),A2e=[F9,I9,L9,R9,z9,B9],j2e=/^[a-z_][a-z0-9_]*$/}}),M2e=class{constructor(){this.name=`memory`}async chat(e,t){let n=[...e].reverse().find(e=>e.role===`user`),r=n?.content;return{content:n?`[memory] ${typeof r==`string`?r:`(complex content)`}`:`[memory] (no user message)`,model:t?.model??`memory`,usage:{promptTokens:0,completionTokens:0,totalTokens:0}}}async complete(e,t){return{content:`[memory] ${e}`,model:t?.model??`memory`,usage:{promptTokens:0,completionTokens:0,totalTokens:0}}}async*streamChat(e,t){let n=(await this.chat(e)).content.split(` `);for(let e=0;e[0,0,0])}async listModels(){return[`memory`]}},N2e=class{constructor(){this.definitions=new Map,this.handlers=new Map}register(e,t){this.definitions.set(e.name,e),this.handlers.set(e.name,t)}unregister(e){this.definitions.delete(e),this.handlers.delete(e)}has(e){return this.definitions.has(e)}getDefinition(e){return this.definitions.get(e)}getAll(){return Array.from(this.definitions.values())}get size(){return this.definitions.size}names(){return Array.from(this.definitions.keys())}async execute(e){let t=this.handlers.get(e.toolName);if(!t)return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:{type:`text`,value:`Tool "${e.toolName}" is not registered`},isError:!0};try{let n=await t(typeof e.input==`string`?JSON.parse(e.input):e.input??{});return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:{type:`text`,value:n}}}catch(t){let n=t instanceof Error?t.message:String(t);return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:{type:`text`,value:n},isError:!0}}}async executeAll(e){return Promise.all(e.map(e=>this.execute(e)))}clear(){this.definitions.clear(),this.handlers.clear()}},P2e=class{constructor(){this.store=new Map,this.counter=0}async create(e={}){let t=new Date().toISOString(),n=`conv_${++this.counter}`,r={id:n,title:e.title,agentId:e.agentId,userId:e.userId,messages:[],createdAt:t,updatedAt:t,metadata:e.metadata};return this.store.set(n,r),r}async get(e){return this.store.get(e)??null}async list(e={}){let t=Array.from(this.store.values());if(e.userId&&(t=t.filter(t=>t.userId===e.userId)),e.agentId&&(t=t.filter(t=>t.agentId===e.agentId)),e.cursor){let n=t.findIndex(t=>t.id===e.cursor);n>=0&&(t=t.slice(n+1))}return e.limit&&e.limit>0&&(t=t.slice(0,e.limit)),t}async addMessage(e,t){let n=this.store.get(e);if(!n)throw Error(`Conversation "${e}" not found`);return n.messages.push(t),n.updatedAt=new Date().toISOString(),n}async delete(e){this.store.delete(e)}get size(){return this.store.size}clear(){this.store.clear(),this.counter=0}};function U9(e,t){return{type:`text-delta`,id:e,text:t}}function W9(e){return{type:`finish`,finishReason:`stop`,totalUsage:e?.usage??{promptTokens:0,completionTokens:0,totalTokens:0},rawFinishReason:`stop`}}var F2e=class e{constructor(e={}){this.adapter=e.adapter??new M2e,this.logger=e.logger??$f({level:`info`,format:`pretty`}),this.toolRegistry=e.toolRegistry??new N2e,this.conversationService=e.conversationService??new P2e,this.logger.info(`[AI] Service initialized with adapter="${this.adapter.name}", tools=${this.toolRegistry.size}`)}get adapterName(){return this.adapter.name}async chat(e,t){return this.logger.debug(`[AI] chat`,{messageCount:e.length,model:t?.model}),this.adapter.chat(e,t)}async complete(e,t){return this.logger.debug(`[AI] complete`,{promptLength:e.length,model:t?.model}),this.adapter.complete(e,t)}async*streamChat(e,t){if(this.logger.debug(`[AI] streamChat`,{messageCount:e.length,model:t?.model}),!this.adapter.streamChat){let n=await this.adapter.chat(e,t);yield U9(`fallback`,n.content),yield W9(n);return}yield*this.adapter.streamChat(e,t)}async embed(e,t){if(!this.adapter.embed)throw Error(`[AI] Adapter "${this.adapter.name}" does not support embeddings`);return this.adapter.embed(e,t)}async listModels(){return this.adapter.listModels?this.adapter.listModels():[]}static extractOutputText(e){return e.output&&typeof e.output==`object`&&`value`in e.output?String(e.output.value):`unknown error`}async chatWithTools(t,n){let{maxIterations:r,onToolError:i,...a}=n??{},o=r??e.DEFAULT_MAX_ITERATIONS,s=[...this.toolRegistry.getAll(),...a.tools??[]],c={...a,tools:s.length>0?s:void 0,toolChoice:s.length>0?a.toolChoice??`auto`:void 0},l=[...t],u=[];this.logger.debug(`[AI] chatWithTools start`,{messageCount:l.length,toolCount:s.length,maxIterations:o});let d=!1;for(let t=0;te.toolName)});let r=[];n.content&&r.push({type:`text`,text:n.content}),r.push(...n.toolCalls),l.push({role:`assistant`,content:r});let a=await this.toolRegistry.executeAll(n.toolCalls);for(let r of a){if(r.isError){let a=n.toolCalls.find(e=>e.toolCallId===r.toolCallId),o=a?.toolName??`unknown`,s=e.extractOutputText(r),c={iteration:t,toolName:o,error:s};u.push(c),this.logger.warn(`[AI] chatWithTools tool error`,c),i&&a&&i(a,s)===`abort`&&(d=!0)}l.push({role:`tool`,content:[r]})}if(d)break}return d?this.logger.warn(`[AI] chatWithTools aborted by onToolError callback`,{toolErrors:u}):this.logger.warn(`[AI] chatWithTools max iterations reached, forcing final response`,{toolErrors:u.length>0?u:void 0}),await this.adapter.chat(l,{...c,tools:void 0,toolChoice:void 0})}async*streamChatWithTools(t,n){let{maxIterations:r,onToolError:i,...a}=n??{},o=r??e.DEFAULT_MAX_ITERATIONS,s=[...this.toolRegistry.getAll(),...a.tools??[]],c={...a,tools:s.length>0?s:void 0,toolChoice:s.length>0?a.toolChoice??`auto`:void 0},l=[...t],u=!1;for(let t=0;te.toolCallId===n.toolCallId);r&&i(r,e.extractOutputText(n))===`abort`&&(u=!0)}yield{type:`tool-result`,toolCallId:n.toolCallId,toolName:n.toolName,output:n.output},l.push({role:`tool`,content:[n]})}if(u)break}u?this.logger.warn(`[AI] streamChatWithTools aborted by onToolError callback`):this.logger.warn(`[AI] streamChatWithTools max iterations reached`);let d={...c,tools:void 0,toolChoice:void 0},f=await this.adapter.chat(l,d);yield U9(`stream`,f.content),yield W9(f)}};F2e.DEFAULT_MAX_ITERATIONS=10;var I2e=F2e;function G9(e){return`data: ${JSON.stringify(e)} - -`}function L2e(e,t){return`${e}:${JSON.stringify(t)} -`}function R2e(e){switch(e.type){case`text-delta`:return G9({type:`text-delta`,id:`0`,delta:e.text});case`tool-input-start`:return G9({type:`tool-input-start`,toolCallId:e.id,toolName:e.toolName});case`tool-input-delta`:return G9({type:`tool-input-delta`,toolCallId:e.id,inputTextDelta:e.delta});case`tool-call`:return G9({type:`tool-input-available`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input});case`tool-result`:return G9({type:`tool-output-available`,toolCallId:e.toolCallId,output:e.output});case`error`:return G9({type:`error`,errorText:String(e.error)});case`reasoning-start`:return L2e(`g`,{text:``});case`reasoning-delta`:return L2e(`g`,{text:e.text});case`reasoning-end`:return``;default:return e.type?.startsWith(`step-`)?G9(e):``}}async function*z2e(e){yield G9({type:`start`}),yield G9({type:`start-step`}),yield G9({type:`text-start`,id:`0`});let t=!0,n=`stop`;for await(let r of e){if(r.type===`finish`&&(n=r.finishReason??`stop`),r.type===`finish-step`||r.type===`finish`){t&&=(yield G9({type:`text-end`,id:`0`}),!1);continue}let e=R2e(r);e&&(yield e)}t&&(yield G9({type:`text-end`,id:`0`})),yield G9({type:`finish-step`}),yield G9({type:`finish`,finishReason:n}),yield`data: [DONE] - -`}function K9(e){let t=e.role;if(typeof e.content==`string`||Array.isArray(e.content))return{role:t,content:e.content};if(Array.isArray(e.parts)){let n=e.parts.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text);if(n.length>0)return{role:t,content:n.join(``)}}return{role:t,content:``}}function B2e(e,t){let n=e.content;if(Array.isArray(e.parts)||typeof n==`string`)return null;if(Array.isArray(n)){for(let e of n){if(typeof e!=`object`||!e)return`message.content array elements must be non-null objects`;let t=e;if(typeof t.type!=`string`)return`each message.content array element must have a string "type" property`;if(t.type===`text`&&typeof t.text!=`string`)return`message.content elements with type "text" must have a string "text" property`}return null}return n==null&&t?.allowEmptyContent?null:`message.content must be a string, an array, or include parts`}var V2e=new Set([`system`,`user`,`assistant`,`tool`]);function q9(e){if(typeof e!=`object`||!e)return`each message must be an object`;let t=e;return typeof t.role!=`string`||!V2e.has(t.role)?`message.role must be one of ${[...V2e].map(e=>`"${e}"`).join(`, `)}`:B2e(t,{allowEmptyContent:t.role===`assistant`||t.role===`tool`})}function H2e(e,t,n){return[{method:`POST`,path:`/api/v1/ai/chat`,description:`Chat completion (supports Vercel AI Data Stream Protocol)`,auth:!0,permissions:[`ai:chat`],handler:async t=>{let r=t.body??{},i=r.messages;if(!Array.isArray(i)||i.length===0)return{status:400,body:{error:`messages array is required`}};for(let e of i){let t=q9(e);if(t)return{status:400,body:{error:t}}}let a={...r.options??{},...r.model!=null&&{model:r.model},...r.temperature!=null&&{temperature:r.temperature},...r.maxTokens!=null&&{maxTokens:r.maxTokens}},o=r.system??r.systemPrompt;if(o!=null&&typeof o!=`string`)return{status:400,body:{error:`system/systemPrompt must be a string`}};let s=o,c=[...s?[{role:`system`,content:s}]:[],...i.map(e=>K9(e))];if(r.stream!==!1)try{return e.streamChatWithTools?{status:200,stream:!0,vercelDataStream:!0,contentType:`text/event-stream`,headers:{"Content-Type":`text/event-stream`,"Cache-Control":`no-cache`,Connection:`keep-alive`,"x-vercel-ai-ui-message-stream":`v1`},events:z2e(e.streamChatWithTools(c,a))}:{status:501,body:{error:`Streaming is not supported by the configured AI service`}}}catch(e){return n.error(`[AI Route] /chat stream error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}try{return{status:200,body:await e.chatWithTools(c,a)}}catch(e){return n.error(`[AI Route] /chat error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/chat/stream`,description:`SSE streaming chat completion`,auth:!0,permissions:[`ai:chat`],handler:async t=>{let{messages:r,options:i}=t.body??{};if(!Array.isArray(r)||r.length===0)return{status:400,body:{error:`messages array is required`}};for(let e of r){let t=q9(e);if(t)return{status:400,body:{error:t}}}try{return e.streamChat?{status:200,stream:!0,events:e.streamChat(r.map(e=>K9(e)),i)}:{status:501,body:{error:`Streaming is not supported by the configured AI service`}}}catch(e){return n.error(`[AI Route] /chat/stream error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/complete`,description:`Text completion`,auth:!0,permissions:[`ai:complete`],handler:async t=>{let{prompt:r,options:i}=t.body??{};if(!r||typeof r!=`string`)return{status:400,body:{error:`prompt string is required`}};try{return{status:200,body:await e.complete(r,i)}}catch(e){return n.error(`[AI Route] /complete error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`GET`,path:`/api/v1/ai/models`,description:`List available models`,auth:!0,permissions:[`ai:read`],handler:async()=>{try{return{status:200,body:{models:e.listModels?await e.listModels():[]}}}catch(e){return n.error(`[AI Route] /models error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/conversations`,description:`Create a conversation`,auth:!0,permissions:[`ai:conversations`],handler:async e=>{try{if(e.body!==void 0&&e.body!==null&&(typeof e.body!=`object`||Array.isArray(e.body)))return{status:400,body:{error:`Invalid request payload`}};let n={...e.body??{}};return e.user?.userId&&(n.userId=e.user.userId),{status:201,body:await t.create(n)}}catch(e){return n.error(`[AI Route] POST /conversations error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`GET`,path:`/api/v1/ai/conversations`,description:`List conversations`,auth:!0,permissions:[`ai:conversations`],handler:async e=>{try{let n=e.query??{},r={...n};if(typeof n.limit==`string`){let e=Number(n.limit);if(!Number.isFinite(e)||e<=0||!Number.isInteger(e))return{status:400,body:{error:`Invalid limit parameter`}};r.limit=e}return e.user?.userId&&(r.userId=e.user.userId),{status:200,body:{conversations:await t.list(r)}}}catch(e){return n.error(`[AI Route] GET /conversations error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/conversations/:id/messages`,description:`Add message to a conversation`,auth:!0,permissions:[`ai:conversations`],handler:async e=>{let r=e.params?.id;if(!r)return{status:400,body:{error:`conversation id is required`}};let i=e.body,a=q9(i);if(a)return{status:400,body:{error:a}};try{if(e.user?.userId){let n=await t.get(r);if(!n)return{status:404,body:{error:`Conversation "${r}" not found`}};if(n.userId&&n.userId!==e.user.userId)return{status:403,body:{error:`You do not have access to this conversation`}}}return{status:200,body:await t.addMessage(r,i)}}catch(e){let t=e instanceof Error?e.message:String(e);return t.includes(`not found`)?{status:404,body:{error:t}}:(n.error(`[AI Route] POST /conversations/:id/messages error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}})}}},{method:`DELETE`,path:`/api/v1/ai/conversations/:id`,description:`Delete a conversation`,auth:!0,permissions:[`ai:conversations`],handler:async e=>{let r=e.params?.id;if(!r)return{status:400,body:{error:`conversation id is required`}};try{if(e.user?.userId){let n=await t.get(r);if(!n)return{status:404,body:{error:`Conversation "${r}" not found`}};if(n.userId&&n.userId!==e.user.userId)return{status:403,body:{error:`You do not have access to this conversation`}}}return await t.delete(r),{status:204}}catch(e){return n.error(`[AI Route] DELETE /conversations/:id error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}}]}var U2e=new Set([`user`,`assistant`]);function W2e(e){if(typeof e!=`object`||!e)return`each message must be an object`;let t=e;return typeof t.role!=`string`||!U2e.has(t.role)?`message.role must be one of ${[...U2e].map(e=>`"${e}"`).join(`, `)} for agent chat`:B2e(t,{allowEmptyContent:t.role===`assistant`})}function G2e(e,t,n){return[{method:`GET`,path:`/api/v1/ai/agents`,description:`List all active AI agents`,auth:!0,permissions:[`ai:chat`],handler:async()=>{try{return{status:200,body:{agents:await t.listAgents()}}}catch(e){return n.error(`[AI Route] /agents list error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/agents/:agentName/chat`,description:`Chat with a specific AI agent (supports Vercel AI Data Stream Protocol)`,auth:!0,permissions:[`ai:chat`,`ai:agents`],handler:async r=>{let i=r.params?.agentName;if(!i)return{status:400,body:{error:`agentName parameter is required`}};let a=r.body??{},{messages:o,context:s,options:c}=a;if(!Array.isArray(o)||o.length===0)return{status:400,body:{error:`messages array is required`}};for(let e of o){let t=W2e(e);if(t)return{status:400,body:{error:t}}}let l=await t.loadAgent(i);if(!l)return{status:404,body:{error:`Agent "${i}" not found`}};if(!l.active)return{status:403,body:{error:`Agent "${i}" is not active`}};try{let n=t.buildSystemMessages(l,s),r=t.buildRequestOptions(l,e.toolRegistry.getAll()),i={};if(c){let e=new Set([`temperature`,`maxTokens`,`stop`]);for(let t of Object.keys(c))e.has(t)&&(i[t]=c[t])}let u={...r,...i},d=[...n,...o.map(e=>K9(e))],f={...u,maxIterations:l.planning?.maxIterations};return a.stream===!1?{status:200,body:await e.chatWithTools(d,f)}:e.streamChatWithTools?{status:200,stream:!0,vercelDataStream:!0,contentType:`text/event-stream`,headers:{"Content-Type":`text/event-stream`,"Cache-Control":`no-cache`,Connection:`keep-alive`,"x-vercel-ai-ui-message-stream":`v1`},events:z2e(e.streamChatWithTools(d,f))}:{status:501,body:{error:`Streaming is not supported by the configured AI service`}}}catch(e){return n.error(`[AI Route] /agents/:agentName/chat error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}}]}function K2e(e){return e?typeof e==`string`?e:typeof e==`object`&&`value`in e?String(e.value??``):JSON.stringify(e):``}function q2e(e,t){return[{method:`GET`,path:`/api/v1/ai/tools`,description:`List all registered AI tools`,auth:!0,permissions:[`ai:tools`],handler:async()=>{try{return{status:200,body:{tools:e.toolRegistry.getAll().map(e=>({name:e.name,description:e.description,category:e.category}))}}}catch(e){return t.error(`[AI Route] /tools list error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}},{method:`POST`,path:`/api/v1/ai/tools/:toolName/execute`,description:`Execute a tool with parameters (playground/testing)`,auth:!0,permissions:[`ai:tools`,`ai:execute`],handler:async n=>{let r=n.params?.toolName;if(!r)return{status:400,body:{error:`toolName parameter is required`}};let{parameters:i}=n.body??{};if(!i||typeof i!=`object`)return{status:400,body:{error:`parameters object is required`}};try{if(!e.toolRegistry.has(r))return{status:404,body:{error:`Tool "${r}" not found`}};let n=Date.now(),a={type:`tool-call`,toolCallId:`playground-${Date.now()}`,toolName:r,input:i},o=await e.toolRegistry.execute(a),s=Date.now()-n;if(o.isError){let e=K2e(o.output);return t.error(`[AI Route] Tool execution error: ${r}`,Error(e)),{status:500,body:{error:e,duration:s}}}return{status:200,body:{result:K2e(o.output),duration:s,toolName:r}}}catch(e){return t.error(`[AI Route] /tools/:toolName/execute error`,e instanceof Error?e:void 0),{status:500,body:{error:`Internal AI service error`}}}}}]}var J9=`ai_conversations`,Y9=`ai_messages`,J2e=[{field:`created_at`,order:`asc`},{field:`id`,order:`asc`}],Y2e=[{field:`created_at`,order:`asc`},{field:`id`,order:`asc`}],X2e=class{constructor(e){this.engine=e}async create(e={}){let t=new Date().toISOString(),n=`conv_${Vf()}`,r={id:n,title:e.title??null,agent_id:e.agentId??null,user_id:e.userId??null,metadata:e.metadata?JSON.stringify(e.metadata):null,created_at:t,updated_at:t};return await this.engine.insert(J9,r),{id:n,title:e.title,agentId:e.agentId,userId:e.userId,messages:[],createdAt:t,updatedAt:t,metadata:e.metadata}}async get(e){let t=await this.engine.findOne(J9,{where:{id:e}});if(!t)return null;let n=await this.engine.find(Y9,{where:{conversation_id:e},orderBy:Y2e});return this.toConversation(t,n)}async list(e={}){let t={};if(e.userId&&(t.user_id=e.userId),e.agentId&&(t.agent_id=e.agentId),e.cursor){let n=await this.engine.findOne(J9,{where:{id:e.cursor},fields:[`created_at`,`id`]});n&&(t.$or=[{created_at:{$gt:n.created_at}},{created_at:n.created_at,id:{$gt:n.id}}])}let n=await this.engine.find(J9,{where:Object.keys(t).length>0?t:void 0,orderBy:J2e,limit:e.limit&&e.limit>0?e.limit:void 0});return await Promise.all(n.map(async e=>{let t=await this.engine.find(Y9,{where:{conversation_id:e.id},orderBy:Y2e});return this.toConversation(e,t)}))}async addMessage(e,t){if(!await this.engine.findOne(J9,{where:{id:e}}))throw Error(`Conversation "${e}" not found`);let n=new Date().toISOString(),r=`msg_${Vf()}`,i,a=null,o=null;if(t.role===`system`||t.role===`user`)i=typeof t.content==`string`?t.content:JSON.stringify(t.content);else if(t.role===`assistant`)if(typeof t.content==`string`)i=t.content;else{let e=t.content,n=e.filter(e=>e.type===`text`).map(e=>e.text),r=e.filter(e=>e.type===`tool-call`);i=n.join(``),r.length>0&&(a=JSON.stringify(r))}else if(t.role===`tool`){i=JSON.stringify(t.content);let e=Array.isArray(t.content)?t.content[0]:void 0;e&&`toolCallId`in e&&(o=e.toolCallId)}else i=``;return await this.engine.insert(Y9,{id:r,conversation_id:e,role:t.role,content:i,tool_calls:a,tool_call_id:o,created_at:n}),await this.engine.update(J9,{id:e,updated_at:n},{where:{id:e}}),await this.get(e)}async delete(e){await this.engine.delete(Y9,{where:{conversation_id:e},multi:!0}),await this.engine.delete(J9,{where:{id:e}})}safeParse(e,t){if(e)try{return JSON.parse(e)}catch{return t}}toConversation(e,t){return{id:e.id,title:e.title??void 0,agentId:e.agent_id??void 0,userId:e.user_id??void 0,messages:t.map(e=>this.toMessage(e)),createdAt:e.created_at,updatedAt:e.updated_at,metadata:this.safeParse(e.metadata)}}toMessage(e){switch(e.role){case`system`:return{role:`system`,content:e.content};case`user`:return{role:`user`,content:e.content};case`assistant`:{let t=this.safeParse(e.tool_calls);if(t&&t.length>0){let n=[];return e.content&&n.push({type:`text`,text:e.content}),n.push(...t),{role:`assistant`,content:n}}return{role:`assistant`,content:e.content}}case`tool`:{let t=this.safeParse(e.content);return t&&t.length>0&&t[0]?.type===`tool-result`?{role:`tool`,content:t}:{role:`tool`,content:[{type:`tool-result`,toolCallId:e.tool_call_id??``,toolName:`unknown`,output:{type:`text`,value:e.content}}]}}default:return{role:`user`,content:e.content}}}},Z2e=O.create({namespace:`ai`,name:`conversations`,label:`AI Conversation`,pluralLabel:`AI Conversations`,icon:`message-square`,isSystem:!0,description:`Persistent AI conversation metadata`,fields:{id:j.text({label:`Conversation ID`,required:!0,readonly:!0}),title:j.text({label:`Title`,required:!1,maxLength:500,description:`Conversation title or summary`}),agent_id:j.text({label:`Agent ID`,required:!1,maxLength:255,description:`Associated AI agent identifier`}),user_id:j.text({label:`User ID`,required:!1,maxLength:255,description:`User who owns the conversation`}),metadata:j.textarea({label:`Metadata`,required:!1,description:`JSON-serialized conversation metadata`}),created_at:j.datetime({label:`Created At`,required:!0,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,required:!0,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`user_id`]},{fields:[`agent_id`]},{fields:[`created_at`]}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),Q2e=O.create({namespace:`ai`,name:`messages`,label:`AI Message`,pluralLabel:`AI Messages`,icon:`message-circle`,isSystem:!0,description:`Individual messages within AI conversations`,fields:{id:j.text({label:`Message ID`,required:!0,readonly:!0}),conversation_id:j.text({label:`Conversation ID`,required:!0,description:`Foreign key to ai_conversations`}),role:j.select({label:`Role`,required:!0,options:[{label:`System`,value:`system`},{label:`User`,value:`user`},{label:`Assistant`,value:`assistant`},{label:`Tool`,value:`tool`}]}),content:j.textarea({label:`Content`,required:!0,description:`Message content`}),tool_calls:j.textarea({label:`Tool Calls`,required:!1,description:`JSON-serialized tool calls (when role=assistant)`}),tool_call_id:j.text({label:`Tool Call ID`,required:!1,maxLength:255,description:`ID of the tool call this message responds to (when role=tool)`}),created_at:j.datetime({label:`Created At`,required:!0,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`conversation_id`]},{fields:[`conversation_id`,`created_at`]}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`],trash:!1,mru:!1}});P9(),H9();var $2e=class{constructor(e){this.metadataService=e}async listAgents(){let e=await this.metadataService.list(`agent`),t=[];for(let n of e){let e=m9.safeParse(n);e.success&&e.data.active&&t.push({name:e.data.name,label:e.data.label,role:e.data.role})}return t}async loadAgent(e){let t=await this.metadataService.get(`agent`,e);if(!t)return;let n=m9.safeParse(t);if(n.success)return n.data}buildSystemMessages(e,t){let n=[];if(n.push(e.instructions),t){let e=[];t.objectName&&e.push(`Current object: ${t.objectName}`),t.recordId&&e.push(`Selected record ID: ${t.recordId}`),t.viewName&&e.push(`Current view: ${t.viewName}`),e.length>0&&n.push(` ---- Current Context --- -`+e.join(` -`))}return[{role:`system`,content:n.join(` -`)}]}buildRequestOptions(e,t){let n={};if(e.model&&(n.model=e.model.model,n.temperature=e.model.temperature,n.maxTokens=e.model.maxTokens),e.tools&&e.tools.length>0){let r=new Map(t.map(e=>[e.name,e])),i=[];for(let t of e.tools){let e=r.get(t.name);e&&i.push(e)}i.length>0&&(n.tools=i,n.toolChoice=`auto`)}return n}},X9={name:`data_chat`,label:`Data Assistant`,role:`Business Data Analyst`,instructions:`You are a helpful data assistant that helps users explore and understand their business data through natural language. - -Capabilities: -- List available data objects (tables) and their schemas -- Query records with filters, sorting, and pagination -- Look up individual records by ID -- Perform aggregations and statistical analysis (count, sum, avg, min, max) - -Guidelines: -1. Always use the describe_object tool first to understand a table's structure before querying it. -2. Respect the user's current context — if they are viewing a specific object or record, use that as the default scope. -3. When presenting data, format it in a clear and readable way using markdown tables or bullet lists. -4. For large result sets, summarize the data and mention the total count. -5. When performing aggregations, explain the results in plain language. -6. If a query returns no results, suggest possible reasons and alternative queries. -7. Never expose internal IDs unless the user explicitly asks for them. -8. Always answer in the same language the user is using.`,model:{provider:`openai`,model:`gpt-4`,temperature:.3,maxTokens:4096},tools:[{type:`query`,name:`list_objects`,description:`List all available data objects`},{type:`query`,name:`describe_object`,description:`Get schema/fields of a data object`},{type:`query`,name:`query_records`,description:`Query records with filters and pagination`},{type:`query`,name:`get_record`,description:`Get a single record by ID`},{type:`query`,name:`aggregate_data`,description:`Aggregate/statistics on data`}],active:!0,visibility:`global`,guardrails:{maxTokensPerInvocation:8192,maxExecutionTimeSec:30,blockedTopics:[`delete_records`,`drop_table`,`alter_schema`]},planning:{strategy:`react`,maxIterations:5,allowReplan:!1},memory:{shortTerm:{maxMessages:20,maxTokens:4096}}},Z9={name:`metadata_assistant`,label:`Metadata Assistant`,role:`Schema Architect`,instructions:`You are an expert metadata architect that helps users design and manage their data models through natural language. - -Capabilities: -- Create new data objects (tables) with fields -- Add fields (columns) to existing objects -- Modify field properties (label, type, required, default value) -- Delete fields from objects -- List all registered metadata objects and their schemas -- Describe the full schema of a specific object - -Guidelines: -1. Before creating a new object, use list_objects to check if a similar one already exists. -2. Before modifying or deleting fields, use describe_object to understand the current schema. -3. Always use snake_case for object names and field names (e.g. project_task, due_date). -4. Suggest meaningful field types based on the user's description (e.g. "deadline" → date, "active" → boolean). -5. When creating objects, propose a reasonable set of initial fields based on the entity type. -6. Explain what changes you are about to make before executing them. -7. After making changes, confirm the result by describing the updated schema. -8. For destructive operations (deleting fields), always warn the user about potential data loss. -9. Always answer in the same language the user is using. -10. If the user's request is ambiguous, ask clarifying questions before proceeding.`,model:{provider:`openai`,model:`gpt-4`,temperature:.2,maxTokens:4096},tools:[{type:`action`,name:`create_object`,description:`Create a new data object (table)`},{type:`action`,name:`add_field`,description:`Add a field to an existing object`},{type:`action`,name:`modify_field`,description:`Modify an existing field definition`},{type:`action`,name:`delete_field`,description:`Delete a field from an object`},{type:`query`,name:`list_objects`,description:`List all data objects`},{type:`query`,name:`describe_object`,description:`Describe an object schema`}],active:!0,visibility:`global`,guardrails:{maxTokensPerInvocation:8192,maxExecutionTimeSec:60,blockedTopics:[`drop_database`,`raw_sql`,`system_tables`]},planning:{strategy:`react`,maxIterations:10,allowReplan:!0},memory:{shortTerm:{maxMessages:30,maxTokens:8192}}};function Q9(e){if(!e)return{};let t={};if(e.temperature!=null&&(t.temperature=e.temperature),e.maxTokens!=null&&(t.maxTokens=e.maxTokens),e.stop?.length&&(t.stopSequences=e.stop),e.tools?.length){let n={};for(let t of e.tools)n[t.name]=FC({description:t.description,inputSchema:DC(t.parameters)});t.tools=n}return e.toolChoice!=null&&(t.toolChoice=e.toolChoice),t}var e4e=class{constructor(e){this.name=`vercel`,this.model=e.model}async chat(e,t){let n=await YE({model:this.model,messages:e,...Q9(t)});return{content:n.text,model:n.response?.modelId,toolCalls:n.toolCalls?.length?n.toolCalls:void 0,usage:n.usage?{promptTokens:n.usage.inputTokens??0,completionTokens:n.usage.outputTokens??0,totalTokens:n.usage.totalTokens??0}:void 0}}async complete(e,t){let n=await YE({model:this.model,prompt:e,...Q9(t)});return{content:n.text,model:n.response?.modelId,usage:n.usage?{promptTokens:n.usage.inputTokens??0,completionTokens:n.usage.outputTokens??0,totalTokens:n.usage.totalTokens??0}:void 0}}async*streamChat(e,t){let n=Rme({model:this.model,messages:e,...Q9(t)});for await(let e of n.fullStream)yield e}async embed(e){throw Error(`[VercelLLMAdapter] Embeddings require a dedicated EmbeddingModel. Configure an embedding adapter instead.`)}async listModels(){return[]}},t4e=class{constructor(e={}){this.name=`com.objectstack.service-ai`,this.version=`1.0.0`,this.type=`standard`,this.dependencies=[`com.objectstack.engine.objectql`],this.options=e}async detectAdapter(e){let t={}.AI_GATEWAY_MODEL;if(t)try{let{gateway:e}=await Gf(async()=>{let{gateway:e}=await import(`@ai-sdk/gateway`);return{gateway:e}},[],import.meta.url);return{adapter:new e4e({model:e(t)}),description:`Vercel AI Gateway (model: ${t})`}}catch(n){e.logger.warn(`[AI] Failed to load @ai-sdk/gateway for AI_GATEWAY_MODEL=${t}, trying next provider`,n instanceof Error?{error:n.message}:void 0)}for(let{envKey:t,pkg:n,factory:r,defaultModel:i,displayName:a}of[{envKey:`OPENAI_API_KEY`,pkg:`@ai-sdk/openai`,factory:`openai`,defaultModel:`gpt-4o`,displayName:`OpenAI`},{envKey:`ANTHROPIC_API_KEY`,pkg:`@ai-sdk/anthropic`,factory:`anthropic`,defaultModel:`claude-sonnet-4-20250514`,displayName:`Anthropic`},{envKey:`GOOGLE_GENERATIVE_AI_API_KEY`,pkg:`@ai-sdk/google`,factory:`google`,defaultModel:`gemini-2.0-flash`,displayName:`Google`}])if({}[t])try{let e=await Gf(()=>import(n),[],import.meta.url),t=e[r]??e.default;if(typeof t==`function`){let e={}.AI_MODEL??i;return{adapter:new e4e({model:t(e)}),description:`${a} (model: ${e})`}}}catch(r){e.logger.warn(`[AI] Failed to load ${n} for ${t}, trying next provider`,r instanceof Error?{error:r.message}:void 0)}return e.logger.warn(`[AI] No LLM provider configured via environment variables. Falling back to MemoryLLMAdapter (echo mode). Set AI_GATEWAY_MODEL, OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_GENERATIVE_AI_API_KEY to use a real LLM.`),{adapter:new M2e,description:`MemoryLLMAdapter (echo mode - for testing only)`}}async init(e){let t=!1;try{let n=e.getService(`ai`);n&&typeof n.chat==`function`&&(t=!0,e.logger.debug(`[AI] Found existing AI service, replacing`))}catch{}let n=this.options.conversationService;if(!n)try{let t=e.getService(`data`);t&&typeof t.find==`function`&&(n=new X2e(t),e.logger.info(`[AI] Using ObjectQLConversationService (IDataEngine detected)`))}catch{}let r,i;if(this.options.adapter)r=this.options.adapter,i=`${r.name} (explicitly configured)`;else{let t=await this.detectAdapter(e);r=t.adapter,i=t.description}e.logger.info(`[AI] Using LLM adapter: ${i}`),this.service=new I2e({adapter:r,logger:e.logger,conversationService:n}),t?e.replaceService(`ai`,this.service):e.registerService(`ai`,this.service),e.getService(`manifest`).register({id:`com.objectstack.service-ai`,name:`AI Service`,version:`1.0.0`,type:`plugin`,namespace:`ai`,objects:[Z2e,Q2e]}),this.options.debug&&e.hook(`ai:beforeChat`,async t=>{e.logger.debug(`[AI] Before chat`,{messages:t})});try{let t=e.getService(`setupNav`);t&&(t.contribute({areaId:`area_ai`,items:[{id:`nav_ai_conversations`,type:`object`,label:`Conversations`,objectName:`conversations`,icon:`message-square`,order:10},{id:`nav_ai_messages`,type:`object`,label:`Messages`,objectName:`messages`,icon:`messages-square`,order:20}]}),e.logger.info(`[AI] Navigation items contributed to Setup App`))}catch{}e.logger.info(`[AI] Service initialized`)}async start(e){if(!this.service)return;let t;try{t=e.getService(`metadata`),console.log(`[AI Plugin] Retrieved metadata service:`,!!t,`has getRegisteredTypes:`,typeof t?.getRegisteredTypes)}catch(t){console.log(`[AI] Metadata service not available:`,t.message),e.logger.debug(`[AI] Metadata service not available`)}try{let n=e.getService(`data`);if(n){if(m2e(this.service.toolRegistry,{dataEngine:n}),e.logger.info(`[AI] Built-in data tools registered`),t){let{DATA_TOOL_DEFINITIONS:n}=await Promise.resolve().then(()=>(P9(),u2e));for(let e of n)typeof t.exists==`function`&&await t.exists(`tool`,e.name)||await t.register(`tool`,e.name,e);e.logger.info(`[AI] ${n.length} data tools registered as metadata`)}if(t)try{typeof t.exists==`function`&&await t.exists(`agent`,X9.name)?(console.log(`[AI] data_chat agent already exists, skipping`),e.logger.debug(`[AI] data_chat agent already exists, skipping auto-registration`)):(await t.register(`agent`,X9.name,X9),console.log(`[AI] Registered data_chat agent to metadataService`),e.logger.info(`[AI] data_chat agent registered`))}catch(t){e.logger.warn(`[AI] Failed to register data_chat agent`,t instanceof Error?{error:t.message,stack:t.stack}:{error:String(t)})}}}catch{e.logger.debug(`[AI] Data engine not available, skipping data tools`)}if(t)try{k2e(this.service.toolRegistry,{metadataService:t}),e.logger.info(`[AI] Built-in metadata tools registered`);let{METADATA_TOOL_DEFINITIONS:n}=await Promise.resolve().then(()=>(H9(),S2e));for(let e of n)typeof t.exists==`function`&&await t.exists(`tool`,e.name)||await t.register(`tool`,e.name,e);e.logger.info(`[AI] ${n.length} metadata tools registered as metadata`);try{typeof t.exists==`function`&&await t.exists(`agent`,Z9.name)?(console.log(`[AI] metadata_assistant agent already exists, skipping`),e.logger.debug(`[AI] metadata_assistant agent already exists, skipping auto-registration`)):(await t.register(`agent`,Z9.name,Z9),console.log(`[AI] Registered metadata_assistant agent to metadataService`),e.logger.info(`[AI] metadata_assistant agent registered`))}catch(t){e.logger.warn(`[AI] Failed to register metadata_assistant agent`,t instanceof Error?{error:t.message,stack:t.stack}:{error:String(t)})}}catch(t){e.logger.debug(`[AI] Failed to register metadata tools`,t instanceof Error?t:void 0)}await e.trigger(`ai:ready`,this.service);let n=H2e(this.service,this.service.conversationService,e.logger),r=q2e(this.service,e.logger);if(n.push(...r),e.logger.info(`[AI] Tool routes registered (${r.length} routes)`),t){let r=new $2e(t),i=G2e(this.service,r,e.logger);n.push(...i),e.logger.info(`[AI] Agent routes registered (${i.length} routes)`)}else e.logger.debug(`[AI] Metadata service not available, skipping agent routes`);await e.trigger(`ai:routes`,n);let i=e.getKernel();i&&(i.__aiRoutes=n),e.logger.info(`[AI] Service started \u2014 adapter="${this.service.adapterName}", tools=${this.service.toolRegistry.size}, routes=${n.length}`)}async destroy(){this.service=void 0}};P9(),H9(),H9();var n4e=class{constructor(e={}){this.items=new Map,this.counter=0,this.subscriptions=new Map,this.maxItems=e.maxItems??0}async listFeed(e){let t=Array.from(this.items.values()).filter(t=>t.object===e.object&&t.recordId===e.recordId);e.filter&&e.filter!==`all`&&(t=t.filter(t=>{switch(e.filter){case`comments_only`:return t.type===`comment`;case`changes_only`:return t.type===`field_change`;case`tasks_only`:return t.type===`task`;default:return!0}})),t.sort((e,t)=>{let n=new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime();return n===0?t.ide.id):n});let n=t.length,r=e.limit??20,i=0;if(e.cursor){let n=t.findIndex(t=>t.id===e.cursor);n>=0&&(i=n+1)}let a=t.slice(i,i+r),o=i+r0?a[a.length-1].id:void 0,hasMore:o}}async createFeedItem(e){if(this.maxItems>0&&this.items.size>=this.maxItems)throw Error(`Maximum feed item limit reached (${this.maxItems}). Delete existing items before adding new ones.`);let t=`feed_${++this.counter}`,n=new Date().toISOString();if(e.parentId){let t=this.items.get(e.parentId);if(!t)throw Error(`Parent feed item not found: ${e.parentId}`);let r={...t,replyCount:(t.replyCount??0)+1,updatedAt:n};this.items.set(t.id,r)}let r={id:t,type:e.type,object:e.object,recordId:e.recordId,actor:{type:e.actor.type,id:e.actor.id,...e.actor.name?{name:e.actor.name}:{},...e.actor.avatarUrl?{avatarUrl:e.actor.avatarUrl}:{}},...e.body===void 0?{}:{body:e.body},...e.mentions?{mentions:e.mentions}:{},...e.changes?{changes:e.changes}:{},...e.parentId?{parentId:e.parentId}:{},visibility:e.visibility??`public`,replyCount:0,isEdited:!1,pinned:!1,starred:!1,createdAt:n};return this.items.set(t,r),r}async updateFeedItem(e,t){let n=this.items.get(e);if(!n)throw Error(`Feed item not found: ${e}`);let r=new Date().toISOString(),i={...n,...t.body===void 0?{}:{body:t.body},...t.mentions===void 0?{}:{mentions:t.mentions},...t.visibility===void 0?{}:{visibility:t.visibility},updatedAt:r,editedAt:r,isEdited:!0};return this.items.set(e,i),i}async deleteFeedItem(e){let t=this.items.get(e);if(!t)throw Error(`Feed item not found: ${e}`);if(t.parentId){let e=this.items.get(t.parentId);if(e){let t={...e,replyCount:Math.max(0,(e.replyCount??0)-1)};this.items.set(e.id,t)}}this.items.delete(e)}async getFeedItem(e){return this.items.get(e)??null}async addReaction(e,t,n){let r=this.items.get(e);if(!r)throw Error(`Feed item not found: ${e}`);let i=[...r.reactions??[]],a=i.find(e=>e.emoji===t);if(a){if(a.userIds.includes(n))throw Error(`Reaction already exists: ${t} by ${n}`);a.userIds=[...a.userIds,n],a.count=a.userIds.length}else i.push({emoji:t,userIds:[n],count:1});let o={...r,reactions:i};return this.items.set(e,o),i}async removeReaction(e,t,n){let r=this.items.get(e);if(!r)throw Error(`Feed item not found: ${e}`);let i=[...r.reactions??[]],a=i.find(e=>e.emoji===t);if(!a||!a.userIds.includes(n))throw Error(`Reaction not found: ${t} by ${n}`);a.userIds=a.userIds.filter(e=>e!==n),a.count=a.userIds.length,i=i.filter(e=>e.count>0);let o={...r,reactions:i};return this.items.set(e,o),i}async subscribe(e){let t=this.subscriptionKey(e.object,e.recordId,e.userId),n=this.findSubscription(e.object,e.recordId,e.userId);if(n){let r={...n,events:e.events??n.events,channels:e.channels??n.channels,active:!0};return this.subscriptions.set(t,r),r}let r=new Date().toISOString(),i={object:e.object,recordId:e.recordId,userId:e.userId,events:e.events??[`all`],channels:e.channels??[`in_app`],active:!0,createdAt:r};return this.subscriptions.set(t,i),i}async unsubscribe(e,t,n){let r=this.subscriptionKey(e,t,n);return this.subscriptions.delete(r)}async getSubscription(e,t,n){return this.findSubscription(e,t,n)}getItemCount(){return this.items.size}getSubscriptionCount(){return this.subscriptions.size}subscriptionKey(e,t,n){return`${e}:${t}:${n}`}findSubscription(e,t,n){let r=this.subscriptionKey(e,t,n);return this.subscriptions.get(r)??null}},r4e=O.create({name:`sys_feed_item`,label:`Feed Item`,pluralLabel:`Feed Items`,icon:`message-square`,description:`Unified activity timeline entries (comments, field changes, tasks, events)`,titleFormat:`{type}: {body}`,compactLayout:[`type`,`object`,`record_id`,`created_at`],fields:{id:j.text({label:`Feed Item ID`,required:!0,readonly:!0}),type:j.select({label:`Type`,required:!0,options:[{label:`Comment`,value:`comment`},{label:`Field Change`,value:`field_change`},{label:`Task`,value:`task`},{label:`Event`,value:`event`},{label:`Email`,value:`email`},{label:`Call`,value:`call`},{label:`Note`,value:`note`},{label:`File`,value:`file`},{label:`Record Create`,value:`record_create`},{label:`Record Delete`,value:`record_delete`},{label:`Approval`,value:`approval`},{label:`Sharing`,value:`sharing`},{label:`System`,value:`system`}]}),object:j.text({label:`Object Name`,required:!0,searchable:!0}),record_id:j.text({label:`Record ID`,required:!0,searchable:!0}),actor_type:j.select({label:`Actor Type`,required:!0,options:[{label:`User`,value:`user`},{label:`System`,value:`system`},{label:`Service`,value:`service`},{label:`Automation`,value:`automation`}]}),actor_id:j.text({label:`Actor ID`,required:!0}),actor_name:j.text({label:`Actor Name`}),actor_avatar_url:j.url({label:`Actor Avatar URL`}),body:j.textarea({label:`Body`,description:`Rich text body (Markdown supported)`}),mentions:j.textarea({label:`Mentions`,description:`Array of @mention objects (JSON)`}),changes:j.textarea({label:`Field Changes`,description:`Array of field change entries (JSON)`}),reactions:j.textarea({label:`Reactions`,description:`Array of emoji reaction objects (JSON)`}),parent_id:j.text({label:`Parent Feed Item ID`,description:`For threaded replies`}),reply_count:j.number({label:`Reply Count`,defaultValue:0}),visibility:j.select({label:`Visibility`,defaultValue:`public`,options:[{label:`Public`,value:`public`},{label:`Internal`,value:`internal`},{label:`Private`,value:`private`}]}),is_edited:j.boolean({label:`Is Edited`,defaultValue:!1}),edited_at:j.datetime({label:`Edited At`}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`object`,`record_id`],unique:!1},{fields:[`actor_id`],unique:!1},{fields:[`parent_id`],unique:!1},{fields:[`created_at`],unique:!1}],enable:{trackHistory:!1,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),i4e=O.create({name:`sys_feed_reaction`,label:`Feed Reaction`,pluralLabel:`Feed Reactions`,icon:`smile`,description:`Emoji reactions on feed items`,titleFormat:`{emoji} by {user_id}`,compactLayout:[`feed_item_id`,`emoji`,`user_id`],fields:{id:j.text({label:`Reaction ID`,required:!0,readonly:!0}),feed_item_id:j.text({label:`Feed Item ID`,required:!0}),emoji:j.text({label:`Emoji`,required:!0,description:`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`}),user_id:j.text({label:`User ID`,required:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`feed_item_id`,`emoji`,`user_id`],unique:!0},{fields:[`feed_item_id`],unique:!1},{fields:[`user_id`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`delete`],trash:!1,mru:!1}}),a4e=O.create({name:`sys_record_subscription`,label:`Record Subscription`,pluralLabel:`Record Subscriptions`,icon:`bell`,description:`Record-level notification subscriptions for feed events`,titleFormat:`{object}/{record_id} — {user_id}`,compactLayout:[`object`,`record_id`,`user_id`,`active`],fields:{id:j.text({label:`Subscription ID`,required:!0,readonly:!0}),object:j.text({label:`Object Name`,required:!0}),record_id:j.text({label:`Record ID`,required:!0}),user_id:j.text({label:`User ID`,required:!0}),events:j.textarea({label:`Subscribed Events`,description:`Array of event types: comment, mention, field_change, task, approval, all (JSON)`}),channels:j.textarea({label:`Notification Channels`,description:`Array of channels: in_app, email, push, slack (JSON)`}),active:j.boolean({label:`Active`,defaultValue:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0})},indexes:[{fields:[`object`,`record_id`,`user_id`],unique:!0},{fields:[`user_id`],unique:!1},{fields:[`object`,`record_id`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),o4e=class{constructor(e={}){this.name=`com.objectstack.service.feed`,this.version=`1.0.0`,this.type=`standard`,this.dependencies=[`com.objectstack.engine.objectql`],this.options={adapter:`memory`,...e}}async init(e){let t=new n4e(this.options.memory);e.registerService(`feed`,t),e.getService(`manifest`).register({id:`com.objectstack.service.feed`,name:`Feed Service`,version:`1.0.0`,type:`plugin`,objects:[r4e,i4e,a4e]}),e.logger.info(`FeedServicePlugin: registered in-memory feed adapter`)}},s4e=O.create({namespace:`sys`,name:`user`,label:`User`,pluralLabel:`Users`,icon:`user`,isSystem:!0,description:`User accounts for authentication`,titleFormat:`{name} ({email})`,compactLayout:[`name`,`email`,`email_verified`],fields:{id:j.text({label:`User ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),email:j.email({label:`Email`,required:!0,searchable:!0}),email_verified:j.boolean({label:`Email Verified`,defaultValue:!1}),name:j.text({label:`Name`,required:!0,searchable:!0,maxLength:255}),image:j.url({label:`Profile Image`,required:!1})},indexes:[{fields:[`email`],unique:!0},{fields:[`created_at`],unique:!1}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!0},validations:[{name:`email_unique`,type:`unique`,severity:`error`,message:`Email must be unique`,fields:[`email`],caseSensitive:!1}]}),c4e=O.create({namespace:`sys`,name:`session`,label:`Session`,pluralLabel:`Sessions`,icon:`key`,isSystem:!0,description:`Active user sessions`,titleFormat:`Session {token}`,compactLayout:[`user_id`,`expires_at`,`ip_address`],fields:{id:j.text({label:`Session ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),user_id:j.text({label:`User ID`,required:!0}),expires_at:j.datetime({label:`Expires At`,required:!0}),token:j.text({label:`Session Token`,required:!0}),ip_address:j.text({label:`IP Address`,required:!1,maxLength:45}),user_agent:j.textarea({label:`User Agent`,required:!1})},indexes:[{fields:[`token`],unique:!0},{fields:[`user_id`],unique:!1},{fields:[`expires_at`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`delete`],trash:!1,mru:!1}}),l4e=O.create({namespace:`sys`,name:`account`,label:`Account`,pluralLabel:`Accounts`,icon:`link`,isSystem:!0,description:`OAuth and authentication provider accounts`,titleFormat:`{provider_id} - {account_id}`,compactLayout:[`provider_id`,`user_id`,`account_id`],fields:{id:j.text({label:`Account ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),provider_id:j.text({label:`Provider ID`,required:!0,description:`OAuth provider identifier (google, github, etc.)`}),account_id:j.text({label:`Provider Account ID`,required:!0,description:`User's ID in the provider's system`}),user_id:j.text({label:`User ID`,required:!0,description:`Link to user table`}),access_token:j.textarea({label:`Access Token`,required:!1}),refresh_token:j.textarea({label:`Refresh Token`,required:!1}),id_token:j.textarea({label:`ID Token`,required:!1}),access_token_expires_at:j.datetime({label:`Access Token Expires At`,required:!1}),refresh_token_expires_at:j.datetime({label:`Refresh Token Expires At`,required:!1}),scope:j.text({label:`OAuth Scope`,required:!1}),password:j.text({label:`Password Hash`,required:!1,description:`Hashed password for email/password provider`})},indexes:[{fields:[`user_id`],unique:!1},{fields:[`provider_id`,`account_id`],unique:!0}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!1}}),u4e=O.create({namespace:`sys`,name:`verification`,label:`Verification`,pluralLabel:`Verifications`,icon:`shield-check`,isSystem:!0,description:`Email and phone verification tokens`,titleFormat:`Verification for {identifier}`,compactLayout:[`identifier`,`expires_at`,`created_at`],fields:{id:j.text({label:`Verification ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),value:j.text({label:`Verification Token`,required:!0,description:`Token or code for verification`}),expires_at:j.datetime({label:`Expires At`,required:!0}),identifier:j.text({label:`Identifier`,required:!0,description:`Email address or phone number`})},indexes:[{fields:[`value`],unique:!0},{fields:[`identifier`],unique:!1},{fields:[`expires_at`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`create`,`delete`],trash:!1,mru:!1}}),d4e=O.create({namespace:`sys`,name:`organization`,label:`Organization`,pluralLabel:`Organizations`,icon:`building-2`,isSystem:!0,description:`Organizations for multi-tenant grouping`,titleFormat:`{name}`,compactLayout:[`name`,`slug`,`created_at`],fields:{id:j.text({label:`Organization ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`Name`,required:!0,searchable:!0,maxLength:255}),slug:j.text({label:`Slug`,required:!1,maxLength:255,description:`URL-friendly identifier`}),logo:j.url({label:`Logo`,required:!1}),metadata:j.textarea({label:`Metadata`,required:!1,description:`JSON-serialized organization metadata`})},indexes:[{fields:[`slug`],unique:!0},{fields:[`name`]}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!0}}),f4e=O.create({namespace:`sys`,name:`member`,label:`Member`,pluralLabel:`Members`,icon:`user-check`,isSystem:!0,description:`Organization membership records`,titleFormat:`{user_id} in {organization_id}`,compactLayout:[`user_id`,`organization_id`,`role`],fields:{id:j.text({label:`Member ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),organization_id:j.text({label:`Organization ID`,required:!0}),user_id:j.text({label:`User ID`,required:!0}),role:j.text({label:`Role`,required:!1,description:`Member role within the organization (e.g. admin, member)`,maxLength:100})},indexes:[{fields:[`organization_id`,`user_id`],unique:!0},{fields:[`user_id`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),p4e=O.create({namespace:`sys`,name:`invitation`,label:`Invitation`,pluralLabel:`Invitations`,icon:`mail`,isSystem:!0,description:`Organization invitations for user onboarding`,titleFormat:`Invitation to {organization_id}`,compactLayout:[`email`,`organization_id`,`status`],fields:{id:j.text({label:`Invitation ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),organization_id:j.text({label:`Organization ID`,required:!0}),email:j.email({label:`Email`,required:!0,description:`Email address of the invited user`}),role:j.text({label:`Role`,required:!1,maxLength:100,description:`Role to assign upon acceptance`}),status:j.select([`pending`,`accepted`,`rejected`,`expired`,`canceled`],{label:`Status`,required:!0,defaultValue:`pending`}),inviter_id:j.text({label:`Inviter ID`,required:!0,description:`User ID of the person who sent the invitation`}),expires_at:j.datetime({label:`Expires At`,required:!0}),team_id:j.text({label:`Team ID`,required:!1,description:`Optional team to assign upon acceptance`})},indexes:[{fields:[`organization_id`]},{fields:[`email`]},{fields:[`expires_at`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),m4e=O.create({namespace:`sys`,name:`team`,label:`Team`,pluralLabel:`Teams`,icon:`users`,isSystem:!0,description:`Teams within organizations for fine-grained grouping`,titleFormat:`{name}`,compactLayout:[`name`,`organization_id`,`created_at`],fields:{id:j.text({label:`Team ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`Name`,required:!0,searchable:!0,maxLength:255}),organization_id:j.text({label:`Organization ID`,required:!0})},indexes:[{fields:[`organization_id`]},{fields:[`name`,`organization_id`],unique:!0}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!1}}),h4e=O.create({namespace:`sys`,name:`team_member`,label:`Team Member`,pluralLabel:`Team Members`,icon:`user-plus`,isSystem:!0,description:`Team membership records linking users to teams`,titleFormat:`{user_id} in {team_id}`,compactLayout:[`user_id`,`team_id`,`created_at`],fields:{id:j.text({label:`Team Member ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),team_id:j.text({label:`Team ID`,required:!0}),user_id:j.text({label:`User ID`,required:!0})},indexes:[{fields:[`team_id`,`user_id`],unique:!0},{fields:[`user_id`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`delete`],trash:!1,mru:!1}}),g4e=O.create({namespace:`sys`,name:`api_key`,label:`API Key`,pluralLabel:`API Keys`,icon:`key-round`,isSystem:!0,description:`API keys for programmatic access`,titleFormat:`{name}`,compactLayout:[`name`,`user_id`,`expires_at`],fields:{id:j.text({label:`API Key ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`Name`,required:!0,maxLength:255,description:`Human-readable label for the API key`}),key:j.text({label:`Key`,required:!0,description:`Hashed API key value`}),prefix:j.text({label:`Prefix`,required:!1,maxLength:16,description:`Visible prefix for identifying the key (e.g., "osk_")`}),user_id:j.text({label:`User ID`,required:!0,description:`Owner user of this API key`}),scopes:j.textarea({label:`Scopes`,required:!1,description:`JSON array of permission scopes`}),expires_at:j.datetime({label:`Expires At`,required:!1}),last_used_at:j.datetime({label:`Last Used At`,required:!1}),revoked:j.boolean({label:`Revoked`,defaultValue:!1})},indexes:[{fields:[`key`],unique:!0},{fields:[`user_id`]},{fields:[`prefix`]}],enable:{trackHistory:!0,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}}),_4e=O.create({namespace:`sys`,name:`two_factor`,label:`Two Factor`,pluralLabel:`Two Factor Credentials`,icon:`smartphone`,isSystem:!0,description:`Two-factor authentication credentials`,titleFormat:`Two-factor for {user_id}`,compactLayout:[`user_id`,`created_at`],fields:{id:j.text({label:`Two Factor ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),user_id:j.text({label:`User ID`,required:!0}),secret:j.text({label:`Secret`,required:!0,description:`TOTP secret key`}),backup_codes:j.textarea({label:`Backup Codes`,required:!1,description:`JSON-serialized backup recovery codes`})},indexes:[{fields:[`user_id`],unique:!0}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`create`,`update`,`delete`],trash:!1,mru:!1}});O.create({namespace:`sys`,name:`user_preference`,label:`User Preference`,pluralLabel:`User Preferences`,icon:`settings`,isSystem:!0,description:`Per-user key-value preferences (theme, locale, etc.)`,titleFormat:`{key}`,compactLayout:[`user_id`,`key`],fields:{id:j.text({label:`Preference ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),user_id:j.text({label:`User ID`,required:!0,maxLength:255,description:`Owner user of this preference`}),key:j.text({label:`Key`,required:!0,maxLength:255,description:`Preference key (e.g., theme, locale, plugin.ai.auto_save)`}),value:j.json({label:`Value`,description:`Preference value (any JSON-serializable type)`})},indexes:[{fields:[`user_id`,`key`],unique:!0},{fields:[`user_id`],unique:!1}],enable:{trackHistory:!1,searchable:!1,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!1,mru:!1}});var v4e=[s4e,c4e,l4e,u4e,d4e,f4e,p4e,m4e,h4e,g4e,_4e,O.create({namespace:`sys`,name:`role`,label:`Role`,pluralLabel:`Roles`,icon:`shield`,isSystem:!0,description:`Role definitions for RBAC access control`,titleFormat:`{name}`,compactLayout:[`name`,`label`,`active`],fields:{id:j.text({label:`Role ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`API Name`,required:!0,searchable:!0,maxLength:100,description:`Unique machine name for the role (e.g. admin, editor, viewer)`}),label:j.text({label:`Display Name`,required:!0,maxLength:255}),description:j.textarea({label:`Description`,required:!1}),permissions:j.textarea({label:`Permissions`,required:!1,description:`JSON-serialized array of permission strings`}),active:j.boolean({label:`Active`,defaultValue:!0}),is_default:j.boolean({label:`Default Role`,defaultValue:!1,description:`Automatically assigned to new users`})},indexes:[{fields:[`name`],unique:!0},{fields:[`active`]}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!0}}),O.create({namespace:`sys`,name:`permission_set`,label:`Permission Set`,pluralLabel:`Permission Sets`,icon:`lock`,isSystem:!0,description:`Named permission groupings for fine-grained access control`,titleFormat:`{name}`,compactLayout:[`name`,`label`,`active`],fields:{id:j.text({label:`Permission Set ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Created At`,defaultValue:`NOW()`,readonly:!0}),updated_at:j.datetime({label:`Updated At`,defaultValue:`NOW()`,readonly:!0}),name:j.text({label:`API Name`,required:!0,searchable:!0,maxLength:100,description:`Unique machine name for the permission set`}),label:j.text({label:`Display Name`,required:!0,maxLength:255}),description:j.textarea({label:`Description`,required:!1}),object_permissions:j.textarea({label:`Object Permissions`,required:!1,description:`JSON-serialized object-level CRUD permissions`}),field_permissions:j.textarea({label:`Field Permissions`,required:!1,description:`JSON-serialized field-level read/write permissions`}),active:j.boolean({label:`Active`,defaultValue:!0})},indexes:[{fields:[`name`],unique:!0},{fields:[`active`]}],enable:{trackHistory:!0,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`,`create`,`update`,`delete`],trash:!0,mru:!0}}),O.create({namespace:`sys`,name:`audit_log`,label:`Audit Log`,pluralLabel:`Audit Logs`,icon:`scroll-text`,isSystem:!0,description:`Immutable audit trail for platform events`,titleFormat:`{action} on {object_name} by {user_id}`,compactLayout:[`action`,`object_name`,`user_id`,`created_at`],fields:{id:j.text({label:`Audit Log ID`,required:!0,readonly:!0}),created_at:j.datetime({label:`Timestamp`,required:!0,defaultValue:`NOW()`,readonly:!0}),user_id:j.text({label:`User ID`,required:!1,description:`User who performed the action (null for system actions)`}),action:j.select([`create`,`update`,`delete`,`restore`,`login`,`logout`,`permission_change`,`config_change`,`export`,`import`],{label:`Action`,required:!0,description:`Action type (snake_case). Values: create, update, delete, restore, login, logout, permission_change, config_change, export, import`}),object_name:j.text({label:`Object Name`,required:!1,maxLength:255,description:`Target object (e.g. sys_user, project_task)`}),record_id:j.text({label:`Record ID`,required:!1,description:`ID of the affected record`}),old_value:j.textarea({label:`Old Value`,required:!1,description:`JSON-serialized previous state`}),new_value:j.textarea({label:`New Value`,required:!1,description:`JSON-serialized new state`}),ip_address:j.text({label:`IP Address`,required:!1,maxLength:45}),user_agent:j.textarea({label:`User Agent`,required:!1}),tenant_id:j.text({label:`Tenant ID`,required:!1,description:`Tenant context for multi-tenant isolation`}),metadata:j.textarea({label:`Metadata`,required:!1,description:`JSON-serialized additional context`})},indexes:[{fields:[`created_at`]},{fields:[`user_id`]},{fields:[`object_name`,`record_id`]},{fields:[`action`]},{fields:[`tenant_id`]}],enable:{trackHistory:!1,searchable:!0,apiEnabled:!0,apiMethods:[`get`,`list`],trash:!1,mru:!1,clone:!1}})];async function y4e(e){let{enableBrowser:t=!0}=e,n=e.appConfigs||(e.appConfig?[e.appConfig]:[]);console.log(`[KernelFactory] Creating ObjectStack Kernel...`),console.log(`[KernelFactory] App Configs:`,n.length);let r=new lBe,i=new lp;await i.use(new $0),await i.use(new BAe(r,`memory`));let a={name:`system`,manifest:{id:`com.objectstack.system`,name:`System`,version:`1.0.0`,type:`plugin`,namespace:`sys`},objects:v4e};console.log(`[KernelFactory] Loading system objects:`,v4e.length),await i.use(new A1(a));for(let e of n)console.log(`[KernelFactory] Loading app:`,e.manifest?.id||e.name||`unknown`),await i.use(new A1(e));await i.use(new cKe),await i.use(new o4e),await i.use(new n$e({watch:!1})),await i.use(new t4e),await i.use(new iqe),await i.use(new dqe),console.log(`[KernelFactory] Protocol service will be registered by ObjectQLPlugin`),await i.use(new aKe({enableBrowser:t,baseUrl:`/api/v1`,logRequests:!0})),await i.bootstrap();let o=i.context?.getService(`objectql`);if(o){let e=new Set([`base`,`system`]),t=(t,n)=>t.includes(`__`)||!n||e.has(n)?t:`${n}__${t}`;for(let e of n){let n=(e.manifest||e)?.namespace,r=[];Array.isArray(e.data)&&r.push(...e.data),e.manifest&&Array.isArray(e.manifest.data)&&r.push(...e.manifest.data);for(let e of r){if(!e.records||!e.object)continue;let r=t(e.object,n),i=await o.find(r);if(i&&i.value&&(i=i.value),!i||i.length===0){console.log(`[KernelFactory] Manual Seeding ${e.records.length} records for ${r}`);for(let t of e.records)await o.insert(r,t)}else console.log(`[KernelFactory] Data verified present for ${r}: ${i.length} records.`)}}}return i}var $9=null;function b4e(e){return e.default||e}var x4e=[b4e(CAe)];async function S4e(){if(!$9)return console.log(`[MSW] Starting ObjectStack Runtime (Browser Mode)...`),$9=await y4e({appConfigs:x4e,enableBrowser:!0}),$9}async function C4e(){if(Fse(),Nse()){console.log(`[Console] Starting in MSW mode (in-browser kernel)`);try{await S4e()}catch(e){console.error(`[Console] ❌ Failed to start MSW mock server:`,e)}}else console.log(`[Console] Starting in Server mode`);ue.createRoot(document.getElementById(`root`)).render((0,B.jsx)(L.StrictMode,{children:(0,B.jsx)(nve,{})}))}C4e().catch(e=>{console.error(`[Console] ❌ Fatal bootstrap error:`,e);let t=document.getElementById(`root`);t&&(t.innerHTML=` -
-

Failed to start

-
${e instanceof Error?e.stack||e.message:String(e)}
-
- `)}); \ No newline at end of file diff --git a/apps/server/public/assets/index-ffw1U6iI.css b/apps/server/public/assets/index-ffw1U6iI.css deleted file mode 100644 index babece656..000000000 --- a/apps/server/public/assets/index-ffw1U6iI.css +++ /dev/null @@ -1,2 +0,0 @@ -/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-950:oklch(25.8% .092 26.042);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-400:oklch(75% .183 55.934);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-orange-950:oklch(26.6% .079 36.259);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-950:oklch(27.9% .077 45.635);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-950:oklch(26.2% .051 172.552);--color-cyan-50:oklch(98.4% .019 200.873);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-600:oklch(60.9% .126 221.723);--color-cyan-800:oklch(45% .085 224.283);--color-cyan-950:oklch(30.2% .056 229.695);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-blue-950:oklch(28.2% .091 267.935);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-800:oklch(43.8% .218 303.724);--color-purple-900:oklch(38.1% .176 304.987);--color-purple-950:oklch(29.1% .149 302.717);--color-pink-50:oklch(97.1% .014 343.198);--color-pink-200:oklch(89.9% .061 343.231);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-600:oklch(59.2% .249 .584);--color-pink-800:oklch(45.9% .187 3.815);--color-pink-950:oklch(28.4% .109 3.907);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-gray-950:oklch(13% .028 261.692);--color-black:#000;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-relaxed:1.625;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:hsl(var(--border));outline-color:hsl(var(--ring))}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-3\.5{top:calc(var(--spacing) * 3.5)}.top-4{top:calc(var(--spacing) * 4)}.top-\[50\%\]{top:50%}.right-0{right:calc(var(--spacing) * 0)}.right-1{right:calc(var(--spacing) * 1)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.bottom-0{bottom:calc(var(--spacing) * 0)}.left-0{left:calc(var(--spacing) * 0)}.left-2{left:calc(var(--spacing) * 2)}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-\[50\%\]{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[100\]{z-index:100}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-3\.5{margin-inline:calc(var(--spacing) * 3.5)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing) * 1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-8{margin-right:calc(var(--spacing) * 8)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.-ml-1{margin-left:calc(var(--spacing) * -1)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-24{height:calc(var(--spacing) * 24)}.h-32{height:calc(var(--spacing) * 32)}.h-\[1px\]{height:1px}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[85vh\]{max-height:85vh}.max-h-screen{max-height:100vh}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-10{min-height:calc(var(--spacing) * 10)}.min-h-\[36px\]{min-height:36px}.min-h-\[60px\]{min-height:60px}.min-h-\[200px\]{min-height:200px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.w-0{width:calc(var(--spacing) * 0)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-3\/4{width:75%}.w-4{width:calc(var(--spacing) * 4)}.w-4\.5{width:calc(var(--spacing) * 4.5)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-15{width:calc(var(--spacing) * 15)}.w-20{width:calc(var(--spacing) * 20)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-60{width:calc(var(--spacing) * 60)}.w-72{width:calc(var(--spacing) * 72)}.w-\[--radix-dropdown-menu-trigger-width\]{width:--radix-dropdown-menu-trigger-width}.w-\[--sidebar-width-icon\]{width:--sidebar-width-icon}.w-\[--sidebar-width\]{width:--sidebar-width}.w-\[1px\]{width:1px}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-\[--skeleton-width\]{max-width:--skeleton-width}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-64{min-width:calc(var(--spacing) * 64)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-px{--tw-translate-x:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-px{--tw-translate-x:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-0{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-75{--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize-none{resize:none}.resize-y{resize:vertical}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 0) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 0) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 4) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-x-reverse)))}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-0{border-right-style:var(--tw-border-style);border-right-width:0}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-300{border-color:var(--color-amber-300)}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/30{border-color:color-mix(in oklab, var(--color-blue-500) 30%, transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/40{border-color:color-mix(in oklab, var(--color-blue-500) 40%, transparent)}}.border-border,.border-border\/30{border-color:hsl(var(--border))}@supports (color:color-mix(in lab, red, red)){.border-border\/30{border-color:color-mix(in oklab, hsl(var(--border)) 30%, transparent)}}.border-border\/50{border-color:hsl(var(--border))}@supports (color:color-mix(in lab, red, red)){.border-border\/50{border-color:color-mix(in oklab, hsl(var(--border)) 50%, transparent)}}.border-cyan-200{border-color:var(--color-cyan-200)}.border-destructive,.border-destructive\/20{border-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.border-destructive\/20{border-color:color-mix(in oklab, hsl(var(--destructive)) 20%, transparent)}}.border-destructive\/30{border-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.border-destructive\/30{border-color:color-mix(in oklab, hsl(var(--destructive)) 30%, transparent)}}.border-destructive\/50{border-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.border-destructive\/50{border-color:color-mix(in oklab, hsl(var(--destructive)) 50%, transparent)}}.border-emerald-200{border-color:var(--color-emerald-200)}.border-emerald-300{border-color:var(--color-emerald-300)}.border-gray-200{border-color:var(--color-gray-200)}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab, red, red)){.border-green-500\/30{border-color:color-mix(in oklab, var(--color-green-500) 30%, transparent)}}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-orange-200{border-color:var(--color-orange-200)}.border-pink-200{border-color:var(--color-pink-200)}.border-primary,.border-primary\/20{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.border-primary\/20{border-color:color-mix(in oklab, hsl(var(--primary)) 20%, transparent)}}.border-purple-200{border-color:var(--color-purple-200)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-transparent{border-color:#0000}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/40{border-color:color-mix(in oklab, var(--color-yellow-500) 40%, transparent)}}.border-t-primary{border-top-color:hsl(var(--primary))}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-background{background-color:hsl(var(--background))}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab, red, red)){.bg-black\/80{background-color:color-mix(in oklab, var(--color-black) 80%, transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/5{background-color:color-mix(in oklab, var(--color-blue-500) 5%, transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/10{background-color:color-mix(in oklab, var(--color-blue-500) 10%, transparent)}}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-cyan-50{background-color:var(--color-cyan-50)}.bg-destructive,.bg-destructive\/5{background-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/5{background-color:color-mix(in oklab, hsl(var(--destructive)) 5%, transparent)}}.bg-destructive\/10{background-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/10{background-color:color-mix(in oklab, hsl(var(--destructive)) 10%, transparent)}}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/10{background-color:color-mix(in oklab, var(--color-green-500) 10%, transparent)}}.bg-muted,.bg-muted\/10{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/10{background-color:color-mix(in oklab, hsl(var(--muted)) 10%, transparent)}}.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/20{background-color:color-mix(in oklab, hsl(var(--muted)) 20%, transparent)}}.bg-muted\/30{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/30{background-color:color-mix(in oklab, hsl(var(--muted)) 30%, transparent)}}.bg-muted\/50{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/50{background-color:color-mix(in oklab, hsl(var(--muted)) 50%, transparent)}}.bg-orange-50{background-color:var(--color-orange-50)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-pink-50{background-color:var(--color-pink-50)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary,.bg-primary\/5{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.bg-primary\/5{background-color:color-mix(in oklab, hsl(var(--primary)) 5%, transparent)}}.bg-primary\/10{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.bg-primary\/10{background-color:color-mix(in oklab, hsl(var(--primary)) 10%, transparent)}}.bg-purple-50{background-color:var(--color-purple-50)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-500{background-color:var(--color-red-500)}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-transparent{background-color:#0000}.bg-yellow-500\/10{background-color:#edb2001a}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/10{background-color:color-mix(in oklab, var(--color-yellow-500) 10%, transparent)}}.fill-background{fill:hsl(var(--background))}.fill-current{fill:currentColor}.fill-foreground{fill:hsl(var(--foreground))}.fill-muted{fill:hsl(var(--muted))}.stroke-border{stroke:hsl(var(--border))}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-\[1px\]{padding:1px}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-1{padding-left:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-xs\/6{font-size:var(--text-xs);line-height:calc(var(--spacing) * 6)}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-600\/80{color:#155dfccc}@supports (color:color-mix(in lab, red, red)){.text-blue-600\/80{color:color-mix(in oklab, var(--color-blue-600) 80%, transparent)}}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-600{color:var(--color-cyan-600)}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-destructive\/80{color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.text-destructive\/80{color:color-mix(in oklab, hsl(var(--destructive)) 80%, transparent)}}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-foreground,.text-foreground\/50{color:hsl(var(--foreground))}@supports (color:color-mix(in lab, red, red)){.text-foreground\/50{color:color-mix(in oklab, hsl(var(--foreground)) 50%, transparent)}}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-muted-foreground,.text-muted-foreground\/40{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\/40{color:color-mix(in oklab, hsl(var(--muted-foreground)) 40%, transparent)}}.text-muted-foreground\/50{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\/50{color:color-mix(in oklab, hsl(var(--muted-foreground)) 50%, transparent)}}.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\/60{color:color-mix(in oklab, hsl(var(--muted-foreground)) 60%, transparent)}}.text-orange-600{color:var(--color-orange-600)}.text-orange-800{color:var(--color-orange-800)}.text-pink-600{color:var(--color-pink-600)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-500{color:var(--color-purple-500)}.text-purple-600{color:var(--color-purple-600)}.text-purple-800{color:var(--color-purple-800)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground,.text-sidebar-foreground\/50{color:hsl(var(--sidebar-foreground))}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\/50{color:color-mix(in oklab, hsl(var(--sidebar-foreground)) 50%, transparent)}}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground))}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\/70{color:color-mix(in oklab, hsl(var(--sidebar-foreground)) 70%, transparent)}}.text-yellow-600{color:var(--color-yellow-600)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:hsl(var(--primary))}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,hsl(var(--sidebar-border)));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-sidebar-ring{--tw-ring-color:hsl(var(--sidebar-ring))}.ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[margin\,opa\]{transition-property:margin,opa;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-linear{--tw-ease:linear;transition-timing-function:linear}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.group-focus-within\/menu-item\:opacity-100:is(:where(.group\/menu-item):focus-within *){opacity:1}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *),.group-hover\/menu-item\:opacity-100:is(:where(.group\/menu-item):hover *){opacity:1}}.group-has-\[\[data-sidebar\=menu-action\]\]\/menu-item\:pr-8:is(:where(.group\/menu-item):has([data-sidebar=menu-action]) *){padding-right:calc(var(--spacing) * 8)}.group-data-\[collapsible\=icon\]\:hidden:is(:where(.group)[data-collapsible=icon] *){display:none}.group-data-\[collapsible\=icon\]\:\!size-8:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--spacing) * 8)!important;height:calc(var(--spacing) * 8)!important}.group-data-\[collapsible\=icon\]\:\!p-0:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 0)!important}.group-data-\[collapsible\=icon\]\:\!p-2:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 2)!important}.group-data-\[collapsible\=offcanvas\]\:translate-x-0:is(:where(.group)[data-collapsible=offcanvas] *){--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[side\=left\]\:-right-4:is(:where(.group)[data-side=left] *){right:calc(var(--spacing) * -4)}.group-data-\[side\=right\]\:left-0:is(:where(.group)[data-side=right] *){left:calc(var(--spacing) * 0)}.group-\[\.destructive\]\:border-muted\/40:is(:where(.group).destructive *){border-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.group-\[\.destructive\]\:border-muted\/40:is(:where(.group).destructive *){border-color:color-mix(in oklab, hsl(var(--muted)) 40%, transparent)}}.group-\[\.destructive\]\:text-red-300:is(:where(.group).destructive *){color:var(--color-red-300)}@media (hover:hover){.peer-hover\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button):hover~*){color:hsl(var(--sidebar-accent-foreground))}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button)[data-active=true]~*){color:hsl(var(--sidebar-accent-foreground))}.peer-data-\[size\=default\]\/menu-button\:top-1\.5:is(:where(.peer\/menu-button)[data-size=default]~*){top:calc(var(--spacing) * 1.5)}.peer-data-\[size\=lg\]\/menu-button\:top-2\.5:is(:where(.peer\/menu-button)[data-size=lg]~*){top:calc(var(--spacing) * 2.5)}.peer-data-\[size\=sm\]\/menu-button\:top-1:is(:where(.peer\/menu-button)[data-size=sm]~*){top:calc(var(--spacing) * 1)}.peer-data-\[variant\=inset\]\:min-h-\[calc\(100svh-theme\(spacing\.4\)\)\]:is(:where(.peer)[data-variant=inset]~*){min-height:calc(100svh - 1rem)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:calc(var(--spacing) * -2)}.after\:inset-y-0:after{content:var(--tw-content);inset-block:calc(var(--spacing) * 0)}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:calc(var(--spacing) * 1)}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[collapsible\=offcanvas\]\:after\:left-full:is(:where(.group)[data-collapsible=offcanvas] *):after{content:var(--tw-content);left:100%}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media (hover:hover){.hover\:border-border:hover{border-color:hsl(var(--border))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab, hsl(var(--primary)) 50%, transparent)}}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-background:hover,.hover\:bg-background\/50:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-background\/50:hover{background-color:color-mix(in oklab, hsl(var(--background)) 50%, transparent)}}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/80:hover{background-color:color-mix(in oklab, hsl(var(--destructive)) 80%, transparent)}}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab, hsl(var(--destructive)) 90%, transparent)}}.hover\:bg-emerald-100:hover{background-color:var(--color-emerald-100)}.hover\:bg-muted:hover,.hover\:bg-muted\/30:hover{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/30:hover{background-color:color-mix(in oklab, hsl(var(--muted)) 30%, transparent)}}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab, hsl(var(--muted)) 50%, transparent)}}.hover\:bg-muted\/60:hover{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/60:hover{background-color:color-mix(in oklab, hsl(var(--muted)) 60%, transparent)}}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/80:hover{background-color:color-mix(in oklab, hsl(var(--primary)) 80%, transparent)}}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab, hsl(var(--primary)) 90%, transparent)}}.hover\:bg-secondary:hover,.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab, hsl(var(--secondary)) 80%, transparent)}}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-transparent:hover{background-color:#0000}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-sidebar-foreground:hover{color:hsl(var(--sidebar-foreground))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow:0 0 0 1px var(--tw-shadow-color,hsl(var(--sidebar-accent)));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-data-\[collapsible\=offcanvas\]\:hover\:bg-sidebar:is(:where(.group)[data-collapsible=offcanvas] *):hover{background-color:hsl(var(--sidebar-background))}.group-\[\.destructive\]\:hover\:border-destructive\/30:is(:where(.group).destructive *):hover{border-color:hsl(var(--destructive))}@supports (color:color-mix(in lab, red, red)){.group-\[\.destructive\]\:hover\:border-destructive\/30:is(:where(.group).destructive *):hover{border-color:color-mix(in oklab, hsl(var(--destructive)) 30%, transparent)}}.group-\[\.destructive\]\:hover\:bg-destructive:is(:where(.group).destructive *):hover{background-color:hsl(var(--destructive))}.group-\[\.destructive\]\:hover\:text-destructive-foreground:is(:where(.group).destructive *):hover{color:hsl(var(--destructive-foreground))}.group-\[\.destructive\]\:hover\:text-red-50:is(:where(.group).destructive *):hover{color:var(--color-red-50)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-destructive:focus{color:hsl(var(--destructive))}.focus\:opacity-100:focus{opacity:1}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.group-\[\.destructive\]\:focus\:ring-destructive:is(:where(.group).destructive *):focus{--tw-ring-color:hsl(var(--destructive))}.group-\[\.destructive\]\:focus\:ring-red-400:is(:where(.group).destructive *):focus{--tw-ring-color:var(--color-red-400)}.group-\[\.destructive\]\:focus\:ring-offset-red-600:is(:where(.group).destructive *):focus{--tw-ring-offset-color:var(--color-red-600)}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:ring-sidebar-ring:focus-visible{--tw-ring-color:hsl(var(--sidebar-ring))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-data-\[variant\=inset\]\:bg-sidebar:has([data-variant=inset]){background-color:hsl(var(--sidebar-background))}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[active\=true\]\:font-medium[data-active=true]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:calc(var(--spacing) * 0)}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:calc(var(--spacing) * 1)}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing) * 4);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=closed\]\:duration-300[data-state=closed]{--tw-duration:.3s;transition-duration:.3s}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[state\=open\]\:duration-500[data-state=open]{--tw-duration:.5s;transition-duration:.5s}@media (hover:hover){.data-\[state\=open\]\:hover\:bg-sidebar-accent[data-state=open]:hover{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground[data-state=open]:hover{color:hsl(var(--sidebar-accent-foreground))}}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x:var(--radix-toast-swipe-end-x);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x:var(--radix-toast-swipe-move-x);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}@media (width>=40rem){.sm\:top-auto{top:auto}.sm\:right-0{right:calc(var(--spacing) * 0)}.sm\:bottom-0{bottom:calc(var(--spacing) * 0)}.sm\:flex{display:flex}.sm\:inline{display:inline}.sm\:inline-flex{display:inline-flex}.sm\:w-28{width:calc(var(--spacing) * 28)}.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:max-w-sm{max-width:var(--container-sm)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[1fr_1fr_140px\]{grid-template-columns:1fr 1fr 140px}.sm\:flex-col{flex-direction:column}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2\.5{gap:calc(var(--spacing) * 2.5)}:where(.sm\:space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}@media (width>=48rem){.md\:block{display:block}.md\:flex{display:flex}.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:opacity-0{opacity:0}.md\:peer-data-\[variant\=inset\]\:m-2:is(:where(.peer)[data-variant=inset]~*){margin:calc(var(--spacing) * 2)}.md\:peer-data-\[variant\=inset\]\:ml-0:is(:where(.peer)[data-variant=inset]~*){margin-left:calc(var(--spacing) * 0)}.md\:peer-data-\[variant\=inset\]\:rounded-xl:is(:where(.peer)[data-variant=inset]~*){border-radius:calc(var(--radius) + 4px)}.md\:peer-data-\[variant\=inset\]\:shadow:is(:where(.peer)[data-variant=inset]~*){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.md\:peer-data-\[state\=collapsed\]\:peer-data-\[variant\=inset\]\:ml-2:is(:where(.peer)[data-state=collapsed]~*):is(:where(.peer)[data-variant=inset]~*){margin-left:calc(var(--spacing) * 2)}}.after\:md\:hidden:after{content:var(--tw-content)}@media (width>=48rem){.after\:md\:hidden:after{display:none}}@media (width>=64rem){.lg\:inline-flex{display:inline-flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-\[1fr_320px\]{grid-template-columns:1fr 320px}.lg\:grid-cols-\[240px_1fr\]{grid-template-columns:240px 1fr}.lg\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}.lg\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.lg\:pr-4{padding-right:calc(var(--spacing) * 4)}}.dark\:scale-0:is(.dark *){--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x) var(--tw-scale-y)}.dark\:scale-100:is(.dark *){--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.dark\:-rotate-90:is(.dark *){rotate:-90deg}.dark\:rotate-0:is(.dark *){rotate:0deg}.dark\:border-amber-800:is(.dark *){border-color:var(--color-amber-800)}.dark\:border-blue-800:is(.dark *){border-color:var(--color-blue-800)}.dark\:border-cyan-800:is(.dark *){border-color:var(--color-cyan-800)}.dark\:border-emerald-800:is(.dark *){border-color:var(--color-emerald-800)}.dark\:border-gray-700:is(.dark *){border-color:var(--color-gray-700)}.dark\:border-gray-800:is(.dark *){border-color:var(--color-gray-800)}.dark\:border-orange-800:is(.dark *){border-color:var(--color-orange-800)}.dark\:border-pink-800:is(.dark *){border-color:var(--color-pink-800)}.dark\:border-purple-800:is(.dark *){border-color:var(--color-purple-800)}.dark\:border-red-800:is(.dark *){border-color:var(--color-red-800)}.dark\:bg-amber-950:is(.dark *){background-color:var(--color-amber-950)}.dark\:bg-amber-950\/50:is(.dark *){background-color:#46190180}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-950\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-amber-950) 50%, transparent)}}.dark\:bg-blue-900:is(.dark *){background-color:var(--color-blue-900)}.dark\:bg-blue-950:is(.dark *){background-color:var(--color-blue-950)}.dark\:bg-blue-950\/50:is(.dark *){background-color:#16245680}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-950\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-blue-950) 50%, transparent)}}.dark\:bg-cyan-950:is(.dark *){background-color:var(--color-cyan-950)}.dark\:bg-emerald-950:is(.dark *){background-color:var(--color-emerald-950)}.dark\:bg-emerald-950\/50:is(.dark *){background-color:#002c2280}@supports (color:color-mix(in lab, red, red)){.dark\:bg-emerald-950\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-emerald-950) 50%, transparent)}}.dark\:bg-gray-900:is(.dark *){background-color:var(--color-gray-900)}.dark\:bg-gray-950:is(.dark *){background-color:var(--color-gray-950)}.dark\:bg-green-900:is(.dark *){background-color:var(--color-green-900)}.dark\:bg-orange-900:is(.dark *){background-color:var(--color-orange-900)}.dark\:bg-orange-950:is(.dark *){background-color:var(--color-orange-950)}.dark\:bg-pink-950:is(.dark *){background-color:var(--color-pink-950)}.dark\:bg-purple-900:is(.dark *){background-color:var(--color-purple-900)}.dark\:bg-purple-950:is(.dark *){background-color:var(--color-purple-950)}.dark\:bg-red-950\/50:is(.dark *){background-color:#46080980}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-950\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-red-950) 50%, transparent)}}.dark\:text-amber-400:is(.dark *){color:var(--color-amber-400)}.dark\:text-blue-200:is(.dark *){color:var(--color-blue-200)}.dark\:text-blue-300:is(.dark *){color:var(--color-blue-300)}.dark\:text-blue-300\/80:is(.dark *){color:#90c5ffcc}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-300\/80:is(.dark *){color:color-mix(in oklab, var(--color-blue-300) 80%, transparent)}}.dark\:text-blue-400:is(.dark *){color:var(--color-blue-400)}.dark\:text-cyan-400:is(.dark *){color:var(--color-cyan-400)}.dark\:text-emerald-400:is(.dark *){color:var(--color-emerald-400)}.dark\:text-gray-200:is(.dark *){color:var(--color-gray-200)}.dark\:text-gray-400:is(.dark *){color:var(--color-gray-400)}.dark\:text-green-200:is(.dark *){color:var(--color-green-200)}.dark\:text-green-300:is(.dark *){color:var(--color-green-300)}.dark\:text-green-400:is(.dark *){color:var(--color-green-400)}.dark\:text-orange-200:is(.dark *){color:var(--color-orange-200)}.dark\:text-orange-400:is(.dark *){color:var(--color-orange-400)}.dark\:text-pink-400:is(.dark *){color:var(--color-pink-400)}.dark\:text-purple-200:is(.dark *){color:var(--color-purple-200)}.dark\:text-purple-400:is(.dark *){color:var(--color-purple-400)}.dark\:text-red-400:is(.dark *){color:var(--color-red-400)}.dark\:text-yellow-400:is(.dark *){color:var(--color-yellow-400)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing) * 0)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\[\&\>span\:last-child\]\:truncate>span:last-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.\[\&\>svg\]\:size-3\.5>svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&\>svg\]\:size-4>svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>tr\]\:last\:border-b-0>tr:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{rotate:90deg}[data-side=left] .\[\[data-side\=left\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:calc(var(--spacing) * -2)}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize,[data-side=right] .\[\[data-side\=right\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:calc(var(--spacing) * -2)}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}}:root{--radius:.625rem;--background:0 0% 100%;--foreground:240 10% 3.9%;--card:0 0% 100%;--card-foreground:240 10% 3.9%;--popover:0 0% 100%;--popover-foreground:240 10% 3.9%;--primary:240 5.9% 10%;--primary-foreground:0 0% 98%;--secondary:240 4.8% 95.9%;--secondary-foreground:240 5.9% 10%;--muted:240 4.8% 95.9%;--muted-foreground:240 3.8% 46.1%;--accent:240 4.8% 95.9%;--accent-foreground:240 5.9% 10%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:240 5.9% 90%;--input:240 5.9% 90%;--ring:240 5.9% 10%;--chart-1:12 76% 61%;--chart-2:173 58% 39%;--chart-3:197 37% 24%;--chart-4:43 74% 66%;--chart-5:27 87% 67%;--sidebar-background:0 0% 98%;--sidebar-foreground:240 5.3% 26.1%;--sidebar-primary:240 5.9% 10%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:240 4.8% 95.9%;--sidebar-accent-foreground:240 5.9% 10%;--sidebar-border:220 13% 91%;--sidebar-ring:240 5.9% 10%}.dark{--background:240 10% 3.9%;--foreground:0 0% 98%;--card:240 10% 3.9%;--card-foreground:0 0% 98%;--popover:240 10% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:240 5.9% 10%;--secondary:240 3.7% 15.9%;--secondary-foreground:0 0% 98%;--muted:240 3.7% 15.9%;--muted-foreground:240 5% 64.9%;--accent:240 3.7% 15.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:240 3.7% 15.9%;--input:240 3.7% 15.9%;--ring:240 4.9% 83.9%;--chart-1:220 70% 50%;--chart-2:160 60% 45%;--chart-3:30 80% 55%;--chart-4:280 65% 60%;--chart-5:340 75% 55%;--sidebar-background:240 5.9% 10%;--sidebar-foreground:240 4.8% 95.9%;--sidebar-primary:224.3 76.3% 48%;--sidebar-primary-foreground:0 0% 100%;--sidebar-accent:240 3.7% 15.9%;--sidebar-accent-foreground:240 4.8% 95.9%;--sidebar-border:240 3.7% 15.9%;--sidebar-ring:240 4.9% 83.9%}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}} diff --git a/apps/server/public/index.html b/apps/server/public/index.html deleted file mode 100644 index 503023f09..000000000 --- a/apps/server/public/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - ObjectStack Studio - - - - - - -
- - diff --git a/apps/server/public/mockServiceWorker.js b/apps/server/public/mockServiceWorker.js deleted file mode 100644 index 86e26f3b6..000000000 --- a/apps/server/public/mockServiceWorker.js +++ /dev/null @@ -1,349 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ - -/** - * Mock Service Worker. - * @see https://github.com/mswjs/msw - * - Please do NOT modify this file. - */ - -const PACKAGE_VERSION = '2.13.3' -const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82' -const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') -const activeClientIds = new Set() - -addEventListener('install', function () { - self.skipWaiting() -}) - -addEventListener('activate', function (event) { - event.waitUntil(self.clients.claim()) -}) - -addEventListener('message', async function (event) { - const clientId = Reflect.get(event.source || {}, 'id') - - if (!clientId || !self.clients) { - return - } - - const client = await self.clients.get(clientId) - - if (!client) { - return - } - - const allClients = await self.clients.matchAll({ - type: 'window', - }) - - switch (event.data) { - case 'KEEPALIVE_REQUEST': { - sendToClient(client, { - type: 'KEEPALIVE_RESPONSE', - }) - break - } - - case 'INTEGRITY_CHECK_REQUEST': { - sendToClient(client, { - type: 'INTEGRITY_CHECK_RESPONSE', - payload: { - packageVersion: PACKAGE_VERSION, - checksum: INTEGRITY_CHECKSUM, - }, - }) - break - } - - case 'MOCK_ACTIVATE': { - activeClientIds.add(clientId) - - sendToClient(client, { - type: 'MOCKING_ENABLED', - payload: { - client: { - id: client.id, - frameType: client.frameType, - }, - }, - }) - break - } - - case 'CLIENT_CLOSED': { - activeClientIds.delete(clientId) - - const remainingClients = allClients.filter((client) => { - return client.id !== clientId - }) - - // Unregister itself when there are no more clients - if (remainingClients.length === 0) { - self.registration.unregister() - } - - break - } - } -}) - -addEventListener('fetch', function (event) { - const requestInterceptedAt = Date.now() - - // Bypass navigation requests. - if (event.request.mode === 'navigate') { - return - } - - // Opening the DevTools triggers the "only-if-cached" request - // that cannot be handled by the worker. Bypass such requests. - if ( - event.request.cache === 'only-if-cached' && - event.request.mode !== 'same-origin' - ) { - return - } - - // Bypass all requests when there are no active clients. - // Prevents the self-unregistered worked from handling requests - // after it's been terminated (still remains active until the next reload). - if (activeClientIds.size === 0) { - return - } - - const requestId = crypto.randomUUID() - event.respondWith(handleRequest(event, requestId, requestInterceptedAt)) -}) - -/** - * @param {FetchEvent} event - * @param {string} requestId - * @param {number} requestInterceptedAt - */ -async function handleRequest(event, requestId, requestInterceptedAt) { - const client = await resolveMainClient(event) - const requestCloneForEvents = event.request.clone() - const response = await getResponse( - event, - client, - requestId, - requestInterceptedAt, - ) - - // Send back the response clone for the "response:*" life-cycle events. - // Ensure MSW is active and ready to handle the message, otherwise - // this message will pend indefinitely. - if (client && activeClientIds.has(client.id)) { - const serializedRequest = await serializeRequest(requestCloneForEvents) - - // Clone the response so both the client and the library could consume it. - const responseClone = response.clone() - - sendToClient( - client, - { - type: 'RESPONSE', - payload: { - isMockedResponse: IS_MOCKED_RESPONSE in response, - request: { - id: requestId, - ...serializedRequest, - }, - response: { - type: responseClone.type, - status: responseClone.status, - statusText: responseClone.statusText, - headers: Object.fromEntries(responseClone.headers.entries()), - body: responseClone.body, - }, - }, - }, - responseClone.body ? [serializedRequest.body, responseClone.body] : [], - ) - } - - return response -} - -/** - * Resolve the main client for the given event. - * Client that issues a request doesn't necessarily equal the client - * that registered the worker. It's with the latter the worker should - * communicate with during the response resolving phase. - * @param {FetchEvent} event - * @returns {Promise} - */ -async function resolveMainClient(event) { - const client = await self.clients.get(event.clientId) - - if (activeClientIds.has(event.clientId)) { - return client - } - - if (client?.frameType === 'top-level') { - return client - } - - const allClients = await self.clients.matchAll({ - type: 'window', - }) - - return allClients - .filter((client) => { - // Get only those clients that are currently visible. - return client.visibilityState === 'visible' - }) - .find((client) => { - // Find the client ID that's recorded in the - // set of clients that have registered the worker. - return activeClientIds.has(client.id) - }) -} - -/** - * @param {FetchEvent} event - * @param {Client | undefined} client - * @param {string} requestId - * @param {number} requestInterceptedAt - * @returns {Promise} - */ -async function getResponse(event, client, requestId, requestInterceptedAt) { - // Clone the request because it might've been already used - // (i.e. its body has been read and sent to the client). - const requestClone = event.request.clone() - - function passthrough() { - // Cast the request headers to a new Headers instance - // so the headers can be manipulated with. - const headers = new Headers(requestClone.headers) - - // Remove the "accept" header value that marked this request as passthrough. - // This prevents request alteration and also keeps it compliant with the - // user-defined CORS policies. - const acceptHeader = headers.get('accept') - if (acceptHeader) { - const values = acceptHeader.split(',').map((value) => value.trim()) - const filteredValues = values.filter( - (value) => value !== 'msw/passthrough', - ) - - if (filteredValues.length > 0) { - headers.set('accept', filteredValues.join(', ')) - } else { - headers.delete('accept') - } - } - - return fetch(requestClone, { headers }) - } - - // Bypass mocking when the client is not active. - if (!client) { - return passthrough() - } - - // Bypass initial page load requests (i.e. static assets). - // The absence of the immediate/parent client in the map of the active clients - // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet - // and is not ready to handle requests. - if (!activeClientIds.has(client.id)) { - return passthrough() - } - - // Notify the client that a request has been intercepted. - const serializedRequest = await serializeRequest(event.request) - const clientMessage = await sendToClient( - client, - { - type: 'REQUEST', - payload: { - id: requestId, - interceptedAt: requestInterceptedAt, - ...serializedRequest, - }, - }, - [serializedRequest.body], - ) - - switch (clientMessage.type) { - case 'MOCK_RESPONSE': { - return respondWithMock(clientMessage.data) - } - - case 'PASSTHROUGH': { - return passthrough() - } - } - - return passthrough() -} - -/** - * @param {Client} client - * @param {any} message - * @param {Array} transferrables - * @returns {Promise} - */ -function sendToClient(client, message, transferrables = []) { - return new Promise((resolve, reject) => { - const channel = new MessageChannel() - - channel.port1.onmessage = (event) => { - if (event.data && event.data.error) { - return reject(event.data.error) - } - - resolve(event.data) - } - - client.postMessage(message, [ - channel.port2, - ...transferrables.filter(Boolean), - ]) - }) -} - -/** - * @param {Response} response - * @returns {Response} - */ -function respondWithMock(response) { - // Setting response status code to 0 is a no-op. - // However, when responding with a "Response.error()", the produced Response - // instance will have status code set to 0. Since it's not possible to create - // a Response instance with status code 0, handle that use-case separately. - if (response.status === 0) { - return Response.error() - } - - const mockedResponse = new Response(response.body, response) - - Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, { - value: true, - enumerable: true, - }) - - return mockedResponse -} - -/** - * @param {Request} request - */ -async function serializeRequest(request) { - return { - url: request.url, - mode: request.mode, - method: request.method, - headers: Object.fromEntries(request.headers.entries()), - cache: request.cache, - credentials: request.credentials, - destination: request.destination, - integrity: request.integrity, - redirect: request.redirect, - referrer: request.referrer, - referrerPolicy: request.referrerPolicy, - body: await request.arrayBuffer(), - keepalive: request.keepalive, - } -} diff --git a/apps/server/public/vite.svg b/apps/server/public/vite.svg deleted file mode 100644 index 896c26fc4..000000000 --- a/apps/server/public/vite.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - -