@agent-team-foundation/first-tree-hub 0.9.9 → 0.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import "../observability-DV_fQKqV-CuLWzBxQ.mjs";
3
- import { $ as configureClientLoggerForService, A as checkServerHealth, B as createOwner, C as runMigrations, D as checkDocker, E as checkDatabase, G as setJsonMode, H as resolveReplyToFromEnv, I as stopPostgres, J as FirstTreeHubSDK, L as ClientRuntime, M as checkWebSocket, N as printResults, O as checkNodeVersion, Q as applyClientLoggerConfig, R as handleClientOrgMismatch, S as uninstallClientService, T as checkClientConfig, W as print, X as SessionRegistry, Y as SdkError, Z as cleanWorkspaces, _ as runHomeMigration, a as showServiceLogs, b as isServiceSupported, c as COMMAND_VERSION, d as promptMissingFields, f as formatCheckReport, g as saveOnboardState, h as onboardCreate, i as parseDuration, j as checkServerReachable, k as checkServerConfig, l as isInteractive, m as onboardCheck, n as declineUpdate, o as validateLevel, p as loadOnboardState, q as ClientOrgMismatchError, r as promptUpdate, s as startServer, t as createExecuteUpdate, u as promptAddAgent, v as getClientServiceStatus, w as checkAgentConfigs, y as installClientService } from "../core-B2YUTpgg.mjs";
3
+ import { $ as configureClientLoggerForService, A as checkServerHealth, B as createOwner, C as runMigrations, D as checkDocker, E as checkDatabase, G as setJsonMode, H as resolveReplyToFromEnv, I as stopPostgres, J as FirstTreeHubSDK, L as ClientRuntime, M as checkWebSocket, N as printResults, O as checkNodeVersion, Q as applyClientLoggerConfig, R as handleClientOrgMismatch, S as uninstallClientService, T as checkClientConfig, W as print, X as SessionRegistry, Y as SdkError, Z as cleanWorkspaces, _ as runHomeMigration, a as showServiceLogs, b as isServiceSupported, c as COMMAND_VERSION, d as promptMissingFields, f as formatCheckReport, g as saveOnboardState, h as onboardCreate, i as parseDuration, j as checkServerReachable, k as checkServerConfig, l as isInteractive, m as onboardCheck, n as declineUpdate, o as validateLevel, p as loadOnboardState, q as ClientOrgMismatchError, r as promptUpdate, s as startServer, t as createExecuteUpdate, u as promptAddAgent, v as getClientServiceStatus, w as checkAgentConfigs, y as installClientService } from "../core-BWaSYpXv.mjs";
4
4
  import "../logger-core-BTmvdflj-DhdipBkV.mjs";
5
5
  import { C as serverConfigSchema, _ as loadAgents, b as resetConfig, c as saveCredentials, d as DEFAULT_HOME_DIR, f as agentConfigSchema, g as initConfig, h as getConfigValue, i as loadCredentials, l as DEFAULT_CONFIG_DIR, n as ensureFreshAccessToken, o as resolveServerUrl, p as clientConfigSchema, r as ensureFreshAdminToken, s as saveAgentConfig, u as DEFAULT_DATA_DIR, w as setConfigValue, x as resetConfigMeta, y as readConfigFile } from "../bootstrap-hh_PkTu6.mjs";
6
- import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-B1Kiq7S6.mjs";
6
+ import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-BJaN64iR.mjs";
7
7
  import { join } from "node:path";
8
8
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync } from "node:fs";
9
9
  import { Command } from "commander";
@@ -90,7 +90,7 @@ function registerAgentConfigCommands(parent) {
90
90
  const { uuid } = await resolveAgentRecord(serverUrl, adminToken, agentName);
91
91
  printConfig(await getCurrent(serverUrl, adminToken, uuid));
92
92
  });
