@neuralnomads/codenomad 0.2.7-dev → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ const AgentModelSelectionsSchema = z.record(z.string(), AgentModelSelectionSchem
8
8
  const PreferencesSchema = z.object({
9
9
  showThinkingBlocks: z.boolean().default(false),
10
10
  thinkingBlocksExpansion: z.enum(["expanded", "collapsed"]).default("expanded"),
11
+ showTimelineTools: z.boolean().default(true),
11
12
  lastUsedBinary: z.string().optional(),
12
13
  environmentVariables: z.record(z.string()).default({}),
13
14
  modelRecents: z.array(ModelPreferenceSchema).default([]),
@@ -16,6 +17,7 @@ const PreferencesSchema = z.object({
16
17
  diagnosticsExpansion: z.enum(["expanded", "collapsed"]).default("expanded"),
17
18
  showUsageMetrics: z.boolean().default(true),
18
19
  autoCleanupBlankSessions: z.boolean().default(true),
20
+ listeningMode: z.enum(["local", "all"]).default("local"),
19
21
  });
20
22
  const RecentFolderSchema = z.object({
21
23
  path: z.string(),
@@ -44,9 +44,10 @@ export class ConfigStore {
44
44
  this.cache = next;
45
45
  this.loaded = true;
46
46
  this.persist();
47
+ const published = Boolean(this.eventBus);
47
48
  this.eventBus?.publish({ type: "config.appChanged", config: this.cache });
48
- this.logger.info("Config updated");
49
- this.logger.debug({ config: this.cache }, "Config payload");
49
+ this.logger.debug({ broadcast: published }, "Config SSE event emitted");
50
+ this.logger.trace({ config: this.cache }, "Config payload");
50
51
  }
51
52
  persist() {
52
53
  try {
@@ -6,7 +6,10 @@ export class EventBus extends EventEmitter {
6
6
  }
7
7
  publish(event) {
8
8
  if (event.type !== "instance.event" && event.type !== "instance.eventStatus") {
9
- this.logger?.debug({ event }, "Publishing workspace event");
9
+ this.logger?.debug({ type: event.type }, "Publishing workspace event");
10
+ if (this.logger?.isLevelEnabled("trace")) {
11
+ this.logger.trace({ event }, "Workspace event payload");
12
+ }
10
13
  }
11
14
  return super.emit(event.type, event);
12
15
  }
@@ -22,6 +25,7 @@ export class EventBus extends EventEmitter {
22
25
  this.on("instance.dataChanged", handler);
23
26
  this.on("instance.event", handler);
24
27
  this.on("instance.eventStatus", handler);
28
+ this.on("app.releaseAvailable", handler);
25
29
  return () => {
26
30
  this.off("workspace.created", handler);
27
31
  this.off("workspace.started", handler);
@@ -33,6 +37,7 @@ export class EventBus extends EventEmitter {
33
37
  this.off("instance.dataChanged", handler);
34
38
  this.off("instance.event", handler);
35
39
  this.off("instance.eventStatus", handler);
40
+ this.off("app.releaseAvailable", handler);
36
41
  };
37
42
  }
38
43
  }
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { InstanceStore } from "./storage/instance-store";
16
16
  import { InstanceEventBridge } from "./workspaces/instance-events";
17
17
  import { createLogger } from "./logger";
18
18
  import { launchInBrowser } from "./launcher";
19
+ import { startReleaseMonitor } from "./releases/release-monitor";
19
20
  const require = createRequire(import.meta.url);
20
21
  const packageJson = require("../package.json");
21
22
  const __filename = fileURLToPath(import.meta.url);
@@ -97,9 +98,26 @@ async function main() {
97
98
  const serverMeta = {
98
99
  httpBaseUrl: `http://${options.host}:${options.port}`,
99
100
  eventsUrl: `/api/events`,
101
+ host: options.host,
102
+ listeningMode: options.host === "0.0.0.0" ? "all" : "local",
103
+ port: options.port,
100
104
  hostLabel: options.host,
101
105
  workspaceRoot: options.rootDir,
106
+ addresses: [],
102
107
  };
108
+ const releaseMonitor = startReleaseMonitor({
109
+ currentVersion: packageJson.version,
110
+ logger: logger.child({ component: "release-monitor" }),
111
+ onUpdate: (release) => {
112
+ if (release) {
113
+ serverMeta.latestRelease = release;
114
+ eventBus.publish({ type: "app.releaseAvailable", release });
115
+ }
116
+ else {
117
+ delete serverMeta.latestRelease;
118
+ }
119
+ },
120
+ });
103
121
  const server = createHttpServer({
104
122
  host: options.host,
105
123
  port: options.port,
@@ -143,6 +161,7 @@ async function main() {
143
161
  catch (error) {
144
162
  logger.error({ err: error }, "Workspace manager shutdown failed");
145
163
  }
164
+ releaseMonitor.stop();
146
165
  logger.info("Exiting process");
147
166
  process.exit(0);
148
167
  };
@@ -0,0 +1,100 @@
1
+ import { fetch } from "undici";
2
+ const RELEASES_API_URL = "https://api.github.com/repos/NeuralNomadsAI/CodeNomad/releases/latest";
3
+ export function startReleaseMonitor(options) {
4
+ let stopped = false;
5
+ const refreshRelease = async () => {
6
+ if (stopped)
7
+ return;
8
+ try {
9
+ const release = await fetchLatestRelease(options);
10
+ options.onUpdate(release);
11
+ }
12
+ catch (error) {
13
+ options.logger.warn({ err: error }, "Failed to refresh release information");
14
+ }
15
+ };
16
+ void refreshRelease();
17
+ return {
18
+ stop() {
19
+ stopped = true;
20
+ },
21
+ };
22
+ }
23
+ async function fetchLatestRelease(options) {
24
+ const response = await fetch(RELEASES_API_URL, {
25
+ headers: {
26
+ Accept: "application/vnd.github+json",
27
+ "User-Agent": "CodeNomad-CLI",
28
+ },
29
+ });
30
+ if (!response.ok) {
31
+ throw new Error(`Release API responded with ${response.status}`);
32
+ }
33
+ const json = (await response.json());
34
+ const tagFromServer = json.tag_name || json.name;
35
+ if (!tagFromServer) {
36
+ return null;
37
+ }
38
+ const normalizedVersion = stripTagPrefix(tagFromServer);
39
+ if (!normalizedVersion) {
40
+ return null;
41
+ }
42
+ const current = parseVersion(options.currentVersion);
43
+ const remote = parseVersion(normalizedVersion);
44
+ if (compareVersions(remote, current) <= 0) {
45
+ return null;
46
+ }
47
+ return {
48
+ version: normalizedVersion,
49
+ tag: tagFromServer,
50
+ url: json.html_url ?? `https://github.com/NeuralNomadsAI/CodeNomad/releases/tag/${encodeURIComponent(tagFromServer)}`,
51
+ channel: json.prerelease || normalizedVersion.includes("-") ? "dev" : "stable",
52
+ publishedAt: json.published_at ?? json.created_at,
53
+ notes: json.body,
54
+ };
55
+ }
56
+ function stripTagPrefix(tag) {
57
+ if (!tag)
58
+ return null;
59
+ const trimmed = tag.trim();
60
+ if (!trimmed)
61
+ return null;
62
+ return trimmed.replace(/^v/i, "");
63
+ }
64
+ function parseVersion(value) {
65
+ const normalized = stripTagPrefix(value) ?? "0.0.0";
66
+ const [core, prerelease = null] = normalized.split("-", 2);
67
+ const [major = 0, minor = 0, patch = 0] = core.split(".").map((segment) => {
68
+ const parsed = Number.parseInt(segment, 10);
69
+ return Number.isFinite(parsed) ? parsed : 0;
70
+ });
71
+ return {
72
+ major,
73
+ minor,
74
+ patch,
75
+ prerelease,
76
+ };
77
+ }
78
+ function compareVersions(a, b) {
79
+ if (a.major !== b.major) {
80
+ return a.major > b.major ? 1 : -1;
81
+ }
82
+ if (a.minor !== b.minor) {
83
+ return a.minor > b.minor ? 1 : -1;
84
+ }
85
+ if (a.patch !== b.patch) {
86
+ return a.patch > b.patch ? 1 : -1;
87
+ }
88
+ const aPre = a.prerelease && a.prerelease.length > 0 ? a.prerelease : null;
89
+ const bPre = b.prerelease && b.prerelease.length > 0 ? b.prerelease : null;
90
+ if (aPre === bPre) {
91
+ return 0;
92
+ }
93
+ if (!aPre) {
94
+ return 1;
95
+ }
96
+ if (!bPre) {
97
+ return -1;
98
+ }
99
+ return aPre.localeCompare(bPre);
100
+ }
@@ -11,9 +11,12 @@ import { registerFilesystemRoutes } from "./routes/filesystem";
11
11
  import { registerMetaRoutes } from "./routes/meta";
12
12
  import { registerEventRoutes } from "./routes/events";
13
13
  import { registerStorageRoutes } from "./routes/storage";
14
+ const DEFAULT_HTTP_PORT = 9898;
14
15
  export function createHttpServer(deps) {
15
16
  const app = Fastify({ logger: false });
16
17
  const proxyLogger = deps.logger.child({ component: "proxy" });
18
+ const apiLogger = deps.logger.child({ component: "http" });
19
+ const sseLogger = deps.logger.child({ component: "sse" });
17
20
  const sseClients = new Set();
18
21
  const registerSseClient = (cleanup) => {
19
22
  sseClients.add(cleanup);
@@ -25,6 +28,28 @@ export function createHttpServer(deps) {
25
28
  }
26
29
  sseClients.clear();
27
30
  };
31
+ app.addHook("onRequest", (request, _reply, done) => {
32
+ ;
33
+ request.__logMeta = {
34
+ start: process.hrtime.bigint(),
35
+ };
36
+ done();
37
+ });
38
+ app.addHook("onResponse", (request, reply, done) => {
39
+ const meta = request.__logMeta;
40
+ const durationMs = meta ? Number((process.hrtime.bigint() - meta.start) / BigInt(1000000)) : undefined;
41
+ const base = {
42
+ method: request.method,
43
+ url: request.url,
44
+ status: reply.statusCode,
45
+ durationMs,
46
+ };
47
+ apiLogger.debug(base, "HTTP request completed");
48
+ if (apiLogger.isLevelEnabled("trace")) {
49
+ apiLogger.trace({ ...base, params: request.params, query: request.query, body: request.body }, "HTTP request payload");
50
+ }
51
+ done();
52
+ });
28
53
  app.register(cors, {
29
54
  origin: true,
30
55
  credentials: true,
@@ -42,7 +67,7 @@ export function createHttpServer(deps) {
42
67
  registerConfigRoutes(app, { configStore: deps.configStore, binaryRegistry: deps.binaryRegistry });
43
68
  registerFilesystemRoutes(app, { fileSystemBrowser: deps.fileSystemBrowser });
44
69
  registerMetaRoutes(app, { serverMeta: deps.serverMeta });
45
- registerEventRoutes(app, { eventBus: deps.eventBus, registerClient: registerSseClient });
70
+ registerEventRoutes(app, { eventBus: deps.eventBus, registerClient: registerSseClient, logger: sseLogger });
46
71
  registerStorageRoutes(app, {
47
72
  instanceStore: deps.instanceStore,
48
73
  eventBus: deps.eventBus,
@@ -58,15 +83,37 @@ export function createHttpServer(deps) {
58
83
  return {
59
84
  instance: app,
60
85
  start: async () => {
61
- const addressInfo = await app.listen({ port: deps.port, host: deps.host });
62
- let actualPort = deps.port;
63
- if (typeof addressInfo === "string") {
86
+ const attemptListen = async (requestedPort) => {
87
+ const addressInfo = await app.listen({ port: requestedPort, host: deps.host });
88
+ return { addressInfo, requestedPort };
89
+ };
90
+ const autoPortRequested = deps.port === 0;
91
+ const primaryPort = autoPortRequested ? DEFAULT_HTTP_PORT : deps.port;
92
+ const shouldRetryWithEphemeral = (error) => {
93
+ if (!autoPortRequested)
94
+ return false;
95
+ const err = error;
96
+ return Boolean(err && err.code === "EADDRINUSE");
97
+ };
98
+ let listenResult;
99
+ try {
100
+ listenResult = await attemptListen(primaryPort);
101
+ }
102
+ catch (error) {
103
+ if (!shouldRetryWithEphemeral(error)) {
104
+ throw error;
105
+ }
106
+ deps.logger.warn({ err: error, port: primaryPort }, "Preferred port unavailable, retrying on ephemeral port");
107
+ listenResult = await attemptListen(0);
108
+ }
109
+ let actualPort = listenResult.requestedPort;
110
+ if (typeof listenResult.addressInfo === "string") {
64
111
  try {
65
- const parsed = new URL(addressInfo);
66
- actualPort = Number(parsed.port) || deps.port;
112
+ const parsed = new URL(listenResult.addressInfo);
113
+ actualPort = Number(parsed.port) || listenResult.requestedPort;
67
114
  }
68
115
  catch {
69
- actualPort = deps.port;
116
+ actualPort = listenResult.requestedPort;
70
117
  }
71
118
  }
72
119
  else {
@@ -78,6 +125,9 @@ export function createHttpServer(deps) {
78
125
  const displayHost = deps.host === "0.0.0.0" ? "127.0.0.1" : deps.host === "127.0.0.1" ? "localhost" : deps.host;
79
126
  const serverUrl = `http://${displayHost}:${actualPort}`;
80
127
  deps.serverMeta.httpBaseUrl = serverUrl;
128
+ deps.serverMeta.host = deps.host;
129
+ deps.serverMeta.port = actualPort;
130
+ deps.serverMeta.listeningMode = deps.host === "0.0.0.0" ? "all" : "local";
81
131
  deps.logger.info({ port: actualPort, host: deps.host }, "HTTP server listening");
82
132
  console.log(`CodeNomad Server is ready at ${serverUrl}`);
83
133
  return { port: actualPort, url: serverUrl, displayHost };
@@ -132,6 +182,10 @@ async function proxyWorkspaceRequest(args) {
132
182
  const queryIndex = (request.raw.url ?? "").indexOf("?");
133
183
  const search = queryIndex >= 0 ? (request.raw.url ?? "").slice(queryIndex) : "";
134
184
  const targetUrl = `http://${INSTANCE_PROXY_HOST}:${port}${normalizedSuffix}${search}`;
185
+ logger.debug({ workspaceId, method: request.method, targetUrl }, "Proxying request to instance");
186
+ if (logger.isLevelEnabled("trace")) {
187
+ logger.trace({ workspaceId, targetUrl, body: request.body }, "Instance proxy payload");
188
+ }
135
189
  return reply.from(targetUrl, {
136
190
  onError: (proxyReply, { error }) => {
137
191
  logger.error({ err: error, workspaceId, targetUrl }, "Failed to proxy workspace request");
@@ -1,5 +1,8 @@
1
+ let nextClientId = 0;
1
2
  export function registerEventRoutes(app, deps) {
2
3
  app.get("/api/events", (request, reply) => {
4
+ const clientId = ++nextClientId;
5
+ deps.logger.debug({ clientId }, "SSE client connected");
3
6
  const origin = request.headers.origin ?? "*";
4
7
  reply.raw.setHeader("Access-Control-Allow-Origin", origin);
5
8
  reply.raw.setHeader("Access-Control-Allow-Credentials", "true");
@@ -9,6 +12,10 @@ export function registerEventRoutes(app, deps) {
9
12
  reply.raw.flushHeaders?.();
10
13
  reply.hijack();
11
14
  const send = (event) => {
15
+ deps.logger.debug({ clientId, type: event.type }, "SSE event dispatched");
16
+ if (deps.logger.isLevelEnabled("trace")) {
17
+ deps.logger.trace({ clientId, event }, "SSE event payload");
18
+ }
12
19
  reply.raw.write(`data: ${JSON.stringify(event)}\n\n`);
13
20
  };
14
21
  const unsubscribe = deps.eventBus.onEvent(send);
@@ -23,6 +30,7 @@ export function registerEventRoutes(app, deps) {
23
30
  clearInterval(heartbeat);
24
31
  unsubscribe();
25
32
  reply.raw.end?.();
33
+ deps.logger.debug({ clientId }, "SSE client disconnected");
26
34
  };
27
35
  const unregister = deps.registerClient(close);
28
36
  const handleClose = () => {
@@ -1,3 +1,97 @@
1
+ import os from "os";
1
2
  export function registerMetaRoutes(app, deps) {
2
- app.get("/api/meta", async () => deps.serverMeta);
3
+ app.get("/api/meta", async () => buildMetaResponse(deps.serverMeta));
4
+ }
5
+ function buildMetaResponse(meta) {
6
+ const port = resolvePort(meta);
7
+ const addresses = port > 0 ? resolveAddresses(port, meta.host) : [];
8
+ return {
9
+ ...meta,
10
+ port,
11
+ listeningMode: meta.host === "0.0.0.0" ? "all" : "local",
12
+ addresses,
13
+ };
14
+ }
15
+ function resolvePort(meta) {
16
+ if (Number.isInteger(meta.port) && meta.port > 0) {
17
+ return meta.port;
18
+ }
19
+ try {
20
+ const parsed = new URL(meta.httpBaseUrl);
21
+ const port = Number(parsed.port);
22
+ return Number.isInteger(port) && port > 0 ? port : 0;
23
+ }
24
+ catch {
25
+ return 0;
26
+ }
27
+ }
28
+ function resolveAddresses(port, host) {
29
+ const interfaces = os.networkInterfaces();
30
+ const seen = new Set();
31
+ const results = [];
32
+ const addAddress = (ip, scope) => {
33
+ if (!ip || ip === "0.0.0.0")
34
+ return;
35
+ const key = `ipv4-${ip}`;
36
+ if (seen.has(key))
37
+ return;
38
+ seen.add(key);
39
+ results.push({ ip, family: "ipv4", scope, url: `http://${ip}:${port}` });
40
+ };
41
+ const normalizeFamily = (value) => {
42
+ if (typeof value === "string") {
43
+ const lowered = value.toLowerCase();
44
+ if (lowered === "ipv4") {
45
+ return "ipv4";
46
+ }
47
+ }
48
+ if (value === 4)
49
+ return "ipv4";
50
+ return null;
51
+ };
52
+ if (host === "0.0.0.0") {
53
+ // Enumerate system interfaces (IPv4 only)
54
+ for (const entries of Object.values(interfaces)) {
55
+ if (!entries)
56
+ continue;
57
+ for (const entry of entries) {
58
+ const family = normalizeFamily(entry.family);
59
+ if (!family)
60
+ continue;
61
+ if (!entry.address || entry.address === "0.0.0.0")
62
+ continue;
63
+ const scope = entry.internal ? "loopback" : "external";
64
+ addAddress(entry.address, scope);
65
+ }
66
+ }
67
+ }
68
+ // Always include loopback address
69
+ addAddress("127.0.0.1", "loopback");
70
+ // Include explicitly configured host if it was IPv4
71
+ if (isIPv4Address(host) && host !== "0.0.0.0") {
72
+ const isLoopback = host.startsWith("127.");
73
+ addAddress(host, isLoopback ? "loopback" : "external");
74
+ }
75
+ const scopeWeight = { external: 0, internal: 1, loopback: 2 };
76
+ return results.sort((a, b) => {
77
+ const scopeDelta = scopeWeight[a.scope] - scopeWeight[b.scope];
78
+ if (scopeDelta !== 0)
79
+ return scopeDelta;
80
+ return a.ip.localeCompare(b.ip);
81
+ });
82
+ }
83
+ function isIPv4Address(value) {
84
+ if (!value)
85
+ return false;
86
+ const parts = value.split(".");
87
+ if (parts.length !== 4)
88
+ return false;
89
+ return parts.every((part) => {
90
+ if (part.length === 0 || part.length > 3)
91
+ return false;
92
+ if (!/^[0-9]+$/.test(part))
93
+ return false;
94
+ const num = Number(part);
95
+ return Number.isInteger(num) && num >= 0 && num <= 255;
96
+ });
3
97
  }
@@ -122,6 +122,10 @@ export class InstanceEventBridge {
122
122
  }
123
123
  try {
124
124
  const event = JSON.parse(payload);
125
+ this.options.logger.debug({ workspaceId, eventType: event.type }, "Instance SSE event received");
126
+ if (this.options.logger.isLevelEnabled("trace")) {
127
+ this.options.logger.trace({ workspaceId, event }, "Instance SSE event payload");
128
+ }
125
129
  this.options.eventBus.publish({ type: "instance.event", instanceId: workspaceId, event });
126
130
  }
127
131
  catch (error) {
@@ -129,6 +133,7 @@ export class InstanceEventBridge {
129
133
  }
130
134
  }
131
135
  publishStatus(instanceId, status, reason) {
136
+ this.options.logger.debug({ instanceId, status, reason }, "Instance SSE status updated");
132
137
  this.options.eventBus.publish({ type: "instance.eventStatus", instanceId, status, reason });
133
138
  }
134
139
  delay(duration, signal) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuralnomads/codenomad",
3
- "version": "0.2.7-dev",
3
+ "version": "0.3.0",
4
4
  "description": "CodeNomad Server",
5
5
  "author": {
6
6
  "name": "Neural Nomads",
@@ -0,0 +1 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const g={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return be(this.context.count)},getNextContextId(){return be(this.context.count++)}};function be(e){const t=String(e),n=t.length-1;return g.context.id+(n?String.fromCharCode(96+n):"")+t}function Be(e){g.context=e}const Ge=!1,Ve=(e,t)=>e===t,X=Symbol("solid-proxy"),Oe=typeof Proxy=="function",Pe=Symbol("solid-track"),Y={equals:Ve};let B=null,Ne=$e;const v=1,Q=2,ke={owned:null,cleanups:null,context:null,owner:null};var y=null;let oe=null,He=null,m=null,F=null,P=null,ne=0;function L(e,t){const n=m,r=y,s=e.length===0,o=t===void 0?r:t,l=s?ke:{owned:null,cleanups:null,context:o?o.context:null,owner:o},i=s?e:()=>e(()=>A(()=>V(l)));y=l,m=null;try{return $(i,!0)}finally{m=n,y=r}}function re(e,t){t=t?Object.assign({},Y,t):Y;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=s=>(typeof s=="function"&&(s=s(n.value)),Te(n,s));return[Le.bind(n),r]}function Wt(e,t,n){const r=K(e,t,!0,v);R(r)}function T(e,t,n){const r=K(e,t,!1,v);R(r)}function ve(e,t,n){Ne=We;const r=K(e,t,!1,v);(!n||!n.render)&&(r.user=!0),P?P.push(r):R(r)}function p(e,t,n){n=n?Object.assign({},Y,n):Y;const r=K(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,R(r),Le.bind(r)}function Xt(e){return $(e,!1)}function A(e){if(m===null)return e();const t=m;m=null;try{return e()}finally{m=t}}function Yt(e,t,n){const r=Array.isArray(e);let s,o=n&&n.defer;return l=>{let i;if(r){i=Array(e.length);for(let a=0;a<e.length;a++)i[a]=e[a]()}else i=e();if(o)return o=!1,l;const c=A(()=>t(i,s,l));return s=i,c}}function Qt(e){ve(()=>A(e))}function G(e){return y===null||(y.cleanups===null?y.cleanups=[e]:y.cleanups.push(e)),e}function Ke(e,t){B||(B=Symbol("error")),y=K(void 0,void 0,!0),y.context={...y.context,[B]:[t]};try{return e()}catch(n){q(n)}finally{y=y.owner}}function Zt(){return m}function Ce(){return y}function qe(e,t){const n=y,r=m;y=e,m=null;try{return $(t,!0)}catch(s){q(s)}finally{y=n,m=r}}function en(e,t){const n=Symbol("context");return{id:n,Provider:Ye(n),defaultValue:e}}function tn(e){let t;return y&&y.context&&(t=y.context[e.id])!==void 0?t:e.defaultValue}function Ie(e){const t=p(e),n=p(()=>fe(t()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}function Le(){if(this.sources&&this.state)if(this.state===v)R(this);else{const e=F;F=null,$(()=>ee(this),!1),F=e}if(m){const e=this.observers?this.observers.length:0;m.sources?(m.sources.push(this),m.sourceSlots.push(e)):(m.sources=[this],m.sourceSlots=[e]),this.observers?(this.observers.push(m),this.observerSlots.push(m.sources.length-1)):(this.observers=[m],this.observerSlots=[m.sources.length-1])}return this.value}function Te(e,t,n){let r=e.value;return(!e.comparator||!e.comparator(r,t))&&(e.value=t,e.observers&&e.observers.length&&$(()=>{for(let s=0;s<e.observers.length;s+=1){const o=e.observers[s],l=oe&&oe.running;l&&oe.disposed.has(o),(l?!o.tState:!o.state)&&(o.pure?F.push(o):P.push(o),o.observers&&Me(o)),l||(o.state=v)}if(F.length>1e6)throw F=[],new Error},!1)),t}function R(e){if(!e.fn)return;V(e);const t=ne;ze(e,e.value,t)}function ze(e,t,n){let r;const s=y,o=m;m=y=e;try{r=e.fn(t)}catch(l){return e.pure&&(e.state=v,e.owned&&e.owned.forEach(V),e.owned=null),e.updatedAt=n+1,q(l)}finally{m=o,y=s}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Te(e,r):e.value=r,e.updatedAt=n)}function K(e,t,n,r=v,s){const o={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:y,context:y?y.context:null,pure:n};return y===null||y!==ke&&(y.owned?y.owned.push(o):y.owned=[o]),o}function Z(e){if(e.state===0)return;if(e.state===Q)return ee(e);if(e.suspense&&A(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<ne);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===v)R(e);else if(e.state===Q){const r=F;F=null,$(()=>ee(e,t[0]),!1),F=r}}function $(e,t){if(F)return e();let n=!1;t||(F=[]),P?n=!0:P=[],ne++;try{const r=e();return Je(n),r}catch(r){n||(P=null),F=null,q(r)}}function Je(e){if(F&&($e(F),F=null),e)return;const t=P;P=null,t.length&&$(()=>Ne(t),!1)}function $e(e){for(let t=0;t<e.length;t++)Z(e[t])}function We(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:Z(r)}if(g.context){if(g.count){g.effects||(g.effects=[]),g.effects.push(...e.slice(0,n));return}Be()}for(g.effects&&(g.done||!g.count)&&(e=[...g.effects,...e],n+=g.effects.length,delete g.effects),t=0;t<n;t++)Z(e[t])}function ee(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const r=e.sources[n];if(r.sources){const s=r.state;s===v?r!==t&&(!r.updatedAt||r.updatedAt<ne)&&Z(r):s===Q&&ee(r,t)}}}function Me(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=Q,n.pure?F.push(n):P.push(n),n.observers&&Me(n))}}function V(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),r=e.sourceSlots.pop(),s=n.observers;if(s&&s.length){const o=s.pop(),l=n.observerSlots.pop();r<s.length&&(o.sourceSlots[l]=r,s[r]=o,n.observerSlots[r]=l)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)V(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)V(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function Xe(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function pe(e,t,n){try{for(const r of t)r(e)}catch(r){q(r,n&&n.owner||null)}}function q(e,t=y){const n=B&&t&&t.context&&t.context[B],r=Xe(e);if(!n)throw r;P?P.push({fn(){pe(r,n,t)},state:v}):pe(r,n,t)}function fe(e){if(typeof e=="function"&&!e.length)return fe(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=fe(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function Ye(e,t){return function(r){let s;return T(()=>s=A(()=>(y.context={...y.context,[e]:r.value},Ie(()=>r.children))),void 0),s}}const ue=Symbol("fallback");function te(e){for(let t=0;t<e.length;t++)e[t]()}function Qe(e,t,n={}){let r=[],s=[],o=[],l=0,i=t.length>1?[]:null;return G(()=>te(o)),()=>{let c=e()||[],a=c.length,u,f;return c[Pe],A(()=>{let h,b,w,C,x,E,O,S,I;if(a===0)l!==0&&(te(o),o=[],r=[],s=[],l=0,i&&(i=[])),n.fallback&&(r=[ue],s[0]=L(U=>(o[0]=U,n.fallback())),l=1);else if(l===0){for(s=new Array(a),f=0;f<a;f++)r[f]=c[f],s[f]=L(d);l=a}else{for(w=new Array(a),C=new Array(a),i&&(x=new Array(a)),E=0,O=Math.min(l,a);E<O&&r[E]===c[E];E++);for(O=l-1,S=a-1;O>=E&&S>=E&&r[O]===c[S];O--,S--)w[S]=s[O],C[S]=o[O],i&&(x[S]=i[O]);for(h=new Map,b=new Array(S+1),f=S;f>=E;f--)I=c[f],u=h.get(I),b[f]=u===void 0?-1:u,h.set(I,f);for(u=E;u<=O;u++)I=r[u],f=h.get(I),f!==void 0&&f!==-1?(w[f]=s[u],C[f]=o[u],i&&(x[f]=i[u]),f=b[f],h.set(I,f)):o[u]();for(f=E;f<a;f++)f in w?(s[f]=w[f],o[f]=C[f],i&&(i[f]=x[f],i[f](f))):s[f]=L(d);s=s.slice(0,l=a),r=c.slice(0)}return s});function d(h){if(o[f]=h,i){const[b,w]=re(f);return i[f]=w,t(c[f],b)}return t(c[f])}}}function Ze(e,t,n={}){let r=[],s=[],o=[],l=[],i=0,c;return G(()=>te(o)),()=>{const a=e()||[],u=a.length;return a[Pe],A(()=>{if(u===0)return i!==0&&(te(o),o=[],r=[],s=[],i=0,l=[]),n.fallback&&(r=[ue],s[0]=L(d=>(o[0]=d,n.fallback())),i=1),s;for(r[0]===ue&&(o[0](),o=[],r=[],s=[],i=0),c=0;c<u;c++)c<r.length&&r[c]!==a[c]?l[c](()=>a[c]):c>=r.length&&(s[c]=L(f));for(;c<r.length;c++)o[c]();return i=l.length=o.length=u,r=a.slice(0),s=s.slice(0,i)});function f(d){o[c]=d;const[h,b]=re(a[c]);return l[c]=b,t(h,c)}}}function nn(e,t){return A(()=>e(t||{}))}function J(){return!0}const ae={get(e,t,n){return t===X?n:e.get(t)},has(e,t){return t===X?!0:e.has(t)},set:J,deleteProperty:J,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:J,deleteProperty:J}},ownKeys(e){return e.keys()}};function ie(e){return(e=typeof e=="function"?e():e)?e:{}}function et(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function rn(...e){let t=!1;for(let l=0;l<e.length;l++){const i=e[l];t=t||!!i&&X in i,e[l]=typeof i=="function"?(t=!0,p(i)):i}if(Oe&&t)return new Proxy({get(l){for(let i=e.length-1;i>=0;i--){const c=ie(e[i])[l];if(c!==void 0)return c}},has(l){for(let i=e.length-1;i>=0;i--)if(l in ie(e[i]))return!0;return!1},keys(){const l=[];for(let i=0;i<e.length;i++)l.push(...Object.keys(ie(e[i])));return[...new Set(l)]}},ae);const n={},r=Object.create(null);for(let l=e.length-1;l>=0;l--){const i=e[l];if(!i)continue;const c=Object.getOwnPropertyNames(i);for(let a=c.length-1;a>=0;a--){const u=c[a];if(u==="__proto__"||u==="constructor")continue;const f=Object.getOwnPropertyDescriptor(i,u);if(!r[u])r[u]=f.get?{enumerable:!0,configurable:!0,get:et.bind(n[u]=[f.get.bind(i)])}:f.value!==void 0?f:void 0;else{const d=n[u];d&&(f.get?d.push(f.get.bind(i)):f.value!==void 0&&d.push(()=>f.value))}}}const s={},o=Object.keys(r);for(let l=o.length-1;l>=0;l--){const i=o[l],c=r[i];c&&c.get?Object.defineProperty(s,i,c):s[i]=c?c.value:void 0}return s}function tt(e,...t){const n=t.length;if(Oe&&X in e){const s=n>1?t.flat():t[0],o=t.map(l=>new Proxy({get(i){return l.includes(i)?e[i]:void 0},has(i){return l.includes(i)&&i in e},keys(){return l.filter(i=>i in e)}},ae));return o.push(new Proxy({get(l){return s.includes(l)?void 0:e[l]},has(l){return s.includes(l)?!1:l in e},keys(){return Object.keys(e).filter(l=>!s.includes(l))}},ae)),o}const r=[];for(let s=0;s<=n;s++)r[s]={};for(const s of Object.getOwnPropertyNames(e)){let o=n;for(let c=0;c<t.length;c++)if(t[c].includes(s)){o=c;break}const l=Object.getOwnPropertyDescriptor(e,s);!l.get&&!l.set&&l.enumerable&&l.writable&&l.configurable?r[o][s]=l.value:Object.defineProperty(r[o],s,l)}return r}let nt=0;function sn(){return g.context?g.getNextContextId():`cl-${nt++}`}const De=e=>`Stale read from <${e}>.`;function on(e){const t="fallback"in e&&{fallback:()=>e.fallback};return p(Qe(()=>e.each,e.children,t||void 0))}function ln(e){const t="fallback"in e&&{fallback:()=>e.fallback};return p(Ze(()=>e.each,e.children,t||void 0))}function cn(e){const t=e.keyed,n=p(()=>e.when,void 0,void 0),r=t?n:p(n,void 0,{equals:(s,o)=>!s==!o});return p(()=>{const s=r();if(s){const o=e.children;return typeof o=="function"&&o.length>0?A(()=>o(t?s:()=>{if(!A(r))throw De("Show");return n()})):o}return e.fallback},void 0,void 0)}function fn(e){const t=Ie(()=>e.children),n=p(()=>{const r=t(),s=Array.isArray(r)?r:[r];let o=()=>{};for(let l=0;l<s.length;l++){const i=l,c=s[l],a=o,u=p(()=>a()?void 0:c.when,void 0,void 0),f=c.keyed?u:p(u,void 0,{equals:(d,h)=>!d==!h});o=()=>a()||(f()?[i,u,c]:void 0)}return o});return p(()=>{const r=n()();if(!r)return e.fallback;const[s,o,l]=r,i=l.children;return typeof i=="function"&&i.length>0?A(()=>i(l.keyed?o():()=>{var a;if(((a=A(n)())==null?void 0:a[0])!==s)throw De("Match");return o()})):i},void 0,void 0)}function un(e){return e}let W;function an(e){let t;g.context&&g.load&&(t=g.load(g.getContextId()));const[n,r]=re(t,void 0);return W||(W=new Set),W.add(r),G(()=>W.delete(r)),p(()=>{let s;if(s=n()){const o=e.fallback;return typeof o=="function"&&o.length?A(()=>o(s,()=>r())):o}return Ke(()=>e.children,r)},void 0,void 0)}const rt=["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"],st=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...rt]),ot=new Set(["innerHTML","textContent","innerText","children"]),it=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),lt=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function ct(e,t){const n=lt[e];return typeof n=="object"?n[t]?n.$:void 0:n}const ft=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),ut=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),at={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},dn=e=>p(()=>e());function dt(e,t,n){let r=n.length,s=t.length,o=r,l=0,i=0,c=t[s-1].nextSibling,a=null;for(;l<s||i<o;){if(t[l]===n[i]){l++,i++;continue}for(;t[s-1]===n[o-1];)s--,o--;if(s===l){const u=o<r?i?n[i-1].nextSibling:n[o-i]:c;for(;i<o;)e.insertBefore(n[i++],u)}else if(o===i)for(;l<s;)(!a||!a.has(t[l]))&&t[l].remove(),l++;else if(t[l]===n[o-1]&&n[i]===t[s-1]){const u=t[--s].nextSibling;e.insertBefore(n[i++],t[l++].nextSibling),e.insertBefore(n[--o],u),t[s]=n[o]}else{if(!a){a=new Map;let f=i;for(;f<o;)a.set(n[f],f++)}const u=a.get(t[l]);if(u!=null)if(i<u&&u<o){let f=l,d=1,h;for(;++f<s&&f<o&&!((h=a.get(t[f]))==null||h!==u+d);)d++;if(d>u-i){const b=t[l];for(;i<u;)e.insertBefore(n[i++],b)}else e.replaceChild(n[i++],t[l++])}else l++;else t[l++].remove()}}}const Ae="_$DX_DELEGATE";function hn(e,t,n,r={}){let s;return L(o=>{s=o,t===document?e():he(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{s(),t.textContent=""}}function gn(e,t,n,r){let s;const o=()=>{const i=r?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return i.innerHTML=e,n?i.content.firstChild.firstChild:r?i.firstChild:i.content.firstChild},l=t?()=>A(()=>document.importNode(s||(s=o()),!0)):()=>(s||(s=o())).cloneNode(!0);return l.cloneNode=l,l}function ht(e,t=window.document){const n=t[Ae]||(t[Ae]=new Set);for(let r=0,s=e.length;r<s;r++){const o=e[r];n.has(o)||(n.add(o),t.addEventListener(o,xt))}}function de(e,t,n){M(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function gt(e,t,n,r){M(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function yt(e,t,n){M(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function mt(e,t){M(e)||(t==null?e.removeAttribute("class"):e.className=t)}function wt(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const s=n[0];e.addEventListener(t,n[0]=o=>s.call(e,n[1],o))}else e.addEventListener(t,n,typeof n!="function"&&n)}function bt(e,t,n={}){const r=Object.keys(t||{}),s=Object.keys(n);let o,l;for(o=0,l=s.length;o<l;o++){const i=s[o];!i||i==="undefined"||t[i]||(Fe(e,i,!1),delete n[i])}for(o=0,l=r.length;o<l;o++){const i=r[o],c=!!t[i];!i||i==="undefined"||n[i]===c||!c||(Fe(e,i,!0),n[i]=c)}return n}function Ct(e,t,n){if(!t)return n?de(e,"style"):t;const r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let s,o;for(o in n)t[o]==null&&r.removeProperty(o),delete n[o];for(o in t)s=t[o],s!==n[o]&&(r.setProperty(o,s),n[o]=s);return n}function yn(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function pt(e,t={},n,r){const s={};return r||T(()=>s.children=H(e,t.children,s.children)),T(()=>typeof t.ref=="function"&&At(t.ref,e)),T(()=>Ft(e,t,n,!0,s,!0)),s}function At(e,t,n){return A(()=>e(t,n))}function he(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return H(e,t,r,n);T(s=>H(e,t(),s,n),r)}function Ft(e,t,n,r,s={},o=!1){t||(t={});for(const l in s)if(!(l in t)){if(l==="children")continue;s[l]=Ee(e,l,null,s[l],n,o,t)}for(const l in t){if(l==="children")continue;const i=t[l];s[l]=Ee(e,l,i,s[l],n,o,t)}}function Et(e){let t,n;return!M()||!(t=g.registry.get(n=Ot()))?e():(g.completed&&g.completed.add(t),g.registry.delete(n),t)}function M(e){return!!g.context&&!g.done&&(!e||e.isConnected)}function St(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Fe(e,t,n){const r=t.trim().split(/\s+/);for(let s=0,o=r.length;s<o;s++)e.classList.toggle(r[s],n)}function Ee(e,t,n,r,s,o,l){let i,c,a,u,f;if(t==="style")return Ct(e,n,r);if(t==="classList")return bt(e,n,r);if(n===r)return r;if(t==="ref")o||n(e);else if(t.slice(0,3)==="on:"){const d=t.slice(3);r&&e.removeEventListener(d,r,typeof r!="function"&&r),n&&e.addEventListener(d,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const d=t.slice(10);r&&e.removeEventListener(d,r,!0),n&&e.addEventListener(d,n,!0)}else if(t.slice(0,2)==="on"){const d=t.slice(2).toLowerCase(),h=ft.has(d);if(!h&&r){const b=Array.isArray(r)?r[0]:r;e.removeEventListener(d,b)}(h||n)&&(wt(e,d,n,h),h&&ht([d]))}else if(t.slice(0,5)==="attr:")de(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")yt(e,t.slice(5),n);else if((f=t.slice(0,5)==="prop:")||(a=ot.has(t))||!s&&((u=ct(t,e.tagName))||(c=st.has(t)))||(i=e.nodeName.includes("-")||"is"in l)){if(f)t=t.slice(5),c=!0;else if(M(e))return n;t==="class"||t==="className"?mt(e,n):i&&!c&&!a?e[St(t)]=n:e[u||t]=n}else{const d=s&&t.indexOf(":")>-1&&at[t.split(":")[0]];d?gt(e,d,t,n):de(e,it[t]||t,n)}return n}function xt(e){if(g.registry&&g.events&&g.events.find(([c,a])=>a===e))return;let t=e.target;const n=`$$${e.type}`,r=e.target,s=e.currentTarget,o=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),l=()=>{const c=t[n];if(c&&!t.disabled){const a=t[`${n}Data`];if(a!==void 0?c.call(t,a,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&o(t.host),!0},i=()=>{for(;l()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),g.registry&&!g.done&&(g.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();o(c[0]);for(let a=0;a<c.length-2&&(t=c[a],!!l());a++){if(t._$host){t=t._$host,i();break}if(t.parentNode===s)break}}else i();o(r)}function H(e,t,n,r,s){const o=M(e);if(o){!n&&(n=[...e.childNodes]);let c=[];for(let a=0;a<n.length;a++){const u=n[a];u.nodeType===8&&u.data.slice(0,2)==="!$"?u.remove():c.push(u)}n=c}for(;typeof n=="function";)n=n();if(t===n)return n;const l=typeof t,i=r!==void 0;if(e=i&&n[0]&&n[0].parentNode||e,l==="string"||l==="number"){if(o||l==="number"&&(t=t.toString(),t===n))return n;if(i){let c=n[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),n=D(e,n,r,c)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||l==="boolean"){if(o)return n;n=D(e,n,r)}else{if(l==="function")return T(()=>{let c=t();for(;typeof c=="function";)c=c();n=H(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],a=n&&Array.isArray(n);if(ge(c,t,n,s))return T(()=>n=H(e,c,n,r,!0)),()=>n;if(o){if(!c.length)return n;if(r===void 0)return n=[...e.childNodes];let u=c[0];if(u.parentNode!==e)return n;const f=[u];for(;(u=u.nextSibling)!==r;)f.push(u);return n=f}if(c.length===0){if(n=D(e,n,r),i)return n}else a?n.length===0?Se(e,c,r):dt(e,n,c):(n&&D(e),Se(e,c));n=c}else if(t.nodeType){if(o&&t.parentNode)return n=i?[t]:t;if(Array.isArray(n)){if(i)return n=D(e,n,r,t);D(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function ge(e,t,n,r){let s=!1;for(let o=0,l=t.length;o<l;o++){let i=t[o],c=n&&n[e.length],a;if(!(i==null||i===!0||i===!1))if((a=typeof i)=="object"&&i.nodeType)e.push(i);else if(Array.isArray(i))s=ge(e,i,c)||s;else if(a==="function")if(r){for(;typeof i=="function";)i=i();s=ge(e,Array.isArray(i)?i:[i],Array.isArray(c)?c:[c])||s}else e.push(i),s=!0;else{const u=String(i);c&&c.nodeType===3&&c.data===u?e.push(c):e.push(document.createTextNode(u))}}return s}function Se(e,t,n=null){for(let r=0,s=t.length;r<s;r++)e.insertBefore(t[r],n)}function D(e,t,n,r){if(n===void 0)return e.textContent="";const s=r||document.createTextNode("");if(t.length){let o=!1;for(let l=t.length-1;l>=0;l--){const i=t[l];if(s!==i){const c=i.parentNode===e;!o&&!l?c?e.replaceChild(s,i):e.insertBefore(s,n):c&&i.remove()}else o=!0}}else e.insertBefore(s,n);return[s]}function Ot(){return g.getNextContextId()}const Pt="http://www.w3.org/2000/svg";function je(e,t=!1,n=void 0){return t?document.createElementNS(Pt,e):document.createElement(e,{is:n})}function mn(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,s=Ce();let o,l=!!g.context;return ve(()=>{l&&(Ce().user=l=!1),o||(o=qe(s,()=>p(()=>e.children)));const i=r();if(i instanceof HTMLHeadElement){const[c,a]=re(!1),u=()=>a(!0);L(f=>he(i,()=>c()?f():o(),null)),G(u)}else{const c=je(e.isSVG?"g":"div",e.isSVG),a=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),he(a,o),i.appendChild(c),e.ref&&e.ref(c),G(()=>i.removeChild(c))}},void 0,{render:!l}),n}function Nt(e,t){const n=p(e);return p(()=>{const r=n();switch(typeof r){case"function":return A(()=>r(t));case"string":const s=ut.has(r),o=g.context?Et():je(r,s,A(()=>t.is));return pt(o,t,s),o}})}function wn(e){const[,t]=tt(e,["component"]);return Nt(()=>e.component,t)}function kt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ye={exports:{}},le,xe;function vt(){if(xe)return le;xe=1;var e=1e3,t=e*60,n=t*60,r=n*24,s=r*7,o=r*365.25;le=function(u,f){f=f||{};var d=typeof u;if(d==="string"&&u.length>0)return l(u);if(d==="number"&&isFinite(u))return f.long?c(u):i(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function l(u){if(u=String(u),!(u.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(f){var d=parseFloat(f[1]),h=(f[2]||"ms").toLowerCase();switch(h){case"years":case"year":case"yrs":case"yr":case"y":return d*o;case"weeks":case"week":case"w":return d*s;case"days":case"day":case"d":return d*r;case"hours":case"hour":case"hrs":case"hr":case"h":return d*n;case"minutes":case"minute":case"mins":case"min":case"m":return d*t;case"seconds":case"second":case"secs":case"sec":case"s":return d*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}}}function i(u){var f=Math.abs(u);return f>=r?Math.round(u/r)+"d":f>=n?Math.round(u/n)+"h":f>=t?Math.round(u/t)+"m":f>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var f=Math.abs(u);return f>=r?a(u,f,r,"day"):f>=n?a(u,f,n,"hour"):f>=t?a(u,f,t,"minute"):f>=e?a(u,f,e,"second"):u+" ms"}function a(u,f,d,h){var b=f>=d*1.5;return Math.round(u/d)+" "+h+(b?"s":"")}return le}function It(e){n.debug=n,n.default=n,n.coerce=c,n.disable=l,n.enable=s,n.enabled=i,n.humanize=vt(),n.destroy=a,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let f=0;for(let d=0;d<u.length;d++)f=(f<<5)-f+u.charCodeAt(d),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=t;function n(u){let f,d=null,h,b;function w(...C){if(!w.enabled)return;const x=w,E=Number(new Date),O=E-(f||E);x.diff=O,x.prev=f,x.curr=E,f=E,C[0]=n.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let S=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(U,_e)=>{if(U==="%%")return"%";S++;const we=n.formatters[_e];if(typeof we=="function"){const Ue=C[S];U=we.call(x,Ue),C.splice(S,1),S--}return U}),n.formatArgs.call(x,C),(x.log||n.log).apply(x,C)}return w.namespace=u,w.useColors=n.useColors(),w.color=n.selectColor(u),w.extend=r,w.destroy=n.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==n.namespaces&&(h=n.namespaces,b=n.enabled(u)),b),set:C=>{d=C}}),typeof n.init=="function"&&n.init(w),w}function r(u,f){const d=n(this.namespace+(typeof f>"u"?":":f)+u);return d.log=this.log,d}function s(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];const f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const d of f)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function o(u,f){let d=0,h=0,b=-1,w=0;for(;d<u.length;)if(h<f.length&&(f[h]===u[d]||f[h]==="*"))f[h]==="*"?(b=h,w=d,h++):(d++,h++);else if(b!==-1)h=b+1,w++,d=w;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===f.length}function l(){const u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}function i(u){for(const f of n.skips)if(o(u,f))return!1;for(const f of n.names)if(o(u,f))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function a(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var Lt=It;(function(e,t){var n={};t.formatArgs=s,t.save=o,t.load=l,t.useColors=r,t.storage=i(),t.destroy=(()=>{let a=!1;return()=>{a||(a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let a;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(a=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(a[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;a.splice(1,0,u,"color: inherit");let f=0,d=0;a[0].replace(/%[a-zA-Z%]/g,h=>{h!=="%%"&&(f++,h==="%c"&&(d=f))}),a.splice(d,0,u)}t.log=console.debug||console.log||(()=>{});function o(a){try{a?t.storage.setItem("debug",a):t.storage.removeItem("debug")}catch{}}function l(){let a;try{a=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!a&&typeof process<"u"&&"env"in process&&(a=n.DEBUG),a}function i(){try{return localStorage}catch{}}e.exports=Lt(t);const{formatters:c}=e.exports;c.j=function(a){try{return JSON.stringify(a)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(ye,ye.exports);var Tt=ye.exports;const me=kt(Tt),_=["sse","api","session","actions"],Re="opencode:logger:namespaces",ce=new Map,N=new Set,k=typeof globalThis<"u"?globalThis.console:void 0;function z(){N.size===0?me.disable():me.enable(Array.from(N).join(","))}function se(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Re,JSON.stringify(Array.from(N)))}catch(t){(e=k==null?void 0:k.warn)==null||e.call(k,"Failed to persist logger namespaces",t)}}function $t(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Re);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)_.includes(r)&&N.add(r)}catch(t){(e=k==null?void 0:k.warn)==null||e.call(k,"Failed to hydrate logger namespaces",t)}}$t();z();function Mt(e){const n=me(e),r=(s,o)=>{n(s,...o)};return{log:(...s)=>n(...s),info:(...s)=>n(...s),warn:(...s)=>r("[warn]",s),error:(...s)=>r("[error]",s)}}function Dt(e){if(!_.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return ce.has(e)||ce.set(e,Mt(e)),ce.get(e)}function jt(){return _.map(e=>({name:e,enabled:N.has(e)}))}function Rt(e){if(!_.includes(e))throw new Error(`Unknown logger namespace: ${e}`);N.has(e)||(N.add(e),se(),z())}function _t(e){if(!_.includes(e))throw new Error(`Unknown logger namespace: ${e}`);N.has(e)&&(N.delete(e),se(),z())}function Ut(){N.clear(),se(),z()}function Bt(){_.forEach(e=>N.add(e)),se(),z()}const Gt={listLoggerNamespaces:jt,enableLogger:Rt,disableLogger:_t,enableAllLoggers:Bt,disableAllLoggers:Ut};function Vt(){typeof window>"u"||(window.codenomadLogger=Gt)}Vt();function Ht(){if(typeof window>"u")return"web";const e=window;return typeof e.electronAPI<"u"?"electron":typeof e.__TAURI__<"u"||typeof navigator<"u"&&/tauri/i.test(navigator.userAgent)?"tauri":"web"}function Kt(){if(typeof navigator>"u")return"desktop";const e=navigator.userAgentData;if(e!=null&&e.mobile)return"mobile";const t=navigator.userAgent.toLowerCase();return/android|iphone|ipad|ipod|blackberry|mini|windows phone|mobile|silk/.test(t)?"mobile":"desktop"}const qt=Dt("actions");let j=null;function zt(){return j||(j={host:Ht(),platform:Kt()},typeof window<"u"&&qt.info(`[runtime] host=${j.host} platform=${j.platform}`),j)}const Jt=zt(),bn=()=>Jt.host==="tauri";export{Pe as $,de as A,ht as B,yn as C,wn as D,Dt as E,on as F,wt as G,Jt as H,kt as I,g as J,an as K,Wt as L,un as M,Ie as N,ln as O,mn as P,hn as Q,bn as R,cn as S,T as a,p as b,ve as c,L as d,re as e,nn as f,Qt as g,Yt as h,en as i,tn as j,dn as k,sn as l,rn as m,X as n,G as o,Xt as p,Zt as q,he as r,tt as s,gn as t,A as u,Ct as v,mt as w,fn as x,pt as y,At as z};