93
- config.command("set-model <agent> <model>").description("Replace the model field (e.g. claude-opus-4-6)").action(async (agentName, model) => {
93
+ config.command("set-model <agent> <model>").description("Replace the model field (alias: opus, sonnet, haiku — or a full id like claude-opus-4-7)").action(async (agentName, model) => {
94
94
  const serverUrl = resolveServerUrl(process.env.FIRST_TREE_HUB_SERVER_URL);
95
95
  const adminToken = await ensureFreshAdminToken();
96
96
  const { uuid } = await resolveAgentRecord(serverUrl, adminToken, agentName);
@@ -2,7 +2,7 @@ import { m as __toESM } from "./esm-CYu4tXXn.mjs";
2
2
  import { _ as withSpan, a as endWsConnectionSpan, b as require_pino, c as messageAttrs, d as rootLogger$1, g as startWsConnectionSpan, i as currentTraceId, n as applyLoggerConfig, o as getFastifyOtelPlugin, p as setWsConnectionAttrs, r as createLogger$1, t as adapterAttrs, u as observabilityPlugin, v as withWsMessageSpan, y as FIRST_TREE_HUB_ATTR } from "./observability-DV_fQKqV-CuLWzBxQ.mjs";
3
3
  import { s as formatPrettyEntry$1, t as LOG_LEVELS$1, u as parseLogLevel$1 } from "./logger-core-BTmvdflj-DhdipBkV.mjs";
4
4
  import { C as serverConfigSchema, S as resolveConfigReadonly, _ as loadAgents, d as DEFAULT_HOME_DIR$1, f as agentConfigSchema, g as initConfig, i as loadCredentials, l as DEFAULT_CONFIG_DIR, m as collectMissingPrompts, n as ensureFreshAccessToken, o as resolveServerUrl, p as clientConfigSchema, s as saveAgentConfig, u as DEFAULT_DATA_DIR$1, v as migrateLegacyHome, w as setConfigValue } from "./bootstrap-hh_PkTu6.mjs";
5
- import { $ as sessionStateMessageSchema, A as createMemberSchema, B as loginSchema, C as agentTypeSchema$1, D as createAdapterMappingSchema, E as createAdapterConfigSchema, F as extractMentions, G as runtimeStateMessageSchema, H as notificationQuerySchema, I as imageInlineContentSchema, J as sendToAgentSchema, K as selfServiceFeishuBotSchema, L as inboxPollQuerySchema, M as createTaskSchema, N as delegateFeishuUserSchema, O as createAgentSchema, P as dryRunAgentRuntimeConfigSchema, Q as sessionReconcileRequestSchema, R as isRedactedEnvValue, S as agentRuntimeConfigPayloadSchema$1, T as connectTokenExchangeSchema, U as paginationQuerySchema, V as messageSourceSchema$1, W as refreshTokenSchema, X as sessionEventMessageSchema, Y as sessionCompletionMessageSchema, Z as sessionEventSchema$1, _ as addParticipantSchema, a as AGENT_SELECTOR_HEADER$1, at as updateMemberSchema, b as agentBindRequestSchema, c as AGENT_TYPES, ct as updateTaskStatusSchema, d as SYSTEM_CONFIG_DEFAULTS, et as taskListQuerySchema, f as TASK_CREATOR_TYPES, g as WS_AUTH_FRAME_TIMEOUT_MS, h as TASK_TERMINAL_STATUSES, i as AGENT_BIND_REJECT_REASONS, it as updateChatSchema, j as createOrganizationSchema, k as createChatSchema, l as AGENT_VISIBILITY, lt as wsAuthFrameSchema, m as TASK_STATUSES, nt as updateAgentRuntimeConfigSchema, o as AGENT_SOURCES, ot as updateOrganizationSchema, p as TASK_HEALTH_SIGNALS, q as sendMessageSchema, rt as updateAgentSchema, s as AGENT_STATUSES, st as updateSystemConfigSchema, tt as updateAdapterConfigSchema, u as DEFAULT_AGENT_RUNTIME_CONFIG_PAYLOAD, v as adminCreateTaskSchema, w as clientRegisterSchema, x as agentPinnedMessageSchema$1, y as adminUpdateTaskSchema, z as linkTaskChatSchema } from "./feishu-B1Kiq7S6.mjs";
5
+ import { $ as sessionStateMessageSchema, A as createMemberSchema, B as loginSchema, C as agentTypeSchema$1, D as createAdapterMappingSchema, E as createAdapterConfigSchema, F as extractMentions, G as runtimeStateMessageSchema, H as notificationQuerySchema, I as imageInlineContentSchema, J as sendToAgentSchema, K as selfServiceFeishuBotSchema, L as inboxPollQuerySchema, M as createTaskSchema, N as delegateFeishuUserSchema, O as createAgentSchema, P as dryRunAgentRuntimeConfigSchema, Q as sessionReconcileRequestSchema, R as isRedactedEnvValue, S as agentRuntimeConfigPayloadSchema$1, T as connectTokenExchangeSchema, U as paginationQuerySchema, V as messageSourceSchema$1, W as refreshTokenSchema, X as sessionEventMessageSchema, Y as sessionCompletionMessageSchema, Z as sessionEventSchema$1, _ as addParticipantSchema, a as AGENT_SELECTOR_HEADER$1, at as updateMemberSchema, b as agentBindRequestSchema, c as AGENT_TYPES, ct as updateTaskStatusSchema, d as SYSTEM_CONFIG_DEFAULTS, et as taskListQuerySchema, f as TASK_CREATOR_TYPES, g as WS_AUTH_FRAME_TIMEOUT_MS, h as TASK_TERMINAL_STATUSES, i as AGENT_BIND_REJECT_REASONS, it as updateChatSchema, j as createOrganizationSchema, k as createChatSchema, l as AGENT_VISIBILITY, lt as wsAuthFrameSchema, m as TASK_STATUSES, nt as updateAgentRuntimeConfigSchema, o as AGENT_SOURCES, ot as updateOrganizationSchema, p as TASK_HEALTH_SIGNALS, q as sendMessageSchema, rt as updateAgentSchema, s as AGENT_STATUSES, st as updateSystemConfigSchema, tt as updateAdapterConfigSchema, u as DEFAULT_AGENT_RUNTIME_CONFIG_PAYLOAD, v as adminCreateTaskSchema, w as clientRegisterSchema, x as agentPinnedMessageSchema$1, y as adminUpdateTaskSchema, z as linkTaskChatSchema } from "./feishu-BJaN64iR.mjs";
6
6
  import { createRequire } from "node:module";
7
7
  import { ZodError, z } from "zod";
8
8
  import { delimiter, dirname, isAbsolute, join, resolve } from "node:path";
@@ -541,7 +541,7 @@ const gitRepoSchema = z.object({
541
541
  */
542
542
  const agentRuntimeConfigPayloadShape = z.object({
543
543
  prompt: promptConfigSchema.default({ append: "" }),
544
- model: z.string().default(""),
544
+ model: z.string().default("opus"),
545
545
  mcpServers: z.array(mcpServerSchema).default([]),
546
546
  env: z.array(envEntrySchema).default([]),
547
547
  gitRepos: z.array(gitRepoSchema).default([])
@@ -3161,7 +3161,7 @@ const createClaudeCodeHandler = (config) => {
3161
3161
  abortController,
3162
3162
  permissionMode,
3163
3163
  allowDangerouslySkipPermissions: true,
3164
- settingSources: ["project"],
3164
+ settingSources: ["user", "project"],
3165
3165
  env: buildEnv(sessionCtx),
3166
3166
  ...claudeCodeExecutable ? { pathToClaudeCodeExecutable: claudeCodeExecutable } : {},
3167
3167
  ...payload?.model ? { model: payload.model } : {},
@@ -4848,7 +4848,7 @@ async function createOwner(databaseUrl, username, orgName, displayName, password
4848
4848
  `);
4849
4849
  await tx.execute(sql`
4850
4850
  INSERT INTO agent_configs (agent_id, version, payload, updated_by)
4851
- VALUES (${agentId}, 1, ${sql`'{"prompt":{"append":""},"model":"","mcpServers":[],"env":[],"gitRepos":[]}'::jsonb`}, 'system')
4851
+ VALUES (${agentId}, 1, ${sql`'{"prompt":{"append":""},"model":"opus","mcpServers":[],"env":[],"gitRepos":[]}'::jsonb`}, 'system')
4852
4852
  ON CONFLICT (agent_id) DO NOTHING
4853
4853
  `);
4854
4854
  });
@@ -6279,7 +6279,7 @@ async function onboardCreate(args) {
6279
6279
  }
6280
6280
  const runtimeAgent = args.type === "human" ? args.assistant : args.id;
6281
6281
  if (args.feishuBotAppId && args.feishuBotAppSecret) {
6282
- const { bindFeishuBot } = await import("./feishu-B1Kiq7S6.mjs").then((n) => n.r);
6282
+ const { bindFeishuBot } = await import("./feishu-BJaN64iR.mjs").then((n) => n.r);
6283
6283
  const targetAgentUuid = args.type === "human" ? assistantUuid : primary.uuid;
6284
6284
  if (!targetAgentUuid) print.line(`Warning: Cannot bind Feishu bot — no runtime agent available for "${args.id}".\n`);
6285
6285
  else {
@@ -289,7 +289,7 @@ const gitRepoSchema = z.object({
289
289
  */
290
290
  const agentRuntimeConfigPayloadShape = z.object({
291
291
  prompt: promptConfigSchema.default({ append: "" }),
292
- model: z.string().default(""),
292
+ model: z.string().default("opus"),
293
293
  mcpServers: z.array(mcpServerSchema).default([]),
294
294
  env: z.array(envEntrySchema).default([]),
295
295
  gitRepos: z.array(gitRepoSchema).default([])
@@ -342,7 +342,7 @@ const agentRuntimeConfigPayloadSchema = agentRuntimeConfigPayloadShape.superRefi
342
342
  /** Default payload used when creating a fresh agent. */
343
343
  const DEFAULT_AGENT_RUNTIME_CONFIG_PAYLOAD = {
344
344
  prompt: { append: "" },
345
- model: "",
345
+ model: "opus",
346
346
  mcpServers: [],
347
347
  env: [],
348
348
  gitRepos: []
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./observability-DV_fQKqV-CuLWzBxQ.mjs";
2
- import { A as checkServerHealth, B as createOwner, C as runMigrations, D as checkDocker, E as checkDatabase, F as isDockerAvailable, I as stopPostgres, J as FirstTreeHubSDK, K as status, L as ClientRuntime, M as checkWebSocket, N as printResults, O as checkNodeVersion, P as ensurePostgres, R as handleClientOrgMismatch, S as uninstallClientService, T as checkClientConfig, U as blank, V as hasUser, Y as SdkError, _ as runHomeMigration, b as isServiceSupported, d as promptMissingFields, f as formatCheckReport, h as onboardCreate, j as checkServerReachable, k as checkServerConfig, l as isInteractive, m as onboardCheck, s as startServer, u as promptAddAgent, v as getClientServiceStatus, w as checkAgentConfigs, x as resolveCliInvocation, y as installClientService, z as rotateClientIdWithBackup } from "./core-B2YUTpgg.mjs";
2
+ import { A as checkServerHealth, B as createOwner, C as runMigrations, D as checkDocker, E as checkDatabase, F as isDockerAvailable, I as stopPostgres, J as FirstTreeHubSDK, K as status, L as ClientRuntime, M as checkWebSocket, N as printResults, O as checkNodeVersion, P as ensurePostgres, R as handleClientOrgMismatch, S as uninstallClientService, T as checkClientConfig, U as blank, V as hasUser, Y as SdkError, _ as runHomeMigration, b as isServiceSupported, d as promptMissingFields, f as formatCheckReport, h as onboardCreate, j as checkServerReachable, k as checkServerConfig, l as isInteractive, m as onboardCheck, s as startServer, u as promptAddAgent, v as getClientServiceStatus, w as checkAgentConfigs, x as resolveCliInvocation, y as installClientService, z as rotateClientIdWithBackup } from "./core-BWaSYpXv.mjs";
3
3
  import "./logger-core-BTmvdflj-DhdipBkV.mjs";
4
4
  import { a as resolveAccessToken, n as ensureFreshAccessToken, o as resolveServerUrl, r as ensureFreshAdminToken } from "./bootstrap-hh_PkTu6.mjs";
5
- import { n as bindFeishuUser, t as bindFeishuBot } from "./feishu-B1Kiq7S6.mjs";
5
+ import { n as bindFeishuUser, t as bindFeishuBot } from "./feishu-BJaN64iR.mjs";
6
6
  export { ClientRuntime, FirstTreeHubSDK, SdkError, bindFeishuBot, bindFeishuUser, blank, checkAgentConfigs, checkClientConfig, checkDatabase, checkDocker, checkNodeVersion, checkServerConfig, checkServerHealth, checkServerReachable, checkWebSocket, createOwner, ensureFreshAccessToken, ensureFreshAdminToken, ensurePostgres, formatCheckReport, getClientServiceStatus, handleClientOrgMismatch, hasUser, installClientService, isDockerAvailable, isInteractive, isServiceSupported, onboardCheck, onboardCreate, printResults, promptAddAgent, promptMissingFields, resolveAccessToken, resolveCliInvocation, resolveServerUrl, rotateClientIdWithBackup, runHomeMigration, runMigrations, startServer, status, stopPostgres, uninstallClientService };
@@ -329,7 +329,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
329
329
 
330
330
  `)}x.write("payload.value = newResult;"),x.write("return payload;");const T=x.compile();return(U,B)=>T(b,U,B)};let o;const u=cu,f=!Fk.jitless,h=f&&UD.value,y=t.catchall;let g;e._zod.parse=(b,x)=>{g??(g=i.value);const k=b.value;return u(k)?f&&h&&(x==null?void 0:x.async)===!1&&x.jitless!==!0?(o||(o=l(t.shape)),b=o(b,x),y?ij([],k,b,x,g,e):b):n(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:k,inst:e}),b)}});function a1(e,t,n,i){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const l=e.filter(o=>!ps(o));return l.length===1?(t.value=l[0].value,l[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(u=>ki(u,i,wi())))}),t)}const lj=ie("$ZodUnion",(e,t)=>{Nt.init(e,t),lt(e._zod,"optin",()=>t.options.some(l=>l._zod.optin==="optional")?"optional":void 0),lt(e._zod,"optout",()=>t.options.some(l=>l._zod.optout==="optional")?"optional":void 0),lt(e._zod,"values",()=>{if(t.options.every(l=>l._zod.values))return new Set(t.options.flatMap(l=>Array.from(l._zod.values)))}),lt(e._zod,"pattern",()=>{if(t.options.every(l=>l._zod.pattern)){const l=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${l.map(o=>Tg(o.source)).join("|")})$`)}});const n=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(l,o)=>{if(n)return i(l,o);let u=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:l.value,issues:[]},o);if(h instanceof Promise)f.push(h),u=!0;else{if(h.issues.length===0)return h;f.push(h)}}return u?Promise.all(f).then(m=>a1(m,l,e,o)):a1(f,l,e,o)}}),jM=ie("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,lj.init(e,t);const n=e._zod.parse;lt(e._zod,"propValues",()=>{const l={};for(const o of t.options){const u=o._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[f,m]of Object.entries(u)){l[f]||(l[f]=new Set);for(const h of m)l[f].add(h)}}return l});const i=Gd(()=>{var u;const l=t.options,o=new Map;for(const f of l){const m=(u=f._zod.propValues)==null?void 0:u[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(f)}"`);for(const h of m){if(o.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);o.set(h,f)}}return o});e._zod.parse=(l,o)=>{const u=l.value;if(!cu(u))return l.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),l;const f=i.value.get(u==null?void 0:u[t.discriminator]);return f?f._zod.run(l,o):t.unionFallback?n(l,o):(l.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:u,path:[t.discriminator],inst:e}),l)}}),EM=ie("$ZodIntersection",(e,t)=>{Nt.init(e,t),e._zod.parse=(n,i)=>{const l=n.value,o=t.left._zod.run({value:l,issues:[]},i),u=t.right._zod.run({value:l,issues:[]},i);return o instanceof Promise||u instanceof Promise?Promise.all([o,u]).then(([m,h])=>i1(n,m,h)):i1(n,o,u)}});function $p(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Os(e)&&Os(t)){const n=Object.keys(t),i=Object.keys(e).filter(o=>n.indexOf(o)!==-1),l={...e,...t};for(const o of i){const u=$p(e[o],t[o]);if(!u.valid)return{valid:!1,mergeErrorPath:[o,...u.mergeErrorPath]};l[o]=u.data}return{valid:!0,data:l}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const l=e[i],o=t[i],u=$p(l,o);if(!u.valid)return{valid:!1,mergeErrorPath:[i,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function i1(e,t,n){const i=new Map;let l;for(const f of t.issues)if(f.code==="unrecognized_keys"){l??(l=f);for(const m of f.keys)i.has(m)||i.set(m,{}),i.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)i.has(m)||i.set(m,{}),i.get(m).r=!0;else e.issues.push(f);const o=[...i].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(o.length&&l&&e.issues.push({...l,keys:o}),ps(e))return e;const u=$p(t.value,n.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const CM=ie("$ZodRecord",(e,t)=>{Nt.init(e,t),e._zod.parse=(n,i)=>{const l=n.value;if(!Os(l))return n.issues.push({expected:"record",code:"invalid_type",input:l,inst:e}),n;const o=[],u=t.keyType._zod.values;if(u){n.value={};const f=new Set;for(const h of u)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const y=t.valueType._zod.run({value:l[h],issues:[]},i);y instanceof Promise?o.push(y.then(g=>{g.issues.length&&n.issues.push(...gs(h,g.issues)),n.value[h]=g.value})):(y.issues.length&&n.issues.push(...gs(h,y.issues)),n.value[h]=y.value)}let m;for(const h in l)f.has(h)||(m=m??[],m.push(h));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:l,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(l)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},i);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&Jk.test(f)&&m.issues.length){const g=t.keyType._zod.run({value:Number(f),issues:[]},i);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(m=g)}if(m.issues.length){t.mode==="loose"?n.value[f]=l[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(g=>ki(g,i,wi())),input:f,path:[f],inst:e});continue}const y=t.valueType._zod.run({value:l[f],issues:[]},i);y instanceof Promise?o.push(y.then(g=>{g.issues.length&&n.issues.push(...gs(f,g.issues)),n.value[m.value]=g.value})):(y.issues.length&&n.issues.push(...gs(f,y.issues)),n.value[m.value]=y.value)}}return o.length?Promise.all(o).then(()=>n):n}}),_M=ie("$ZodEnum",(e,t)=>{Nt.init(e,t);const n=qk(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter(l=>BD.has(typeof l)).map(l=>typeof l=="string"?Ds(l):l.toString()).join("|")})$`),e._zod.parse=(l,o)=>{const u=l.value;return i.has(u)||l.issues.push({code:"invalid_value",values:n,input:u,inst:e}),l}}),NM=ie("$ZodLiteral",(e,t)=>{if(Nt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(i=>typeof i=="string"?Ds(i):i?Ds(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,l)=>{const o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),i}}),AM=ie("$ZodTransform",(e,t)=>{Nt.init(e,t),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new $k(e.constructor.name);const l=t.transform(n.value,n);if(i.async)return(l instanceof Promise?l:Promise.resolve(l)).then(u=>(n.value=u,n));if(l instanceof Promise)throw new bs;return n.value=l,n}});function l1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const sj=ie("$ZodOptional",(e,t)=>{Nt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",lt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),lt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Tg(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(t.innerType._zod.optin==="optional"){const l=t.innerType._zod.run(n,i);return l instanceof Promise?l.then(o=>l1(o,n.value)):l1(l,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,i)}}),TM=ie("$ZodExactOptional",(e,t)=>{sj.init(e,t),lt(e._zod,"values",()=>t.innerType._zod.values),lt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),RM=ie("$ZodNullable",(e,t)=>{Nt.init(e,t),lt(e._zod,"optin",()=>t.innerType._zod.optin),lt(e._zod,"optout",()=>t.innerType._zod.optout),lt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Tg(n.source)}|null)$`):void 0}),lt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)}),zM=ie("$ZodDefault",(e,t)=>{Nt.init(e,t),e._zod.optin="optional",lt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;const l=t.innerType._zod.run(n,i);return l instanceof Promise?l.then(o=>s1(o,t)):s1(l,t)}});function s1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const OM=ie("$ZodPrefault",(e,t)=>{Nt.init(e,t),e._zod.optin="optional",lt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))}),DM=ie("$ZodNonOptional",(e,t)=>{Nt.init(e,t),lt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{const l=t.innerType._zod.run(n,i);return l instanceof Promise?l.then(o=>o1(o,e)):o1(l,e)}});function o1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const MM=ie("$ZodCatch",(e,t)=>{Nt.init(e,t),lt(e._zod,"optin",()=>t.innerType._zod.optin),lt(e._zod,"optout",()=>t.innerType._zod.optout),lt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const l=t.innerType._zod.run(n,i);return l instanceof Promise?l.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(u=>ki(u,i,wi()))},input:n.value}),n.issues=[]),n)):(n.value=l.value,l.issues.length&&(n.value=t.catchValue({...n,error:{issues:l.issues.map(o=>ki(o,i,wi()))},input:n.value}),n.issues=[]),n)}}),LM=ie("$ZodPipe",(e,t)=>{Nt.init(e,t),lt(e._zod,"values",()=>t.in._zod.values),lt(e._zod,"optin",()=>t.in._zod.optin),lt(e._zod,"optout",()=>t.out._zod.optout),lt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){const o=t.out._zod.run(n,i);return o instanceof Promise?o.then(u=>nd(u,t.in,i)):nd(o,t.in,i)}const l=t.in._zod.run(n,i);return l instanceof Promise?l.then(o=>nd(o,t.out,i)):nd(l,t.out,i)}});function nd(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const IM=ie("$ZodReadonly",(e,t)=>{Nt.init(e,t),lt(e._zod,"propValues",()=>t.innerType._zod.propValues),lt(e._zod,"values",()=>t.innerType._zod.values),lt(e._zod,"optin",()=>{var n,i;return(i=(n=t.innerType)==null?void 0:n._zod)==null?void 0:i.optin}),lt(e._zod,"optout",()=>{var n,i;return(i=(n=t.innerType)==null?void 0:n._zod)==null?void 0:i.optout}),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const l=t.innerType._zod.run(n,i);return l instanceof Promise?l.then(u1):u1(l)}});function u1(e){return e.value=Object.freeze(e.value),e}const UM=ie("$ZodCustom",(e,t)=>{In.init(e,t),Nt.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{const i=n.value,l=t.fn(i);if(l instanceof Promise)return l.then(o=>c1(o,n,i,e));c1(l,n,i,e)}});function c1(e,t,n,i){if(!e){const l={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(l.params=i._zod.def.params),t.issues.push(du(l))}}var d1;class BM{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const i=n[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const i={...this.get(n)??{}};delete i.id;const l={...i,...this._map.get(t)};return Object.keys(l).length?l:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function PM(){return new BM}(d1=globalThis).__zod_globalRegistry??(d1.__zod_globalRegistry=PM());const Xo=globalThis.__zod_globalRegistry;function $M(e,t){return new e({type:"string",...Ce(t)})}function FM(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ce(t)})}function f1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ce(t)})}function qM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ce(t)})}function HM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ce(t)})}function ZM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ce(t)})}function VM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ce(t)})}function QM(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ce(t)})}function GM(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ce(t)})}function KM(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ce(t)})}function YM(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ce(t)})}function XM(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ce(t)})}function JM(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ce(t)})}function WM(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ce(t)})}function e4(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ce(t)})}function t4(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ce(t)})}function n4(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ce(t)})}function r4(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ce(t)})}function a4(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ce(t)})}function i4(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ce(t)})}function l4(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ce(t)})}function s4(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ce(t)})}function o4(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ce(t)})}function u4(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ce(t)})}function c4(e,t){return new e({type:"string",format:"date",check:"string_format",...Ce(t)})}function d4(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ce(t)})}function f4(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ce(t)})}function h4(e,t){return new e({type:"number",checks:[],...Ce(t)})}function m4(e,t){return new e({type:"number",coerce:!0,checks:[],...Ce(t)})}function p4(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ce(t)})}function g4(e,t){return new e({type:"boolean",...Ce(t)})}function y4(e){return new e({type:"unknown"})}function v4(e,t){return new e({type:"never",...Ce(t)})}function h1(e,t){return new ej({check:"less_than",...Ce(t),value:e,inclusive:!1})}function Bm(e,t){return new ej({check:"less_than",...Ce(t),value:e,inclusive:!0})}function m1(e,t){return new tj({check:"greater_than",...Ce(t),value:e,inclusive:!1})}function Pm(e,t){return new tj({check:"greater_than",...Ce(t),value:e,inclusive:!0})}function p1(e,t){return new z3({check:"multiple_of",...Ce(t),value:e})}function oj(e,t){return new D3({check:"max_length",...Ce(t),maximum:e})}function _d(e,t){return new M3({check:"min_length",...Ce(t),minimum:e})}function uj(e,t){return new L3({check:"length_equals",...Ce(t),length:e})}function b4(e,t){return new I3({check:"string_format",format:"regex",...Ce(t),pattern:e})}function x4(e){return new U3({check:"string_format",format:"lowercase",...Ce(e)})}function S4(e){return new B3({check:"string_format",format:"uppercase",...Ce(e)})}function w4(e,t){return new P3({check:"string_format",format:"includes",...Ce(t),includes:e})}function k4(e,t){return new $3({check:"string_format",format:"starts_with",...Ce(t),prefix:e})}function j4(e,t){return new F3({check:"string_format",format:"ends_with",...Ce(t),suffix:e})}function qs(e){return new q3({check:"overwrite",tx:e})}function E4(e){return qs(t=>t.normalize(e))}function C4(){return qs(e=>e.trim())}function _4(){return qs(e=>e.toLowerCase())}function N4(){return qs(e=>e.toUpperCase())}function A4(){return qs(e=>ID(e))}function T4(e,t,n){return new e({type:"array",element:t,...Ce(n)})}function R4(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ce(n)})}function z4(e){const t=O4(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(du(i,n.value,t._zod.def));else{const l=i;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=n.value),l.inst??(l.inst=t),l.continue??(l.continue=!t._zod.def.abort),n.issues.push(du(l))}},e(n.value,n)));return t}function O4(e,t){const n=new In({check:"custom",...Ce(t)});return n._zod.check=e,n}function cj(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Xo,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Ft(e,t,n={path:[],schemaPath:[]}){var y,g;var i;const l=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const u={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,u);const f=(g=(y=e._zod).toJSONSchema)==null?void 0:g.call(y);if(f)u.schema=f;else{const b={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,b);else{const k=u.schema,j=t.processors[l.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${l.type}`);j(e,t,k,b)}const x=e._zod.parent;x&&(u.ref||(u.ref=x),Ft(x,t,b),t.seen.get(x).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(u.schema,m),t.io==="input"&&yn(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((i=u.schema).default??(i.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function dj(e,t){var u,f,m,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const y of e.seen.entries()){const g=(u=e.metadataRegistry.get(y[0]))==null?void 0:u.id;if(g){const b=i.get(g);if(b&&b!==y[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(g,y[0])}}const l=y=>{var j;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const E=(j=e.external.registry.get(y[0]))==null?void 0:j.id,N=e.external.uri??(D=>D);if(E)return{ref:N(E)};const T=y[1].defId??y[1].schema.id??`schema${e.counter++}`;return y[1].defId=T,{defId:T,ref:`${N("__shared")}#/${g}/${T}`}}if(y[1]===n)return{ref:"#"};const x=`#/${g}/`,k=y[1].schema.id??`__schema${e.counter++}`;return{defId:k,ref:x+k}},o=y=>{if(y[1].schema.$ref)return;const g=y[1],{ref:b,defId:x}=l(y);g.def={...g.schema},x&&(g.defId=x);const k=g.schema;for(const j in k)delete k[j];k.$ref=b};if(e.cycles==="throw")for(const y of e.seen.entries()){const g=y[1];if(g.cycle)throw new Error(`Cycle detected: #/${(f=g.cycle)==null?void 0:f.join("/")}/<root>
331
331
 
332
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const g=y[1];if(t===y[0]){o(y);continue}if(e.external){const x=(m=e.external.registry.get(y[0]))==null?void 0:m.id;if(t!==y[0]&&x){o(y);continue}}if((h=e.metadataRegistry.get(y[0]))==null?void 0:h.id){o(y);continue}if(g.cycle){o(y);continue}if(g.count>1&&e.reused==="ref"){o(y);continue}}}function fj(e,t){var u,f,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=h=>{const y=e.seen.get(h);if(y.ref===null)return;const g=y.def??y.schema,b={...g},x=y.ref;if(y.ref=null,x){i(x);const j=e.seen.get(x),E=j.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(E)):Object.assign(g,E),Object.assign(g,b),h._zod.parent===x)for(const T in g)T==="$ref"||T==="allOf"||T in b||delete g[T];if(E.$ref&&j.def)for(const T in g)T==="$ref"||T==="allOf"||T in j.def&&JSON.stringify(g[T])===JSON.stringify(j.def[T])&&delete g[T]}const k=h._zod.parent;if(k&&k!==x){i(k);const j=e.seen.get(k);if(j!=null&&j.schema.$ref&&(g.$ref=j.schema.$ref,j.def))for(const E in g)E==="$ref"||E==="allOf"||E in j.def&&JSON.stringify(g[E])===JSON.stringify(j.def[E])&&delete g[E]}e.override({zodSchema:h,jsonSchema:g,path:y.path??[]})};for(const h of[...e.seen.entries()].reverse())i(h[0]);const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,(u=e.external)!=null&&u.uri){const h=(f=e.external.registry.get(t))==null?void 0:f.id;if(!h)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(h)}Object.assign(l,n.def??n.schema);const o=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const y=h[1];y.def&&y.defId&&(o[y.defId]=y.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?l.$defs=o:l.definitions=o);try{const h=JSON.parse(JSON.stringify(l));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Nd(t,"input",e.processors),output:Nd(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function yn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return yn(i.element,n);if(i.type==="set")return yn(i.valueType,n);if(i.type==="lazy")return yn(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return yn(i.innerType,n);if(i.type==="intersection")return yn(i.left,n)||yn(i.right,n);if(i.type==="record"||i.type==="map")return yn(i.keyType,n)||yn(i.valueType,n);if(i.type==="pipe")return yn(i.in,n)||yn(i.out,n);if(i.type==="object"){for(const l in i.shape)if(yn(i.shape[l],n))return!0;return!1}if(i.type==="union"){for(const l of i.options)if(yn(l,n))return!0;return!1}if(i.type==="tuple"){for(const l of i.items)if(yn(l,n))return!0;return!!(i.rest&&yn(i.rest,n))}return!1}const D4=(e,t={})=>n=>{const i=cj({...n,processors:t});return Ft(e,i),dj(i,e),fj(i,e)},Nd=(e,t,n={})=>i=>{const{libraryOptions:l,target:o}=i??{},u=cj({...l??{},target:o,io:t,processors:n});return Ft(e,u),dj(u,e),fj(u,e)},M4={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},L4=(e,t,n,i)=>{const l=n;l.type="string";const{minimum:o,maximum:u,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof o=="number"&&(l.minLength=o),typeof u=="number"&&(l.maxLength=u),f&&(l.format=M4[f]??f,l.format===""&&delete l.format,f==="time"&&delete l.format),h&&(l.contentEncoding=h),m&&m.size>0){const y=[...m];y.length===1?l.pattern=y[0].source:y.length>1&&(l.allOf=[...y.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},I4=(e,t,n,i)=>{const l=n,{minimum:o,maximum:u,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof f=="string"&&f.includes("int")?l.type="integer":l.type="number",typeof y=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(l.minimum=y,l.exclusiveMinimum=!0):l.exclusiveMinimum=y),typeof o=="number"&&(l.minimum=o,typeof y=="number"&&t.target!=="draft-04"&&(y>=o?delete l.minimum:delete l.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(l.maximum=h,l.exclusiveMaximum=!0):l.exclusiveMaximum=h),typeof u=="number"&&(l.maximum=u,typeof h=="number"&&t.target!=="draft-04"&&(h<=u?delete l.maximum:delete l.exclusiveMaximum)),typeof m=="number"&&(l.multipleOf=m)},U4=(e,t,n,i)=>{n.type="boolean"},B4=(e,t,n,i)=>{n.not={}},P4=(e,t,n,i)=>{},$4=(e,t,n,i)=>{const l=e._zod.def,o=qk(l.entries);o.every(u=>typeof u=="number")&&(n.type="number"),o.every(u=>typeof u=="string")&&(n.type="string"),n.enum=o},F4=(e,t,n,i)=>{const l=e._zod.def,o=[];for(const u of l.values)if(u===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof u=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(u))}else o.push(u);if(o.length!==0)if(o.length===1){const u=o[0];n.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[u]:n.const=u}else o.every(u=>typeof u=="number")&&(n.type="number"),o.every(u=>typeof u=="string")&&(n.type="string"),o.every(u=>typeof u=="boolean")&&(n.type="boolean"),o.every(u=>u===null)&&(n.type="null"),n.enum=o},q4=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},H4=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Z4=(e,t,n,i)=>{const l=n,o=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(l.minItems=u),typeof f=="number"&&(l.maxItems=f),l.type="array",l.items=Ft(o.element,t,{...i,path:[...i.path,"items"]})},V4=(e,t,n,i)=>{var h;const l=n,o=e._zod.def;l.type="object",l.properties={};const u=o.shape;for(const y in u)l.properties[y]=Ft(u[y],t,{...i,path:[...i.path,"properties",y]});const f=new Set(Object.keys(u)),m=new Set([...f].filter(y=>{const g=o.shape[y]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));m.size>0&&(l.required=Array.from(m)),((h=o.catchall)==null?void 0:h._zod.def.type)==="never"?l.additionalProperties=!1:o.catchall?o.catchall&&(l.additionalProperties=Ft(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(l.additionalProperties=!1)},Q4=(e,t,n,i)=>{const l=e._zod.def,o=l.inclusive===!1,u=l.options.map((f,m)=>Ft(f,t,{...i,path:[...i.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=u:n.anyOf=u},G4=(e,t,n,i)=>{const l=e._zod.def,o=Ft(l.left,t,{...i,path:[...i.path,"allOf",0]}),u=Ft(l.right,t,{...i,path:[...i.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(o)?o.allOf:[o],...f(u)?u.allOf:[u]];n.allOf=m},K4=(e,t,n,i)=>{const l=n,o=e._zod.def;l.type="object";const u=o.keyType,f=u._zod.bag,m=f==null?void 0:f.patterns;if(o.mode==="loose"&&m&&m.size>0){const y=Ft(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});l.patternProperties={};for(const g of m)l.patternProperties[g.source]=y}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(l.propertyNames=Ft(o.keyType,t,{...i,path:[...i.path,"propertyNames"]})),l.additionalProperties=Ft(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]});const h=u._zod.values;if(h){const y=[...h].filter(g=>typeof g=="string"||typeof g=="number");y.length>0&&(l.required=y)}},Y4=(e,t,n,i)=>{const l=e._zod.def,o=Ft(l.innerType,t,i),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=l.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},X4=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType},J4=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType,n.default=JSON.parse(JSON.stringify(l.defaultValue))},W4=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(l.defaultValue)))},e5=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType;let u;try{u=l.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=u},t5=(e,t,n,i)=>{const l=e._zod.def,o=t.io==="input"?l.in._zod.def.type==="transform"?l.out:l.in:l.out;Ft(o,t,i);const u=t.seen.get(e);u.ref=o},n5=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType,n.readOnly=!0},hj=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType},r5=ie("ZodISODateTime",(e,t)=>{rM.init(e,t),Tt.init(e,t)});function a5(e){return u4(r5,e)}const i5=ie("ZodISODate",(e,t)=>{aM.init(e,t),Tt.init(e,t)});function l5(e){return c4(i5,e)}const s5=ie("ZodISOTime",(e,t)=>{iM.init(e,t),Tt.init(e,t)});function o5(e){return d4(s5,e)}const u5=ie("ZodISODuration",(e,t)=>{lM.init(e,t),Tt.init(e,t)});function c5(e){return f4(u5,e)}const d5=(e,t)=>{Qk.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>YD(e,n)},flatten:{value:n=>KD(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Pp,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Pp,2)}},isEmpty:{get(){return e.issues.length===0}}})},vr=ie("ZodError",d5,{Parent:Error}),f5=zg(vr),h5=Og(vr),m5=Kd(vr),p5=Yd(vr),g5=WD(vr),y5=e3(vr),v5=t3(vr),b5=n3(vr),x5=r3(vr),S5=a3(vr),w5=i3(vr),k5=l3(vr),At=ie("ZodType",(e,t)=>(Nt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Nd(e,"input"),output:Nd(e,"output")}}),e.toJSONSchema=D4(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ci(t,{checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0}),e.with=e.check,e.clone=(n,i)=>_i(e,n,i),e.brand=()=>e,e.register=((n,i)=>(n.add(e,i),e)),e.parse=(n,i)=>f5(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>m5(e,n,i),e.parseAsync=async(n,i)=>h5(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>p5(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>g5(e,n,i),e.decode=(n,i)=>y5(e,n,i),e.encodeAsync=async(n,i)=>v5(e,n,i),e.decodeAsync=async(n,i)=>b5(e,n,i),e.safeEncode=(n,i)=>x5(e,n,i),e.safeDecode=(n,i)=>S5(e,n,i),e.safeEncodeAsync=async(n,i)=>w5(e,n,i),e.safeDecodeAsync=async(n,i)=>k5(e,n,i),e.refine=(n,i)=>e.check(g6(n,i)),e.superRefine=n=>e.check(y6(n)),e.overwrite=n=>e.check(qs(n)),e.optional=()=>v1(e),e.exactOptional=()=>r6(e),e.nullable=()=>b1(e),e.nullish=()=>v1(b1(e)),e.nonoptional=n=>u6(e,n),e.array=()=>Yn(e),e.or=n=>gj([e,n]),e.and=n=>X5(e,n),e.transform=n=>x1(e,t6(n)),e.default=n=>l6(e,n),e.prefault=n=>o6(e,n),e.catch=n=>d6(e,n),e.pipe=n=>x1(e,n),e.readonly=()=>m6(e),e.describe=n=>{const i=e.clone();return Xo.add(i,{description:n}),i},Object.defineProperty(e,"description",{get(){var n;return(n=Xo.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Xo.get(e);const i=e.clone();return Xo.add(i,n[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),mj=ie("_ZodString",(e,t)=>{Dg.init(e,t),At.init(e,t),e._zod.processJSONSchema=(i,l,o)=>L4(e,i,l);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...i)=>e.check(b4(...i)),e.includes=(...i)=>e.check(w4(...i)),e.startsWith=(...i)=>e.check(k4(...i)),e.endsWith=(...i)=>e.check(j4(...i)),e.min=(...i)=>e.check(_d(...i)),e.max=(...i)=>e.check(oj(...i)),e.length=(...i)=>e.check(uj(...i)),e.nonempty=(...i)=>e.check(_d(1,...i)),e.lowercase=i=>e.check(x4(i)),e.uppercase=i=>e.check(S4(i)),e.trim=()=>e.check(C4()),e.normalize=(...i)=>e.check(E4(...i)),e.toLowerCase=()=>e.check(_4()),e.toUpperCase=()=>e.check(N4()),e.slugify=()=>e.check(A4())}),j5=ie("ZodString",(e,t)=>{Dg.init(e,t),mj.init(e,t),e.email=n=>e.check(FM(E5,n)),e.url=n=>e.check(QM(C5,n)),e.jwt=n=>e.check(o4($5,n)),e.emoji=n=>e.check(GM(_5,n)),e.guid=n=>e.check(f1(g1,n)),e.uuid=n=>e.check(qM(rd,n)),e.uuidv4=n=>e.check(HM(rd,n)),e.uuidv6=n=>e.check(ZM(rd,n)),e.uuidv7=n=>e.check(VM(rd,n)),e.nanoid=n=>e.check(KM(N5,n)),e.guid=n=>e.check(f1(g1,n)),e.cuid=n=>e.check(YM(A5,n)),e.cuid2=n=>e.check(XM(T5,n)),e.ulid=n=>e.check(JM(R5,n)),e.base64=n=>e.check(i4(U5,n)),e.base64url=n=>e.check(l4(B5,n)),e.xid=n=>e.check(WM(z5,n)),e.ksuid=n=>e.check(e4(O5,n)),e.ipv4=n=>e.check(t4(D5,n)),e.ipv6=n=>e.check(n4(M5,n)),e.cidrv4=n=>e.check(r4(L5,n)),e.cidrv6=n=>e.check(a4(I5,n)),e.e164=n=>e.check(s4(P5,n)),e.datetime=n=>e.check(a5(n)),e.date=n=>e.check(l5(n)),e.time=n=>e.check(o5(n)),e.duration=n=>e.check(c5(n))});function O(e){return $M(j5,e)}const Tt=ie("ZodStringFormat",(e,t)=>{Ct.init(e,t),mj.init(e,t)}),E5=ie("ZodEmail",(e,t)=>{G3.init(e,t),Tt.init(e,t)}),g1=ie("ZodGUID",(e,t)=>{V3.init(e,t),Tt.init(e,t)}),rd=ie("ZodUUID",(e,t)=>{Q3.init(e,t),Tt.init(e,t)}),C5=ie("ZodURL",(e,t)=>{K3.init(e,t),Tt.init(e,t)}),_5=ie("ZodEmoji",(e,t)=>{Y3.init(e,t),Tt.init(e,t)}),N5=ie("ZodNanoID",(e,t)=>{X3.init(e,t),Tt.init(e,t)}),A5=ie("ZodCUID",(e,t)=>{J3.init(e,t),Tt.init(e,t)}),T5=ie("ZodCUID2",(e,t)=>{W3.init(e,t),Tt.init(e,t)}),R5=ie("ZodULID",(e,t)=>{eM.init(e,t),Tt.init(e,t)}),z5=ie("ZodXID",(e,t)=>{tM.init(e,t),Tt.init(e,t)}),O5=ie("ZodKSUID",(e,t)=>{nM.init(e,t),Tt.init(e,t)}),D5=ie("ZodIPv4",(e,t)=>{sM.init(e,t),Tt.init(e,t)}),M5=ie("ZodIPv6",(e,t)=>{oM.init(e,t),Tt.init(e,t)}),L5=ie("ZodCIDRv4",(e,t)=>{uM.init(e,t),Tt.init(e,t)}),I5=ie("ZodCIDRv6",(e,t)=>{cM.init(e,t),Tt.init(e,t)}),U5=ie("ZodBase64",(e,t)=>{dM.init(e,t),Tt.init(e,t)}),B5=ie("ZodBase64URL",(e,t)=>{hM.init(e,t),Tt.init(e,t)}),P5=ie("ZodE164",(e,t)=>{mM.init(e,t),Tt.init(e,t)}),$5=ie("ZodJWT",(e,t)=>{gM.init(e,t),Tt.init(e,t)}),Mg=ie("ZodNumber",(e,t)=>{rj.init(e,t),At.init(e,t),e._zod.processJSONSchema=(i,l,o)=>I4(e,i,l),e.gt=(i,l)=>e.check(m1(i,l)),e.gte=(i,l)=>e.check(Pm(i,l)),e.min=(i,l)=>e.check(Pm(i,l)),e.lt=(i,l)=>e.check(h1(i,l)),e.lte=(i,l)=>e.check(Bm(i,l)),e.max=(i,l)=>e.check(Bm(i,l)),e.int=i=>e.check(y1(i)),e.safe=i=>e.check(y1(i)),e.positive=i=>e.check(m1(0,i)),e.nonnegative=i=>e.check(Pm(0,i)),e.negative=i=>e.check(h1(0,i)),e.nonpositive=i=>e.check(Bm(0,i)),e.multipleOf=(i,l)=>e.check(p1(i,l)),e.step=(i,l)=>e.check(p1(i,l)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function He(e){return h4(Mg,e)}const F5=ie("ZodNumberFormat",(e,t)=>{yM.init(e,t),Mg.init(e,t)});function y1(e){return p4(F5,e)}const q5=ie("ZodBoolean",(e,t)=>{vM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>U4(e,n,i)});function Eu(e){return g4(q5,e)}const H5=ie("ZodUnknown",(e,t)=>{bM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>P4()});function St(){return y4(H5)}const Z5=ie("ZodNever",(e,t)=>{xM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>B4(e,n,i)});function V5(e){return v4(Z5,e)}const Q5=ie("ZodArray",(e,t)=>{SM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>Z4(e,n,i,l),e.element=t.element,e.min=(n,i)=>e.check(_d(n,i)),e.nonempty=n=>e.check(_d(1,n)),e.max=(n,i)=>e.check(oj(n,i)),e.length=(n,i)=>e.check(uj(n,i)),e.unwrap=()=>e.element});function Yn(e,t){return T4(Q5,e,t)}const G5=ie("ZodObject",(e,t)=>{kM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>V4(e,n,i,l),lt(e,"shape",()=>t.shape),e.keyof=()=>Xe(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:St()}),e.loose=()=>e.clone({...e._zod.def,catchall:St()}),e.strict=()=>e.clone({...e._zod.def,catchall:V5()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>HD(e,n),e.safeExtend=n=>ZD(e,n),e.merge=n=>VD(e,n),e.pick=n=>FD(e,n),e.omit=n=>qD(e,n),e.partial=(...n)=>QD(vj,e,n[0]),e.required=(...n)=>GD(bj,e,n[0])});function de(e,t){const n={type:"object",shape:e??{},...Ce(t)};return new G5(n)}const pj=ie("ZodUnion",(e,t)=>{lj.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>Q4(e,n,i,l),e.options=t.options});function gj(e,t){return new pj({type:"union",options:e,...Ce(t)})}const K5=ie("ZodDiscriminatedUnion",(e,t)=>{pj.init(e,t),jM.init(e,t)});function yj(e,t,n){return new K5({type:"union",options:t,discriminator:e,...Ce(n)})}const Y5=ie("ZodIntersection",(e,t)=>{EM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>G4(e,n,i,l)});function X5(e,t){return new Y5({type:"intersection",left:e,right:t})}const J5=ie("ZodRecord",(e,t)=>{CM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>K4(e,n,i,l),e.keyType=t.keyType,e.valueType=t.valueType});function qt(e,t,n){return new J5({type:"record",keyType:e,valueType:t,...Ce(n)})}const Fp=ie("ZodEnum",(e,t)=>{_M.init(e,t),At.init(e,t),e._zod.processJSONSchema=(i,l,o)=>$4(e,i,l),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(i,l)=>{const o={};for(const u of i)if(n.has(u))o[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Fp({...t,checks:[],...Ce(l),entries:o})},e.exclude=(i,l)=>{const o={...t.entries};for(const u of i)if(n.has(u))delete o[u];else throw new Error(`Key ${u} not found in enum`);return new Fp({...t,checks:[],...Ce(l),entries:o})}});function Xe(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Fp({type:"enum",entries:n,...Ce(t)})}const W5=ie("ZodLiteral",(e,t)=>{NM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>F4(e,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function xn(e,t){return new W5({type:"literal",values:Array.isArray(e)?e:[e],...Ce(t)})}const e6=ie("ZodTransform",(e,t)=>{AM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>H4(e,n),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new $k(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(du(o,n.value,t));else{const u=o;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),n.issues.push(du(u))}};const l=t.transform(n.value,n);return l instanceof Promise?l.then(o=>(n.value=o,n)):(n.value=l,n)}});function t6(e){return new e6({type:"transform",transform:e})}const vj=ie("ZodOptional",(e,t)=>{sj.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>hj(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function v1(e){return new vj({type:"optional",innerType:e})}const n6=ie("ZodExactOptional",(e,t)=>{TM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>hj(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function r6(e){return new n6({type:"optional",innerType:e})}const a6=ie("ZodNullable",(e,t)=>{RM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>Y4(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function b1(e){return new a6({type:"nullable",innerType:e})}const i6=ie("ZodDefault",(e,t)=>{zM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>J4(e,n,i,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function l6(e,t){return new i6({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Zk(t)}})}const s6=ie("ZodPrefault",(e,t)=>{OM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>W4(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function o6(e,t){return new s6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Zk(t)}})}const bj=ie("ZodNonOptional",(e,t)=>{DM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>X4(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function u6(e,t){return new bj({type:"nonoptional",innerType:e,...Ce(t)})}const c6=ie("ZodCatch",(e,t)=>{MM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>e5(e,n,i,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function d6(e,t){return new c6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const f6=ie("ZodPipe",(e,t)=>{LM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>t5(e,n,i,l),e.in=t.in,e.out=t.out});function x1(e,t){return new f6({type:"pipe",in:e,out:t})}const h6=ie("ZodReadonly",(e,t)=>{IM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>n5(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function m6(e){return new h6({type:"readonly",innerType:e})}const p6=ie("ZodCustom",(e,t)=>{UM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>q4(e,n)});function g6(e,t={}){return R4(p6,e,t)}function y6(e){return z4(e)}const $m={custom:"custom"};function Jd(e){return m4(Mg,e)}const v6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},xj=Xe(["feishu","slack","kael"]),Sj=Xe(["active","inactive"]);de({platform:xj,agentId:O().min(1),credentials:qt(O(),St()),status:Sj.default("active")});de({agentId:O().min(1).optional(),credentials:qt(O(),St()).optional(),status:Sj.optional()});de({id:He(),platform:O(),agentId:O(),hasCredentials:Eu(),status:O(),createdAt:O(),updatedAt:O()});const b6=Xe(["code","reverse_token","oauth","manual"]);de({appId:O().min(1),appSecret:O().min(1)});de({platform:xj,externalUserId:O().min(1),agentId:O().min(1),boundVia:b6.default("manual"),displayName:O().max(200).optional()});de({id:He(),platform:O(),externalUserId:O(),agentId:O(),boundVia:O().nullable(),displayName:O().nullable(),createdAt:O()});de({feishuUserId:O().min(1),displayName:O().max(200).optional()});de({configId:He(),platform:O(),agentId:O(),appId:O(),connected:Eu(),lastActiveAt:O().nullable()});const wj=Xe(["online","offline"]),kj=Xe(["idle","working","blocked","error"]);Xe(["active","suspended","evicted"]);const x6=Xe(["active","suspended"]);de({chatId:O().min(1),state:x6});de({runtimeState:kj});de({agentId:O().min(1),runtimeType:O().max(50),runtimeVersion:O().max(50).optional()});Xe(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent"]);de({agentId:O(),status:wj,connectedAt:O().nullable(),lastSeenAt:O(),clientId:O().nullable().optional(),runtimeType:O().nullable().optional(),runtimeVersion:O().nullable().optional(),runtimeState:kj.nullable().optional(),activeSessions:He().int().nullable().optional(),totalSessions:He().int().nullable().optional(),runtimeUpdatedAt:O().nullable().optional()});de({total:He().int(),running:He().int(),byState:de({idle:He().int(),working:He().int(),blocked:He().int(),error:He().int()}),clients:He().int()});const S6={HUMAN:"human",PERSONAL_ASSISTANT:"personal_assistant",AUTONOMOUS_AGENT:"autonomous_agent"},Wd=Xe(["human","personal_assistant","autonomous_agent"]),S1={PRIVATE:"private",ORGANIZATION:"organization"},Lg=Xe(["private","organization"]),w6=Xe(["admin-api","portal"]);Xe(["active","suspended"]);de({name:O().min(1).max(100).regex(/^[a-z0-9_-]+$/,"Only lowercase alphanumeric, hyphens, and underscores").optional(),type:Wd,displayName:O().max(200).optional(),delegateMention:O().max(100).optional(),organizationId:O().max(100).optional(),source:w6.optional(),visibility:Lg.optional(),metadata:qt(O(),St()).optional(),managerId:O().optional(),clientId:O().min(1).max(100).optional()});de({type:Wd.optional(),displayName:O().max(200).nullable().optional(),delegateMention:O().max(100).nullable().optional(),visibility:Lg.optional(),metadata:qt(O(),St()).optional(),managerId:O().nullable().optional(),clientId:O().min(1).max(100).nullable().optional()});de({uuid:O(),name:O().nullable(),organizationId:O(),type:Wd,displayName:O().nullable(),delegateMention:O().nullable(),inboxId:O(),status:O(),source:O().nullable().optional(),visibility:Lg,metadata:qt(O(),St()),managerId:O().nullable(),clientId:O().nullable(),presenceStatus:wj.optional(),createdAt:O(),updatedAt:O()});de({repo:O().nullable(),branch:O().nullable()});de({type:xn("agent:pinned"),agentId:O(),name:O().nullable(),displayName:O().nullable(),agentType:Wd});const k6=32e3,Ig=/^[a-z0-9][a-z0-9_-]{0,63}$/i,j6=/^[A-Z][A-Z0-9_]*$/,E6=de({append:O().max(k6).default("")}),C6=de({name:O().regex(Ig,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:xn("stdio"),command:O().min(1),args:Yn(O()).optional()}),_6=de({name:O().regex(Ig,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:xn("http"),url:O().url(),headers:qt(O(),O()).optional()}),N6=de({name:O().regex(Ig,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:xn("sse"),url:O().url(),headers:qt(O(),O()).optional()}),A6=yj("transport",[C6,_6,N6]),T6=de({key:O().regex(j6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:O(),sensitive:Eu().default(!1)}),R6=de({url:O().min(1),ref:O().min(1).optional(),localPath:O().min(1).optional()}),Ug=de({prompt:E6.default({append:""}),model:O().default(""),mcpServers:Yn(A6).default([]),env:Yn(T6).default([]),gitRepos:Yn(R6).default([])}),z6=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,u)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:$m.custom,path:["mcpServers",u,"name"],message:`Duplicate MCP server name "${o.name}"`}),n.add(f)});const i=new Set;e.env.forEach((o,u)=>{i.has(o.key)&&t.addIssue({code:$m.custom,path:["env",u,"key"],message:`Duplicate env key "${o.key}"`}),i.add(o.key)});const l=new Set;e.gitRepos.forEach((o,u)=>{const f=o.localPath??Ad(o.url);f&&(l.has(f)&&t.addIssue({code:$m.custom,path:["gitRepos",u,"localPath"],message:`Duplicate git repo local path "${f}"`}),l.add(f))})},jj=Ug.superRefine(z6),O6=de({agentId:O(),version:He().int().positive(),payload:jj,updatedAt:O(),updatedBy:O()});de({expectedVersion:He().int().positive(),payload:Ug.partial()});de({payload:Ug.partial()});de({current:O6,next:jj,diff:Yn(de({path:O(),op:Xe(["add","remove","replace"]),before:St().optional(),after:St().optional()}))});const qp="***";function Ad(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}de({username:O().min(1),password:O().min(1)});de({accessToken:O(),refreshToken:O()});de({refreshToken:O().min(1)});de({token:O().min(1)});de({token:O(),expiresIn:He(),command:O()});const D6=Xe(["direct","group","thread"]);de({type:D6,topic:O().max(500).optional(),participantIds:Yn(O()).min(1),metadata:qt(O(),St()).optional()});const Ej=de({agentId:O(),role:O(),mode:O(),joinedAt:O()});Ej.extend({name:O().nullable(),displayName:O().nullable(),type:O()});const M6=de({id:O(),organizationId:O(),type:O(),topic:O().nullable(),lifecyclePolicy:O().nullable().optional(),metadata:qt(O(),St()),createdAt:O(),updatedAt:O()});M6.extend({participants:Yn(Ej)});de({topic:O().trim().max(500).nullable()});de({agentId:O().min(1),mode:Xe(["full","mention_only"]).default("full")});de({agentId:O().min(1)});const L6=Xe(["connected","disconnected"]);de({id:O(),userId:O().nullable(),status:L6,sdkVersion:O().max(50).nullable(),hostname:O().max(100).nullable(),os:O().max(50).nullable(),agentCount:He().int().min(0),connectedAt:O().nullable(),lastSeenAt:O(),metadata:qt(O(),St()).nullable()});de({clientId:O().min(1).max(100),hostname:O().max(100).optional(),os:O().max(50).optional(),sdkVersion:O().max(50).optional()});de({limit:Jd().int().min(1).max(100).default(20),cursor:O().optional()});const I6=["image/png","image/jpeg","image/gif","image/webp"],Bg=Xe(I6);de({data:O().min(1),mimeType:Bg,filename:O().min(1),size:He().int().nonnegative().optional(),imageId:O().uuid().optional()});de({imageId:O().uuid(),mimeType:Bg,filename:O().min(1),size:He().int().nonnegative().optional()});de({type:xn("image_payload"),imageId:O().uuid(),chatId:O(),base64:O().min(1),mimeType:Bg,filename:O().min(1),size:He().int().nonnegative().optional()});const Pg=Xe(["hub_ui","cli","feishu","github","api"]),Cj=Xe(["text","markdown","card","reference","file","task"]);de({format:Cj.default("text"),content:St(),metadata:qt(O(),St()).optional(),inReplyTo:O().optional(),replyToInbox:O().optional(),replyToChat:O().optional(),source:Pg.optional()});de({format:Cj.default("text"),content:St(),metadata:qt(O(),St()).optional(),replyToInbox:O().optional(),replyToChat:O().optional(),source:Pg.optional()});const U6=de({id:O(),chatId:O(),senderId:O(),format:O(),content:St(),metadata:qt(O(),St()),replyToInbox:O().nullable(),replyToChat:O().nullable(),inReplyTo:O().nullable(),source:Pg.nullable(),createdAt:O()}),B6=de({senderId:O(),chatId:O(),replyToChat:O().nullable()}).nullable(),P6=Xe(["full","mention_only"]),$6=U6.extend({configVersion:He().int().positive(),recipientMode:P6.default("full"),inReplyToSnapshot:B6.default(null)});Xe(["pending","delivered","acked","failed"]);const F6=de({id:He(),inboxId:O(),messageId:O(),chatId:O().nullable(),status:O(),retryCount:He(),createdAt:O(),deliveredAt:O().nullable(),ackedAt:O().nullable()});F6.extend({message:$6});de({limit:Jd().int().min(1).max(50).default(10)});const q6={ADMIN:"admin",MEMBER:"member"},$g=Xe(["admin","member"]),H6=de({id:O(),userId:O(),organizationId:O(),agentId:O(),role:$g,createdAt:O()});de({username:O().min(1).max(100),displayName:O().min(1).max(200),role:$g.default("member")});de({role:$g.optional(),displayName:O().min(1).max(200).optional()});H6.extend({username:O(),displayName:O(),password:O()});const Z6=Xe(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),_j=Xe(["high","medium","low"]);de({id:O(),organizationId:O(),type:Z6,severity:_j,agentId:O().nullable(),chatId:O().nullable(),message:O(),read:Eu(),createdAt:O()});de({limit:Jd().int().min(1).max(100).default(20),cursor:O().optional(),severity:_j.optional(),read:Xe(["true","false"]).transform(e=>e==="true").optional(),agentId:O().optional()});const Nj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;de({name:O().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!Nj.test(e),"Name must not be a UUID format"),displayName:O().min(1).max(200),maxAgents:He().int().min(0).default(0),maxMessagesPerMinute:He().int().min(0).default(0),features:qt(O(),St()).default({})});de({name:O().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!Nj.test(e),"Name must not be a UUID format").optional(),displayName:O().min(1).max(200).optional(),maxAgents:He().int().min(0).optional(),maxMessagesPerMinute:He().int().min(0).optional(),features:qt(O(),St()).optional()});de({id:O(),name:O(),displayName:O(),maxAgents:He(),maxMessagesPerMinute:He(),features:qt(O(),St()),createdAt:O(),updatedAt:O()});const V6=de({workingCount:He().int().nonnegative(),errorMask:Eu()}),Q6=de({type:xn("pulse:tick"),organizationId:O(),agents:qt(O(),Yn(V6).length(32))}),G6=Xe(["tool_call","error","assistant_text","thinking","turn_end"]),Aj=de({toolUseId:O(),name:O(),args:St(),status:Xe(["pending","ok","error"]),durationMs:He().int().nonnegative().optional(),resultPreview:O().max(400).optional()}),Tj=de({source:Xe(["sdk","runtime","tool"]),message:O().max(2e3)}),Rj=de({text:O().max(8e3)}),zj=de({}),Oj=de({status:Xe(["success","error"])}),K6=yj("kind",[de({kind:xn("tool_call"),payload:Aj}),de({kind:xn("error"),payload:Tj}),de({kind:xn("assistant_text"),payload:Rj}),de({kind:xn("thinking"),payload:zj}),de({kind:xn("turn_end"),payload:Oj})]);de({id:O(),agentId:O(),chatId:O(),seq:He().int().positive(),kind:G6,payload:gj([Aj,Tj,Rj,zj,Oj]),createdAt:O()});de({agentId:O(),chatId:O(),event:K6});de({agentId:O(),chatId:O()});de({type:xn("session:reconcile"),agentId:O().min(1),chatIds:Yn(O().min(1)).max(500)});de({type:xn("session:reconcile:result"),agentId:O().min(1),staleChatIds:Yn(O().min(1))});const Y6=de({organizationId:O(),agentCount:He(),chatCount:He(),messageCount:He()});de({totalAgents:He(),totalChats:He(),totalMessages:He(),byOrganization:Yn(Y6)});de({key:O(),value:St(),updatedAt:O()});qt(O(),St());const yi={INBOX_TIMEOUT_SECONDS:"inbox_timeout_seconds",MAX_RETRY_COUNT:"max_retry_count",POLLING_INTERVAL_SECONDS:"polling_interval_seconds",PRESENCE_CLEANUP_SECONDS:"presence_cleanup_seconds"},vd={[yi.INBOX_TIMEOUT_SECONDS]:300,[yi.MAX_RETRY_COUNT]:3,[yi.POLLING_INTERVAL_SECONDS]:5,[yi.PRESENCE_CLEANUP_SECONDS]:60},fu=Xe(["pending","assigned","working","completed","failed","cancelled"]),w1=Xe(["agent","admin"]),X6=Xe(["assigned","status_changed","cancelled"]);de({taskId:O(),event:X6,title:O(),body:O().default(""),status:fu,fromStatus:fu.optional(),originRef:O().nullable().optional()});const J6=de({title:O().min(1).max(500),body:O().optional(),assigneeAgentId:O().optional(),originRef:O().max(500).optional(),metadata:qt(O(),St()).optional()});J6.extend({organizationId:O().optional()});de({status:Xe(["working","completed","failed"]),result:O().optional()});de({assigneeAgentId:O().nullable().optional(),status:fu.optional(),result:O().optional()});de({chatId:O().min(1)});const W6=de({id:O(),organizationId:O(),title:O(),body:O(),status:fu,assigneeAgentId:O().nullable(),createdByType:w1,createdById:O(),originRef:O().nullable(),result:O().nullable(),metadata:qt(O(),St()),createdAt:O(),updatedAt:O(),cancelledAt:O().nullable(),cancelledByType:w1.nullable(),cancelledById:O().nullable()}),eL=de({taskId:O(),chatId:O(),linkedByAgentId:O().nullable(),linkedAt:O()});W6.extend({chats:Yn(eL)});de({status:fu.optional(),assigneeAgentId:O().optional(),originRef:O().optional(),limit:Jd().int().min(1).max(100).default(20),cursor:O().optional()});const tL=Xe(["normal","idle_island","awaiting_reply","no_chat","not_applicable"]);de({taskId:O(),signal:tL,reason:O()});const nL=Xe(["active","suspended"]);de({id:O(),username:O(),displayName:O(),avatarUrl:O().nullable(),status:nL,createdAt:O(),updatedAt:O()});de({username:O().min(1).max(100),displayName:O().min(1).max(200),password:O().min(8).max(200)});de({displayName:O().min(1).max(200).optional(),password:O().min(8).max(200).optional()});de({type:xn("auth"),token:O().min(1)});de({type:xn("server:welcome"),serverCommandVersion:O().min(1),serverTimeMs:He().int().nonnegative()}).passthrough();const Dj=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function rL(e){const t=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));for(const n of Object.values(e))for(let i=0;i<32&&i<n.length;i++){const l=n[i],o=t[i];!l||!o||(o.workingCount+=l.workingCount,o.errorMask=o.errorMask||l.errorMask)}return t}const aL=2e3,iL=3e4;let si=null,Td=!1,Fm=0,eu=null;const Hp=new Set;let Jo=null,ys=0;function lL(e){for(const t of Hp)try{t(e)}catch{}Jo&&(e.type==="notification"?Jo.invalidateQueries({queryKey:["notifications"]}):e.type==="session:state"&&(Jo.invalidateQueries({queryKey:["activity"]}),Jo.invalidateQueries({queryKey:["sessions"]})))}function Mj(){const e=xg();if(!(e!=null&&e.accessToken))return;const n=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws/admin?token=${e.accessToken}`,i=new WebSocket(n);si=i,i.onmessage=l=>{if(i===si)try{const o=JSON.parse(l.data);lL(o)}catch{}},i.onopen=()=>{i===si&&(Fm=0)},i.onclose=()=>{if(i!==si||(si=null,Td||ys===0))return;Fm++;const l=Math.min(aL*2**(Fm-1),iL);eu=setTimeout(()=>{eu=null,!Td&&ys>0&&Mj()},l)}}function sL(){Td=!0,eu&&(clearTimeout(eu),eu=null),si&&(si.close(1e3,"unmount"),si=null)}function Lj(e){const{onMessage:t,enabled:n=!0}=e??{},i=Wn(),l=S.useRef(t);l.current=t,S.useEffect(()=>{Jo=i},[i]),S.useEffect(()=>{if(!n)return;const o=u=>{var f;return(f=l.current)==null?void 0:f.call(l,u)};return Hp.add(o),ys++,ys===1&&(Td=!1,Mj()),()=>{Hp.delete(o),ys--,ys===0&&sL()}},[n])}const Ij=S.createContext({aggregated:Dj,agents:{},receivedAtMs:null,stale:!0});function oL({children:e}){const[t,n]=S.useState({aggregated:Dj,agents:{},receivedAtMs:null}),[i,l]=S.useState(()=>Date.now());Lj({onMessage:u=>{const f=Q6.safeParse(u);f.success&&n({aggregated:rL(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),S.useEffect(()=>{const u=setInterval(()=>l(Date.now()),1e4);return()=>clearInterval(u)},[]);const o=S.useMemo(()=>({...t,stale:t.receivedAtMs===null||i-t.receivedAtMs>3e4}),[t,i]);return d.jsx(Ij.Provider,{value:o,children:e})}function uL(){return S.useContext(Ij)}function ef({title:e,subtitle:t,right:n,className:i,style:l,...o}){return d.jsxs("div",{className:Te("flex items-baseline gap-3 shrink-0",i),style:{padding:"var(--sp-3) var(--sp-5) var(--sp-2_5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)",...l},...o,children:[d.jsx("h1",{className:"m-0 text-title",style:{color:"var(--fg)"},children:e}),t&&d.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),d.jsx("div",{style:{flex:1}}),n]})}function Uj({className:e,style:t,...n}){return d.jsx("div",{className:Te("flex items-end",e),style:{gap:2,height:34,padding:"0 var(--sp-5)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg-raised)",...t},...n})}function Bj({active:e,onClick:t,children:n}){return d.jsx("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1.5 bg-transparent text-body font-medium",style:{padding:"var(--sp-1_75) var(--sp-3)",marginBottom:-1,borderBottom:`var(--hairline-bold) solid ${e?"var(--accent)":"transparent"}`,color:e?"var(--fg)":"var(--fg-3)",cursor:"pointer",transition:"color 0.12s"},onMouseEnter:i=>{e||(i.currentTarget.style.color="var(--fg)")},onMouseLeave:i=>{e||(i.currentTarget.style.color="var(--fg-3)")},children:n})}const cL={neutral:{bg:"var(--bg-sunken)",fg:"var(--fg-2)",bd:"var(--border)"},accent:{bg:"var(--accent-bg)",fg:"var(--accent-dim)",bd:"color-mix(in oklch, var(--accent) 30%, transparent)"},warn:{bg:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},error:{bg:"color-mix(in oklch, var(--state-error) 14%, transparent)",fg:"var(--state-error)",bd:"color-mix(in oklch, var(--state-error) 30%, transparent)"},outline:{bg:"transparent",fg:"var(--fg-3)",bd:"var(--border)"},idle:{bg:"color-mix(in oklch, var(--state-idle) 14%, transparent)",fg:"var(--state-idle)",bd:"color-mix(in oklch, var(--state-idle) 30%, transparent)"},working:{bg:"color-mix(in oklch, var(--state-working) 14%, transparent)",fg:"var(--state-working)",bd:"color-mix(in oklch, var(--state-working) 30%, transparent)"},blocked:{bg:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},offline:{bg:"color-mix(in oklch, var(--state-offline) 14%, transparent)",fg:"var(--state-offline)",bd:"color-mix(in oklch, var(--state-offline) 30%, transparent)"}};function Wt({tone:e="neutral",className:t,style:n,...i}){const l=cL[e],o={background:l.bg,color:l.fg,border:`var(--hairline) solid ${l.bd}`,...n};return d.jsx("span",{className:Te("mono inline-flex items-center uppercase text-caption leading-[1.6]",t),style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",...o},...i})}const Sa=S.forwardRef(({className:e,...t},n)=>d.jsx("table",{ref:n,className:Te("w-full",e),style:{borderCollapse:"separate",borderSpacing:0},...t}));Sa.displayName="DenseTable";const wa=S.forwardRef(({className:e,...t},n)=>d.jsx("thead",{ref:n,className:e,...t}));wa.displayName="DenseTableHeader";const ka=S.forwardRef(({className:e,...t},n)=>d.jsx("tbody",{ref:n,className:e,...t}));ka.displayName="DenseTableBody";const Qt=S.forwardRef(({className:e,interactive:t,selected:n,style:i,...l},o)=>d.jsx("tr",{ref:o,className:Te("transition-colors",e),"data-interactive":t?"":void 0,"data-selected":n?"":void 0,style:{background:n?"var(--bg-active)":void 0,cursor:t?"pointer":void 0,...i},...l}));Qt.displayName="DenseTableRow";const Ae=S.forwardRef(({className:e,style:t,...n},i)=>d.jsx("th",{ref:i,className:Te("mono text-left uppercase text-eyebrow whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3)",color:"var(--fg-4)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border)",...t},...n}));Ae.displayName="DenseTableHead";const Ee=S.forwardRef(({className:e,style:t,...n},i)=>d.jsx("td",{ref:i,className:Te("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));Ee.displayName="DenseTableCell";const Fr=S.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:Te("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)"},...t}));Fr.displayName="Panel";const Pj=S.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:Te("flex items-center justify-between gap-3",e),style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},...t}));Pj.displayName="PanelHeader";const $j=S.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:Te("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)"},...t}));$j.displayName="PanelTitle";const dL=S.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:Te(e),style:{padding:"var(--sp-3) var(--sp-3_5)"},...t}));dL.displayName="PanelBody";function Ms({children:e,right:t,className:n,style:i,...l}){return d.jsxs("div",{className:Te("mono flex items-center justify-between uppercase text-eyebrow",n),style:{padding:"var(--sp-1_75) var(--sp-3_5)",color:"var(--fg-4)",background:"var(--bg-raised)",borderBottom:"var(--hairline) solid var(--border-faint)",...i},...l,children:[d.jsx("span",{children:e}),t]})}function Cu({className:e,style:t,...n}){return d.jsx("span",{className:Te("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function Fg(){return De.get("/members")}function fL(e){return De.post("/members",e)}function hL(e,t){return De.patch(`/members/${encodeURIComponent(e)}`,t)}function mL(e){return De.delete(`/members/${encodeURIComponent(e)}`)}function qg(){const{data:e}=qe({queryKey:["members","name-map"],queryFn:Fg,staleTime:3e4});return S.useMemo(()=>{const t=new Map;if(e)for(const n of e)t.set(n.id,n.displayName||n.username);return n=>n?t.get(n)??n:"—"},[e])}function pL(){const e=qr(),t=qg(),{data:n,isLoading:i,error:l}=qe({queryKey:["admin-all-agents"],queryFn:()=>xD({limit:100})});return d.jsxs("div",{children:[d.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",padding:"0 var(--sp-0_5) var(--sp-2_5)"},children:"Every agent in the organization — including private agents owned by other members. Use this view to troubleshoot or reassign."}),d.jsxs(Fr,{children:[d.jsxs(Ms,{children:["All agents · ",(n==null?void 0:n.items.length)??0]}),i?d.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):l?d.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load agents: ",l instanceof Error?l.message:"Unknown error"]}):!n||n.items.length===0?d.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"No agents"}):d.jsxs(Sa,{children:[d.jsx(wa,{children:d.jsxs(Qt,{children:[d.jsx(Ae,{children:"Name"}),d.jsx(Ae,{children:"Display"}),d.jsx(Ae,{children:"Type"}),d.jsx(Ae,{children:"Visibility"}),d.jsx(Ae,{children:"Owner"}),d.jsx(Ae,{children:"Status"}),d.jsx(Ae,{children:"Created"})]})}),d.jsx(ka,{children:n.items.map(o=>d.jsxs(Qt,{interactive:!0,onClick:()=>e(`/agents/${encodeURIComponent(o.uuid)}`),children:[d.jsx(Ee,{children:d.jsx("span",{className:"mono font-medium",children:o.name??o.uuid.slice(0,8)})}),d.jsx(Ee,{style:{color:"var(--fg-2)"},children:o.displayName??"—"}),d.jsx(Ee,{children:d.jsx(Wt,{tone:o.type==="autonomous_agent"?"accent":"neutral",children:o.type})}),d.jsx(Ee,{children:d.jsx(Wt,{tone:o.visibility==="organization"?"accent":"outline",children:o.visibility})}),d.jsx(Ee,{className:"text-label",style:{color:"var(--fg-2)"},children:o.managerId?t(o.managerId):"—"}),d.jsx(Ee,{children:d.jsx(Wt,{tone:o.status==="active"?"accent":"neutral",children:o.status})}),d.jsx(Ee,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:xa(o.createdAt)})]},o.uuid))})]})]})]})}const k1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,j1=kw,gL=(e,t)=>n=>{var i;if((t==null?void 0:t.variants)==null)return j1(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:o}=t,u=Object.keys(l).map(h=>{const y=n==null?void 0:n[h],g=o==null?void 0:o[h];if(y===null)return null;const b=k1(y)||k1(g);return l[h][b]}),f=n&&Object.entries(n).reduce((h,y)=>{let[g,b]=y;return b===void 0||(h[g]=b),h},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((h,y)=>{let{class:g,className:b,...x}=y;return Object.entries(x).every(k=>{let[j,E]=k;return Array.isArray(E)?E.includes({...o,...f}[j]):{...o,...f}[j]===E})?[...h,g,b]:h},[]);return j1(e,u,m,n==null?void 0:n.class,n==null?void 0:n.className)},yL=gL("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-input)] text-body font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{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 px-3 text-label",xs:"h-7 rounded-[var(--radius-chip)] px-2.5 text-label gap-1.5",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ve=S.forwardRef(({className:e,variant:t,size:n,asChild:i=!1,...l},o)=>{const u=i?GO:"button";return d.jsx(u,{className:Te(yL({variant:t,size:n,className:e})),ref:o,...l})});ve.displayName="Button";const vt=S.forwardRef(({className:e,type:t,...n},i)=>d.jsx("input",{type:t,className:Te("flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors file:border-0 file:bg-transparent file:text-body 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:i,...n}));vt.displayName="Input";var vL="Label",Fj=S.forwardRef((e,t)=>d.jsx(Ca.label,{...e,ref:t,onMouseDown:n=>{var l;n.target.closest("button, input, select, textarea")||((l=e.onMouseDown)==null||l.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Fj.displayName=vL;var bL=Fj;const et=S.forwardRef(({className:e,...t},n)=>d.jsx(bL,{ref:n,className:Te("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));et.displayName="Label";const qj=Object.values(q6);function xL(e,t){const n=(e==null?void 0:e.trim())||t,i=n.split(/[\s._-]+/).filter(Boolean);if(i.length>=2){const l=i[0]??"",o=i[1]??"";return`${l[0]??""}${o[0]??""}`.toUpperCase()}return n.slice(0,2).toUpperCase()}function SL(){const e=Wn(),{memberId:t}=ja(),[n,i]=S.useState(!1),[l,o]=S.useState({username:"",displayName:"",role:"member"}),[u,f]=S.useState(null),[m,h]=S.useState(null),{data:y,isLoading:g,error:b}=qe({queryKey:["members"],queryFn:Fg}),x=yt({mutationFn:()=>fL({username:l.username,displayName:l.displayName,role:l.role}),onSuccess:T=>{e.invalidateQueries({queryKey:["members"]}),f(T.password)}}),k=yt({mutationFn:mL,onSuccess:()=>e.invalidateQueries({queryKey:["members"]})});function j(){i(!1),o({username:"",displayName:"",role:"member"}),f(null)}function E(T){T.preventDefault(),x.mutate()}function N(T){window.confirm("Delete this member? Their human agent will also be deactivated.")&&k.mutate(T)}return d.jsxs(d.Fragment,{children:[d.jsxs(Fr,{children:[d.jsxs(Ms,{right:d.jsxs(On,{open:n,onOpenChange:T=>T?i(!0):j(),children:[d.jsx(gD,{asChild:!0,children:d.jsxs(ve,{size:"xs",className:"normal-case tracking-normal",children:[d.jsx(gl,{className:"h-3 w-3"}),"Add member"]})}),d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:u?"Member Created":"Create Member"})}),u?d.jsxs("div",{className:"space-y-4",children:[d.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Member created. Share the password below — it will only be shown once."}),d.jsxs("div",{className:"flex items-center gap-2 rounded-md p-3",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)"},children:[d.jsx("code",{className:"flex-1 text-body mono",children:u}),d.jsx(ve,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText(u),title:"Copy password",children:d.jsx(Sg,{className:"h-4 w-4"})})]}),d.jsx(Dn,{children:d.jsx(ve,{onClick:j,children:"Done"})})]}):d.jsxs("form",{onSubmit:E,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"member-username",children:"Username"}),d.jsx(vt,{id:"member-username",type:"text",value:l.username,onChange:T=>o({...l,username:T.target.value}),required:!0})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"member-name",children:"Display Name"}),d.jsx(vt,{id:"member-name",value:l.displayName,onChange:T=>o({...l,displayName:T.target.value}),required:!0})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"member-role",children:"Role"}),d.jsx("select",{id:"member-role",value:l.role,onChange:T=>o({...l,role:T.target.value}),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:qj.map(T=>d.jsx("option",{value:T,children:T},T))})]}),x.error instanceof Error&&d.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:x.error.message}),d.jsx(Dn,{children:d.jsx(ve,{type:"submit",disabled:x.isPending,children:x.isPending?"Creating...":"Create"})})]})]})]}),children:["Members · ",(y==null?void 0:y.length)??0]}),g?d.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):b?d.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load members: ",b instanceof Error?b.message:"Unknown error"]}):(y==null?void 0:y.length)===0?d.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"No members"}):d.jsxs(Sa,{children:[d.jsx(wa,{children:d.jsxs(Qt,{children:[d.jsx(Ae,{style:{width:30}}),d.jsx(Ae,{children:"Username"}),d.jsx(Ae,{children:"Name"}),d.jsx(Ae,{children:"Role"}),d.jsx(Ae,{children:"Created"}),d.jsx(Ae,{style:{width:1}})]})}),d.jsx(ka,{children:y==null?void 0:y.map(T=>{const D=t===T.id;return d.jsxs(Qt,{children:[d.jsx(Ee,{children:d.jsx("span",{className:"mono inline-flex items-center justify-center text-caption font-semibold",style:{width:22,height:22,borderRadius:"var(--radius-input)",background:D?"var(--accent-bg)":"var(--bg-active)",border:"var(--hairline) solid var(--border-strong)",color:D?"var(--accent-dim)":"var(--fg-2)"},children:xL(T.displayName,T.username)})}),d.jsxs(Ee,{children:[d.jsx("span",{className:"mono font-medium",children:T.username}),D&&d.jsx(Cu,{style:{marginLeft:6},children:"you"})]}),d.jsx(Ee,{style:{color:"var(--fg-2)"},children:T.displayName}),d.jsx(Ee,{children:d.jsx(Wt,{tone:T.role==="admin"?"accent":"neutral",children:T.role})}),d.jsx(Ee,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:xa(T.createdAt)}),d.jsx(Ee,{style:{whiteSpace:"nowrap"},children:d.jsxs("div",{className:"flex gap-0.5 justify-end",children:[d.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>h({id:T.id,username:T.username,displayName:T.displayName,role:T.role}),title:"Edit",children:d.jsx($d,{className:"h-3.5 w-3.5"})}),d.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(T.id),disabled:k.isPending,title:"Delete",style:{color:"var(--fg-4)"},children:d.jsx(su,{className:"h-3.5 w-3.5"})})]})})]},T.id)})})]})]}),d.jsx(wL,{target:m,onClose:()=>h(null),onSaved:()=>{h(null),e.invalidateQueries({queryKey:["members"]})}})]})}function wL({target:e,onClose:t,onSaved:n}){const[i,l]=S.useState(""),[o,u]=S.useState("member"),[f,m]=S.useState(null);S.useEffect(()=>{e&&(l(e.displayName),u(e.role),m(null))},[e]);const h=yt({mutationFn:async()=>{if(!e)throw new Error("No target");const b={};return i.trim()&&i!==e.displayName&&(b.displayName=i.trim()),o!==e.role&&(b.role=o),Object.keys(b).length===0?e:hL(e.id,b)},onSuccess:()=>{m(null),n()},onError:b=>{m(b instanceof Error?b.message:String(b))}});function y(b){b.preventDefault(),h.mutate()}const g=e!==null;return d.jsx(On,{open:g,onOpenChange:b=>b?void 0:t(),children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:"Edit Member"})}),e&&d.jsxs("form",{onSubmit:y,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{children:"Username"}),d.jsx(vt,{value:e.username,disabled:!0,className:"font-mono"}),d.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"edit-member-display",children:"Display Name"}),d.jsx(vt,{id:"edit-member-display",value:i,onChange:b=>l(b.target.value),required:!0,maxLength:200})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"edit-member-role",children:"Role"}),d.jsx("select",{id:"edit-member-role",value:o,onChange:b=>u(b.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:qj.map(b=>d.jsx("option",{value:b,children:b},b))}),d.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Demoting the last admin is blocked — every org needs at least one admin to manage members."})]}),f&&d.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:f}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:t,disabled:h.isPending,children:"Cancel"}),d.jsx(ve,{type:"submit",disabled:h.isPending,children:h.isPending?"Saving…":"Save"})]})]})]})})}function kL(){return De.get("/admin/system/config")}function jL(e){return De.patch("/admin/system/config",e)}const Hj=[{key:yi.INBOX_TIMEOUT_SECONDS,label:"Inbox timeout",description:"How long an agent waits for inbound messages before sleeping.",unit:"seconds"},{key:yi.MAX_RETRY_COUNT,label:"Max retry count",description:"Delivery attempts before a message is marked failed.",unit:null},{key:yi.POLLING_INTERVAL_SECONDS,label:"Polling interval",description:"Runtime heartbeat cadence for offline detection.",unit:"seconds"},{key:yi.PRESENCE_CLEANUP_SECONDS,label:"Presence cleanup",description:"When presence rows expire after disconnect.",unit:"seconds"}],E1=Hj.map(e=>e.key);function EL(){const e=Wn(),{data:t,isLoading:n}=qe({queryKey:["system-config"],queryFn:kL}),[i,l]=S.useState({}),[o,u]=S.useState(!1);S.useEffect(()=>{if(!t)return;const y={};for(const g of E1){const b=t[g]??vd[g]??"";y[g]=String(b)}l(y)},[t]);const f=yt({mutationFn:()=>{const y={};for(const[g,b]of Object.entries(i)){const x=b.trim();if(x==="")y[g]=vd[g]??0;else{const k=Number(x);y[g]=Number.isNaN(k)?x:k}}return jL(y)},onSuccess:()=>{e.invalidateQueries({queryKey:["system-config"]}),u(!0),setTimeout(()=>u(!1),2e3)}});function m(){const y={};for(const g of E1)y[g]=String(vd[g]??"");l(y)}function h(y){y.preventDefault(),f.mutate()}return d.jsx("form",{onSubmit:h,children:d.jsxs(Fr,{children:[d.jsxs(Pj,{children:[d.jsx($j,{children:"System configuration"}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[o&&d.jsx("span",{className:"mono text-caption",style:{color:"var(--accent-dim)"},children:"saved"}),d.jsx(ve,{type:"button",variant:"ghost",size:"xs",onClick:m,disabled:f.isPending,children:"Reset defaults"}),d.jsxs(ve,{type:"submit",size:"xs",disabled:f.isPending,children:[d.jsx(Pd,{className:"h-3 w-3"}),f.isPending?"Saving…":"Save changes"]})]})]}),d.jsxs("div",{style:{padding:"var(--sp-1) var(--sp-4) var(--sp-3_5)"},children:[n?d.jsx("div",{className:"py-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):Hj.map(y=>d.jsx(CL,{field:y,value:i[y.key]??"",onChange:g=>l({...i,[y.key]:g})},y.key)),f.error instanceof Error&&d.jsx("div",{className:"text-body pt-2",style:{color:"var(--state-error)"},children:f.error.message})]})]})})}function CL({field:e,value:t,onChange:n}){const i=String(vd[e.key]??"—");return d.jsxs("div",{className:"grid items-start gap-5",style:{gridTemplateColumns:"1fr var(--sp-45)",padding:"var(--sp-3_5) 0",borderTop:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.label}),d.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.key})]}),d.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:2},children:e.description}),d.jsxs(Cu,{style:{marginTop:4,display:"block"},children:["default"," ",d.jsx("span",{className:"mono normal-case tracking-normal",style:{color:"var(--fg-3)"},children:i})]})]}),d.jsxs("div",{style:{position:"relative"},children:[d.jsx("input",{value:t,onChange:l=>n(l.target.value),className:"w-full outline-none mono text-body",style:{padding:`var(--sp-1_25) ${e.unit?56:10}px var(--sp-1_25) var(--sp-2_5)`,background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"}}),e.unit&&d.jsx("span",{className:"mono text-caption",style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)",pointerEvents:"none"},children:e.unit})]})]})}const C1=[{key:"members",label:"Members"},{key:"all-agents",label:"All agents"},{key:"settings",label:"Org settings"}];function _L(){const{role:e}=ja(),t=yr(),n=qr();if(e===null)return d.jsx("div",{className:"text-body",style:{padding:20,color:"var(--fg-3)"},children:"Loading…"});if(e!=="admin")return d.jsx(pg,{to:"/settings",replace:!0});const i=t.hash.replace("#",""),l=C1.some(u=>u.key===i)?i:"members",o=u=>{n({hash:u},{replace:!0})};return d.jsxs("div",{className:"-m-6",children:[d.jsx(ef,{title:"Admin",subtitle:"Organization-wide controls"}),d.jsx(Uj,{children:C1.map(u=>d.jsx(Bj,{active:l===u.key,onClick:()=>o(u.key),children:u.label},u.key))}),d.jsxs("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:[l==="members"&&d.jsx(SL,{}),l==="all-agents"&&d.jsx(pL,{}),l==="settings"&&d.jsx(EL,{})]})]})}function Zj(){return De.get("/admin/adapter-mappings")}function NL(e){return De.post("/admin/adapter-mappings",e)}function AL(e){return De.delete(`/admin/adapter-mappings/${e}`)}function Vj(){return De.get("/admin/adapters/status")}function Qj(){return De.get("/admin/adapters")}function TL(e){return De.post("/admin/adapters",e)}function RL(e,t){return De.patch(`/admin/adapters/${e}`,t)}function zL(e){return De.delete(`/admin/adapters/${e}`)}function OL(e){return De.get(`/admin/agents/${e}/config`)}function DL(e,t){return De.patch(`/admin/agents/${e}/config`,t)}function ML(e,t){return De.post(`/admin/agents/${e}/config/dry-run`,{payload:t})}function LL(e){return De.get(`/admin/agents/${e}/client-status`)}function IL({className:e,style:t,...n}){return d.jsx("div",{className:Te("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function UL({onClick:e,children:t}){return d.jsx("button",{type:"button",onClick:e,className:"bg-transparent border-0 p-0 cursor-pointer",style:{color:"var(--fg-3)",textDecoration:"none",font:"inherit"},onMouseEnter:n=>{n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--fg-3)"},children:t})}function BL(){return d.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function PL({children:e,mono:t}){return d.jsx("span",{className:Te("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}function hl({state:e,size:t=8,className:n}){const i={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?d.jsxs("span",{className:Te("shrink-0",n),style:i,role:"img","aria-label":"working",children:[d.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),d.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-working)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]}):e==="blocked"?d.jsx("span",{className:Te("shrink-0",n),style:{...i,border:"var(--hairline-bold) dashed var(--state-blocked)",borderRadius:"50%",animation:"dash-spin 4s linear infinite"},role:"img","aria-label":"blocked",children:d.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?d.jsx("span",{className:Te("shrink-0",n),style:{...i,background:"var(--state-error)",clipPath:"polygon(50% 0%, 100% 100%, 0% 100%)",borderRadius:1},role:"img","aria-label":"error"}):e==="idle"?d.jsx("span",{className:Te("shrink-0",n),style:{...i,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):d.jsx("span",{className:Te("shrink-0",n),style:{...i,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function $L(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function ml({state:e,className:t}){const n=e!==null&&$L(e)?e:"offline",i=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return d.jsxs("span",{className:Te("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:i},children:[d.jsx(hl,{state:n,size:7}),n]})}function ad({label:e,value:t,accent:n}){return d.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:4},children:[d.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),d.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:1},children:t})]})}function FL(e){const{agent:t}=e,[n,i]=S.useState(!1),l=t.displayName||t.name||t.uuid;return d.jsxs("section",{style:{background:"color-mix(in oklch, var(--state-error) 6%, var(--bg-raised))",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[d.jsx(JT,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),d.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),d.jsxs("div",{children:[t.status==="active"?d.jsx(qm,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:d.jsx(ve,{variant:"outline",size:"xs",onClick:e.onSuspend,disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):d.jsx(qm,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:d.jsx(ve,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),d.jsx(qm,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:d.jsxs(ve,{variant:"destructive",size:"xs",onClick:()=>i(!0),disabled:e.deletePending,children:[d.jsx(su,{className:"h-3 w-3"}),"Delete"]})})]}),d.jsx(qL,{open:n,onOpenChange:i,expected:l,onDelete:()=>{i(!1),e.onDelete()},deleting:e.deletePending})]})}function qm(e){return d.jsxs("div",{className:"flex items-start justify-between gap-4 text-body",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid color-mix(in oklch, var(--state-error) 14%, transparent)"},children:[d.jsxs("div",{children:[d.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),d.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),d.jsx("div",{children:e.action})]})}function qL({open:e,onOpenChange:t,expected:n,onDelete:i,deleting:l}){const[o,u]=S.useState("");function f(m){m.preventDefault(),o===n&&i()}return d.jsx(On,{open:e,onOpenChange:m=>{t(m),m||u("")},children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsxs(Mn,{children:['Delete "',n,'"?']})}),d.jsxs("form",{onSubmit:f,className:"space-y-4",children:[d.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",d.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),d.jsx(vt,{value:o,onChange:m=>u(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:l,children:"Cancel"}),d.jsx(ve,{type:"submit",variant:"destructive",disabled:o!==n||l,children:l?"Deleting…":"Delete"})]})]})]})})}const HL={unchanged:{label:"",tone:""},added:{label:"new",tone:"bg-success-soft text-success"},modified:{label:"changed",tone:"bg-warn-soft text-warn"},deleted:{label:"will be removed on save",tone:"bg-error-soft text-error"}};function Hg({status:e,onEdit:t,onDelete:n,onUndo:i,children:l,disabled:o}){const u=HL[e],f=e==="deleted";return d.jsxs("div",{className:Te("flex items-center gap-2 rounded border px-3 py-2 text-body",f?"bg-error-soft border-error text-error line-through decoration-error":"bg-card"),children:[d.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:l}),u.label&&d.jsx("span",{className:Te("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",u.tone),children:u.label}),!o&&(f?d.jsxs(ve,{size:"sm",variant:"ghost",onClick:i,children:[d.jsx(eR,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):d.jsx(ZL,{onEdit:t,onDelete:n}))]})}function ZL({onEdit:e,onDelete:t}){return d.jsxs("div",{className:"flex gap-1",children:[d.jsx(ve,{size:"sm",variant:"ghost",onClick:e,title:"Edit",children:"Edit"}),d.jsxs(ve,{size:"sm",variant:"ghost",onClick:t,title:"Delete",children:[d.jsx(xT,{className:"sr-only h-3.5 w-3.5","aria-hidden":!0}),"Delete"]})]})}function VL(e){const[t,n]=S.useState(null),i=e.items.filter(l=>l.status!=="deleted").length;return d.jsxs("section",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("h3",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:["Environment Variables (",i,")"]}),!e.disabled&&d.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[d.jsx(gl,{className:"h-3 w-3"})," Add"]})]}),d.jsx("div",{className:"px-4 py-3 space-y-2",children:e.items.length===0?d.jsx("p",{className:"text-body text-muted-foreground",children:"No environment variables."}):e.items.map(l=>d.jsxs(Hg,{status:l.status,onEdit:()=>n({mode:"edit",key:l.key,initial:l.value}),onDelete:()=>e.onDelete(l.key),onUndo:()=>e.onUndoDelete(l.key),disabled:e.disabled,children:[d.jsx("span",{className:"font-mono font-medium",children:l.value.key}),d.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:l.value.sensitive?"••••••":l.value.value||d.jsx("em",{children:"(empty)"})}),l.value.sensitive&&d.jsx(_T,{className:"h-3 w-3 text-muted-foreground"})]},l.key))}),t&&d.jsx(QL,{open:!!t,onOpenChange:l=>!l&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:l=>{t.mode==="edit"?e.onUpdate(t.key,l):e.onAdd(l),n(null)}})]})}function QL({open:e,onOpenChange:t,initial:n,forbiddenKeys:i,onSubmit:l}){const[o,u]=S.useState((n==null?void 0:n.key)??""),[f,m]=S.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,y]=S.useState((n==null?void 0:n.sensitive)??!1),[g,b]=S.useState(null);S.useEffect(()=>{e&&(u((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),y((n==null?void 0:n.sensitive)??!1),b(null))},[e,n]);function x(k){if(k.preventDefault(),!o.match(/^[A-Z][A-Z0-9_]*$/)){b("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(i.has(o)){b(`Another entry already uses key "${o}".`);return}let j=f;if(h&&(n!=null&&n.sensitive)&&!f&&(j=qp),!h&&!n&&!f){b("Value is required for non-sensitive entries.");return}l({key:o,value:j,sensitive:h})}return d.jsx(On,{open:e,onOpenChange:t,children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:n?"Edit environment variable":"Add environment variable"})}),d.jsxs("form",{onSubmit:x,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"env-key",children:"Key"}),d.jsx(vt,{id:"env-key",value:o,onChange:k=>u(k.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&d.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"env-value",children:"Value"}),d.jsx(vt,{id:"env-value",type:h?"password":"text",autoComplete:"new-password",value:f,onChange:k=>m(k.target.value),placeholder:n!=null&&n.sensitive?"Leave empty to keep existing value":h?"new secret":"value",className:"font-mono"})]}),d.jsxs("label",{className:"flex items-center gap-2 text-body",children:[d.jsx("input",{type:"checkbox",checked:h,onChange:k=>y(k.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),d.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),g&&d.jsx("p",{className:"text-body text-destructive",children:g}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),d.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function GL(e){const[t,n]=S.useState(null),i=e.items.filter(l=>l.status!=="deleted").length;return d.jsxs("section",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("h3",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:["Git Repositories (",i,")"]}),!e.disabled&&d.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[d.jsx(gl,{className:"h-3 w-3"})," Add"]})]}),d.jsx("div",{className:"px-4 py-3 space-y-2",children:e.items.length===0?d.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(l=>{const o=l.value.localPath??Ad(l.value.url);return d.jsxs(Hg,{status:l.status,onEdit:()=>n({mode:"edit",key:l.key,initial:l.value}),onDelete:()=>e.onDelete(l.key),onUndo:()=>e.onUndoDelete(l.key),disabled:e.disabled,children:[d.jsx("span",{className:"font-mono text-caption",children:l.value.url}),l.value.ref&&d.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",l.value.ref]}),d.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",o||"./"]})]},l.key)})}),t&&d.jsx(KL,{open:!!t,onOpenChange:l=>!l&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenPaths:e.otherPaths(t.mode==="edit"?t.key:null),onSubmit:l=>{t.mode==="edit"?e.onUpdate(t.key,l):e.onAdd(l),n(null)}})]})}function KL({open:e,onOpenChange:t,initial:n,forbiddenPaths:i,onSubmit:l}){const[o,u]=S.useState((n==null?void 0:n.url)??""),[f,m]=S.useState((n==null?void 0:n.ref)??""),[h,y]=S.useState((n==null?void 0:n.localPath)??""),[g,b]=S.useState(null);S.useEffect(()=>{e&&(u((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),y((n==null?void 0:n.localPath)??""),b(null))},[e,n]);function x(k){k.preventDefault();const j=o.trim();if(!j){b("URL is required.");return}const E=h.trim()||Ad(j);if(E&&i.has(E)){b(`Another repo already occupies local path "${E}".`);return}const N={url:j,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};l(N)}return d.jsx(On,{open:e,onOpenChange:t,children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:n?"Edit Git repository":"Add Git repository"})}),d.jsxs("form",{onSubmit:x,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"git-url",children:"URL"}),d.jsx(vt,{id:"git-url",value:o,onChange:k=>u(k.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),d.jsx(vt,{id:"git-ref",value:f,onChange:k=>m(k.target.value),placeholder:"main",className:"font-mono"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"git-path",children:"Local path (optional)"}),d.jsx(vt,{id:"git-path",value:h,onChange:k=>y(k.target.value),placeholder:Ad(o)||"repo-name",className:"font-mono"}),d.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),g&&d.jsx("p",{className:"text-body text-destructive",children:g}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),d.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function YL({agent:e,onSave:t}){const[n,i]=S.useState(!1),l=Ei(),o=qg(),u=e.metadata,f=u==null?void 0:u.tree,m=typeof(f==null?void 0:f.role)=="string"?f.role:null,h=Array.isArray(f==null?void 0:f.domains)?(f==null?void 0:f.domains).filter(b=>typeof b=="string"):[],y=e.managerId?o(e.managerId):null,g=e.delegateMention?l(e.delegateMention):null;return d.jsxs("section",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsx("h2",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:"Profile"}),e.status==="active"&&d.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>i(!0),children:[d.jsx($d,{className:"h-3 w-3"})," Edit"]})]}),d.jsxs("div",{className:"px-4 py-3 text-body space-y-1",children:[d.jsxs("div",{children:[d.jsx("span",{className:"font-mono",children:e.name??e.uuid}),d.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),d.jsx("span",{children:e.displayName??d.jsx("span",{className:"text-muted-foreground italic",children:"no display name"})}),g&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),d.jsxs("span",{className:"text-muted-foreground",children:["delegate ",d.jsx("span",{className:"font-mono",children:g})]})]})]}),d.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[d.jsxs("span",{children:["owner ",d.jsx("span",{className:"text-foreground",children:y??"—"})]}),m&&d.jsxs("span",{children:["role ",d.jsx("span",{className:"text-foreground",children:m})]}),d.jsxs("span",{children:["type ",d.jsx(Wt,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),d.jsxs("span",{children:["visibility"," ",d.jsx(Wt,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),h.length>0&&d.jsxs("span",{children:["domains"," ",d.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:h.map(b=>d.jsx(Wt,{tone:"outline",children:b},b))})]})]})]}),d.jsx(XL,{agent:e,open:n,onOpenChange:i,onSave:t})]})}function XL({agent:e,open:t,onOpenChange:n,onSave:i}){var U;const{memberId:l,role:o}=ja(),[u,f]=S.useState(e.displayName??""),[m,h]=S.useState(e.delegateMention??""),[y,g]=S.useState(e.visibility),[b,x]=S.useState(!1),[k,j]=S.useState(null);S.useEffect(()=>{t&&(f(e.displayName??""),h(e.delegateMention??""),g(e.visibility),j(null))},[t,e]);const E=e.type==="human",N=o==="admin"||e.managerId===l,T=qe({queryKey:["agents-for-delegate"],queryFn:async()=>(await Ng({limit:100})).items.filter(z=>z.type==="personal_assistant"&&z.status==="active"),enabled:t&&E});async function D(B){B.preventDefault(),j(null),x(!0);try{const z={displayName:u||null,delegateMention:m||null};y!==e.visibility&&(z.visibility=y),await i(z),n(!1)}catch(z){j(z instanceof Error?z.message:String(z))}finally{x(!1)}}return d.jsx(On,{open:t,onOpenChange:n,children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:"Edit Identity"})}),d.jsxs("form",{onSubmit:D,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{children:"Name (mention)"}),d.jsx(vt,{value:e.name??"",disabled:!0,className:"font-mono"}),d.jsx("p",{className:"text-caption text-muted-foreground",children:"Name is permanent after creation."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"id-display",children:"Display Name"}),d.jsx(vt,{id:"id-display",value:u,onChange:B=>f(B.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"id-visibility",children:"Visibility"}),d.jsxs("select",{id:"id-visibility",value:y,onChange:B=>g(B.target.value),disabled:!N,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[d.jsx("option",{value:S1.PRIVATE,children:"Private — only the manager"}),d.jsx("option",{value:S1.ORGANIZATION,children:"Organization — all members"})]}),d.jsx("p",{className:"text-caption text-muted-foreground",children:N?"Private agents are only visible to their manager; organization agents appear in every member's list.":"Only the manager or an admin can change this agent's visibility."})]}),E&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"id-delegate",children:"Delegate Mention"}),d.jsxs("select",{id:"id-delegate",value:m,onChange:B=>h(B.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[d.jsx("option",{value:"",children:"None"}),(U=T.data)==null?void 0:U.map(B=>d.jsx("option",{value:B.uuid,children:B.displayName?`${B.displayName} (${B.name??B.uuid})`:B.name??B.uuid},B.uuid))]}),d.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),k&&d.jsx("p",{className:"text-body text-destructive",children:k}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:b,children:"Cancel"}),d.jsx(ve,{type:"submit",disabled:b,children:b?"Saving…":"Save"})]})]})]})})}function JL(e){const[t,n]=S.useState(null),i=e.items.filter(l=>l.status!=="deleted").length;return d.jsxs("section",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("h3",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:["MCP Servers (",i,")"]}),!e.disabled&&d.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[d.jsx(gl,{className:"h-3 w-3"})," Add"]})]}),d.jsx("div",{className:"px-4 py-3 space-y-2",children:e.items.length===0?d.jsx("p",{className:"text-body text-muted-foreground",children:"No MCP servers. Add one to extend the agent's tools."}):e.items.map(l=>d.jsxs(Hg,{status:l.status,onEdit:()=>n({mode:"edit",key:l.key,initial:l.value}),onDelete:()=>e.onDelete(l.key),onUndo:()=>e.onUndoDelete(l.key),disabled:e.disabled,children:[d.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:l.value.transport}),d.jsx("span",{className:"font-medium font-mono",children:l.value.name}),d.jsx("span",{className:"text-caption text-muted-foreground truncate",children:WL(l.value)})]},l.key))}),t&&d.jsx(eI,{open:!!t,onOpenChange:l=>!l&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenNames:e.otherNames(t.mode==="edit"?t.key:null),onSubmit:l=>{t.mode==="edit"?e.onUpdate(t.key,l):e.onAdd(l),n(null)}})]})}function WL(e){var t;if(e.transport==="stdio"){const n=(t=e.args)!=null&&t.length?` ${e.args.join(" ")}`:"";return`${e.command}${n}`}return e.url}function eI({open:e,onOpenChange:t,initial:n,forbiddenNames:i,onSubmit:l}){const[o,u]=S.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=S.useState((n==null?void 0:n.name)??""),[h,y]=S.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[g,b]=S.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[x,k]=S.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[j,E]=S.useState(null);S.useEffect(()=>{e&&(u((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),y((n==null?void 0:n.transport)==="stdio"?n.command:""),b((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),k(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),E(null))},[e,n]);function N(T){if(T.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){E("Name must start alphanumeric and contain only a-z0-9_-.");return}if(i.has(f.toLowerCase())){E(`Another MCP server is already named "${f}".`);return}let D;if(o==="stdio"){if(!h.trim()){E("stdio transport requires a command.");return}const U=g.trim().split(/\s+/).filter(B=>B.length>0);D={name:f,transport:"stdio",command:h.trim(),...U.length?{args:U}:{}}}else{const U=x.trim();try{new URL(U)}catch{E("URL is not valid.");return}D={name:f,transport:o,url:U}}l(D)}return d.jsx(On,{open:e,onOpenChange:t,children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:n?"Edit MCP server":"Add MCP server"})}),d.jsxs("form",{onSubmit:N,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-transport",children:"Transport"}),d.jsxs("select",{id:"mcp-transport",value:o,onChange:T=>u(T.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[d.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),d.jsx("option",{value:"http",children:"http"}),d.jsx("option",{value:"sse",children:"sse"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-name",children:"Name"}),d.jsx(vt,{id:"mcp-name",value:f,onChange:T=>m(T.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-command",children:"Command"}),d.jsx(vt,{id:"mcp-command",value:h,onChange:T=>y(T.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),d.jsx(vt,{id:"mcp-args",value:g,onChange:T=>b(T.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-url",children:"URL"}),d.jsx(vt,{id:"mcp-url",value:x,onChange:T=>k(T.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),j&&d.jsx("p",{className:"text-body text-destructive",children:j}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),d.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const _1=[{value:"claude-opus-4-6",label:"claude-opus-4-6",hint:"most capable"},{value:"claude-sonnet-4-6",label:"claude-sonnet-4-6",hint:"default"},{value:"claude-haiku-4-5",label:"claude-haiku-4-5",hint:"fastest"}];function tI({value:e,baseline:t,onChange:n,onRevert:i,disabled:l}){const o=e!==t,u=!_1.some(f=>f.value===e)&&e!=="";return d.jsxs("section",{style:{background:"var(--bg-raised)",border:`var(--hairline) solid ${o?"color-mix(in oklch, var(--state-blocked) 40%, transparent)":"var(--border)"}`,borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("h3",{className:"inline-flex items-center gap-2 text-body font-semibold",style:{color:"var(--fg)"},children:["Model",o&&d.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:3,background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))"},children:"changed"})]}),o&&d.jsx(ve,{size:"xs",variant:"ghost",onClick:i,disabled:l,children:"Revert"})]}),d.jsxs("div",{className:"px-4 py-3 space-y-2",children:[d.jsxs("select",{value:e,onChange:f=>n(f.target.value),disabled:l,className:"flex h-9 w-full max-w-md rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:[d.jsx("option",{value:"",children:"(agent default)"}),_1.map(f=>d.jsxs("option",{value:f.value,children:[f.label,f.hint?` — ${f.hint}`:""]},f.value)),u&&d.jsxs("option",{value:e,children:[e," — custom"]})]}),d.jsx("p",{className:"text-caption text-muted-foreground",children:"Choose which Claude model powers this agent. Applies to new sessions immediately; active sessions switch on their next message."})]})]})}function nI(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const rI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iI={};function N1(e,t){return(iI.jsx?aI:rI).test(e)}const lI=/[ \t\n\f\r]/g;function sI(e){return typeof e=="object"?e.type==="text"?A1(e.value):!1:A1(e)}function A1(e){return e.replace(lI,"")===""}class _u{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}_u.prototype.normal={};_u.prototype.property={};_u.prototype.space=void 0;function Gj(e,t){const n={},i={};for(const l of e)Object.assign(n,l.property),Object.assign(i,l.normal);return new _u(n,i,t)}function Zp(e){return e.toLowerCase()}class Un{constructor(t,n){this.attribute=n,this.property=t}}Un.prototype.attribute="";Un.prototype.booleanish=!1;Un.prototype.boolean=!1;Un.prototype.commaOrSpaceSeparated=!1;Un.prototype.commaSeparated=!1;Un.prototype.defined=!1;Un.prototype.mustUseProperty=!1;Un.prototype.number=!1;Un.prototype.overloadedBoolean=!1;Un.prototype.property="";Un.prototype.spaceSeparated=!1;Un.prototype.space=void 0;let oI=0;const Pe=xl(),$t=xl(),Vp=xl(),he=xl(),xt=xl(),xs=xl(),Gn=xl();function xl(){return 2**++oI}const Qp=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pe,booleanish:$t,commaOrSpaceSeparated:Gn,commaSeparated:xs,number:he,overloadedBoolean:Vp,spaceSeparated:xt},Symbol.toStringTag,{value:"Module"})),Hm=Object.keys(Qp);class Zg extends Un{constructor(t,n,i,l){let o=-1;if(super(t,n),T1(this,"space",l),typeof i=="number")for(;++o<Hm.length;){const u=Hm[o];T1(this,Hm[o],(i&Qp[u])===Qp[u])}}}Zg.prototype.defined=!0;function T1(e,t,n){n&&(e[t]=n)}function Hs(e){const t={},n={};for(const[i,l]of Object.entries(e.properties)){const o=new Zg(i,e.transform(e.attributes||{},i),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[Zp(i)]=i,n[Zp(o.attribute)]=i}return new _u(t,n,e.space)}const Kj=Hs({properties:{ariaActiveDescendant:null,ariaAtomic:$t,ariaAutoComplete:null,ariaBusy:$t,ariaChecked:$t,ariaColCount:he,ariaColIndex:he,ariaColSpan:he,ariaControls:xt,ariaCurrent:null,ariaDescribedBy:xt,ariaDetails:null,ariaDisabled:$t,ariaDropEffect:xt,ariaErrorMessage:null,ariaExpanded:$t,ariaFlowTo:xt,ariaGrabbed:$t,ariaHasPopup:null,ariaHidden:$t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xt,ariaLevel:he,ariaLive:null,ariaModal:$t,ariaMultiLine:$t,ariaMultiSelectable:$t,ariaOrientation:null,ariaOwns:xt,ariaPlaceholder:null,ariaPosInSet:he,ariaPressed:$t,ariaReadOnly:$t,ariaRelevant:null,ariaRequired:$t,ariaRoleDescription:xt,ariaRowCount:he,ariaRowIndex:he,ariaRowSpan:he,ariaSelected:$t,ariaSetSize:he,ariaSort:null,ariaValueMax:he,ariaValueMin:he,ariaValueNow:he,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Yj(e,t){return t in e?e[t]:t}function Xj(e,t){return Yj(e,t.toLowerCase())}const uI=Hs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xs,acceptCharset:xt,accessKey:xt,action:null,allow:null,allowFullScreen:Pe,allowPaymentRequest:Pe,allowUserMedia:Pe,alt:null,as:null,async:Pe,autoCapitalize:null,autoComplete:xt,autoFocus:Pe,autoPlay:Pe,blocking:xt,capture:null,charSet:null,checked:Pe,cite:null,className:xt,cols:he,colSpan:null,content:null,contentEditable:$t,controls:Pe,controlsList:xt,coords:he|xs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pe,defer:Pe,dir:null,dirName:null,disabled:Pe,download:Vp,draggable:$t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pe,formTarget:null,headers:xt,height:he,hidden:Vp,high:he,href:null,hrefLang:null,htmlFor:xt,httpEquiv:xt,id:null,imageSizes:null,imageSrcSet:null,inert:Pe,inputMode:null,integrity:null,is:null,isMap:Pe,itemId:null,itemProp:xt,itemRef:xt,itemScope:Pe,itemType:xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pe,low:he,manifest:null,max:null,maxLength:he,media:null,method:null,min:null,minLength:he,multiple:Pe,muted:Pe,name:null,nonce:null,noModule:Pe,noValidate:Pe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Pe,optimum:he,pattern:null,ping:xt,placeholder:null,playsInline:Pe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pe,referrerPolicy:null,rel:xt,required:Pe,reversed:Pe,rows:he,rowSpan:he,sandbox:xt,scope:null,scoped:Pe,seamless:Pe,selected:Pe,shadowRootClonable:Pe,shadowRootDelegatesFocus:Pe,shadowRootMode:null,shape:null,size:he,sizes:null,slot:null,span:he,spellCheck:$t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:he,step:null,style:null,tabIndex:he,target:null,title:null,translate:null,type:null,typeMustMatch:Pe,useMap:null,value:$t,width:he,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xt,axis:null,background:null,bgColor:null,border:he,borderColor:null,bottomMargin:he,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Pe,declare:Pe,event:null,face:null,frame:null,frameBorder:null,hSpace:he,leftMargin:he,link:null,longDesc:null,lowSrc:null,marginHeight:he,marginWidth:he,noResize:Pe,noHref:Pe,noShade:Pe,noWrap:Pe,object:null,profile:null,prompt:null,rev:null,rightMargin:he,rules:null,scheme:null,scrolling:$t,standby:null,summary:null,text:null,topMargin:he,valueType:null,version:null,vAlign:null,vLink:null,vSpace:he,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Pe,disableRemotePlayback:Pe,prefix:null,property:null,results:he,security:null,unselectable:null},space:"html",transform:Xj}),cI=Hs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Gn,accentHeight:he,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:he,amplitude:he,arabicForm:null,ascent:he,attributeName:null,attributeType:null,azimuth:he,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:he,by:null,calcMode:null,capHeight:he,className:xt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:he,diffuseConstant:he,direction:null,display:null,dur:null,divisor:he,dominantBaseline:null,download:Pe,dx:null,dy:null,edgeMode:null,editable:null,elevation:he,enableBackground:null,end:null,event:null,exponent:he,externalResourcesRequired:null,fill:null,fillOpacity:he,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xs,g2:xs,glyphName:xs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:he,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:he,horizOriginX:he,horizOriginY:he,id:null,ideographic:he,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:he,k:he,k1:he,k2:he,k3:he,k4:he,kernelMatrix:Gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:he,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:he,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:he,overlineThickness:he,paintOrder:null,panose1:null,path:null,pathLength:he,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:he,pointsAtY:he,pointsAtZ:he,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:he,specularExponent:he,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:he,strikethroughThickness:he,string:null,stroke:null,strokeDashArray:Gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:he,strokeOpacity:he,strokeWidth:null,style:null,surfaceScale:he,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gn,tabIndex:he,tableValues:null,target:null,targetX:he,targetY:he,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:he,underlineThickness:he,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:he,values:null,vAlphabetic:he,vMathematical:he,vectorEffect:null,vHanging:he,vIdeographic:he,version:null,vertAdvY:he,vertOriginX:he,vertOriginY:he,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:he,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Yj}),Jj=Hs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Wj=Hs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Xj}),eE=Hs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),dI={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},fI=/[A-Z]/g,R1=/-[a-z]/g,hI=/^data[-\w.:]+$/i;function mI(e,t){const n=Zp(t);let i=t,l=Un;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hI.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(R1,gI);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!R1.test(o)){let u=o.replace(fI,pI);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}l=Zg}return new l(i,t)}function pI(e){return"-"+e.toLowerCase()}function gI(e){return e.charAt(1).toUpperCase()}const yI=Gj([Kj,uI,Jj,Wj,eE],"html"),Vg=Gj([Kj,cI,Jj,Wj,eE],"svg");function vI(e){return e.join(" ").trim()}var cs={},Zm,z1;function bI(){if(z1)return Zm;z1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
332
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const g=y[1];if(t===y[0]){o(y);continue}if(e.external){const x=(m=e.external.registry.get(y[0]))==null?void 0:m.id;if(t!==y[0]&&x){o(y);continue}}if((h=e.metadataRegistry.get(y[0]))==null?void 0:h.id){o(y);continue}if(g.cycle){o(y);continue}if(g.count>1&&e.reused==="ref"){o(y);continue}}}function fj(e,t){var u,f,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=h=>{const y=e.seen.get(h);if(y.ref===null)return;const g=y.def??y.schema,b={...g},x=y.ref;if(y.ref=null,x){i(x);const j=e.seen.get(x),E=j.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(E)):Object.assign(g,E),Object.assign(g,b),h._zod.parent===x)for(const T in g)T==="$ref"||T==="allOf"||T in b||delete g[T];if(E.$ref&&j.def)for(const T in g)T==="$ref"||T==="allOf"||T in j.def&&JSON.stringify(g[T])===JSON.stringify(j.def[T])&&delete g[T]}const k=h._zod.parent;if(k&&k!==x){i(k);const j=e.seen.get(k);if(j!=null&&j.schema.$ref&&(g.$ref=j.schema.$ref,j.def))for(const E in g)E==="$ref"||E==="allOf"||E in j.def&&JSON.stringify(g[E])===JSON.stringify(j.def[E])&&delete g[E]}e.override({zodSchema:h,jsonSchema:g,path:y.path??[]})};for(const h of[...e.seen.entries()].reverse())i(h[0]);const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,(u=e.external)!=null&&u.uri){const h=(f=e.external.registry.get(t))==null?void 0:f.id;if(!h)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(h)}Object.assign(l,n.def??n.schema);const o=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const y=h[1];y.def&&y.defId&&(o[y.defId]=y.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?l.$defs=o:l.definitions=o);try{const h=JSON.parse(JSON.stringify(l));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Nd(t,"input",e.processors),output:Nd(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function yn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return yn(i.element,n);if(i.type==="set")return yn(i.valueType,n);if(i.type==="lazy")return yn(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return yn(i.innerType,n);if(i.type==="intersection")return yn(i.left,n)||yn(i.right,n);if(i.type==="record"||i.type==="map")return yn(i.keyType,n)||yn(i.valueType,n);if(i.type==="pipe")return yn(i.in,n)||yn(i.out,n);if(i.type==="object"){for(const l in i.shape)if(yn(i.shape[l],n))return!0;return!1}if(i.type==="union"){for(const l of i.options)if(yn(l,n))return!0;return!1}if(i.type==="tuple"){for(const l of i.items)if(yn(l,n))return!0;return!!(i.rest&&yn(i.rest,n))}return!1}const D4=(e,t={})=>n=>{const i=cj({...n,processors:t});return Ft(e,i),dj(i,e),fj(i,e)},Nd=(e,t,n={})=>i=>{const{libraryOptions:l,target:o}=i??{},u=cj({...l??{},target:o,io:t,processors:n});return Ft(e,u),dj(u,e),fj(u,e)},M4={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},L4=(e,t,n,i)=>{const l=n;l.type="string";const{minimum:o,maximum:u,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof o=="number"&&(l.minLength=o),typeof u=="number"&&(l.maxLength=u),f&&(l.format=M4[f]??f,l.format===""&&delete l.format,f==="time"&&delete l.format),h&&(l.contentEncoding=h),m&&m.size>0){const y=[...m];y.length===1?l.pattern=y[0].source:y.length>1&&(l.allOf=[...y.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},I4=(e,t,n,i)=>{const l=n,{minimum:o,maximum:u,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof f=="string"&&f.includes("int")?l.type="integer":l.type="number",typeof y=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(l.minimum=y,l.exclusiveMinimum=!0):l.exclusiveMinimum=y),typeof o=="number"&&(l.minimum=o,typeof y=="number"&&t.target!=="draft-04"&&(y>=o?delete l.minimum:delete l.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(l.maximum=h,l.exclusiveMaximum=!0):l.exclusiveMaximum=h),typeof u=="number"&&(l.maximum=u,typeof h=="number"&&t.target!=="draft-04"&&(h<=u?delete l.maximum:delete l.exclusiveMaximum)),typeof m=="number"&&(l.multipleOf=m)},U4=(e,t,n,i)=>{n.type="boolean"},B4=(e,t,n,i)=>{n.not={}},P4=(e,t,n,i)=>{},$4=(e,t,n,i)=>{const l=e._zod.def,o=qk(l.entries);o.every(u=>typeof u=="number")&&(n.type="number"),o.every(u=>typeof u=="string")&&(n.type="string"),n.enum=o},F4=(e,t,n,i)=>{const l=e._zod.def,o=[];for(const u of l.values)if(u===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof u=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(u))}else o.push(u);if(o.length!==0)if(o.length===1){const u=o[0];n.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[u]:n.const=u}else o.every(u=>typeof u=="number")&&(n.type="number"),o.every(u=>typeof u=="string")&&(n.type="string"),o.every(u=>typeof u=="boolean")&&(n.type="boolean"),o.every(u=>u===null)&&(n.type="null"),n.enum=o},q4=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},H4=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Z4=(e,t,n,i)=>{const l=n,o=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(l.minItems=u),typeof f=="number"&&(l.maxItems=f),l.type="array",l.items=Ft(o.element,t,{...i,path:[...i.path,"items"]})},V4=(e,t,n,i)=>{var h;const l=n,o=e._zod.def;l.type="object",l.properties={};const u=o.shape;for(const y in u)l.properties[y]=Ft(u[y],t,{...i,path:[...i.path,"properties",y]});const f=new Set(Object.keys(u)),m=new Set([...f].filter(y=>{const g=o.shape[y]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));m.size>0&&(l.required=Array.from(m)),((h=o.catchall)==null?void 0:h._zod.def.type)==="never"?l.additionalProperties=!1:o.catchall?o.catchall&&(l.additionalProperties=Ft(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(l.additionalProperties=!1)},Q4=(e,t,n,i)=>{const l=e._zod.def,o=l.inclusive===!1,u=l.options.map((f,m)=>Ft(f,t,{...i,path:[...i.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=u:n.anyOf=u},G4=(e,t,n,i)=>{const l=e._zod.def,o=Ft(l.left,t,{...i,path:[...i.path,"allOf",0]}),u=Ft(l.right,t,{...i,path:[...i.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(o)?o.allOf:[o],...f(u)?u.allOf:[u]];n.allOf=m},K4=(e,t,n,i)=>{const l=n,o=e._zod.def;l.type="object";const u=o.keyType,f=u._zod.bag,m=f==null?void 0:f.patterns;if(o.mode==="loose"&&m&&m.size>0){const y=Ft(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});l.patternProperties={};for(const g of m)l.patternProperties[g.source]=y}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(l.propertyNames=Ft(o.keyType,t,{...i,path:[...i.path,"propertyNames"]})),l.additionalProperties=Ft(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]});const h=u._zod.values;if(h){const y=[...h].filter(g=>typeof g=="string"||typeof g=="number");y.length>0&&(l.required=y)}},Y4=(e,t,n,i)=>{const l=e._zod.def,o=Ft(l.innerType,t,i),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=l.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},X4=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType},J4=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType,n.default=JSON.parse(JSON.stringify(l.defaultValue))},W4=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(l.defaultValue)))},e5=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType;let u;try{u=l.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=u},t5=(e,t,n,i)=>{const l=e._zod.def,o=t.io==="input"?l.in._zod.def.type==="transform"?l.out:l.in:l.out;Ft(o,t,i);const u=t.seen.get(e);u.ref=o},n5=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType,n.readOnly=!0},hj=(e,t,n,i)=>{const l=e._zod.def;Ft(l.innerType,t,i);const o=t.seen.get(e);o.ref=l.innerType},r5=ie("ZodISODateTime",(e,t)=>{rM.init(e,t),Tt.init(e,t)});function a5(e){return u4(r5,e)}const i5=ie("ZodISODate",(e,t)=>{aM.init(e,t),Tt.init(e,t)});function l5(e){return c4(i5,e)}const s5=ie("ZodISOTime",(e,t)=>{iM.init(e,t),Tt.init(e,t)});function o5(e){return d4(s5,e)}const u5=ie("ZodISODuration",(e,t)=>{lM.init(e,t),Tt.init(e,t)});function c5(e){return f4(u5,e)}const d5=(e,t)=>{Qk.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>YD(e,n)},flatten:{value:n=>KD(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Pp,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Pp,2)}},isEmpty:{get(){return e.issues.length===0}}})},vr=ie("ZodError",d5,{Parent:Error}),f5=zg(vr),h5=Og(vr),m5=Kd(vr),p5=Yd(vr),g5=WD(vr),y5=e3(vr),v5=t3(vr),b5=n3(vr),x5=r3(vr),S5=a3(vr),w5=i3(vr),k5=l3(vr),At=ie("ZodType",(e,t)=>(Nt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Nd(e,"input"),output:Nd(e,"output")}}),e.toJSONSchema=D4(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ci(t,{checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0}),e.with=e.check,e.clone=(n,i)=>_i(e,n,i),e.brand=()=>e,e.register=((n,i)=>(n.add(e,i),e)),e.parse=(n,i)=>f5(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>m5(e,n,i),e.parseAsync=async(n,i)=>h5(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>p5(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>g5(e,n,i),e.decode=(n,i)=>y5(e,n,i),e.encodeAsync=async(n,i)=>v5(e,n,i),e.decodeAsync=async(n,i)=>b5(e,n,i),e.safeEncode=(n,i)=>x5(e,n,i),e.safeDecode=(n,i)=>S5(e,n,i),e.safeEncodeAsync=async(n,i)=>w5(e,n,i),e.safeDecodeAsync=async(n,i)=>k5(e,n,i),e.refine=(n,i)=>e.check(g6(n,i)),e.superRefine=n=>e.check(y6(n)),e.overwrite=n=>e.check(qs(n)),e.optional=()=>v1(e),e.exactOptional=()=>r6(e),e.nullable=()=>b1(e),e.nullish=()=>v1(b1(e)),e.nonoptional=n=>u6(e,n),e.array=()=>Yn(e),e.or=n=>gj([e,n]),e.and=n=>X5(e,n),e.transform=n=>x1(e,t6(n)),e.default=n=>l6(e,n),e.prefault=n=>o6(e,n),e.catch=n=>d6(e,n),e.pipe=n=>x1(e,n),e.readonly=()=>m6(e),e.describe=n=>{const i=e.clone();return Xo.add(i,{description:n}),i},Object.defineProperty(e,"description",{get(){var n;return(n=Xo.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Xo.get(e);const i=e.clone();return Xo.add(i,n[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),mj=ie("_ZodString",(e,t)=>{Dg.init(e,t),At.init(e,t),e._zod.processJSONSchema=(i,l,o)=>L4(e,i,l);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...i)=>e.check(b4(...i)),e.includes=(...i)=>e.check(w4(...i)),e.startsWith=(...i)=>e.check(k4(...i)),e.endsWith=(...i)=>e.check(j4(...i)),e.min=(...i)=>e.check(_d(...i)),e.max=(...i)=>e.check(oj(...i)),e.length=(...i)=>e.check(uj(...i)),e.nonempty=(...i)=>e.check(_d(1,...i)),e.lowercase=i=>e.check(x4(i)),e.uppercase=i=>e.check(S4(i)),e.trim=()=>e.check(C4()),e.normalize=(...i)=>e.check(E4(...i)),e.toLowerCase=()=>e.check(_4()),e.toUpperCase=()=>e.check(N4()),e.slugify=()=>e.check(A4())}),j5=ie("ZodString",(e,t)=>{Dg.init(e,t),mj.init(e,t),e.email=n=>e.check(FM(E5,n)),e.url=n=>e.check(QM(C5,n)),e.jwt=n=>e.check(o4($5,n)),e.emoji=n=>e.check(GM(_5,n)),e.guid=n=>e.check(f1(g1,n)),e.uuid=n=>e.check(qM(rd,n)),e.uuidv4=n=>e.check(HM(rd,n)),e.uuidv6=n=>e.check(ZM(rd,n)),e.uuidv7=n=>e.check(VM(rd,n)),e.nanoid=n=>e.check(KM(N5,n)),e.guid=n=>e.check(f1(g1,n)),e.cuid=n=>e.check(YM(A5,n)),e.cuid2=n=>e.check(XM(T5,n)),e.ulid=n=>e.check(JM(R5,n)),e.base64=n=>e.check(i4(U5,n)),e.base64url=n=>e.check(l4(B5,n)),e.xid=n=>e.check(WM(z5,n)),e.ksuid=n=>e.check(e4(O5,n)),e.ipv4=n=>e.check(t4(D5,n)),e.ipv6=n=>e.check(n4(M5,n)),e.cidrv4=n=>e.check(r4(L5,n)),e.cidrv6=n=>e.check(a4(I5,n)),e.e164=n=>e.check(s4(P5,n)),e.datetime=n=>e.check(a5(n)),e.date=n=>e.check(l5(n)),e.time=n=>e.check(o5(n)),e.duration=n=>e.check(c5(n))});function O(e){return $M(j5,e)}const Tt=ie("ZodStringFormat",(e,t)=>{Ct.init(e,t),mj.init(e,t)}),E5=ie("ZodEmail",(e,t)=>{G3.init(e,t),Tt.init(e,t)}),g1=ie("ZodGUID",(e,t)=>{V3.init(e,t),Tt.init(e,t)}),rd=ie("ZodUUID",(e,t)=>{Q3.init(e,t),Tt.init(e,t)}),C5=ie("ZodURL",(e,t)=>{K3.init(e,t),Tt.init(e,t)}),_5=ie("ZodEmoji",(e,t)=>{Y3.init(e,t),Tt.init(e,t)}),N5=ie("ZodNanoID",(e,t)=>{X3.init(e,t),Tt.init(e,t)}),A5=ie("ZodCUID",(e,t)=>{J3.init(e,t),Tt.init(e,t)}),T5=ie("ZodCUID2",(e,t)=>{W3.init(e,t),Tt.init(e,t)}),R5=ie("ZodULID",(e,t)=>{eM.init(e,t),Tt.init(e,t)}),z5=ie("ZodXID",(e,t)=>{tM.init(e,t),Tt.init(e,t)}),O5=ie("ZodKSUID",(e,t)=>{nM.init(e,t),Tt.init(e,t)}),D5=ie("ZodIPv4",(e,t)=>{sM.init(e,t),Tt.init(e,t)}),M5=ie("ZodIPv6",(e,t)=>{oM.init(e,t),Tt.init(e,t)}),L5=ie("ZodCIDRv4",(e,t)=>{uM.init(e,t),Tt.init(e,t)}),I5=ie("ZodCIDRv6",(e,t)=>{cM.init(e,t),Tt.init(e,t)}),U5=ie("ZodBase64",(e,t)=>{dM.init(e,t),Tt.init(e,t)}),B5=ie("ZodBase64URL",(e,t)=>{hM.init(e,t),Tt.init(e,t)}),P5=ie("ZodE164",(e,t)=>{mM.init(e,t),Tt.init(e,t)}),$5=ie("ZodJWT",(e,t)=>{gM.init(e,t),Tt.init(e,t)}),Mg=ie("ZodNumber",(e,t)=>{rj.init(e,t),At.init(e,t),e._zod.processJSONSchema=(i,l,o)=>I4(e,i,l),e.gt=(i,l)=>e.check(m1(i,l)),e.gte=(i,l)=>e.check(Pm(i,l)),e.min=(i,l)=>e.check(Pm(i,l)),e.lt=(i,l)=>e.check(h1(i,l)),e.lte=(i,l)=>e.check(Bm(i,l)),e.max=(i,l)=>e.check(Bm(i,l)),e.int=i=>e.check(y1(i)),e.safe=i=>e.check(y1(i)),e.positive=i=>e.check(m1(0,i)),e.nonnegative=i=>e.check(Pm(0,i)),e.negative=i=>e.check(h1(0,i)),e.nonpositive=i=>e.check(Bm(0,i)),e.multipleOf=(i,l)=>e.check(p1(i,l)),e.step=(i,l)=>e.check(p1(i,l)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function He(e){return h4(Mg,e)}const F5=ie("ZodNumberFormat",(e,t)=>{yM.init(e,t),Mg.init(e,t)});function y1(e){return p4(F5,e)}const q5=ie("ZodBoolean",(e,t)=>{vM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>U4(e,n,i)});function Eu(e){return g4(q5,e)}const H5=ie("ZodUnknown",(e,t)=>{bM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>P4()});function St(){return y4(H5)}const Z5=ie("ZodNever",(e,t)=>{xM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>B4(e,n,i)});function V5(e){return v4(Z5,e)}const Q5=ie("ZodArray",(e,t)=>{SM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>Z4(e,n,i,l),e.element=t.element,e.min=(n,i)=>e.check(_d(n,i)),e.nonempty=n=>e.check(_d(1,n)),e.max=(n,i)=>e.check(oj(n,i)),e.length=(n,i)=>e.check(uj(n,i)),e.unwrap=()=>e.element});function Yn(e,t){return T4(Q5,e,t)}const G5=ie("ZodObject",(e,t)=>{kM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>V4(e,n,i,l),lt(e,"shape",()=>t.shape),e.keyof=()=>Xe(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:St()}),e.loose=()=>e.clone({...e._zod.def,catchall:St()}),e.strict=()=>e.clone({...e._zod.def,catchall:V5()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>HD(e,n),e.safeExtend=n=>ZD(e,n),e.merge=n=>VD(e,n),e.pick=n=>FD(e,n),e.omit=n=>qD(e,n),e.partial=(...n)=>QD(vj,e,n[0]),e.required=(...n)=>GD(bj,e,n[0])});function de(e,t){const n={type:"object",shape:e??{},...Ce(t)};return new G5(n)}const pj=ie("ZodUnion",(e,t)=>{lj.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>Q4(e,n,i,l),e.options=t.options});function gj(e,t){return new pj({type:"union",options:e,...Ce(t)})}const K5=ie("ZodDiscriminatedUnion",(e,t)=>{pj.init(e,t),jM.init(e,t)});function yj(e,t,n){return new K5({type:"union",options:t,discriminator:e,...Ce(n)})}const Y5=ie("ZodIntersection",(e,t)=>{EM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>G4(e,n,i,l)});function X5(e,t){return new Y5({type:"intersection",left:e,right:t})}const J5=ie("ZodRecord",(e,t)=>{CM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>K4(e,n,i,l),e.keyType=t.keyType,e.valueType=t.valueType});function qt(e,t,n){return new J5({type:"record",keyType:e,valueType:t,...Ce(n)})}const Fp=ie("ZodEnum",(e,t)=>{_M.init(e,t),At.init(e,t),e._zod.processJSONSchema=(i,l,o)=>$4(e,i,l),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(i,l)=>{const o={};for(const u of i)if(n.has(u))o[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Fp({...t,checks:[],...Ce(l),entries:o})},e.exclude=(i,l)=>{const o={...t.entries};for(const u of i)if(n.has(u))delete o[u];else throw new Error(`Key ${u} not found in enum`);return new Fp({...t,checks:[],...Ce(l),entries:o})}});function Xe(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Fp({type:"enum",entries:n,...Ce(t)})}const W5=ie("ZodLiteral",(e,t)=>{NM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>F4(e,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function xn(e,t){return new W5({type:"literal",values:Array.isArray(e)?e:[e],...Ce(t)})}const e6=ie("ZodTransform",(e,t)=>{AM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>H4(e,n),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new $k(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(du(o,n.value,t));else{const u=o;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),n.issues.push(du(u))}};const l=t.transform(n.value,n);return l instanceof Promise?l.then(o=>(n.value=o,n)):(n.value=l,n)}});function t6(e){return new e6({type:"transform",transform:e})}const vj=ie("ZodOptional",(e,t)=>{sj.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>hj(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function v1(e){return new vj({type:"optional",innerType:e})}const n6=ie("ZodExactOptional",(e,t)=>{TM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>hj(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function r6(e){return new n6({type:"optional",innerType:e})}const a6=ie("ZodNullable",(e,t)=>{RM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>Y4(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function b1(e){return new a6({type:"nullable",innerType:e})}const i6=ie("ZodDefault",(e,t)=>{zM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>J4(e,n,i,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function l6(e,t){return new i6({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Zk(t)}})}const s6=ie("ZodPrefault",(e,t)=>{OM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>W4(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function o6(e,t){return new s6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Zk(t)}})}const bj=ie("ZodNonOptional",(e,t)=>{DM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>X4(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function u6(e,t){return new bj({type:"nonoptional",innerType:e,...Ce(t)})}const c6=ie("ZodCatch",(e,t)=>{MM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>e5(e,n,i,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function d6(e,t){return new c6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const f6=ie("ZodPipe",(e,t)=>{LM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>t5(e,n,i,l),e.in=t.in,e.out=t.out});function x1(e,t){return new f6({type:"pipe",in:e,out:t})}const h6=ie("ZodReadonly",(e,t)=>{IM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>n5(e,n,i,l),e.unwrap=()=>e._zod.def.innerType});function m6(e){return new h6({type:"readonly",innerType:e})}const p6=ie("ZodCustom",(e,t)=>{UM.init(e,t),At.init(e,t),e._zod.processJSONSchema=(n,i,l)=>q4(e,n)});function g6(e,t={}){return R4(p6,e,t)}function y6(e){return z4(e)}const $m={custom:"custom"};function Jd(e){return m4(Mg,e)}const v6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},xj=Xe(["feishu","slack","kael"]),Sj=Xe(["active","inactive"]);de({platform:xj,agentId:O().min(1),credentials:qt(O(),St()),status:Sj.default("active")});de({agentId:O().min(1).optional(),credentials:qt(O(),St()).optional(),status:Sj.optional()});de({id:He(),platform:O(),agentId:O(),hasCredentials:Eu(),status:O(),createdAt:O(),updatedAt:O()});const b6=Xe(["code","reverse_token","oauth","manual"]);de({appId:O().min(1),appSecret:O().min(1)});de({platform:xj,externalUserId:O().min(1),agentId:O().min(1),boundVia:b6.default("manual"),displayName:O().max(200).optional()});de({id:He(),platform:O(),externalUserId:O(),agentId:O(),boundVia:O().nullable(),displayName:O().nullable(),createdAt:O()});de({feishuUserId:O().min(1),displayName:O().max(200).optional()});de({configId:He(),platform:O(),agentId:O(),appId:O(),connected:Eu(),lastActiveAt:O().nullable()});const wj=Xe(["online","offline"]),kj=Xe(["idle","working","blocked","error"]);Xe(["active","suspended","evicted"]);const x6=Xe(["active","suspended"]);de({chatId:O().min(1),state:x6});de({runtimeState:kj});de({agentId:O().min(1),runtimeType:O().max(50),runtimeVersion:O().max(50).optional()});Xe(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent"]);de({agentId:O(),status:wj,connectedAt:O().nullable(),lastSeenAt:O(),clientId:O().nullable().optional(),runtimeType:O().nullable().optional(),runtimeVersion:O().nullable().optional(),runtimeState:kj.nullable().optional(),activeSessions:He().int().nullable().optional(),totalSessions:He().int().nullable().optional(),runtimeUpdatedAt:O().nullable().optional()});de({total:He().int(),running:He().int(),byState:de({idle:He().int(),working:He().int(),blocked:He().int(),error:He().int()}),clients:He().int()});const S6={HUMAN:"human",PERSONAL_ASSISTANT:"personal_assistant",AUTONOMOUS_AGENT:"autonomous_agent"},Wd=Xe(["human","personal_assistant","autonomous_agent"]),S1={PRIVATE:"private",ORGANIZATION:"organization"},Lg=Xe(["private","organization"]),w6=Xe(["admin-api","portal"]);Xe(["active","suspended"]);de({name:O().min(1).max(100).regex(/^[a-z0-9_-]+$/,"Only lowercase alphanumeric, hyphens, and underscores").optional(),type:Wd,displayName:O().max(200).optional(),delegateMention:O().max(100).optional(),organizationId:O().max(100).optional(),source:w6.optional(),visibility:Lg.optional(),metadata:qt(O(),St()).optional(),managerId:O().optional(),clientId:O().min(1).max(100).optional()});de({type:Wd.optional(),displayName:O().max(200).nullable().optional(),delegateMention:O().max(100).nullable().optional(),visibility:Lg.optional(),metadata:qt(O(),St()).optional(),managerId:O().nullable().optional(),clientId:O().min(1).max(100).nullable().optional()});de({uuid:O(),name:O().nullable(),organizationId:O(),type:Wd,displayName:O().nullable(),delegateMention:O().nullable(),inboxId:O(),status:O(),source:O().nullable().optional(),visibility:Lg,metadata:qt(O(),St()),managerId:O().nullable(),clientId:O().nullable(),presenceStatus:wj.optional(),createdAt:O(),updatedAt:O()});de({repo:O().nullable(),branch:O().nullable()});de({type:xn("agent:pinned"),agentId:O(),name:O().nullable(),displayName:O().nullable(),agentType:Wd});const k6=32e3,Ig=/^[a-z0-9][a-z0-9_-]{0,63}$/i,j6=/^[A-Z][A-Z0-9_]*$/,E6=de({append:O().max(k6).default("")}),C6=de({name:O().regex(Ig,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:xn("stdio"),command:O().min(1),args:Yn(O()).optional()}),_6=de({name:O().regex(Ig,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:xn("http"),url:O().url(),headers:qt(O(),O()).optional()}),N6=de({name:O().regex(Ig,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:xn("sse"),url:O().url(),headers:qt(O(),O()).optional()}),A6=yj("transport",[C6,_6,N6]),T6=de({key:O().regex(j6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:O(),sensitive:Eu().default(!1)}),R6=de({url:O().min(1),ref:O().min(1).optional(),localPath:O().min(1).optional()}),Ug=de({prompt:E6.default({append:""}),model:O().default("opus"),mcpServers:Yn(A6).default([]),env:Yn(T6).default([]),gitRepos:Yn(R6).default([])}),z6=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,u)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:$m.custom,path:["mcpServers",u,"name"],message:`Duplicate MCP server name "${o.name}"`}),n.add(f)});const i=new Set;e.env.forEach((o,u)=>{i.has(o.key)&&t.addIssue({code:$m.custom,path:["env",u,"key"],message:`Duplicate env key "${o.key}"`}),i.add(o.key)});const l=new Set;e.gitRepos.forEach((o,u)=>{const f=o.localPath??Ad(o.url);f&&(l.has(f)&&t.addIssue({code:$m.custom,path:["gitRepos",u,"localPath"],message:`Duplicate git repo local path "${f}"`}),l.add(f))})},jj=Ug.superRefine(z6),O6=de({agentId:O(),version:He().int().positive(),payload:jj,updatedAt:O(),updatedBy:O()});de({expectedVersion:He().int().positive(),payload:Ug.partial()});de({payload:Ug.partial()});de({current:O6,next:jj,diff:Yn(de({path:O(),op:Xe(["add","remove","replace"]),before:St().optional(),after:St().optional()}))});const qp="***";function Ad(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}de({username:O().min(1),password:O().min(1)});de({accessToken:O(),refreshToken:O()});de({refreshToken:O().min(1)});de({token:O().min(1)});de({token:O(),expiresIn:He(),command:O()});const D6=Xe(["direct","group","thread"]);de({type:D6,topic:O().max(500).optional(),participantIds:Yn(O()).min(1),metadata:qt(O(),St()).optional()});const Ej=de({agentId:O(),role:O(),mode:O(),joinedAt:O()});Ej.extend({name:O().nullable(),displayName:O().nullable(),type:O()});const M6=de({id:O(),organizationId:O(),type:O(),topic:O().nullable(),lifecyclePolicy:O().nullable().optional(),metadata:qt(O(),St()),createdAt:O(),updatedAt:O()});M6.extend({participants:Yn(Ej)});de({topic:O().trim().max(500).nullable()});de({agentId:O().min(1),mode:Xe(["full","mention_only"]).default("full")});de({agentId:O().min(1)});const L6=Xe(["connected","disconnected"]);de({id:O(),userId:O().nullable(),status:L6,sdkVersion:O().max(50).nullable(),hostname:O().max(100).nullable(),os:O().max(50).nullable(),agentCount:He().int().min(0),connectedAt:O().nullable(),lastSeenAt:O(),metadata:qt(O(),St()).nullable()});de({clientId:O().min(1).max(100),hostname:O().max(100).optional(),os:O().max(50).optional(),sdkVersion:O().max(50).optional()});de({limit:Jd().int().min(1).max(100).default(20),cursor:O().optional()});const I6=["image/png","image/jpeg","image/gif","image/webp"],Bg=Xe(I6);de({data:O().min(1),mimeType:Bg,filename:O().min(1),size:He().int().nonnegative().optional(),imageId:O().uuid().optional()});de({imageId:O().uuid(),mimeType:Bg,filename:O().min(1),size:He().int().nonnegative().optional()});de({type:xn("image_payload"),imageId:O().uuid(),chatId:O(),base64:O().min(1),mimeType:Bg,filename:O().min(1),size:He().int().nonnegative().optional()});const Pg=Xe(["hub_ui","cli","feishu","github","api"]),Cj=Xe(["text","markdown","card","reference","file","task"]);de({format:Cj.default("text"),content:St(),metadata:qt(O(),St()).optional(),inReplyTo:O().optional(),replyToInbox:O().optional(),replyToChat:O().optional(),source:Pg.optional()});de({format:Cj.default("text"),content:St(),metadata:qt(O(),St()).optional(),replyToInbox:O().optional(),replyToChat:O().optional(),source:Pg.optional()});const U6=de({id:O(),chatId:O(),senderId:O(),format:O(),content:St(),metadata:qt(O(),St()),replyToInbox:O().nullable(),replyToChat:O().nullable(),inReplyTo:O().nullable(),source:Pg.nullable(),createdAt:O()}),B6=de({senderId:O(),chatId:O(),replyToChat:O().nullable()}).nullable(),P6=Xe(["full","mention_only"]),$6=U6.extend({configVersion:He().int().positive(),recipientMode:P6.default("full"),inReplyToSnapshot:B6.default(null)});Xe(["pending","delivered","acked","failed"]);const F6=de({id:He(),inboxId:O(),messageId:O(),chatId:O().nullable(),status:O(),retryCount:He(),createdAt:O(),deliveredAt:O().nullable(),ackedAt:O().nullable()});F6.extend({message:$6});de({limit:Jd().int().min(1).max(50).default(10)});const q6={ADMIN:"admin",MEMBER:"member"},$g=Xe(["admin","member"]),H6=de({id:O(),userId:O(),organizationId:O(),agentId:O(),role:$g,createdAt:O()});de({username:O().min(1).max(100),displayName:O().min(1).max(200),role:$g.default("member")});de({role:$g.optional(),displayName:O().min(1).max(200).optional()});H6.extend({username:O(),displayName:O(),password:O()});const Z6=Xe(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),_j=Xe(["high","medium","low"]);de({id:O(),organizationId:O(),type:Z6,severity:_j,agentId:O().nullable(),chatId:O().nullable(),message:O(),read:Eu(),createdAt:O()});de({limit:Jd().int().min(1).max(100).default(20),cursor:O().optional(),severity:_j.optional(),read:Xe(["true","false"]).transform(e=>e==="true").optional(),agentId:O().optional()});const Nj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;de({name:O().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!Nj.test(e),"Name must not be a UUID format"),displayName:O().min(1).max(200),maxAgents:He().int().min(0).default(0),maxMessagesPerMinute:He().int().min(0).default(0),features:qt(O(),St()).default({})});de({name:O().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!Nj.test(e),"Name must not be a UUID format").optional(),displayName:O().min(1).max(200).optional(),maxAgents:He().int().min(0).optional(),maxMessagesPerMinute:He().int().min(0).optional(),features:qt(O(),St()).optional()});de({id:O(),name:O(),displayName:O(),maxAgents:He(),maxMessagesPerMinute:He(),features:qt(O(),St()),createdAt:O(),updatedAt:O()});const V6=de({workingCount:He().int().nonnegative(),errorMask:Eu()}),Q6=de({type:xn("pulse:tick"),organizationId:O(),agents:qt(O(),Yn(V6).length(32))}),G6=Xe(["tool_call","error","assistant_text","thinking","turn_end"]),Aj=de({toolUseId:O(),name:O(),args:St(),status:Xe(["pending","ok","error"]),durationMs:He().int().nonnegative().optional(),resultPreview:O().max(400).optional()}),Tj=de({source:Xe(["sdk","runtime","tool"]),message:O().max(2e3)}),Rj=de({text:O().max(8e3)}),zj=de({}),Oj=de({status:Xe(["success","error"])}),K6=yj("kind",[de({kind:xn("tool_call"),payload:Aj}),de({kind:xn("error"),payload:Tj}),de({kind:xn("assistant_text"),payload:Rj}),de({kind:xn("thinking"),payload:zj}),de({kind:xn("turn_end"),payload:Oj})]);de({id:O(),agentId:O(),chatId:O(),seq:He().int().positive(),kind:G6,payload:gj([Aj,Tj,Rj,zj,Oj]),createdAt:O()});de({agentId:O(),chatId:O(),event:K6});de({agentId:O(),chatId:O()});de({type:xn("session:reconcile"),agentId:O().min(1),chatIds:Yn(O().min(1)).max(500)});de({type:xn("session:reconcile:result"),agentId:O().min(1),staleChatIds:Yn(O().min(1))});const Y6=de({organizationId:O(),agentCount:He(),chatCount:He(),messageCount:He()});de({totalAgents:He(),totalChats:He(),totalMessages:He(),byOrganization:Yn(Y6)});de({key:O(),value:St(),updatedAt:O()});qt(O(),St());const yi={INBOX_TIMEOUT_SECONDS:"inbox_timeout_seconds",MAX_RETRY_COUNT:"max_retry_count",POLLING_INTERVAL_SECONDS:"polling_interval_seconds",PRESENCE_CLEANUP_SECONDS:"presence_cleanup_seconds"},vd={[yi.INBOX_TIMEOUT_SECONDS]:300,[yi.MAX_RETRY_COUNT]:3,[yi.POLLING_INTERVAL_SECONDS]:5,[yi.PRESENCE_CLEANUP_SECONDS]:60},fu=Xe(["pending","assigned","working","completed","failed","cancelled"]),w1=Xe(["agent","admin"]),X6=Xe(["assigned","status_changed","cancelled"]);de({taskId:O(),event:X6,title:O(),body:O().default(""),status:fu,fromStatus:fu.optional(),originRef:O().nullable().optional()});const J6=de({title:O().min(1).max(500),body:O().optional(),assigneeAgentId:O().optional(),originRef:O().max(500).optional(),metadata:qt(O(),St()).optional()});J6.extend({organizationId:O().optional()});de({status:Xe(["working","completed","failed"]),result:O().optional()});de({assigneeAgentId:O().nullable().optional(),status:fu.optional(),result:O().optional()});de({chatId:O().min(1)});const W6=de({id:O(),organizationId:O(),title:O(),body:O(),status:fu,assigneeAgentId:O().nullable(),createdByType:w1,createdById:O(),originRef:O().nullable(),result:O().nullable(),metadata:qt(O(),St()),createdAt:O(),updatedAt:O(),cancelledAt:O().nullable(),cancelledByType:w1.nullable(),cancelledById:O().nullable()}),eL=de({taskId:O(),chatId:O(),linkedByAgentId:O().nullable(),linkedAt:O()});W6.extend({chats:Yn(eL)});de({status:fu.optional(),assigneeAgentId:O().optional(),originRef:O().optional(),limit:Jd().int().min(1).max(100).default(20),cursor:O().optional()});const tL=Xe(["normal","idle_island","awaiting_reply","no_chat","not_applicable"]);de({taskId:O(),signal:tL,reason:O()});const nL=Xe(["active","suspended"]);de({id:O(),username:O(),displayName:O(),avatarUrl:O().nullable(),status:nL,createdAt:O(),updatedAt:O()});de({username:O().min(1).max(100),displayName:O().min(1).max(200),password:O().min(8).max(200)});de({displayName:O().min(1).max(200).optional(),password:O().min(8).max(200).optional()});de({type:xn("auth"),token:O().min(1)});de({type:xn("server:welcome"),serverCommandVersion:O().min(1),serverTimeMs:He().int().nonnegative()}).passthrough();const Dj=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function rL(e){const t=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));for(const n of Object.values(e))for(let i=0;i<32&&i<n.length;i++){const l=n[i],o=t[i];!l||!o||(o.workingCount+=l.workingCount,o.errorMask=o.errorMask||l.errorMask)}return t}const aL=2e3,iL=3e4;let si=null,Td=!1,Fm=0,eu=null;const Hp=new Set;let Jo=null,ys=0;function lL(e){for(const t of Hp)try{t(e)}catch{}Jo&&(e.type==="notification"?Jo.invalidateQueries({queryKey:["notifications"]}):e.type==="session:state"&&(Jo.invalidateQueries({queryKey:["activity"]}),Jo.invalidateQueries({queryKey:["sessions"]})))}function Mj(){const e=xg();if(!(e!=null&&e.accessToken))return;const n=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws/admin?token=${e.accessToken}`,i=new WebSocket(n);si=i,i.onmessage=l=>{if(i===si)try{const o=JSON.parse(l.data);lL(o)}catch{}},i.onopen=()=>{i===si&&(Fm=0)},i.onclose=()=>{if(i!==si||(si=null,Td||ys===0))return;Fm++;const l=Math.min(aL*2**(Fm-1),iL);eu=setTimeout(()=>{eu=null,!Td&&ys>0&&Mj()},l)}}function sL(){Td=!0,eu&&(clearTimeout(eu),eu=null),si&&(si.close(1e3,"unmount"),si=null)}function Lj(e){const{onMessage:t,enabled:n=!0}=e??{},i=Wn(),l=S.useRef(t);l.current=t,S.useEffect(()=>{Jo=i},[i]),S.useEffect(()=>{if(!n)return;const o=u=>{var f;return(f=l.current)==null?void 0:f.call(l,u)};return Hp.add(o),ys++,ys===1&&(Td=!1,Mj()),()=>{Hp.delete(o),ys--,ys===0&&sL()}},[n])}const Ij=S.createContext({aggregated:Dj,agents:{},receivedAtMs:null,stale:!0});function oL({children:e}){const[t,n]=S.useState({aggregated:Dj,agents:{},receivedAtMs:null}),[i,l]=S.useState(()=>Date.now());Lj({onMessage:u=>{const f=Q6.safeParse(u);f.success&&n({aggregated:rL(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),S.useEffect(()=>{const u=setInterval(()=>l(Date.now()),1e4);return()=>clearInterval(u)},[]);const o=S.useMemo(()=>({...t,stale:t.receivedAtMs===null||i-t.receivedAtMs>3e4}),[t,i]);return d.jsx(Ij.Provider,{value:o,children:e})}function uL(){return S.useContext(Ij)}function ef({title:e,subtitle:t,right:n,className:i,style:l,...o}){return d.jsxs("div",{className:Te("flex items-baseline gap-3 shrink-0",i),style:{padding:"var(--sp-3) var(--sp-5) var(--sp-2_5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)",...l},...o,children:[d.jsx("h1",{className:"m-0 text-title",style:{color:"var(--fg)"},children:e}),t&&d.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),d.jsx("div",{style:{flex:1}}),n]})}function Uj({className:e,style:t,...n}){return d.jsx("div",{className:Te("flex items-end",e),style:{gap:2,height:34,padding:"0 var(--sp-5)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg-raised)",...t},...n})}function Bj({active:e,onClick:t,children:n}){return d.jsx("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1.5 bg-transparent text-body font-medium",style:{padding:"var(--sp-1_75) var(--sp-3)",marginBottom:-1,borderBottom:`var(--hairline-bold) solid ${e?"var(--accent)":"transparent"}`,color:e?"var(--fg)":"var(--fg-3)",cursor:"pointer",transition:"color 0.12s"},onMouseEnter:i=>{e||(i.currentTarget.style.color="var(--fg)")},onMouseLeave:i=>{e||(i.currentTarget.style.color="var(--fg-3)")},children:n})}const cL={neutral:{bg:"var(--bg-sunken)",fg:"var(--fg-2)",bd:"var(--border)"},accent:{bg:"var(--accent-bg)",fg:"var(--accent-dim)",bd:"color-mix(in oklch, var(--accent) 30%, transparent)"},warn:{bg:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},error:{bg:"color-mix(in oklch, var(--state-error) 14%, transparent)",fg:"var(--state-error)",bd:"color-mix(in oklch, var(--state-error) 30%, transparent)"},outline:{bg:"transparent",fg:"var(--fg-3)",bd:"var(--border)"},idle:{bg:"color-mix(in oklch, var(--state-idle) 14%, transparent)",fg:"var(--state-idle)",bd:"color-mix(in oklch, var(--state-idle) 30%, transparent)"},working:{bg:"color-mix(in oklch, var(--state-working) 14%, transparent)",fg:"var(--state-working)",bd:"color-mix(in oklch, var(--state-working) 30%, transparent)"},blocked:{bg:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},offline:{bg:"color-mix(in oklch, var(--state-offline) 14%, transparent)",fg:"var(--state-offline)",bd:"color-mix(in oklch, var(--state-offline) 30%, transparent)"}};function Wt({tone:e="neutral",className:t,style:n,...i}){const l=cL[e],o={background:l.bg,color:l.fg,border:`var(--hairline) solid ${l.bd}`,...n};return d.jsx("span",{className:Te("mono inline-flex items-center uppercase text-caption leading-[1.6]",t),style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",...o},...i})}const Sa=S.forwardRef(({className:e,...t},n)=>d.jsx("table",{ref:n,className:Te("w-full",e),style:{borderCollapse:"separate",borderSpacing:0},...t}));Sa.displayName="DenseTable";const wa=S.forwardRef(({className:e,...t},n)=>d.jsx("thead",{ref:n,className:e,...t}));wa.displayName="DenseTableHeader";const ka=S.forwardRef(({className:e,...t},n)=>d.jsx("tbody",{ref:n,className:e,...t}));ka.displayName="DenseTableBody";const Qt=S.forwardRef(({className:e,interactive:t,selected:n,style:i,...l},o)=>d.jsx("tr",{ref:o,className:Te("transition-colors",e),"data-interactive":t?"":void 0,"data-selected":n?"":void 0,style:{background:n?"var(--bg-active)":void 0,cursor:t?"pointer":void 0,...i},...l}));Qt.displayName="DenseTableRow";const Ae=S.forwardRef(({className:e,style:t,...n},i)=>d.jsx("th",{ref:i,className:Te("mono text-left uppercase text-eyebrow whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3)",color:"var(--fg-4)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border)",...t},...n}));Ae.displayName="DenseTableHead";const Ee=S.forwardRef(({className:e,style:t,...n},i)=>d.jsx("td",{ref:i,className:Te("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));Ee.displayName="DenseTableCell";const Fr=S.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:Te("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)"},...t}));Fr.displayName="Panel";const Pj=S.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:Te("flex items-center justify-between gap-3",e),style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},...t}));Pj.displayName="PanelHeader";const $j=S.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:Te("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)"},...t}));$j.displayName="PanelTitle";const dL=S.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:Te(e),style:{padding:"var(--sp-3) var(--sp-3_5)"},...t}));dL.displayName="PanelBody";function Ms({children:e,right:t,className:n,style:i,...l}){return d.jsxs("div",{className:Te("mono flex items-center justify-between uppercase text-eyebrow",n),style:{padding:"var(--sp-1_75) var(--sp-3_5)",color:"var(--fg-4)",background:"var(--bg-raised)",borderBottom:"var(--hairline) solid var(--border-faint)",...i},...l,children:[d.jsx("span",{children:e}),t]})}function Cu({className:e,style:t,...n}){return d.jsx("span",{className:Te("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function Fg(){return De.get("/members")}function fL(e){return De.post("/members",e)}function hL(e,t){return De.patch(`/members/${encodeURIComponent(e)}`,t)}function mL(e){return De.delete(`/members/${encodeURIComponent(e)}`)}function qg(){const{data:e}=qe({queryKey:["members","name-map"],queryFn:Fg,staleTime:3e4});return S.useMemo(()=>{const t=new Map;if(e)for(const n of e)t.set(n.id,n.displayName||n.username);return n=>n?t.get(n)??n:"—"},[e])}function pL(){const e=qr(),t=qg(),{data:n,isLoading:i,error:l}=qe({queryKey:["admin-all-agents"],queryFn:()=>xD({limit:100})});return d.jsxs("div",{children:[d.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",padding:"0 var(--sp-0_5) var(--sp-2_5)"},children:"Every agent in the organization — including private agents owned by other members. Use this view to troubleshoot or reassign."}),d.jsxs(Fr,{children:[d.jsxs(Ms,{children:["All agents · ",(n==null?void 0:n.items.length)??0]}),i?d.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):l?d.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load agents: ",l instanceof Error?l.message:"Unknown error"]}):!n||n.items.length===0?d.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"No agents"}):d.jsxs(Sa,{children:[d.jsx(wa,{children:d.jsxs(Qt,{children:[d.jsx(Ae,{children:"Name"}),d.jsx(Ae,{children:"Display"}),d.jsx(Ae,{children:"Type"}),d.jsx(Ae,{children:"Visibility"}),d.jsx(Ae,{children:"Owner"}),d.jsx(Ae,{children:"Status"}),d.jsx(Ae,{children:"Created"})]})}),d.jsx(ka,{children:n.items.map(o=>d.jsxs(Qt,{interactive:!0,onClick:()=>e(`/agents/${encodeURIComponent(o.uuid)}`),children:[d.jsx(Ee,{children:d.jsx("span",{className:"mono font-medium",children:o.name??o.uuid.slice(0,8)})}),d.jsx(Ee,{style:{color:"var(--fg-2)"},children:o.displayName??"—"}),d.jsx(Ee,{children:d.jsx(Wt,{tone:o.type==="autonomous_agent"?"accent":"neutral",children:o.type})}),d.jsx(Ee,{children:d.jsx(Wt,{tone:o.visibility==="organization"?"accent":"outline",children:o.visibility})}),d.jsx(Ee,{className:"text-label",style:{color:"var(--fg-2)"},children:o.managerId?t(o.managerId):"—"}),d.jsx(Ee,{children:d.jsx(Wt,{tone:o.status==="active"?"accent":"neutral",children:o.status})}),d.jsx(Ee,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:xa(o.createdAt)})]},o.uuid))})]})]})]})}const k1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,j1=kw,gL=(e,t)=>n=>{var i;if((t==null?void 0:t.variants)==null)return j1(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:o}=t,u=Object.keys(l).map(h=>{const y=n==null?void 0:n[h],g=o==null?void 0:o[h];if(y===null)return null;const b=k1(y)||k1(g);return l[h][b]}),f=n&&Object.entries(n).reduce((h,y)=>{let[g,b]=y;return b===void 0||(h[g]=b),h},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((h,y)=>{let{class:g,className:b,...x}=y;return Object.entries(x).every(k=>{let[j,E]=k;return Array.isArray(E)?E.includes({...o,...f}[j]):{...o,...f}[j]===E})?[...h,g,b]:h},[]);return j1(e,u,m,n==null?void 0:n.class,n==null?void 0:n.className)},yL=gL("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-input)] text-body font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{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 px-3 text-label",xs:"h-7 rounded-[var(--radius-chip)] px-2.5 text-label gap-1.5",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ve=S.forwardRef(({className:e,variant:t,size:n,asChild:i=!1,...l},o)=>{const u=i?GO:"button";return d.jsx(u,{className:Te(yL({variant:t,size:n,className:e})),ref:o,...l})});ve.displayName="Button";const vt=S.forwardRef(({className:e,type:t,...n},i)=>d.jsx("input",{type:t,className:Te("flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors file:border-0 file:bg-transparent file:text-body 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:i,...n}));vt.displayName="Input";var vL="Label",Fj=S.forwardRef((e,t)=>d.jsx(Ca.label,{...e,ref:t,onMouseDown:n=>{var l;n.target.closest("button, input, select, textarea")||((l=e.onMouseDown)==null||l.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Fj.displayName=vL;var bL=Fj;const et=S.forwardRef(({className:e,...t},n)=>d.jsx(bL,{ref:n,className:Te("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));et.displayName="Label";const qj=Object.values(q6);function xL(e,t){const n=(e==null?void 0:e.trim())||t,i=n.split(/[\s._-]+/).filter(Boolean);if(i.length>=2){const l=i[0]??"",o=i[1]??"";return`${l[0]??""}${o[0]??""}`.toUpperCase()}return n.slice(0,2).toUpperCase()}function SL(){const e=Wn(),{memberId:t}=ja(),[n,i]=S.useState(!1),[l,o]=S.useState({username:"",displayName:"",role:"member"}),[u,f]=S.useState(null),[m,h]=S.useState(null),{data:y,isLoading:g,error:b}=qe({queryKey:["members"],queryFn:Fg}),x=yt({mutationFn:()=>fL({username:l.username,displayName:l.displayName,role:l.role}),onSuccess:T=>{e.invalidateQueries({queryKey:["members"]}),f(T.password)}}),k=yt({mutationFn:mL,onSuccess:()=>e.invalidateQueries({queryKey:["members"]})});function j(){i(!1),o({username:"",displayName:"",role:"member"}),f(null)}function E(T){T.preventDefault(),x.mutate()}function N(T){window.confirm("Delete this member? Their human agent will also be deactivated.")&&k.mutate(T)}return d.jsxs(d.Fragment,{children:[d.jsxs(Fr,{children:[d.jsxs(Ms,{right:d.jsxs(On,{open:n,onOpenChange:T=>T?i(!0):j(),children:[d.jsx(gD,{asChild:!0,children:d.jsxs(ve,{size:"xs",className:"normal-case tracking-normal",children:[d.jsx(gl,{className:"h-3 w-3"}),"Add member"]})}),d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:u?"Member Created":"Create Member"})}),u?d.jsxs("div",{className:"space-y-4",children:[d.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Member created. Share the password below — it will only be shown once."}),d.jsxs("div",{className:"flex items-center gap-2 rounded-md p-3",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)"},children:[d.jsx("code",{className:"flex-1 text-body mono",children:u}),d.jsx(ve,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText(u),title:"Copy password",children:d.jsx(Sg,{className:"h-4 w-4"})})]}),d.jsx(Dn,{children:d.jsx(ve,{onClick:j,children:"Done"})})]}):d.jsxs("form",{onSubmit:E,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"member-username",children:"Username"}),d.jsx(vt,{id:"member-username",type:"text",value:l.username,onChange:T=>o({...l,username:T.target.value}),required:!0})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"member-name",children:"Display Name"}),d.jsx(vt,{id:"member-name",value:l.displayName,onChange:T=>o({...l,displayName:T.target.value}),required:!0})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"member-role",children:"Role"}),d.jsx("select",{id:"member-role",value:l.role,onChange:T=>o({...l,role:T.target.value}),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:qj.map(T=>d.jsx("option",{value:T,children:T},T))})]}),x.error instanceof Error&&d.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:x.error.message}),d.jsx(Dn,{children:d.jsx(ve,{type:"submit",disabled:x.isPending,children:x.isPending?"Creating...":"Create"})})]})]})]}),children:["Members · ",(y==null?void 0:y.length)??0]}),g?d.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):b?d.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load members: ",b instanceof Error?b.message:"Unknown error"]}):(y==null?void 0:y.length)===0?d.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"No members"}):d.jsxs(Sa,{children:[d.jsx(wa,{children:d.jsxs(Qt,{children:[d.jsx(Ae,{style:{width:30}}),d.jsx(Ae,{children:"Username"}),d.jsx(Ae,{children:"Name"}),d.jsx(Ae,{children:"Role"}),d.jsx(Ae,{children:"Created"}),d.jsx(Ae,{style:{width:1}})]})}),d.jsx(ka,{children:y==null?void 0:y.map(T=>{const D=t===T.id;return d.jsxs(Qt,{children:[d.jsx(Ee,{children:d.jsx("span",{className:"mono inline-flex items-center justify-center text-caption font-semibold",style:{width:22,height:22,borderRadius:"var(--radius-input)",background:D?"var(--accent-bg)":"var(--bg-active)",border:"var(--hairline) solid var(--border-strong)",color:D?"var(--accent-dim)":"var(--fg-2)"},children:xL(T.displayName,T.username)})}),d.jsxs(Ee,{children:[d.jsx("span",{className:"mono font-medium",children:T.username}),D&&d.jsx(Cu,{style:{marginLeft:6},children:"you"})]}),d.jsx(Ee,{style:{color:"var(--fg-2)"},children:T.displayName}),d.jsx(Ee,{children:d.jsx(Wt,{tone:T.role==="admin"?"accent":"neutral",children:T.role})}),d.jsx(Ee,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:xa(T.createdAt)}),d.jsx(Ee,{style:{whiteSpace:"nowrap"},children:d.jsxs("div",{className:"flex gap-0.5 justify-end",children:[d.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>h({id:T.id,username:T.username,displayName:T.displayName,role:T.role}),title:"Edit",children:d.jsx($d,{className:"h-3.5 w-3.5"})}),d.jsx(ve,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(T.id),disabled:k.isPending,title:"Delete",style:{color:"var(--fg-4)"},children:d.jsx(su,{className:"h-3.5 w-3.5"})})]})})]},T.id)})})]})]}),d.jsx(wL,{target:m,onClose:()=>h(null),onSaved:()=>{h(null),e.invalidateQueries({queryKey:["members"]})}})]})}function wL({target:e,onClose:t,onSaved:n}){const[i,l]=S.useState(""),[o,u]=S.useState("member"),[f,m]=S.useState(null);S.useEffect(()=>{e&&(l(e.displayName),u(e.role),m(null))},[e]);const h=yt({mutationFn:async()=>{if(!e)throw new Error("No target");const b={};return i.trim()&&i!==e.displayName&&(b.displayName=i.trim()),o!==e.role&&(b.role=o),Object.keys(b).length===0?e:hL(e.id,b)},onSuccess:()=>{m(null),n()},onError:b=>{m(b instanceof Error?b.message:String(b))}});function y(b){b.preventDefault(),h.mutate()}const g=e!==null;return d.jsx(On,{open:g,onOpenChange:b=>b?void 0:t(),children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:"Edit Member"})}),e&&d.jsxs("form",{onSubmit:y,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{children:"Username"}),d.jsx(vt,{value:e.username,disabled:!0,className:"font-mono"}),d.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"edit-member-display",children:"Display Name"}),d.jsx(vt,{id:"edit-member-display",value:i,onChange:b=>l(b.target.value),required:!0,maxLength:200})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"edit-member-role",children:"Role"}),d.jsx("select",{id:"edit-member-role",value:o,onChange:b=>u(b.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:qj.map(b=>d.jsx("option",{value:b,children:b},b))}),d.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Demoting the last admin is blocked — every org needs at least one admin to manage members."})]}),f&&d.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:f}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:t,disabled:h.isPending,children:"Cancel"}),d.jsx(ve,{type:"submit",disabled:h.isPending,children:h.isPending?"Saving…":"Save"})]})]})]})})}function kL(){return De.get("/admin/system/config")}function jL(e){return De.patch("/admin/system/config",e)}const Hj=[{key:yi.INBOX_TIMEOUT_SECONDS,label:"Inbox timeout",description:"How long an agent waits for inbound messages before sleeping.",unit:"seconds"},{key:yi.MAX_RETRY_COUNT,label:"Max retry count",description:"Delivery attempts before a message is marked failed.",unit:null},{key:yi.POLLING_INTERVAL_SECONDS,label:"Polling interval",description:"Runtime heartbeat cadence for offline detection.",unit:"seconds"},{key:yi.PRESENCE_CLEANUP_SECONDS,label:"Presence cleanup",description:"When presence rows expire after disconnect.",unit:"seconds"}],E1=Hj.map(e=>e.key);function EL(){const e=Wn(),{data:t,isLoading:n}=qe({queryKey:["system-config"],queryFn:kL}),[i,l]=S.useState({}),[o,u]=S.useState(!1);S.useEffect(()=>{if(!t)return;const y={};for(const g of E1){const b=t[g]??vd[g]??"";y[g]=String(b)}l(y)},[t]);const f=yt({mutationFn:()=>{const y={};for(const[g,b]of Object.entries(i)){const x=b.trim();if(x==="")y[g]=vd[g]??0;else{const k=Number(x);y[g]=Number.isNaN(k)?x:k}}return jL(y)},onSuccess:()=>{e.invalidateQueries({queryKey:["system-config"]}),u(!0),setTimeout(()=>u(!1),2e3)}});function m(){const y={};for(const g of E1)y[g]=String(vd[g]??"");l(y)}function h(y){y.preventDefault(),f.mutate()}return d.jsx("form",{onSubmit:h,children:d.jsxs(Fr,{children:[d.jsxs(Pj,{children:[d.jsx($j,{children:"System configuration"}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[o&&d.jsx("span",{className:"mono text-caption",style:{color:"var(--accent-dim)"},children:"saved"}),d.jsx(ve,{type:"button",variant:"ghost",size:"xs",onClick:m,disabled:f.isPending,children:"Reset defaults"}),d.jsxs(ve,{type:"submit",size:"xs",disabled:f.isPending,children:[d.jsx(Pd,{className:"h-3 w-3"}),f.isPending?"Saving…":"Save changes"]})]})]}),d.jsxs("div",{style:{padding:"var(--sp-1) var(--sp-4) var(--sp-3_5)"},children:[n?d.jsx("div",{className:"py-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):Hj.map(y=>d.jsx(CL,{field:y,value:i[y.key]??"",onChange:g=>l({...i,[y.key]:g})},y.key)),f.error instanceof Error&&d.jsx("div",{className:"text-body pt-2",style:{color:"var(--state-error)"},children:f.error.message})]})]})})}function CL({field:e,value:t,onChange:n}){const i=String(vd[e.key]??"—");return d.jsxs("div",{className:"grid items-start gap-5",style:{gridTemplateColumns:"1fr var(--sp-45)",padding:"var(--sp-3_5) 0",borderTop:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.label}),d.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.key})]}),d.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:2},children:e.description}),d.jsxs(Cu,{style:{marginTop:4,display:"block"},children:["default"," ",d.jsx("span",{className:"mono normal-case tracking-normal",style:{color:"var(--fg-3)"},children:i})]})]}),d.jsxs("div",{style:{position:"relative"},children:[d.jsx("input",{value:t,onChange:l=>n(l.target.value),className:"w-full outline-none mono text-body",style:{padding:`var(--sp-1_25) ${e.unit?56:10}px var(--sp-1_25) var(--sp-2_5)`,background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"}}),e.unit&&d.jsx("span",{className:"mono text-caption",style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)",pointerEvents:"none"},children:e.unit})]})]})}const C1=[{key:"members",label:"Members"},{key:"all-agents",label:"All agents"},{key:"settings",label:"Org settings"}];function _L(){const{role:e}=ja(),t=yr(),n=qr();if(e===null)return d.jsx("div",{className:"text-body",style:{padding:20,color:"var(--fg-3)"},children:"Loading…"});if(e!=="admin")return d.jsx(pg,{to:"/settings",replace:!0});const i=t.hash.replace("#",""),l=C1.some(u=>u.key===i)?i:"members",o=u=>{n({hash:u},{replace:!0})};return d.jsxs("div",{className:"-m-6",children:[d.jsx(ef,{title:"Admin",subtitle:"Organization-wide controls"}),d.jsx(Uj,{children:C1.map(u=>d.jsx(Bj,{active:l===u.key,onClick:()=>o(u.key),children:u.label},u.key))}),d.jsxs("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:[l==="members"&&d.jsx(SL,{}),l==="all-agents"&&d.jsx(pL,{}),l==="settings"&&d.jsx(EL,{})]})]})}function Zj(){return De.get("/admin/adapter-mappings")}function NL(e){return De.post("/admin/adapter-mappings",e)}function AL(e){return De.delete(`/admin/adapter-mappings/${e}`)}function Vj(){return De.get("/admin/adapters/status")}function Qj(){return De.get("/admin/adapters")}function TL(e){return De.post("/admin/adapters",e)}function RL(e,t){return De.patch(`/admin/adapters/${e}`,t)}function zL(e){return De.delete(`/admin/adapters/${e}`)}function OL(e){return De.get(`/admin/agents/${e}/config`)}function DL(e,t){return De.patch(`/admin/agents/${e}/config`,t)}function ML(e,t){return De.post(`/admin/agents/${e}/config/dry-run`,{payload:t})}function LL(e){return De.get(`/admin/agents/${e}/client-status`)}function IL({className:e,style:t,...n}){return d.jsx("div",{className:Te("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function UL({onClick:e,children:t}){return d.jsx("button",{type:"button",onClick:e,className:"bg-transparent border-0 p-0 cursor-pointer",style:{color:"var(--fg-3)",textDecoration:"none",font:"inherit"},onMouseEnter:n=>{n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--fg-3)"},children:t})}function BL(){return d.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function PL({children:e,mono:t}){return d.jsx("span",{className:Te("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}function hl({state:e,size:t=8,className:n}){const i={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?d.jsxs("span",{className:Te("shrink-0",n),style:i,role:"img","aria-label":"working",children:[d.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),d.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-working)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]}):e==="blocked"?d.jsx("span",{className:Te("shrink-0",n),style:{...i,border:"var(--hairline-bold) dashed var(--state-blocked)",borderRadius:"50%",animation:"dash-spin 4s linear infinite"},role:"img","aria-label":"blocked",children:d.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?d.jsx("span",{className:Te("shrink-0",n),style:{...i,background:"var(--state-error)",clipPath:"polygon(50% 0%, 100% 100%, 0% 100%)",borderRadius:1},role:"img","aria-label":"error"}):e==="idle"?d.jsx("span",{className:Te("shrink-0",n),style:{...i,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):d.jsx("span",{className:Te("shrink-0",n),style:{...i,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function $L(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function ml({state:e,className:t}){const n=e!==null&&$L(e)?e:"offline",i=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return d.jsxs("span",{className:Te("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:i},children:[d.jsx(hl,{state:n,size:7}),n]})}function ad({label:e,value:t,accent:n}){return d.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:4},children:[d.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),d.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:1},children:t})]})}function FL(e){const{agent:t}=e,[n,i]=S.useState(!1),l=t.displayName||t.name||t.uuid;return d.jsxs("section",{style:{background:"color-mix(in oklch, var(--state-error) 6%, var(--bg-raised))",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[d.jsx(JT,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),d.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),d.jsxs("div",{children:[t.status==="active"?d.jsx(qm,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:d.jsx(ve,{variant:"outline",size:"xs",onClick:e.onSuspend,disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):d.jsx(qm,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:d.jsx(ve,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),d.jsx(qm,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:d.jsxs(ve,{variant:"destructive",size:"xs",onClick:()=>i(!0),disabled:e.deletePending,children:[d.jsx(su,{className:"h-3 w-3"}),"Delete"]})})]}),d.jsx(qL,{open:n,onOpenChange:i,expected:l,onDelete:()=>{i(!1),e.onDelete()},deleting:e.deletePending})]})}function qm(e){return d.jsxs("div",{className:"flex items-start justify-between gap-4 text-body",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid color-mix(in oklch, var(--state-error) 14%, transparent)"},children:[d.jsxs("div",{children:[d.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),d.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),d.jsx("div",{children:e.action})]})}function qL({open:e,onOpenChange:t,expected:n,onDelete:i,deleting:l}){const[o,u]=S.useState("");function f(m){m.preventDefault(),o===n&&i()}return d.jsx(On,{open:e,onOpenChange:m=>{t(m),m||u("")},children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsxs(Mn,{children:['Delete "',n,'"?']})}),d.jsxs("form",{onSubmit:f,className:"space-y-4",children:[d.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",d.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),d.jsx(vt,{value:o,onChange:m=>u(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:l,children:"Cancel"}),d.jsx(ve,{type:"submit",variant:"destructive",disabled:o!==n||l,children:l?"Deleting…":"Delete"})]})]})]})})}const HL={unchanged:{label:"",tone:""},added:{label:"new",tone:"bg-success-soft text-success"},modified:{label:"changed",tone:"bg-warn-soft text-warn"},deleted:{label:"will be removed on save",tone:"bg-error-soft text-error"}};function Hg({status:e,onEdit:t,onDelete:n,onUndo:i,children:l,disabled:o}){const u=HL[e],f=e==="deleted";return d.jsxs("div",{className:Te("flex items-center gap-2 rounded border px-3 py-2 text-body",f?"bg-error-soft border-error text-error line-through decoration-error":"bg-card"),children:[d.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:l}),u.label&&d.jsx("span",{className:Te("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",u.tone),children:u.label}),!o&&(f?d.jsxs(ve,{size:"sm",variant:"ghost",onClick:i,children:[d.jsx(eR,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):d.jsx(ZL,{onEdit:t,onDelete:n}))]})}function ZL({onEdit:e,onDelete:t}){return d.jsxs("div",{className:"flex gap-1",children:[d.jsx(ve,{size:"sm",variant:"ghost",onClick:e,title:"Edit",children:"Edit"}),d.jsxs(ve,{size:"sm",variant:"ghost",onClick:t,title:"Delete",children:[d.jsx(xT,{className:"sr-only h-3.5 w-3.5","aria-hidden":!0}),"Delete"]})]})}function VL(e){const[t,n]=S.useState(null),i=e.items.filter(l=>l.status!=="deleted").length;return d.jsxs("section",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("h3",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:["Environment Variables (",i,")"]}),!e.disabled&&d.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[d.jsx(gl,{className:"h-3 w-3"})," Add"]})]}),d.jsx("div",{className:"px-4 py-3 space-y-2",children:e.items.length===0?d.jsx("p",{className:"text-body text-muted-foreground",children:"No environment variables."}):e.items.map(l=>d.jsxs(Hg,{status:l.status,onEdit:()=>n({mode:"edit",key:l.key,initial:l.value}),onDelete:()=>e.onDelete(l.key),onUndo:()=>e.onUndoDelete(l.key),disabled:e.disabled,children:[d.jsx("span",{className:"font-mono font-medium",children:l.value.key}),d.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:l.value.sensitive?"••••••":l.value.value||d.jsx("em",{children:"(empty)"})}),l.value.sensitive&&d.jsx(_T,{className:"h-3 w-3 text-muted-foreground"})]},l.key))}),t&&d.jsx(QL,{open:!!t,onOpenChange:l=>!l&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:l=>{t.mode==="edit"?e.onUpdate(t.key,l):e.onAdd(l),n(null)}})]})}function QL({open:e,onOpenChange:t,initial:n,forbiddenKeys:i,onSubmit:l}){const[o,u]=S.useState((n==null?void 0:n.key)??""),[f,m]=S.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,y]=S.useState((n==null?void 0:n.sensitive)??!1),[g,b]=S.useState(null);S.useEffect(()=>{e&&(u((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),y((n==null?void 0:n.sensitive)??!1),b(null))},[e,n]);function x(k){if(k.preventDefault(),!o.match(/^[A-Z][A-Z0-9_]*$/)){b("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(i.has(o)){b(`Another entry already uses key "${o}".`);return}let j=f;if(h&&(n!=null&&n.sensitive)&&!f&&(j=qp),!h&&!n&&!f){b("Value is required for non-sensitive entries.");return}l({key:o,value:j,sensitive:h})}return d.jsx(On,{open:e,onOpenChange:t,children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:n?"Edit environment variable":"Add environment variable"})}),d.jsxs("form",{onSubmit:x,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"env-key",children:"Key"}),d.jsx(vt,{id:"env-key",value:o,onChange:k=>u(k.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&d.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"env-value",children:"Value"}),d.jsx(vt,{id:"env-value",type:h?"password":"text",autoComplete:"new-password",value:f,onChange:k=>m(k.target.value),placeholder:n!=null&&n.sensitive?"Leave empty to keep existing value":h?"new secret":"value",className:"font-mono"})]}),d.jsxs("label",{className:"flex items-center gap-2 text-body",children:[d.jsx("input",{type:"checkbox",checked:h,onChange:k=>y(k.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),d.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),g&&d.jsx("p",{className:"text-body text-destructive",children:g}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),d.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function GL(e){const[t,n]=S.useState(null),i=e.items.filter(l=>l.status!=="deleted").length;return d.jsxs("section",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("h3",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:["Git Repositories (",i,")"]}),!e.disabled&&d.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[d.jsx(gl,{className:"h-3 w-3"})," Add"]})]}),d.jsx("div",{className:"px-4 py-3 space-y-2",children:e.items.length===0?d.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(l=>{const o=l.value.localPath??Ad(l.value.url);return d.jsxs(Hg,{status:l.status,onEdit:()=>n({mode:"edit",key:l.key,initial:l.value}),onDelete:()=>e.onDelete(l.key),onUndo:()=>e.onUndoDelete(l.key),disabled:e.disabled,children:[d.jsx("span",{className:"font-mono text-caption",children:l.value.url}),l.value.ref&&d.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",l.value.ref]}),d.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",o||"./"]})]},l.key)})}),t&&d.jsx(KL,{open:!!t,onOpenChange:l=>!l&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenPaths:e.otherPaths(t.mode==="edit"?t.key:null),onSubmit:l=>{t.mode==="edit"?e.onUpdate(t.key,l):e.onAdd(l),n(null)}})]})}function KL({open:e,onOpenChange:t,initial:n,forbiddenPaths:i,onSubmit:l}){const[o,u]=S.useState((n==null?void 0:n.url)??""),[f,m]=S.useState((n==null?void 0:n.ref)??""),[h,y]=S.useState((n==null?void 0:n.localPath)??""),[g,b]=S.useState(null);S.useEffect(()=>{e&&(u((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),y((n==null?void 0:n.localPath)??""),b(null))},[e,n]);function x(k){k.preventDefault();const j=o.trim();if(!j){b("URL is required.");return}const E=h.trim()||Ad(j);if(E&&i.has(E)){b(`Another repo already occupies local path "${E}".`);return}const N={url:j,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};l(N)}return d.jsx(On,{open:e,onOpenChange:t,children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:n?"Edit Git repository":"Add Git repository"})}),d.jsxs("form",{onSubmit:x,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"git-url",children:"URL"}),d.jsx(vt,{id:"git-url",value:o,onChange:k=>u(k.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),d.jsx(vt,{id:"git-ref",value:f,onChange:k=>m(k.target.value),placeholder:"main",className:"font-mono"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"git-path",children:"Local path (optional)"}),d.jsx(vt,{id:"git-path",value:h,onChange:k=>y(k.target.value),placeholder:Ad(o)||"repo-name",className:"font-mono"}),d.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),g&&d.jsx("p",{className:"text-body text-destructive",children:g}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),d.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function YL({agent:e,onSave:t}){const[n,i]=S.useState(!1),l=Ei(),o=qg(),u=e.metadata,f=u==null?void 0:u.tree,m=typeof(f==null?void 0:f.role)=="string"?f.role:null,h=Array.isArray(f==null?void 0:f.domains)?(f==null?void 0:f.domains).filter(b=>typeof b=="string"):[],y=e.managerId?o(e.managerId):null,g=e.delegateMention?l(e.delegateMention):null;return d.jsxs("section",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsx("h2",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:"Profile"}),e.status==="active"&&d.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>i(!0),children:[d.jsx($d,{className:"h-3 w-3"})," Edit"]})]}),d.jsxs("div",{className:"px-4 py-3 text-body space-y-1",children:[d.jsxs("div",{children:[d.jsx("span",{className:"font-mono",children:e.name??e.uuid}),d.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),d.jsx("span",{children:e.displayName??d.jsx("span",{className:"text-muted-foreground italic",children:"no display name"})}),g&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),d.jsxs("span",{className:"text-muted-foreground",children:["delegate ",d.jsx("span",{className:"font-mono",children:g})]})]})]}),d.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[d.jsxs("span",{children:["owner ",d.jsx("span",{className:"text-foreground",children:y??"—"})]}),m&&d.jsxs("span",{children:["role ",d.jsx("span",{className:"text-foreground",children:m})]}),d.jsxs("span",{children:["type ",d.jsx(Wt,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),d.jsxs("span",{children:["visibility"," ",d.jsx(Wt,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),h.length>0&&d.jsxs("span",{children:["domains"," ",d.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:h.map(b=>d.jsx(Wt,{tone:"outline",children:b},b))})]})]})]}),d.jsx(XL,{agent:e,open:n,onOpenChange:i,onSave:t})]})}function XL({agent:e,open:t,onOpenChange:n,onSave:i}){var U;const{memberId:l,role:o}=ja(),[u,f]=S.useState(e.displayName??""),[m,h]=S.useState(e.delegateMention??""),[y,g]=S.useState(e.visibility),[b,x]=S.useState(!1),[k,j]=S.useState(null);S.useEffect(()=>{t&&(f(e.displayName??""),h(e.delegateMention??""),g(e.visibility),j(null))},[t,e]);const E=e.type==="human",N=o==="admin"||e.managerId===l,T=qe({queryKey:["agents-for-delegate"],queryFn:async()=>(await Ng({limit:100})).items.filter(z=>z.type==="personal_assistant"&&z.status==="active"),enabled:t&&E});async function D(B){B.preventDefault(),j(null),x(!0);try{const z={displayName:u||null,delegateMention:m||null};y!==e.visibility&&(z.visibility=y),await i(z),n(!1)}catch(z){j(z instanceof Error?z.message:String(z))}finally{x(!1)}}return d.jsx(On,{open:t,onOpenChange:n,children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:"Edit Identity"})}),d.jsxs("form",{onSubmit:D,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{children:"Name (mention)"}),d.jsx(vt,{value:e.name??"",disabled:!0,className:"font-mono"}),d.jsx("p",{className:"text-caption text-muted-foreground",children:"Name is permanent after creation."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"id-display",children:"Display Name"}),d.jsx(vt,{id:"id-display",value:u,onChange:B=>f(B.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"id-visibility",children:"Visibility"}),d.jsxs("select",{id:"id-visibility",value:y,onChange:B=>g(B.target.value),disabled:!N,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[d.jsx("option",{value:S1.PRIVATE,children:"Private — only the manager"}),d.jsx("option",{value:S1.ORGANIZATION,children:"Organization — all members"})]}),d.jsx("p",{className:"text-caption text-muted-foreground",children:N?"Private agents are only visible to their manager; organization agents appear in every member's list.":"Only the manager or an admin can change this agent's visibility."})]}),E&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"id-delegate",children:"Delegate Mention"}),d.jsxs("select",{id:"id-delegate",value:m,onChange:B=>h(B.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[d.jsx("option",{value:"",children:"None"}),(U=T.data)==null?void 0:U.map(B=>d.jsx("option",{value:B.uuid,children:B.displayName?`${B.displayName} (${B.name??B.uuid})`:B.name??B.uuid},B.uuid))]}),d.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),k&&d.jsx("p",{className:"text-body text-destructive",children:k}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:b,children:"Cancel"}),d.jsx(ve,{type:"submit",disabled:b,children:b?"Saving…":"Save"})]})]})]})})}function JL(e){const[t,n]=S.useState(null),i=e.items.filter(l=>l.status!=="deleted").length;return d.jsxs("section",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("h3",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:["MCP Servers (",i,")"]}),!e.disabled&&d.jsxs(ve,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[d.jsx(gl,{className:"h-3 w-3"})," Add"]})]}),d.jsx("div",{className:"px-4 py-3 space-y-2",children:e.items.length===0?d.jsx("p",{className:"text-body text-muted-foreground",children:"No MCP servers. Add one to extend the agent's tools."}):e.items.map(l=>d.jsxs(Hg,{status:l.status,onEdit:()=>n({mode:"edit",key:l.key,initial:l.value}),onDelete:()=>e.onDelete(l.key),onUndo:()=>e.onUndoDelete(l.key),disabled:e.disabled,children:[d.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:l.value.transport}),d.jsx("span",{className:"font-medium font-mono",children:l.value.name}),d.jsx("span",{className:"text-caption text-muted-foreground truncate",children:WL(l.value)})]},l.key))}),t&&d.jsx(eI,{open:!!t,onOpenChange:l=>!l&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenNames:e.otherNames(t.mode==="edit"?t.key:null),onSubmit:l=>{t.mode==="edit"?e.onUpdate(t.key,l):e.onAdd(l),n(null)}})]})}function WL(e){var t;if(e.transport==="stdio"){const n=(t=e.args)!=null&&t.length?` ${e.args.join(" ")}`:"";return`${e.command}${n}`}return e.url}function eI({open:e,onOpenChange:t,initial:n,forbiddenNames:i,onSubmit:l}){const[o,u]=S.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=S.useState((n==null?void 0:n.name)??""),[h,y]=S.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[g,b]=S.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[x,k]=S.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[j,E]=S.useState(null);S.useEffect(()=>{e&&(u((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),y((n==null?void 0:n.transport)==="stdio"?n.command:""),b((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),k(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),E(null))},[e,n]);function N(T){if(T.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){E("Name must start alphanumeric and contain only a-z0-9_-.");return}if(i.has(f.toLowerCase())){E(`Another MCP server is already named "${f}".`);return}let D;if(o==="stdio"){if(!h.trim()){E("stdio transport requires a command.");return}const U=g.trim().split(/\s+/).filter(B=>B.length>0);D={name:f,transport:"stdio",command:h.trim(),...U.length?{args:U}:{}}}else{const U=x.trim();try{new URL(U)}catch{E("URL is not valid.");return}D={name:f,transport:o,url:U}}l(D)}return d.jsx(On,{open:e,onOpenChange:t,children:d.jsxs(wn,{children:[d.jsx(Jn,{children:d.jsx(Mn,{children:n?"Edit MCP server":"Add MCP server"})}),d.jsxs("form",{onSubmit:N,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-transport",children:"Transport"}),d.jsxs("select",{id:"mcp-transport",value:o,onChange:T=>u(T.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[d.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),d.jsx("option",{value:"http",children:"http"}),d.jsx("option",{value:"sse",children:"sse"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-name",children:"Name"}),d.jsx(vt,{id:"mcp-name",value:f,onChange:T=>m(T.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-command",children:"Command"}),d.jsx(vt,{id:"mcp-command",value:h,onChange:T=>y(T.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),d.jsx(vt,{id:"mcp-args",value:g,onChange:T=>b(T.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):d.jsxs("div",{className:"space-y-2",children:[d.jsx(et,{htmlFor:"mcp-url",children:"URL"}),d.jsx(vt,{id:"mcp-url",value:x,onChange:T=>k(T.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),j&&d.jsx("p",{className:"text-body text-destructive",children:j}),d.jsxs(Dn,{children:[d.jsx(ve,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),d.jsx(ve,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const _1=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}];function tI({value:e,baseline:t,onChange:n,onRevert:i,disabled:l}){const o=e!==t,u=!_1.some(f=>f.value===e)&&e!=="";return d.jsxs("section",{style:{background:"var(--bg-raised)",border:`var(--hairline) solid ${o?"color-mix(in oklch, var(--state-blocked) 40%, transparent)":"var(--border)"}`,borderRadius:6},children:[d.jsxs("header",{className:"flex items-center justify-between",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[d.jsxs("h3",{className:"inline-flex items-center gap-2 text-body font-semibold",style:{color:"var(--fg)"},children:["Model",o&&d.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:3,background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))"},children:"changed"})]}),o&&d.jsx(ve,{size:"xs",variant:"ghost",onClick:i,disabled:l,children:"Revert"})]}),d.jsxs("div",{className:"px-4 py-3 space-y-2",children:[d.jsxs("select",{value:e,onChange:f=>n(f.target.value),disabled:l,className:"flex h-9 w-full max-w-md rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:[e===""&&d.jsx("option",{value:"",children:"(unset — inherits local)"}),_1.map(f=>d.jsxs("option",{value:f.value,children:[f.label,f.hint?` — ${f.hint}`:""]},f.value)),u&&d.jsxs("option",{value:e,children:[e," — custom"]})]}),d.jsxs("p",{className:"text-caption text-muted-foreground",children:["Choose which Claude model powers this agent. Aliases (opus / sonnet / haiku) follow the CLI's latest-in-family mapping and may shift across releases. Applies to new sessions immediately; active sessions switch on their next message. Unset falls back to the operator's local ",d.jsx("code",{children:"~/.claude/settings.json"})," model preference, then the CLI default."]})]})]})}function nI(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const rI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iI={};function N1(e,t){return(iI.jsx?aI:rI).test(e)}const lI=/[ \t\n\f\r]/g;function sI(e){return typeof e=="object"?e.type==="text"?A1(e.value):!1:A1(e)}function A1(e){return e.replace(lI,"")===""}class _u{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}_u.prototype.normal={};_u.prototype.property={};_u.prototype.space=void 0;function Gj(e,t){const n={},i={};for(const l of e)Object.assign(n,l.property),Object.assign(i,l.normal);return new _u(n,i,t)}function Zp(e){return e.toLowerCase()}class Un{constructor(t,n){this.attribute=n,this.property=t}}Un.prototype.attribute="";Un.prototype.booleanish=!1;Un.prototype.boolean=!1;Un.prototype.commaOrSpaceSeparated=!1;Un.prototype.commaSeparated=!1;Un.prototype.defined=!1;Un.prototype.mustUseProperty=!1;Un.prototype.number=!1;Un.prototype.overloadedBoolean=!1;Un.prototype.property="";Un.prototype.spaceSeparated=!1;Un.prototype.space=void 0;let oI=0;const Pe=xl(),$t=xl(),Vp=xl(),he=xl(),xt=xl(),xs=xl(),Gn=xl();function xl(){return 2**++oI}const Qp=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pe,booleanish:$t,commaOrSpaceSeparated:Gn,commaSeparated:xs,number:he,overloadedBoolean:Vp,spaceSeparated:xt},Symbol.toStringTag,{value:"Module"})),Hm=Object.keys(Qp);class Zg extends Un{constructor(t,n,i,l){let o=-1;if(super(t,n),T1(this,"space",l),typeof i=="number")for(;++o<Hm.length;){const u=Hm[o];T1(this,Hm[o],(i&Qp[u])===Qp[u])}}}Zg.prototype.defined=!0;function T1(e,t,n){n&&(e[t]=n)}function Hs(e){const t={},n={};for(const[i,l]of Object.entries(e.properties)){const o=new Zg(i,e.transform(e.attributes||{},i),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[Zp(i)]=i,n[Zp(o.attribute)]=i}return new _u(t,n,e.space)}const Kj=Hs({properties:{ariaActiveDescendant:null,ariaAtomic:$t,ariaAutoComplete:null,ariaBusy:$t,ariaChecked:$t,ariaColCount:he,ariaColIndex:he,ariaColSpan:he,ariaControls:xt,ariaCurrent:null,ariaDescribedBy:xt,ariaDetails:null,ariaDisabled:$t,ariaDropEffect:xt,ariaErrorMessage:null,ariaExpanded:$t,ariaFlowTo:xt,ariaGrabbed:$t,ariaHasPopup:null,ariaHidden:$t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xt,ariaLevel:he,ariaLive:null,ariaModal:$t,ariaMultiLine:$t,ariaMultiSelectable:$t,ariaOrientation:null,ariaOwns:xt,ariaPlaceholder:null,ariaPosInSet:he,ariaPressed:$t,ariaReadOnly:$t,ariaRelevant:null,ariaRequired:$t,ariaRoleDescription:xt,ariaRowCount:he,ariaRowIndex:he,ariaRowSpan:he,ariaSelected:$t,ariaSetSize:he,ariaSort:null,ariaValueMax:he,ariaValueMin:he,ariaValueNow:he,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Yj(e,t){return t in e?e[t]:t}function Xj(e,t){return Yj(e,t.toLowerCase())}const uI=Hs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xs,acceptCharset:xt,accessKey:xt,action:null,allow:null,allowFullScreen:Pe,allowPaymentRequest:Pe,allowUserMedia:Pe,alt:null,as:null,async:Pe,autoCapitalize:null,autoComplete:xt,autoFocus:Pe,autoPlay:Pe,blocking:xt,capture:null,charSet:null,checked:Pe,cite:null,className:xt,cols:he,colSpan:null,content:null,contentEditable:$t,controls:Pe,controlsList:xt,coords:he|xs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pe,defer:Pe,dir:null,dirName:null,disabled:Pe,download:Vp,draggable:$t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pe,formTarget:null,headers:xt,height:he,hidden:Vp,high:he,href:null,hrefLang:null,htmlFor:xt,httpEquiv:xt,id:null,imageSizes:null,imageSrcSet:null,inert:Pe,inputMode:null,integrity:null,is:null,isMap:Pe,itemId:null,itemProp:xt,itemRef:xt,itemScope:Pe,itemType:xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pe,low:he,manifest:null,max:null,maxLength:he,media:null,method:null,min:null,minLength:he,multiple:Pe,muted:Pe,name:null,nonce:null,noModule:Pe,noValidate:Pe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Pe,optimum:he,pattern:null,ping:xt,placeholder:null,playsInline:Pe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pe,referrerPolicy:null,rel:xt,required:Pe,reversed:Pe,rows:he,rowSpan:he,sandbox:xt,scope:null,scoped:Pe,seamless:Pe,selected:Pe,shadowRootClonable:Pe,shadowRootDelegatesFocus:Pe,shadowRootMode:null,shape:null,size:he,sizes:null,slot:null,span:he,spellCheck:$t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:he,step:null,style:null,tabIndex:he,target:null,title:null,translate:null,type:null,typeMustMatch:Pe,useMap:null,value:$t,width:he,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xt,axis:null,background:null,bgColor:null,border:he,borderColor:null,bottomMargin:he,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Pe,declare:Pe,event:null,face:null,frame:null,frameBorder:null,hSpace:he,leftMargin:he,link:null,longDesc:null,lowSrc:null,marginHeight:he,marginWidth:he,noResize:Pe,noHref:Pe,noShade:Pe,noWrap:Pe,object:null,profile:null,prompt:null,rev:null,rightMargin:he,rules:null,scheme:null,scrolling:$t,standby:null,summary:null,text:null,topMargin:he,valueType:null,version:null,vAlign:null,vLink:null,vSpace:he,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Pe,disableRemotePlayback:Pe,prefix:null,property:null,results:he,security:null,unselectable:null},space:"html",transform:Xj}),cI=Hs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Gn,accentHeight:he,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:he,amplitude:he,arabicForm:null,ascent:he,attributeName:null,attributeType:null,azimuth:he,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:he,by:null,calcMode:null,capHeight:he,className:xt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:he,diffuseConstant:he,direction:null,display:null,dur:null,divisor:he,dominantBaseline:null,download:Pe,dx:null,dy:null,edgeMode:null,editable:null,elevation:he,enableBackground:null,end:null,event:null,exponent:he,externalResourcesRequired:null,fill:null,fillOpacity:he,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xs,g2:xs,glyphName:xs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:he,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:he,horizOriginX:he,horizOriginY:he,id:null,ideographic:he,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:he,k:he,k1:he,k2:he,k3:he,k4:he,kernelMatrix:Gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:he,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:he,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:he,overlineThickness:he,paintOrder:null,panose1:null,path:null,pathLength:he,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:he,pointsAtY:he,pointsAtZ:he,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:he,specularExponent:he,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:he,strikethroughThickness:he,string:null,stroke:null,strokeDashArray:Gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:he,strokeOpacity:he,strokeWidth:null,style:null,surfaceScale:he,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gn,tabIndex:he,tableValues:null,target:null,targetX:he,targetY:he,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:he,underlineThickness:he,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:he,values:null,vAlphabetic:he,vMathematical:he,vectorEffect:null,vHanging:he,vIdeographic:he,version:null,vertAdvY:he,vertOriginX:he,vertOriginY:he,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:he,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Yj}),Jj=Hs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Wj=Hs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Xj}),eE=Hs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),dI={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},fI=/[A-Z]/g,R1=/-[a-z]/g,hI=/^data[-\w.:]+$/i;function mI(e,t){const n=Zp(t);let i=t,l=Un;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hI.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(R1,gI);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!R1.test(o)){let u=o.replace(fI,pI);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}l=Zg}return new l(i,t)}function pI(e){return"-"+e.toLowerCase()}function gI(e){return e.charAt(1).toUpperCase()}const yI=Gj([Kj,uI,Jj,Wj,eE],"html"),Vg=Gj([Kj,cI,Jj,Wj,eE],"svg");function vI(e){return e.join(" ").trim()}var cs={},Zm,z1;function bI(){if(z1)return Zm;z1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
333
333
  `,h="/",y="*",g="",b="comment",x="declaration";function k(E,N){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];N=N||{};var T=1,D=1;function U(fe){var W=fe.match(t);W&&(T+=W.length);var P=fe.lastIndexOf(m);D=~P?fe.length-P:D+fe.length}function B(){var fe={line:T,column:D};return function(W){return W.position=new z(fe),ee(),W}}function z(fe){this.start=fe,this.end={line:T,column:D},this.source=N.source}z.prototype.content=E;function F(fe){var W=new Error(N.source+":"+T+":"+D+": "+fe);if(W.reason=fe,W.filename=N.source,W.line=T,W.column=D,W.source=E,!N.silent)throw W}function Z(fe){var W=fe.exec(E);if(W){var P=W[0];return U(P),E=E.slice(P.length),W}}function ee(){Z(n)}function q(fe){var W;for(fe=fe||[];W=ae();)W!==!1&&fe.push(W);return fe}function ae(){var fe=B();if(!(h!=E.charAt(0)||y!=E.charAt(1))){for(var W=2;g!=E.charAt(W)&&(y!=E.charAt(W)||h!=E.charAt(W+1));)++W;if(W+=2,g===E.charAt(W-1))return F("End of comment missing");var P=E.slice(2,W-2);return D+=2,U(P),E=E.slice(W),D+=2,fe({type:b,comment:P})}}function re(){var fe=B(),W=Z(i);if(W){if(ae(),!Z(l))return F("property missing ':'");var P=Z(o),V=fe({type:x,property:j(W[0].replace(e,g)),value:P?j(P[0].replace(e,g)):g});return Z(u),V}}function pe(){var fe=[];q(fe);for(var W;W=re();)W!==!1&&(fe.push(W),q(fe));return fe}return ee(),pe()}function j(E){return E?E.replace(f,g):g}return Zm=k,Zm}var O1;function xI(){if(O1)return cs;O1=1;var e=cs&&cs.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(cs,"__esModule",{value:!0}),cs.default=n;const t=e(bI());function n(i,l){let o=null;if(!i||typeof i!="string")return o;const u=(0,t.default)(i),f=typeof l=="function";return u.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:y}=m;f?l(h,y,m):y&&(o=o||{},o[h]=y)}),o}return cs}var Vo={},D1;function SI(){if(D1)return Vo;D1=1,Object.defineProperty(Vo,"__esModule",{value:!0}),Vo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},u=function(h,y){return y.toUpperCase()},f=function(h,y){return"".concat(y,"-")},m=function(h,y){return y===void 0&&(y={}),o(h)?h:(h=h.toLowerCase(),y.reactCompat?h=h.replace(l,f):h=h.replace(i,f),h.replace(t,u))};return Vo.camelCase=m,Vo}var Qo,M1;function wI(){if(M1)return Qo;M1=1;var e=Qo&&Qo.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(xI()),n=SI();function i(l,o){var u={};return!l||typeof l!="string"||(0,t.default)(l,function(f,m){f&&m&&(u[(0,n.camelCase)(f,o)]=m)}),u}return i.default=i,Qo=i,Qo}var kI=wI();const jI=Md(kI),tE=nE("end"),Qg=nE("start");function nE(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function EI(e){const t=Qg(e),n=tE(e);if(t&&n)return{start:t,end:n}}function tu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?L1(e.position):"start"in e||"end"in e?L1(e):"line"in e||"column"in e?Gp(e):""}function Gp(e){return I1(e&&e.line)+":"+I1(e&&e.column)}function L1(e){return Gp(e&&e.start)+"-"+Gp(e&&e.end)}function I1(e){return e&&typeof e=="number"?e:1}class pn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let l="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?l=t:!o.cause&&t&&(u=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof i=="string"){const m=i.indexOf(":");m===-1?o.ruleId=i:(o.source=i.slice(0,m),o.ruleId=i.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=tu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}pn.prototype.file="";pn.prototype.name="";pn.prototype.reason="";pn.prototype.message="";pn.prototype.stack="";pn.prototype.column=void 0;pn.prototype.line=void 0;pn.prototype.ancestors=void 0;pn.prototype.cause=void 0;pn.prototype.fatal=void 0;pn.prototype.place=void 0;pn.prototype.ruleId=void 0;pn.prototype.source=void 0;const Gg={}.hasOwnProperty,CI=new Map,_I=/[A-Z]/g,NI=new Set(["table","tbody","thead","tfoot","tr"]),AI=new Set(["td","th"]),rE="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function TI(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=UI(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=II(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Vg:yI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=aE(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function aE(e,t,n){if(t.type==="element")return RI(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return zI(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return DI(e,t,n);if(t.type==="mdxjsEsm")return OI(e,t);if(t.type==="root")return MI(e,t,n);if(t.type==="text")return LI(e,t)}function RI(e,t,n){const i=e.schema;let l=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=Vg,e.schema=l),e.ancestors.push(t);const o=lE(e,t.tagName,!1),u=BI(e,t);let f=Yg(e,t);return NI.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!sI(m):!0})),iE(e,u,o,t),Kg(u,f),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function zI(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}hu(e,t.position)}function OI(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);hu(e,t.position)}function DI(e,t,n){const i=e.schema;let l=i;t.name==="svg"&&i.space==="html"&&(l=Vg,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:lE(e,t.name,!0),u=PI(e,t),f=Yg(e,t);return iE(e,u,o,t),Kg(u,f),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function MI(e,t,n){const i={};return Kg(i,Yg(e,t)),e.create(t,e.Fragment,i,n)}function LI(e,t){return t.value}function iE(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Kg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function II(e,t,n){return i;function i(l,o,u,f){const h=Array.isArray(u.children)?n:t;return f?h(o,u,f):h(o,u)}}function UI(e,t){return n;function n(i,l,o,u){const f=Array.isArray(o.children),m=Qg(i);return t(l,o,u,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function BI(e,t){const n={};let i,l;for(l in t.properties)if(l!=="children"&&Gg.call(t.properties,l)){const o=$I(e,l,t.properties[l]);if(o){const[u,f]=o;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&AI.has(t.tagName)?i=f:n[u]=f}}if(i){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function PI(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const o=i.data.estree.body[0];o.type;const u=o.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else hu(e,t.position);else{const l=i.name;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else hu(e,t.position);else o=i.value===null?!0:i.value;n[l]=o}return n}function Yg(e,t){const n=[];let i=-1;const l=e.passKeys?new Map:CI;for(;++i<t.children.length;){const o=t.children[i];let u;if(e.passKeys){const m=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(m){const h=l.get(m)||0;u=m+"-"+h,l.set(m,h+1)}}const f=aE(e,o,u);f!==void 0&&n.push(f)}return n}function $I(e,t,n){const i=mI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?nI(n):vI(n)),i.property==="style"){let l=typeof n=="object"?n:FI(e,String(n));return e.stylePropertyNameCase==="css"&&(l=qI(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&i.space?dI[i.property]||i.property:i.attribute,n]}}function FI(e,t){try{return jI(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,l=new pn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=rE+"#cannot-parse-style-attribute",l}}function lE(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let o=-1,u;for(;++o<l.length;){const f=N1(l[o])?{type:"Identifier",name:l[o]}:{type:"Literal",value:l[o]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}i=u}else i=N1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const l=i.value;return Gg.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(i);hu(e)}function hu(e,t){const n=new pn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=rE+"#cannot-handle-mdx-estrees-without-createevaluater",n}function qI(e){const t={};let n;for(n in e)Gg.call(e,n)&&(t[HI(n)]=e[n]);return t}function HI(e){let t=e.replace(_I,ZI);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ZI(e){return"-"+e.toLowerCase()}const Vm={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},VI={};function Xg(e,t){const n=VI,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,l=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return sE(e,i,l)}function sE(e,t,n){if(QI(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return U1(e.children,t,n)}return Array.isArray(e)?U1(e,t,n):""}function U1(e,t,n){const i=[];let l=-1;for(;++l<e.length;)i[l]=sE(e[l],t,n);return i.join("")}function QI(e){return!!(e&&typeof e=="object")}const B1=document.createElement("i");function Jg(e){const t="&"+e+";";B1.innerHTML=t;const n=B1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Xn(e,t,n,i){const l=e.length;let o=0,u;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,n=n>0?n:0,i.length<1e4)u=Array.from(i),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<i.length;)u=i.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function mr(e,t){return e.length>0?(Xn(e,e.length,0,t),e):t}const P1={}.hasOwnProperty;function oE(e){const t={};let n=-1;for(;++n<e.length;)GI(t,e[n]);return t}function GI(e,t){let n;for(n in t){const l=(P1.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){P1.call(l,u)||(l[u]=[]);const f=o[u];KI(l[u],Array.isArray(f)?f:f?[f]:[])}}}function KI(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);Xn(e,0,0,i)}function uE(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Cr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Sn=Ni(/[A-Za-z]/),mn=Ni(/[\dA-Za-z]/),YI=Ni(/[#-'*+\--9=?A-Z^-~]/);function Rd(e){return e!==null&&(e<32||e===127)}const Kp=Ni(/\d/),XI=Ni(/[\dA-Fa-f]/),JI=Ni(/[!-/:-@[-`{-~]/);function Re(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function Ge(e){return e===-2||e===-1||e===32}const tf=Ni(new RegExp("\\p{P}|\\p{S}","u")),pl=Ni(/\s/);function Ni(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Zs(e){const t=[];let n=-1,i=0,l=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&mn(e.charCodeAt(n+1))&&mn(e.charCodeAt(n+2)))l=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(u=String.fromCharCode(o,f),l=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+l+1,u=""),l&&(n+=l,l=0)}return t.join("")+e.slice(i)}function tt(e,t,n,i){const l=i?i-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(m){return Ge(m)?(e.enter(n),f(m)):t(m)}function f(m){return Ge(m)&&o++<l?(e.consume(m),f):(e.exit(n),t(m))}}const WI={tokenize:eU};function eU(e){const t=e.attempt(this.parser.constructs.contentInitial,i,l);let n;return t;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),tt(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),o(f)}function o(f){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Re(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),u)}}const tU={tokenize:nU},$1={tokenize:rU};function nU(e){const t=this,n=[];let i=0,l,o,u;return f;function f(D){if(i<n.length){const U=n[i];return t.containerState=U[1],e.attempt(U[0].continuation,m,h)(D)}return h(D)}function m(D){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&T();const U=t.events.length;let B=U,z;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){z=t.events[B][1].end;break}N(i);let F=U;for(;F<t.events.length;)t.events[F][1].end={...z},F++;return Xn(t.events,B+1,0,t.events.slice(U)),t.events.length=F,h(D)}return f(D)}function h(D){if(i===n.length){if(!l)return b(D);if(l.currentConstruct&&l.currentConstruct.concrete)return k(D);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check($1,y,g)(D)}function y(D){return l&&T(),N(i),b(D)}function g(D){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,k(D)}function b(D){return t.containerState={},e.attempt($1,x,k)(D)}function x(D){return i++,n.push([t.currentConstruct,t.containerState]),b(D)}function k(D){if(D===null){l&&T(),N(0),e.consume(D);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:o}),j(D)}function j(D){if(D===null){E(e.exit("chunkFlow"),!0),N(0),e.consume(D);return}return Re(D)?(e.consume(D),E(e.exit("chunkFlow")),i=0,t.interrupt=void 0,f):(e.consume(D),j)}function E(D,U){const B=t.sliceStream(D);if(U&&B.push(null),D.previous=o,o&&(o.next=D),o=D,l.defineSkip(D.start),l.write(B),t.parser.lazy[D.start.line]){let z=l.events.length;for(;z--;)if(l.events[z][1].start.offset<u&&(!l.events[z][1].end||l.events[z][1].end.offset>u))return;const F=t.events.length;let Z=F,ee,q;for(;Z--;)if(t.events[Z][0]==="exit"&&t.events[Z][1].type==="chunkFlow"){if(ee){q=t.events[Z][1].end;break}ee=!0}for(N(i),z=F;z<t.events.length;)t.events[z][1].end={...q},z++;Xn(t.events,Z+1,0,t.events.slice(F)),t.events.length=z}}function N(D){let U=n.length;for(;U-- >D;){const B=n[U];t.containerState=B[1],B[0].exit.call(t,e)}n.length=D}function T(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function rU(e,t,n){return tt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ls(e){if(e===null||bt(e)||pl(e))return 1;if(tf(e))return 2}function nf(e,t,n){const i=[];let l=-1;for(;++l<e.length;){const o=e[l].resolveAll;o&&!i.includes(o)&&(t=o(t,n),i.push(o))}return t}const Yp={name:"attention",resolveAll:aU,tokenize:iU};function aU(e,t){let n=-1,i,l,o,u,f,m,h,y;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[i][1].end},b={...e[n][1].start};F1(g,-m),F1(b,m),u={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[i][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:m>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},l={type:m>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[i][1].end={...u.start},e[n][1].start={...f.end},h=[],e[i][1].end.offset-e[i][1].start.offset&&(h=mr(h,[["enter",e[i][1],t],["exit",e[i][1],t]])),h=mr(h,[["enter",l,t],["enter",u,t],["exit",u,t],["enter",o,t]]),h=mr(h,nf(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),h=mr(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(y=2,h=mr(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):y=0,Xn(e,i-1,n-i+3,h),n=i+h.length-y-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function iU(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,l=Ls(i);let o;return u;function u(m){return o=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===o)return e.consume(m),f;const h=e.exit("attentionSequence"),y=Ls(m),g=!y||y===2&&l||n.includes(m),b=!l||l===2&&y||n.includes(i);return h._open=!!(o===42?g:g&&(l||!b)),h._close=!!(o===42?b:b&&(y||!g)),t(m)}}function F1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const lU={name:"autolink",tokenize:sU};function sU(e,t,n){let i=0;return l;function l(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(x){return Sn(x)?(e.consume(x),u):x===64?n(x):h(x)}function u(x){return x===43||x===45||x===46||mn(x)?(i=1,f(x)):h(x)}function f(x){return x===58?(e.consume(x),i=0,m):(x===43||x===45||x===46||mn(x))&&i++<32?(e.consume(x),f):(i=0,h(x))}function m(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||Rd(x)?n(x):(e.consume(x),m)}function h(x){return x===64?(e.consume(x),y):YI(x)?(e.consume(x),h):n(x)}function y(x){return mn(x)?g(x):n(x)}function g(x){return x===46?(e.consume(x),i=0,y):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):b(x)}function b(x){if((x===45||mn(x))&&i++<63){const k=x===45?b:g;return e.consume(x),k}return n(x)}}const Nu={partial:!0,tokenize:oU};function oU(e,t,n){return i;function i(o){return Ge(o)?tt(e,l,"linePrefix")(o):l(o)}function l(o){return o===null||Re(o)?t(o):n(o)}}const cE={continuation:{tokenize:cU},exit:dU,name:"blockQuote",tokenize:uU};function uU(e,t,n){const i=this;return l;function l(u){if(u===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return Ge(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function cU(e,t,n){const i=this;return l;function l(u){return Ge(u)?tt(e,o,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(cE,t,n)(u)}}function dU(e){e.exit("blockQuote")}const dE={name:"characterEscape",tokenize:fU};function fU(e,t,n){return i;function i(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),l}function l(o){return JI(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const fE={name:"characterReference",tokenize:hU};function hU(e,t,n){const i=this;let l=0,o,u;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,u=mn,y(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=XI,y):(e.enter("characterReferenceValue"),o=7,u=Kp,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return u===mn&&!Jg(i.sliceSerialize(b))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(g)&&l++<o?(e.consume(g),y):n(g)}}const q1={partial:!0,tokenize:pU},H1={concrete:!0,name:"codeFenced",tokenize:mU};function mU(e,t,n){const i=this,l={partial:!0,tokenize:B};let o=0,u=0,f;return m;function m(z){return h(z)}function h(z){const F=i.events[i.events.length-1];return o=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(z)}function y(z){return z===f?(u++,e.consume(z),y):u<3?n(z):(e.exit("codeFencedFenceSequence"),Ge(z)?tt(e,g,"whitespace")(z):g(z))}function g(z){return z===null||Re(z)?(e.exit("codeFencedFence"),i.interrupt?t(z):e.check(q1,j,U)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||Re(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(z)):Ge(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),tt(e,x,"whitespace")(z)):z===96&&z===f?n(z):(e.consume(z),b)}function x(z){return z===null||Re(z)?g(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(z))}function k(z){return z===null||Re(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(z)):z===96&&z===f?n(z):(e.consume(z),k)}function j(z){return e.attempt(l,U,E)(z)}function E(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),N}function N(z){return o>0&&Ge(z)?tt(e,T,"linePrefix",o+1)(z):T(z)}function T(z){return z===null||Re(z)?e.check(q1,j,U)(z):(e.enter("codeFlowValue"),D(z))}function D(z){return z===null||Re(z)?(e.exit("codeFlowValue"),T(z)):(e.consume(z),D)}function U(z){return e.exit("codeFenced"),t(z)}function B(z,F,Z){let ee=0;return q;function q(W){return z.enter("lineEnding"),z.consume(W),z.exit("lineEnding"),ae}function ae(W){return z.enter("codeFencedFence"),Ge(W)?tt(z,re,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):re(W)}function re(W){return W===f?(z.enter("codeFencedFenceSequence"),pe(W)):Z(W)}function pe(W){return W===f?(ee++,z.consume(W),pe):ee>=u?(z.exit("codeFencedFenceSequence"),Ge(W)?tt(z,fe,"whitespace")(W):fe(W)):Z(W)}function fe(W){return W===null||Re(W)?(z.exit("codeFencedFence"),F(W)):Z(W)}}}function pU(e,t,n){const i=this;return l;function l(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const Qm={name:"codeIndented",tokenize:yU},gU={partial:!0,tokenize:vU};function yU(e,t,n){const i=this;return l;function l(h){return e.enter("codeIndented"),tt(e,o,"linePrefix",5)(h)}function o(h){const y=i.events[i.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?u(h):n(h)}function u(h){return h===null?m(h):Re(h)?e.attempt(gU,u,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Re(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function vU(e,t,n){const i=this;return l;function l(u){return i.parser.lazy[i.now().line]?n(u):Re(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):tt(e,o,"linePrefix",5)(u)}function o(u){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):Re(u)?l(u):n(u)}}const bU={name:"codeText",previous:SU,resolve:xU,tokenize:wU};function xU(e){let t=e.length-4,n=3,i,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)l===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(l=i):(i===t||e[i][1].type==="lineEnding")&&(e[l][1].type="codeTextData",i!==l+2&&(e[l][1].end=e[i-1][1].end,e.splice(l+2,i-l-2),t-=i-l-2,i=l+2),l=void 0);return e}function SU(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wU(e,t,n){let i=0,l,o;return u;function u(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),i++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(o=e.enter("codeTextSequence"),l=0,y(g)):Re(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Re(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function y(g){return g===96?(e.consume(g),l++,y):l===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",h(g))}}class kU{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const l=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&Go(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Go(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Go(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Go(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Go(this.left,n.reverse())}}}function Go(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function hE(e){const t={};let n=-1,i,l,o,u,f,m,h;const y=new kU(e);for(;++n<y.length;){for(;n in t;)n=t[n];if(i=y.get(n),n&&i[1].type==="chunkFlow"&&y.get(n-1)[1].type==="listItemPrefix"&&(m=i[1]._tokenizer.events,o=0,o<m.length&&m[o][1].type==="lineEndingBlank"&&(o+=2),o<m.length&&m[o][1].type==="content"))for(;++o<m.length&&m[o][1].type!=="content";)m[o][1].type==="chunkText"&&(m[o][1]._isInFirstContentOfListItem=!0,o++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,jU(y,n)),n=t[n],h=!0);else if(i[1]._container){for(o=n,l=void 0;o--;)if(u=y.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),u[1].type="lineEnding",l=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;l&&(i[1].end={...y.get(l)[1].start},f=y.slice(l,n),f.unshift(i),y.splice(l,n-l+1,f))}}return Xn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!h}function jU(e,t){const n=e.get(t)[1],i=e.get(t)[2];let l=t-1;const o=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,m=[],h={};let y,g,b=-1,x=n,k=0,j=0;const E=[j];for(;x;){for(;e.get(++l)[1]!==x;);o.push(l),x._tokenizer||(y=i.sliceStream(x),x.next||y.push(null),g&&u.defineSkip(x.start),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(y),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(j=b+1,E.push(j),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(u.events=[],x?(x._tokenizer=void 0,x.previous=void 0):E.pop(),b=E.length;b--;){const N=f.slice(E[b],E[b+1]),T=o.pop();m.push([T,T+N.length-1]),e.splice(T,2,N)}for(m.reverse(),b=-1;++b<m.length;)h[k+m[b][0]]=k+m[b][1],k+=m[b][1]-m[b][0]-1;return h}const EU={resolve:_U,tokenize:NU},CU={partial:!0,tokenize:AU};function _U(e){return hE(e),e}function NU(e,t){let n;return i;function i(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?o(f):Re(f)?e.check(CU,u,o)(f):(e.consume(f),l)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,l}}function AU(e,t,n){const i=this;return l;function l(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),tt(e,o,"linePrefix")}function o(u){if(u===null||Re(u))return n(u);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,n,t)(u)}}function mE(e,t,n,i,l,o,u,f,m){const h=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(N){return N===60?(e.enter(i),e.enter(l),e.enter(o),e.consume(N),e.exit(o),b):N===null||N===32||N===41||Rd(N)?n(N):(e.enter(i),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(N))}function b(N){return N===62?(e.enter(o),e.consume(N),e.exit(o),e.exit(l),e.exit(i),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),x(N))}function x(N){return N===62?(e.exit("chunkString"),e.exit(f),b(N)):N===null||N===60||Re(N)?n(N):(e.consume(N),N===92?k:x)}function k(N){return N===60||N===62||N===92?(e.consume(N),x):x(N)}function j(N){return!y&&(N===null||N===41||bt(N))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(i),t(N)):y<h&&N===40?(e.consume(N),y++,j):N===41?(e.consume(N),y--,j):N===null||N===32||N===40||Rd(N)?n(N):(e.consume(N),N===92?E:j)}function E(N){return N===40||N===41||N===92?(e.consume(N),j):j(N)}}function pE(e,t,n,i,l,o){const u=this;let f=0,m;return h;function h(x){return e.enter(i),e.enter(l),e.consume(x),e.exit(l),e.enter(o),y}function y(x){return f>999||x===null||x===91||x===93&&!m||x===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(x):x===93?(e.exit(o),e.enter(l),e.consume(x),e.exit(l),e.exit(i),t):Re(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||Re(x)||f++>999?(e.exit("chunkString"),y(x)):(e.consume(x),m||(m=!Ge(x)),x===92?b:g)}function b(x){return x===91||x===92||x===93?(e.consume(x),f++,g):g(x)}}function gE(e,t,n,i,l,o){let u;return f;function f(b){return b===34||b===39||b===40?(e.enter(i),e.enter(l),e.consume(b),e.exit(l),u=b===40?41:b,m):n(b)}function m(b){return b===u?(e.enter(l),e.consume(b),e.exit(l),e.exit(i),t):(e.enter(o),h(b))}function h(b){return b===u?(e.exit(o),m(u)):b===null?n(b):Re(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),tt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===u||b===null||Re(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?g:y)}function g(b){return b===u||b===92?(e.consume(b),y):y(b)}}function nu(e,t){let n;return i;function i(l){return Re(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,i):Ge(l)?tt(e,i,n?"linePrefix":"lineSuffix")(l):t(l)}}const TU={name:"definition",tokenize:zU},RU={partial:!0,tokenize:OU};function zU(e,t,n){const i=this;let l;return o;function o(x){return e.enter("definition"),u(x)}function u(x){return pE.call(i,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function f(x){return l=Cr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),m):n(x)}function m(x){return bt(x)?nu(e,h)(x):h(x)}function h(x){return mE(e,y,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function y(x){return e.attempt(RU,g,g)(x)}function g(x){return Ge(x)?tt(e,b,"whitespace")(x):b(x)}function b(x){return x===null||Re(x)?(e.exit("definition"),i.parser.defined.push(l),t(x)):n(x)}}function OU(e,t,n){return i;function i(f){return bt(f)?nu(e,l)(f):n(f)}function l(f){return gE(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return Ge(f)?tt(e,u,"whitespace")(f):u(f)}function u(f){return f===null||Re(f)?t(f):n(f)}}const DU={name:"hardBreakEscape",tokenize:MU};function MU(e,t,n){return i;function i(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return Re(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const LU={name:"headingAtx",resolve:IU,tokenize:UU};function IU(e,t){let n=e.length-2,i=3,l,o;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(l={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},o={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},Xn(e,i,n-i+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function UU(e,t,n){let i=0;return l;function l(y){return e.enter("atxHeading"),o(y)}function o(y){return e.enter("atxHeadingSequence"),u(y)}function u(y){return y===35&&i++<6?(e.consume(y),u):y===null||bt(y)?(e.exit("atxHeadingSequence"),f(y)):n(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Re(y)?(e.exit("atxHeading"),t(y)):Ge(y)?tt(e,f,"whitespace")(y):(e.enter("atxHeadingText"),h(y))}function m(y){return y===35?(e.consume(y),m):(e.exit("atxHeadingSequence"),f(y))}function h(y){return y===null||y===35||bt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),h)}}const BU=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Z1=["pre","script","style","textarea"],PU={concrete:!0,name:"htmlFlow",resolveTo:qU,tokenize:HU},$U={partial:!0,tokenize:VU},FU={partial:!0,tokenize:ZU};function qU(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function HU(e,t,n){const i=this;let l,o,u,f,m;return h;function h(C){return y(C)}function y(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),g}function g(C){return C===33?(e.consume(C),b):C===47?(e.consume(C),o=!0,j):C===63?(e.consume(C),l=3,i.interrupt?t:R):Sn(C)?(e.consume(C),u=String.fromCharCode(C),E):n(C)}function b(C){return C===45?(e.consume(C),l=2,x):C===91?(e.consume(C),l=5,f=0,k):Sn(C)?(e.consume(C),l=4,i.interrupt?t:R):n(C)}function x(C){return C===45?(e.consume(C),i.interrupt?t:R):n(C)}function k(C){const J="CDATA[";return C===J.charCodeAt(f++)?(e.consume(C),f===J.length?i.interrupt?t:re:k):n(C)}function j(C){return Sn(C)?(e.consume(C),u=String.fromCharCode(C),E):n(C)}function E(C){if(C===null||C===47||C===62||bt(C)){const J=C===47,Y=u.toLowerCase();return!J&&!o&&Z1.includes(Y)?(l=1,i.interrupt?t(C):re(C)):BU.includes(u.toLowerCase())?(l=6,J?(e.consume(C),N):i.interrupt?t(C):re(C)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(C):o?T(C):D(C))}return C===45||mn(C)?(e.consume(C),u+=String.fromCharCode(C),E):n(C)}function N(C){return C===62?(e.consume(C),i.interrupt?t:re):n(C)}function T(C){return Ge(C)?(e.consume(C),T):q(C)}function D(C){return C===47?(e.consume(C),q):C===58||C===95||Sn(C)?(e.consume(C),U):Ge(C)?(e.consume(C),D):q(C)}function U(C){return C===45||C===46||C===58||C===95||mn(C)?(e.consume(C),U):B(C)}function B(C){return C===61?(e.consume(C),z):Ge(C)?(e.consume(C),B):D(C)}function z(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),m=C,F):Ge(C)?(e.consume(C),z):Z(C)}function F(C){return C===m?(e.consume(C),m=null,ee):C===null||Re(C)?n(C):(e.consume(C),F)}function Z(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||bt(C)?B(C):(e.consume(C),Z)}function ee(C){return C===47||C===62||Ge(C)?D(C):n(C)}function q(C){return C===62?(e.consume(C),ae):n(C)}function ae(C){return C===null||Re(C)?re(C):Ge(C)?(e.consume(C),ae):n(C)}function re(C){return C===45&&l===2?(e.consume(C),P):C===60&&l===1?(e.consume(C),V):C===62&&l===4?(e.consume(C),L):C===63&&l===3?(e.consume(C),R):C===93&&l===5?(e.consume(C),be):Re(C)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check($U,A,pe)(C)):C===null||Re(C)?(e.exit("htmlFlowData"),pe(C)):(e.consume(C),re)}function pe(C){return e.check(FU,fe,A)(C)}function fe(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),W}function W(C){return C===null||Re(C)?pe(C):(e.enter("htmlFlowData"),re(C))}function P(C){return C===45?(e.consume(C),R):re(C)}function V(C){return C===47?(e.consume(C),u="",ce):re(C)}function ce(C){if(C===62){const J=u.toLowerCase();return Z1.includes(J)?(e.consume(C),L):re(C)}return Sn(C)&&u.length<8?(e.consume(C),u+=String.fromCharCode(C),ce):re(C)}function be(C){return C===93?(e.consume(C),R):re(C)}function R(C){return C===62?(e.consume(C),L):C===45&&l===2?(e.consume(C),R):re(C)}function L(C){return C===null||Re(C)?(e.exit("htmlFlowData"),A(C)):(e.consume(C),L)}function A(C){return e.exit("htmlFlow"),t(C)}}function ZU(e,t,n){const i=this;return l;function l(u){return Re(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}function VU(e,t,n){return i;function i(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Nu,t,n)}}const QU={name:"htmlText",tokenize:GU};function GU(e,t,n){const i=this;let l,o,u;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),m}function m(R){return R===33?(e.consume(R),h):R===47?(e.consume(R),B):R===63?(e.consume(R),D):Sn(R)?(e.consume(R),Z):n(R)}function h(R){return R===45?(e.consume(R),y):R===91?(e.consume(R),o=0,k):Sn(R)?(e.consume(R),T):n(R)}function y(R){return R===45?(e.consume(R),x):n(R)}function g(R){return R===null?n(R):R===45?(e.consume(R),b):Re(R)?(u=g,V(R)):(e.consume(R),g)}function b(R){return R===45?(e.consume(R),x):g(R)}function x(R){return R===62?P(R):R===45?b(R):g(R)}function k(R){const L="CDATA[";return R===L.charCodeAt(o++)?(e.consume(R),o===L.length?j:k):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),E):Re(R)?(u=j,V(R)):(e.consume(R),j)}function E(R){return R===93?(e.consume(R),N):j(R)}function N(R){return R===62?P(R):R===93?(e.consume(R),N):j(R)}function T(R){return R===null||R===62?P(R):Re(R)?(u=T,V(R)):(e.consume(R),T)}function D(R){return R===null?n(R):R===63?(e.consume(R),U):Re(R)?(u=D,V(R)):(e.consume(R),D)}function U(R){return R===62?P(R):D(R)}function B(R){return Sn(R)?(e.consume(R),z):n(R)}function z(R){return R===45||mn(R)?(e.consume(R),z):F(R)}function F(R){return Re(R)?(u=F,V(R)):Ge(R)?(e.consume(R),F):P(R)}function Z(R){return R===45||mn(R)?(e.consume(R),Z):R===47||R===62||bt(R)?ee(R):n(R)}function ee(R){return R===47?(e.consume(R),P):R===58||R===95||Sn(R)?(e.consume(R),q):Re(R)?(u=ee,V(R)):Ge(R)?(e.consume(R),ee):P(R)}function q(R){return R===45||R===46||R===58||R===95||mn(R)?(e.consume(R),q):ae(R)}function ae(R){return R===61?(e.consume(R),re):Re(R)?(u=ae,V(R)):Ge(R)?(e.consume(R),ae):ee(R)}function re(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),l=R,pe):Re(R)?(u=re,V(R)):Ge(R)?(e.consume(R),re):(e.consume(R),fe)}function pe(R){return R===l?(e.consume(R),l=void 0,W):R===null?n(R):Re(R)?(u=pe,V(R)):(e.consume(R),pe)}function fe(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||bt(R)?ee(R):(e.consume(R),fe)}function W(R){return R===47||R===62||bt(R)?ee(R):n(R)}function P(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function V(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ce}function ce(R){return Ge(R)?tt(e,be,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):be(R)}function be(R){return e.enter("htmlTextData"),u(R)}}const Wg={name:"labelEnd",resolveAll:JU,resolveTo:WU,tokenize:e9},KU={tokenize:t9},YU={tokenize:n9},XU={tokenize:r9};function JU(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const l=i.type==="labelImage"?4:2;i.type="data",t+=l}}return e.length!==n.length&&Xn(e,0,e.length,n),e}function WU(e,t){let n=e.length,i=0,l,o,u,f;for(;n--;)if(l=e[n][1],o){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[n][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(o=n,l.type!=="labelLink")){i=2;break}}else l.type==="labelEnd"&&(u=n);const m={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},y={type:"labelText",start:{...e[o+i+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=mr(f,e.slice(o+1,o+i+3)),f=mr(f,[["enter",y,t]]),f=mr(f,nf(t.parser.constructs.insideSpan.null,e.slice(o+i+4,u-3),t)),f=mr(f,[["exit",y,t],e[u-2],e[u-1],["exit",h,t]]),f=mr(f,e.slice(u+1)),f=mr(f,[["exit",m,t]]),Xn(e,o,e.length,f),e}function e9(e,t,n){const i=this;let l=i.events.length,o,u;for(;l--;)if((i.events[l][1].type==="labelImage"||i.events[l][1].type==="labelLink")&&!i.events[l][1]._balanced){o=i.events[l][1];break}return f;function f(b){return o?o._inactive?g(b):(u=i.parser.defined.includes(Cr(i.sliceSerialize({start:o.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):n(b)}function m(b){return b===40?e.attempt(KU,y,u?y:g)(b):b===91?e.attempt(YU,y,u?h:g)(b):u?y(b):g(b)}function h(b){return e.attempt(XU,y,g)(b)}function y(b){return t(b)}function g(b){return o._balanced=!0,n(b)}}function t9(e,t,n){return i;function i(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return bt(g)?nu(e,o)(g):o(g)}function o(g){return g===41?y(g):mE(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function u(g){return bt(g)?nu(e,m)(g):y(g)}function f(g){return n(g)}function m(g){return g===34||g===39||g===40?gE(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function h(g){return bt(g)?nu(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function n9(e,t,n){const i=this;return l;function l(f){return pE.call(i,e,o,u,"reference","referenceMarker","referenceString")(f)}function o(f){return i.parser.defined.includes(Cr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function r9(e,t,n){return i;function i(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),l}function l(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const a9={name:"labelStartImage",resolveAll:Wg.resolveAll,tokenize:i9};function i9(e,t,n){const i=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):t(f)}}const l9={name:"labelStartLink",resolveAll:Wg.resolveAll,tokenize:s9};function s9(e,t,n){const i=this;return l;function l(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),o}function o(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const Gm={name:"lineEnding",tokenize:o9};function o9(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),tt(e,t,"linePrefix")}}const bd={name:"thematicBreak",tokenize:u9};function u9(e,t,n){let i=0,l;return o;function o(h){return e.enter("thematicBreak"),u(h)}function u(h){return l=h,f(h)}function f(h){return h===l?(e.enter("thematicBreakSequence"),m(h)):i>=3&&(h===null||Re(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===l?(e.consume(h),i++,m):(e.exit("thematicBreakSequence"),Ge(h)?tt(e,f,"whitespace")(h):f(h))}}const Tn={continuation:{tokenize:h9},exit:p9,name:"list",tokenize:f9},c9={partial:!0,tokenize:g9},d9={partial:!0,tokenize:m9};function f9(e,t,n){const i=this,l=i.events[i.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,u=0;return f;function f(x){const k=i.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!i.containerState.marker||x===i.containerState.marker:Kp(x)){if(i.containerState.type||(i.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(bd,n,h)(x):h(x);if(!i.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(x)}return n(x)}function m(x){return Kp(x)&&++u<10?(e.consume(x),m):(!i.interrupt||u<2)&&(i.containerState.marker?x===i.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),h(x)):n(x)}function h(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||x,e.check(Nu,i.interrupt?n:y,e.attempt(c9,b,g))}function y(x){return i.containerState.initialBlankLine=!0,o++,b(x)}function g(x){return Ge(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),b):n(x)}function b(x){return i.containerState.size=o+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function h9(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Nu,l,o);function l(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,tt(e,t,"listItemIndent",i.containerState.size+1)(f)}function o(f){return i.containerState.furtherBlankLines||!Ge(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(d9,t,u)(f))}function u(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,tt(e,e.attempt(Tn,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function m9(e,t,n){const i=this;return tt(e,l,"listItemIndent",i.containerState.size+1);function l(o){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(o):n(o)}}function p9(e){e.exit(this.containerState.type)}function g9(e,t,n){const i=this;return tt(e,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const u=i.events[i.events.length-1];return!Ge(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const V1={name:"setextUnderline",resolveTo:y9,tokenize:v9};function y9(e,t){let n=e.length,i,l,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",u,t]),e.splice(o+1,0,["exit",e[i][1],t]),e[i][1].end={...e[o][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function v9(e,t,n){const i=this;let l;return o;function o(h){let y=i.events.length,g;for(;y--;)if(i.events[y][1].type!=="lineEnding"&&i.events[y][1].type!=="linePrefix"&&i.events[y][1].type!=="content"){g=i.events[y][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(e.enter("setextHeadingLine"),l=h,u(h)):n(h)}function u(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===l?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Ge(h)?tt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Re(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const b9={tokenize:x9};function x9(e){const t=this,n=e.attempt(Nu,i,e.attempt(this.parser.constructs.flowInitial,l,tt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(EU,l)),"linePrefix")));return n;function i(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const S9={resolveAll:vE()},w9=yE("string"),k9=yE("text");function yE(e){return{resolveAll:vE(e==="text"?j9:void 0),tokenize:t};function t(n){const i=this,l=this.parser.constructs[e],o=n.attempt(l,u,f);return u;function u(y){return h(y)?o(y):f(y)}function f(y){if(y===null){n.consume(y);return}return n.enter("data"),n.consume(y),m}function m(y){return h(y)?(n.exit("data"),o(y)):(n.consume(y),m)}function h(y){if(y===null)return!0;const g=l[y];let b=-1;if(g)for(;++b<g.length;){const x=g[b];if(!x.previous||x.previous.call(i,i.previous))return!0}return!1}}}function vE(e){return t;function t(n,i){let l=-1,o;for(;++l<=n.length;)o===void 0?n[l]&&n[l][1].type==="data"&&(o=l,l++):(!n[l]||n[l][1].type!=="data")&&(l!==o+2&&(n[o][1].end=n[l-1][1].end,n.splice(o+2,l-o-2),l=o+2),o=void 0);return e?e(n,i):n}}function j9(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],l=t.sliceStream(i);let o=l.length,u=-1,f=0,m;for(;o--;){const h=l[o];if(typeof h=="string"){for(u=h.length;h.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(h===-2)m=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:i.start._bufferIndex+u,_index:i.start._index+o,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const E9={42:Tn,43:Tn,45:Tn,48:Tn,49:Tn,50:Tn,51:Tn,52:Tn,53:Tn,54:Tn,55:Tn,56:Tn,57:Tn,62:cE},C9={91:TU},_9={[-2]:Qm,[-1]:Qm,32:Qm},N9={35:LU,42:bd,45:[V1,bd],60:PU,61:V1,95:bd,96:H1,126:H1},A9={38:fE,92:dE},T9={[-5]:Gm,[-4]:Gm,[-3]:Gm,33:a9,38:fE,42:Yp,60:[lU,QU],91:l9,92:[DU,dE],93:Wg,95:Yp,96:bU},R9={null:[Yp,S9]},z9={null:[42,95]},O9={null:[]},D9=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:z9,contentInitial:C9,disable:O9,document:E9,flow:N9,flowInitial:_9,insideSpan:R9,string:A9,text:T9},Symbol.toStringTag,{value:"Module"}));function M9(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const l={},o=[];let u=[],f=[];const m={attempt:F(B),check:F(z),consume:T,enter:D,exit:U,interrupt:F(z,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:x,write:g};let y=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function g(ae){return u=mr(u,ae),E(),u[u.length-1]!==null?[]:(Z(t,0),h.events=nf(o,h.events,h),h.events)}function b(ae,re){return I9(x(ae),re)}function x(ae){return L9(u,ae)}function k(){const{_bufferIndex:ae,_index:re,line:pe,column:fe,offset:W}=i;return{_bufferIndex:ae,_index:re,line:pe,column:fe,offset:W}}function j(ae){l[ae.line]=ae.column,q()}function E(){let ae;for(;i._index<u.length;){const re=u[i._index];if(typeof re=="string")for(ae=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===ae&&i._bufferIndex<re.length;)N(re.charCodeAt(i._bufferIndex));else N(re)}}function N(ae){y=y(ae)}function T(ae){Re(ae)?(i.line++,i.column=1,i.offset+=ae===-3?2:1,q()):ae!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=ae}function D(ae,re){const pe=re||{};return pe.type=ae,pe.start=k(),h.events.push(["enter",pe,h]),f.push(pe),pe}function U(ae){const re=f.pop();return re.end=k(),h.events.push(["exit",re,h]),re}function B(ae,re){Z(ae,re.from)}function z(ae,re){re.restore()}function F(ae,re){return pe;function pe(fe,W,P){let V,ce,be,R;return Array.isArray(fe)?A(fe):"tokenize"in fe?A([fe]):L(fe);function L(ue){return ge;function ge(Me){const xe=Me!==null&&ue[Me],_t=Me!==null&&ue.null,en=[...Array.isArray(xe)?xe:xe?[xe]:[],...Array.isArray(_t)?_t:_t?[_t]:[]];return A(en)(Me)}}function A(ue){return V=ue,ce=0,ue.length===0?P:C(ue[ce])}function C(ue){return ge;function ge(Me){return R=ee(),be=ue,ue.partial||(h.currentConstruct=ue),ue.name&&h.parser.constructs.disable.null.includes(ue.name)?Y():ue.tokenize.call(re?Object.assign(Object.create(h),re):h,m,J,Y)(Me)}}function J(ue){return ae(be,R),W}function Y(ue){return R.restore(),++ce<V.length?C(V[ce]):P}}}function Z(ae,re){ae.resolveAll&&!o.includes(ae)&&o.push(ae),ae.resolve&&Xn(h.events,re,h.events.length-re,ae.resolve(h.events.slice(re),h)),ae.resolveTo&&(h.events=ae.resolveTo(h.events,h))}function ee(){const ae=k(),re=h.previous,pe=h.currentConstruct,fe=h.events.length,W=Array.from(f);return{from:fe,restore:P};function P(){i=ae,h.previous=re,h.currentConstruct=pe,h.events.length=fe,f=W,q()}}function q(){i.line in l&&i.column<2&&(i.column=l[i.line],i.offset+=l[i.line]-1)}}function L9(e,t){const n=t.start._index,i=t.start._bufferIndex,l=t.end._index,o=t.end._bufferIndex;let u;if(n===l)u=[e[n].slice(i,o)];else{if(u=e.slice(n,l),i>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(i):u.shift()}o>0&&u.push(e[l].slice(0,o))}return u}function I9(e,t){let n=-1;const i=[];let l;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
334
334
  `;break}case-3:{u=`\r
335
335
  `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&l)continue;u=" ";break}default:u=String.fromCharCode(o)}l=o===-2,i.push(u)}return i.join("")}function U9(e){const i={constructs:oE([D9,...(e||{}).extensions||[]]),content:l(WI),defined:[],document:l(tU),flow:l(b9),lazy:{},string:l(w9),text:l(k9)};return i;function l(o){return u;function u(f){return M9(i,o,f)}}}function B9(e){for(;!hE(e););return e}const Q1=/[\0\t\n\r]/g;function P9(){let e=1,t="",n=!0,i;return l;function l(o,u,f){const m=[];let h,y,g,b,x;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(Q1.lastIndex=g,h=Q1.exec(o),b=h&&h.index!==void 0?h.index:o.length,x=o.charCodeAt(b),!h){t=o.slice(g);break}if(x===10&&g===b&&i)m.push(-3),i=void 0;else switch(i&&(m.push(-5),i=void 0),g<b&&(m.push(o.slice(g,b)),e+=b-g),x){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:i=!0,e=1}g=b+1}return f&&(i&&m.push(-5),t&&m.push(t),m.push(null)),m}}const $9=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function F9(e){return e.replace($9,q9)}function q9(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const l=n.charCodeAt(1),o=l===120||l===88;return uE(n.slice(o?2:1),o?16:10)}return Jg(n)||e}const bE={}.hasOwnProperty;function H9(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Z9(n)(B9(U9(n).document().write(P9()(e,t,!0))))}function Z9(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Zr),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:o(Na),blockQuote:o(_t),characterEscape:ee,characterReference:ee,codeFenced:o(en),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(en,u),codeText:o(Bn,u),codeTextData:ee,data:ee,codeFlowValue:ee,definition:o(tr),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(tn),hardBreakEscape:o(ft),hardBreakTrailing:o(ft),htmlFlow:o(Gt,u),htmlFlowData:ee,htmlText:o(Gt,u),htmlTextData:ee,image:o(br),label:u,link:o(Zr),listItem:o(Ai),listItemValue:b,listOrdered:o(Vr,g),listUnordered:o(Vr),paragraph:o(Ti),reference:C,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(Na),strong:o(Vs),thematicBreak:o(Qs)},exit:{atxHeading:m(),atxHeadingSequence:B,autolink:m(),autolinkEmail:xe,autolinkProtocol:Me,blockQuote:m(),characterEscapeValue:q,characterReferenceMarkerHexadecimal:Y,characterReferenceMarkerNumeric:Y,characterReferenceValue:ue,characterReference:ge,codeFenced:m(E),codeFencedFence:j,codeFencedFenceInfo:x,codeFencedFenceMeta:k,codeFlowValue:q,codeIndented:m(N),codeText:m(W),codeTextData:q,data:q,definition:m(),definitionDestinationString:U,definitionLabelString:T,definitionTitleString:D,emphasis:m(),hardBreakEscape:m(re),hardBreakTrailing:m(re),htmlFlow:m(pe),htmlFlowData:q,htmlText:m(fe),htmlTextData:q,image:m(V),label:be,labelText:ce,lineEnding:ae,link:m(P),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:J,resourceDestinationString:R,resourceTitleString:L,resource:A,setextHeading:m(Z),setextHeadingLineSequence:F,setextHeadingText:z,strong:m(),thematicBreak:m()}};xE(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ne){let me={type:"root",children:[]};const Oe={stack:[me],tokenStack:[],config:t,enter:f,exit:h,buffer:u,resume:y,data:n},$e=[];let nt=-1;for(;++nt<ne.length;)if(ne[nt][1].type==="listOrdered"||ne[nt][1].type==="listUnordered")if(ne[nt][0]==="enter")$e.push(nt);else{const cn=$e.pop();nt=l(ne,cn,nt)}for(nt=-1;++nt<ne.length;){const cn=t[ne[nt][0]];bE.call(cn,ne[nt][1].type)&&cn[ne[nt][1].type].call(Object.assign({sliceSerialize:ne[nt][2].sliceSerialize},Oe),ne[nt][1])}if(Oe.tokenStack.length>0){const cn=Oe.tokenStack[Oe.tokenStack.length-1];(cn[1]||G1).call(Oe,void 0,cn[0])}for(me.position={start:ai(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:ai(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},nt=-1;++nt<t.transforms.length;)me=t.transforms[nt](me)||me;return me}function l(ne,me,Oe){let $e=me-1,nt=-1,cn=!1,xr,rn,Dt,dn;for(;++$e<=Oe;){const ut=ne[$e];switch(ut[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ut[0]==="enter"?nt++:nt--,dn=void 0;break}case"lineEndingBlank":{ut[0]==="enter"&&(xr&&!dn&&!nt&&!Dt&&(Dt=$e),dn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:dn=void 0}if(!nt&&ut[0]==="enter"&&ut[1].type==="listItemPrefix"||nt===-1&&ut[0]==="exit"&&(ut[1].type==="listUnordered"||ut[1].type==="listOrdered")){if(xr){let Nr=$e;for(rn=void 0;Nr--;){const Pn=ne[Nr];if(Pn[1].type==="lineEnding"||Pn[1].type==="lineEndingBlank"){if(Pn[0]==="exit")continue;rn&&(ne[rn][1].type="lineEndingBlank",cn=!0),Pn[1].type="lineEnding",rn=Nr}else if(!(Pn[1].type==="linePrefix"||Pn[1].type==="blockQuotePrefix"||Pn[1].type==="blockQuotePrefixWhitespace"||Pn[1].type==="blockQuoteMarker"||Pn[1].type==="listItemIndent"))break}Dt&&(!rn||Dt<rn)&&(xr._spread=!0),xr.end=Object.assign({},rn?ne[rn][1].start:ut[1].end),ne.splice(rn||$e,0,["exit",xr,ut[2]]),$e++,Oe++}if(ut[1].type==="listItemPrefix"){const Nr={type:"listItem",_spread:!1,start:Object.assign({},ut[1].start),end:void 0};xr=Nr,ne.splice($e,0,["enter",Nr,ut[2]]),$e++,Oe++,Dt=void 0,dn=!0}}}return ne[me][1]._spread=cn,Oe}function o(ne,me){return Oe;function Oe($e){f.call(this,ne($e),$e),me&&me.call(this,$e)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(ne,me,Oe){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([me,Oe||void 0]),ne.position={start:ai(me.start),end:void 0}}function m(ne){return me;function me(Oe){ne&&ne.call(this,Oe),h.call(this,Oe)}}function h(ne,me){const Oe=this.stack.pop(),$e=this.tokenStack.pop();if($e)$e[0].type!==ne.type&&(me?me.call(this,ne,$e[0]):($e[1]||G1).call(this,ne,$e[0]));else throw new Error("Cannot close `"+ne.type+"` ("+tu({start:ne.start,end:ne.end})+"): it’s not open");Oe.position.end=ai(ne.end)}function y(){return Xg(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(ne){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function x(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.lang=ne}function k(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.meta=ne}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function N(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne.replace(/(\r?\n|\r)$/g,"")}function T(ne){const me=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=me,Oe.identifier=Cr(this.sliceSerialize(ne)).toLowerCase()}function D(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.title=ne}function U(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.url=ne}function B(ne){const me=this.stack[this.stack.length-1];if(!me.depth){const Oe=this.sliceSerialize(ne).length;me.depth=Oe}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function F(ne){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function Z(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(ne){const Oe=this.stack[this.stack.length-1].children;let $e=Oe[Oe.length-1];(!$e||$e.type!=="text")&&($e=nn(),$e.position={start:ai(ne.start),end:void 0},Oe.push($e)),this.stack.push($e)}function q(ne){const me=this.stack.pop();me.value+=this.sliceSerialize(ne),me.position.end=ai(ne.end)}function ae(ne){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Oe=me.children[me.children.length-1];Oe.position.end=ai(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(me.type)&&(ee.call(this,ne),q.call(this,ne))}function re(){this.data.atHardBreak=!0}function pe(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne}function fe(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne}function W(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.value=ne}function P(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=me,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function V(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=me,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function ce(ne){const me=this.sliceSerialize(ne),Oe=this.stack[this.stack.length-2];Oe.label=F9(me),Oe.identifier=Cr(me).toLowerCase()}function be(){const ne=this.stack[this.stack.length-1],me=this.resume(),Oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Oe.type==="link"){const $e=ne.children;Oe.children=$e}else Oe.alt=me}function R(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.url=ne}function L(){const ne=this.resume(),me=this.stack[this.stack.length-1];me.title=ne}function A(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function J(ne){const me=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=me,Oe.identifier=Cr(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function Y(ne){this.data.characterReferenceType=ne.type}function ue(ne){const me=this.sliceSerialize(ne),Oe=this.data.characterReferenceType;let $e;Oe?($e=uE(me,Oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$e=Jg(me);const nt=this.stack[this.stack.length-1];nt.value+=$e}function ge(ne){const me=this.stack.pop();me.position.end=ai(ne.end)}function Me(ne){q.call(this,ne);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(ne)}function xe(ne){q.call(this,ne);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(ne)}function _t(){return{type:"blockquote",children:[]}}function en(){return{type:"code",lang:null,meta:null,value:""}}function Bn(){return{type:"inlineCode",value:""}}function tr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function tn(){return{type:"emphasis",children:[]}}function Na(){return{type:"heading",depth:0,children:[]}}function ft(){return{type:"break"}}function Gt(){return{type:"html",value:""}}function br(){return{type:"image",title:null,url:"",alt:null}}function Zr(){return{type:"link",title:null,url:"",children:[]}}function Vr(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function Ai(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function Ti(){return{type:"paragraph",children:[]}}function Vs(){return{type:"strong",children:[]}}function nn(){return{type:"text",value:""}}function Qs(){return{type:"thematicBreak"}}}function ai(e){return{line:e.line,column:e.column,offset:e.offset}}function xE(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?xE(e,i):V9(e,i)}}function V9(e,t){let n;for(n in t)if(bE.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function G1(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+tu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+tu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+tu({start:t.start,end:t.end})+") is still open")}function Q9(e){const t=this;t.parser=n;function n(i){return H9(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function G9(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function K9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -16,7 +16,7 @@
16
16
  if (t === "dark" || (!t && m)) document.documentElement.classList.add("dark");
17
17
  })();
18
18
  </script>
19
- <script type="module" crossorigin src="/assets/index-DkzjED0c.js"></script>
19
+ <script type="module" crossorigin src="/assets/index-Cyvhyw0R.js"></script>
20
20
  <link rel="stylesheet" crossorigin href="/assets/index-DEwlT6PE.css">
21
21
  </head>
22
22
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-team-foundation/first-tree-hub",
3
- "version": "0.9.9",
3
+ "version": "0.9.10",
4
4
  "type": "module",
5
5
  "description": "First Tree Hub — unified CLI for server, client, and agent management",
6
6
  "exports": {